From 5c37c2c688a4a3712ecaccd3164ecea6cf1d4af6 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 24 Aug 2023 20:57:01 +0000 Subject: [PATCH 1/2] fix: simplify logic for HTTP/1.1 REST fallback option For the `fallback` parameter, all values considered as `true` in Boolean context will enable HTTP/1.1 REST fallback, since the other fallback transport, proto over HTTP, is removed from `google-gax` v4. PiperOrigin-RevId: 559812260 Source-Link: https://github.com/googleapis/googleapis/commit/6a6fd29a79fe2846001d90d93e79a19fcc303b85 Source-Link: https://github.com/googleapis/googleapis-gen/commit/56c16657e7a59122b1da94771a9ef40989c282c0 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWZ1bmN0aW9ucy8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWdrZWJhY2t1cC8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWdrZWNvbm5lY3QtZ2F0ZXdheS8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWdrZWh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWdrZW11bHRpY2xvdWQvLk93bEJvdC55YW1sIiwiaCI6IjU2YzE2NjU3ZTdhNTkxMjJiMWRhOTQ3NzFhOWVmNDA5ODljMjgyYzAifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWdzdWl0ZWFkZG9ucy8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWlhcC8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWlkcy8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWlvdC8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWttcy1pbnZlbnRvcnkvLk93bEJvdC55YW1sIiwiaCI6IjU2YzE2NjU3ZTdhNTkxMjJiMWRhOTQ3NzFhOWVmNDA5ODljMjgyYzAifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWttcy8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWxhbmd1YWdlLy5Pd2xCb3QueWFtbCIsImgiOiI1NmMxNjY1N2U3YTU5MTIyYjFkYTk0NzcxYTllZjQwOTg5YzI4MmMwIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWxpZmVzY2llbmNlcy8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW1hbmFnZWRpZGVudGl0aWVzLy5Pd2xCb3QueWFtbCIsImgiOiI1NmMxNjY1N2U3YTU5MTIyYjFkYTk0NzcxYTllZjQwOTg5YzI4MmMwIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW1lZGlhdHJhbnNsYXRpb24vLk93bEJvdC55YW1sIiwiaCI6IjU2YzE2NjU3ZTdhNTkxMjJiMWRhOTQ3NzFhOWVmNDA5ODljMjgyYzAifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW1lbWNhY2hlLy5Pd2xCb3QueWFtbCIsImgiOiI1NmMxNjY1N2U3YTU5MTIyYjFkYTk0NzcxYTllZjQwOTg5YzI4MmMwIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW1ldGFzdG9yZS8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW1pZ3JhdGlvbmNlbnRlci8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW5ldHdvcmtjb25uZWN0aXZpdHkvLk93bEJvdC55YW1sIiwiaCI6IjU2YzE2NjU3ZTdhNTkxMjJiMWRhOTQ3NzFhOWVmNDA5ODljMjgyYzAifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW5ldHdvcmttYW5hZ2VtZW50Ly5Pd2xCb3QueWFtbCIsImgiOiI1NmMxNjY1N2U3YTU5MTIyYjFkYTk0NzcxYTllZjQwOTg5YzI4MmMwIn0= --- .../google-cloud-functions/v1/.eslintignore | 7 + .../google-cloud-functions/v1/.eslintrc.json | 3 + .../google-cloud-functions/v1/.gitignore | 14 + .../google-cloud-functions/v1/.jsdoc.js | 55 + .../google-cloud-functions/v1/.mocharc.js | 33 + .../google-cloud-functions/v1/.prettierrc.js | 22 + .../google-cloud-functions/v1/README.md | 1 + .../google-cloud-functions/v1/package.json | 58 + .../google/cloud/functions/v1/functions.proto | 866 ++ .../cloud/functions/v1/operations.proto | 73 + .../cloud_functions_service.call_function.js | 66 + ...cloud_functions_service.create_function.js | 68 + ...cloud_functions_service.delete_function.js | 62 + ...functions_service.generate_download_url.js | 66 + ...d_functions_service.generate_upload_url.js | 79 + .../cloud_functions_service.get_function.js | 61 + .../cloud_functions_service.get_iam_policy.js | 67 + .../cloud_functions_service.list_functions.js | 78 + .../cloud_functions_service.set_iam_policy.js | 77 + ..._functions_service.test_iam_permissions.js | 70 + ...cloud_functions_service.update_function.js | 66 + ...et_metadata_google.cloud.functions.v1.json | 499 + .../google-cloud-functions/v1/src/index.ts | 25 + .../src/v1/cloud_functions_service_client.ts | 1881 ++++ ...cloud_functions_service_client_config.json | 76 + .../cloud_functions_service_proto_list.json | 4 + .../v1/src/v1/gapic_metadata.json | 137 + .../google-cloud-functions/v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../test/gapic_cloud_functions_service_v1.ts | 2288 +++++ .../google-cloud-functions/v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../google-cloud-functions/v2/.eslintignore | 7 + .../google-cloud-functions/v2/.eslintrc.json | 3 + .../google-cloud-functions/v2/.gitignore | 14 + .../google-cloud-functions/v2/.jsdoc.js | 55 + .../google-cloud-functions/v2/.mocharc.js | 33 + .../google-cloud-functions/v2/.prettierrc.js | 22 + .../google-cloud-functions/v2/README.md | 1 + .../google-cloud-functions/v2/package.json | 58 + .../google/cloud/functions/v2/functions.proto | 1147 +++ .../v2/function_service.create_function.js | 75 + .../v2/function_service.delete_function.js | 62 + .../function_service.generate_download_url.js | 62 + .../function_service.generate_upload_url.js | 78 + .../v2/function_service.get_function.js | 61 + .../v2/function_service.list_functions.js | 93 + .../v2/function_service.list_runtimes.js | 67 + .../v2/function_service.update_function.js | 68 + ...et_metadata_google.cloud.functions.v2.json | 371 + .../google-cloud-functions/v2/src/index.ts | 25 + .../v2/src/v2/function_service_client.ts | 2197 +++++ .../v2/function_service_client_config.json | 58 + .../src/v2/function_service_proto_list.json | 3 + .../v2/src/v2/gapic_metadata.json | 107 + .../google-cloud-functions/v2/src/v2/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v2/system-test/install.ts | 49 + .../v2/test/gapic_function_service_v2.ts | 2584 +++++ .../google-cloud-functions/v2/tsconfig.json | 19 + .../v2/webpack.config.js | 64 + .../v2alpha/.eslintignore | 7 + .../v2alpha/.eslintrc.json | 3 + .../google-cloud-functions/v2alpha/.gitignore | 14 + .../google-cloud-functions/v2alpha/.jsdoc.js | 55 + .../v2alpha/.mocharc.js | 33 + .../v2alpha/.prettierrc.js | 22 + .../google-cloud-functions/v2alpha/README.md | 1 + .../v2alpha/package.json | 58 + .../cloud/functions/v2alpha/functions.proto | 1147 +++ .../function_service.create_function.js | 75 + .../function_service.delete_function.js | 62 + .../function_service.generate_download_url.js | 62 + .../function_service.generate_upload_url.js | 78 + .../v2alpha/function_service.get_function.js | 61 + .../function_service.list_functions.js | 93 + .../v2alpha/function_service.list_runtimes.js | 67 + .../function_service.update_function.js | 68 + ...tadata_google.cloud.functions.v2alpha.json | 371 + .../v2alpha/src/index.ts | 25 + .../src/v2alpha/function_service_client.ts | 2197 +++++ .../function_service_client_config.json | 58 + .../v2alpha/function_service_proto_list.json | 3 + .../v2alpha/src/v2alpha/gapic_metadata.json | 107 + .../v2alpha/src/v2alpha/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v2alpha/system-test/install.ts | 49 + .../test/gapic_function_service_v2alpha.ts | 2584 +++++ .../v2alpha/tsconfig.json | 19 + .../v2alpha/webpack.config.js | 64 + .../v2beta/.eslintignore | 7 + .../v2beta/.eslintrc.json | 3 + .../google-cloud-functions/v2beta/.gitignore | 14 + .../google-cloud-functions/v2beta/.jsdoc.js | 55 + .../google-cloud-functions/v2beta/.mocharc.js | 33 + .../v2beta/.prettierrc.js | 22 + .../google-cloud-functions/v2beta/README.md | 1 + .../v2beta/package.json | 58 + .../cloud/functions/v2beta/functions.proto | 1147 +++ .../function_service.create_function.js | 75 + .../function_service.delete_function.js | 62 + .../function_service.generate_download_url.js | 62 + .../function_service.generate_upload_url.js | 78 + .../v2beta/function_service.get_function.js | 61 + .../v2beta/function_service.list_functions.js | 93 + .../v2beta/function_service.list_runtimes.js | 67 + .../function_service.update_function.js | 68 + ...etadata_google.cloud.functions.v2beta.json | 371 + .../v2beta/src/index.ts | 25 + .../src/v2beta/function_service_client.ts | 2197 +++++ .../function_service_client_config.json | 58 + .../v2beta/function_service_proto_list.json | 3 + .../v2beta/src/v2beta/gapic_metadata.json | 107 + .../v2beta/src/v2beta/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v2beta/system-test/install.ts | 49 + .../test/gapic_function_service_v2beta.ts | 2584 +++++ .../v2beta/tsconfig.json | 19 + .../v2beta/webpack.config.js | 64 + .../google-cloud-gkebackup/v1/.eslintignore | 7 + .../google-cloud-gkebackup/v1/.eslintrc.json | 3 + .../google-cloud-gkebackup/v1/.gitignore | 14 + .../google-cloud-gkebackup/v1/.jsdoc.js | 55 + .../google-cloud-gkebackup/v1/.mocharc.js | 33 + .../google-cloud-gkebackup/v1/.prettierrc.js | 22 + .../google-cloud-gkebackup/v1/README.md | 1 + .../google-cloud-gkebackup/v1/package.json | 58 + .../google/cloud/gkebackup/v1/backup.proto | 242 + .../cloud/gkebackup/v1/backup_plan.proto | 238 + .../google/cloud/gkebackup/v1/common.proto | 58 + .../google/cloud/gkebackup/v1/gkebackup.proto | 960 ++ .../google/cloud/gkebackup/v1/restore.proto | 494 + .../cloud/gkebackup/v1/restore_plan.proto | 130 + .../google/cloud/gkebackup/v1/volume.proto | 231 + .../v1/backup_for_g_k_e.create_backup.js | 77 + .../v1/backup_for_g_k_e.create_backup_plan.js | 79 + .../v1/backup_for_g_k_e.create_restore.js | 79 + .../backup_for_g_k_e.create_restore_plan.js | 79 + .../v1/backup_for_g_k_e.delete_backup.js | 75 + .../v1/backup_for_g_k_e.delete_backup_plan.js | 69 + .../v1/backup_for_g_k_e.delete_restore.js | 75 + .../backup_for_g_k_e.delete_restore_plan.js | 75 + .../v1/backup_for_g_k_e.get_backup.js | 62 + .../v1/backup_for_g_k_e.get_backup_plan.js | 62 + .../v1/backup_for_g_k_e.get_restore.js | 62 + .../v1/backup_for_g_k_e.get_restore_plan.js | 62 + .../v1/backup_for_g_k_e.get_volume_backup.js | 62 + .../v1/backup_for_g_k_e.get_volume_restore.js | 62 + .../v1/backup_for_g_k_e.list_backup_plans.js | 90 + .../v1/backup_for_g_k_e.list_backups.js | 90 + .../v1/backup_for_g_k_e.list_restore_plans.js | 90 + .../v1/backup_for_g_k_e.list_restores.js | 90 + .../backup_for_g_k_e.list_volume_backups.js | 90 + .../backup_for_g_k_e.list_volume_restores.js | 90 + .../v1/backup_for_g_k_e.update_backup.js | 74 + .../v1/backup_for_g_k_e.update_backup_plan.js | 75 + .../v1/backup_for_g_k_e.update_restore.js | 74 + .../backup_for_g_k_e.update_restore_plan.js | 74 + ...et_metadata_google.cloud.gkebackup.v1.json | 1147 +++ .../google-cloud-gkebackup/v1/src/index.ts | 25 + .../v1/src/v1/backup_for_g_k_e_client.ts | 4191 ++++++++ .../v1/backup_for_g_k_e_client_config.json | 158 + .../src/v1/backup_for_g_k_e_proto_list.json | 9 + .../v1/src/v1/gapic_metadata.json | 287 + .../google-cloud-gkebackup/v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_backup_for_g_k_e_v1.ts | 5257 ++++++++++ .../google-cloud-gkebackup/v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1beta1/.eslintignore | 7 + .../v1beta1/.eslintrc.json | 3 + .../v1beta1/.gitignore | 14 + .../v1beta1/.jsdoc.js | 55 + .../v1beta1/.mocharc.js | 33 + .../v1beta1/.prettierrc.js | 22 + .../v1beta1/README.md | 1 + .../v1beta1/package.json | 58 + .../gkeconnect/gateway/v1beta1/gateway.proto | 75 + .../gateway_service.delete_resource.js | 69 + .../v1beta1/gateway_service.get_resource.js | 69 + .../v1beta1/gateway_service.patch_resource.js | 69 + .../v1beta1/gateway_service.post_resource.js | 69 + .../v1beta1/gateway_service.put_resource.js | 69 + ...ogle.cloud.gkeconnect.gateway.v1beta1.json | 255 + .../v1beta1/src/index.ts | 25 + .../v1beta1/src/v1beta1/gapic_metadata.json | 73 + .../src/v1beta1/gateway_service_client.ts | 657 ++ .../gateway_service_client_config.json | 46 + .../v1beta1/gateway_service_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 + .../test/gapic_gateway_service_v1beta1.ts | 525 + .../v1beta1/tsconfig.json | 19 + .../v1beta1/webpack.config.js | 64 + .../google-cloud-gkehub/v1/.eslintignore | 7 + .../google-cloud-gkehub/v1/.eslintrc.json | 3 + .../google-cloud-gkehub/v1/.gitignore | 14 + .../google-cloud-gkehub/v1/.jsdoc.js | 55 + .../google-cloud-gkehub/v1/.mocharc.js | 33 + .../google-cloud-gkehub/v1/.prettierrc.js | 22 + .../google-cloud-gkehub/v1/README.md | 1 + .../google-cloud-gkehub/v1/package.json | 58 + .../configmanagement/configmanagement.proto | 382 + .../google/cloud/gkehub/v1/feature.proto | 198 + .../google/cloud/gkehub/v1/membership.proto | 348 + .../multiclusteringress.proto | 33 + .../google/cloud/gkehub/v1/service.proto | 648 ++ .../generated/v1/gke_hub.create_feature.js | 84 + .../generated/v1/gke_hub.create_membership.js | 93 + .../generated/v1/gke_hub.delete_feature.js | 82 + .../generated/v1/gke_hub.delete_membership.js | 83 + .../v1/gke_hub.generate_connect_manifest.js | 97 + .../generated/v1/gke_hub.get_feature.js | 61 + .../generated/v1/gke_hub.get_membership.js | 62 + .../generated/v1/gke_hub.list_features.js | 92 + .../generated/v1/gke_hub.list_memberships.js | 96 + .../generated/v1/gke_hub.update_feature.js | 91 + .../generated/v1/gke_hub.update_membership.js | 94 + ...ippet_metadata_google.cloud.gkehub.v1.json | 575 ++ .../google-cloud-gkehub/v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 141 + .../v1/src/v1/gke_hub_client.ts | 2006 ++++ .../v1/src/v1/gke_hub_client_config.json | 93 + .../v1/src/v1/gke_hub_proto_list.json | 7 + .../google-cloud-gkehub/v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_gke_hub_v1.ts | 2114 ++++ .../google-cloud-gkehub/v1/tsconfig.json | 19 + .../google-cloud-gkehub/v1/webpack.config.js | 64 + .../google-cloud-gkehub/v1alpha/.eslintignore | 7 + .../v1alpha/.eslintrc.json | 3 + .../google-cloud-gkehub/v1alpha/.gitignore | 14 + .../google-cloud-gkehub/v1alpha/.jsdoc.js | 55 + .../google-cloud-gkehub/v1alpha/.mocharc.js | 33 + .../v1alpha/.prettierrc.js | 22 + .../google-cloud-gkehub/v1alpha/README.md | 1 + .../google-cloud-gkehub/v1alpha/package.json | 58 + .../cloudauditlogging/cloudauditlogging.proto | 36 + .../configmanagement/configmanagement.proto | 415 + .../google/cloud/gkehub/v1alpha/feature.proto | 215 + .../gkehub/v1alpha/metering/metering.proto | 38 + .../multiclusteringress.proto | 49 + .../google/cloud/gkehub/v1alpha/service.proto | 280 + .../v1alpha/servicemesh/servicemesh.proto | 114 + .../v1alpha/gke_hub.create_feature.js | 84 + .../v1alpha/gke_hub.delete_feature.js | 82 + .../generated/v1alpha/gke_hub.get_feature.js | 61 + .../v1alpha/gke_hub.list_features.js | 92 + .../v1alpha/gke_hub.update_feature.js | 91 + ..._metadata_google.cloud.gkehub.v1alpha.json | 263 + .../google-cloud-gkehub/v1alpha/src/index.ts | 25 + .../v1alpha/src/v1alpha/gapic_metadata.json | 77 + .../v1alpha/src/v1alpha/gke_hub_client.ts | 1084 ++ .../src/v1alpha/gke_hub_client_config.json | 63 + .../src/v1alpha/gke_hub_proto_list.json | 9 + .../v1alpha/src/v1alpha/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1alpha/system-test/install.ts | 49 + .../v1alpha/test/gapic_gke_hub_v1alpha.ts | 1077 ++ .../google-cloud-gkehub/v1alpha/tsconfig.json | 19 + .../v1alpha/webpack.config.js | 64 + .../v1alpha2/.eslintignore | 7 + .../v1alpha2/.eslintrc.json | 3 + .../google-cloud-gkehub/v1alpha2/.gitignore | 14 + .../google-cloud-gkehub/v1alpha2/.jsdoc.js | 55 + .../google-cloud-gkehub/v1alpha2/.mocharc.js | 33 + .../v1alpha2/.prettierrc.js | 22 + .../google-cloud-gkehub/v1alpha2/README.md | 1 + .../google-cloud-gkehub/v1alpha2/package.json | 58 + .../cloud/gkehub/v1alpha2/membership.proto | 713 ++ .../v1alpha2/gke_hub.create_membership.js | 79 + .../v1alpha2/gke_hub.delete_membership.js | 63 + .../gke_hub.generate_connect_manifest.js | 95 + .../v1alpha2/gke_hub.get_membership.js | 62 + .../v1alpha2/gke_hub.initialize_hub.js | 62 + .../v1alpha2/gke_hub.list_memberships.js | 95 + .../v1alpha2/gke_hub.update_membership.js | 80 + ...metadata_google.cloud.gkehub.v1alpha2.json | 351 + .../google-cloud-gkehub/v1alpha2/src/index.ts | 25 + .../v1alpha2/src/v1alpha2/gapic_metadata.json | 97 + .../v1alpha2/src/v1alpha2/gke_hub_client.ts | 1296 +++ .../src/v1alpha2/gke_hub_client_config.json | 73 + .../src/v1alpha2/gke_hub_proto_list.json | 3 + .../v1alpha2/src/v1alpha2/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1alpha2/system-test/install.ts | 49 + .../v1alpha2/test/gapic_gke_hub_v1alpha2.ts | 1361 +++ .../v1alpha2/tsconfig.json | 19 + .../v1alpha2/webpack.config.js | 64 + .../google-cloud-gkehub/v1beta/.eslintignore | 7 + .../google-cloud-gkehub/v1beta/.eslintrc.json | 3 + .../google-cloud-gkehub/v1beta/.gitignore | 14 + .../google-cloud-gkehub/v1beta/.jsdoc.js | 55 + .../google-cloud-gkehub/v1beta/.mocharc.js | 33 + .../google-cloud-gkehub/v1beta/.prettierrc.js | 22 + .../google-cloud-gkehub/v1beta/README.md | 1 + .../google-cloud-gkehub/v1beta/package.json | 58 + .../configmanagement/configmanagement.proto | 409 + .../google/cloud/gkehub/v1beta/feature.proto | 202 + .../gkehub/v1beta/metering/metering.proto | 38 + .../multiclusteringress.proto | 49 + .../google/cloud/gkehub/v1beta/service.proto | 280 + .../v1beta/gke_hub.create_feature.js | 84 + .../v1beta/gke_hub.delete_feature.js | 82 + .../generated/v1beta/gke_hub.get_feature.js | 61 + .../generated/v1beta/gke_hub.list_features.js | 92 + .../v1beta/gke_hub.update_feature.js | 91 + ...t_metadata_google.cloud.gkehub.v1beta.json | 263 + .../google-cloud-gkehub/v1beta/src/index.ts | 25 + .../v1beta/src/v1beta/gapic_metadata.json | 77 + .../v1beta/src/v1beta/gke_hub_client.ts | 1084 ++ .../src/v1beta/gke_hub_client_config.json | 63 + .../v1beta/src/v1beta/gke_hub_proto_list.json | 7 + .../v1beta/src/v1beta/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1beta/system-test/install.ts | 49 + .../v1beta/test/gapic_gke_hub_v1beta.ts | 1077 ++ .../google-cloud-gkehub/v1beta/tsconfig.json | 19 + .../v1beta/webpack.config.js | 64 + .../google-cloud-gkehub/v1beta1/.eslintignore | 7 + .../v1beta1/.eslintrc.json | 3 + .../google-cloud-gkehub/v1beta1/.gitignore | 14 + .../google-cloud-gkehub/v1beta1/.jsdoc.js | 55 + .../google-cloud-gkehub/v1beta1/.mocharc.js | 33 + .../v1beta1/.prettierrc.js | 22 + .../google-cloud-gkehub/v1beta1/README.md | 1 + .../google-cloud-gkehub/v1beta1/package.json | 58 + .../cloud/gkehub/v1beta1/membership.proto | 957 ++ ...ub_membership_service.create_membership.js | 93 + ...ub_membership_service.delete_membership.js | 83 + ...rship_service.generate_connect_manifest.js | 85 + ...p_service.generate_exclusivity_manifest.js | 74 + ...e_hub_membership_service.get_membership.js | 62 + ...hub_membership_service.list_memberships.js | 96 + ...ub_membership_service.update_membership.js | 95 + ...membership_service.validate_exclusivity.js | 74 + ..._metadata_google.cloud.gkehub.v1beta1.json | 419 + .../google-cloud-gkehub/v1beta1/src/index.ts | 25 + .../v1beta1/src/v1beta1/gapic_metadata.json | 107 + .../gke_hub_membership_service_client.ts | 1832 ++++ ..._hub_membership_service_client_config.json | 78 + ...gke_hub_membership_service_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 + ...apic_gke_hub_membership_service_v1beta1.ts | 2166 ++++ .../google-cloud-gkehub/v1beta1/tsconfig.json | 19 + .../v1beta1/webpack.config.js | 64 + .../v1/.eslintignore | 7 + .../v1/.eslintrc.json | 3 + .../google-cloud-gkemulticloud/v1/.gitignore | 14 + .../google-cloud-gkemulticloud/v1/.jsdoc.js | 55 + .../google-cloud-gkemulticloud/v1/.mocharc.js | 33 + .../v1/.prettierrc.js | 22 + .../google-cloud-gkemulticloud/v1/README.md | 1 + .../v1/package.json | 60 + .../gkemulticloud/v1/attached_resources.proto | 230 + .../gkemulticloud/v1/attached_service.proto | 432 + .../gkemulticloud/v1/aws_resources.proto | 627 ++ .../cloud/gkemulticloud/v1/aws_service.proto | 605 ++ .../gkemulticloud/v1/azure_resources.proto | 708 ++ .../gkemulticloud/v1/azure_service.proto | 776 ++ .../gkemulticloud/v1/common_resources.proto | 174 + ...tached_clusters.create_attached_cluster.js | 88 + ...tached_clusters.delete_attached_cluster.js | 95 + ...erate_attached_cluster_install_manifest.js | 89 + .../attached_clusters.get_attached_cluster.js | 67 + ...hed_clusters.get_attached_server_config.js | 67 + ...tached_clusters.import_attached_cluster.js | 90 + ...ttached_clusters.list_attached_clusters.js | 82 + ...tached_clusters.update_attached_cluster.js | 82 + .../v1/aws_clusters.create_aws_cluster.js | 88 + .../v1/aws_clusters.create_aws_node_pool.js | 89 + .../v1/aws_clusters.delete_aws_cluster.js | 87 + .../v1/aws_clusters.delete_aws_node_pool.js | 88 + .../aws_clusters.generate_aws_access_token.js | 67 + .../v1/aws_clusters.get_aws_cluster.js | 67 + .../v1/aws_clusters.get_aws_node_pool.js | 67 + .../v1/aws_clusters.get_aws_server_config.js | 67 + .../v1/aws_clusters.list_aws_clusters.js | 82 + .../v1/aws_clusters.list_aws_node_pools.js | 83 + .../v1/aws_clusters.update_aws_cluster.js | 97 + .../v1/aws_clusters.update_aws_node_pool.js | 96 + .../v1/azure_clusters.create_azure_client.js | 88 + .../v1/azure_clusters.create_azure_cluster.js | 88 + .../azure_clusters.create_azure_node_pool.js | 88 + .../v1/azure_clusters.delete_azure_client.js | 80 + .../v1/azure_clusters.delete_azure_cluster.js | 87 + .../azure_clusters.delete_azure_node_pool.js | 89 + ...re_clusters.generate_azure_access_token.js | 67 + .../v1/azure_clusters.get_azure_client.js | 68 + .../v1/azure_clusters.get_azure_cluster.js | 67 + .../v1/azure_clusters.get_azure_node_pool.js | 67 + .../azure_clusters.get_azure_server_config.js | 67 + .../v1/azure_clusters.list_azure_clients.js | 82 + .../v1/azure_clusters.list_azure_clusters.js | 82 + .../azure_clusters.list_azure_node_pools.js | 83 + .../v1/azure_clusters.update_azure_cluster.js | 90 + .../azure_clusters.update_azure_node_pool.js | 79 + ...etadata_google.cloud.gkemulticloud.v1.json | 1711 ++++ .../v1/src/index.ts | 29 + .../v1/src/v1/attached_clusters_client.ts | 2007 ++++ .../v1/attached_clusters_client_config.json | 78 + .../src/v1/attached_clusters_proto_list.json | 9 + .../v1/src/v1/aws_clusters_client.ts | 2546 +++++ .../v1/src/v1/aws_clusters_client_config.json | 98 + .../v1/src/v1/aws_clusters_proto_list.json | 9 + .../v1/src/v1/azure_clusters_client.ts | 3068 ++++++ .../src/v1/azure_clusters_client_config.json | 118 + .../v1/src/v1/azure_clusters_proto_list.json | 9 + .../v1/src/v1/gapic_metadata.json | 435 + .../v1/src/v1/index.ts | 21 + .../system-test/fixtures/sample/src/index.js | 29 + .../system-test/fixtures/sample/src/index.ts | 44 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_attached_clusters_v1.ts | 2134 ++++ .../v1/test/gapic_aws_clusters_v1.ts | 2799 ++++++ .../v1/test/gapic_azure_clusters_v1.ts | 3460 +++++++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1/.eslintignore | 7 + .../v1/.eslintrc.json | 3 + .../google-cloud-gsuiteaddons/v1/.gitignore | 14 + .../google-cloud-gsuiteaddons/v1/.jsdoc.js | 55 + .../google-cloud-gsuiteaddons/v1/.mocharc.js | 33 + .../v1/.prettierrc.js | 22 + .../google-cloud-gsuiteaddons/v1/README.md | 1 + .../google-cloud-gsuiteaddons/v1/package.json | 58 + .../apps/script/type/addon_widget_set.proto | 58 + .../calendar/calendar_addon_manifest.proto | 107 + .../type/docs/docs_addon_manifest.proto | 47 + .../type/drive/drive_addon_manifest.proto | 48 + .../apps/script/type/extension_point.proto | 77 + .../type/gmail/gmail_addon_manifest.proto | 127 + .../apps/script/type/script_manifest.proto | 105 + .../type/sheets/sheets_addon_manifest.proto | 47 + .../type/slides/slides_addon_manifest.proto | 47 + .../cloud/gsuiteaddons/v1/gsuiteaddons.proto | 389 + .../v1/g_suite_add_ons.create_deployment.js | 73 + .../v1/g_suite_add_ons.delete_deployment.js | 67 + .../v1/g_suite_add_ons.get_authorization.js | 63 + .../v1/g_suite_add_ons.get_deployment.js | 62 + .../v1/g_suite_add_ons.get_install_status.js | 62 + .../v1/g_suite_add_ons.install_deployment.js | 62 + .../v1/g_suite_add_ons.list_deployments.js | 78 + .../v1/g_suite_add_ons.replace_deployment.js | 61 + .../g_suite_add_ons.uninstall_deployment.js | 62 + ...metadata_google.cloud.gsuiteaddons.v1.json | 395 + .../google-cloud-gsuiteaddons/v1/src/index.ts | 25 + .../v1/src/v1/g_suite_add_ons_client.ts | 1266 +++ .../src/v1/g_suite_add_ons_client_config.json | 84 + .../v1/src/v1/g_suite_add_ons_proto_list.json | 12 + .../v1/src/v1/gapic_metadata.json | 117 + .../v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_g_suite_add_ons_v1.ts | 1449 +++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../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 + .../google-cloud-iap/v1/package.json | 59 + .../protos/google/cloud/iap/v1/service.proto | 736 ++ ..._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 | 1338 +++ ...are_proxy_admin_service_client_config.json | 76 + ..._aware_proxy_admin_service_proto_list.json | 3 + ...ntity_aware_proxy_o_auth_service_client.ts | 1160 +++ ...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 + .../google-cloud-iap/v1beta1/package.json | 58 + .../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 | 549 ++ ...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 + .../google-cloud-ids/v1/.eslintignore | 7 + .../google-cloud-ids/v1/.eslintrc.json | 3 + .../google-cloud-ids/v1/.gitignore | 14 + owl-bot-staging/google-cloud-ids/v1/.jsdoc.js | 55 + .../google-cloud-ids/v1/.mocharc.js | 33 + .../google-cloud-ids/v1/.prettierrc.js | 22 + owl-bot-staging/google-cloud-ids/v1/README.md | 1 + .../google-cloud-ids/v1/package.json | 58 + .../v1/protos/google/cloud/ids/v1/ids.proto | 296 + .../generated/v1/i_d_s.create_endpoint.js | 91 + .../generated/v1/i_d_s.delete_endpoint.js | 76 + .../generated/v1/i_d_s.get_endpoint.js | 62 + .../generated/v1/i_d_s.list_endpoints.js | 85 + .../snippet_metadata_google.cloud.ids.v1.json | 207 + .../google-cloud-ids/v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 67 + .../v1/src/v1/i_d_s_client.ts | 967 ++ .../v1/src/v1/i_d_s_client_config.json | 58 + .../v1/src/v1/i_d_s_proto_list.json | 3 + .../google-cloud-ids/v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_i_d_s_v1.ts | 991 ++ .../google-cloud-ids/v1/tsconfig.json | 19 + .../google-cloud-ids/v1/webpack.config.js | 64 + .../google-cloud-iot/v1/.eslintignore | 7 + .../google-cloud-iot/v1/.eslintrc.json | 3 + .../google-cloud-iot/v1/.gitignore | 14 + owl-bot-staging/google-cloud-iot/v1/.jsdoc.js | 55 + .../google-cloud-iot/v1/.mocharc.js | 33 + .../google-cloud-iot/v1/.prettierrc.js | 22 + owl-bot-staging/google-cloud-iot/v1/README.md | 1 + .../google-cloud-iot/v1/package.json | 58 + .../google/cloud/iot/v1/device_manager.proto | 651 ++ .../google/cloud/iot/v1/resources.proto | 483 + .../device_manager.bind_device_to_gateway.js | 75 + .../v1/device_manager.create_device.js | 70 + .../device_manager.create_device_registry.js | 69 + .../v1/device_manager.delete_device.js | 63 + .../device_manager.delete_device_registry.js | 62 + .../generated/v1/device_manager.get_device.js | 69 + .../v1/device_manager.get_device_registry.js | 62 + .../v1/device_manager.get_iam_policy.js | 67 + ...ice_manager.list_device_config_versions.js | 69 + .../device_manager.list_device_registries.js | 77 + .../v1/device_manager.list_device_states.js | 69 + .../v1/device_manager.list_devices.js | 98 + ...e_manager.modify_cloud_to_device_config.js | 76 + .../device_manager.send_command_to_device.js | 76 + .../v1/device_manager.set_iam_policy.js | 77 + .../v1/device_manager.test_iam_permissions.js | 70 + ...vice_manager.unbind_device_from_gateway.js | 75 + .../v1/device_manager.update_device.js | 72 + .../device_manager.update_device_registry.js | 72 + .../snippet_metadata_google.cloud.iot.v1.json | 883 ++ .../google-cloud-iot/v1/src/index.ts | 25 + .../v1/src/v1/device_manager_client.ts | 2217 +++++ .../src/v1/device_manager_client_config.json | 135 + .../v1/src/v1/device_manager_proto_list.json | 4 + .../v1/src/v1/gapic_metadata.json | 221 + .../google-cloud-iot/v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_device_manager_v1.ts | 2672 +++++ .../google-cloud-iot/v1/tsconfig.json | 19 + .../google-cloud-iot/v1/webpack.config.js | 64 + .../v1/.eslintignore | 7 + .../v1/.eslintrc.json | 3 + .../google-cloud-kms-inventory/v1/.gitignore | 14 + .../google-cloud-kms-inventory/v1/.jsdoc.js | 55 + .../google-cloud-kms-inventory/v1/.mocharc.js | 33 + .../v1/.prettierrc.js | 22 + .../google-cloud-kms-inventory/v1/README.md | 1 + .../v1/package.json | 59 + .../inventory/v1/key_dashboard_service.proto | 81 + .../inventory/v1/key_tracking_service.proto | 228 + .../key_dashboard_service.list_crypto_keys.js | 75 + ...service.get_protected_resources_summary.js | 62 + ...king_service.search_protected_resources.js | 100 + ...etadata_google.cloud.kms.inventory.v1.json | 159 + .../v1/src/index.ts | 27 + .../v1/src/v1/gapic_metadata.json | 75 + .../v1/src/v1/index.ts | 20 + .../v1/src/v1/key_dashboard_service_client.ts | 1016 ++ .../key_dashboard_service_client_config.json | 31 + .../v1/key_dashboard_service_proto_list.json | 5 + .../v1/src/v1/key_tracking_service_client.ts | 1163 +++ .../key_tracking_service_client_config.json | 36 + .../v1/key_tracking_service_proto_list.json | 5 + .../system-test/fixtures/sample/src/index.js | 28 + .../system-test/fixtures/sample/src/index.ts | 38 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_key_dashboard_service_v1.ts | 869 ++ .../v1/test/gapic_key_tracking_service_v1.ts | 977 ++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../google-cloud-kms/v1/.eslintignore | 7 + .../google-cloud-kms/v1/.eslintrc.json | 3 + .../google-cloud-kms/v1/.gitignore | 14 + owl-bot-staging/google-cloud-kms/v1/.jsdoc.js | 55 + .../google-cloud-kms/v1/.mocharc.js | 33 + .../google-cloud-kms/v1/.prettierrc.js | 22 + owl-bot-staging/google-cloud-kms/v1/README.md | 1 + .../google-cloud-kms/v1/package.json | 59 + .../google/cloud/kms/v1/ekm_service.proto | 451 + .../google/cloud/kms/v1/resources.proto | 920 ++ .../protos/google/cloud/kms/v1/service.proto | 2073 ++++ .../v1/ekm_service.create_ekm_connection.js | 75 + .../v1/ekm_service.get_ekm_config.js | 62 + .../v1/ekm_service.get_ekm_connection.js | 62 + .../v1/ekm_service.list_ekm_connections.js | 94 + .../v1/ekm_service.update_ekm_config.js | 66 + .../v1/ekm_service.update_ekm_connection.js | 67 + .../v1/ekm_service.verify_connectivity.js | 62 + ...y_management_service.asymmetric_decrypt.js | 92 + .../key_management_service.asymmetric_sign.js | 123 + ...ey_management_service.create_crypto_key.js | 85 + ...ement_service.create_crypto_key_version.js | 69 + ...ey_management_service.create_import_job.js | 75 + .../key_management_service.create_key_ring.js | 75 + .../v1/key_management_service.decrypt.js | 118 + ...ment_service.destroy_crypto_key_version.js | 62 + .../v1/key_management_service.encrypt.js | 139 + ...anagement_service.generate_random_bytes.js | 73 + .../key_management_service.get_crypto_key.js | 62 + ...nagement_service.get_crypto_key_version.js | 62 + .../key_management_service.get_import_job.js | 62 + .../v1/key_management_service.get_key_ring.js | 62 + .../key_management_service.get_public_key.js | 62 + ...ement_service.import_crypto_key_version.js | 145 + ...gement_service.list_crypto_key_versions.js | 98 + ...key_management_service.list_crypto_keys.js | 97 + ...key_management_service.list_import_jobs.js | 93 + .../key_management_service.list_key_rings.js | 94 + .../v1/key_management_service.mac_sign.js | 89 + .../v1/key_management_service.mac_verify.js | 115 + .../v1/key_management_service.raw_decrypt.js | 142 + .../v1/key_management_service.raw_encrypt.js | 154 + ...ment_service.restore_crypto_key_version.js | 62 + ...ey_management_service.update_crypto_key.js | 66 + ...rvice.update_crypto_key_primary_version.js | 68 + ...ement_service.update_crypto_key_version.js | 67 + .../snippet_metadata_google.cloud.kms.v1.json | 1723 ++++ .../google-cloud-kms/v1/src/index.ts | 27 + .../v1/src/v1/ekm_service_client.ts | 1696 ++++ .../v1/src/v1/ekm_service_client_config.json | 58 + .../v1/src/v1/ekm_service_proto_list.json | 5 + .../v1/src/v1/gapic_metadata.json | 407 + .../google-cloud-kms/v1/src/v1/index.ts | 20 + .../src/v1/key_management_service_client.ts | 4292 ++++++++ .../key_management_service_client_config.json | 164 + .../v1/key_management_service_proto_list.json | 5 + .../system-test/fixtures/sample/src/index.js | 28 + .../system-test/fixtures/sample/src/index.ts | 38 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_ekm_service_v1.ts | 1943 ++++ .../test/gapic_key_management_service_v1.ts | 4622 +++++++++ .../google-cloud-kms/v1/tsconfig.json | 19 + .../google-cloud-kms/v1/webpack.config.js | 64 + .../google-cloud-language/v1/.eslintignore | 7 + .../google-cloud-language/v1/.eslintrc.json | 3 + .../google-cloud-language/v1/.gitignore | 14 + .../google-cloud-language/v1/.jsdoc.js | 55 + .../google-cloud-language/v1/.mocharc.js | 33 + .../google-cloud-language/v1/.prettierrc.js | 22 + .../google-cloud-language/v1/README.md | 1 + .../google-cloud-language/v1/package.json | 58 + .../cloud/language/v1/language_service.proto | 1211 +++ .../v1/language_service.analyze_entities.js | 65 + ...nguage_service.analyze_entity_sentiment.js | 65 + .../v1/language_service.analyze_sentiment.js | 65 + .../v1/language_service.analyze_syntax.js | 65 + .../v1/language_service.annotate_text.js | 70 + .../v1/language_service.classify_text.js | 66 + .../v1/language_service.moderate_text.js | 61 + ...pet_metadata_google.cloud.language.v1.json | 323 + .../google-cloud-language/v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 93 + .../google-cloud-language/v1/src/v1/index.ts | 19 + .../v1/src/v1/language_service_client.ts | 786 ++ .../v1/language_service_client_config.json | 60 + .../src/v1/language_service_proto_list.json | 3 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_language_service_v1.ts | 675 ++ .../google-cloud-language/v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1beta2/.eslintignore | 7 + .../v1beta2/.eslintrc.json | 3 + .../google-cloud-language/v1beta2/.gitignore | 14 + .../google-cloud-language/v1beta2/.jsdoc.js | 55 + .../google-cloud-language/v1beta2/.mocharc.js | 33 + .../v1beta2/.prettierrc.js | 22 + .../google-cloud-language/v1beta2/README.md | 1 + .../v1beta2/package.json | 58 + .../language/v1beta2/language_service.proto | 1235 +++ .../language_service.analyze_entities.js | 65 + ...nguage_service.analyze_entity_sentiment.js | 65 + .../language_service.analyze_sentiment.js | 66 + .../language_service.analyze_syntax.js | 65 + .../v1beta2/language_service.annotate_text.js | 70 + .../v1beta2/language_service.classify_text.js | 66 + .../v1beta2/language_service.moderate_text.js | 61 + ...etadata_google.cloud.language.v1beta2.json | 323 + .../v1beta2/src/index.ts | 25 + .../v1beta2/src/v1beta2/gapic_metadata.json | 93 + .../v1beta2/src/v1beta2/index.ts | 19 + .../src/v1beta2/language_service_client.ts | 787 ++ .../language_service_client_config.json | 60 + .../v1beta2/language_service_proto_list.json | 3 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1beta2/system-test/install.ts | 49 + .../test/gapic_language_service_v1beta2.ts | 675 ++ .../v1beta2/tsconfig.json | 19 + .../v1beta2/webpack.config.js | 64 + .../google-cloud-language/v2/.eslintignore | 7 + .../google-cloud-language/v2/.eslintrc.json | 3 + .../google-cloud-language/v2/.gitignore | 14 + .../google-cloud-language/v2/.jsdoc.js | 55 + .../google-cloud-language/v2/.mocharc.js | 33 + .../google-cloud-language/v2/.prettierrc.js | 22 + .../google-cloud-language/v2/README.md | 1 + .../google-cloud-language/v2/package.json | 58 + .../cloud/language/v2/language_service.proto | 504 + .../v2/language_service.analyze_entities.js | 65 + .../v2/language_service.analyze_sentiment.js | 65 + .../v2/language_service.annotate_text.js | 70 + .../v2/language_service.classify_text.js | 61 + .../v2/language_service.moderate_text.js | 61 + ...pet_metadata_google.cloud.language.v2.json | 231 + .../google-cloud-language/v2/src/index.ts | 25 + .../v2/src/v2/gapic_metadata.json | 73 + .../google-cloud-language/v2/src/v2/index.ts | 19 + .../v2/src/v2/language_service_client.ts | 643 ++ .../v2/language_service_client_config.json | 51 + .../src/v2/language_service_proto_list.json | 3 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v2/system-test/install.ts | 49 + .../v2/test/gapic_language_service_v2.ts | 525 + .../google-cloud-language/v2/tsconfig.json | 19 + .../v2/webpack.config.js | 64 + .../v2beta/.eslintignore | 7 + .../v2beta/.eslintrc.json | 3 + .../v2beta/.gitignore | 14 + .../v2beta/.jsdoc.js | 55 + .../v2beta/.mocharc.js | 33 + .../v2beta/.prettierrc.js | 22 + .../v2beta/README.md | 1 + .../v2beta/package.json | 58 + .../cloud/lifesciences/v2beta/workflows.proto | 783 ++ ...data_google.cloud.lifesciences.v2beta.json | 67 + .../workflows_service_v2_beta.run_pipeline.js | 81 + .../v2beta/src/index.ts | 25 + .../v2beta/src/v2beta/gapic_metadata.json | 33 + .../v2beta/src/v2beta/index.ts | 19 + .../workflows_service_v2_beta_client.ts | 714 ++ ...rkflows_service_v2_beta_client_config.json | 31 + .../workflows_service_v2_beta_proto_list.json | 3 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v2beta/system-test/install.ts | 49 + .../gapic_workflows_service_v2_beta_v2beta.ts | 757 ++ .../v2beta/tsconfig.json | 19 + .../v2beta/webpack.config.js | 64 + .../v1/.eslintignore | 7 + .../v1/.eslintrc.json | 3 + .../v1/.gitignore | 14 + .../v1/.jsdoc.js | 55 + .../v1/.mocharc.js | 33 + .../v1/.prettierrc.js | 22 + .../v1/README.md | 1 + .../v1/package.json | 58 + .../v1/managed_identities_service.proto | 422 + .../cloud/managedidentities/v1/resource.proto | 212 + ...managed_identities_service.attach_trust.js | 68 + ...ties_service.create_microsoft_ad_domain.js | 83 + ...anaged_identities_service.delete_domain.js | 63 + ...managed_identities_service.detach_trust.js | 68 + .../managed_identities_service.get_domain.js | 62 + ...managed_identities_service.list_domains.js | 90 + ...ed_identities_service.reconfigure_trust.js | 75 + ...identities_service.reset_admin_password.js | 62 + ...anaged_identities_service.update_domain.js | 73 + ...naged_identities_service.validate_trust.js | 68 + ...ata_google.cloud.managedidentities.v1.json | 463 + .../v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 127 + .../v1/src/v1/index.ts | 19 + .../v1/managed_identities_service_client.ts | 1574 +++ ...aged_identities_service_client_config.json | 76 + ...managed_identities_service_proto_list.json | 4 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../gapic_managed_identities_service_v1.ts | 1873 ++++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1beta1/.eslintignore | 7 + .../v1beta1/.eslintrc.json | 3 + .../v1beta1/.gitignore | 14 + .../v1beta1/.jsdoc.js | 55 + .../v1beta1/.mocharc.js | 33 + .../v1beta1/.prettierrc.js | 22 + .../v1beta1/README.md | 1 + .../v1beta1/package.json | 58 + .../v1beta1/managed_identities_service.proto | 389 + .../managedidentities/v1beta1/resource.proto | 216 + ...managed_identities_service.attach_trust.js | 68 + ...ties_service.create_microsoft_ad_domain.js | 82 + ...anaged_identities_service.delete_domain.js | 63 + ...managed_identities_service.detach_trust.js | 68 + .../managed_identities_service.get_domain.js | 62 + ...managed_identities_service.list_domains.js | 90 + ...ed_identities_service.reconfigure_trust.js | 75 + ...identities_service.reset_admin_password.js | 62 + ...anaged_identities_service.update_domain.js | 74 + ...naged_identities_service.validate_trust.js | 68 + ...oogle.cloud.managedidentities.v1beta1.json | 463 + .../v1beta1/src/index.ts | 25 + .../v1beta1/src/v1beta1/gapic_metadata.json | 127 + .../v1beta1/src/v1beta1/index.ts | 19 + .../managed_identities_service_client.ts | 1541 +++ ...aged_identities_service_client_config.json | 66 + ...managed_identities_service_proto_list.json | 4 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1beta1/system-test/install.ts | 49 + ...apic_managed_identities_service_v1beta1.ts | 1873 ++++ .../v1beta1/tsconfig.json | 19 + .../v1beta1/webpack.config.js | 64 + .../v1beta1/.eslintignore | 7 + .../v1beta1/.eslintrc.json | 3 + .../v1beta1/.gitignore | 14 + .../v1beta1/.jsdoc.js | 55 + .../v1beta1/.mocharc.js | 33 + .../v1beta1/.prettierrc.js | 22 + .../v1beta1/README.md | 1 + .../v1beta1/package.json | 58 + .../v1beta1/media_translation.proto | 204 + ...google.cloud.mediatranslation.v1beta1.json | 59 + ...tion_service.streaming_translate_speech.js | 77 + .../v1beta1/src/index.ts | 25 + .../v1beta1/src/v1beta1/gapic_metadata.json | 27 + .../v1beta1/src/v1beta1/index.ts | 19 + .../speech_translation_service_client.ts | 342 + ...ech_translation_service_client_config.json | 31 + ...speech_translation_service_proto_list.json | 3 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1beta1/system-test/install.ts | 49 + ...apic_speech_translation_service_v1beta1.ts | 217 + .../v1beta1/tsconfig.json | 19 + .../v1beta1/webpack.config.js | 64 + .../google-cloud-memcache/v1/.eslintignore | 7 + .../google-cloud-memcache/v1/.eslintrc.json | 3 + .../google-cloud-memcache/v1/.gitignore | 14 + .../google-cloud-memcache/v1/.jsdoc.js | 55 + .../google-cloud-memcache/v1/.mocharc.js | 33 + .../google-cloud-memcache/v1/.prettierrc.js | 22 + .../google-cloud-memcache/v1/README.md | 1 + .../google-cloud-memcache/v1/package.json | 58 + .../cloud/memcache/v1/cloud_memcache.proto | 618 ++ .../v1/cloud_memcache.apply_parameters.js | 73 + .../v1/cloud_memcache.create_instance.js | 81 + .../v1/cloud_memcache.delete_instance.js | 64 + .../v1/cloud_memcache.get_instance.js | 63 + .../v1/cloud_memcache.list_instances.js | 87 + .../cloud_memcache.reschedule_maintenance.js | 75 + .../v1/cloud_memcache.update_instance.js | 69 + .../v1/cloud_memcache.update_parameters.js | 72 + ...pet_metadata_google.cloud.memcache.v1.json | 387 + .../google-cloud-memcache/v1/src/index.ts | 25 + .../v1/src/v1/cloud_memcache_client.ts | 1619 +++ .../src/v1/cloud_memcache_client_config.json | 66 + .../v1/src/v1/cloud_memcache_proto_list.json | 3 + .../v1/src/v1/gapic_metadata.json | 107 + .../google-cloud-memcache/v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_cloud_memcache_v1.ts | 2002 ++++ .../google-cloud-memcache/v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1beta2/.eslintignore | 7 + .../v1beta2/.eslintrc.json | 3 + .../google-cloud-memcache/v1beta2/.gitignore | 14 + .../google-cloud-memcache/v1beta2/.jsdoc.js | 55 + .../google-cloud-memcache/v1beta2/.mocharc.js | 33 + .../v1beta2/.prettierrc.js | 22 + .../google-cloud-memcache/v1beta2/README.md | 1 + .../v1beta2/package.json | 58 + .../memcache/v1beta2/cloud_memcache.proto | 658 ++ .../cloud_memcache.apply_parameters.js | 73 + .../cloud_memcache.apply_software_update.js | 74 + .../v1beta2/cloud_memcache.create_instance.js | 81 + .../v1beta2/cloud_memcache.delete_instance.js | 64 + .../v1beta2/cloud_memcache.get_instance.js | 63 + .../v1beta2/cloud_memcache.list_instances.js | 87 + .../cloud_memcache.reschedule_maintenance.js | 75 + .../v1beta2/cloud_memcache.update_instance.js | 69 + .../cloud_memcache.update_parameters.js | 72 + ...etadata_google.cloud.memcache.v1beta2.json | 435 + .../v1beta2/src/index.ts | 25 + .../src/v1beta2/cloud_memcache_client.ts | 1724 ++++ .../v1beta2/cloud_memcache_client_config.json | 71 + .../v1beta2/cloud_memcache_proto_list.json | 3 + .../v1beta2/src/v1beta2/gapic_metadata.json | 117 + .../v1beta2/src/v1beta2/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1beta2/system-test/install.ts | 49 + .../test/gapic_cloud_memcache_v1beta2.ts | 2156 ++++ .../v1beta2/tsconfig.json | 19 + .../v1beta2/webpack.config.js | 64 + .../google-cloud-metastore/v1/.eslintignore | 7 + .../google-cloud-metastore/v1/.eslintrc.json | 3 + .../google-cloud-metastore/v1/.gitignore | 14 + .../google-cloud-metastore/v1/.jsdoc.js | 55 + .../google-cloud-metastore/v1/.mocharc.js | 33 + .../google-cloud-metastore/v1/.prettierrc.js | 22 + .../google-cloud-metastore/v1/README.md | 1 + .../google-cloud-metastore/v1/package.json | 59 + .../google/cloud/metastore/v1/metastore.proto | 1602 +++ .../metastore/v1/metastore_federation.proto | 374 + ...astore.alter_metadata_resource_location.js | 79 + .../v1/dataproc_metastore.create_backup.js | 92 + ...taproc_metastore.create_metadata_import.js | 93 + .../v1/dataproc_metastore.create_service.js | 93 + .../v1/dataproc_metastore.delete_backup.js | 77 + .../v1/dataproc_metastore.delete_service.js | 77 + .../v1/dataproc_metastore.export_metadata.js | 88 + .../v1/dataproc_metastore.get_backup.js | 63 + .../dataproc_metastore.get_metadata_import.js | 63 + .../v1/dataproc_metastore.get_service.js | 63 + .../v1/dataproc_metastore.list_backups.js | 91 + ...ataproc_metastore.list_metadata_imports.js | 91 + .../v1/dataproc_metastore.list_services.js | 92 + ...taproc_metastore.move_table_to_database.js | 79 + .../v1/dataproc_metastore.query_metadata.js | 70 + .../v1/dataproc_metastore.restore_service.js | 88 + ...taproc_metastore.update_metadata_import.js | 86 + .../v1/dataproc_metastore.update_service.js | 86 + ..._metastore_federation.create_federation.js | 93 + ..._metastore_federation.delete_federation.js | 77 + ...roc_metastore_federation.get_federation.js | 63 + ...c_metastore_federation.list_federations.js | 91 + ..._metastore_federation.update_federation.js | 86 + ...et_metadata_google.cloud.metastore.v1.json | 1131 +++ .../google-cloud-metastore/v1/src/index.ts | 27 + .../v1/src/v1/dataproc_metastore_client.ts | 3409 +++++++ .../v1/dataproc_metastore_client_config.json | 128 + .../dataproc_metastore_federation_client.ts | 1714 ++++ ...oc_metastore_federation_client_config.json | 46 + ...aproc_metastore_federation_proto_list.json | 4 + .../src/v1/dataproc_metastore_proto_list.json | 4 + .../v1/src/v1/gapic_metadata.json | 283 + .../google-cloud-metastore/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 + .../gapic_dataproc_metastore_federation_v1.ts | 2000 ++++ .../v1/test/gapic_dataproc_metastore_v1.ts | 4134 ++++++++ .../google-cloud-metastore/v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1alpha/.eslintignore | 7 + .../v1alpha/.eslintrc.json | 3 + .../google-cloud-metastore/v1alpha/.gitignore | 14 + .../google-cloud-metastore/v1alpha/.jsdoc.js | 55 + .../v1alpha/.mocharc.js | 33 + .../v1alpha/.prettierrc.js | 22 + .../google-cloud-metastore/v1alpha/README.md | 1 + .../v1alpha/package.json | 59 + .../cloud/metastore/v1alpha/metastore.proto | 1681 ++++ .../v1alpha/metastore_federation.proto | 377 + ...astore.alter_metadata_resource_location.js | 79 + .../dataproc_metastore.create_backup.js | 92 + ...taproc_metastore.create_metadata_import.js | 93 + .../dataproc_metastore.create_service.js | 93 + .../dataproc_metastore.delete_backup.js | 77 + .../dataproc_metastore.delete_service.js | 77 + .../dataproc_metastore.export_metadata.js | 88 + .../v1alpha/dataproc_metastore.get_backup.js | 63 + .../dataproc_metastore.get_metadata_import.js | 63 + .../v1alpha/dataproc_metastore.get_service.js | 63 + .../dataproc_metastore.list_backups.js | 91 + ...ataproc_metastore.list_metadata_imports.js | 91 + .../dataproc_metastore.list_services.js | 92 + ...taproc_metastore.move_table_to_database.js | 79 + .../dataproc_metastore.query_metadata.js | 70 + .../dataproc_metastore.remove_iam_policy.js | 70 + .../dataproc_metastore.restore_service.js | 88 + ...taproc_metastore.update_metadata_import.js | 86 + .../dataproc_metastore.update_service.js | 86 + ..._metastore_federation.create_federation.js | 93 + ..._metastore_federation.delete_federation.js | 77 + ...roc_metastore_federation.get_federation.js | 63 + ...c_metastore_federation.list_federations.js | 91 + ..._metastore_federation.update_federation.js | 86 + ...tadata_google.cloud.metastore.v1alpha.json | 1175 +++ .../v1alpha/src/index.ts | 27 + .../src/v1alpha/dataproc_metastore_client.ts | 3539 +++++++ .../dataproc_metastore_client_config.json | 133 + .../dataproc_metastore_federation_client.ts | 1714 ++++ ...oc_metastore_federation_client_config.json | 46 + ...aproc_metastore_federation_proto_list.json | 4 + .../dataproc_metastore_proto_list.json | 4 + .../v1alpha/src/v1alpha/gapic_metadata.json | 293 + .../v1alpha/src/v1alpha/index.ts | 20 + .../system-test/fixtures/sample/src/index.js | 28 + .../system-test/fixtures/sample/src/index.ts | 38 + .../v1alpha/system-test/install.ts | 49 + ...c_dataproc_metastore_federation_v1alpha.ts | 2000 ++++ .../test/gapic_dataproc_metastore_v1alpha.ts | 4288 ++++++++ .../v1alpha/tsconfig.json | 19 + .../v1alpha/webpack.config.js | 64 + .../v1beta/.eslintignore | 7 + .../v1beta/.eslintrc.json | 3 + .../google-cloud-metastore/v1beta/.gitignore | 14 + .../google-cloud-metastore/v1beta/.jsdoc.js | 55 + .../google-cloud-metastore/v1beta/.mocharc.js | 33 + .../v1beta/.prettierrc.js | 22 + .../google-cloud-metastore/v1beta/README.md | 1 + .../v1beta/package.json | 59 + .../cloud/metastore/v1beta/metastore.proto | 1681 ++++ .../v1beta/metastore_federation.proto | 377 + ...astore.alter_metadata_resource_location.js | 79 + .../dataproc_metastore.create_backup.js | 92 + ...taproc_metastore.create_metadata_import.js | 93 + .../dataproc_metastore.create_service.js | 93 + .../dataproc_metastore.delete_backup.js | 77 + .../dataproc_metastore.delete_service.js | 77 + .../dataproc_metastore.export_metadata.js | 88 + .../v1beta/dataproc_metastore.get_backup.js | 63 + .../dataproc_metastore.get_metadata_import.js | 63 + .../v1beta/dataproc_metastore.get_service.js | 63 + .../v1beta/dataproc_metastore.list_backups.js | 91 + ...ataproc_metastore.list_metadata_imports.js | 91 + .../dataproc_metastore.list_services.js | 92 + ...taproc_metastore.move_table_to_database.js | 79 + .../dataproc_metastore.query_metadata.js | 70 + .../dataproc_metastore.remove_iam_policy.js | 70 + .../dataproc_metastore.restore_service.js | 88 + ...taproc_metastore.update_metadata_import.js | 86 + .../dataproc_metastore.update_service.js | 86 + ..._metastore_federation.create_federation.js | 93 + ..._metastore_federation.delete_federation.js | 77 + ...roc_metastore_federation.get_federation.js | 63 + ...c_metastore_federation.list_federations.js | 91 + ..._metastore_federation.update_federation.js | 86 + ...etadata_google.cloud.metastore.v1beta.json | 1175 +++ .../v1beta/src/index.ts | 27 + .../src/v1beta/dataproc_metastore_client.ts | 3539 +++++++ .../dataproc_metastore_client_config.json | 133 + .../dataproc_metastore_federation_client.ts | 1714 ++++ ...oc_metastore_federation_client_config.json | 46 + ...aproc_metastore_federation_proto_list.json | 4 + .../v1beta/dataproc_metastore_proto_list.json | 4 + .../v1beta/src/v1beta/gapic_metadata.json | 293 + .../v1beta/src/v1beta/index.ts | 20 + .../system-test/fixtures/sample/src/index.js | 28 + .../system-test/fixtures/sample/src/index.ts | 38 + .../v1beta/system-test/install.ts | 49 + ...ic_dataproc_metastore_federation_v1beta.ts | 2000 ++++ .../test/gapic_dataproc_metastore_v1beta.ts | 4288 ++++++++ .../v1beta/tsconfig.json | 19 + .../v1beta/webpack.config.js | 64 + .../v1/.eslintignore | 7 + .../v1/.eslintrc.json | 3 + .../v1/.gitignore | 14 + .../google-cloud-migrationcenter/v1/.jsdoc.js | 55 + .../v1/.mocharc.js | 33 + .../v1/.prettierrc.js | 22 + .../google-cloud-migrationcenter/v1/README.md | 1 + .../v1/package.json | 58 + .../migrationcenter/v1/migrationcenter.proto | 4005 ++++++++ .../migration_center.add_assets_to_group.js | 91 + ...igration_center.aggregate_assets_values.js | 70 + .../migration_center.batch_delete_assets.js | 74 + .../migration_center.batch_update_assets.js | 67 + .../v1/migration_center.create_group.js | 90 + ...igration_center.create_import_data_file.js | 86 + .../v1/migration_center.create_import_job.js | 86 + .../migration_center.create_preference_set.js | 91 + .../v1/migration_center.create_report.js | 90 + .../migration_center.create_report_config.js | 90 + .../v1/migration_center.create_source.js | 90 + .../v1/migration_center.delete_asset.js | 75 + .../v1/migration_center.delete_group.js | 76 + ...igration_center.delete_import_data_file.js | 76 + .../v1/migration_center.delete_import_job.js | 82 + .../migration_center.delete_preference_set.js | 76 + .../v1/migration_center.delete_report.js | 76 + .../migration_center.delete_report_config.js | 82 + .../v1/migration_center.delete_source.js | 76 + .../v1/migration_center.get_asset.js | 65 + .../v1/migration_center.get_error_frame.js | 68 + .../v1/migration_center.get_group.js | 61 + .../migration_center.get_import_data_file.js | 61 + .../v1/migration_center.get_import_job.js | 66 + .../v1/migration_center.get_preference_set.js | 61 + .../v1/migration_center.get_report.js | 65 + .../v1/migration_center.get_report_config.js | 61 + .../v1/migration_center.get_settings.js | 61 + .../v1/migration_center.get_source.js | 61 + .../v1/migration_center.list_assets.js | 84 + .../v1/migration_center.list_error_frames.js | 77 + .../v1/migration_center.list_groups.js | 80 + ...migration_center.list_import_data_files.js | 85 + .../v1/migration_center.list_import_jobs.js | 85 + .../migration_center.list_preference_sets.js | 77 + .../migration_center.list_report_configs.js | 80 + .../v1/migration_center.list_reports.js | 84 + .../v1/migration_center.list_sources.js | 80 + ...gration_center.remove_assets_from_group.js | 90 + .../migration_center.report_asset_frames.js | 70 + .../v1/migration_center.run_import_job.js | 76 + .../v1/migration_center.update_asset.js | 85 + .../v1/migration_center.update_group.js | 85 + .../v1/migration_center.update_import_job.js | 86 + .../migration_center.update_preference_set.js | 86 + .../v1/migration_center.update_settings.js | 86 + .../v1/migration_center.update_source.js | 86 + .../migration_center.validate_import_job.js | 76 + ...adata_google.cloud.migrationcenter.v1.json | 2331 +++++ .../v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 539 + .../v1/src/v1/index.ts | 19 + .../v1/src/v1/migration_center_client.ts | 6782 +++++++++++++ .../v1/migration_center_client_config.json | 266 + .../src/v1/migration_center_proto_list.json | 3 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_migration_center_v1.ts | 8680 +++++++++++++++++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1/.eslintignore | 7 + .../v1/.eslintrc.json | 3 + .../v1/.gitignore | 14 + .../v1/.jsdoc.js | 55 + .../v1/.mocharc.js | 33 + .../v1/.prettierrc.js | 22 + .../v1/README.md | 1 + .../v1/package.json | 58 + .../cloud/networkconnectivity/v1/common.proto | 64 + .../cloud/networkconnectivity/v1/hub.proto | 694 ++ .../generated/v1/hub_service.create_hub.js | 87 + .../generated/v1/hub_service.create_spoke.js | 87 + .../generated/v1/hub_service.delete_hub.js | 77 + .../generated/v1/hub_service.delete_spoke.js | 77 + .../generated/v1/hub_service.get_hub.js | 61 + .../generated/v1/hub_service.get_spoke.js | 61 + .../generated/v1/hub_service.list_hubs.js | 79 + .../generated/v1/hub_service.list_spokes.js | 79 + .../generated/v1/hub_service.update_hub.js | 85 + .../generated/v1/hub_service.update_spoke.js | 85 + ...a_google.cloud.networkconnectivity.v1.json | 495 + .../v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 131 + .../v1/src/v1/hub_service_client.ts | 2277 +++++ .../v1/src/v1/hub_service_client_config.json | 88 + .../v1/src/v1/hub_service_proto_list.json | 4 + .../v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_hub_service_v1.ts | 2849 ++++++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1alpha1/.eslintignore | 7 + .../v1alpha1/.eslintrc.json | 3 + .../v1alpha1/.gitignore | 14 + .../v1alpha1/.jsdoc.js | 55 + .../v1alpha1/.mocharc.js | 33 + .../v1alpha1/.prettierrc.js | 22 + .../v1alpha1/README.md | 1 + .../v1alpha1/package.json | 58 + .../networkconnectivity/v1alpha1/common.proto | 55 + .../networkconnectivity/v1alpha1/hub.proto | 551 ++ .../v1alpha1/hub_service.create_hub.js | 85 + .../v1alpha1/hub_service.create_spoke.js | 85 + .../v1alpha1/hub_service.delete_hub.js | 76 + .../v1alpha1/hub_service.delete_spoke.js | 76 + .../generated/v1alpha1/hub_service.get_hub.js | 61 + .../v1alpha1/hub_service.get_spoke.js | 61 + .../v1alpha1/hub_service.list_hubs.js | 79 + .../v1alpha1/hub_service.list_spokes.js | 79 + .../v1alpha1/hub_service.update_hub.js | 84 + .../v1alpha1/hub_service.update_spoke.js | 84 + ...le.cloud.networkconnectivity.v1alpha1.json | 495 + .../v1alpha1/src/index.ts | 25 + .../v1alpha1/src/v1alpha1/gapic_metadata.json | 131 + .../src/v1alpha1/hub_service_client.ts | 1829 ++++ .../v1alpha1/hub_service_client_config.json | 88 + .../src/v1alpha1/hub_service_proto_list.json | 4 + .../v1alpha1/src/v1alpha1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1alpha1/system-test/install.ts | 49 + .../test/gapic_hub_service_v1alpha1.ts | 2114 ++++ .../v1alpha1/tsconfig.json | 19 + .../v1alpha1/webpack.config.js | 64 + .../v1/.eslintignore | 7 + .../v1/.eslintrc.json | 3 + .../v1/.gitignore | 14 + .../v1/.jsdoc.js | 55 + .../v1/.mocharc.js | 33 + .../v1/.prettierrc.js | 22 + .../v1/README.md | 1 + .../v1/package.json | 58 + .../v1/connectivity_test.proto | 405 + .../networkmanagement/v1/reachability.proto | 274 + .../cloud/networkmanagement/v1/trace.proto | 1241 +++ ...bility_service.create_connectivity_test.js | 79 + ...bility_service.delete_connectivity_test.js | 63 + ...chability_service.get_connectivity_test.js | 62 + ...ability_service.list_connectivity_tests.js | 95 + ...ability_service.rerun_connectivity_test.js | 63 + ...bility_service.update_connectivity_test.js | 68 + ...ata_google.cloud.networkmanagement.v1.json | 283 + .../v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 87 + .../v1/src/v1/index.ts | 19 + .../v1/src/v1/reachability_service_client.ts | 1139 +++ .../reachability_service_client_config.json | 56 + .../v1/reachability_service_proto_list.json | 5 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_reachability_service_v1.ts | 1227 +++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1beta1/.eslintignore | 7 + .../v1beta1/.eslintrc.json | 3 + .../v1beta1/.gitignore | 14 + .../v1beta1/.jsdoc.js | 55 + .../v1beta1/.mocharc.js | 33 + .../v1beta1/.prettierrc.js | 22 + .../v1beta1/README.md | 1 + .../v1beta1/package.json | 58 + .../v1beta1/connectivity_test.proto | 405 + .../v1beta1/reachability.proto | 269 + .../networkmanagement/v1beta1/trace.proto | 1241 +++ ...bility_service.create_connectivity_test.js | 79 + ...bility_service.delete_connectivity_test.js | 63 + ...chability_service.get_connectivity_test.js | 62 + ...ability_service.list_connectivity_tests.js | 95 + ...ability_service.rerun_connectivity_test.js | 63 + ...bility_service.update_connectivity_test.js | 68 + ...oogle.cloud.networkmanagement.v1beta1.json | 283 + .../v1beta1/src/index.ts | 25 + .../v1beta1/src/v1beta1/gapic_metadata.json | 87 + .../v1beta1/src/v1beta1/index.ts | 19 + .../v1beta1/reachability_service_client.ts | 1139 +++ .../reachability_service_client_config.json | 56 + .../reachability_service_proto_list.json | 5 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1beta1/system-test/install.ts | 49 + .../gapic_reachability_service_v1beta1.ts | 1227 +++ .../v1beta1/tsconfig.json | 19 + .../v1beta1/webpack.config.js | 64 + 1311 files changed, 300568 insertions(+) create mode 100644 owl-bot-staging/google-cloud-functions/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-functions/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-functions/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-functions/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-functions/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-functions/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-functions/v1/README.md create mode 100644 owl-bot-staging/google-cloud-functions/v1/package.json create mode 100644 owl-bot-staging/google-cloud-functions/v1/protos/google/cloud/functions/v1/functions.proto create mode 100644 owl-bot-staging/google-cloud-functions/v1/protos/google/cloud/functions/v1/operations.proto create mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.call_function.js create mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.create_function.js create mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.delete_function.js create mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.generate_download_url.js create mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.generate_upload_url.js create mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.get_function.js create mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.get_iam_policy.js create mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.list_functions.js create mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.set_iam_policy.js create mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.test_iam_permissions.js create mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.update_function.js create mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/snippet_metadata_google.cloud.functions.v1.json create mode 100644 owl-bot-staging/google-cloud-functions/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_client.ts create mode 100644 owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-functions/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-functions/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-functions/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-functions/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-functions/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-functions/v1/test/gapic_cloud_functions_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-functions/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-functions/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-functions/v2/.eslintignore create mode 100644 owl-bot-staging/google-cloud-functions/v2/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-functions/v2/.gitignore create mode 100644 owl-bot-staging/google-cloud-functions/v2/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-functions/v2/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-functions/v2/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-functions/v2/README.md create mode 100644 owl-bot-staging/google-cloud-functions/v2/package.json create mode 100644 owl-bot-staging/google-cloud-functions/v2/protos/google/cloud/functions/v2/functions.proto create mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.create_function.js create mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.delete_function.js create mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.generate_download_url.js create mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.generate_upload_url.js create mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.get_function.js create mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.list_functions.js create mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.list_runtimes.js create mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.update_function.js create mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/snippet_metadata_google.cloud.functions.v2.json create mode 100644 owl-bot-staging/google-cloud-functions/v2/src/index.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_client.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-functions/v2/src/v2/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-functions/v2/src/v2/index.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-functions/v2/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2/test/gapic_function_service_v2.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-functions/v2/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/.eslintignore create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/.gitignore create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/README.md create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/package.json create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/protos/google/cloud/functions/v2alpha/functions.proto create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.create_function.js create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.delete_function.js create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.generate_download_url.js create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.generate_upload_url.js create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.get_function.js create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.list_functions.js create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.list_runtimes.js create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.update_function.js create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/snippet_metadata_google.cloud.functions.v2alpha.json create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/src/index.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_client.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/index.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/test/gapic_function_service_v2alpha.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/.eslintignore create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/.gitignore create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/README.md create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/package.json create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/protos/google/cloud/functions/v2beta/functions.proto create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.create_function.js create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.delete_function.js create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.generate_download_url.js create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.generate_upload_url.js create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.get_function.js create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.list_functions.js create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.list_runtimes.js create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.update_function.js create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/snippet_metadata_google.cloud.functions.v2beta.json create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/src/index.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_client.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/index.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/test/gapic_function_service_v2beta.ts create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-functions/v2beta/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/README.md create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/package.json create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/backup.proto create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/backup_plan.proto create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/common.proto create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/gkebackup.proto create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/restore.proto create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/restore_plan.proto create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/volume.proto create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_backup.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_backup_plan.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_restore.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_restore_plan.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_backup.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_backup_plan.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_restore.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_restore_plan.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_backup.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_backup_plan.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_restore.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_restore_plan.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_volume_backup.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_volume_restore.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_backup_plans.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_backups.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_restore_plans.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_restores.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_volume_backups.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_volume_restores.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_backup.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_backup_plan.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_restore.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_restore_plan.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/snippet_metadata_google.cloud.gkebackup.v1.json create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_client.ts create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_client_config.json create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_proto_list.json create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/test/gapic_backup_for_g_k_e_v1.ts create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.gitignore create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/README.md create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/package.json create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.delete_resource.js create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.get_resource.js create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.patch_resource.js create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.post_resource.js create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.put_resource.js create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.gkeconnect.gateway.v1beta1.json create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_client.ts create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/index.ts create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/test/gapic_gateway_service_v1beta1.ts create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/README.md create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/package.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/configmanagement/configmanagement.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/feature.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/membership.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/multiclusteringress/multiclusteringress.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/service.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.create_feature.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.create_membership.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.delete_feature.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.delete_membership.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.generate_connect_manifest.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.get_feature.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.get_membership.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.list_features.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.list_memberships.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.update_feature.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.update_membership.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/snippet_metadata_google.cloud.gkehub.v1.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_client.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_client_config.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_proto_list.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/test/gapic_gke_hub_v1.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/.eslintignore create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/.gitignore create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/README.md create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/package.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/cloudauditlogging/cloudauditlogging.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/configmanagement/configmanagement.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/feature.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/metering/metering.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/multiclusteringress/multiclusteringress.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/service.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/servicemesh/servicemesh.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.create_feature.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.delete_feature.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.get_feature.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.list_features.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.update_feature.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.gkehub.v1alpha.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_client.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_client_config.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_proto_list.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/index.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/test/gapic_gke_hub_v1alpha.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/.eslintignore create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/.gitignore create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/README.md create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/package.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/protos/google/cloud/gkehub/v1alpha2/membership.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.create_membership.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.delete_membership.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.generate_connect_manifest.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.get_membership.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.initialize_hub.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.list_memberships.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.update_membership.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/snippet_metadata_google.cloud.gkehub.v1alpha2.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_client.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_client_config.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_proto_list.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/index.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/test/gapic_gke_hub_v1alpha2.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/.eslintignore create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/.gitignore create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/README.md create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/package.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/configmanagement/configmanagement.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/feature.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/metering/metering.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/multiclusteringress/multiclusteringress.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/service.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.create_feature.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.delete_feature.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.get_feature.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.list_features.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.update_feature.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.gkehub.v1beta.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_client.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_client_config.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_proto_list.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/index.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/test/gapic_gke_hub_v1beta.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/.gitignore create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/README.md create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/package.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/protos/google/cloud/gkehub/v1beta1/membership.proto create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.create_membership.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.delete_membership.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.generate_connect_manifest.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.generate_exclusivity_manifest.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.get_membership.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.list_memberships.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.update_membership.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.validate_exclusivity.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.gkehub.v1beta1.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_client.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/index.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/test/gapic_gke_hub_membership_service_v1beta1.ts create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/README.md create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/package.json create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/attached_resources.proto create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/attached_service.proto create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/aws_resources.proto create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/aws_service.proto create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/azure_resources.proto create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/azure_service.proto create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/common_resources.proto create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.create_attached_cluster.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.delete_attached_cluster.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.generate_attached_cluster_install_manifest.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.get_attached_cluster.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.get_attached_server_config.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.import_attached_cluster.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.list_attached_clusters.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.update_attached_cluster.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.create_aws_cluster.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.create_aws_node_pool.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.delete_aws_cluster.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.delete_aws_node_pool.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.generate_aws_access_token.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_cluster.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_node_pool.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_server_config.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.list_aws_clusters.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.list_aws_node_pools.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.update_aws_cluster.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.update_aws_node_pool.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_client.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_cluster.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_node_pool.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_client.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_cluster.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_node_pool.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.generate_azure_access_token.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_client.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_cluster.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_node_pool.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_server_config.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_clients.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_clusters.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_node_pools.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.update_azure_cluster.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.update_azure_node_pool.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/snippet_metadata_google.cloud.gkemulticloud.v1.json create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_client.ts create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_client_config.json create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_proto_list.json create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_client.ts create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_client_config.json create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_proto_list.json create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_client.ts create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_client_config.json create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_proto_list.json create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_attached_clusters_v1.ts create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_aws_clusters_v1.ts create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_azure_clusters_v1.ts create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/README.md create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/package.json create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/addon_widget_set.proto create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/calendar/calendar_addon_manifest.proto create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/docs/docs_addon_manifest.proto create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/drive/drive_addon_manifest.proto create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/extension_point.proto create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/gmail/gmail_addon_manifest.proto create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/script_manifest.proto create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/sheets/sheets_addon_manifest.proto create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/slides/slides_addon_manifest.proto create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/cloud/gsuiteaddons/v1/gsuiteaddons.proto create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.create_deployment.js create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.delete_deployment.js create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_authorization.js create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_deployment.js create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_install_status.js create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.install_deployment.js create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.list_deployments.js create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.replace_deployment.js create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.uninstall_deployment.js create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/snippet_metadata_google.cloud.gsuiteaddons.v1.json create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_client.ts create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_client_config.json create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_proto_list.json create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/test/gapic_g_suite_add_ons_v1.ts create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/webpack.config.js 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/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/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 create mode 100644 owl-bot-staging/google-cloud-ids/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-ids/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-ids/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-ids/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-ids/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-ids/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-ids/v1/README.md create mode 100644 owl-bot-staging/google-cloud-ids/v1/package.json create mode 100644 owl-bot-staging/google-cloud-ids/v1/protos/google/cloud/ids/v1/ids.proto create mode 100644 owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.create_endpoint.js create mode 100644 owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.delete_endpoint.js create mode 100644 owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.get_endpoint.js create mode 100644 owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.list_endpoints.js create mode 100644 owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/snippet_metadata_google.cloud.ids.v1.json create mode 100644 owl-bot-staging/google-cloud-ids/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-ids/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_client.ts create mode 100644 owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_client_config.json create mode 100644 owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_proto_list.json create mode 100644 owl-bot-staging/google-cloud-ids/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-ids/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-ids/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-ids/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-ids/v1/test/gapic_i_d_s_v1.ts create mode 100644 owl-bot-staging/google-cloud-ids/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-ids/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-iot/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-iot/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-iot/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/README.md create mode 100644 owl-bot-staging/google-cloud-iot/v1/package.json create mode 100644 owl-bot-staging/google-cloud-iot/v1/protos/google/cloud/iot/v1/device_manager.proto create mode 100644 owl-bot-staging/google-cloud-iot/v1/protos/google/cloud/iot/v1/resources.proto create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.bind_device_to_gateway.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.create_device.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.create_device_registry.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.delete_device.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.delete_device_registry.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.get_device.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.get_device_registry.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.get_iam_policy.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_config_versions.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_registries.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_states.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_devices.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.modify_cloud_to_device_config.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.send_command_to_device.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.set_iam_policy.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.test_iam_permissions.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.unbind_device_from_gateway.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.update_device.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.update_device_registry.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/snippet_metadata_google.cloud.iot.v1.json create mode 100644 owl-bot-staging/google-cloud-iot/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_client.ts create mode 100644 owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_client_config.json create mode 100644 owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_proto_list.json create mode 100644 owl-bot-staging/google-cloud-iot/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-iot/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-iot/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-iot/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-iot/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-iot/v1/test/gapic_device_manager_v1.ts create mode 100644 owl-bot-staging/google-cloud-iot/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-iot/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/README.md create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/package.json create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/protos/google/cloud/kms/inventory/v1/key_dashboard_service.proto create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/protos/google/cloud/kms/inventory/v1/key_tracking_service.proto create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_dashboard_service.list_crypto_keys.js create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_tracking_service.get_protected_resources_summary.js create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_tracking_service.search_protected_resources.js create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/snippet_metadata_google.cloud.kms.inventory.v1.json create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_client.ts create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_client.ts create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/test/gapic_key_dashboard_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/test/gapic_key_tracking_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-kms/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-kms/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-kms/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/README.md create mode 100644 owl-bot-staging/google-cloud-kms/v1/package.json create mode 100644 owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/ekm_service.proto create mode 100644 owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/resources.proto create mode 100644 owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/service.proto create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.create_ekm_connection.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.get_ekm_config.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.get_ekm_connection.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.list_ekm_connections.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.update_ekm_config.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.update_ekm_connection.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.verify_connectivity.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.asymmetric_decrypt.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.asymmetric_sign.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_crypto_key.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_crypto_key_version.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_import_job.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_key_ring.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.decrypt.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.destroy_crypto_key_version.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.encrypt.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.generate_random_bytes.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_crypto_key.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_crypto_key_version.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_import_job.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_key_ring.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_public_key.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.import_crypto_key_version.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_crypto_key_versions.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_crypto_keys.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_import_jobs.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_key_rings.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.mac_sign.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.mac_verify.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.raw_decrypt.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.raw_encrypt.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.restore_crypto_key_version.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key_version.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/snippet_metadata_google.cloud.kms.v1.json create mode 100644 owl-bot-staging/google-cloud-kms/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_client.ts create mode 100644 owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-kms/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-kms/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_client.ts create mode 100644 owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-kms/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-kms/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-kms/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-kms/v1/test/gapic_ekm_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-kms/v1/test/gapic_key_management_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-kms/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-kms/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-language/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-language/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-language/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-language/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-language/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-language/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-language/v1/README.md create mode 100644 owl-bot-staging/google-cloud-language/v1/package.json create mode 100644 owl-bot-staging/google-cloud-language/v1/protos/google/cloud/language/v1/language_service.proto create mode 100644 owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_entities.js create mode 100644 owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_entity_sentiment.js create mode 100644 owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_sentiment.js create mode 100644 owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_syntax.js create mode 100644 owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.annotate_text.js create mode 100644 owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.classify_text.js create mode 100644 owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.moderate_text.js create mode 100644 owl-bot-staging/google-cloud-language/v1/samples/generated/v1/snippet_metadata_google.cloud.language.v1.json create mode 100644 owl-bot-staging/google-cloud-language/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-language/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-language/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-language/v1/src/v1/language_service_client.ts create mode 100644 owl-bot-staging/google-cloud-language/v1/src/v1/language_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-language/v1/src/v1/language_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-language/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-language/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-language/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-language/v1/test/gapic_language_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-language/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-language/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/.eslintignore create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/.gitignore create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/README.md create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/package.json create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/protos/google/cloud/language/v1beta2/language_service.proto create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_entities.js create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_entity_sentiment.js create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_sentiment.js create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_syntax.js create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.annotate_text.js create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.classify_text.js create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.moderate_text.js create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/snippet_metadata_google.cloud.language.v1beta2.json create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/src/index.ts create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/index.ts create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_client.ts create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/test/gapic_language_service_v1beta2.ts create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-language/v1beta2/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-language/v2/.eslintignore create mode 100644 owl-bot-staging/google-cloud-language/v2/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-language/v2/.gitignore create mode 100644 owl-bot-staging/google-cloud-language/v2/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-language/v2/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-language/v2/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-language/v2/README.md create mode 100644 owl-bot-staging/google-cloud-language/v2/package.json create mode 100644 owl-bot-staging/google-cloud-language/v2/protos/google/cloud/language/v2/language_service.proto create mode 100644 owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.analyze_entities.js create mode 100644 owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.analyze_sentiment.js create mode 100644 owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.annotate_text.js create mode 100644 owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.classify_text.js create mode 100644 owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.moderate_text.js create mode 100644 owl-bot-staging/google-cloud-language/v2/samples/generated/v2/snippet_metadata_google.cloud.language.v2.json create mode 100644 owl-bot-staging/google-cloud-language/v2/src/index.ts create mode 100644 owl-bot-staging/google-cloud-language/v2/src/v2/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-language/v2/src/v2/index.ts create mode 100644 owl-bot-staging/google-cloud-language/v2/src/v2/language_service_client.ts create mode 100644 owl-bot-staging/google-cloud-language/v2/src/v2/language_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-language/v2/src/v2/language_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-language/v2/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-language/v2/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-language/v2/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-language/v2/test/gapic_language_service_v2.ts create mode 100644 owl-bot-staging/google-cloud-language/v2/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-language/v2/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintignore create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.gitignore create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/README.md create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/package.json create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/protos/google/cloud/lifesciences/v2beta/workflows.proto create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/snippet_metadata_google.cloud.lifesciences.v2beta.json create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/index.ts create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/index.ts create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client_config.json create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_proto_list.json create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/test/gapic_workflows_service_v2_beta_v2beta.ts create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/README.md create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/package.json create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/protos/google/cloud/managedidentities/v1/managed_identities_service.proto create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/protos/google/cloud/managedidentities/v1/resource.proto create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.attach_trust.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.delete_domain.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.detach_trust.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.get_domain.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.list_domains.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.reconfigure_trust.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.reset_admin_password.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.update_domain.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.validate_trust.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/snippet_metadata_google.cloud.managedidentities.v1.json create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_client.ts create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/test/gapic_managed_identities_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/.gitignore create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/README.md create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/package.json create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/protos/google/cloud/managedidentities/v1beta1/resource.proto create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.attach_trust.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.delete_domain.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.detach_trust.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.get_domain.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.list_domains.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.reset_admin_password.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.update_domain.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.validate_trust.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.managedidentities.v1beta1.json create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/index.ts create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_client.ts create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/test/gapic_managed_identities_service_v1beta1.ts create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/.gitignore create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/README.md create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/package.json create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/protos/google/cloud/mediatranslation/v1beta1/media_translation.proto create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.mediatranslation.v1beta1.json create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/samples/generated/v1beta1/speech_translation_service.streaming_translate_speech.js create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/index.ts create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_client.ts create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/test/gapic_speech_translation_service_v1beta1.ts create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-memcache/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-memcache/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-memcache/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1/README.md create mode 100644 owl-bot-staging/google-cloud-memcache/v1/package.json create mode 100644 owl-bot-staging/google-cloud-memcache/v1/protos/google/cloud/memcache/v1/cloud_memcache.proto create mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.apply_parameters.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.create_instance.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.delete_instance.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.get_instance.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.list_instances.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.reschedule_maintenance.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.update_instance.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.update_parameters.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/snippet_metadata_google.cloud.memcache.v1.json create mode 100644 owl-bot-staging/google-cloud-memcache/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_client.ts create mode 100644 owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_client_config.json create mode 100644 owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_proto_list.json create mode 100644 owl-bot-staging/google-cloud-memcache/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-memcache/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-memcache/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-memcache/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-memcache/v1/test/gapic_cloud_memcache_v1.ts create mode 100644 owl-bot-staging/google-cloud-memcache/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-memcache/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/.eslintignore create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/.gitignore create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/README.md create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/package.json create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/protos/google/cloud/memcache/v1beta2/cloud_memcache.proto create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.apply_parameters.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.apply_software_update.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.create_instance.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.delete_instance.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.get_instance.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.list_instances.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.reschedule_maintenance.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.update_instance.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.update_parameters.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/snippet_metadata_google.cloud.memcache.v1beta2.json create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/src/index.ts create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_client.ts create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_client_config.json create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_proto_list.json create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/index.ts create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/test/gapic_cloud_memcache_v1beta2.ts create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-metastore/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-metastore/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/README.md create mode 100644 owl-bot-staging/google-cloud-metastore/v1/package.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore.proto create mode 100644 owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore_federation.proto create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.alter_metadata_resource_location.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.export_metadata.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_backups.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_metadata_imports.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_services.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.move_table_to_database.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.query_metadata.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.restore_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.create_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.delete_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.get_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.list_federations.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.update_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/snippet_metadata_google.cloud.metastore.v1.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client_config.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client_config.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_proto_list.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_proto_list.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_federation_v1.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_v1.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.eslintignore create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.gitignore create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/README.md create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/package.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore.proto create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore_federation.proto create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.alter_metadata_resource_location.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.export_metadata.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_backups.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_services.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.move_table_to_database.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.query_metadata.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.remove_iam_policy.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.restore_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.metastore.v1alpha.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client_config.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client_config.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_proto_list.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_proto_list.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_federation_v1alpha.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_v1alpha.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.eslintignore create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.gitignore create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/README.md create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/package.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore.proto create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore_federation.proto create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.alter_metadata_resource_location.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.export_metadata.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_backups.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_services.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.move_table_to_database.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.query_metadata.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.remove_iam_policy.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.restore_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.create_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.get_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.list_federations.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.update_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.metastore.v1beta.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client_config.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client_config.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_proto_list.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_proto_list.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_federation_v1beta.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_v1beta.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/README.md create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/package.json create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/protos/google/cloud/migrationcenter/v1/migrationcenter.proto create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.add_assets_to_group.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.aggregate_assets_values.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.batch_delete_assets.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.batch_update_assets.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_group.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_import_data_file.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_import_job.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_preference_set.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_report.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_report_config.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_source.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_asset.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_group.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_import_data_file.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_import_job.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_preference_set.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_report.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_report_config.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_source.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_asset.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_error_frame.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_group.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_import_data_file.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_import_job.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_preference_set.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_report.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_report_config.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_settings.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_source.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_assets.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_error_frames.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_groups.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_import_data_files.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_import_jobs.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_preference_sets.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_report_configs.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_reports.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_sources.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.remove_assets_from_group.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.report_asset_frames.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.run_import_job.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_asset.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_group.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_import_job.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_preference_set.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_settings.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_source.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.validate_import_job.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/snippet_metadata_google.cloud.migrationcenter.v1.json create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_client.ts create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_client_config.json create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_proto_list.json create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/test/gapic_migration_center_v1.ts create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/README.md create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/package.json create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/protos/google/cloud/networkconnectivity/v1/common.proto create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/protos/google/cloud/networkconnectivity/v1/hub.proto create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.create_hub.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.create_spoke.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.delete_hub.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.delete_spoke.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.get_hub.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.get_spoke.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.list_hubs.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.list_spokes.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.update_hub.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.update_spoke.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/snippet_metadata_google.cloud.networkconnectivity.v1.json create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_client.ts create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/test/gapic_hub_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.gitignore create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/README.md create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/package.json create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/common.proto create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/hub.proto create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.create_hub.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.create_spoke.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.delete_hub.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.delete_spoke.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.get_hub.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.get_spoke.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.list_hubs.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.list_spokes.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.update_hub.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.update_spoke.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/snippet_metadata_google.cloud.networkconnectivity.v1alpha1.json create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_client.ts create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/index.ts create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/test/gapic_hub_service_v1alpha1.ts create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/README.md create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/package.json create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/connectivity_test.proto create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/reachability.proto create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/trace.proto create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.create_connectivity_test.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.delete_connectivity_test.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.get_connectivity_test.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.list_connectivity_tests.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.rerun_connectivity_test.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.update_connectivity_test.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/snippet_metadata_google.cloud.networkmanagement.v1.json create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_client.ts create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/test/gapic_reachability_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/.gitignore create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/README.md create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/package.json create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/connectivity_test.proto create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/reachability.proto create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/trace.proto create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.create_connectivity_test.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.delete_connectivity_test.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.get_connectivity_test.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.list_connectivity_tests.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.rerun_connectivity_test.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.update_connectivity_test.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.networkmanagement.v1beta1.json create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/index.ts create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_client.ts create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/test/gapic_reachability_service_v1beta1.ts create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/webpack.config.js diff --git a/owl-bot-staging/google-cloud-functions/v1/.eslintignore b/owl-bot-staging/google-cloud-functions/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-functions/v1/.eslintrc.json b/owl-bot-staging/google-cloud-functions/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-functions/v1/.gitignore b/owl-bot-staging/google-cloud-functions/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/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-functions/v1/.jsdoc.js b/owl-bot-staging/google-cloud-functions/v1/.jsdoc.js new file mode 100644 index 00000000000..43186156cf8 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/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/functions', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-functions/v1/.mocharc.js b/owl-bot-staging/google-cloud-functions/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/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-functions/v1/.prettierrc.js b/owl-bot-staging/google-cloud-functions/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/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-functions/v1/README.md b/owl-bot-staging/google-cloud-functions/v1/README.md new file mode 100644 index 00000000000..efb614cf6e7 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/README.md @@ -0,0 +1 @@ +Functions: Nodejs Client diff --git a/owl-bot-staging/google-cloud-functions/v1/package.json b/owl-bot-staging/google-cloud-functions/v1/package.json new file mode 100644 index 00000000000..8ccda2512b2 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/functions", + "version": "0.1.0", + "description": "Functions client for Node.js", + "repository": "googleapis/nodejs-functions", + "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 functions", + "functions", + "cloud functions service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-functions/v1/protos/google/cloud/functions/v1/functions.proto b/owl-bot-staging/google-cloud-functions/v1/protos/google/cloud/functions/v1/functions.proto new file mode 100644 index 00000000000..340338e5b23 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/protos/google/cloud/functions/v1/functions.proto @@ -0,0 +1,866 @@ +// 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 +// +// 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.functions.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/functions/v1/operations.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/functions/apiv1/functionspb;functionspb"; +option java_multiple_files = true; +option java_outer_classname = "FunctionsProto"; +option java_package = "com.google.cloud.functions.v1"; +option objc_class_prefix = "GCF"; +option (google.api.resource_definition) = { + type: "artifactregistry.googleapis.com/Repository" + pattern: "projects/{project}/locations/{location}/repositories/{repository}" +}; +option (google.api.resource_definition) = { + type: "cloudkms.googleapis.com/CryptoKey" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" +}; + +// A service that application uses to manipulate triggers and functions. +service CloudFunctionsService { + option (google.api.default_host) = "cloudfunctions.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Returns a list of functions that belong to the requested project. + rpc ListFunctions(ListFunctionsRequest) returns (ListFunctionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/functions" + }; + } + + // Returns a function with the given name from the requested project. + rpc GetFunction(GetFunctionRequest) returns (CloudFunction) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new function. If a function with the given name already exists in + // the specified project, the long running operation returns an + // `ALREADY_EXISTS` error. + rpc CreateFunction(CreateFunctionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{location=projects/*/locations/*}/functions" + body: "function" + }; + option (google.api.method_signature) = "location,function"; + option (google.longrunning.operation_info) = { + response_type: "CloudFunction" + metadata_type: "OperationMetadataV1" + }; + } + + // Updates existing function. + rpc UpdateFunction(UpdateFunctionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{function.name=projects/*/locations/*/functions/*}" + body: "function" + }; + option (google.api.method_signature) = "function"; + option (google.longrunning.operation_info) = { + response_type: "CloudFunction" + metadata_type: "OperationMetadataV1" + }; + } + + // Deletes a function with the given name from the specified project. If the + // given function is used by some trigger, the trigger is updated to + // remove this function. + rpc DeleteFunction(DeleteFunctionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadataV1" + }; + } + + // Synchronously invokes a deployed Cloud Function. To be used for testing + // purposes as very limited traffic is allowed. For more information on + // the actual limits, refer to + // [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits). + rpc CallFunction(CallFunctionRequest) returns (CallFunctionResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/functions/*}:call" + body: "*" + }; + option (google.api.method_signature) = "name,data"; + } + + // Returns a signed URL for uploading a function source code. + // For more information about the signed URL usage see: + // https://cloud.google.com/storage/docs/access-control/signed-urls. + // Once the function source code upload is complete, the used signed + // URL should be provided in CreateFunction or UpdateFunction request + // as a reference to the function source code. + // + // When uploading source code to the generated signed URL, please follow + // these restrictions: + // + // * Source file type should be a zip file. + // * Source file size should not exceed 100MB limit. + // * No credentials should be attached - the signed URLs provide access to the + // target bucket using internal service identity; if credentials were + // attached, the identity from the credentials would be used, but that + // identity does not have permissions to upload files to the URL. + // + // When making an HTTP PUT request, these two headers must be specified: + // + // * `content-type: application/zip` + // * `x-goog-content-length-range: 0,104857600` + // + // And this header must NOT be specified: + // + // * `Authorization: Bearer YOUR_TOKEN` + rpc GenerateUploadUrl(GenerateUploadUrlRequest) + returns (GenerateUploadUrlResponse) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/functions:generateUploadUrl" + body: "*" + }; + } + + // Returns a signed URL for downloading deployed function source code. + // The URL is only valid for a limited period and must be used within + // minutes after generation. + // For more information about the signed URL usage, see: + // https://cloud.google.com/storage/docs/access-control/signed-urls + rpc GenerateDownloadUrl(GenerateDownloadUrlRequest) + returns (GenerateDownloadUrlResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/functions/*}:generateDownloadUrl" + body: "*" + }; + } + + // Sets the IAM access control policy on the specified function. + // Replaces any existing policy. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/locations/*/functions/*}:setIamPolicy" + body: "*" + }; + } + + // Gets the IAM access control policy for a function. + // Returns an empty policy if the function exists and does not have a policy + // set. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.http) = { + get: "/v1/{resource=projects/*/locations/*/functions/*}:getIamPolicy" + }; + } + + // Tests the specified permissions against the IAM access control policy + // for a function. + // If the function does not exist, this returns an empty set of + // permissions, not a NOT_FOUND error. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) + returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/locations/*/functions/*}:testIamPermissions" + body: "*" + }; + } +} + +// Describes a Cloud Function that contains user computation executed in +// response to an event. It encapsulates function and triggers configurations. +message CloudFunction { + option (google.api.resource) = { + type: "cloudfunctions.googleapis.com/CloudFunction" + pattern: "projects/{project}/locations/{location}/functions/{function}" + }; + + // Available egress settings. + // + // This controls what traffic is diverted through the Serverless VPC Access + // connector resource. By default, PRIVATE_RANGES_ONLY is used. + enum VpcConnectorEgressSettings { + // Unspecified. + VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; + + // Use the Serverless VPC Access connector only for private IP space from + // RFC1918. + PRIVATE_RANGES_ONLY = 1; + + // Force the use of Serverless VPC Access connector for all egress traffic + // from the function. + ALL_TRAFFIC = 2; + } + + // Available ingress settings. + // + // This controls what traffic can reach the function. + // + // If unspecified, ALLOW_ALL is used. + enum IngressSettings { + // Unspecified. + INGRESS_SETTINGS_UNSPECIFIED = 0; + + // Allow HTTP traffic from public and private sources. + ALLOW_ALL = 1; + + // Allow HTTP traffic from only private VPC sources. + ALLOW_INTERNAL_ONLY = 2; + + // Allow HTTP traffic from private VPC sources and through GCLB. + ALLOW_INTERNAL_AND_GCLB = 3; + } + + // Docker Registry to use for storing function Docker images. + enum DockerRegistry { + // Unspecified. + DOCKER_REGISTRY_UNSPECIFIED = 0; + + // Docker images are stored in multi-regional Container Registry + // repositories named `gcf`. + CONTAINER_REGISTRY = 1; + + // Docker images are stored in regional Artifact Registry repositories. + // By default, Cloud Functions creates and uses repositories named + // `gcf-artifacts` in every region in which a function is deployed. But the + // repository to use can also be specified by the user by using the + // `docker_repository` field. + ARTIFACT_REGISTRY = 2; + } + + // A user-defined name of the function. Function names must be unique + // globally and match pattern `projects/*/locations/*/functions/*` + string name = 1; + + // User-provided description of a function. + string description = 2; + + // The location of the function source code. + oneof source_code { + // The Google Cloud Storage URL, starting with `gs://`, pointing to the zip + // archive which contains the function. + string source_archive_url = 3; + + // **Beta Feature** + // + // The source repository where a function is hosted. + SourceRepository source_repository = 4; + + // The Google Cloud Storage-signed URL used for source uploading, generated + // by calling [google.cloud.functions.v1.GenerateUploadUrl]. + // + // The signature is validated on write methods (Create, Update) + // The signature is stripped from the Function object on read methods (Get, + // List) + string source_upload_url = 16; + } + + // An event that triggers the function. + oneof trigger { + // An HTTPS endpoint type of source that can be triggered via URL. + HttpsTrigger https_trigger = 5; + + // A source that fires events in response to a condition in another service. + EventTrigger event_trigger = 6; + } + + // Output only. Status of the function deployment. + CloudFunctionStatus status = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The name of the function (as defined in source code) that is executed. + // Defaults to the resource name suffix, if not specified. For + // backward compatibility, if function with given name is not found, the + // system tries to use the function named "function". + // For Node.js, this is the name of a function exported by the module + // as specified in `source_location`. + string entry_point = 8; + + // The runtime in which to run the function. Required when deploying a new + // function, optional when updating an existing function. For a complete + // list of possible choices, see the + // [`gcloud` command + // reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + string runtime = 19; + + // The function execution timeout. Execution is considered failed and + // can be terminated if the function is not completed at the end of the + // timeout period. Defaults to 60 seconds. + google.protobuf.Duration timeout = 9; + + // The amount of memory in MB available for a function. + // Defaults to 256MB. + int32 available_memory_mb = 10; + + // The email of the function's service account. If empty, defaults to + // `{project_id}@appspot.gserviceaccount.com`. + string service_account_email = 11; + + // Output only. The last update timestamp of a Cloud Function. + google.protobuf.Timestamp update_time = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The version identifier of the Cloud Function. Each deployment + // attempt results in a new version of a function being created. + int64 version_id = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels associated with this Cloud Function. + map labels = 15; + + // Environment variables that shall be available during function execution. + map environment_variables = 17; + + // Build environment variables that shall be available during build time. + map build_environment_variables = 28; + + // The Serverless VPC Access connector that this cloud function can connect + // to. It can be either the fully qualified URI, or the short name of the + // connector resource. If the connector name is used, the connector must + // belong to the same project as the function. Otherwise, it must belong to a + // project within the same organization. The format of this field is either + // `projects/{project}/global/networks/{network}` or `{network}`, where + // `{project}` is a project id where the network is defined, and `{network}` + // is the short name of the network. + // + // This field is mutually exclusive with `vpc_connector` and will be replaced + // by it. + // + // See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for + // more information on connecting Cloud projects. + string network = 18; + + // The limit on the maximum number of function instances that can coexist at a + // given time. + // + // In some cases, such as rapid traffic surges, Cloud Functions can for a + // short period of time create more instances than the specified max + // instances limit. If your function cannot tolerate this temporary behavior, + // you might want to factor in a safety margin and set a lower max instances + // value than your function can tolerate. + // + // See the [Max + // Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + // more details. + int32 max_instances = 20; + + // A lower bound for the number function instances that can coexist at a + // given time. + int32 min_instances = 32; + + // The VPC Network Connector that this cloud function can connect to. It can + // be either the fully qualified URI, or the short name of the network + // connector resource. The format of this field is + // `projects/*/locations/*/connectors/*` + // + // This field is mutually exclusive with `network` field and will eventually + // replace it. + // + // See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for + // more information on connecting Cloud projects. + string vpc_connector = 22; + + // The egress settings for the connector, controlling what traffic is diverted + // through it. + VpcConnectorEgressSettings vpc_connector_egress_settings = 23; + + // The ingress settings for the function, controlling what traffic can reach + // it. + IngressSettings ingress_settings = 24; + + // Resource name of a KMS crypto key (managed by the user) used to + // encrypt/decrypt function resources. + // + // It must match the pattern + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + // + // If specified, you must also provide an artifact registry repository using + // the `docker_repository` field that was created with the same KMS crypto + // key. + // + // The following service accounts need to be granted the role 'Cloud KMS + // CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' + // on the Key/KeyRing/Project/Organization (least access preferred). + // + // 1. Google Cloud Functions service account + // (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - + // Required to protect the function's image. + // 2. Google Storage service account + // (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - + // Required to protect the function's source code. + // If this service account does not exist, deploying a function without a + // KMS key or retrieving the service agent name provisions it. For more + // information, see + // https://cloud.google.com/storage/docs/projects#service-agents and + // https://cloud.google.com/storage/docs/getting-service-agent#gsutil. + // + // Google Cloud Functions delegates access to service agents to protect + // function resources in internal projects that are not accessible by the + // end user. + string kms_key_name = 25 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + }]; + + // Name of the Cloud Build Custom Worker Pool that should be used to build the + // function. The format of this field is + // `projects/{project}/locations/{region}/workerPools/{workerPool}` where + // `{project}` and `{region}` are the project id and region respectively where + // the worker pool is defined and `{workerPool}` is the short name of the + // worker pool. + // + // If the project id is not the same as the function, then the Cloud + // Functions Service Agent + // (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must + // be granted the role Cloud Build Custom Workers Builder + // (`roles/cloudbuild.customworkers.builder`) in the project. + string build_worker_pool = 26; + + // Output only. The Cloud Build ID of the latest successful deployment of the + // function. + string build_id = 27 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Cloud Build Name of the function deployment. + // `projects//locations//builds/`. + string build_name = 33 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Secret environment variables configuration. + repeated SecretEnvVar secret_environment_variables = 29; + + // Secret volumes configuration. + repeated SecretVolume secret_volumes = 30; + + // Input only. An identifier for Firebase function sources. Disclaimer: This + // field is only supported for Firebase function deployments. + string source_token = 31 [(google.api.field_behavior) = INPUT_ONLY]; + + // User managed repository created in Artifact Registry optionally with a + // customer managed encryption key. If specified, deployments will use + // Artifact Registry. If unspecified and the deployment is eligible to use + // Artifact Registry, GCF will create and use a repository named + // 'gcf-artifacts' for every deployed region. This is the repository to which + // the function docker image is pushed after it is built by Cloud Build. + // + // It must match the pattern + // `projects/{project}/locations/{location}/repositories/{repository}`. + // + // Cross-project repositories are not supported. + // Cross-location repositories are not supported. + // Repository format must be 'DOCKER'. + string docker_repository = 34 [(google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/Repository" + }]; + + // Docker Registry to use for this deployment. + // + // If `docker_repository` field is specified, this field is automatically + // set as `ARTIFACT_REGISTRY`. + // If unspecified, it currently defaults to `CONTAINER_REGISTRY`. + // This field may be overridden by the backend for eligible deployments. + DockerRegistry docker_registry = 35; +} + +// Describes SourceRepository, used to represent parameters related to +// source repository where a function is hosted. +message SourceRepository { + // The URL pointing to the hosted repository where the function is defined. + // There are supported Cloud Source Repository URLs in the following + // formats: + // + // To refer to a specific commit: + // `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` + // To refer to a moveable alias (branch): + // `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` + // In particular, to refer to HEAD use `master` moveable alias. + // To refer to a specific fixed alias (tag): + // `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` + // + // You can omit `paths/*` if you want to use the main directory. + string url = 1; + + // Output only. The URL pointing to the hosted repository where the function + // were defined at the time of deployment. It always points to a specific + // commit in the format described above. + string deployed_url = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Describes HttpsTrigger, could be used to connect web hooks to function. +message HttpsTrigger { + // Available security-level settings. + // + // This controls the methods to enforce security (HTTPS) on a URL. + // + // If unspecified, SECURE_OPTIONAL is used. + enum SecurityLevel { + // Unspecified. + SECURITY_LEVEL_UNSPECIFIED = 0; + + // Requests for a URL that match this handler that do not use HTTPS are + // automatically redirected to the HTTPS URL with the same path. Query + // parameters are reserved for the redirect. + SECURE_ALWAYS = 1; + + // Both HTTP and HTTPS requests with URLs that match the handler succeed + // without redirects. The application can examine the request to determine + // which protocol was used and respond accordingly. + SECURE_OPTIONAL = 2; + } + + // Output only. The deployed URL for the function. + string url = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The security level for the function. + SecurityLevel security_level = 2; +} + +// Describes EventTrigger, used to request that events be sent from another +// service. +message EventTrigger { + // Required. The type of event to observe. For example: + // `providers/cloud.storage/eventTypes/object.change` and + // `providers/cloud.pubsub/eventTypes/topic.publish`. + // + // Event types match pattern `providers/*/eventTypes/*.*`. + // The pattern contains: + // + // 1. namespace: For example, `cloud.storage` and + // `google.firebase.analytics`. + // 2. resource type: The type of resource on which event occurs. For + // example, the Google Cloud Storage API includes the type `object`. + // 3. action: The action that generates the event. For example, action for + // a Google Cloud Storage Object is 'change'. + // These parts are lowercase. + string event_type = 1; + + // Required. The resource(s) from which to observe events, for example, + // `projects/_/buckets/myBucket`. + // + // Not all syntactically correct values are accepted by all services. For + // example: + // + // 1. The authorization model must support it. Google Cloud Functions + // only allows EventTriggers to be deployed that observe resources in the + // same project as the `CloudFunction`. + // 2. The resource type must match the pattern expected for an + // `event_type`. For example, an `EventTrigger` that has an + // `event_type` of "google.pubsub.topic.publish" should have a resource + // that matches Google Cloud Pub/Sub topics. + // + // Additionally, some services may support short names when creating an + // `EventTrigger`. These are always returned in the normalized "long" + // format. + // + // See each *service's* documentation for supported formats. + string resource = 2; + + // The hostname of the service that should be observed. + // + // If no string is provided, the default service implementing the API will + // be used. For example, `storage.googleapis.com` is the default for all + // event types in the `google.storage` namespace. + string service = 3; + + // Specifies policy for failed executions. + FailurePolicy failure_policy = 5; +} + +// Describes the policy in case of function's execution failure. +// If empty, then defaults to ignoring failures (i.e., not retrying them). +message FailurePolicy { + // Describes the retry policy in case of function's execution failure. + // A function execution is retried on any failure. + // A failed execution is retried up to 7 days with an exponential backoff + // (capped at 10 seconds). + // Retried execution is charged as any other execution. + message Retry {} + + // Defines the action taken in case of a function execution failure. + oneof action { + // If specified, the function is retried in case of a failure. + Retry retry = 1; + } +} + +// Describes the current stage of a deployment. +enum CloudFunctionStatus { + // Not specified. Invalid state. + CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0; + + // Function has been successfully deployed and is serving. + ACTIVE = 1; + + // Function deployment failed and the function isn’t serving. + OFFLINE = 2; + + // Function is being created or updated. + DEPLOY_IN_PROGRESS = 3; + + // Function is being deleted. + DELETE_IN_PROGRESS = 4; + + // Function deployment failed and the function serving state is undefined. + // The function should be updated or deleted to move it out of this state. + UNKNOWN = 5; +} + +// Configuration for a secret environment variable. It has the information +// necessary to fetch the secret value from Secret Manager and expose it as an +// environment variable. +message SecretEnvVar { + // Name of the environment variable. + string key = 1; + + // Project identifier (preferrably project number but can also be the project + // ID) of the project that contains the secret. If not set, it is + // populated with the function's project, assuming that the secret exists in + // the same project as the function. + string project_id = 2; + + // Name of the secret in Secret Manager (not the full resource name). + string secret = 3; + + // Version of the secret (version number or the string 'latest'). It is + // recommended to use a numeric version for secret environment variables as + // any updates to the secret value is not reflected until new instances start. + string version = 4; +} + +// Configuration for a secret volume. It has the information necessary to fetch +// the secret value from Secret Manager and make it available as files mounted +// at the requested paths within the application container. Secret value is not +// a part of the configuration. Every file system read operation performs a +// lookup in Secret Manager to retrieve the secret value. +message SecretVolume { + // Configuration for a single version. + message SecretVersion { + // Version of the secret (version number or the string 'latest'). It is + // preferable to use `latest` version with secret volumes as secret value + // changes are reflected immediately. + string version = 1; + + // Relative path of the file under the mount path where the secret value for + // this version is fetched and made available. For example, setting the + // mount_path as '/etc/secrets' and path as `/secret_foo` mounts the + // secret value file at `/etc/secrets/secret_foo`. + string path = 2; + } + + // The path within the container to mount the secret volume. For example, + // setting the mount_path as `/etc/secrets` mounts the secret value files + // under the `/etc/secrets` directory. This directory is also completely + // shadowed and unavailable to mount any other secrets. + // + // Recommended mount paths: /etc/secrets + // Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log + string mount_path = 1; + + // Project identifier (preferrably project number but can also be the project + // ID) of the project that contains the secret. If not set, it is + // populated with the function's project, assuming that the secret exists in + // the same project as the function. + string project_id = 2; + + // Name of the secret in Secret Manager (not the full resource name). + string secret = 3; + + // List of secret versions to mount for this secret. If empty, the `latest` + // version of the secret is made available in a file named after the + // secret under the mount point. + repeated SecretVersion versions = 4; +} + +// Request for the `CreateFunction` method. +message CreateFunctionRequest { + // Required. The project and location in which the function should be created, + // specified in the format `projects/*/locations/*` + string location = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Function to be created. + CloudFunction function = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `UpdateFunction` method. +message UpdateFunctionRequest { + // Required. New version of the function. + CloudFunction function = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The list of fields in `CloudFunction` that have to be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for the `GetFunction` method. +message GetFunctionRequest { + // Required. The name of the function which details should be obtained. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/CloudFunction" + } + ]; +} + +// Request for the `ListFunctions` method. +message ListFunctionsRequest { + // The project and location from which the function should be listed, + // specified in the format `projects/*/locations/*` + // If you want to list functions in all locations, use "-" in place of a + // location. When listing functions in all locations, if one or more + // location(s) are unreachable, the response will contain functions from all + // reachable locations along with the names of any unreachable locations. + string parent = 1 [(google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + }]; + + // Maximum number of functions to return per call. + int32 page_size = 2; + + // The value returned by the last + // `ListFunctionsResponse`; indicates that + // this is a continuation of a prior `ListFunctions` call, and that the + // system should return the next page of data. + string page_token = 3; +} + +// Response for the `ListFunctions` method. +message ListFunctionsResponse { + // The functions that match the request. + repeated CloudFunction functions = 1; + + // If not empty, indicates that there may be more functions that match + // the request; this value should be passed in a new + // [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] + // to get more functions. + string next_page_token = 2; + + // Locations that could not be reached. The response does not include any + // functions from these locations. + repeated string unreachable = 3; +} + +// Request for the `DeleteFunction` method. +message DeleteFunctionRequest { + // Required. The name of the function which should be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/CloudFunction" + } + ]; +} + +// Request for the `CallFunction` method. +message CallFunctionRequest { + // Required. The name of the function to be called. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/CloudFunction" + } + ]; + + // Required. Input to be passed to the function. + string data = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Response of `CallFunction` method. +message CallFunctionResponse { + // Execution id of function invocation. + string execution_id = 1; + + // Result populated for successful execution of synchronous function. Will + // not be populated if function does not return a result through context. + string result = 2; + + // Either system or user-function generated error. Set if execution + // was not successful. + string error = 3; +} + +// Request of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlRequest { + // The project and location in which the Google Cloud Storage signed URL + // should be generated, specified in the format `projects/*/locations/*`. + string parent = 1; + + // Resource name of a KMS crypto key (managed by the user) used to + // encrypt/decrypt function source code objects in staging Cloud Storage + // buckets. When you generate an upload url and upload your source code, it + // gets copied to a staging Cloud Storage bucket in an internal regional + // project. The source code is then copied to a versioned directory in the + // sources bucket in the consumer project during the function deployment. + // + // It must match the pattern + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + // + // The Google Cloud Functions service account + // (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + // granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + // (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + // Key/KeyRing/Project/Organization (least access preferred). GCF will + // delegate access to the Google Storage service account in the internal + // project. + string kms_key_name = 2 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + }]; +} + +// Response of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for a + // function source code upload. The uploaded file should be a zip archive + // which contains a function. + string upload_url = 1; +} + +// Request of `GenerateDownloadUrl` method. +message GenerateDownloadUrlRequest { + // The name of function for which source code Google Cloud Storage signed + // URL should be generated. + string name = 1; + + // The optional version of function. If not set, default, current version + // is used. + uint64 version_id = 2; +} + +// Response of `GenerateDownloadUrl` method. +message GenerateDownloadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for + // function source code download. + string download_url = 1; +} diff --git a/owl-bot-staging/google-cloud-functions/v1/protos/google/cloud/functions/v1/operations.proto b/owl-bot-staging/google-cloud-functions/v1/protos/google/cloud/functions/v1/operations.proto new file mode 100644 index 00000000000..1a9ba18890b --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/protos/google/cloud/functions/v1/operations.proto @@ -0,0 +1,73 @@ +// 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 +// +// 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.functions.v1; + +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/functions/apiv1/functionspb;functionspb"; +option java_multiple_files = true; +option java_outer_classname = "FunctionsOperationsProto"; +option java_package = "com.google.cloud.functions.v1"; + +// A type of an operation. +enum OperationType { + // Unknown operation type. + OPERATION_UNSPECIFIED = 0; + + // Triggered by CreateFunction call + CREATE_FUNCTION = 1; + + // Triggered by UpdateFunction call + UPDATE_FUNCTION = 2; + + // Triggered by DeleteFunction call. + DELETE_FUNCTION = 3; +} + +// Metadata describing an [Operation][google.longrunning.Operation] +message OperationMetadataV1 { + // Target of the operation - for example + // `projects/project-1/locations/region-1/functions/function-1` + string target = 1; + + // Type of operation. + OperationType type = 2; + + // The original request that started the operation. + google.protobuf.Any request = 3; + + // Version id of the function created or updated by an API call. + // This field is only populated for Create and Update operations. + int64 version_id = 4; + + // The last update timestamp of the operation. + google.protobuf.Timestamp update_time = 5; + + // The Cloud Build ID of the function created or updated by an API call. + // This field is only populated for Create and Update operations. + string build_id = 6; + + // An identifier for Firebase function sources. Disclaimer: This field is only + // supported for Firebase function deployments. + string source_token = 7; + + // The Cloud Build Name of the function deployment. + // This field is only populated for Create and Update operations. + // `projects//locations//builds/`. + string build_name = 8; +} diff --git a/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.call_function.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.call_function.js new file mode 100644 index 00000000000..c3c01a9aaf3 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.call_function.js @@ -0,0 +1,66 @@ +// 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, data) { + // [START cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function to be called. + */ + // const name = 'abc123' + /** + * Required. Input to be passed to the function. + */ + // const data = 'abc123' + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callCallFunction() { + // Construct request + const request = { + name, + data, + }; + + // Run request + const response = await functionsClient.callFunction(request); + console.log(response); + } + + callCallFunction(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_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-functions/v1/samples/generated/v1/cloud_functions_service.create_function.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.create_function.js new file mode 100644 index 00000000000..dbb4c91641e --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.create_function.js @@ -0,0 +1,68 @@ +// 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(location, function1) { + // [START cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_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 project and location in which the function should be created, + * specified in the format `projects/* /locations/*` + */ + // const location = 'abc123' + /** + * Required. Function to be created. + */ + // const function = {} + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callCreateFunction() { + // Construct request + const request = { + location, + function1, + }; + + // Run request + const [operation] = await functionsClient.createFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFunction(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_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-functions/v1/samples/generated/v1/cloud_functions_service.delete_function.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.delete_function.js new file mode 100644 index 00000000000..20927310ece --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.delete_function.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 cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which should be deleted. + */ + // const name = 'abc123' + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callDeleteFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await functionsClient.deleteFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFunction(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_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-functions/v1/samples/generated/v1/cloud_functions_service.generate_download_url.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.generate_download_url.js new file mode 100644 index 00000000000..bb0ca85a69a --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.generate_download_url.js @@ -0,0 +1,66 @@ +// 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() { + // [START cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The name of function for which source code Google Cloud Storage signed + * URL should be generated. + */ + // const name = 'abc123' + /** + * The optional version of function. If not set, default, current version + * is used. + */ + // const versionId = 1234 + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callGenerateDownloadUrl() { + // Construct request + const request = { + }; + + // Run request + const response = await functionsClient.generateDownloadUrl(request); + console.log(response); + } + + callGenerateDownloadUrl(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_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-functions/v1/samples/generated/v1/cloud_functions_service.generate_upload_url.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.generate_upload_url.js new file mode 100644 index 00000000000..52ec47839a4 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.generate_upload_url.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() { + // [START cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in staging Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to a staging Cloud Storage bucket in an internal regional + * project. The source code is then copied to a versioned directory in the + * sources bucket in the consumer project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). GCF will + * delegate access to the Google Storage service account in the internal + * project. + */ + // const kmsKeyName = 'abc123' + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callGenerateUploadUrl() { + // Construct request + const request = { + }; + + // Run request + const response = await functionsClient.generateUploadUrl(request); + console.log(response); + } + + callGenerateUploadUrl(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_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-functions/v1/samples/generated/v1/cloud_functions_service.get_function.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.get_function.js new file mode 100644 index 00000000000..7882acbad52 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.get_function.js @@ -0,0 +1,61 @@ +// 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 cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which details should be obtained. + */ + // const name = 'abc123' + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callGetFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await functionsClient.getFunction(request); + console.log(response); + } + + callGetFunction(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_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-functions/v1/samples/generated/v1/cloud_functions_service.get_iam_policy.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.get_iam_policy.js new file mode 100644 index 00000000000..8f206ab5c56 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_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 cloudfunctions_v1_generated_CloudFunctionsService_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 Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await functionsClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_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-functions/v1/samples/generated/v1/cloud_functions_service.list_functions.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.list_functions.js new file mode 100644 index 00000000000..9b3a80b942f --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.list_functions.js @@ -0,0 +1,78 @@ +// 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() { + // [START cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + */ + // const parent = 'abc123' + /** + * Maximum number of functions to return per call. + */ + // const pageSize = 1234 + /** + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + */ + // const pageToken = 'abc123' + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callListFunctions() { + // Construct request + const request = { + }; + + // Run request + const iterable = await functionsClient.listFunctionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFunctions(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_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-functions/v1/samples/generated/v1/cloud_functions_service.set_iam_policy.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.set_iam_policy.js new file mode 100644 index 00000000000..823bd367827 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_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 cloudfunctions_v1_generated_CloudFunctionsService_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 Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await functionsClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_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-functions/v1/samples/generated/v1/cloud_functions_service.test_iam_permissions.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.test_iam_permissions.js new file mode 100644 index 00000000000..54f1cec58ab --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_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 cloudfunctions_v1_generated_CloudFunctionsService_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 = ['abc','def'] + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await functionsClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_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-functions/v1/samples/generated/v1/cloud_functions_service.update_function.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.update_function.js new file mode 100644 index 00000000000..6d6d22999b6 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.update_function.js @@ -0,0 +1,66 @@ +// 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(function1) { + // [START cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_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. New version of the function. + */ + // const function = {} + /** + * Required. The list of fields in `CloudFunction` that have to be updated. + */ + // const updateMask = {} + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callUpdateFunction() { + // Construct request + const request = { + function1, + }; + + // Run request + const [operation] = await functionsClient.updateFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFunction(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_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-functions/v1/samples/generated/v1/snippet_metadata_google.cloud.functions.v1.json b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/snippet_metadata_google.cloud.functions.v1.json new file mode 100644 index 00000000000..6fbe3144065 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/snippet_metadata_google.cloud.functions.v1.json @@ -0,0 +1,499 @@ +{ + "clientLibrary": { + "name": "nodejs-functions", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.functions.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_async", + "title": "CloudFunctionsService listFunctions Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of functions that belong to the requested project.", + "canonical": true, + "file": "cloud_functions_service.list_functions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.ListFunctions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v1.ListFunctionsResponse", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.ListFunctions", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_async", + "title": "CloudFunctionsService getFunction Sample", + "origin": "API_DEFINITION", + "description": " Returns a function with the given name from the requested project.", + "canonical": true, + "file": "cloud_functions_service.get_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v1.CloudFunction", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetFunction", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_async", + "title": "CloudFunctionsService createFunction Sample", + "origin": "API_DEFINITION", + "description": " Creates a new function. If a function with the given name already exists in the specified project, the long running operation returns an `ALREADY_EXISTS` error.", + "canonical": true, + "file": "cloud_functions_service.create_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.CreateFunction", + "async": true, + "parameters": [ + { + "name": "location", + "type": "TYPE_STRING" + }, + { + "name": "function", + "type": ".google.cloud.functions.v1.CloudFunction" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.CreateFunction", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_async", + "title": "CloudFunctionsService updateFunction Sample", + "origin": "API_DEFINITION", + "description": " Updates existing function.", + "canonical": true, + "file": "cloud_functions_service.update_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.UpdateFunction", + "async": true, + "parameters": [ + { + "name": "function", + "type": ".google.cloud.functions.v1.CloudFunction" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.UpdateFunction", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async", + "title": "CloudFunctionsService deleteFunction Sample", + "origin": "API_DEFINITION", + "description": " Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger is updated to remove this function.", + "canonical": true, + "file": "cloud_functions_service.delete_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.DeleteFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.DeleteFunction", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_async", + "title": "CloudFunctionsService callFunction Sample", + "origin": "API_DEFINITION", + "description": " Synchronously invokes a deployed Cloud Function. To be used for testing purposes as very limited traffic is allowed. For more information on the actual limits, refer to [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits).", + "canonical": true, + "file": "cloud_functions_service.call_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CallFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.CallFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "data", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v1.CallFunctionResponse", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "CallFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.CallFunction", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_async", + "title": "CloudFunctionsService generateUploadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * Source file size should not exceed 100MB limit. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making an HTTP PUT request, these two headers must be specified: * `content-type: application/zip` * `x-goog-content-length-range: 0,104857600` And this header must NOT be specified: * `Authorization: Bearer YOUR_TOKEN`", + "canonical": true, + "file": "cloud_functions_service.generate_upload_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateUploadUrl", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "kms_key_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v1.GenerateUploadUrlResponse", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateUploadUrl", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_async", + "title": "CloudFunctionsService generateDownloadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and must be used within minutes after generation. For more information about the signed URL usage, see: https://cloud.google.com/storage/docs/access-control/signed-urls", + "canonical": true, + "file": "cloud_functions_service.generate_download_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateDownloadUrl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "version_id", + "type": "TYPE_UINT64" + } + ], + "resultType": ".google.cloud.functions.v1.GenerateDownloadUrlResponse", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateDownloadUrl", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_SetIamPolicy_async", + "title": "CloudFunctionsService setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the IAM access control policy on the specified function. Replaces any existing policy.", + "canonical": true, + "file": "cloud_functions_service.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.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": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.SetIamPolicy", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GetIamPolicy_async", + "title": "CloudFunctionsService getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the IAM access control policy for a function. Returns an empty policy if the function exists and does not have a policy set.", + "canonical": true, + "file": "cloud_functions_service.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetIamPolicy", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_TestIamPermissions_async", + "title": "CloudFunctionsService testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Tests the specified permissions against the IAM access control policy for a function. If the function does not exist, this returns an empty set of permissions, not a NOT_FOUND error.", + "canonical": true, + "file": "cloud_functions_service.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.TestIamPermissions", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-functions/v1/src/index.ts b/owl-bot-staging/google-cloud-functions/v1/src/index.ts new file mode 100644 index 00000000000..269dff995d6 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/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 v1 from './v1'; +const CloudFunctionsServiceClient = v1.CloudFunctionsServiceClient; +type CloudFunctionsServiceClient = v1.CloudFunctionsServiceClient; +export {v1, CloudFunctionsServiceClient}; +export default {v1, CloudFunctionsServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_client.ts b/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_client.ts new file mode 100644 index 00000000000..38275e292d4 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_client.ts @@ -0,0 +1,1881 @@ +// 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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/cloud_functions_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './cloud_functions_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * A service that application uses to manipulate triggers and functions. + * @class + * @memberof v1 + */ +export class CloudFunctionsServiceClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + cloudFunctionsServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CloudFunctionsServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 CloudFunctionsServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CloudFunctionsServiceClient; + 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + 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 = { + cloudFunctionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/functions/{function}' + ), + cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + repositoryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}' + ), + }; + + // 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 = { + listFunctions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'functions') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v1.CloudFunction') as gax.protobuf.Type; + const createFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v1.OperationMetadataV1') as gax.protobuf.Type; + const updateFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v1.CloudFunction') as gax.protobuf.Type; + const updateFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v1.OperationMetadataV1') as gax.protobuf.Type; + const deleteFunctionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v1.OperationMetadataV1') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFunctionResponse.decode.bind(createFunctionResponse), + createFunctionMetadata.decode.bind(createFunctionMetadata)), + updateFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFunctionResponse.decode.bind(updateFunctionResponse), + updateFunctionMetadata.decode.bind(updateFunctionMetadata)), + deleteFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFunctionResponse.decode.bind(deleteFunctionResponse), + deleteFunctionMetadata.decode.bind(deleteFunctionMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.functions.v1.CloudFunctionsService', 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.cloudFunctionsServiceStub) { + return this.cloudFunctionsServiceStub; + } + + // Put together the "service stub" for + // google.cloud.functions.v1.CloudFunctionsService. + this.cloudFunctionsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.functions.v1.CloudFunctionsService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.functions.v1.CloudFunctionsService, + 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 cloudFunctionsServiceStubMethods = + ['listFunctions', 'getFunction', 'createFunction', 'updateFunction', 'deleteFunction', 'callFunction', 'generateUploadUrl', 'generateDownloadUrl', 'setIamPolicy', 'getIamPolicy', 'testIamPermissions']; + for (const methodName of cloudFunctionsServiceStubMethods) { + const callPromise = this.cloudFunctionsServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.cloudFunctionsServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudfunctions.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 'cloudfunctions.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 -- + // ------------------- +/** + * Returns a function with the given name from the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which details should be obtained. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v1.CloudFunction|CloudFunction}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.get_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_async + */ + getFunction( + request?: protos.google.cloud.functions.v1.IGetFunctionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest|undefined, {}|undefined + ]>; + getFunction( + request: protos.google.cloud.functions.v1.IGetFunctionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest|null|undefined, + {}|null|undefined>): void; + getFunction( + request: protos.google.cloud.functions.v1.IGetFunctionRequest, + callback: Callback< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest|null|undefined, + {}|null|undefined>): void; + getFunction( + request?: protos.google.cloud.functions.v1.IGetFunctionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest|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.getFunction(request, options, callback); + } +/** + * Synchronously invokes a deployed Cloud Function. To be used for testing + * purposes as very limited traffic is allowed. For more information on + * the actual limits, refer to + * [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function to be called. + * @param {string} request.data + * Required. Input to be passed to the function. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v1.CallFunctionResponse|CallFunctionResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.call_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_async + */ + callFunction( + request?: protos.google.cloud.functions.v1.ICallFunctionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest|undefined, {}|undefined + ]>; + callFunction( + request: protos.google.cloud.functions.v1.ICallFunctionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest|null|undefined, + {}|null|undefined>): void; + callFunction( + request: protos.google.cloud.functions.v1.ICallFunctionRequest, + callback: Callback< + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest|null|undefined, + {}|null|undefined>): void; + callFunction( + request?: protos.google.cloud.functions.v1.ICallFunctionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest|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.callFunction(request, options, callback); + } +/** + * Returns a signed URL for uploading a function source code. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls. + * Once the function source code upload is complete, the used signed + * URL should be provided in CreateFunction or UpdateFunction request + * as a reference to the function source code. + * + * When uploading source code to the generated signed URL, please follow + * these restrictions: + * + * * Source file type should be a zip file. + * * Source file size should not exceed 100MB limit. + * * No credentials should be attached - the signed URLs provide access to the + * target bucket using internal service identity; if credentials were + * attached, the identity from the credentials would be used, but that + * identity does not have permissions to upload files to the URL. + * + * When making an HTTP PUT request, these two headers must be specified: + * + * * `content-type: application/zip` + * * `x-goog-content-length-range: 0,104857600` + * + * And this header must NOT be specified: + * + * * `Authorization: Bearer YOUR_TOKEN` + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/* /locations/*`. + * @param {string} request.kmsKeyName + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in staging Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to a staging Cloud Storage bucket in an internal regional + * project. The source code is then copied to a versioned directory in the + * sources bucket in the consumer project during the function deployment. + * + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). GCF will + * delegate access to the Google Storage service account in the internal + * project. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v1.GenerateUploadUrlResponse|GenerateUploadUrlResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.generate_upload_url.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_async + */ + generateUploadUrl( + request?: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|undefined, {}|undefined + ]>; + generateUploadUrl( + request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateUploadUrl( + request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateUploadUrl( + request?: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|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.generateUploadUrl(request, options, callback); + } +/** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and must be used within + * minutes after generation. + * For more information about the signed URL usage, see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of function for which source code Google Cloud Storage signed + * URL should be generated. + * @param {number} request.versionId + * The optional version of function. If not set, default, current version + * is used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v1.GenerateDownloadUrlResponse|GenerateDownloadUrlResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.generate_download_url.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_async + */ + generateDownloadUrl( + request?: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|undefined, {}|undefined + ]>; + generateDownloadUrl( + request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateDownloadUrl( + request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateDownloadUrl( + request?: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|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.generateDownloadUrl(request, options, callback); + } +/** + * Sets the IAM access control policy on the specified function. + * Replaces any existing policy. + * + * @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 protos.google.iam.v1.Policy|Policy}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.set_iam_policy.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_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 IAM access control policy for a function. + * Returns an empty policy if the function exists and does not have a policy + * set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {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 protos.google.iam.v1.Policy|Policy}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.get_iam_policy.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_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); + } +/** + * Tests the specified permissions against the IAM access control policy + * for a function. + * If the function does not exist, this returns an empty set of + * permissions, not a NOT_FOUND error. + * + * @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 protos.google.iam.v1.TestIamPermissionsResponse|TestIamPermissionsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.test_iam_permissions.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_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); + } + +/** + * Creates a new function. If a function with the given name already exists in + * the specified project, the long running operation returns an + * `ALREADY_EXISTS` error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.location + * Required. The project and location in which the function should be created, + * specified in the format `projects/* /locations/*` + * @param {google.cloud.functions.v1.CloudFunction} request.function + * Required. Function 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.create_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_async + */ + createFunction( + request?: protos.google.cloud.functions.v1.ICreateFunctionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createFunction( + request: protos.google.cloud.functions.v1.ICreateFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFunction( + request: protos.google.cloud.functions.v1.ICreateFunctionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFunction( + request?: protos.google.cloud.functions.v1.ICreateFunctionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'location': request.location ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFunction(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createFunction()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.create_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_async + */ + async checkCreateFunctionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFunction, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates existing function. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.functions.v1.CloudFunction} request.function + * Required. New version of the function. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The list of fields in `CloudFunction` that have to be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.update_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_async + */ + updateFunction( + request?: protos.google.cloud.functions.v1.IUpdateFunctionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateFunction( + request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFunction( + request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFunction( + request?: protos.google.cloud.functions.v1.IUpdateFunctionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'function.name': request.function!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFunction(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateFunction()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.update_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_async + */ + async checkUpdateFunctionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFunction, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger is updated to + * remove this function. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which should be deleted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.delete_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async + */ + deleteFunction( + request?: protos.google.cloud.functions.v1.IDeleteFunctionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteFunction( + request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFunction( + request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFunction( + request?: protos.google.cloud.functions.v1.IDeleteFunctionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteFunction(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteFunction()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.delete_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async + */ + async checkDeleteFunctionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFunction, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Returns a list of functions that belong to the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v1.CloudFunction|CloudFunction}. + * 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 `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFunctions( + request?: protos.google.cloud.functions.v1.IListFunctionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v1.ICloudFunction[], + protos.google.cloud.functions.v1.IListFunctionsRequest|null, + protos.google.cloud.functions.v1.IListFunctionsResponse + ]>; + listFunctions( + request: protos.google.cloud.functions.v1.IListFunctionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.functions.v1.IListFunctionsRequest, + protos.google.cloud.functions.v1.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v1.ICloudFunction>): void; + listFunctions( + request: protos.google.cloud.functions.v1.IListFunctionsRequest, + callback: PaginationCallback< + protos.google.cloud.functions.v1.IListFunctionsRequest, + protos.google.cloud.functions.v1.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v1.ICloudFunction>): void; + listFunctions( + request?: protos.google.cloud.functions.v1.IListFunctionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.functions.v1.IListFunctionsRequest, + protos.google.cloud.functions.v1.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v1.ICloudFunction>, + callback?: PaginationCallback< + protos.google.cloud.functions.v1.IListFunctionsRequest, + protos.google.cloud.functions.v1.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v1.ICloudFunction>): + Promise<[ + protos.google.cloud.functions.v1.ICloudFunction[], + protos.google.cloud.functions.v1.IListFunctionsRequest|null, + protos.google.cloud.functions.v1.IListFunctionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listFunctions(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 + * The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @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 protos.google.cloud.functions.v1.CloudFunction|CloudFunction} 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 `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFunctionsStream( + request?: protos.google.cloud.functions.v1.IListFunctionsRequest, + 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['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.createStream( + this.innerApiCalls.listFunctions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFunctions`, 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 + * The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.functions.v1.CloudFunction|CloudFunction}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.list_functions.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_async + */ + listFunctionsAsync( + request?: protos.google.cloud.functions.v1.IListFunctionsRequest, + 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['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.asyncIterate( + this.innerApiCalls['listFunctions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified cloudFunction resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} functionParam + * @returns {string} Resource name string. + */ + cloudFunctionPath(project:string,location:string,functionParam:string) { + return this.pathTemplates.cloudFunctionPathTemplate.render({ + project: project, + location: location, + function: functionParam, + }); + } + + /** + * Parse the project from CloudFunction resource. + * + * @param {string} cloudFunctionName + * A fully-qualified path representing CloudFunction resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCloudFunctionName(cloudFunctionName: string) { + return this.pathTemplates.cloudFunctionPathTemplate.match(cloudFunctionName).project; + } + + /** + * Parse the location from CloudFunction resource. + * + * @param {string} cloudFunctionName + * A fully-qualified path representing CloudFunction resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCloudFunctionName(cloudFunctionName: string) { + return this.pathTemplates.cloudFunctionPathTemplate.match(cloudFunctionName).location; + } + + /** + * Parse the function from CloudFunction resource. + * + * @param {string} cloudFunctionName + * A fully-qualified path representing CloudFunction resource. + * @returns {string} A string representing the function. + */ + matchFunctionFromCloudFunctionName(cloudFunctionName: string) { + return this.pathTemplates.cloudFunctionPathTemplate.match(cloudFunctionName).function; + } + + /** + * Return a fully-qualified cryptoKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @returns {string} Resource name string. + */ + cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { + return this.pathTemplates.cryptoKeyPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + }); + } + + /** + * Parse the project from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; + } + + /** + * Parse the location from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; + } + + /** + * Parse the key_ring from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; + } + + /** + * Parse the crypto_key from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified repository resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @returns {string} Resource name string. + */ + repositoryPath(project:string,location:string,repository:string) { + return this.pathTemplates.repositoryPathTemplate.render({ + project: project, + location: location, + repository: repository, + }); + } + + /** + * Parse the project from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).project; + } + + /** + * Parse the location from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).location; + } + + /** + * Parse the repository from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).repository; + } + + /** + * 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.cloudFunctionsServiceStub && !this._terminated) { + return this.cloudFunctionsServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_client_config.json b/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_client_config.json new file mode 100644 index 00000000000..d7b46e523f7 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_client_config.json @@ -0,0 +1,76 @@ +{ + "interfaces": { + "google.cloud.functions.v1.CloudFunctionsService": { + "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": { + "ListFunctions": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetFunction": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateFunction": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFunction": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteFunction": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CallFunction": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateUploadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateDownloadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetIamPolicy": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_proto_list.json b/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_proto_list.json new file mode 100644 index 00000000000..26c6fb8d3dd --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/functions/v1/functions.proto", + "../../protos/google/cloud/functions/v1/operations.proto" +] diff --git a/owl-bot-staging/google-cloud-functions/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-functions/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..d48829005cf --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/src/v1/gapic_metadata.json @@ -0,0 +1,137 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.functions.v1", + "libraryPackage": "@google-cloud/functions", + "services": { + "CloudFunctionsService": { + "clients": { + "grpc": { + "libraryClient": "CloudFunctionsServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "CallFunction": { + "methods": [ + "callFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CloudFunctionsServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "CallFunction": { + "methods": [ + "callFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-functions/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-functions/v1/src/v1/index.ts new file mode 100644 index 00000000000..5eca92cc0d7 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/src/v1/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 {CloudFunctionsServiceClient} from './cloud_functions_service_client'; diff --git a/owl-bot-staging/google-cloud-functions/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-functions/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..5fe0f8cfa53 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/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 functions = require('@google-cloud/functions'); + +function main() { + const cloudFunctionsServiceClient = new functions.CloudFunctionsServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-functions/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-functions/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..a300aff6476 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/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 {CloudFunctionsServiceClient} from '@google-cloud/functions'; + +// check that the client class type name can be used +function doStuffWithCloudFunctionsServiceClient(client: CloudFunctionsServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + doStuffWithCloudFunctionsServiceClient(cloudFunctionsServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-functions/v1/system-test/install.ts b/owl-bot-staging/google-cloud-functions/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/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-functions/v1/test/gapic_cloud_functions_service_v1.ts b/owl-bot-staging/google-cloud-functions/v1/test/gapic_cloud_functions_service_v1.ts new file mode 100644 index 00000000000..f8d2faaeb6c --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v1/test/gapic_cloud_functions_service_v1.ts @@ -0,0 +1,2288 @@ +// 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 cloudfunctionsserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.CloudFunctionsServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudFunctionsServiceStub, undefined); + await client.initialize(); + assert(client.cloudFunctionsServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.cloudFunctionsServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudFunctionsServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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('getFunction', () => { + it('invokes getFunction without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GetFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.GetFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v1.CloudFunction() + ); + client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); + const [response] = await client.getFunction(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFunction without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GetFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.GetFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v1.CloudFunction() + ); + client.innerApiCalls.getFunction = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFunction( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v1.ICloudFunction|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFunction with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GetFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.GetFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFunction = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFunction(request), expectedError); + const actualRequest = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFunction with closed client', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GetFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.GetFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFunction(request), expectedError); + }); + }); + + describe('callFunction', () => { + it('invokes callFunction without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.CallFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.CallFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v1.CallFunctionResponse() + ); + client.innerApiCalls.callFunction = stubSimpleCall(expectedResponse); + const [response] = await client.callFunction(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.callFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.callFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes callFunction without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.CallFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.CallFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v1.CallFunctionResponse() + ); + client.innerApiCalls.callFunction = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.callFunction( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v1.ICallFunctionResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.callFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.callFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes callFunction with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.CallFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.CallFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.callFunction = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.callFunction(request), expectedError); + const actualRequest = (client.innerApiCalls.callFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.callFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes callFunction with closed client', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.CallFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.CallFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.callFunction(request), expectedError); + }); + }); + + describe('generateUploadUrl', () => { + it('invokes generateUploadUrl without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.GenerateUploadUrlRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); + const [response] = await client.generateUploadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateUploadUrl without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.GenerateUploadUrlRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateUploadUrl( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v1.IGenerateUploadUrlResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateUploadUrl with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.GenerateUploadUrlRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateUploadUrl = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateUploadUrl(request), expectedError); + const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateUploadUrl with closed client', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.GenerateUploadUrlRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateUploadUrl(request), expectedError); + }); + }); + + describe('generateDownloadUrl', () => { + it('invokes generateDownloadUrl without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.GenerateDownloadUrlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = stubSimpleCall(expectedResponse); + const [response] = await client.generateDownloadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateDownloadUrl without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.GenerateDownloadUrlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateDownloadUrl( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateDownloadUrl with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.GenerateDownloadUrlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateDownloadUrl = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateDownloadUrl with closed client', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.GenerateDownloadUrlRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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('createFunction', () => { + it('invokes createFunction without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.CreateFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.CreateFunctionRequest', ['location']); + request.location = defaultValue1; + const expectedHeaderRequestParams = `location=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = stubLongRunningCall(expectedResponse); + const [operation] = await client.createFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFunction without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.CreateFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.CreateFunctionRequest', ['location']); + request.location = defaultValue1; + const expectedHeaderRequestParams = `location=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFunction( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFunction with call error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.CreateFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.CreateFunctionRequest', ['location']); + request.location = defaultValue1; + const expectedHeaderRequestParams = `location=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createFunction(request), expectedError); + const actualRequest = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFunction with LRO error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.CreateFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.CreateFunctionRequest', ['location']); + request.location = defaultValue1; + const expectedHeaderRequestParams = `location=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createFunction(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateFunctionProgress without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateFunctionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFunctionProgress with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateFunctionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateFunction', () => { + it('invokes updateFunction without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.UpdateFunctionRequest() + ); + request.function ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.UpdateFunctionRequest', ['function', 'name']); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFunction without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.UpdateFunctionRequest() + ); + request.function ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.UpdateFunctionRequest', ['function', 'name']); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFunction( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFunction with call error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.UpdateFunctionRequest() + ); + request.function ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.UpdateFunctionRequest', ['function', 'name']); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateFunction(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFunction with LRO error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.UpdateFunctionRequest() + ); + request.function ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.UpdateFunctionRequest', ['function', 'name']); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateFunction(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateFunctionProgress without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateFunctionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFunctionProgress with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateFunctionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteFunction', () => { + it('invokes deleteFunction without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.DeleteFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.DeleteFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFunction without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.DeleteFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.DeleteFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFunction( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFunction with call error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.DeleteFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.DeleteFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteFunction(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFunction with LRO error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.DeleteFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.DeleteFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteFunction(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteFunctionProgress without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteFunctionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFunctionProgress with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteFunctionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listFunctions', () => { + it('invokes listFunctions without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + ]; + client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); + const [response] = await client.listFunctions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFunctions without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + ]; + client.innerApiCalls.listFunctions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFunctions( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v1.ICloudFunction[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFunctions with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFunctions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFunctions(request), expectedError); + const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFunctionsStream without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + ]; + client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v1.CloudFunction[] = []; + stream.on('data', (response: protos.google.cloud.functions.v1.CloudFunction) => { + 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.listFunctions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFunctionsStream with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v1.CloudFunction[] = []; + stream.on('data', (response: protos.google.cloud.functions.v1.CloudFunction) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFunctions without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + ]; + client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.functions.v1.ICloudFunction[] = []; + const iterable = client.listFunctionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFunctions with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v1.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFunctionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.functions.v1.ICloudFunction[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('cloudFunction', () => { + const fakePath = "/rendered/path/cloudFunction"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + function: "functionValue", + }; + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cloudFunctionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.cloudFunctionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('cloudFunctionPath', () => { + const result = client.cloudFunctionPath("projectValue", "locationValue", "functionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.cloudFunctionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCloudFunctionName', () => { + const result = client.matchProjectFromCloudFunctionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.cloudFunctionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCloudFunctionName', () => { + const result = client.matchLocationFromCloudFunctionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.cloudFunctionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFunctionFromCloudFunctionName', () => { + const result = client.matchFunctionFromCloudFunctionName(fakePath); + assert.strictEqual(result, "functionValue"); + assert((client.pathTemplates.cloudFunctionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('cryptoKey', () => { + const fakePath = "/rendered/path/cryptoKey"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + }; + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.cryptoKeyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('cryptoKeyPath', () => { + const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCryptoKeyName', () => { + const result = client.matchProjectFromCryptoKeyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCryptoKeyName', () => { + const result = client.matchLocationFromCryptoKeyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromCryptoKeyName', () => { + const result = client.matchKeyRingFromCryptoKeyName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromCryptoKeyName', () => { + const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('repository', () => { + const fakePath = "/rendered/path/repository"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + }; + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.repositoryPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.repositoryPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('repositoryPath', () => { + const result = client.repositoryPath("projectValue", "locationValue", "repositoryValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.repositoryPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromRepositoryName', () => { + const result = client.matchProjectFromRepositoryName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromRepositoryName', () => { + const result = client.matchLocationFromRepositoryName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromRepositoryName', () => { + const result = client.matchRepositoryFromRepositoryName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-functions/v1/tsconfig.json b/owl-bot-staging/google-cloud-functions/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/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-functions/v1/webpack.config.js b/owl-bot-staging/google-cloud-functions/v1/webpack.config.js new file mode 100644 index 00000000000..115d8297e02 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/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: 'CloudFunctionsService', + filename: './cloud-functions-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-functions/v2/.eslintignore b/owl-bot-staging/google-cloud-functions/v2/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-functions/v2/.eslintrc.json b/owl-bot-staging/google-cloud-functions/v2/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-functions/v2/.gitignore b/owl-bot-staging/google-cloud-functions/v2/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/.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-functions/v2/.jsdoc.js b/owl-bot-staging/google-cloud-functions/v2/.jsdoc.js new file mode 100644 index 00000000000..43186156cf8 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/.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/functions', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-functions/v2/.mocharc.js b/owl-bot-staging/google-cloud-functions/v2/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/.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-functions/v2/.prettierrc.js b/owl-bot-staging/google-cloud-functions/v2/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/.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-functions/v2/README.md b/owl-bot-staging/google-cloud-functions/v2/README.md new file mode 100644 index 00000000000..efb614cf6e7 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/README.md @@ -0,0 +1 @@ +Functions: Nodejs Client diff --git a/owl-bot-staging/google-cloud-functions/v2/package.json b/owl-bot-staging/google-cloud-functions/v2/package.json new file mode 100644 index 00000000000..a5e7b166e52 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/functions", + "version": "0.1.0", + "description": "Functions client for Node.js", + "repository": "googleapis/nodejs-functions", + "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 functions", + "functions", + "function service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-functions/v2/protos/google/cloud/functions/v2/functions.proto b/owl-bot-staging/google-cloud-functions/v2/protos/google/cloud/functions/v2/functions.proto new file mode 100644 index 00000000000..ae0cdc1ef22 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/protos/google/cloud/functions/v2/functions.proto @@ -0,0 +1,1147 @@ +// 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 +// +// 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.functions.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/functions/apiv2/functionspb;functionspb"; +option java_multiple_files = true; +option java_outer_classname = "FunctionsProto"; +option java_package = "com.google.cloud.functions.v2"; +option objc_class_prefix = "GCF"; +option (google.api.resource_definition) = { + type: "artifactregistry.googleapis.com/Repository" + pattern: "projects/{project}/locations/{location}/repositories/{repository}" +}; +option (google.api.resource_definition) = { + type: "cloudbuild.googleapis.com/Build" + pattern: "projects/{project}/locations/{location}/builds/{build}" +}; +option (google.api.resource_definition) = { + type: "cloudbuild.googleapis.com/WorkerPool" + pattern: "projects/{project}/locations/{location}/workerPools/{worker_pool}" +}; +option (google.api.resource_definition) = { + type: "run.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/services/{service}" +}; +option (google.api.resource_definition) = { + type: "vpcaccess.googleapis.com/Connector" + pattern: "projects/{project}/locations/{location}/connectors/{connector}" +}; +option (google.api.resource_definition) = { + type: "eventarc.googleapis.com/Trigger" + pattern: "projects/{project}/locations/{location}/triggers/{trigger}" +}; +option (google.api.resource_definition) = { + type: "eventarc.googleapis.com/Channel" + pattern: "projects/{project}/locations/{location}/channels/{channel}" +}; +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" +}; +option (google.api.resource_definition) = { + type: "cloudkms.googleapis.com/CryptoKey" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" +}; + +// Google Cloud Functions is used to deploy functions that are executed by +// Google in response to various events. Data connected with that event is +// passed to a function as the input data. +// +// A **function** is a resource which describes a function that should be +// executed and how it is triggered. +service FunctionService { + option (google.api.default_host) = "cloudfunctions.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Returns a function with the given name from the requested project. + rpc GetFunction(GetFunctionRequest) returns (Function) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns a list of functions that belong to the requested project. + rpc ListFunctions(ListFunctionsRequest) returns (ListFunctionsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/functions" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new function. If a function with the given name already exists in + // the specified project, the long running operation will return + // `ALREADY_EXISTS` error. + rpc CreateFunction(CreateFunctionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}/functions" + body: "function" + }; + option (google.api.method_signature) = "parent,function,function_id"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.functions.v2.Function" + metadata_type: "google.cloud.functions.v2.OperationMetadata" + }; + } + + // Updates existing function. + rpc UpdateFunction(UpdateFunctionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2/{function.name=projects/*/locations/*/functions/*}" + body: "function" + }; + option (google.api.method_signature) = "function,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.functions.v2.Function" + metadata_type: "google.cloud.functions.v2.OperationMetadata" + }; + } + + // Deletes a function with the given name from the specified project. If the + // given function is used by some trigger, the trigger will be updated to + // remove this function. + rpc DeleteFunction(DeleteFunctionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.functions.v2.OperationMetadata" + }; + } + + // Returns a signed URL for uploading a function source code. + // For more information about the signed URL usage see: + // https://cloud.google.com/storage/docs/access-control/signed-urls. + // Once the function source code upload is complete, the used signed + // URL should be provided in CreateFunction or UpdateFunction request + // as a reference to the function source code. + // + // When uploading source code to the generated signed URL, please follow + // these restrictions: + // + // * Source file type should be a zip file. + // * No credentials should be attached - the signed URLs provide access to the + // target bucket using internal service identity; if credentials were + // attached, the identity from the credentials would be used, but that + // identity does not have permissions to upload files to the URL. + // + // When making a HTTP PUT request, these two headers need to be specified: + // + // * `content-type: application/zip` + // + // And this header SHOULD NOT be specified: + // + // * `Authorization: Bearer YOUR_TOKEN` + rpc GenerateUploadUrl(GenerateUploadUrlRequest) + returns (GenerateUploadUrlResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}/functions:generateUploadUrl" + body: "*" + }; + } + + // Returns a signed URL for downloading deployed function source code. + // The URL is only valid for a limited period and should be used within + // 30 minutes of generation. + // For more information about the signed URL usage see: + // https://cloud.google.com/storage/docs/access-control/signed-urls + rpc GenerateDownloadUrl(GenerateDownloadUrlRequest) + returns (GenerateDownloadUrlResponse) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/functions/*}:generateDownloadUrl" + body: "*" + }; + } + + // Returns a list of runtimes that are supported for the requested project. + rpc ListRuntimes(ListRuntimesRequest) returns (ListRuntimesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/runtimes" + }; + option (google.api.method_signature) = "parent"; + } +} + +// The environment the function is hosted on. +enum Environment { + // Unspecified + ENVIRONMENT_UNSPECIFIED = 0; + + // Gen 1 + GEN_1 = 1; + + // Gen 2 + GEN_2 = 2; +} + +// Describes a Cloud Function that contains user computation executed in +// response to an event. It encapsulates function and trigger configurations. +message Function { + option (google.api.resource) = { + type: "cloudfunctions.googleapis.com/Function" + pattern: "projects/{project}/locations/{location}/functions/{function}" + plural: "functions" + singular: "function" + }; + + // Describes the current state of the function. + enum State { + // Not specified. Invalid state. + STATE_UNSPECIFIED = 0; + + // Function has been successfully deployed and is serving. + ACTIVE = 1; + + // Function deployment failed and the function is not serving. + FAILED = 2; + + // Function is being created or updated. + DEPLOYING = 3; + + // Function is being deleted. + DELETING = 4; + + // Function deployment failed and the function serving state is undefined. + // The function should be updated or deleted to move it out of this state. + UNKNOWN = 5; + } + + // A user-defined name of the function. Function names must be unique + // globally and match pattern `projects/*/locations/*/functions/*` + string name = 1; + + // User-provided description of a function. + string description = 2; + + // Describes the Build step of the function that builds a container from the + // given source. + BuildConfig build_config = 3; + + // Describes the Service being deployed. Currently deploys services to Cloud + // Run (fully managed). + ServiceConfig service_config = 4; + + // An Eventarc trigger managed by Google Cloud Functions that fires events in + // response to a condition in another service. + EventTrigger event_trigger = 5; + + // Output only. State of the function. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of a Cloud Function. + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels associated with this Cloud Function. + map labels = 8; + + // Output only. State Messages for this Cloud Function. + repeated StateMessage state_messages = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Describe whether the function is 1st Gen or 2nd Gen. + Environment environment = 10; + + // Output only. The deployed url for the function. + string url = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // [Preview] Resource name of a KMS crypto key (managed by the user) used to + // encrypt/decrypt function resources. + // + // It must match the pattern + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + string kms_key_name = 25 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + }]; +} + +// Informational messages about the state of the Cloud Function or Operation. +message StateMessage { + // Severity of the state message. + enum Severity { + // Not specified. Invalid severity. + SEVERITY_UNSPECIFIED = 0; + + // ERROR-level severity. + ERROR = 1; + + // WARNING-level severity. + WARNING = 2; + + // INFO-level severity. + INFO = 3; + } + + // Severity of the state message. + Severity severity = 1; + + // One-word CamelCase type of the state message. + string type = 2; + + // The message. + string message = 3; +} + +// Location of the source in an archive file in Google Cloud Storage. +message StorageSource { + // Google Cloud Storage bucket containing the source (see + // [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + string bucket = 1; + + // Google Cloud Storage object containing the source. + // + // This object must be a gzipped archive file (`.tar.gz`) containing source to + // build. + string object = 2; + + // Google Cloud Storage generation for the object. If the generation is + // omitted, the latest generation will be used. + int64 generation = 3; +} + +// Location of the source in a Google Cloud Source Repository. +message RepoSource { + // A revision within the Cloud Source Repository must be specified in + // one of these ways. + oneof revision { + // Regex matching branches to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string branch_name = 3; + + // Regex matching tags to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string tag_name = 4; + + // Explicit commit SHA to build. + string commit_sha = 5; + } + + // ID of the project that owns the Cloud Source Repository. If omitted, the + // project ID requesting the build is assumed. + string project_id = 1; + + // Name of the Cloud Source Repository. + string repo_name = 2; + + // Directory, relative to the source root, in which to run the build. + // + // This must be a relative path. If a step's `dir` is specified and is an + // absolute path, this value is ignored for that step's execution. + // eg. helloworld (no leading slash allowed) + string dir = 6; + + // Only trigger a build if the revision regex does NOT match the revision + // regex. + bool invert_regex = 7; +} + +// The location of the function source code. +message Source { + // Location of the source. + // At least one source needs to be provided for the deployment to succeed. + oneof source { + // If provided, get the source from this location in Google Cloud Storage. + StorageSource storage_source = 1; + + // If provided, get the source from this location in a Cloud Source + // Repository. + RepoSource repo_source = 2; + } +} + +// Provenance of the source. Ways to find the original source, or verify that +// some source was used for this build. +message SourceProvenance { + // A copy of the build's `source.storage_source`, if exists, with any + // generations resolved. + StorageSource resolved_storage_source = 1; + + // A copy of the build's `source.repo_source`, if exists, with any + // revisions resolved. + RepoSource resolved_repo_source = 2; +} + +// Describes the Build step of the function that builds a container from the +// given source. +message BuildConfig { + // Docker Registry to use for storing function Docker images. + enum DockerRegistry { + // Unspecified. + DOCKER_REGISTRY_UNSPECIFIED = 0; + + // Docker images will be stored in multi-regional Container Registry + // repositories named `gcf`. + CONTAINER_REGISTRY = 1; + + // Docker images will be stored in regional Artifact Registry repositories. + // By default, GCF will create and use repositories named `gcf-artifacts` + // in every region in which a function is deployed. But the repository to + // use can also be specified by the user using the `docker_repository` + // field. + ARTIFACT_REGISTRY = 2; + } + + // Output only. The Cloud Build name of the latest successful deployment of + // the function. + string build = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Build" + } + ]; + + // The runtime in which to run the function. Required when deploying a new + // function, optional when updating an existing function. For a complete + // list of possible choices, see the + // [`gcloud` command + // reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + string runtime = 2; + + // The name of the function (as defined in source code) that will be + // executed. Defaults to the resource name suffix, if not specified. For + // backward compatibility, if function with given name is not found, then the + // system will try to use function named "function". + // For Node.js this is name of a function exported by the module specified + // in `source_location`. + string entry_point = 3; + + // The location of the function source code. + Source source = 4; + + // Output only. A permanent fixed identifier for source. + SourceProvenance source_provenance = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Name of the Cloud Build Custom Worker Pool that should be used to build the + // function. The format of this field is + // `projects/{project}/locations/{region}/workerPools/{workerPool}` where + // {project} and {region} are the project id and region respectively where the + // worker pool is defined and {workerPool} is the short name of the worker + // pool. + // + // If the project id is not the same as the function, then the Cloud + // Functions Service Agent + // (service-@gcf-admin-robot.iam.gserviceaccount.com) must be + // granted the role Cloud Build Custom Workers Builder + // (roles/cloudbuild.customworkers.builder) in the project. + string worker_pool = 5 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + + // User-provided build-time environment variables for the function + map environment_variables = 6; + + // Docker Registry to use for this deployment. This configuration is only + // applicable to 1st Gen functions, 2nd Gen functions can only use Artifact + // Registry. + // + // If `docker_repository` field is specified, this field will be automatically + // set as `ARTIFACT_REGISTRY`. + // If unspecified, it currently defaults to `CONTAINER_REGISTRY`. + // This field may be overridden by the backend for eligible deployments. + DockerRegistry docker_registry = 10; + + // User managed repository created in Artifact Registry optionally + // with a customer managed encryption key. This is the repository to which the + // function docker image will be pushed after it is built by Cloud Build. + // If unspecified, GCF will create and use a repository named 'gcf-artifacts' + // for every deployed region. + // + // It must match the pattern + // `projects/{project}/locations/{location}/repositories/{repository}`. + // + // Cross-project repositories are not supported. + // Cross-location repositories are not supported. + // Repository format must be 'DOCKER'. + string docker_repository = 7 [(google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/Repository" + }]; +} + +// Describes the Service being deployed. +// Currently Supported : Cloud Run (fully managed). +message ServiceConfig { + // Available egress settings. + // + // This controls what traffic is diverted through the VPC Access Connector + // resource. By default PRIVATE_RANGES_ONLY will be used. + enum VpcConnectorEgressSettings { + // Unspecified. + VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; + + // Use the VPC Access Connector only for private IP space from RFC1918. + PRIVATE_RANGES_ONLY = 1; + + // Force the use of VPC Access Connector for all egress traffic from the + // function. + ALL_TRAFFIC = 2; + } + + // Available ingress settings. + // + // This controls what traffic can reach the function. + // + // If unspecified, ALLOW_ALL will be used. + enum IngressSettings { + // Unspecified. + INGRESS_SETTINGS_UNSPECIFIED = 0; + + // Allow HTTP traffic from public and private sources. + ALLOW_ALL = 1; + + // Allow HTTP traffic from only private VPC sources. + ALLOW_INTERNAL_ONLY = 2; + + // Allow HTTP traffic from private VPC sources and through GCLB. + ALLOW_INTERNAL_AND_GCLB = 3; + } + + // Available security level settings. + // + // This enforces security protocol on function URL. + // + // Security level is only configurable for 1st Gen functions, If unspecified, + // SECURE_OPTIONAL will be used. 2nd Gen functions are SECURE_ALWAYS ONLY. + enum SecurityLevel { + // Unspecified. + SECURITY_LEVEL_UNSPECIFIED = 0; + + // Requests for a URL that match this handler that do not use HTTPS are + // automatically redirected to the HTTPS URL with the same path. Query + // parameters are reserved for the redirect. + SECURE_ALWAYS = 1; + + // Both HTTP and HTTPS requests with URLs that match the handler succeed + // without redirects. The application can examine the request to determine + // which protocol was used and respond accordingly. + SECURE_OPTIONAL = 2; + } + + // Output only. Name of the service associated with a Function. + // The format of this field is + // `projects/{project}/locations/{region}/services/{service}` + string service = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { type: "run.googleapis.com/Service" } + ]; + + // The function execution timeout. Execution is considered failed and + // can be terminated if the function is not completed at the end of the + // timeout period. Defaults to 60 seconds. + int32 timeout_seconds = 2; + + // The amount of memory available for a function. + // Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is + // supplied the value is interpreted as bytes. + // See + // https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go + // a full description. + string available_memory = 13; + + // [Preview] The number of CPUs used in a single container instance. + // Default value is calculated from available memory. + // Supports the same values as Cloud Run, see + // https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements + // Example: "1" indicates 1 vCPU + string available_cpu = 22; + + // Environment variables that shall be available during function execution. + map environment_variables = 4; + + // The limit on the maximum number of function instances that may coexist at a + // given time. + // + // In some cases, such as rapid traffic surges, Cloud Functions may, for a + // short period of time, create more instances than the specified max + // instances limit. If your function cannot tolerate this temporary behavior, + // you may want to factor in a safety margin and set a lower max instances + // value than your function can tolerate. + // + // See the [Max + // Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + // more details. + int32 max_instance_count = 5; + + // The limit on the minimum number of function instances that may coexist at a + // given time. + // + // Function instances are kept in idle state for a short period after they + // finished executing the request to reduce cold start time for subsequent + // requests. Setting a minimum instance count will ensure that the given + // number of instances are kept running in idle state always. This can help + // with cold start times when jump in incoming request count occurs after the + // idle instance would have been stopped in the default case. + int32 min_instance_count = 12; + + // The Serverless VPC Access connector that this cloud function can connect + // to. The format of this field is `projects/*/locations/*/connectors/*`. + string vpc_connector = 6 [(google.api.resource_reference) = { + type: "vpcaccess.googleapis.com/Connector" + }]; + + // The egress settings for the connector, controlling what traffic is diverted + // through it. + VpcConnectorEgressSettings vpc_connector_egress_settings = 7; + + // The ingress settings for the function, controlling what traffic can reach + // it. + IngressSettings ingress_settings = 8; + + // Output only. URI of the Service deployed. + string uri = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The email of the service's service account. If empty, defaults to + // `{project_number}-compute@developer.gserviceaccount.com`. + string service_account_email = 10; + + // Whether 100% of traffic is routed to the latest revision. + // On CreateFunction and UpdateFunction, when set to true, the revision being + // deployed will serve 100% of traffic, ignoring any traffic split settings, + // if any. On GetFunction, true will be returned if the latest revision is + // serving 100% of traffic. + bool all_traffic_on_latest_revision = 16; + + // Secret environment variables configuration. + repeated SecretEnvVar secret_environment_variables = 17; + + // Secret volumes configuration. + repeated SecretVolume secret_volumes = 19; + + // Output only. The name of service revision. + string revision = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // [Preview] Sets the maximum number of concurrent requests that each instance + // can receive. Defaults to 1. + int32 max_instance_request_concurrency = 20; + + // Security level configure whether the function only accepts https. + // This configuration is only applicable to 1st Gen functions with Http + // trigger. By default https is optional for 1st Gen functions; 2nd Gen + // functions are https ONLY. + SecurityLevel security_level = 21; +} + +// Configuration for a secret environment variable. It has the information +// necessary to fetch the secret value from secret manager and expose it as an +// environment variable. +message SecretEnvVar { + // Name of the environment variable. + string key = 1; + + // Project identifier (preferably project number but can also be the + // project ID) of the project that contains the secret. If not set, it is + // assumed that the secret is in the same project as the function. + string project_id = 2; + + // Name of the secret in secret manager (not the full resource name). + string secret = 3; + + // Version of the secret (version number or the string 'latest'). It is + // recommended to use a numeric version for secret environment variables as + // any updates to the secret value is not reflected until new instances + // start. + string version = 4; +} + +// Configuration for a secret volume. It has the information necessary to fetch +// the secret value from secret manager and make it available as files mounted +// at the requested paths within the application container. +message SecretVolume { + // Configuration for a single version. + message SecretVersion { + // Version of the secret (version number or the string 'latest'). It is + // preferable to use `latest` version with secret volumes as secret value + // changes are reflected immediately. + string version = 1; + + // Relative path of the file under the mount path where the secret value for + // this version will be fetched and made available. For example, setting the + // mount_path as '/etc/secrets' and path as `secret_foo` would mount the + // secret value file at `/etc/secrets/secret_foo`. + string path = 2; + } + + // The path within the container to mount the secret volume. For example, + // setting the mount_path as `/etc/secrets` would mount the secret value files + // under the `/etc/secrets` directory. This directory will also be completely + // shadowed and unavailable to mount any other secrets. + // Recommended mount path: /etc/secrets + string mount_path = 1; + + // Project identifier (preferably project number but can also be the project + // ID) of the project that contains the secret. If not set, it is + // assumed that the secret is in the same project as the function. + string project_id = 2; + + // Name of the secret in secret manager (not the full resource name). + string secret = 3; + + // List of secret versions to mount for this secret. If empty, the `latest` + // version of the secret will be made available in a file named after the + // secret under the mount point. + repeated SecretVersion versions = 4; +} + +// Describes EventTrigger, used to request events to be sent from another +// service. +message EventTrigger { + // Describes the retry policy in case of function's execution failure. + // Retried execution is charged as any other execution. + enum RetryPolicy { + // Not specified. + RETRY_POLICY_UNSPECIFIED = 0; + + // Do not retry. + RETRY_POLICY_DO_NOT_RETRY = 1; + + // Retry on any failure, retry up to 7 days with an exponential backoff + // (capped at 10 seconds). + RETRY_POLICY_RETRY = 2; + } + + // Output only. The resource name of the Eventarc trigger. The format of this + // field is `projects/{project}/locations/{region}/triggers/{trigger}`. + string trigger = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Trigger" + } + ]; + + // The region that the trigger will be in. The trigger will only receive + // events originating in this region. It can be the same + // region as the function, a different region or multi-region, or the global + // region. If not provided, defaults to the same region as the function. + string trigger_region = 2; + + // Required. The type of event to observe. For example: + // `google.cloud.audit.log.v1.written` or + // `google.cloud.pubsub.topic.v1.messagePublished`. + string event_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Criteria used to filter events. + repeated EventFilter event_filters = 4; + + // Optional. The name of a Pub/Sub topic in the same project that will be used + // as the transport topic for the event delivery. Format: + // `projects/{project}/topics/{topic}`. + // + // This is only valid for events of type + // `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here + // will not be deleted at function deletion. + string pubsub_topic = 5 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } + ]; + + // Optional. The email of the trigger's service account. The service account + // must have permission to invoke Cloud Run services, the permission is + // `run.routes.invoke`. + // If empty, defaults to the Compute Engine default service account: + // `{project_number}-compute@developer.gserviceaccount.com`. + string service_account_email = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If unset, then defaults to ignoring failures (i.e. not retrying + // them). + RetryPolicy retry_policy = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the channel associated with the trigger in + // `projects/{project}/locations/{location}/channels/{channel}` format. + // You must provide a channel to receive events from Eventarc SaaS partners. + string channel = 8 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Channel" + } + ]; +} + +// Filters events based on exact matches on the CloudEvents attributes. +message EventFilter { + // Required. The name of a CloudEvents attribute. + string attribute = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The value for the attribute. + string value = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The operator used for matching the events with the value of the + // filter. If not specified, only events that have an exact key-value pair + // specified in the filter are matched. The only allowed value is + // `match-path-pattern`. + string operator = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for the `GetFunction` method. +message GetFunctionRequest { + // Required. The name of the function which details should be obtained. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Request for the `ListFunctions` method. +message ListFunctionsRequest { + // Required. The project and location from which the function should be + // listed, specified in the format `projects/*/locations/*` If you want to + // list functions in all locations, use "-" in place of a location. When + // listing functions in all locations, if one or more location(s) are + // unreachable, the response will contain functions from all reachable + // locations along with the names of any unreachable locations. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudfunctions.googleapis.com/Function" + } + ]; + + // Maximum number of functions to return per call. The largest allowed + // page_size is 1,000, if the page_size is omitted or specified as greater + // than 1,000 then it will be replaced as 1,000. The size of the list + // response can be less than specified when used with filters. + int32 page_size = 2; + + // The value returned by the last + // `ListFunctionsResponse`; indicates that + // this is a continuation of a prior `ListFunctions` call, and that the + // system should return the next page of data. + string page_token = 3; + + // The filter for Functions that match the filter expression, + // following the syntax outlined in https://google.aip.dev/160. + string filter = 4; + + // The sorting order of the resources returned. Value should be a comma + // separated list of fields. The default sorting oder is ascending. + // See https://google.aip.dev/132#ordering. + string order_by = 5; +} + +// Response for the `ListFunctions` method. +message ListFunctionsResponse { + // The functions that match the request. + repeated Function functions = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. The response does not include any + // functions from these locations. + repeated string unreachable = 3; +} + +// Request for the `CreateFunction` method. +message CreateFunctionRequest { + // Required. The project and location in which the function should be created, + // specified in the format `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Function to be created. + Function function = 2 [(google.api.field_behavior) = REQUIRED]; + + // The ID to use for the function, which will become the final component of + // the function's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + string function_id = 3; +} + +// Request for the `UpdateFunction` method. +message UpdateFunctionRequest { + // Required. New version of the function. + Function function = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + // If no field mask is provided, all provided fields in the request will be + // updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for the `DeleteFunction` method. +message DeleteFunctionRequest { + // Required. The name of the function which should be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Request of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlRequest { + // Required. The project and location in which the Google Cloud Storage signed + // URL should be generated, specified in the format `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // [Preview] Resource name of a KMS crypto key (managed by the user) used to + // encrypt/decrypt function source code objects in intermediate Cloud Storage + // buckets. When you generate an upload url and upload your source code, it + // gets copied to an intermediate Cloud Storage bucket. The source code is + // then copied to a versioned directory in the sources bucket in the consumer + // project during the function deployment. + // + // It must match the pattern + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + // + // The Google Cloud Functions service account + // (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + // granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + // (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + // Key/KeyRing/Project/Organization (least access preferred). + string kms_key_name = 2 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + }]; +} + +// Response of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for a + // function source code upload. The uploaded file should be a zip archive + // which contains a function. + string upload_url = 1; + + // The location of the source code in the upload bucket. + // + // Once the archive is uploaded using the `upload_url` use this field to + // set the `function.build_config.source.storage_source` + // during CreateFunction and UpdateFunction. + // + // Generation defaults to 0, as Cloud Storage provides a new generation only + // upon uploading a new object or version of an object. + StorageSource storage_source = 2; +} + +// Request of `GenerateDownloadUrl` method. +message GenerateDownloadUrlRequest { + // Required. The name of function for which source code Google Cloud Storage + // signed URL should be generated. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Response of `GenerateDownloadUrl` method. +message GenerateDownloadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for + // function source code download. + string download_url = 1; +} + +// Request for the `ListRuntimes` method. +message ListRuntimesRequest { + // Required. The project and location from which the runtimes should be + // listed, specified in the format `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The filter for Runtimes that match the filter expression, + // following the syntax outlined in https://google.aip.dev/160. + string filter = 2; +} + +// Response for the `ListRuntimes` method. +message ListRuntimesResponse { + // Describes a runtime and any special information (e.g., deprecation status) + // related to it. + message Runtime { + // The name of the runtime, e.g., 'go113', 'nodejs12', etc. + string name = 1; + + // The user facing name, eg 'Go 1.13', 'Node.js 12', etc. + string display_name = 5; + + // The stage of life this runtime is in, e.g., BETA, GA, etc. + RuntimeStage stage = 2; + + // Warning messages, e.g., a deprecation warning. + repeated string warnings = 3; + + // The environment for the runtime. + Environment environment = 4; + } + + // The various stages that a runtime can be in. + enum RuntimeStage { + // Not specified. + RUNTIME_STAGE_UNSPECIFIED = 0; + + // The runtime is in development. + DEVELOPMENT = 1; + + // The runtime is in the Alpha stage. + ALPHA = 2; + + // The runtime is in the Beta stage. + BETA = 3; + + // The runtime is generally available. + GA = 4; + + // The runtime is deprecated. + DEPRECATED = 5; + + // The runtime is no longer supported. + DECOMMISSIONED = 6; + } + + // The runtimes that match the request. + repeated Runtime runtimes = 1; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation finished running. + google.protobuf.Timestamp end_time = 2; + + // Server-defined resource path for the target of the operation. + string target = 3; + + // Name of the verb executed by the operation. + string verb = 4; + + // Human-readable status of the operation, if any. + string status_detail = 5; + + // Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a + // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + // `Code.CANCELLED`. + bool cancel_requested = 6; + + // API version used to start the operation. + string api_version = 7; + + // The original request that started the operation. + google.protobuf.Any request_resource = 8; + + // Mechanism for reporting in-progress stages + repeated Stage stages = 9; +} + +// Extra GCF specific location information. +message LocationMetadata { + // The Cloud Function environments this location supports. + repeated Environment environments = 1; +} + +// Each Stage of the deployment process +message Stage { + // Possible names for a Stage + enum Name { + // Not specified. Invalid name. + NAME_UNSPECIFIED = 0; + + // Artifact Regsitry Stage + ARTIFACT_REGISTRY = 1; + + // Build Stage + BUILD = 2; + + // Service Stage + SERVICE = 3; + + // Trigger Stage + TRIGGER = 4; + + // Service Rollback Stage + SERVICE_ROLLBACK = 5; + + // Trigger Rollback Stage + TRIGGER_ROLLBACK = 6; + } + + // Possible states for a Stage + enum State { + // Not specified. Invalid state. + STATE_UNSPECIFIED = 0; + + // Stage has not started. + NOT_STARTED = 1; + + // Stage is in progress. + IN_PROGRESS = 2; + + // Stage has completed. + COMPLETE = 3; + } + + // Name of the Stage. This will be unique for each Stage. + Name name = 1; + + // Message describing the Stage + string message = 2; + + // Current state of the Stage + State state = 3; + + // Resource of the Stage + string resource = 4; + + // Link to the current Stage resource + string resource_uri = 5; + + // State messages from the current Stage. + repeated StateMessage state_messages = 6; +} diff --git a/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.create_function.js b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.create_function.js new file mode 100644 index 00000000000..08fde6038e3 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.create_function.js @@ -0,0 +1,75 @@ +// 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, function1) { + // [START cloudfunctions_v2_generated_FunctionService_CreateFunction_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 project and location in which the function should be created, + * specified in the format `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * Required. Function to be created. + */ + // const function = {} + /** + * The ID to use for the function, which will become the final component of + * the function's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + */ + // const functionId = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callCreateFunction() { + // Construct request + const request = { + parent, + function1, + }; + + // Run request + const [operation] = await functionsClient.createFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFunction(); + // [END cloudfunctions_v2_generated_FunctionService_CreateFunction_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-functions/v2/samples/generated/v2/function_service.delete_function.js b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.delete_function.js new file mode 100644 index 00000000000..ce53678f3f9 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.delete_function.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 cloudfunctions_v2_generated_FunctionService_DeleteFunction_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which should be deleted. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callDeleteFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await functionsClient.deleteFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFunction(); + // [END cloudfunctions_v2_generated_FunctionService_DeleteFunction_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-functions/v2/samples/generated/v2/function_service.generate_download_url.js b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.generate_download_url.js new file mode 100644 index 00000000000..069b98c675b --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.generate_download_url.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 cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of function for which source code Google Cloud Storage + * signed URL should be generated. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGenerateDownloadUrl() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await functionsClient.generateDownloadUrl(request); + console.log(response); + } + + callGenerateDownloadUrl(); + // [END cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_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-functions/v2/samples/generated/v2/function_service.generate_upload_url.js b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.generate_upload_url.js new file mode 100644 index 00000000000..e5ad4b903cb --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.generate_upload_url.js @@ -0,0 +1,78 @@ +// 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 cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_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 project and location in which the Google Cloud Storage signed + * URL should be generated, specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Preview Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). + */ + // const kmsKeyName = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGenerateUploadUrl() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await functionsClient.generateUploadUrl(request); + console.log(response); + } + + callGenerateUploadUrl(); + // [END cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_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-functions/v2/samples/generated/v2/function_service.get_function.js b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.get_function.js new file mode 100644 index 00000000000..a4d115c143f --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.get_function.js @@ -0,0 +1,61 @@ +// 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 cloudfunctions_v2_generated_FunctionService_GetFunction_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which details should be obtained. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGetFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await functionsClient.getFunction(request); + console.log(response); + } + + callGetFunction(); + // [END cloudfunctions_v2_generated_FunctionService_GetFunction_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-functions/v2/samples/generated/v2/function_service.list_functions.js b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.list_functions.js new file mode 100644 index 00000000000..bf396080a4d --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.list_functions.js @@ -0,0 +1,93 @@ +// 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 cloudfunctions_v2_generated_FunctionService_ListFunctions_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 project and location from which the function should be + * listed, specified in the format `projects/* /locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. + */ + // const parent = 'abc123' + /** + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + */ + // const pageSize = 1234 + /** + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + */ + // const filter = 'abc123' + /** + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callListFunctions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await functionsClient.listFunctionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFunctions(); + // [END cloudfunctions_v2_generated_FunctionService_ListFunctions_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-functions/v2/samples/generated/v2/function_service.list_runtimes.js b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.list_runtimes.js new file mode 100644 index 00000000000..d1ee7e22ebd --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.list_runtimes.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) { + // [START cloudfunctions_v2_generated_FunctionService_ListRuntimes_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 project and location from which the runtimes should be + * listed, specified in the format `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + */ + // const filter = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callListRuntimes() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await functionsClient.listRuntimes(request); + console.log(response); + } + + callListRuntimes(); + // [END cloudfunctions_v2_generated_FunctionService_ListRuntimes_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-functions/v2/samples/generated/v2/function_service.update_function.js b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.update_function.js new file mode 100644 index 00000000000..b6122068c28 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.update_function.js @@ -0,0 +1,68 @@ +// 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(function1) { + // [START cloudfunctions_v2_generated_FunctionService_UpdateFunction_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. New version of the function. + */ + // const function = {} + /** + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request will be + * updated. + */ + // const updateMask = {} + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callUpdateFunction() { + // Construct request + const request = { + function1, + }; + + // Run request + const [operation] = await functionsClient.updateFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFunction(); + // [END cloudfunctions_v2_generated_FunctionService_UpdateFunction_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-functions/v2/samples/generated/v2/snippet_metadata_google.cloud.functions.v2.json b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/snippet_metadata_google.cloud.functions.v2.json new file mode 100644 index 00000000000..a39ba256d39 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/snippet_metadata_google.cloud.functions.v2.json @@ -0,0 +1,371 @@ +{ + "clientLibrary": { + "name": "nodejs-functions", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.functions.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_GetFunction_async", + "title": "FunctionService getFunction Sample", + "origin": "API_DEFINITION", + "description": " Returns a function with the given name from the requested project.", + "canonical": true, + "file": "function_service.get_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v2.FunctionService.GetFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2.Function", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v2.FunctionService.GetFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_ListFunctions_async", + "title": "FunctionService listFunctions Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of functions that belong to the requested project.", + "canonical": true, + "file": "function_service.list_functions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v2.FunctionService.ListFunctions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2.ListFunctionsResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v2.FunctionService.ListFunctions", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_CreateFunction_async", + "title": "FunctionService createFunction Sample", + "origin": "API_DEFINITION", + "description": " Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return `ALREADY_EXISTS` error.", + "canonical": true, + "file": "function_service.create_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v2.FunctionService.CreateFunction", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "function", + "type": ".google.cloud.functions.v2.Function" + }, + { + "name": "function_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v2.FunctionService.CreateFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_UpdateFunction_async", + "title": "FunctionService updateFunction Sample", + "origin": "API_DEFINITION", + "description": " Updates existing function.", + "canonical": true, + "file": "function_service.update_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v2.FunctionService.UpdateFunction", + "async": true, + "parameters": [ + { + "name": "function", + "type": ".google.cloud.functions.v2.Function" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v2.FunctionService.UpdateFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_DeleteFunction_async", + "title": "FunctionService deleteFunction Sample", + "origin": "API_DEFINITION", + "description": " Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.", + "canonical": true, + "file": "function_service.delete_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v2.FunctionService.DeleteFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v2.FunctionService.DeleteFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_async", + "title": "FunctionService generateUploadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type: application/zip` And this header SHOULD NOT be specified: * `Authorization: Bearer YOUR_TOKEN`", + "canonical": true, + "file": "function_service.generate_upload_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v2.FunctionService.GenerateUploadUrl", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "kms_key_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2.GenerateUploadUrlResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v2.FunctionService.GenerateUploadUrl", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_async", + "title": "FunctionService generateDownloadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls", + "canonical": true, + "file": "function_service.generate_download_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v2.FunctionService.GenerateDownloadUrl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2.GenerateDownloadUrlResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v2.FunctionService.GenerateDownloadUrl", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_ListRuntimes_async", + "title": "FunctionService listRuntimes Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of runtimes that are supported for the requested project.", + "canonical": true, + "file": "function_service.list_runtimes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRuntimes", + "fullName": "google.cloud.functions.v2.FunctionService.ListRuntimes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2.ListRuntimesResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "ListRuntimes", + "fullName": "google.cloud.functions.v2.FunctionService.ListRuntimes", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-functions/v2/src/index.ts b/owl-bot-staging/google-cloud-functions/v2/src/index.ts new file mode 100644 index 00000000000..2a635dc096f --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/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 v2 from './v2'; +const FunctionServiceClient = v2.FunctionServiceClient; +type FunctionServiceClient = v2.FunctionServiceClient; +export {v2, FunctionServiceClient}; +export default {v2, FunctionServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_client.ts b/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_client.ts new file mode 100644 index 00000000000..cac23924837 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_client.ts @@ -0,0 +1,2197 @@ +// 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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/function_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './function_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Google Cloud Functions is used to deploy functions that are executed by + * Google in response to various events. Data connected with that event is + * passed to a function as the input data. + * + * A **function** is a resource which describes a function that should be + * executed and how it is triggered. + * @class + * @memberof v2 + */ +export class FunctionServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + functionServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of FunctionServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 FunctionServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof FunctionServiceClient; + 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; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + 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 = { + buildPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/builds/{build}' + ), + channelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/channels/{channel}' + ), + connectorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/connectors/{connector}' + ), + cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' + ), + functionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/functions/{function}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + repositoryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + topicPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/topics/{topic}' + ), + triggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/triggers/{trigger}' + ), + workerPoolPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workerPools/{worker_pool}' + ), + }; + + // 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 = { + listFunctions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'functions') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v2/{resource=projects/*/locations/*/functions/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v2/{resource=projects/*/locations/*/functions/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v2/{resource=projects/*/locations/*/functions/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v2.Function') as gax.protobuf.Type; + const createFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2.OperationMetadata') as gax.protobuf.Type; + const updateFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v2.Function') as gax.protobuf.Type; + const updateFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2.OperationMetadata') as gax.protobuf.Type; + const deleteFunctionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFunctionResponse.decode.bind(createFunctionResponse), + createFunctionMetadata.decode.bind(createFunctionMetadata)), + updateFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFunctionResponse.decode.bind(updateFunctionResponse), + updateFunctionMetadata.decode.bind(updateFunctionMetadata)), + deleteFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFunctionResponse.decode.bind(deleteFunctionResponse), + deleteFunctionMetadata.decode.bind(deleteFunctionMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.functions.v2.FunctionService', 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.functionServiceStub) { + return this.functionServiceStub; + } + + // Put together the "service stub" for + // google.cloud.functions.v2.FunctionService. + this.functionServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.functions.v2.FunctionService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.functions.v2.FunctionService, + 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 functionServiceStubMethods = + ['getFunction', 'listFunctions', 'createFunction', 'updateFunction', 'deleteFunction', 'generateUploadUrl', 'generateDownloadUrl', 'listRuntimes']; + for (const methodName of functionServiceStubMethods) { + const callPromise = this.functionServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.functionServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudfunctions.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 'cloudfunctions.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 -- + // ------------------- +/** + * Returns a function with the given name from the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which details should be obtained. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2.Function|Function}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/function_service.get_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_GetFunction_async + */ + getFunction( + request?: protos.google.cloud.functions.v2.IGetFunctionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IGetFunctionRequest|undefined, {}|undefined + ]>; + getFunction( + request: protos.google.cloud.functions.v2.IGetFunctionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IGetFunctionRequest|null|undefined, + {}|null|undefined>): void; + getFunction( + request: protos.google.cloud.functions.v2.IGetFunctionRequest, + callback: Callback< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IGetFunctionRequest|null|undefined, + {}|null|undefined>): void; + getFunction( + request?: protos.google.cloud.functions.v2.IGetFunctionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IGetFunctionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IGetFunctionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IGetFunctionRequest|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.getFunction(request, options, callback); + } +/** + * Returns a signed URL for uploading a function source code. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls. + * Once the function source code upload is complete, the used signed + * URL should be provided in CreateFunction or UpdateFunction request + * as a reference to the function source code. + * + * When uploading source code to the generated signed URL, please follow + * these restrictions: + * + * * Source file type should be a zip file. + * * No credentials should be attached - the signed URLs provide access to the + * target bucket using internal service identity; if credentials were + * attached, the identity from the credentials would be used, but that + * identity does not have permissions to upload files to the URL. + * + * When making a HTTP PUT request, these two headers need to be specified: + * + * * `content-type: application/zip` + * + * And this header SHOULD NOT be specified: + * + * * `Authorization: Bearer YOUR_TOKEN` + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location in which the Google Cloud Storage signed + * URL should be generated, specified in the format `projects/* /locations/*`. + * @param {string} request.kmsKeyName + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2.GenerateUploadUrlResponse|GenerateUploadUrlResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/function_service.generate_upload_url.js + * region_tag:cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_async + */ + generateUploadUrl( + request?: protos.google.cloud.functions.v2.IGenerateUploadUrlRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2.IGenerateUploadUrlRequest|undefined, {}|undefined + ]>; + generateUploadUrl( + request: protos.google.cloud.functions.v2.IGenerateUploadUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateUploadUrl( + request: protos.google.cloud.functions.v2.IGenerateUploadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateUploadUrl( + request?: protos.google.cloud.functions.v2.IGenerateUploadUrlRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2.IGenerateUploadUrlRequest|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.generateUploadUrl(request, options, callback); + } +/** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and should be used within + * 30 minutes of generation. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of function for which source code Google Cloud Storage + * signed URL should be generated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2.GenerateDownloadUrlResponse|GenerateDownloadUrlResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/function_service.generate_download_url.js + * region_tag:cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_async + */ + generateDownloadUrl( + request?: protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest|undefined, {}|undefined + ]>; + generateDownloadUrl( + request: protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateDownloadUrl( + request: protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateDownloadUrl( + request?: protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest|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.generateDownloadUrl(request, options, callback); + } +/** + * Returns a list of runtimes that are supported for the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the runtimes should be + * listed, specified in the format `projects/* /locations/*` + * @param {string} request.filter + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2.ListRuntimesResponse|ListRuntimesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/function_service.list_runtimes.js + * region_tag:cloudfunctions_v2_generated_FunctionService_ListRuntimes_async + */ + listRuntimes( + request?: protos.google.cloud.functions.v2.IListRuntimesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v2.IListRuntimesResponse, + protos.google.cloud.functions.v2.IListRuntimesRequest|undefined, {}|undefined + ]>; + listRuntimes( + request: protos.google.cloud.functions.v2.IListRuntimesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2.IListRuntimesResponse, + protos.google.cloud.functions.v2.IListRuntimesRequest|null|undefined, + {}|null|undefined>): void; + listRuntimes( + request: protos.google.cloud.functions.v2.IListRuntimesRequest, + callback: Callback< + protos.google.cloud.functions.v2.IListRuntimesResponse, + protos.google.cloud.functions.v2.IListRuntimesRequest|null|undefined, + {}|null|undefined>): void; + listRuntimes( + request?: protos.google.cloud.functions.v2.IListRuntimesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.functions.v2.IListRuntimesResponse, + protos.google.cloud.functions.v2.IListRuntimesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v2.IListRuntimesResponse, + protos.google.cloud.functions.v2.IListRuntimesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v2.IListRuntimesResponse, + protos.google.cloud.functions.v2.IListRuntimesRequest|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.listRuntimes(request, options, callback); + } + +/** + * Creates a new function. If a function with the given name already exists in + * the specified project, the long running operation will return + * `ALREADY_EXISTS` error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location in which the function should be created, + * specified in the format `projects/* /locations/*` + * @param {google.cloud.functions.v2.Function} request.function + * Required. Function to be created. + * @param {string} request.functionId + * The ID to use for the function, which will become the final component of + * the function's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link protos.0-9|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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/function_service.create_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_CreateFunction_async + */ + createFunction( + request?: protos.google.cloud.functions.v2.ICreateFunctionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createFunction( + request: protos.google.cloud.functions.v2.ICreateFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFunction( + request: protos.google.cloud.functions.v2.ICreateFunctionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFunction( + request?: protos.google.cloud.functions.v2.ICreateFunctionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFunction(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createFunction()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/function_service.create_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_CreateFunction_async + */ + async checkCreateFunctionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFunction, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates existing function. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.functions.v2.Function} request.function + * Required. New version of the function. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request will be + * updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/function_service.update_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_UpdateFunction_async + */ + updateFunction( + request?: protos.google.cloud.functions.v2.IUpdateFunctionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateFunction( + request: protos.google.cloud.functions.v2.IUpdateFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFunction( + request: protos.google.cloud.functions.v2.IUpdateFunctionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFunction( + request?: protos.google.cloud.functions.v2.IUpdateFunctionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'function.name': request.function!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFunction(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateFunction()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/function_service.update_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_UpdateFunction_async + */ + async checkUpdateFunctionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFunction, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger will be updated to + * remove this function. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which should be deleted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/function_service.delete_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_DeleteFunction_async + */ + deleteFunction( + request?: protos.google.cloud.functions.v2.IDeleteFunctionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteFunction( + request: protos.google.cloud.functions.v2.IDeleteFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFunction( + request: protos.google.cloud.functions.v2.IDeleteFunctionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFunction( + request?: protos.google.cloud.functions.v2.IDeleteFunctionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteFunction(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteFunction()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/function_service.delete_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_DeleteFunction_async + */ + async checkDeleteFunctionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFunction, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Returns a list of functions that belong to the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the function should be + * listed, specified in the format `projects/* /locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2.Function|Function}. + * 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 `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFunctions( + request?: protos.google.cloud.functions.v2.IListFunctionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v2.IFunction[], + protos.google.cloud.functions.v2.IListFunctionsRequest|null, + protos.google.cloud.functions.v2.IListFunctionsResponse + ]>; + listFunctions( + request: protos.google.cloud.functions.v2.IListFunctionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.functions.v2.IListFunctionsRequest, + protos.google.cloud.functions.v2.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v2.IFunction>): void; + listFunctions( + request: protos.google.cloud.functions.v2.IListFunctionsRequest, + callback: PaginationCallback< + protos.google.cloud.functions.v2.IListFunctionsRequest, + protos.google.cloud.functions.v2.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v2.IFunction>): void; + listFunctions( + request?: protos.google.cloud.functions.v2.IListFunctionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.functions.v2.IListFunctionsRequest, + protos.google.cloud.functions.v2.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v2.IFunction>, + callback?: PaginationCallback< + protos.google.cloud.functions.v2.IListFunctionsRequest, + protos.google.cloud.functions.v2.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v2.IFunction>): + Promise<[ + protos.google.cloud.functions.v2.IFunction[], + protos.google.cloud.functions.v2.IListFunctionsRequest|null, + protos.google.cloud.functions.v2.IListFunctionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listFunctions(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the function should be + * listed, specified in the format `projects/* /locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @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 protos.google.cloud.functions.v2.Function|Function} 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 `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFunctionsStream( + request?: protos.google.cloud.functions.v2.IListFunctionsRequest, + 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['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.createStream( + this.innerApiCalls.listFunctions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFunctions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the function should be + * listed, specified in the format `projects/* /locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.functions.v2.Function|Function}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/function_service.list_functions.js + * region_tag:cloudfunctions_v2_generated_FunctionService_ListFunctions_async + */ + listFunctionsAsync( + request?: protos.google.cloud.functions.v2.IListFunctionsRequest, + 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['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.asyncIterate( + this.innerApiCalls['listFunctions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified build resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} build + * @returns {string} Resource name string. + */ + buildPath(project:string,location:string,build:string) { + return this.pathTemplates.buildPathTemplate.render({ + project: project, + location: location, + build: build, + }); + } + + /** + * Parse the project from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).project; + } + + /** + * Parse the location from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).location; + } + + /** + * Parse the build from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the build. + */ + matchBuildFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).build; + } + + /** + * Return a fully-qualified channel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} channel + * @returns {string} Resource name string. + */ + channelPath(project:string,location:string,channel:string) { + return this.pathTemplates.channelPathTemplate.render({ + project: project, + location: location, + channel: channel, + }); + } + + /** + * Parse the project from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).project; + } + + /** + * Parse the location from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the location. + */ + matchLocationFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).location; + } + + /** + * Parse the channel from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the channel. + */ + matchChannelFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).channel; + } + + /** + * Return a fully-qualified connector resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} connector + * @returns {string} Resource name string. + */ + connectorPath(project:string,location:string,connector:string) { + return this.pathTemplates.connectorPathTemplate.render({ + project: project, + location: location, + connector: connector, + }); + } + + /** + * Parse the project from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName).project; + } + + /** + * Parse the location from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName).location; + } + + /** + * Parse the connector from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the connector. + */ + matchConnectorFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName).connector; + } + + /** + * Return a fully-qualified cryptoKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @returns {string} Resource name string. + */ + cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { + return this.pathTemplates.cryptoKeyPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + }); + } + + /** + * Parse the project from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; + } + + /** + * Parse the location from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; + } + + /** + * Parse the key_ring from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; + } + + /** + * Parse the crypto_key from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; + } + + /** + * Return a fully-qualified function resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} functionParam + * @returns {string} Resource name string. + */ + functionPath(project:string,location:string,functionParam:string) { + return this.pathTemplates.functionPathTemplate.render({ + project: project, + location: location, + function: functionParam, + }); + } + + /** + * Parse the project from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).project; + } + + /** + * Parse the location from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).location; + } + + /** + * Parse the function from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the function. + */ + matchFunctionFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).function; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified 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 repository resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @returns {string} Resource name string. + */ + repositoryPath(project:string,location:string,repository:string) { + return this.pathTemplates.repositoryPathTemplate.render({ + project: project, + location: location, + repository: repository, + }); + } + + /** + * Parse the project from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).project; + } + + /** + * Parse the location from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).location; + } + + /** + * Parse the repository from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).repository; + } + + /** + * Return a fully-qualified service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * Return a fully-qualified topic resource name string. + * + * @param {string} project + * @param {string} topic + * @returns {string} Resource name string. + */ + topicPath(project:string,topic:string) { + return this.pathTemplates.topicPathTemplate.render({ + project: project, + topic: topic, + }); + } + + /** + * Parse the project from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).project; + } + + /** + * Parse the topic from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the topic. + */ + matchTopicFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).topic; + } + + /** + * Return a fully-qualified trigger resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} trigger + * @returns {string} Resource name string. + */ + triggerPath(project:string,location:string,trigger:string) { + return this.pathTemplates.triggerPathTemplate.render({ + project: project, + location: location, + trigger: trigger, + }); + } + + /** + * Parse the project from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).project; + } + + /** + * Parse the location from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).location; + } + + /** + * Parse the trigger from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the trigger. + */ + matchTriggerFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).trigger; + } + + /** + * Return a fully-qualified workerPool resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} worker_pool + * @returns {string} Resource name string. + */ + workerPoolPath(project:string,location:string,workerPool:string) { + return this.pathTemplates.workerPoolPathTemplate.render({ + project: project, + location: location, + worker_pool: workerPool, + }); + } + + /** + * Parse the project from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).project; + } + + /** + * Parse the location from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).location; + } + + /** + * Parse the worker_pool from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the worker_pool. + */ + matchWorkerPoolFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).worker_pool; + } + + /** + * 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.functionServiceStub && !this._terminated) { + return this.functionServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_client_config.json b/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_client_config.json new file mode 100644 index 00000000000..936769f0cb7 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_client_config.json @@ -0,0 +1,58 @@ +{ + "interfaces": { + "google.cloud.functions.v2.FunctionService": { + "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": { + "GetFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListFunctions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateUploadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateDownloadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListRuntimes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_proto_list.json b/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_proto_list.json new file mode 100644 index 00000000000..cfde205a091 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/functions/v2/functions.proto" +] diff --git a/owl-bot-staging/google-cloud-functions/v2/src/v2/gapic_metadata.json b/owl-bot-staging/google-cloud-functions/v2/src/v2/gapic_metadata.json new file mode 100644 index 00000000000..4342a4d7966 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/src/v2/gapic_metadata.json @@ -0,0 +1,107 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.functions.v2", + "libraryPackage": "@google-cloud/functions", + "services": { + "FunctionService": { + "clients": { + "grpc": { + "libraryClient": "FunctionServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "ListRuntimes": { + "methods": [ + "listRuntimes" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "FunctionServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "ListRuntimes": { + "methods": [ + "listRuntimes" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-functions/v2/src/v2/index.ts b/owl-bot-staging/google-cloud-functions/v2/src/v2/index.ts new file mode 100644 index 00000000000..ec33a786b85 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/src/v2/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 {FunctionServiceClient} from './function_service_client'; diff --git a/owl-bot-staging/google-cloud-functions/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-functions/v2/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..c41f33eb2a8 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/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 functions = require('@google-cloud/functions'); + +function main() { + const functionServiceClient = new functions.FunctionServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-functions/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-functions/v2/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..530ace3134e --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/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 {FunctionServiceClient} from '@google-cloud/functions'; + +// check that the client class type name can be used +function doStuffWithFunctionServiceClient(client: FunctionServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const functionServiceClient = new FunctionServiceClient(); + doStuffWithFunctionServiceClient(functionServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-functions/v2/system-test/install.ts b/owl-bot-staging/google-cloud-functions/v2/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/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-functions/v2/test/gapic_function_service_v2.ts b/owl-bot-staging/google-cloud-functions/v2/test/gapic_function_service_v2.ts new file mode 100644 index 00000000000..6256c9ab9ed --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/test/gapic_function_service_v2.ts @@ -0,0 +1,2584 @@ +// 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 functionserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.FunctionServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = functionserviceModule.v2.FunctionServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = functionserviceModule.v2.FunctionServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = functionserviceModule.v2.FunctionServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new functionserviceModule.v2.FunctionServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + await client.initialize(); + assert(client.functionServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.functionServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new functionserviceModule.v2.FunctionServiceClient({ + 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 functionserviceModule.v2.FunctionServiceClient({ + 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('getFunction', () => { + it('invokes getFunction without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GetFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.GetFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.Function() + ); + client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); + const [response] = await client.getFunction(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFunction without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GetFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.GetFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.Function() + ); + client.innerApiCalls.getFunction = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFunction( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v2.IFunction|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFunction with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GetFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.GetFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFunction = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFunction(request), expectedError); + const actualRequest = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFunction with closed client', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GetFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.GetFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFunction(request), expectedError); + }); + }); + + describe('generateUploadUrl', () => { + it('invokes generateUploadUrl without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.GenerateUploadUrlRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); + const [response] = await client.generateUploadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateUploadUrl without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.GenerateUploadUrlRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateUploadUrl( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v2.IGenerateUploadUrlResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateUploadUrl with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.GenerateUploadUrlRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateUploadUrl = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateUploadUrl(request), expectedError); + const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateUploadUrl with closed client', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.GenerateUploadUrlRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateUploadUrl(request), expectedError); + }); + }); + + describe('generateDownloadUrl', () => { + it('invokes generateDownloadUrl without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.GenerateDownloadUrlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = stubSimpleCall(expectedResponse); + const [response] = await client.generateDownloadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateDownloadUrl without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.GenerateDownloadUrlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateDownloadUrl( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateDownloadUrl with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.GenerateDownloadUrlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateDownloadUrl = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateDownloadUrl with closed client', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.GenerateDownloadUrlRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + }); + }); + + describe('listRuntimes', () => { + it('invokes listRuntimes without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.ListRuntimesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesResponse() + ); + client.innerApiCalls.listRuntimes = stubSimpleCall(expectedResponse); + const [response] = await client.listRuntimes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimes without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.ListRuntimesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesResponse() + ); + client.innerApiCalls.listRuntimes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRuntimes( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v2.IListRuntimesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimes with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.ListRuntimesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRuntimes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listRuntimes(request), expectedError); + const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimes with closed client', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.ListRuntimesRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listRuntimes(request), expectedError); + }); + }); + + describe('createFunction', () => { + it('invokes createFunction without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.CreateFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.CreateFunctionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = stubLongRunningCall(expectedResponse); + const [operation] = await client.createFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFunction without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.CreateFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.CreateFunctionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFunction( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFunction with call error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.CreateFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.CreateFunctionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createFunction(request), expectedError); + const actualRequest = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFunction with LRO error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.CreateFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.CreateFunctionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createFunction(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateFunctionProgress without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateFunctionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFunctionProgress with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateFunctionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateFunction', () => { + it('invokes updateFunction without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.UpdateFunctionRequest() + ); + request.function ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.UpdateFunctionRequest', ['function', 'name']); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFunction without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.UpdateFunctionRequest() + ); + request.function ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.UpdateFunctionRequest', ['function', 'name']); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFunction( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFunction with call error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.UpdateFunctionRequest() + ); + request.function ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.UpdateFunctionRequest', ['function', 'name']); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateFunction(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFunction with LRO error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.UpdateFunctionRequest() + ); + request.function ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.UpdateFunctionRequest', ['function', 'name']); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateFunction(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateFunctionProgress without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateFunctionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFunctionProgress with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateFunctionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteFunction', () => { + it('invokes deleteFunction without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.DeleteFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.DeleteFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFunction without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.DeleteFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.DeleteFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFunction( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFunction with call error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.DeleteFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.DeleteFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteFunction(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFunction with LRO error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.DeleteFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.DeleteFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteFunction(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteFunctionProgress without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteFunctionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFunctionProgress with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteFunctionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listFunctions', () => { + it('invokes listFunctions without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + ]; + client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); + const [response] = await client.listFunctions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFunctions without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + ]; + client.innerApiCalls.listFunctions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFunctions( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v2.IFunction[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFunctions with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFunctions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFunctions(request), expectedError); + const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFunctionsStream without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + ]; + client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v2.Function[] = []; + stream.on('data', (response: protos.google.cloud.functions.v2.Function) => { + 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.listFunctions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFunctionsStream with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v2.Function[] = []; + stream.on('data', (response: protos.google.cloud.functions.v2.Function) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFunctions without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + ]; + client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.functions.v2.IFunction[] = []; + const iterable = client.listFunctionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFunctions with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFunctionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.functions.v2.IFunction[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('build', () => { + const fakePath = "/rendered/path/build"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + build: "buildValue", + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.buildPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.buildPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('buildPath', () => { + const result = client.buildPath("projectValue", "locationValue", "buildValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.buildPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBuildName', () => { + const result = client.matchProjectFromBuildName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBuildName', () => { + const result = client.matchLocationFromBuildName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBuildFromBuildName', () => { + const result = client.matchBuildFromBuildName(fakePath); + assert.strictEqual(result, "buildValue"); + assert((client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('channel', () => { + const fakePath = "/rendered/path/channel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + channel: "channelValue", + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.channelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.channelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('channelPath', () => { + const result = client.channelPath("projectValue", "locationValue", "channelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.channelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromChannelName', () => { + const result = client.matchProjectFromChannelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromChannelName', () => { + const result = client.matchLocationFromChannelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchChannelFromChannelName', () => { + const result = client.matchChannelFromChannelName(fakePath); + assert.strictEqual(result, "channelValue"); + assert((client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('connector', () => { + const fakePath = "/rendered/path/connector"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + connector: "connectorValue", + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.connectorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.connectorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('connectorPath', () => { + const result = client.connectorPath("projectValue", "locationValue", "connectorValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.connectorPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConnectorName', () => { + const result = client.matchProjectFromConnectorName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConnectorName', () => { + const result = client.matchLocationFromConnectorName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConnectorFromConnectorName', () => { + const result = client.matchConnectorFromConnectorName(fakePath); + assert.strictEqual(result, "connectorValue"); + assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('cryptoKey', () => { + const fakePath = "/rendered/path/cryptoKey"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.cryptoKeyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('cryptoKeyPath', () => { + const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCryptoKeyName', () => { + const result = client.matchProjectFromCryptoKeyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCryptoKeyName', () => { + const result = client.matchLocationFromCryptoKeyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromCryptoKeyName', () => { + const result = client.matchKeyRingFromCryptoKeyName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromCryptoKeyName', () => { + const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('function', () => { + const fakePath = "/rendered/path/function"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + function: "functionValue", + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.functionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.functionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('functionPath', () => { + const result = client.functionPath("projectValue", "locationValue", "functionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.functionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFunctionName', () => { + const result = client.matchProjectFromFunctionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFunctionName', () => { + const result = client.matchLocationFromFunctionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFunctionFromFunctionName', () => { + const result = client.matchFunctionFromFunctionName(fakePath); + assert.strictEqual(result, "functionValue"); + assert((client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + 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('repository', () => { + const fakePath = "/rendered/path/repository"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.repositoryPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.repositoryPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('repositoryPath', () => { + const result = client.repositoryPath("projectValue", "locationValue", "repositoryValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.repositoryPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromRepositoryName', () => { + const result = client.matchProjectFromRepositoryName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromRepositoryName', () => { + const result = client.matchLocationFromRepositoryName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromRepositoryName', () => { + const result = client.matchRepositoryFromRepositoryName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath("projectValue", "locationValue", "serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('topic', () => { + const fakePath = "/rendered/path/topic"; + const expectedParameters = { + project: "projectValue", + topic: "topicValue", + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.topicPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.topicPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('topicPath', () => { + const result = client.topicPath("projectValue", "topicValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.topicPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTopicName', () => { + const result = client.matchProjectFromTopicName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.topicPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTopicFromTopicName', () => { + const result = client.matchTopicFromTopicName(fakePath); + assert.strictEqual(result, "topicValue"); + assert((client.pathTemplates.topicPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('trigger', () => { + const fakePath = "/rendered/path/trigger"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + trigger: "triggerValue", + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.triggerPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.triggerPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('triggerPath', () => { + const result = client.triggerPath("projectValue", "locationValue", "triggerValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.triggerPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTriggerName', () => { + const result = client.matchProjectFromTriggerName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromTriggerName', () => { + const result = client.matchLocationFromTriggerName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTriggerFromTriggerName', () => { + const result = client.matchTriggerFromTriggerName(fakePath); + assert.strictEqual(result, "triggerValue"); + assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('workerPool', () => { + const fakePath = "/rendered/path/workerPool"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + worker_pool: "workerPoolValue", + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workerPoolPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workerPoolPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workerPoolPath', () => { + const result = client.workerPoolPath("projectValue", "locationValue", "workerPoolValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workerPoolPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkerPoolName', () => { + const result = client.matchProjectFromWorkerPoolName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkerPoolName', () => { + const result = client.matchLocationFromWorkerPoolName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkerPoolFromWorkerPoolName', () => { + const result = client.matchWorkerPoolFromWorkerPoolName(fakePath); + assert.strictEqual(result, "workerPoolValue"); + assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-functions/v2/tsconfig.json b/owl-bot-staging/google-cloud-functions/v2/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/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-functions/v2/webpack.config.js b/owl-bot-staging/google-cloud-functions/v2/webpack.config.js new file mode 100644 index 00000000000..527abad554f --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2/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: 'FunctionService', + filename: './function-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-functions/v2alpha/.eslintignore b/owl-bot-staging/google-cloud-functions/v2alpha/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/.eslintrc.json b/owl-bot-staging/google-cloud-functions/v2alpha/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/.gitignore b/owl-bot-staging/google-cloud-functions/v2alpha/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/.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-functions/v2alpha/.jsdoc.js b/owl-bot-staging/google-cloud-functions/v2alpha/.jsdoc.js new file mode 100644 index 00000000000..43186156cf8 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/.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/functions', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/.mocharc.js b/owl-bot-staging/google-cloud-functions/v2alpha/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/.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-functions/v2alpha/.prettierrc.js b/owl-bot-staging/google-cloud-functions/v2alpha/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/.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-functions/v2alpha/README.md b/owl-bot-staging/google-cloud-functions/v2alpha/README.md new file mode 100644 index 00000000000..efb614cf6e7 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/README.md @@ -0,0 +1 @@ +Functions: Nodejs Client diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/package.json b/owl-bot-staging/google-cloud-functions/v2alpha/package.json new file mode 100644 index 00000000000..a5e7b166e52 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/functions", + "version": "0.1.0", + "description": "Functions client for Node.js", + "repository": "googleapis/nodejs-functions", + "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 functions", + "functions", + "function service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/protos/google/cloud/functions/v2alpha/functions.proto b/owl-bot-staging/google-cloud-functions/v2alpha/protos/google/cloud/functions/v2alpha/functions.proto new file mode 100644 index 00000000000..3c96518d728 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/protos/google/cloud/functions/v2alpha/functions.proto @@ -0,0 +1,1147 @@ +// 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 +// +// 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.functions.v2alpha; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/functions/apiv2alpha/functionspb;functionspb"; +option java_multiple_files = true; +option java_outer_classname = "FunctionsProto"; +option java_package = "com.google.cloud.functions.v2alpha"; +option objc_class_prefix = "GCF"; +option (google.api.resource_definition) = { + type: "artifactregistry.googleapis.com/Repository" + pattern: "projects/{project}/locations/{location}/repositories/{repository}" +}; +option (google.api.resource_definition) = { + type: "cloudbuild.googleapis.com/Build" + pattern: "projects/{project}/locations/{location}/builds/{build}" +}; +option (google.api.resource_definition) = { + type: "cloudbuild.googleapis.com/WorkerPool" + pattern: "projects/{project}/locations/{location}/workerPools/{worker_pool}" +}; +option (google.api.resource_definition) = { + type: "run.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/services/{service}" +}; +option (google.api.resource_definition) = { + type: "vpcaccess.googleapis.com/Connector" + pattern: "projects/{project}/locations/{location}/connectors/{connector}" +}; +option (google.api.resource_definition) = { + type: "eventarc.googleapis.com/Trigger" + pattern: "projects/{project}/locations/{location}/triggers/{trigger}" +}; +option (google.api.resource_definition) = { + type: "eventarc.googleapis.com/Channel" + pattern: "projects/{project}/locations/{location}/channels/{channel}" +}; +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" +}; +option (google.api.resource_definition) = { + type: "cloudkms.googleapis.com/CryptoKey" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" +}; + +// Google Cloud Functions is used to deploy functions that are executed by +// Google in response to various events. Data connected with that event is +// passed to a function as the input data. +// +// A **function** is a resource which describes a function that should be +// executed and how it is triggered. +service FunctionService { + option (google.api.default_host) = "cloudfunctions.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Returns a function with the given name from the requested project. + rpc GetFunction(GetFunctionRequest) returns (Function) { + option (google.api.http) = { + get: "/v2alpha/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns a list of functions that belong to the requested project. + rpc ListFunctions(ListFunctionsRequest) returns (ListFunctionsResponse) { + option (google.api.http) = { + get: "/v2alpha/{parent=projects/*/locations/*}/functions" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new function. If a function with the given name already exists in + // the specified project, the long running operation will return + // `ALREADY_EXISTS` error. + rpc CreateFunction(CreateFunctionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha/{parent=projects/*/locations/*}/functions" + body: "function" + }; + option (google.api.method_signature) = "parent,function,function_id"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.functions.v2alpha.Function" + metadata_type: "google.cloud.functions.v2alpha.OperationMetadata" + }; + } + + // Updates existing function. + rpc UpdateFunction(UpdateFunctionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2alpha/{function.name=projects/*/locations/*/functions/*}" + body: "function" + }; + option (google.api.method_signature) = "function,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.functions.v2alpha.Function" + metadata_type: "google.cloud.functions.v2alpha.OperationMetadata" + }; + } + + // Deletes a function with the given name from the specified project. If the + // given function is used by some trigger, the trigger will be updated to + // remove this function. + rpc DeleteFunction(DeleteFunctionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2alpha/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.functions.v2alpha.OperationMetadata" + }; + } + + // Returns a signed URL for uploading a function source code. + // For more information about the signed URL usage see: + // https://cloud.google.com/storage/docs/access-control/signed-urls. + // Once the function source code upload is complete, the used signed + // URL should be provided in CreateFunction or UpdateFunction request + // as a reference to the function source code. + // + // When uploading source code to the generated signed URL, please follow + // these restrictions: + // + // * Source file type should be a zip file. + // * No credentials should be attached - the signed URLs provide access to the + // target bucket using internal service identity; if credentials were + // attached, the identity from the credentials would be used, but that + // identity does not have permissions to upload files to the URL. + // + // When making a HTTP PUT request, these two headers need to be specified: + // + // * `content-type: application/zip` + // + // And this header SHOULD NOT be specified: + // + // * `Authorization: Bearer YOUR_TOKEN` + rpc GenerateUploadUrl(GenerateUploadUrlRequest) + returns (GenerateUploadUrlResponse) { + option (google.api.http) = { + post: "/v2alpha/{parent=projects/*/locations/*}/functions:generateUploadUrl" + body: "*" + }; + } + + // Returns a signed URL for downloading deployed function source code. + // The URL is only valid for a limited period and should be used within + // 30 minutes of generation. + // For more information about the signed URL usage see: + // https://cloud.google.com/storage/docs/access-control/signed-urls + rpc GenerateDownloadUrl(GenerateDownloadUrlRequest) + returns (GenerateDownloadUrlResponse) { + option (google.api.http) = { + post: "/v2alpha/{name=projects/*/locations/*/functions/*}:generateDownloadUrl" + body: "*" + }; + } + + // Returns a list of runtimes that are supported for the requested project. + rpc ListRuntimes(ListRuntimesRequest) returns (ListRuntimesResponse) { + option (google.api.http) = { + get: "/v2alpha/{parent=projects/*/locations/*}/runtimes" + }; + option (google.api.method_signature) = "parent"; + } +} + +// The environment the function is hosted on. +enum Environment { + // Unspecified + ENVIRONMENT_UNSPECIFIED = 0; + + // Gen 1 + GEN_1 = 1; + + // Gen 2 + GEN_2 = 2; +} + +// Describes a Cloud Function that contains user computation executed in +// response to an event. It encapsulates function and trigger configurations. +message Function { + option (google.api.resource) = { + type: "cloudfunctions.googleapis.com/Function" + pattern: "projects/{project}/locations/{location}/functions/{function}" + plural: "functions" + singular: "function" + }; + + // Describes the current state of the function. + enum State { + // Not specified. Invalid state. + STATE_UNSPECIFIED = 0; + + // Function has been successfully deployed and is serving. + ACTIVE = 1; + + // Function deployment failed and the function is not serving. + FAILED = 2; + + // Function is being created or updated. + DEPLOYING = 3; + + // Function is being deleted. + DELETING = 4; + + // Function deployment failed and the function serving state is undefined. + // The function should be updated or deleted to move it out of this state. + UNKNOWN = 5; + } + + // A user-defined name of the function. Function names must be unique + // globally and match pattern `projects/*/locations/*/functions/*` + string name = 1; + + // User-provided description of a function. + string description = 2; + + // Describes the Build step of the function that builds a container from the + // given source. + BuildConfig build_config = 3; + + // Describes the Service being deployed. Currently deploys services to Cloud + // Run (fully managed). + ServiceConfig service_config = 4; + + // An Eventarc trigger managed by Google Cloud Functions that fires events in + // response to a condition in another service. + EventTrigger event_trigger = 5; + + // Output only. State of the function. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of a Cloud Function. + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels associated with this Cloud Function. + map labels = 8; + + // Output only. State Messages for this Cloud Function. + repeated StateMessage state_messages = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Describe whether the function is 1st Gen or 2nd Gen. + Environment environment = 10; + + // Output only. The deployed url for the function. + string url = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // [Preview] Resource name of a KMS crypto key (managed by the user) used to + // encrypt/decrypt function resources. + // + // It must match the pattern + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + string kms_key_name = 25 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + }]; +} + +// Informational messages about the state of the Cloud Function or Operation. +message StateMessage { + // Severity of the state message. + enum Severity { + // Not specified. Invalid severity. + SEVERITY_UNSPECIFIED = 0; + + // ERROR-level severity. + ERROR = 1; + + // WARNING-level severity. + WARNING = 2; + + // INFO-level severity. + INFO = 3; + } + + // Severity of the state message. + Severity severity = 1; + + // One-word CamelCase type of the state message. + string type = 2; + + // The message. + string message = 3; +} + +// Location of the source in an archive file in Google Cloud Storage. +message StorageSource { + // Google Cloud Storage bucket containing the source (see + // [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + string bucket = 1; + + // Google Cloud Storage object containing the source. + // + // This object must be a gzipped archive file (`.tar.gz`) containing source to + // build. + string object = 2; + + // Google Cloud Storage generation for the object. If the generation is + // omitted, the latest generation will be used. + int64 generation = 3; +} + +// Location of the source in a Google Cloud Source Repository. +message RepoSource { + // A revision within the Cloud Source Repository must be specified in + // one of these ways. + oneof revision { + // Regex matching branches to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string branch_name = 3; + + // Regex matching tags to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string tag_name = 4; + + // Explicit commit SHA to build. + string commit_sha = 5; + } + + // ID of the project that owns the Cloud Source Repository. If omitted, the + // project ID requesting the build is assumed. + string project_id = 1; + + // Name of the Cloud Source Repository. + string repo_name = 2; + + // Directory, relative to the source root, in which to run the build. + // + // This must be a relative path. If a step's `dir` is specified and is an + // absolute path, this value is ignored for that step's execution. + // eg. helloworld (no leading slash allowed) + string dir = 6; + + // Only trigger a build if the revision regex does NOT match the revision + // regex. + bool invert_regex = 7; +} + +// The location of the function source code. +message Source { + // Location of the source. + // At least one source needs to be provided for the deployment to succeed. + oneof source { + // If provided, get the source from this location in Google Cloud Storage. + StorageSource storage_source = 1; + + // If provided, get the source from this location in a Cloud Source + // Repository. + RepoSource repo_source = 2; + } +} + +// Provenance of the source. Ways to find the original source, or verify that +// some source was used for this build. +message SourceProvenance { + // A copy of the build's `source.storage_source`, if exists, with any + // generations resolved. + StorageSource resolved_storage_source = 1; + + // A copy of the build's `source.repo_source`, if exists, with any + // revisions resolved. + RepoSource resolved_repo_source = 2; +} + +// Describes the Build step of the function that builds a container from the +// given source. +message BuildConfig { + // Docker Registry to use for storing function Docker images. + enum DockerRegistry { + // Unspecified. + DOCKER_REGISTRY_UNSPECIFIED = 0; + + // Docker images will be stored in multi-regional Container Registry + // repositories named `gcf`. + CONTAINER_REGISTRY = 1; + + // Docker images will be stored in regional Artifact Registry repositories. + // By default, GCF will create and use repositories named `gcf-artifacts` + // in every region in which a function is deployed. But the repository to + // use can also be specified by the user using the `docker_repository` + // field. + ARTIFACT_REGISTRY = 2; + } + + // Output only. The Cloud Build name of the latest successful deployment of + // the function. + string build = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Build" + } + ]; + + // The runtime in which to run the function. Required when deploying a new + // function, optional when updating an existing function. For a complete + // list of possible choices, see the + // [`gcloud` command + // reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + string runtime = 2; + + // The name of the function (as defined in source code) that will be + // executed. Defaults to the resource name suffix, if not specified. For + // backward compatibility, if function with given name is not found, then the + // system will try to use function named "function". + // For Node.js this is name of a function exported by the module specified + // in `source_location`. + string entry_point = 3; + + // The location of the function source code. + Source source = 4; + + // Output only. A permanent fixed identifier for source. + SourceProvenance source_provenance = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Name of the Cloud Build Custom Worker Pool that should be used to build the + // function. The format of this field is + // `projects/{project}/locations/{region}/workerPools/{workerPool}` where + // {project} and {region} are the project id and region respectively where the + // worker pool is defined and {workerPool} is the short name of the worker + // pool. + // + // If the project id is not the same as the function, then the Cloud + // Functions Service Agent + // (service-@gcf-admin-robot.iam.gserviceaccount.com) must be + // granted the role Cloud Build Custom Workers Builder + // (roles/cloudbuild.customworkers.builder) in the project. + string worker_pool = 5 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + + // User-provided build-time environment variables for the function + map environment_variables = 6; + + // Docker Registry to use for this deployment. This configuration is only + // applicable to 1st Gen functions, 2nd Gen functions can only use Artifact + // Registry. + // + // If `docker_repository` field is specified, this field will be automatically + // set as `ARTIFACT_REGISTRY`. + // If unspecified, it currently defaults to `CONTAINER_REGISTRY`. + // This field may be overridden by the backend for eligible deployments. + DockerRegistry docker_registry = 10; + + // User managed repository created in Artifact Registry optionally + // with a customer managed encryption key. This is the repository to which the + // function docker image will be pushed after it is built by Cloud Build. + // If unspecified, GCF will create and use a repository named 'gcf-artifacts' + // for every deployed region. + // + // It must match the pattern + // `projects/{project}/locations/{location}/repositories/{repository}`. + // + // Cross-project repositories are not supported. + // Cross-location repositories are not supported. + // Repository format must be 'DOCKER'. + string docker_repository = 7 [(google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/Repository" + }]; +} + +// Describes the Service being deployed. +// Currently Supported : Cloud Run (fully managed). +message ServiceConfig { + // Available egress settings. + // + // This controls what traffic is diverted through the VPC Access Connector + // resource. By default PRIVATE_RANGES_ONLY will be used. + enum VpcConnectorEgressSettings { + // Unspecified. + VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; + + // Use the VPC Access Connector only for private IP space from RFC1918. + PRIVATE_RANGES_ONLY = 1; + + // Force the use of VPC Access Connector for all egress traffic from the + // function. + ALL_TRAFFIC = 2; + } + + // Available ingress settings. + // + // This controls what traffic can reach the function. + // + // If unspecified, ALLOW_ALL will be used. + enum IngressSettings { + // Unspecified. + INGRESS_SETTINGS_UNSPECIFIED = 0; + + // Allow HTTP traffic from public and private sources. + ALLOW_ALL = 1; + + // Allow HTTP traffic from only private VPC sources. + ALLOW_INTERNAL_ONLY = 2; + + // Allow HTTP traffic from private VPC sources and through GCLB. + ALLOW_INTERNAL_AND_GCLB = 3; + } + + // Available security level settings. + // + // This enforces security protocol on function URL. + // + // Security level is only configurable for 1st Gen functions, If unspecified, + // SECURE_OPTIONAL will be used. 2nd Gen functions are SECURE_ALWAYS ONLY. + enum SecurityLevel { + // Unspecified. + SECURITY_LEVEL_UNSPECIFIED = 0; + + // Requests for a URL that match this handler that do not use HTTPS are + // automatically redirected to the HTTPS URL with the same path. Query + // parameters are reserved for the redirect. + SECURE_ALWAYS = 1; + + // Both HTTP and HTTPS requests with URLs that match the handler succeed + // without redirects. The application can examine the request to determine + // which protocol was used and respond accordingly. + SECURE_OPTIONAL = 2; + } + + // Output only. Name of the service associated with a Function. + // The format of this field is + // `projects/{project}/locations/{region}/services/{service}` + string service = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { type: "run.googleapis.com/Service" } + ]; + + // The function execution timeout. Execution is considered failed and + // can be terminated if the function is not completed at the end of the + // timeout period. Defaults to 60 seconds. + int32 timeout_seconds = 2; + + // The amount of memory available for a function. + // Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is + // supplied the value is interpreted as bytes. + // See + // https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go + // a full description. + string available_memory = 13; + + // [Preview] The number of CPUs used in a single container instance. + // Default value is calculated from available memory. + // Supports the same values as Cloud Run, see + // https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements + // Example: "1" indicates 1 vCPU + string available_cpu = 22; + + // Environment variables that shall be available during function execution. + map environment_variables = 4; + + // The limit on the maximum number of function instances that may coexist at a + // given time. + // + // In some cases, such as rapid traffic surges, Cloud Functions may, for a + // short period of time, create more instances than the specified max + // instances limit. If your function cannot tolerate this temporary behavior, + // you may want to factor in a safety margin and set a lower max instances + // value than your function can tolerate. + // + // See the [Max + // Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + // more details. + int32 max_instance_count = 5; + + // The limit on the minimum number of function instances that may coexist at a + // given time. + // + // Function instances are kept in idle state for a short period after they + // finished executing the request to reduce cold start time for subsequent + // requests. Setting a minimum instance count will ensure that the given + // number of instances are kept running in idle state always. This can help + // with cold start times when jump in incoming request count occurs after the + // idle instance would have been stopped in the default case. + int32 min_instance_count = 12; + + // The Serverless VPC Access connector that this cloud function can connect + // to. The format of this field is `projects/*/locations/*/connectors/*`. + string vpc_connector = 6 [(google.api.resource_reference) = { + type: "vpcaccess.googleapis.com/Connector" + }]; + + // The egress settings for the connector, controlling what traffic is diverted + // through it. + VpcConnectorEgressSettings vpc_connector_egress_settings = 7; + + // The ingress settings for the function, controlling what traffic can reach + // it. + IngressSettings ingress_settings = 8; + + // Output only. URI of the Service deployed. + string uri = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The email of the service's service account. If empty, defaults to + // `{project_number}-compute@developer.gserviceaccount.com`. + string service_account_email = 10; + + // Whether 100% of traffic is routed to the latest revision. + // On CreateFunction and UpdateFunction, when set to true, the revision being + // deployed will serve 100% of traffic, ignoring any traffic split settings, + // if any. On GetFunction, true will be returned if the latest revision is + // serving 100% of traffic. + bool all_traffic_on_latest_revision = 16; + + // Secret environment variables configuration. + repeated SecretEnvVar secret_environment_variables = 17; + + // Secret volumes configuration. + repeated SecretVolume secret_volumes = 19; + + // Output only. The name of service revision. + string revision = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // [Preview] Sets the maximum number of concurrent requests that each instance + // can receive. Defaults to 1. + int32 max_instance_request_concurrency = 20; + + // Security level configure whether the function only accepts https. + // This configuration is only applicable to 1st Gen functions with Http + // trigger. By default https is optional for 1st Gen functions; 2nd Gen + // functions are https ONLY. + SecurityLevel security_level = 21; +} + +// Configuration for a secret environment variable. It has the information +// necessary to fetch the secret value from secret manager and expose it as an +// environment variable. +message SecretEnvVar { + // Name of the environment variable. + string key = 1; + + // Project identifier (preferably project number but can also be the + // project ID) of the project that contains the secret. If not set, it is + // assumed that the secret is in the same project as the function. + string project_id = 2; + + // Name of the secret in secret manager (not the full resource name). + string secret = 3; + + // Version of the secret (version number or the string 'latest'). It is + // recommended to use a numeric version for secret environment variables as + // any updates to the secret value is not reflected until new instances + // start. + string version = 4; +} + +// Configuration for a secret volume. It has the information necessary to fetch +// the secret value from secret manager and make it available as files mounted +// at the requested paths within the application container. +message SecretVolume { + // Configuration for a single version. + message SecretVersion { + // Version of the secret (version number or the string 'latest'). It is + // preferable to use `latest` version with secret volumes as secret value + // changes are reflected immediately. + string version = 1; + + // Relative path of the file under the mount path where the secret value for + // this version will be fetched and made available. For example, setting the + // mount_path as '/etc/secrets' and path as `secret_foo` would mount the + // secret value file at `/etc/secrets/secret_foo`. + string path = 2; + } + + // The path within the container to mount the secret volume. For example, + // setting the mount_path as `/etc/secrets` would mount the secret value files + // under the `/etc/secrets` directory. This directory will also be completely + // shadowed and unavailable to mount any other secrets. + // Recommended mount path: /etc/secrets + string mount_path = 1; + + // Project identifier (preferably project number but can also be the project + // ID) of the project that contains the secret. If not set, it is + // assumed that the secret is in the same project as the function. + string project_id = 2; + + // Name of the secret in secret manager (not the full resource name). + string secret = 3; + + // List of secret versions to mount for this secret. If empty, the `latest` + // version of the secret will be made available in a file named after the + // secret under the mount point. + repeated SecretVersion versions = 4; +} + +// Describes EventTrigger, used to request events to be sent from another +// service. +message EventTrigger { + // Describes the retry policy in case of function's execution failure. + // Retried execution is charged as any other execution. + enum RetryPolicy { + // Not specified. + RETRY_POLICY_UNSPECIFIED = 0; + + // Do not retry. + RETRY_POLICY_DO_NOT_RETRY = 1; + + // Retry on any failure, retry up to 7 days with an exponential backoff + // (capped at 10 seconds). + RETRY_POLICY_RETRY = 2; + } + + // Output only. The resource name of the Eventarc trigger. The format of this + // field is `projects/{project}/locations/{region}/triggers/{trigger}`. + string trigger = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Trigger" + } + ]; + + // The region that the trigger will be in. The trigger will only receive + // events originating in this region. It can be the same + // region as the function, a different region or multi-region, or the global + // region. If not provided, defaults to the same region as the function. + string trigger_region = 2; + + // Required. The type of event to observe. For example: + // `google.cloud.audit.log.v1.written` or + // `google.cloud.pubsub.topic.v1.messagePublished`. + string event_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Criteria used to filter events. + repeated EventFilter event_filters = 4; + + // Optional. The name of a Pub/Sub topic in the same project that will be used + // as the transport topic for the event delivery. Format: + // `projects/{project}/topics/{topic}`. + // + // This is only valid for events of type + // `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here + // will not be deleted at function deletion. + string pubsub_topic = 5 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } + ]; + + // Optional. The email of the trigger's service account. The service account + // must have permission to invoke Cloud Run services, the permission is + // `run.routes.invoke`. + // If empty, defaults to the Compute Engine default service account: + // `{project_number}-compute@developer.gserviceaccount.com`. + string service_account_email = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If unset, then defaults to ignoring failures (i.e. not retrying + // them). + RetryPolicy retry_policy = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the channel associated with the trigger in + // `projects/{project}/locations/{location}/channels/{channel}` format. + // You must provide a channel to receive events from Eventarc SaaS partners. + string channel = 8 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Channel" + } + ]; +} + +// Filters events based on exact matches on the CloudEvents attributes. +message EventFilter { + // Required. The name of a CloudEvents attribute. + string attribute = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The value for the attribute. + string value = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The operator used for matching the events with the value of the + // filter. If not specified, only events that have an exact key-value pair + // specified in the filter are matched. The only allowed value is + // `match-path-pattern`. + string operator = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for the `GetFunction` method. +message GetFunctionRequest { + // Required. The name of the function which details should be obtained. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Request for the `ListFunctions` method. +message ListFunctionsRequest { + // Required. The project and location from which the function should be + // listed, specified in the format `projects/*/locations/*` If you want to + // list functions in all locations, use "-" in place of a location. When + // listing functions in all locations, if one or more location(s) are + // unreachable, the response will contain functions from all reachable + // locations along with the names of any unreachable locations. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudfunctions.googleapis.com/Function" + } + ]; + + // Maximum number of functions to return per call. The largest allowed + // page_size is 1,000, if the page_size is omitted or specified as greater + // than 1,000 then it will be replaced as 1,000. The size of the list + // response can be less than specified when used with filters. + int32 page_size = 2; + + // The value returned by the last + // `ListFunctionsResponse`; indicates that + // this is a continuation of a prior `ListFunctions` call, and that the + // system should return the next page of data. + string page_token = 3; + + // The filter for Functions that match the filter expression, + // following the syntax outlined in https://google.aip.dev/160. + string filter = 4; + + // The sorting order of the resources returned. Value should be a comma + // separated list of fields. The default sorting oder is ascending. + // See https://google.aip.dev/132#ordering. + string order_by = 5; +} + +// Response for the `ListFunctions` method. +message ListFunctionsResponse { + // The functions that match the request. + repeated Function functions = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. The response does not include any + // functions from these locations. + repeated string unreachable = 3; +} + +// Request for the `CreateFunction` method. +message CreateFunctionRequest { + // Required. The project and location in which the function should be created, + // specified in the format `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Function to be created. + Function function = 2 [(google.api.field_behavior) = REQUIRED]; + + // The ID to use for the function, which will become the final component of + // the function's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + string function_id = 3; +} + +// Request for the `UpdateFunction` method. +message UpdateFunctionRequest { + // Required. New version of the function. + Function function = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + // If no field mask is provided, all provided fields in the request will be + // updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for the `DeleteFunction` method. +message DeleteFunctionRequest { + // Required. The name of the function which should be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Request of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlRequest { + // Required. The project and location in which the Google Cloud Storage signed + // URL should be generated, specified in the format `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // [Preview] Resource name of a KMS crypto key (managed by the user) used to + // encrypt/decrypt function source code objects in intermediate Cloud Storage + // buckets. When you generate an upload url and upload your source code, it + // gets copied to an intermediate Cloud Storage bucket. The source code is + // then copied to a versioned directory in the sources bucket in the consumer + // project during the function deployment. + // + // It must match the pattern + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + // + // The Google Cloud Functions service account + // (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + // granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + // (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + // Key/KeyRing/Project/Organization (least access preferred). + string kms_key_name = 2 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + }]; +} + +// Response of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for a + // function source code upload. The uploaded file should be a zip archive + // which contains a function. + string upload_url = 1; + + // The location of the source code in the upload bucket. + // + // Once the archive is uploaded using the `upload_url` use this field to + // set the `function.build_config.source.storage_source` + // during CreateFunction and UpdateFunction. + // + // Generation defaults to 0, as Cloud Storage provides a new generation only + // upon uploading a new object or version of an object. + StorageSource storage_source = 2; +} + +// Request of `GenerateDownloadUrl` method. +message GenerateDownloadUrlRequest { + // Required. The name of function for which source code Google Cloud Storage + // signed URL should be generated. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Response of `GenerateDownloadUrl` method. +message GenerateDownloadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for + // function source code download. + string download_url = 1; +} + +// Request for the `ListRuntimes` method. +message ListRuntimesRequest { + // Required. The project and location from which the runtimes should be + // listed, specified in the format `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The filter for Runtimes that match the filter expression, + // following the syntax outlined in https://google.aip.dev/160. + string filter = 2; +} + +// Response for the `ListRuntimes` method. +message ListRuntimesResponse { + // Describes a runtime and any special information (e.g., deprecation status) + // related to it. + message Runtime { + // The name of the runtime, e.g., 'go113', 'nodejs12', etc. + string name = 1; + + // The user facing name, eg 'Go 1.13', 'Node.js 12', etc. + string display_name = 5; + + // The stage of life this runtime is in, e.g., BETA, GA, etc. + RuntimeStage stage = 2; + + // Warning messages, e.g., a deprecation warning. + repeated string warnings = 3; + + // The environment for the runtime. + Environment environment = 4; + } + + // The various stages that a runtime can be in. + enum RuntimeStage { + // Not specified. + RUNTIME_STAGE_UNSPECIFIED = 0; + + // The runtime is in development. + DEVELOPMENT = 1; + + // The runtime is in the Alpha stage. + ALPHA = 2; + + // The runtime is in the Beta stage. + BETA = 3; + + // The runtime is generally available. + GA = 4; + + // The runtime is deprecated. + DEPRECATED = 5; + + // The runtime is no longer supported. + DECOMMISSIONED = 6; + } + + // The runtimes that match the request. + repeated Runtime runtimes = 1; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation finished running. + google.protobuf.Timestamp end_time = 2; + + // Server-defined resource path for the target of the operation. + string target = 3; + + // Name of the verb executed by the operation. + string verb = 4; + + // Human-readable status of the operation, if any. + string status_detail = 5; + + // Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a + // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + // `Code.CANCELLED`. + bool cancel_requested = 6; + + // API version used to start the operation. + string api_version = 7; + + // The original request that started the operation. + google.protobuf.Any request_resource = 8; + + // Mechanism for reporting in-progress stages + repeated Stage stages = 9; +} + +// Extra GCF specific location information. +message LocationMetadata { + // The Cloud Function environments this location supports. + repeated Environment environments = 1; +} + +// Each Stage of the deployment process +message Stage { + // Possible names for a Stage + enum Name { + // Not specified. Invalid name. + NAME_UNSPECIFIED = 0; + + // Artifact Regsitry Stage + ARTIFACT_REGISTRY = 1; + + // Build Stage + BUILD = 2; + + // Service Stage + SERVICE = 3; + + // Trigger Stage + TRIGGER = 4; + + // Service Rollback Stage + SERVICE_ROLLBACK = 5; + + // Trigger Rollback Stage + TRIGGER_ROLLBACK = 6; + } + + // Possible states for a Stage + enum State { + // Not specified. Invalid state. + STATE_UNSPECIFIED = 0; + + // Stage has not started. + NOT_STARTED = 1; + + // Stage is in progress. + IN_PROGRESS = 2; + + // Stage has completed. + COMPLETE = 3; + } + + // Name of the Stage. This will be unique for each Stage. + Name name = 1; + + // Message describing the Stage + string message = 2; + + // Current state of the Stage + State state = 3; + + // Resource of the Stage + string resource = 4; + + // Link to the current Stage resource + string resource_uri = 5; + + // State messages from the current Stage. + repeated StateMessage state_messages = 6; +} diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.create_function.js b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.create_function.js new file mode 100644 index 00000000000..0f5680a4aa3 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.create_function.js @@ -0,0 +1,75 @@ +// 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, function1) { + // [START cloudfunctions_v2alpha_generated_FunctionService_CreateFunction_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 project and location in which the function should be created, + * specified in the format `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * Required. Function to be created. + */ + // const function = {} + /** + * The ID to use for the function, which will become the final component of + * the function's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + */ + // const functionId = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callCreateFunction() { + // Construct request + const request = { + parent, + function1, + }; + + // Run request + const [operation] = await functionsClient.createFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFunction(); + // [END cloudfunctions_v2alpha_generated_FunctionService_CreateFunction_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-functions/v2alpha/samples/generated/v2alpha/function_service.delete_function.js b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.delete_function.js new file mode 100644 index 00000000000..d835bb0b47e --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.delete_function.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 cloudfunctions_v2alpha_generated_FunctionService_DeleteFunction_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which should be deleted. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callDeleteFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await functionsClient.deleteFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFunction(); + // [END cloudfunctions_v2alpha_generated_FunctionService_DeleteFunction_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-functions/v2alpha/samples/generated/v2alpha/function_service.generate_download_url.js b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.generate_download_url.js new file mode 100644 index 00000000000..aef6c59f518 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.generate_download_url.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 cloudfunctions_v2alpha_generated_FunctionService_GenerateDownloadUrl_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of function for which source code Google Cloud Storage + * signed URL should be generated. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGenerateDownloadUrl() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await functionsClient.generateDownloadUrl(request); + console.log(response); + } + + callGenerateDownloadUrl(); + // [END cloudfunctions_v2alpha_generated_FunctionService_GenerateDownloadUrl_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-functions/v2alpha/samples/generated/v2alpha/function_service.generate_upload_url.js b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.generate_upload_url.js new file mode 100644 index 00000000000..06ed9cd3085 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.generate_upload_url.js @@ -0,0 +1,78 @@ +// 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 cloudfunctions_v2alpha_generated_FunctionService_GenerateUploadUrl_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 project and location in which the Google Cloud Storage signed + * URL should be generated, specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Preview Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). + */ + // const kmsKeyName = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGenerateUploadUrl() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await functionsClient.generateUploadUrl(request); + console.log(response); + } + + callGenerateUploadUrl(); + // [END cloudfunctions_v2alpha_generated_FunctionService_GenerateUploadUrl_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-functions/v2alpha/samples/generated/v2alpha/function_service.get_function.js b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.get_function.js new file mode 100644 index 00000000000..d560d8fb815 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.get_function.js @@ -0,0 +1,61 @@ +// 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 cloudfunctions_v2alpha_generated_FunctionService_GetFunction_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which details should be obtained. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGetFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await functionsClient.getFunction(request); + console.log(response); + } + + callGetFunction(); + // [END cloudfunctions_v2alpha_generated_FunctionService_GetFunction_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-functions/v2alpha/samples/generated/v2alpha/function_service.list_functions.js b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.list_functions.js new file mode 100644 index 00000000000..9e131b18177 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.list_functions.js @@ -0,0 +1,93 @@ +// 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 cloudfunctions_v2alpha_generated_FunctionService_ListFunctions_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 project and location from which the function should be + * listed, specified in the format `projects/* /locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. + */ + // const parent = 'abc123' + /** + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + */ + // const pageSize = 1234 + /** + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + */ + // const filter = 'abc123' + /** + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callListFunctions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await functionsClient.listFunctionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFunctions(); + // [END cloudfunctions_v2alpha_generated_FunctionService_ListFunctions_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-functions/v2alpha/samples/generated/v2alpha/function_service.list_runtimes.js b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.list_runtimes.js new file mode 100644 index 00000000000..9a5754e50d3 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.list_runtimes.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) { + // [START cloudfunctions_v2alpha_generated_FunctionService_ListRuntimes_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 project and location from which the runtimes should be + * listed, specified in the format `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + */ + // const filter = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callListRuntimes() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await functionsClient.listRuntimes(request); + console.log(response); + } + + callListRuntimes(); + // [END cloudfunctions_v2alpha_generated_FunctionService_ListRuntimes_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-functions/v2alpha/samples/generated/v2alpha/function_service.update_function.js b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.update_function.js new file mode 100644 index 00000000000..799bde25a65 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.update_function.js @@ -0,0 +1,68 @@ +// 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(function1) { + // [START cloudfunctions_v2alpha_generated_FunctionService_UpdateFunction_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. New version of the function. + */ + // const function = {} + /** + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request will be + * updated. + */ + // const updateMask = {} + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callUpdateFunction() { + // Construct request + const request = { + function1, + }; + + // Run request + const [operation] = await functionsClient.updateFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFunction(); + // [END cloudfunctions_v2alpha_generated_FunctionService_UpdateFunction_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-functions/v2alpha/samples/generated/v2alpha/snippet_metadata_google.cloud.functions.v2alpha.json b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/snippet_metadata_google.cloud.functions.v2alpha.json new file mode 100644 index 00000000000..2cf3cbeee32 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/snippet_metadata_google.cloud.functions.v2alpha.json @@ -0,0 +1,371 @@ +{ + "clientLibrary": { + "name": "nodejs-functions", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.functions.v2alpha", + "version": "v2alpha" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_GetFunction_async", + "title": "FunctionService getFunction Sample", + "origin": "API_DEFINITION", + "description": " Returns a function with the given name from the requested project.", + "canonical": true, + "file": "function_service.get_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v2alpha.FunctionService.GetFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2alpha.Function", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" + }, + "method": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v2alpha.FunctionService.GetFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2alpha.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_ListFunctions_async", + "title": "FunctionService listFunctions Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of functions that belong to the requested project.", + "canonical": true, + "file": "function_service.list_functions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v2alpha.FunctionService.ListFunctions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2alpha.ListFunctionsResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" + }, + "method": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v2alpha.FunctionService.ListFunctions", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2alpha.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_CreateFunction_async", + "title": "FunctionService createFunction Sample", + "origin": "API_DEFINITION", + "description": " Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return `ALREADY_EXISTS` error.", + "canonical": true, + "file": "function_service.create_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v2alpha.FunctionService.CreateFunction", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "function", + "type": ".google.cloud.functions.v2alpha.Function" + }, + { + "name": "function_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" + }, + "method": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v2alpha.FunctionService.CreateFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2alpha.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_UpdateFunction_async", + "title": "FunctionService updateFunction Sample", + "origin": "API_DEFINITION", + "description": " Updates existing function.", + "canonical": true, + "file": "function_service.update_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v2alpha.FunctionService.UpdateFunction", + "async": true, + "parameters": [ + { + "name": "function", + "type": ".google.cloud.functions.v2alpha.Function" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" + }, + "method": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v2alpha.FunctionService.UpdateFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2alpha.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_DeleteFunction_async", + "title": "FunctionService deleteFunction Sample", + "origin": "API_DEFINITION", + "description": " Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.", + "canonical": true, + "file": "function_service.delete_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v2alpha.FunctionService.DeleteFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" + }, + "method": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v2alpha.FunctionService.DeleteFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2alpha.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_GenerateUploadUrl_async", + "title": "FunctionService generateUploadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type: application/zip` And this header SHOULD NOT be specified: * `Authorization: Bearer YOUR_TOKEN`", + "canonical": true, + "file": "function_service.generate_upload_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v2alpha.FunctionService.GenerateUploadUrl", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "kms_key_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2alpha.GenerateUploadUrlResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" + }, + "method": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v2alpha.FunctionService.GenerateUploadUrl", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2alpha.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_GenerateDownloadUrl_async", + "title": "FunctionService generateDownloadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls", + "canonical": true, + "file": "function_service.generate_download_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v2alpha.FunctionService.GenerateDownloadUrl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2alpha.GenerateDownloadUrlResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" + }, + "method": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v2alpha.FunctionService.GenerateDownloadUrl", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2alpha.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_ListRuntimes_async", + "title": "FunctionService listRuntimes Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of runtimes that are supported for the requested project.", + "canonical": true, + "file": "function_service.list_runtimes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRuntimes", + "fullName": "google.cloud.functions.v2alpha.FunctionService.ListRuntimes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2alpha.ListRuntimesResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" + }, + "method": { + "shortName": "ListRuntimes", + "fullName": "google.cloud.functions.v2alpha.FunctionService.ListRuntimes", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2alpha.FunctionService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/src/index.ts b/owl-bot-staging/google-cloud-functions/v2alpha/src/index.ts new file mode 100644 index 00000000000..0d4a89e06b1 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/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 v2alpha from './v2alpha'; +const FunctionServiceClient = v2alpha.FunctionServiceClient; +type FunctionServiceClient = v2alpha.FunctionServiceClient; +export {v2alpha, FunctionServiceClient}; +export default {v2alpha, FunctionServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_client.ts b/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_client.ts new file mode 100644 index 00000000000..1b23e790c16 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_client.ts @@ -0,0 +1,2197 @@ +// 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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2alpha/function_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './function_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Google Cloud Functions is used to deploy functions that are executed by + * Google in response to various events. Data connected with that event is + * passed to a function as the input data. + * + * A **function** is a resource which describes a function that should be + * executed and how it is triggered. + * @class + * @memberof v2alpha + */ +export class FunctionServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + functionServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of FunctionServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 FunctionServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof FunctionServiceClient; + 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; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + 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 = { + buildPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/builds/{build}' + ), + channelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/channels/{channel}' + ), + connectorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/connectors/{connector}' + ), + cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' + ), + functionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/functions/{function}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + repositoryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + topicPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/topics/{topic}' + ), + triggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/triggers/{trigger}' + ), + workerPoolPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workerPools/{worker_pool}' + ), + }; + + // 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 = { + listFunctions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'functions') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2alpha/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v2alpha/{resource=projects/*/locations/*/functions/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v2alpha/{resource=projects/*/locations/*/functions/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v2alpha/{resource=projects/*/locations/*/functions/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v2alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v2alpha/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v2alpha.Function') as gax.protobuf.Type; + const createFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2alpha.OperationMetadata') as gax.protobuf.Type; + const updateFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v2alpha.Function') as gax.protobuf.Type; + const updateFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2alpha.OperationMetadata') as gax.protobuf.Type; + const deleteFunctionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2alpha.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFunctionResponse.decode.bind(createFunctionResponse), + createFunctionMetadata.decode.bind(createFunctionMetadata)), + updateFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFunctionResponse.decode.bind(updateFunctionResponse), + updateFunctionMetadata.decode.bind(updateFunctionMetadata)), + deleteFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFunctionResponse.decode.bind(deleteFunctionResponse), + deleteFunctionMetadata.decode.bind(deleteFunctionMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.functions.v2alpha.FunctionService', 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.functionServiceStub) { + return this.functionServiceStub; + } + + // Put together the "service stub" for + // google.cloud.functions.v2alpha.FunctionService. + this.functionServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.functions.v2alpha.FunctionService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.functions.v2alpha.FunctionService, + 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 functionServiceStubMethods = + ['getFunction', 'listFunctions', 'createFunction', 'updateFunction', 'deleteFunction', 'generateUploadUrl', 'generateDownloadUrl', 'listRuntimes']; + for (const methodName of functionServiceStubMethods) { + const callPromise = this.functionServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.functionServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudfunctions.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 'cloudfunctions.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 -- + // ------------------- +/** + * Returns a function with the given name from the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which details should be obtained. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2alpha.Function|Function}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.get_function.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_GetFunction_async + */ + getFunction( + request?: protos.google.cloud.functions.v2alpha.IGetFunctionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IGetFunctionRequest|undefined, {}|undefined + ]>; + getFunction( + request: protos.google.cloud.functions.v2alpha.IGetFunctionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IGetFunctionRequest|null|undefined, + {}|null|undefined>): void; + getFunction( + request: protos.google.cloud.functions.v2alpha.IGetFunctionRequest, + callback: Callback< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IGetFunctionRequest|null|undefined, + {}|null|undefined>): void; + getFunction( + request?: protos.google.cloud.functions.v2alpha.IGetFunctionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IGetFunctionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IGetFunctionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IGetFunctionRequest|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.getFunction(request, options, callback); + } +/** + * Returns a signed URL for uploading a function source code. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls. + * Once the function source code upload is complete, the used signed + * URL should be provided in CreateFunction or UpdateFunction request + * as a reference to the function source code. + * + * When uploading source code to the generated signed URL, please follow + * these restrictions: + * + * * Source file type should be a zip file. + * * No credentials should be attached - the signed URLs provide access to the + * target bucket using internal service identity; if credentials were + * attached, the identity from the credentials would be used, but that + * identity does not have permissions to upload files to the URL. + * + * When making a HTTP PUT request, these two headers need to be specified: + * + * * `content-type: application/zip` + * + * And this header SHOULD NOT be specified: + * + * * `Authorization: Bearer YOUR_TOKEN` + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location in which the Google Cloud Storage signed + * URL should be generated, specified in the format `projects/* /locations/*`. + * @param {string} request.kmsKeyName + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2alpha.GenerateUploadUrlResponse|GenerateUploadUrlResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.generate_upload_url.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_GenerateUploadUrl_async + */ + generateUploadUrl( + request?: protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest|undefined, {}|undefined + ]>; + generateUploadUrl( + request: protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateUploadUrl( + request: protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateUploadUrl( + request?: protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest|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.generateUploadUrl(request, options, callback); + } +/** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and should be used within + * 30 minutes of generation. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of function for which source code Google Cloud Storage + * signed URL should be generated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2alpha.GenerateDownloadUrlResponse|GenerateDownloadUrlResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.generate_download_url.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_GenerateDownloadUrl_async + */ + generateDownloadUrl( + request?: protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest|undefined, {}|undefined + ]>; + generateDownloadUrl( + request: protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateDownloadUrl( + request: protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateDownloadUrl( + request?: protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest|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.generateDownloadUrl(request, options, callback); + } +/** + * Returns a list of runtimes that are supported for the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the runtimes should be + * listed, specified in the format `projects/* /locations/*` + * @param {string} request.filter + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2alpha.ListRuntimesResponse|ListRuntimesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.list_runtimes.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_ListRuntimes_async + */ + listRuntimes( + request?: protos.google.cloud.functions.v2alpha.IListRuntimesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v2alpha.IListRuntimesResponse, + protos.google.cloud.functions.v2alpha.IListRuntimesRequest|undefined, {}|undefined + ]>; + listRuntimes( + request: protos.google.cloud.functions.v2alpha.IListRuntimesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2alpha.IListRuntimesResponse, + protos.google.cloud.functions.v2alpha.IListRuntimesRequest|null|undefined, + {}|null|undefined>): void; + listRuntimes( + request: protos.google.cloud.functions.v2alpha.IListRuntimesRequest, + callback: Callback< + protos.google.cloud.functions.v2alpha.IListRuntimesResponse, + protos.google.cloud.functions.v2alpha.IListRuntimesRequest|null|undefined, + {}|null|undefined>): void; + listRuntimes( + request?: protos.google.cloud.functions.v2alpha.IListRuntimesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.functions.v2alpha.IListRuntimesResponse, + protos.google.cloud.functions.v2alpha.IListRuntimesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v2alpha.IListRuntimesResponse, + protos.google.cloud.functions.v2alpha.IListRuntimesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v2alpha.IListRuntimesResponse, + protos.google.cloud.functions.v2alpha.IListRuntimesRequest|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.listRuntimes(request, options, callback); + } + +/** + * Creates a new function. If a function with the given name already exists in + * the specified project, the long running operation will return + * `ALREADY_EXISTS` error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location in which the function should be created, + * specified in the format `projects/* /locations/*` + * @param {google.cloud.functions.v2alpha.Function} request.function + * Required. Function to be created. + * @param {string} request.functionId + * The ID to use for the function, which will become the final component of + * the function's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link protos.0-9|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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.create_function.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_CreateFunction_async + */ + createFunction( + request?: protos.google.cloud.functions.v2alpha.ICreateFunctionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createFunction( + request: protos.google.cloud.functions.v2alpha.ICreateFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFunction( + request: protos.google.cloud.functions.v2alpha.ICreateFunctionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFunction( + request?: protos.google.cloud.functions.v2alpha.ICreateFunctionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFunction(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createFunction()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.create_function.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_CreateFunction_async + */ + async checkCreateFunctionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFunction, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates existing function. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.functions.v2alpha.Function} request.function + * Required. New version of the function. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request will be + * updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.update_function.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_UpdateFunction_async + */ + updateFunction( + request?: protos.google.cloud.functions.v2alpha.IUpdateFunctionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateFunction( + request: protos.google.cloud.functions.v2alpha.IUpdateFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFunction( + request: protos.google.cloud.functions.v2alpha.IUpdateFunctionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFunction( + request?: protos.google.cloud.functions.v2alpha.IUpdateFunctionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'function.name': request.function!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFunction(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateFunction()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.update_function.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_UpdateFunction_async + */ + async checkUpdateFunctionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFunction, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger will be updated to + * remove this function. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which should be deleted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.delete_function.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_DeleteFunction_async + */ + deleteFunction( + request?: protos.google.cloud.functions.v2alpha.IDeleteFunctionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteFunction( + request: protos.google.cloud.functions.v2alpha.IDeleteFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFunction( + request: protos.google.cloud.functions.v2alpha.IDeleteFunctionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFunction( + request?: protos.google.cloud.functions.v2alpha.IDeleteFunctionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteFunction(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteFunction()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.delete_function.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_DeleteFunction_async + */ + async checkDeleteFunctionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFunction, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Returns a list of functions that belong to the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the function should be + * listed, specified in the format `projects/* /locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2alpha.Function|Function}. + * 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 `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFunctions( + request?: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v2alpha.IFunction[], + protos.google.cloud.functions.v2alpha.IListFunctionsRequest|null, + protos.google.cloud.functions.v2alpha.IListFunctionsResponse + ]>; + listFunctions( + request: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + protos.google.cloud.functions.v2alpha.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v2alpha.IFunction>): void; + listFunctions( + request: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + callback: PaginationCallback< + protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + protos.google.cloud.functions.v2alpha.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v2alpha.IFunction>): void; + listFunctions( + request?: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + protos.google.cloud.functions.v2alpha.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v2alpha.IFunction>, + callback?: PaginationCallback< + protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + protos.google.cloud.functions.v2alpha.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v2alpha.IFunction>): + Promise<[ + protos.google.cloud.functions.v2alpha.IFunction[], + protos.google.cloud.functions.v2alpha.IListFunctionsRequest|null, + protos.google.cloud.functions.v2alpha.IListFunctionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listFunctions(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the function should be + * listed, specified in the format `projects/* /locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @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 protos.google.cloud.functions.v2alpha.Function|Function} 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 `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFunctionsStream( + request?: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + 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['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.createStream( + this.innerApiCalls.listFunctions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFunctions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the function should be + * listed, specified in the format `projects/* /locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.functions.v2alpha.Function|Function}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.list_functions.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_ListFunctions_async + */ + listFunctionsAsync( + request?: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + 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['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.asyncIterate( + this.innerApiCalls['listFunctions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified build resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} build + * @returns {string} Resource name string. + */ + buildPath(project:string,location:string,build:string) { + return this.pathTemplates.buildPathTemplate.render({ + project: project, + location: location, + build: build, + }); + } + + /** + * Parse the project from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).project; + } + + /** + * Parse the location from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).location; + } + + /** + * Parse the build from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the build. + */ + matchBuildFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).build; + } + + /** + * Return a fully-qualified channel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} channel + * @returns {string} Resource name string. + */ + channelPath(project:string,location:string,channel:string) { + return this.pathTemplates.channelPathTemplate.render({ + project: project, + location: location, + channel: channel, + }); + } + + /** + * Parse the project from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).project; + } + + /** + * Parse the location from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the location. + */ + matchLocationFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).location; + } + + /** + * Parse the channel from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the channel. + */ + matchChannelFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).channel; + } + + /** + * Return a fully-qualified connector resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} connector + * @returns {string} Resource name string. + */ + connectorPath(project:string,location:string,connector:string) { + return this.pathTemplates.connectorPathTemplate.render({ + project: project, + location: location, + connector: connector, + }); + } + + /** + * Parse the project from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName).project; + } + + /** + * Parse the location from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName).location; + } + + /** + * Parse the connector from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the connector. + */ + matchConnectorFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName).connector; + } + + /** + * Return a fully-qualified cryptoKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @returns {string} Resource name string. + */ + cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { + return this.pathTemplates.cryptoKeyPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + }); + } + + /** + * Parse the project from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; + } + + /** + * Parse the location from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; + } + + /** + * Parse the key_ring from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; + } + + /** + * Parse the crypto_key from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; + } + + /** + * Return a fully-qualified function resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} functionParam + * @returns {string} Resource name string. + */ + functionPath(project:string,location:string,functionParam:string) { + return this.pathTemplates.functionPathTemplate.render({ + project: project, + location: location, + function: functionParam, + }); + } + + /** + * Parse the project from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).project; + } + + /** + * Parse the location from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).location; + } + + /** + * Parse the function from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the function. + */ + matchFunctionFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).function; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified 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 repository resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @returns {string} Resource name string. + */ + repositoryPath(project:string,location:string,repository:string) { + return this.pathTemplates.repositoryPathTemplate.render({ + project: project, + location: location, + repository: repository, + }); + } + + /** + * Parse the project from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).project; + } + + /** + * Parse the location from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).location; + } + + /** + * Parse the repository from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).repository; + } + + /** + * Return a fully-qualified service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * Return a fully-qualified topic resource name string. + * + * @param {string} project + * @param {string} topic + * @returns {string} Resource name string. + */ + topicPath(project:string,topic:string) { + return this.pathTemplates.topicPathTemplate.render({ + project: project, + topic: topic, + }); + } + + /** + * Parse the project from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).project; + } + + /** + * Parse the topic from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the topic. + */ + matchTopicFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).topic; + } + + /** + * Return a fully-qualified trigger resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} trigger + * @returns {string} Resource name string. + */ + triggerPath(project:string,location:string,trigger:string) { + return this.pathTemplates.triggerPathTemplate.render({ + project: project, + location: location, + trigger: trigger, + }); + } + + /** + * Parse the project from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).project; + } + + /** + * Parse the location from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).location; + } + + /** + * Parse the trigger from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the trigger. + */ + matchTriggerFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).trigger; + } + + /** + * Return a fully-qualified workerPool resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} worker_pool + * @returns {string} Resource name string. + */ + workerPoolPath(project:string,location:string,workerPool:string) { + return this.pathTemplates.workerPoolPathTemplate.render({ + project: project, + location: location, + worker_pool: workerPool, + }); + } + + /** + * Parse the project from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).project; + } + + /** + * Parse the location from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).location; + } + + /** + * Parse the worker_pool from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the worker_pool. + */ + matchWorkerPoolFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).worker_pool; + } + + /** + * 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.functionServiceStub && !this._terminated) { + return this.functionServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_client_config.json b/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_client_config.json new file mode 100644 index 00000000000..2ca6513ccba --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_client_config.json @@ -0,0 +1,58 @@ +{ + "interfaces": { + "google.cloud.functions.v2alpha.FunctionService": { + "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": { + "GetFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListFunctions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateUploadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateDownloadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListRuntimes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_proto_list.json b/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_proto_list.json new file mode 100644 index 00000000000..78acb336bb6 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/functions/v2alpha/functions.proto" +] diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/gapic_metadata.json b/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/gapic_metadata.json new file mode 100644 index 00000000000..eaf1f6d3475 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/gapic_metadata.json @@ -0,0 +1,107 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.functions.v2alpha", + "libraryPackage": "@google-cloud/functions", + "services": { + "FunctionService": { + "clients": { + "grpc": { + "libraryClient": "FunctionServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "ListRuntimes": { + "methods": [ + "listRuntimes" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "FunctionServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "ListRuntimes": { + "methods": [ + "listRuntimes" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/index.ts b/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/index.ts new file mode 100644 index 00000000000..ec33a786b85 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/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 {FunctionServiceClient} from './function_service_client'; diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-functions/v2alpha/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..c41f33eb2a8 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/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 functions = require('@google-cloud/functions'); + +function main() { + const functionServiceClient = new functions.FunctionServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-functions/v2alpha/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..530ace3134e --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/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 {FunctionServiceClient} from '@google-cloud/functions'; + +// check that the client class type name can be used +function doStuffWithFunctionServiceClient(client: FunctionServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const functionServiceClient = new FunctionServiceClient(); + doStuffWithFunctionServiceClient(functionServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/system-test/install.ts b/owl-bot-staging/google-cloud-functions/v2alpha/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/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-functions/v2alpha/test/gapic_function_service_v2alpha.ts b/owl-bot-staging/google-cloud-functions/v2alpha/test/gapic_function_service_v2alpha.ts new file mode 100644 index 00000000000..ae797ac80fe --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/test/gapic_function_service_v2alpha.ts @@ -0,0 +1,2584 @@ +// 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 functionserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2alpha.FunctionServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = functionserviceModule.v2alpha.FunctionServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = functionserviceModule.v2alpha.FunctionServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = functionserviceModule.v2alpha.FunctionServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + await client.initialize(); + assert(client.functionServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.functionServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + 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('getFunction', () => { + it('invokes getFunction without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GetFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.GetFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.Function() + ); + client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); + const [response] = await client.getFunction(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFunction without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GetFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.GetFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.Function() + ); + client.innerApiCalls.getFunction = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFunction( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v2alpha.IFunction|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFunction with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GetFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.GetFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFunction = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFunction(request), expectedError); + const actualRequest = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFunction with closed client', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GetFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.GetFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFunction(request), expectedError); + }); + }); + + describe('generateUploadUrl', () => { + it('invokes generateUploadUrl without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateUploadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.GenerateUploadUrlRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); + const [response] = await client.generateUploadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateUploadUrl without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateUploadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.GenerateUploadUrlRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateUploadUrl( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateUploadUrl with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateUploadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.GenerateUploadUrlRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateUploadUrl = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateUploadUrl(request), expectedError); + const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateUploadUrl with closed client', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateUploadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.GenerateUploadUrlRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateUploadUrl(request), expectedError); + }); + }); + + describe('generateDownloadUrl', () => { + it('invokes generateDownloadUrl without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = stubSimpleCall(expectedResponse); + const [response] = await client.generateDownloadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateDownloadUrl without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateDownloadUrl( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateDownloadUrl with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateDownloadUrl = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateDownloadUrl with closed client', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + }); + }); + + describe('listRuntimes', () => { + it('invokes listRuntimes without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListRuntimesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.ListRuntimesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListRuntimesResponse() + ); + client.innerApiCalls.listRuntimes = stubSimpleCall(expectedResponse); + const [response] = await client.listRuntimes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimes without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListRuntimesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.ListRuntimesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListRuntimesResponse() + ); + client.innerApiCalls.listRuntimes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRuntimes( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v2alpha.IListRuntimesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimes with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListRuntimesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.ListRuntimesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRuntimes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listRuntimes(request), expectedError); + const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimes with closed client', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListRuntimesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.ListRuntimesRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listRuntimes(request), expectedError); + }); + }); + + describe('createFunction', () => { + it('invokes createFunction without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.CreateFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.CreateFunctionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = stubLongRunningCall(expectedResponse); + const [operation] = await client.createFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFunction without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.CreateFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.CreateFunctionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFunction( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFunction with call error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.CreateFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.CreateFunctionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createFunction(request), expectedError); + const actualRequest = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFunction with LRO error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.CreateFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.CreateFunctionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createFunction(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateFunctionProgress without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateFunctionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFunctionProgress with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateFunctionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateFunction', () => { + it('invokes updateFunction without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.UpdateFunctionRequest() + ); + request.function ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.UpdateFunctionRequest', ['function', 'name']); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFunction without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.UpdateFunctionRequest() + ); + request.function ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.UpdateFunctionRequest', ['function', 'name']); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFunction( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFunction with call error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.UpdateFunctionRequest() + ); + request.function ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.UpdateFunctionRequest', ['function', 'name']); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateFunction(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFunction with LRO error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.UpdateFunctionRequest() + ); + request.function ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.UpdateFunctionRequest', ['function', 'name']); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateFunction(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateFunctionProgress without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateFunctionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFunctionProgress with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateFunctionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteFunction', () => { + it('invokes deleteFunction without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.DeleteFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.DeleteFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFunction without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.DeleteFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.DeleteFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFunction( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFunction with call error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.DeleteFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.DeleteFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteFunction(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFunction with LRO error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.DeleteFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.DeleteFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteFunction(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteFunctionProgress without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteFunctionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFunctionProgress with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteFunctionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listFunctions', () => { + it('invokes listFunctions without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), + ]; + client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); + const [response] = await client.listFunctions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFunctions without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), + ]; + client.innerApiCalls.listFunctions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFunctions( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v2alpha.IFunction[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFunctions with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFunctions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFunctions(request), expectedError); + const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFunctionsStream without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), + ]; + client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v2alpha.Function[] = []; + stream.on('data', (response: protos.google.cloud.functions.v2alpha.Function) => { + 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.listFunctions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFunctionsStream with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v2alpha.Function[] = []; + stream.on('data', (response: protos.google.cloud.functions.v2alpha.Function) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFunctions without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), + ]; + client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.functions.v2alpha.IFunction[] = []; + const iterable = client.listFunctionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFunctions with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2alpha.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFunctionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.functions.v2alpha.IFunction[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('build', () => { + const fakePath = "/rendered/path/build"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + build: "buildValue", + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.buildPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.buildPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('buildPath', () => { + const result = client.buildPath("projectValue", "locationValue", "buildValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.buildPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBuildName', () => { + const result = client.matchProjectFromBuildName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBuildName', () => { + const result = client.matchLocationFromBuildName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBuildFromBuildName', () => { + const result = client.matchBuildFromBuildName(fakePath); + assert.strictEqual(result, "buildValue"); + assert((client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('channel', () => { + const fakePath = "/rendered/path/channel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + channel: "channelValue", + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.channelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.channelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('channelPath', () => { + const result = client.channelPath("projectValue", "locationValue", "channelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.channelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromChannelName', () => { + const result = client.matchProjectFromChannelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromChannelName', () => { + const result = client.matchLocationFromChannelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchChannelFromChannelName', () => { + const result = client.matchChannelFromChannelName(fakePath); + assert.strictEqual(result, "channelValue"); + assert((client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('connector', () => { + const fakePath = "/rendered/path/connector"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + connector: "connectorValue", + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.connectorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.connectorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('connectorPath', () => { + const result = client.connectorPath("projectValue", "locationValue", "connectorValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.connectorPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConnectorName', () => { + const result = client.matchProjectFromConnectorName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConnectorName', () => { + const result = client.matchLocationFromConnectorName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConnectorFromConnectorName', () => { + const result = client.matchConnectorFromConnectorName(fakePath); + assert.strictEqual(result, "connectorValue"); + assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('cryptoKey', () => { + const fakePath = "/rendered/path/cryptoKey"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.cryptoKeyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('cryptoKeyPath', () => { + const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCryptoKeyName', () => { + const result = client.matchProjectFromCryptoKeyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCryptoKeyName', () => { + const result = client.matchLocationFromCryptoKeyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromCryptoKeyName', () => { + const result = client.matchKeyRingFromCryptoKeyName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromCryptoKeyName', () => { + const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('function', () => { + const fakePath = "/rendered/path/function"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + function: "functionValue", + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.functionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.functionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('functionPath', () => { + const result = client.functionPath("projectValue", "locationValue", "functionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.functionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFunctionName', () => { + const result = client.matchProjectFromFunctionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFunctionName', () => { + const result = client.matchLocationFromFunctionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFunctionFromFunctionName', () => { + const result = client.matchFunctionFromFunctionName(fakePath); + assert.strictEqual(result, "functionValue"); + assert((client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + 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('repository', () => { + const fakePath = "/rendered/path/repository"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.repositoryPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.repositoryPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('repositoryPath', () => { + const result = client.repositoryPath("projectValue", "locationValue", "repositoryValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.repositoryPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromRepositoryName', () => { + const result = client.matchProjectFromRepositoryName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromRepositoryName', () => { + const result = client.matchLocationFromRepositoryName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromRepositoryName', () => { + const result = client.matchRepositoryFromRepositoryName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath("projectValue", "locationValue", "serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('topic', () => { + const fakePath = "/rendered/path/topic"; + const expectedParameters = { + project: "projectValue", + topic: "topicValue", + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.topicPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.topicPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('topicPath', () => { + const result = client.topicPath("projectValue", "topicValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.topicPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTopicName', () => { + const result = client.matchProjectFromTopicName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.topicPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTopicFromTopicName', () => { + const result = client.matchTopicFromTopicName(fakePath); + assert.strictEqual(result, "topicValue"); + assert((client.pathTemplates.topicPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('trigger', () => { + const fakePath = "/rendered/path/trigger"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + trigger: "triggerValue", + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.triggerPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.triggerPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('triggerPath', () => { + const result = client.triggerPath("projectValue", "locationValue", "triggerValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.triggerPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTriggerName', () => { + const result = client.matchProjectFromTriggerName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromTriggerName', () => { + const result = client.matchLocationFromTriggerName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTriggerFromTriggerName', () => { + const result = client.matchTriggerFromTriggerName(fakePath); + assert.strictEqual(result, "triggerValue"); + assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('workerPool', () => { + const fakePath = "/rendered/path/workerPool"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + worker_pool: "workerPoolValue", + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workerPoolPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workerPoolPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workerPoolPath', () => { + const result = client.workerPoolPath("projectValue", "locationValue", "workerPoolValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workerPoolPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkerPoolName', () => { + const result = client.matchProjectFromWorkerPoolName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkerPoolName', () => { + const result = client.matchLocationFromWorkerPoolName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkerPoolFromWorkerPoolName', () => { + const result = client.matchWorkerPoolFromWorkerPoolName(fakePath); + assert.strictEqual(result, "workerPoolValue"); + assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/tsconfig.json b/owl-bot-staging/google-cloud-functions/v2alpha/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/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-functions/v2alpha/webpack.config.js b/owl-bot-staging/google-cloud-functions/v2alpha/webpack.config.js new file mode 100644 index 00000000000..527abad554f --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2alpha/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: 'FunctionService', + filename: './function-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-functions/v2beta/.eslintignore b/owl-bot-staging/google-cloud-functions/v2beta/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-functions/v2beta/.eslintrc.json b/owl-bot-staging/google-cloud-functions/v2beta/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-functions/v2beta/.gitignore b/owl-bot-staging/google-cloud-functions/v2beta/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/.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-functions/v2beta/.jsdoc.js b/owl-bot-staging/google-cloud-functions/v2beta/.jsdoc.js new file mode 100644 index 00000000000..43186156cf8 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/.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/functions', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-functions/v2beta/.mocharc.js b/owl-bot-staging/google-cloud-functions/v2beta/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/.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-functions/v2beta/.prettierrc.js b/owl-bot-staging/google-cloud-functions/v2beta/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/.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-functions/v2beta/README.md b/owl-bot-staging/google-cloud-functions/v2beta/README.md new file mode 100644 index 00000000000..efb614cf6e7 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/README.md @@ -0,0 +1 @@ +Functions: Nodejs Client diff --git a/owl-bot-staging/google-cloud-functions/v2beta/package.json b/owl-bot-staging/google-cloud-functions/v2beta/package.json new file mode 100644 index 00000000000..a5e7b166e52 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/functions", + "version": "0.1.0", + "description": "Functions client for Node.js", + "repository": "googleapis/nodejs-functions", + "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 functions", + "functions", + "function service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-functions/v2beta/protos/google/cloud/functions/v2beta/functions.proto b/owl-bot-staging/google-cloud-functions/v2beta/protos/google/cloud/functions/v2beta/functions.proto new file mode 100644 index 00000000000..a8f89d5a4f4 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/protos/google/cloud/functions/v2beta/functions.proto @@ -0,0 +1,1147 @@ +// 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 +// +// 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.functions.v2beta; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/functions/apiv2beta/functionspb;functionspb"; +option java_multiple_files = true; +option java_outer_classname = "FunctionsProto"; +option java_package = "com.google.cloud.functions.v2beta"; +option objc_class_prefix = "GCF"; +option (google.api.resource_definition) = { + type: "artifactregistry.googleapis.com/Repository" + pattern: "projects/{project}/locations/{location}/repositories/{repository}" +}; +option (google.api.resource_definition) = { + type: "cloudbuild.googleapis.com/Build" + pattern: "projects/{project}/locations/{location}/builds/{build}" +}; +option (google.api.resource_definition) = { + type: "cloudbuild.googleapis.com/WorkerPool" + pattern: "projects/{project}/locations/{location}/workerPools/{worker_pool}" +}; +option (google.api.resource_definition) = { + type: "run.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/services/{service}" +}; +option (google.api.resource_definition) = { + type: "vpcaccess.googleapis.com/Connector" + pattern: "projects/{project}/locations/{location}/connectors/{connector}" +}; +option (google.api.resource_definition) = { + type: "eventarc.googleapis.com/Trigger" + pattern: "projects/{project}/locations/{location}/triggers/{trigger}" +}; +option (google.api.resource_definition) = { + type: "eventarc.googleapis.com/Channel" + pattern: "projects/{project}/locations/{location}/channels/{channel}" +}; +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" +}; +option (google.api.resource_definition) = { + type: "cloudkms.googleapis.com/CryptoKey" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" +}; + +// Google Cloud Functions is used to deploy functions that are executed by +// Google in response to various events. Data connected with that event is +// passed to a function as the input data. +// +// A **function** is a resource which describes a function that should be +// executed and how it is triggered. +service FunctionService { + option (google.api.default_host) = "cloudfunctions.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Returns a function with the given name from the requested project. + rpc GetFunction(GetFunctionRequest) returns (Function) { + option (google.api.http) = { + get: "/v2beta/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns a list of functions that belong to the requested project. + rpc ListFunctions(ListFunctionsRequest) returns (ListFunctionsResponse) { + option (google.api.http) = { + get: "/v2beta/{parent=projects/*/locations/*}/functions" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new function. If a function with the given name already exists in + // the specified project, the long running operation will return + // `ALREADY_EXISTS` error. + rpc CreateFunction(CreateFunctionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta/{parent=projects/*/locations/*}/functions" + body: "function" + }; + option (google.api.method_signature) = "parent,function,function_id"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.functions.v2beta.Function" + metadata_type: "google.cloud.functions.v2beta.OperationMetadata" + }; + } + + // Updates existing function. + rpc UpdateFunction(UpdateFunctionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2beta/{function.name=projects/*/locations/*/functions/*}" + body: "function" + }; + option (google.api.method_signature) = "function,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.functions.v2beta.Function" + metadata_type: "google.cloud.functions.v2beta.OperationMetadata" + }; + } + + // Deletes a function with the given name from the specified project. If the + // given function is used by some trigger, the trigger will be updated to + // remove this function. + rpc DeleteFunction(DeleteFunctionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2beta/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.functions.v2beta.OperationMetadata" + }; + } + + // Returns a signed URL for uploading a function source code. + // For more information about the signed URL usage see: + // https://cloud.google.com/storage/docs/access-control/signed-urls. + // Once the function source code upload is complete, the used signed + // URL should be provided in CreateFunction or UpdateFunction request + // as a reference to the function source code. + // + // When uploading source code to the generated signed URL, please follow + // these restrictions: + // + // * Source file type should be a zip file. + // * No credentials should be attached - the signed URLs provide access to the + // target bucket using internal service identity; if credentials were + // attached, the identity from the credentials would be used, but that + // identity does not have permissions to upload files to the URL. + // + // When making a HTTP PUT request, these two headers need to be specified: + // + // * `content-type: application/zip` + // + // And this header SHOULD NOT be specified: + // + // * `Authorization: Bearer YOUR_TOKEN` + rpc GenerateUploadUrl(GenerateUploadUrlRequest) + returns (GenerateUploadUrlResponse) { + option (google.api.http) = { + post: "/v2beta/{parent=projects/*/locations/*}/functions:generateUploadUrl" + body: "*" + }; + } + + // Returns a signed URL for downloading deployed function source code. + // The URL is only valid for a limited period and should be used within + // 30 minutes of generation. + // For more information about the signed URL usage see: + // https://cloud.google.com/storage/docs/access-control/signed-urls + rpc GenerateDownloadUrl(GenerateDownloadUrlRequest) + returns (GenerateDownloadUrlResponse) { + option (google.api.http) = { + post: "/v2beta/{name=projects/*/locations/*/functions/*}:generateDownloadUrl" + body: "*" + }; + } + + // Returns a list of runtimes that are supported for the requested project. + rpc ListRuntimes(ListRuntimesRequest) returns (ListRuntimesResponse) { + option (google.api.http) = { + get: "/v2beta/{parent=projects/*/locations/*}/runtimes" + }; + option (google.api.method_signature) = "parent"; + } +} + +// The environment the function is hosted on. +enum Environment { + // Unspecified + ENVIRONMENT_UNSPECIFIED = 0; + + // Gen 1 + GEN_1 = 1; + + // Gen 2 + GEN_2 = 2; +} + +// Describes a Cloud Function that contains user computation executed in +// response to an event. It encapsulates function and trigger configurations. +message Function { + option (google.api.resource) = { + type: "cloudfunctions.googleapis.com/Function" + pattern: "projects/{project}/locations/{location}/functions/{function}" + plural: "functions" + singular: "function" + }; + + // Describes the current state of the function. + enum State { + // Not specified. Invalid state. + STATE_UNSPECIFIED = 0; + + // Function has been successfully deployed and is serving. + ACTIVE = 1; + + // Function deployment failed and the function is not serving. + FAILED = 2; + + // Function is being created or updated. + DEPLOYING = 3; + + // Function is being deleted. + DELETING = 4; + + // Function deployment failed and the function serving state is undefined. + // The function should be updated or deleted to move it out of this state. + UNKNOWN = 5; + } + + // A user-defined name of the function. Function names must be unique + // globally and match pattern `projects/*/locations/*/functions/*` + string name = 1; + + // User-provided description of a function. + string description = 2; + + // Describes the Build step of the function that builds a container from the + // given source. + BuildConfig build_config = 3; + + // Describes the Service being deployed. Currently deploys services to Cloud + // Run (fully managed). + ServiceConfig service_config = 4; + + // An Eventarc trigger managed by Google Cloud Functions that fires events in + // response to a condition in another service. + EventTrigger event_trigger = 5; + + // Output only. State of the function. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of a Cloud Function. + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels associated with this Cloud Function. + map labels = 8; + + // Output only. State Messages for this Cloud Function. + repeated StateMessage state_messages = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Describe whether the function is 1st Gen or 2nd Gen. + Environment environment = 10; + + // Output only. The deployed url for the function. + string url = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // [Preview] Resource name of a KMS crypto key (managed by the user) used to + // encrypt/decrypt function resources. + // + // It must match the pattern + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + string kms_key_name = 25 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + }]; +} + +// Informational messages about the state of the Cloud Function or Operation. +message StateMessage { + // Severity of the state message. + enum Severity { + // Not specified. Invalid severity. + SEVERITY_UNSPECIFIED = 0; + + // ERROR-level severity. + ERROR = 1; + + // WARNING-level severity. + WARNING = 2; + + // INFO-level severity. + INFO = 3; + } + + // Severity of the state message. + Severity severity = 1; + + // One-word CamelCase type of the state message. + string type = 2; + + // The message. + string message = 3; +} + +// Location of the source in an archive file in Google Cloud Storage. +message StorageSource { + // Google Cloud Storage bucket containing the source (see + // [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + string bucket = 1; + + // Google Cloud Storage object containing the source. + // + // This object must be a gzipped archive file (`.tar.gz`) containing source to + // build. + string object = 2; + + // Google Cloud Storage generation for the object. If the generation is + // omitted, the latest generation will be used. + int64 generation = 3; +} + +// Location of the source in a Google Cloud Source Repository. +message RepoSource { + // A revision within the Cloud Source Repository must be specified in + // one of these ways. + oneof revision { + // Regex matching branches to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string branch_name = 3; + + // Regex matching tags to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string tag_name = 4; + + // Explicit commit SHA to build. + string commit_sha = 5; + } + + // ID of the project that owns the Cloud Source Repository. If omitted, the + // project ID requesting the build is assumed. + string project_id = 1; + + // Name of the Cloud Source Repository. + string repo_name = 2; + + // Directory, relative to the source root, in which to run the build. + // + // This must be a relative path. If a step's `dir` is specified and is an + // absolute path, this value is ignored for that step's execution. + // eg. helloworld (no leading slash allowed) + string dir = 6; + + // Only trigger a build if the revision regex does NOT match the revision + // regex. + bool invert_regex = 7; +} + +// The location of the function source code. +message Source { + // Location of the source. + // At least one source needs to be provided for the deployment to succeed. + oneof source { + // If provided, get the source from this location in Google Cloud Storage. + StorageSource storage_source = 1; + + // If provided, get the source from this location in a Cloud Source + // Repository. + RepoSource repo_source = 2; + } +} + +// Provenance of the source. Ways to find the original source, or verify that +// some source was used for this build. +message SourceProvenance { + // A copy of the build's `source.storage_source`, if exists, with any + // generations resolved. + StorageSource resolved_storage_source = 1; + + // A copy of the build's `source.repo_source`, if exists, with any + // revisions resolved. + RepoSource resolved_repo_source = 2; +} + +// Describes the Build step of the function that builds a container from the +// given source. +message BuildConfig { + // Docker Registry to use for storing function Docker images. + enum DockerRegistry { + // Unspecified. + DOCKER_REGISTRY_UNSPECIFIED = 0; + + // Docker images will be stored in multi-regional Container Registry + // repositories named `gcf`. + CONTAINER_REGISTRY = 1; + + // Docker images will be stored in regional Artifact Registry repositories. + // By default, GCF will create and use repositories named `gcf-artifacts` + // in every region in which a function is deployed. But the repository to + // use can also be specified by the user using the `docker_repository` + // field. + ARTIFACT_REGISTRY = 2; + } + + // Output only. The Cloud Build name of the latest successful deployment of + // the function. + string build = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Build" + } + ]; + + // The runtime in which to run the function. Required when deploying a new + // function, optional when updating an existing function. For a complete + // list of possible choices, see the + // [`gcloud` command + // reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + string runtime = 2; + + // The name of the function (as defined in source code) that will be + // executed. Defaults to the resource name suffix, if not specified. For + // backward compatibility, if function with given name is not found, then the + // system will try to use function named "function". + // For Node.js this is name of a function exported by the module specified + // in `source_location`. + string entry_point = 3; + + // The location of the function source code. + Source source = 4; + + // Output only. A permanent fixed identifier for source. + SourceProvenance source_provenance = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Name of the Cloud Build Custom Worker Pool that should be used to build the + // function. The format of this field is + // `projects/{project}/locations/{region}/workerPools/{workerPool}` where + // {project} and {region} are the project id and region respectively where the + // worker pool is defined and {workerPool} is the short name of the worker + // pool. + // + // If the project id is not the same as the function, then the Cloud + // Functions Service Agent + // (service-@gcf-admin-robot.iam.gserviceaccount.com) must be + // granted the role Cloud Build Custom Workers Builder + // (roles/cloudbuild.customworkers.builder) in the project. + string worker_pool = 5 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + + // User-provided build-time environment variables for the function + map environment_variables = 6; + + // Docker Registry to use for this deployment. This configuration is only + // applicable to 1st Gen functions, 2nd Gen functions can only use Artifact + // Registry. + // + // If `docker_repository` field is specified, this field will be automatically + // set as `ARTIFACT_REGISTRY`. + // If unspecified, it currently defaults to `CONTAINER_REGISTRY`. + // This field may be overridden by the backend for eligible deployments. + DockerRegistry docker_registry = 10; + + // User managed repository created in Artifact Registry optionally + // with a customer managed encryption key. This is the repository to which the + // function docker image will be pushed after it is built by Cloud Build. + // If unspecified, GCF will create and use a repository named 'gcf-artifacts' + // for every deployed region. + // + // It must match the pattern + // `projects/{project}/locations/{location}/repositories/{repository}`. + // + // Cross-project repositories are not supported. + // Cross-location repositories are not supported. + // Repository format must be 'DOCKER'. + string docker_repository = 7 [(google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/Repository" + }]; +} + +// Describes the Service being deployed. +// Currently Supported : Cloud Run (fully managed). +message ServiceConfig { + // Available egress settings. + // + // This controls what traffic is diverted through the VPC Access Connector + // resource. By default PRIVATE_RANGES_ONLY will be used. + enum VpcConnectorEgressSettings { + // Unspecified. + VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; + + // Use the VPC Access Connector only for private IP space from RFC1918. + PRIVATE_RANGES_ONLY = 1; + + // Force the use of VPC Access Connector for all egress traffic from the + // function. + ALL_TRAFFIC = 2; + } + + // Available ingress settings. + // + // This controls what traffic can reach the function. + // + // If unspecified, ALLOW_ALL will be used. + enum IngressSettings { + // Unspecified. + INGRESS_SETTINGS_UNSPECIFIED = 0; + + // Allow HTTP traffic from public and private sources. + ALLOW_ALL = 1; + + // Allow HTTP traffic from only private VPC sources. + ALLOW_INTERNAL_ONLY = 2; + + // Allow HTTP traffic from private VPC sources and through GCLB. + ALLOW_INTERNAL_AND_GCLB = 3; + } + + // Available security level settings. + // + // This enforces security protocol on function URL. + // + // Security level is only configurable for 1st Gen functions, If unspecified, + // SECURE_OPTIONAL will be used. 2nd Gen functions are SECURE_ALWAYS ONLY. + enum SecurityLevel { + // Unspecified. + SECURITY_LEVEL_UNSPECIFIED = 0; + + // Requests for a URL that match this handler that do not use HTTPS are + // automatically redirected to the HTTPS URL with the same path. Query + // parameters are reserved for the redirect. + SECURE_ALWAYS = 1; + + // Both HTTP and HTTPS requests with URLs that match the handler succeed + // without redirects. The application can examine the request to determine + // which protocol was used and respond accordingly. + SECURE_OPTIONAL = 2; + } + + // Output only. Name of the service associated with a Function. + // The format of this field is + // `projects/{project}/locations/{region}/services/{service}` + string service = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { type: "run.googleapis.com/Service" } + ]; + + // The function execution timeout. Execution is considered failed and + // can be terminated if the function is not completed at the end of the + // timeout period. Defaults to 60 seconds. + int32 timeout_seconds = 2; + + // The amount of memory available for a function. + // Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is + // supplied the value is interpreted as bytes. + // See + // https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go + // a full description. + string available_memory = 13; + + // [Preview] The number of CPUs used in a single container instance. + // Default value is calculated from available memory. + // Supports the same values as Cloud Run, see + // https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements + // Example: "1" indicates 1 vCPU + string available_cpu = 22; + + // Environment variables that shall be available during function execution. + map environment_variables = 4; + + // The limit on the maximum number of function instances that may coexist at a + // given time. + // + // In some cases, such as rapid traffic surges, Cloud Functions may, for a + // short period of time, create more instances than the specified max + // instances limit. If your function cannot tolerate this temporary behavior, + // you may want to factor in a safety margin and set a lower max instances + // value than your function can tolerate. + // + // See the [Max + // Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + // more details. + int32 max_instance_count = 5; + + // The limit on the minimum number of function instances that may coexist at a + // given time. + // + // Function instances are kept in idle state for a short period after they + // finished executing the request to reduce cold start time for subsequent + // requests. Setting a minimum instance count will ensure that the given + // number of instances are kept running in idle state always. This can help + // with cold start times when jump in incoming request count occurs after the + // idle instance would have been stopped in the default case. + int32 min_instance_count = 12; + + // The Serverless VPC Access connector that this cloud function can connect + // to. The format of this field is `projects/*/locations/*/connectors/*`. + string vpc_connector = 6 [(google.api.resource_reference) = { + type: "vpcaccess.googleapis.com/Connector" + }]; + + // The egress settings for the connector, controlling what traffic is diverted + // through it. + VpcConnectorEgressSettings vpc_connector_egress_settings = 7; + + // The ingress settings for the function, controlling what traffic can reach + // it. + IngressSettings ingress_settings = 8; + + // Output only. URI of the Service deployed. + string uri = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The email of the service's service account. If empty, defaults to + // `{project_number}-compute@developer.gserviceaccount.com`. + string service_account_email = 10; + + // Whether 100% of traffic is routed to the latest revision. + // On CreateFunction and UpdateFunction, when set to true, the revision being + // deployed will serve 100% of traffic, ignoring any traffic split settings, + // if any. On GetFunction, true will be returned if the latest revision is + // serving 100% of traffic. + bool all_traffic_on_latest_revision = 16; + + // Secret environment variables configuration. + repeated SecretEnvVar secret_environment_variables = 17; + + // Secret volumes configuration. + repeated SecretVolume secret_volumes = 19; + + // Output only. The name of service revision. + string revision = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // [Preview] Sets the maximum number of concurrent requests that each instance + // can receive. Defaults to 1. + int32 max_instance_request_concurrency = 20; + + // Security level configure whether the function only accepts https. + // This configuration is only applicable to 1st Gen functions with Http + // trigger. By default https is optional for 1st Gen functions; 2nd Gen + // functions are https ONLY. + SecurityLevel security_level = 21; +} + +// Configuration for a secret environment variable. It has the information +// necessary to fetch the secret value from secret manager and expose it as an +// environment variable. +message SecretEnvVar { + // Name of the environment variable. + string key = 1; + + // Project identifier (preferably project number but can also be the + // project ID) of the project that contains the secret. If not set, it is + // assumed that the secret is in the same project as the function. + string project_id = 2; + + // Name of the secret in secret manager (not the full resource name). + string secret = 3; + + // Version of the secret (version number or the string 'latest'). It is + // recommended to use a numeric version for secret environment variables as + // any updates to the secret value is not reflected until new instances + // start. + string version = 4; +} + +// Configuration for a secret volume. It has the information necessary to fetch +// the secret value from secret manager and make it available as files mounted +// at the requested paths within the application container. +message SecretVolume { + // Configuration for a single version. + message SecretVersion { + // Version of the secret (version number or the string 'latest'). It is + // preferable to use `latest` version with secret volumes as secret value + // changes are reflected immediately. + string version = 1; + + // Relative path of the file under the mount path where the secret value for + // this version will be fetched and made available. For example, setting the + // mount_path as '/etc/secrets' and path as `secret_foo` would mount the + // secret value file at `/etc/secrets/secret_foo`. + string path = 2; + } + + // The path within the container to mount the secret volume. For example, + // setting the mount_path as `/etc/secrets` would mount the secret value files + // under the `/etc/secrets` directory. This directory will also be completely + // shadowed and unavailable to mount any other secrets. + // Recommended mount path: /etc/secrets + string mount_path = 1; + + // Project identifier (preferably project number but can also be the project + // ID) of the project that contains the secret. If not set, it is + // assumed that the secret is in the same project as the function. + string project_id = 2; + + // Name of the secret in secret manager (not the full resource name). + string secret = 3; + + // List of secret versions to mount for this secret. If empty, the `latest` + // version of the secret will be made available in a file named after the + // secret under the mount point. + repeated SecretVersion versions = 4; +} + +// Describes EventTrigger, used to request events to be sent from another +// service. +message EventTrigger { + // Describes the retry policy in case of function's execution failure. + // Retried execution is charged as any other execution. + enum RetryPolicy { + // Not specified. + RETRY_POLICY_UNSPECIFIED = 0; + + // Do not retry. + RETRY_POLICY_DO_NOT_RETRY = 1; + + // Retry on any failure, retry up to 7 days with an exponential backoff + // (capped at 10 seconds). + RETRY_POLICY_RETRY = 2; + } + + // Output only. The resource name of the Eventarc trigger. The format of this + // field is `projects/{project}/locations/{region}/triggers/{trigger}`. + string trigger = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Trigger" + } + ]; + + // The region that the trigger will be in. The trigger will only receive + // events originating in this region. It can be the same + // region as the function, a different region or multi-region, or the global + // region. If not provided, defaults to the same region as the function. + string trigger_region = 2; + + // Required. The type of event to observe. For example: + // `google.cloud.audit.log.v1.written` or + // `google.cloud.pubsub.topic.v1.messagePublished`. + string event_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Criteria used to filter events. + repeated EventFilter event_filters = 4; + + // Optional. The name of a Pub/Sub topic in the same project that will be used + // as the transport topic for the event delivery. Format: + // `projects/{project}/topics/{topic}`. + // + // This is only valid for events of type + // `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here + // will not be deleted at function deletion. + string pubsub_topic = 5 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } + ]; + + // Optional. The email of the trigger's service account. The service account + // must have permission to invoke Cloud Run services, the permission is + // `run.routes.invoke`. + // If empty, defaults to the Compute Engine default service account: + // `{project_number}-compute@developer.gserviceaccount.com`. + string service_account_email = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If unset, then defaults to ignoring failures (i.e. not retrying + // them). + RetryPolicy retry_policy = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the channel associated with the trigger in + // `projects/{project}/locations/{location}/channels/{channel}` format. + // You must provide a channel to receive events from Eventarc SaaS partners. + string channel = 8 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Channel" + } + ]; +} + +// Filters events based on exact matches on the CloudEvents attributes. +message EventFilter { + // Required. The name of a CloudEvents attribute. + string attribute = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The value for the attribute. + string value = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The operator used for matching the events with the value of the + // filter. If not specified, only events that have an exact key-value pair + // specified in the filter are matched. The only allowed value is + // `match-path-pattern`. + string operator = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for the `GetFunction` method. +message GetFunctionRequest { + // Required. The name of the function which details should be obtained. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Request for the `ListFunctions` method. +message ListFunctionsRequest { + // Required. The project and location from which the function should be + // listed, specified in the format `projects/*/locations/*` If you want to + // list functions in all locations, use "-" in place of a location. When + // listing functions in all locations, if one or more location(s) are + // unreachable, the response will contain functions from all reachable + // locations along with the names of any unreachable locations. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudfunctions.googleapis.com/Function" + } + ]; + + // Maximum number of functions to return per call. The largest allowed + // page_size is 1,000, if the page_size is omitted or specified as greater + // than 1,000 then it will be replaced as 1,000. The size of the list + // response can be less than specified when used with filters. + int32 page_size = 2; + + // The value returned by the last + // `ListFunctionsResponse`; indicates that + // this is a continuation of a prior `ListFunctions` call, and that the + // system should return the next page of data. + string page_token = 3; + + // The filter for Functions that match the filter expression, + // following the syntax outlined in https://google.aip.dev/160. + string filter = 4; + + // The sorting order of the resources returned. Value should be a comma + // separated list of fields. The default sorting oder is ascending. + // See https://google.aip.dev/132#ordering. + string order_by = 5; +} + +// Response for the `ListFunctions` method. +message ListFunctionsResponse { + // The functions that match the request. + repeated Function functions = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. The response does not include any + // functions from these locations. + repeated string unreachable = 3; +} + +// Request for the `CreateFunction` method. +message CreateFunctionRequest { + // Required. The project and location in which the function should be created, + // specified in the format `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Function to be created. + Function function = 2 [(google.api.field_behavior) = REQUIRED]; + + // The ID to use for the function, which will become the final component of + // the function's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + string function_id = 3; +} + +// Request for the `UpdateFunction` method. +message UpdateFunctionRequest { + // Required. New version of the function. + Function function = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + // If no field mask is provided, all provided fields in the request will be + // updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for the `DeleteFunction` method. +message DeleteFunctionRequest { + // Required. The name of the function which should be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Request of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlRequest { + // Required. The project and location in which the Google Cloud Storage signed + // URL should be generated, specified in the format `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // [Preview] Resource name of a KMS crypto key (managed by the user) used to + // encrypt/decrypt function source code objects in intermediate Cloud Storage + // buckets. When you generate an upload url and upload your source code, it + // gets copied to an intermediate Cloud Storage bucket. The source code is + // then copied to a versioned directory in the sources bucket in the consumer + // project during the function deployment. + // + // It must match the pattern + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + // + // The Google Cloud Functions service account + // (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + // granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + // (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + // Key/KeyRing/Project/Organization (least access preferred). + string kms_key_name = 2 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + }]; +} + +// Response of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for a + // function source code upload. The uploaded file should be a zip archive + // which contains a function. + string upload_url = 1; + + // The location of the source code in the upload bucket. + // + // Once the archive is uploaded using the `upload_url` use this field to + // set the `function.build_config.source.storage_source` + // during CreateFunction and UpdateFunction. + // + // Generation defaults to 0, as Cloud Storage provides a new generation only + // upon uploading a new object or version of an object. + StorageSource storage_source = 2; +} + +// Request of `GenerateDownloadUrl` method. +message GenerateDownloadUrlRequest { + // Required. The name of function for which source code Google Cloud Storage + // signed URL should be generated. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Response of `GenerateDownloadUrl` method. +message GenerateDownloadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for + // function source code download. + string download_url = 1; +} + +// Request for the `ListRuntimes` method. +message ListRuntimesRequest { + // Required. The project and location from which the runtimes should be + // listed, specified in the format `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The filter for Runtimes that match the filter expression, + // following the syntax outlined in https://google.aip.dev/160. + string filter = 2; +} + +// Response for the `ListRuntimes` method. +message ListRuntimesResponse { + // Describes a runtime and any special information (e.g., deprecation status) + // related to it. + message Runtime { + // The name of the runtime, e.g., 'go113', 'nodejs12', etc. + string name = 1; + + // The user facing name, eg 'Go 1.13', 'Node.js 12', etc. + string display_name = 5; + + // The stage of life this runtime is in, e.g., BETA, GA, etc. + RuntimeStage stage = 2; + + // Warning messages, e.g., a deprecation warning. + repeated string warnings = 3; + + // The environment for the runtime. + Environment environment = 4; + } + + // The various stages that a runtime can be in. + enum RuntimeStage { + // Not specified. + RUNTIME_STAGE_UNSPECIFIED = 0; + + // The runtime is in development. + DEVELOPMENT = 1; + + // The runtime is in the Alpha stage. + ALPHA = 2; + + // The runtime is in the Beta stage. + BETA = 3; + + // The runtime is generally available. + GA = 4; + + // The runtime is deprecated. + DEPRECATED = 5; + + // The runtime is no longer supported. + DECOMMISSIONED = 6; + } + + // The runtimes that match the request. + repeated Runtime runtimes = 1; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation finished running. + google.protobuf.Timestamp end_time = 2; + + // Server-defined resource path for the target of the operation. + string target = 3; + + // Name of the verb executed by the operation. + string verb = 4; + + // Human-readable status of the operation, if any. + string status_detail = 5; + + // Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a + // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + // `Code.CANCELLED`. + bool cancel_requested = 6; + + // API version used to start the operation. + string api_version = 7; + + // The original request that started the operation. + google.protobuf.Any request_resource = 8; + + // Mechanism for reporting in-progress stages + repeated Stage stages = 9; +} + +// Extra GCF specific location information. +message LocationMetadata { + // The Cloud Function environments this location supports. + repeated Environment environments = 1; +} + +// Each Stage of the deployment process +message Stage { + // Possible names for a Stage + enum Name { + // Not specified. Invalid name. + NAME_UNSPECIFIED = 0; + + // Artifact Regsitry Stage + ARTIFACT_REGISTRY = 1; + + // Build Stage + BUILD = 2; + + // Service Stage + SERVICE = 3; + + // Trigger Stage + TRIGGER = 4; + + // Service Rollback Stage + SERVICE_ROLLBACK = 5; + + // Trigger Rollback Stage + TRIGGER_ROLLBACK = 6; + } + + // Possible states for a Stage + enum State { + // Not specified. Invalid state. + STATE_UNSPECIFIED = 0; + + // Stage has not started. + NOT_STARTED = 1; + + // Stage is in progress. + IN_PROGRESS = 2; + + // Stage has completed. + COMPLETE = 3; + } + + // Name of the Stage. This will be unique for each Stage. + Name name = 1; + + // Message describing the Stage + string message = 2; + + // Current state of the Stage + State state = 3; + + // Resource of the Stage + string resource = 4; + + // Link to the current Stage resource + string resource_uri = 5; + + // State messages from the current Stage. + repeated StateMessage state_messages = 6; +} diff --git a/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.create_function.js b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.create_function.js new file mode 100644 index 00000000000..aed5e22444d --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.create_function.js @@ -0,0 +1,75 @@ +// 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, function1) { + // [START cloudfunctions_v2beta_generated_FunctionService_CreateFunction_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 project and location in which the function should be created, + * specified in the format `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * Required. Function to be created. + */ + // const function = {} + /** + * The ID to use for the function, which will become the final component of + * the function's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + */ + // const functionId = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callCreateFunction() { + // Construct request + const request = { + parent, + function1, + }; + + // Run request + const [operation] = await functionsClient.createFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFunction(); + // [END cloudfunctions_v2beta_generated_FunctionService_CreateFunction_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-functions/v2beta/samples/generated/v2beta/function_service.delete_function.js b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.delete_function.js new file mode 100644 index 00000000000..32bcd8d5058 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.delete_function.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 cloudfunctions_v2beta_generated_FunctionService_DeleteFunction_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which should be deleted. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callDeleteFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await functionsClient.deleteFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFunction(); + // [END cloudfunctions_v2beta_generated_FunctionService_DeleteFunction_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-functions/v2beta/samples/generated/v2beta/function_service.generate_download_url.js b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.generate_download_url.js new file mode 100644 index 00000000000..cc28d633047 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.generate_download_url.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 cloudfunctions_v2beta_generated_FunctionService_GenerateDownloadUrl_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of function for which source code Google Cloud Storage + * signed URL should be generated. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGenerateDownloadUrl() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await functionsClient.generateDownloadUrl(request); + console.log(response); + } + + callGenerateDownloadUrl(); + // [END cloudfunctions_v2beta_generated_FunctionService_GenerateDownloadUrl_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-functions/v2beta/samples/generated/v2beta/function_service.generate_upload_url.js b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.generate_upload_url.js new file mode 100644 index 00000000000..a148b14523d --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.generate_upload_url.js @@ -0,0 +1,78 @@ +// 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 cloudfunctions_v2beta_generated_FunctionService_GenerateUploadUrl_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 project and location in which the Google Cloud Storage signed + * URL should be generated, specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Preview Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). + */ + // const kmsKeyName = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGenerateUploadUrl() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await functionsClient.generateUploadUrl(request); + console.log(response); + } + + callGenerateUploadUrl(); + // [END cloudfunctions_v2beta_generated_FunctionService_GenerateUploadUrl_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-functions/v2beta/samples/generated/v2beta/function_service.get_function.js b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.get_function.js new file mode 100644 index 00000000000..0c61728a517 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.get_function.js @@ -0,0 +1,61 @@ +// 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 cloudfunctions_v2beta_generated_FunctionService_GetFunction_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which details should be obtained. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGetFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await functionsClient.getFunction(request); + console.log(response); + } + + callGetFunction(); + // [END cloudfunctions_v2beta_generated_FunctionService_GetFunction_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-functions/v2beta/samples/generated/v2beta/function_service.list_functions.js b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.list_functions.js new file mode 100644 index 00000000000..c1eaa32538e --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.list_functions.js @@ -0,0 +1,93 @@ +// 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 cloudfunctions_v2beta_generated_FunctionService_ListFunctions_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 project and location from which the function should be + * listed, specified in the format `projects/* /locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. + */ + // const parent = 'abc123' + /** + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + */ + // const pageSize = 1234 + /** + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + */ + // const filter = 'abc123' + /** + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callListFunctions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await functionsClient.listFunctionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFunctions(); + // [END cloudfunctions_v2beta_generated_FunctionService_ListFunctions_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-functions/v2beta/samples/generated/v2beta/function_service.list_runtimes.js b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.list_runtimes.js new file mode 100644 index 00000000000..7e10600b474 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.list_runtimes.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) { + // [START cloudfunctions_v2beta_generated_FunctionService_ListRuntimes_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 project and location from which the runtimes should be + * listed, specified in the format `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + */ + // const filter = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callListRuntimes() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await functionsClient.listRuntimes(request); + console.log(response); + } + + callListRuntimes(); + // [END cloudfunctions_v2beta_generated_FunctionService_ListRuntimes_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-functions/v2beta/samples/generated/v2beta/function_service.update_function.js b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.update_function.js new file mode 100644 index 00000000000..dd0d2483a80 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.update_function.js @@ -0,0 +1,68 @@ +// 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(function1) { + // [START cloudfunctions_v2beta_generated_FunctionService_UpdateFunction_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. New version of the function. + */ + // const function = {} + /** + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request will be + * updated. + */ + // const updateMask = {} + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callUpdateFunction() { + // Construct request + const request = { + function1, + }; + + // Run request + const [operation] = await functionsClient.updateFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFunction(); + // [END cloudfunctions_v2beta_generated_FunctionService_UpdateFunction_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-functions/v2beta/samples/generated/v2beta/snippet_metadata_google.cloud.functions.v2beta.json b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/snippet_metadata_google.cloud.functions.v2beta.json new file mode 100644 index 00000000000..e2a32a49e0c --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/snippet_metadata_google.cloud.functions.v2beta.json @@ -0,0 +1,371 @@ +{ + "clientLibrary": { + "name": "nodejs-functions", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.functions.v2beta", + "version": "v2beta" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudfunctions_v2beta_generated_FunctionService_GetFunction_async", + "title": "FunctionService getFunction Sample", + "origin": "API_DEFINITION", + "description": " Returns a function with the given name from the requested project.", + "canonical": true, + "file": "function_service.get_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v2beta.FunctionService.GetFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2beta.Function", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" + }, + "method": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v2beta.FunctionService.GetFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2beta.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2beta_generated_FunctionService_ListFunctions_async", + "title": "FunctionService listFunctions Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of functions that belong to the requested project.", + "canonical": true, + "file": "function_service.list_functions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v2beta.FunctionService.ListFunctions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2beta.ListFunctionsResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" + }, + "method": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v2beta.FunctionService.ListFunctions", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2beta.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2beta_generated_FunctionService_CreateFunction_async", + "title": "FunctionService createFunction Sample", + "origin": "API_DEFINITION", + "description": " Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return `ALREADY_EXISTS` error.", + "canonical": true, + "file": "function_service.create_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v2beta.FunctionService.CreateFunction", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "function", + "type": ".google.cloud.functions.v2beta.Function" + }, + { + "name": "function_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" + }, + "method": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v2beta.FunctionService.CreateFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2beta.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2beta_generated_FunctionService_UpdateFunction_async", + "title": "FunctionService updateFunction Sample", + "origin": "API_DEFINITION", + "description": " Updates existing function.", + "canonical": true, + "file": "function_service.update_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v2beta.FunctionService.UpdateFunction", + "async": true, + "parameters": [ + { + "name": "function", + "type": ".google.cloud.functions.v2beta.Function" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" + }, + "method": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v2beta.FunctionService.UpdateFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2beta.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2beta_generated_FunctionService_DeleteFunction_async", + "title": "FunctionService deleteFunction Sample", + "origin": "API_DEFINITION", + "description": " Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.", + "canonical": true, + "file": "function_service.delete_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v2beta.FunctionService.DeleteFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" + }, + "method": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v2beta.FunctionService.DeleteFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2beta.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2beta_generated_FunctionService_GenerateUploadUrl_async", + "title": "FunctionService generateUploadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type: application/zip` And this header SHOULD NOT be specified: * `Authorization: Bearer YOUR_TOKEN`", + "canonical": true, + "file": "function_service.generate_upload_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v2beta.FunctionService.GenerateUploadUrl", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "kms_key_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2beta.GenerateUploadUrlResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" + }, + "method": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v2beta.FunctionService.GenerateUploadUrl", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2beta.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2beta_generated_FunctionService_GenerateDownloadUrl_async", + "title": "FunctionService generateDownloadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls", + "canonical": true, + "file": "function_service.generate_download_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v2beta.FunctionService.GenerateDownloadUrl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2beta.GenerateDownloadUrlResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" + }, + "method": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v2beta.FunctionService.GenerateDownloadUrl", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2beta.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2beta_generated_FunctionService_ListRuntimes_async", + "title": "FunctionService listRuntimes Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of runtimes that are supported for the requested project.", + "canonical": true, + "file": "function_service.list_runtimes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRuntimes", + "fullName": "google.cloud.functions.v2beta.FunctionService.ListRuntimes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2beta.ListRuntimesResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" + }, + "method": { + "shortName": "ListRuntimes", + "fullName": "google.cloud.functions.v2beta.FunctionService.ListRuntimes", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2beta.FunctionService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-functions/v2beta/src/index.ts b/owl-bot-staging/google-cloud-functions/v2beta/src/index.ts new file mode 100644 index 00000000000..168b8ae2042 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/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 v2beta from './v2beta'; +const FunctionServiceClient = v2beta.FunctionServiceClient; +type FunctionServiceClient = v2beta.FunctionServiceClient; +export {v2beta, FunctionServiceClient}; +export default {v2beta, FunctionServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_client.ts b/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_client.ts new file mode 100644 index 00000000000..13e4f1ad7b3 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_client.ts @@ -0,0 +1,2197 @@ +// 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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta/function_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './function_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Google Cloud Functions is used to deploy functions that are executed by + * Google in response to various events. Data connected with that event is + * passed to a function as the input data. + * + * A **function** is a resource which describes a function that should be + * executed and how it is triggered. + * @class + * @memberof v2beta + */ +export class FunctionServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + functionServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of FunctionServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 FunctionServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof FunctionServiceClient; + 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; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + 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 = { + buildPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/builds/{build}' + ), + channelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/channels/{channel}' + ), + connectorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/connectors/{connector}' + ), + cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' + ), + functionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/functions/{function}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + repositoryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + topicPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/topics/{topic}' + ), + triggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/triggers/{trigger}' + ), + workerPoolPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workerPools/{worker_pool}' + ), + }; + + // 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 = { + listFunctions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'functions') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2beta/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v2beta/{resource=projects/*/locations/*/functions/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v2beta/{resource=projects/*/locations/*/functions/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v2beta/{resource=projects/*/locations/*/functions/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v2beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v2beta/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v2beta.Function') as gax.protobuf.Type; + const createFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2beta.OperationMetadata') as gax.protobuf.Type; + const updateFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v2beta.Function') as gax.protobuf.Type; + const updateFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2beta.OperationMetadata') as gax.protobuf.Type; + const deleteFunctionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2beta.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFunctionResponse.decode.bind(createFunctionResponse), + createFunctionMetadata.decode.bind(createFunctionMetadata)), + updateFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFunctionResponse.decode.bind(updateFunctionResponse), + updateFunctionMetadata.decode.bind(updateFunctionMetadata)), + deleteFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFunctionResponse.decode.bind(deleteFunctionResponse), + deleteFunctionMetadata.decode.bind(deleteFunctionMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.functions.v2beta.FunctionService', 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.functionServiceStub) { + return this.functionServiceStub; + } + + // Put together the "service stub" for + // google.cloud.functions.v2beta.FunctionService. + this.functionServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.functions.v2beta.FunctionService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.functions.v2beta.FunctionService, + 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 functionServiceStubMethods = + ['getFunction', 'listFunctions', 'createFunction', 'updateFunction', 'deleteFunction', 'generateUploadUrl', 'generateDownloadUrl', 'listRuntimes']; + for (const methodName of functionServiceStubMethods) { + const callPromise = this.functionServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.functionServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudfunctions.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 'cloudfunctions.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 -- + // ------------------- +/** + * Returns a function with the given name from the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which details should be obtained. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2beta.Function|Function}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.get_function.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_GetFunction_async + */ + getFunction( + request?: protos.google.cloud.functions.v2beta.IGetFunctionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IGetFunctionRequest|undefined, {}|undefined + ]>; + getFunction( + request: protos.google.cloud.functions.v2beta.IGetFunctionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IGetFunctionRequest|null|undefined, + {}|null|undefined>): void; + getFunction( + request: protos.google.cloud.functions.v2beta.IGetFunctionRequest, + callback: Callback< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IGetFunctionRequest|null|undefined, + {}|null|undefined>): void; + getFunction( + request?: protos.google.cloud.functions.v2beta.IGetFunctionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IGetFunctionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IGetFunctionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IGetFunctionRequest|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.getFunction(request, options, callback); + } +/** + * Returns a signed URL for uploading a function source code. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls. + * Once the function source code upload is complete, the used signed + * URL should be provided in CreateFunction or UpdateFunction request + * as a reference to the function source code. + * + * When uploading source code to the generated signed URL, please follow + * these restrictions: + * + * * Source file type should be a zip file. + * * No credentials should be attached - the signed URLs provide access to the + * target bucket using internal service identity; if credentials were + * attached, the identity from the credentials would be used, but that + * identity does not have permissions to upload files to the URL. + * + * When making a HTTP PUT request, these two headers need to be specified: + * + * * `content-type: application/zip` + * + * And this header SHOULD NOT be specified: + * + * * `Authorization: Bearer YOUR_TOKEN` + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location in which the Google Cloud Storage signed + * URL should be generated, specified in the format `projects/* /locations/*`. + * @param {string} request.kmsKeyName + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2beta.GenerateUploadUrlResponse|GenerateUploadUrlResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.generate_upload_url.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_GenerateUploadUrl_async + */ + generateUploadUrl( + request?: protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest|undefined, {}|undefined + ]>; + generateUploadUrl( + request: protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateUploadUrl( + request: protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateUploadUrl( + request?: protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest|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.generateUploadUrl(request, options, callback); + } +/** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and should be used within + * 30 minutes of generation. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of function for which source code Google Cloud Storage + * signed URL should be generated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2beta.GenerateDownloadUrlResponse|GenerateDownloadUrlResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.generate_download_url.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_GenerateDownloadUrl_async + */ + generateDownloadUrl( + request?: protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest|undefined, {}|undefined + ]>; + generateDownloadUrl( + request: protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateDownloadUrl( + request: protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateDownloadUrl( + request?: protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest|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.generateDownloadUrl(request, options, callback); + } +/** + * Returns a list of runtimes that are supported for the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the runtimes should be + * listed, specified in the format `projects/* /locations/*` + * @param {string} request.filter + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2beta.ListRuntimesResponse|ListRuntimesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.list_runtimes.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_ListRuntimes_async + */ + listRuntimes( + request?: protos.google.cloud.functions.v2beta.IListRuntimesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v2beta.IListRuntimesResponse, + protos.google.cloud.functions.v2beta.IListRuntimesRequest|undefined, {}|undefined + ]>; + listRuntimes( + request: protos.google.cloud.functions.v2beta.IListRuntimesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2beta.IListRuntimesResponse, + protos.google.cloud.functions.v2beta.IListRuntimesRequest|null|undefined, + {}|null|undefined>): void; + listRuntimes( + request: protos.google.cloud.functions.v2beta.IListRuntimesRequest, + callback: Callback< + protos.google.cloud.functions.v2beta.IListRuntimesResponse, + protos.google.cloud.functions.v2beta.IListRuntimesRequest|null|undefined, + {}|null|undefined>): void; + listRuntimes( + request?: protos.google.cloud.functions.v2beta.IListRuntimesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.functions.v2beta.IListRuntimesResponse, + protos.google.cloud.functions.v2beta.IListRuntimesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v2beta.IListRuntimesResponse, + protos.google.cloud.functions.v2beta.IListRuntimesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v2beta.IListRuntimesResponse, + protos.google.cloud.functions.v2beta.IListRuntimesRequest|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.listRuntimes(request, options, callback); + } + +/** + * Creates a new function. If a function with the given name already exists in + * the specified project, the long running operation will return + * `ALREADY_EXISTS` error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location in which the function should be created, + * specified in the format `projects/* /locations/*` + * @param {google.cloud.functions.v2beta.Function} request.function + * Required. Function to be created. + * @param {string} request.functionId + * The ID to use for the function, which will become the final component of + * the function's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link protos.0-9|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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.create_function.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_CreateFunction_async + */ + createFunction( + request?: protos.google.cloud.functions.v2beta.ICreateFunctionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createFunction( + request: protos.google.cloud.functions.v2beta.ICreateFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFunction( + request: protos.google.cloud.functions.v2beta.ICreateFunctionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFunction( + request?: protos.google.cloud.functions.v2beta.ICreateFunctionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFunction(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createFunction()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.create_function.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_CreateFunction_async + */ + async checkCreateFunctionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFunction, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates existing function. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.functions.v2beta.Function} request.function + * Required. New version of the function. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request will be + * updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.update_function.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_UpdateFunction_async + */ + updateFunction( + request?: protos.google.cloud.functions.v2beta.IUpdateFunctionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateFunction( + request: protos.google.cloud.functions.v2beta.IUpdateFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFunction( + request: protos.google.cloud.functions.v2beta.IUpdateFunctionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFunction( + request?: protos.google.cloud.functions.v2beta.IUpdateFunctionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'function.name': request.function!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFunction(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateFunction()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.update_function.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_UpdateFunction_async + */ + async checkUpdateFunctionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFunction, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger will be updated to + * remove this function. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which should be deleted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.delete_function.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_DeleteFunction_async + */ + deleteFunction( + request?: protos.google.cloud.functions.v2beta.IDeleteFunctionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteFunction( + request: protos.google.cloud.functions.v2beta.IDeleteFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFunction( + request: protos.google.cloud.functions.v2beta.IDeleteFunctionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFunction( + request?: protos.google.cloud.functions.v2beta.IDeleteFunctionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteFunction(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteFunction()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.delete_function.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_DeleteFunction_async + */ + async checkDeleteFunctionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFunction, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Returns a list of functions that belong to the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the function should be + * listed, specified in the format `projects/* /locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2beta.Function|Function}. + * 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 `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFunctions( + request?: protos.google.cloud.functions.v2beta.IListFunctionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.functions.v2beta.IFunction[], + protos.google.cloud.functions.v2beta.IListFunctionsRequest|null, + protos.google.cloud.functions.v2beta.IListFunctionsResponse + ]>; + listFunctions( + request: protos.google.cloud.functions.v2beta.IListFunctionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.functions.v2beta.IListFunctionsRequest, + protos.google.cloud.functions.v2beta.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v2beta.IFunction>): void; + listFunctions( + request: protos.google.cloud.functions.v2beta.IListFunctionsRequest, + callback: PaginationCallback< + protos.google.cloud.functions.v2beta.IListFunctionsRequest, + protos.google.cloud.functions.v2beta.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v2beta.IFunction>): void; + listFunctions( + request?: protos.google.cloud.functions.v2beta.IListFunctionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.functions.v2beta.IListFunctionsRequest, + protos.google.cloud.functions.v2beta.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v2beta.IFunction>, + callback?: PaginationCallback< + protos.google.cloud.functions.v2beta.IListFunctionsRequest, + protos.google.cloud.functions.v2beta.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v2beta.IFunction>): + Promise<[ + protos.google.cloud.functions.v2beta.IFunction[], + protos.google.cloud.functions.v2beta.IListFunctionsRequest|null, + protos.google.cloud.functions.v2beta.IListFunctionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listFunctions(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the function should be + * listed, specified in the format `projects/* /locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @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 protos.google.cloud.functions.v2beta.Function|Function} 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 `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFunctionsStream( + request?: protos.google.cloud.functions.v2beta.IListFunctionsRequest, + 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['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.createStream( + this.innerApiCalls.listFunctions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFunctions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the function should be + * listed, specified in the format `projects/* /locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.functions.v2beta.Function|Function}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.list_functions.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_ListFunctions_async + */ + listFunctionsAsync( + request?: protos.google.cloud.functions.v2beta.IListFunctionsRequest, + 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['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.asyncIterate( + this.innerApiCalls['listFunctions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified build resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} build + * @returns {string} Resource name string. + */ + buildPath(project:string,location:string,build:string) { + return this.pathTemplates.buildPathTemplate.render({ + project: project, + location: location, + build: build, + }); + } + + /** + * Parse the project from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).project; + } + + /** + * Parse the location from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).location; + } + + /** + * Parse the build from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the build. + */ + matchBuildFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).build; + } + + /** + * Return a fully-qualified channel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} channel + * @returns {string} Resource name string. + */ + channelPath(project:string,location:string,channel:string) { + return this.pathTemplates.channelPathTemplate.render({ + project: project, + location: location, + channel: channel, + }); + } + + /** + * Parse the project from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).project; + } + + /** + * Parse the location from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the location. + */ + matchLocationFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).location; + } + + /** + * Parse the channel from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the channel. + */ + matchChannelFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).channel; + } + + /** + * Return a fully-qualified connector resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} connector + * @returns {string} Resource name string. + */ + connectorPath(project:string,location:string,connector:string) { + return this.pathTemplates.connectorPathTemplate.render({ + project: project, + location: location, + connector: connector, + }); + } + + /** + * Parse the project from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName).project; + } + + /** + * Parse the location from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName).location; + } + + /** + * Parse the connector from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the connector. + */ + matchConnectorFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName).connector; + } + + /** + * Return a fully-qualified cryptoKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @returns {string} Resource name string. + */ + cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { + return this.pathTemplates.cryptoKeyPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + }); + } + + /** + * Parse the project from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; + } + + /** + * Parse the location from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; + } + + /** + * Parse the key_ring from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; + } + + /** + * Parse the crypto_key from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; + } + + /** + * Return a fully-qualified function resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} functionParam + * @returns {string} Resource name string. + */ + functionPath(project:string,location:string,functionParam:string) { + return this.pathTemplates.functionPathTemplate.render({ + project: project, + location: location, + function: functionParam, + }); + } + + /** + * Parse the project from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).project; + } + + /** + * Parse the location from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).location; + } + + /** + * Parse the function from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the function. + */ + matchFunctionFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).function; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified 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 repository resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @returns {string} Resource name string. + */ + repositoryPath(project:string,location:string,repository:string) { + return this.pathTemplates.repositoryPathTemplate.render({ + project: project, + location: location, + repository: repository, + }); + } + + /** + * Parse the project from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).project; + } + + /** + * Parse the location from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).location; + } + + /** + * Parse the repository from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).repository; + } + + /** + * Return a fully-qualified service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * Return a fully-qualified topic resource name string. + * + * @param {string} project + * @param {string} topic + * @returns {string} Resource name string. + */ + topicPath(project:string,topic:string) { + return this.pathTemplates.topicPathTemplate.render({ + project: project, + topic: topic, + }); + } + + /** + * Parse the project from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).project; + } + + /** + * Parse the topic from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the topic. + */ + matchTopicFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).topic; + } + + /** + * Return a fully-qualified trigger resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} trigger + * @returns {string} Resource name string. + */ + triggerPath(project:string,location:string,trigger:string) { + return this.pathTemplates.triggerPathTemplate.render({ + project: project, + location: location, + trigger: trigger, + }); + } + + /** + * Parse the project from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).project; + } + + /** + * Parse the location from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).location; + } + + /** + * Parse the trigger from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the trigger. + */ + matchTriggerFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).trigger; + } + + /** + * Return a fully-qualified workerPool resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} worker_pool + * @returns {string} Resource name string. + */ + workerPoolPath(project:string,location:string,workerPool:string) { + return this.pathTemplates.workerPoolPathTemplate.render({ + project: project, + location: location, + worker_pool: workerPool, + }); + } + + /** + * Parse the project from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).project; + } + + /** + * Parse the location from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).location; + } + + /** + * Parse the worker_pool from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the worker_pool. + */ + matchWorkerPoolFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).worker_pool; + } + + /** + * 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.functionServiceStub && !this._terminated) { + return this.functionServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_client_config.json b/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_client_config.json new file mode 100644 index 00000000000..d6bce91ead4 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_client_config.json @@ -0,0 +1,58 @@ +{ + "interfaces": { + "google.cloud.functions.v2beta.FunctionService": { + "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": { + "GetFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListFunctions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateUploadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateDownloadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListRuntimes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_proto_list.json b/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_proto_list.json new file mode 100644 index 00000000000..a92a5d75e33 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/functions/v2beta/functions.proto" +] diff --git a/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/gapic_metadata.json b/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/gapic_metadata.json new file mode 100644 index 00000000000..e66fe6e8e8b --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/gapic_metadata.json @@ -0,0 +1,107 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.functions.v2beta", + "libraryPackage": "@google-cloud/functions", + "services": { + "FunctionService": { + "clients": { + "grpc": { + "libraryClient": "FunctionServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "ListRuntimes": { + "methods": [ + "listRuntimes" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "FunctionServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "ListRuntimes": { + "methods": [ + "listRuntimes" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/index.ts b/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/index.ts new file mode 100644 index 00000000000..ec33a786b85 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/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 {FunctionServiceClient} from './function_service_client'; diff --git a/owl-bot-staging/google-cloud-functions/v2beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-functions/v2beta/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..c41f33eb2a8 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/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 functions = require('@google-cloud/functions'); + +function main() { + const functionServiceClient = new functions.FunctionServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-functions/v2beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-functions/v2beta/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..530ace3134e --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/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 {FunctionServiceClient} from '@google-cloud/functions'; + +// check that the client class type name can be used +function doStuffWithFunctionServiceClient(client: FunctionServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const functionServiceClient = new FunctionServiceClient(); + doStuffWithFunctionServiceClient(functionServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-functions/v2beta/system-test/install.ts b/owl-bot-staging/google-cloud-functions/v2beta/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/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-functions/v2beta/test/gapic_function_service_v2beta.ts b/owl-bot-staging/google-cloud-functions/v2beta/test/gapic_function_service_v2beta.ts new file mode 100644 index 00000000000..849027018ec --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/test/gapic_function_service_v2beta.ts @@ -0,0 +1,2584 @@ +// 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 functionserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta.FunctionServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = functionserviceModule.v2beta.FunctionServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = functionserviceModule.v2beta.FunctionServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = functionserviceModule.v2beta.FunctionServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + await client.initialize(); + assert(client.functionServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.functionServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + 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 functionserviceModule.v2beta.FunctionServiceClient({ + 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('getFunction', () => { + it('invokes getFunction without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GetFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.GetFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2beta.Function() + ); + client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); + const [response] = await client.getFunction(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFunction without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GetFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.GetFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2beta.Function() + ); + client.innerApiCalls.getFunction = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFunction( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v2beta.IFunction|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFunction with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GetFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.GetFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFunction = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFunction(request), expectedError); + const actualRequest = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFunction with closed client', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GetFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.GetFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFunction(request), expectedError); + }); + }); + + describe('generateUploadUrl', () => { + it('invokes generateUploadUrl without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateUploadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.GenerateUploadUrlRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); + const [response] = await client.generateUploadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateUploadUrl without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateUploadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.GenerateUploadUrlRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateUploadUrl( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateUploadUrl with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateUploadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.GenerateUploadUrlRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateUploadUrl = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateUploadUrl(request), expectedError); + const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateUploadUrl with closed client', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateUploadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.GenerateUploadUrlRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateUploadUrl(request), expectedError); + }); + }); + + describe('generateDownloadUrl', () => { + it('invokes generateDownloadUrl without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateDownloadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.GenerateDownloadUrlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = stubSimpleCall(expectedResponse); + const [response] = await client.generateDownloadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateDownloadUrl without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateDownloadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.GenerateDownloadUrlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateDownloadUrl( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateDownloadUrl with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateDownloadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.GenerateDownloadUrlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateDownloadUrl = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateDownloadUrl with closed client', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateDownloadUrlRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.GenerateDownloadUrlRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + }); + }); + + describe('listRuntimes', () => { + it('invokes listRuntimes without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListRuntimesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.ListRuntimesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListRuntimesResponse() + ); + client.innerApiCalls.listRuntimes = stubSimpleCall(expectedResponse); + const [response] = await client.listRuntimes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimes without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListRuntimesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.ListRuntimesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListRuntimesResponse() + ); + client.innerApiCalls.listRuntimes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRuntimes( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v2beta.IListRuntimesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimes with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListRuntimesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.ListRuntimesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRuntimes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listRuntimes(request), expectedError); + const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimes with closed client', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListRuntimesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.ListRuntimesRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listRuntimes(request), expectedError); + }); + }); + + describe('createFunction', () => { + it('invokes createFunction without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.CreateFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.CreateFunctionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = stubLongRunningCall(expectedResponse); + const [operation] = await client.createFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFunction without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.CreateFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.CreateFunctionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFunction( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFunction with call error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.CreateFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.CreateFunctionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createFunction(request), expectedError); + const actualRequest = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFunction with LRO error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.CreateFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.CreateFunctionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createFunction(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateFunctionProgress without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateFunctionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFunctionProgress with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateFunctionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateFunction', () => { + it('invokes updateFunction without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.UpdateFunctionRequest() + ); + request.function ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.UpdateFunctionRequest', ['function', 'name']); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFunction without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.UpdateFunctionRequest() + ); + request.function ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.UpdateFunctionRequest', ['function', 'name']); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFunction( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFunction with call error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.UpdateFunctionRequest() + ); + request.function ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.UpdateFunctionRequest', ['function', 'name']); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateFunction(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFunction with LRO error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.UpdateFunctionRequest() + ); + request.function ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.UpdateFunctionRequest', ['function', 'name']); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateFunction(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateFunctionProgress without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateFunctionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFunctionProgress with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateFunctionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteFunction', () => { + it('invokes deleteFunction without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.DeleteFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.DeleteFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFunction without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.DeleteFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.DeleteFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFunction( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFunction with call error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.DeleteFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.DeleteFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteFunction(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFunction with LRO error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.DeleteFunctionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.DeleteFunctionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteFunction(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteFunctionProgress without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteFunctionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFunctionProgress with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteFunctionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listFunctions', () => { + it('invokes listFunctions without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), + ]; + client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); + const [response] = await client.listFunctions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFunctions without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), + ]; + client.innerApiCalls.listFunctions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFunctions( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v2beta.IFunction[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFunctions with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFunctions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFunctions(request), expectedError); + const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFunctionsStream without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), + ]; + client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v2beta.Function[] = []; + stream.on('data', (response: protos.google.cloud.functions.v2beta.Function) => { + 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.listFunctions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFunctionsStream with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v2beta.Function[] = []; + stream.on('data', (response: protos.google.cloud.functions.v2beta.Function) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFunctions without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), + ]; + client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.functions.v2beta.IFunction[] = []; + const iterable = client.listFunctionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFunctions with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListFunctionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.functions.v2beta.ListFunctionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFunctionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.functions.v2beta.IFunction[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('build', () => { + const fakePath = "/rendered/path/build"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + build: "buildValue", + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.buildPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.buildPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('buildPath', () => { + const result = client.buildPath("projectValue", "locationValue", "buildValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.buildPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBuildName', () => { + const result = client.matchProjectFromBuildName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBuildName', () => { + const result = client.matchLocationFromBuildName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBuildFromBuildName', () => { + const result = client.matchBuildFromBuildName(fakePath); + assert.strictEqual(result, "buildValue"); + assert((client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('channel', () => { + const fakePath = "/rendered/path/channel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + channel: "channelValue", + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.channelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.channelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('channelPath', () => { + const result = client.channelPath("projectValue", "locationValue", "channelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.channelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromChannelName', () => { + const result = client.matchProjectFromChannelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromChannelName', () => { + const result = client.matchLocationFromChannelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchChannelFromChannelName', () => { + const result = client.matchChannelFromChannelName(fakePath); + assert.strictEqual(result, "channelValue"); + assert((client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('connector', () => { + const fakePath = "/rendered/path/connector"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + connector: "connectorValue", + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.connectorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.connectorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('connectorPath', () => { + const result = client.connectorPath("projectValue", "locationValue", "connectorValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.connectorPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConnectorName', () => { + const result = client.matchProjectFromConnectorName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConnectorName', () => { + const result = client.matchLocationFromConnectorName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConnectorFromConnectorName', () => { + const result = client.matchConnectorFromConnectorName(fakePath); + assert.strictEqual(result, "connectorValue"); + assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('cryptoKey', () => { + const fakePath = "/rendered/path/cryptoKey"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.cryptoKeyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('cryptoKeyPath', () => { + const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCryptoKeyName', () => { + const result = client.matchProjectFromCryptoKeyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCryptoKeyName', () => { + const result = client.matchLocationFromCryptoKeyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromCryptoKeyName', () => { + const result = client.matchKeyRingFromCryptoKeyName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromCryptoKeyName', () => { + const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('function', () => { + const fakePath = "/rendered/path/function"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + function: "functionValue", + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.functionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.functionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('functionPath', () => { + const result = client.functionPath("projectValue", "locationValue", "functionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.functionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFunctionName', () => { + const result = client.matchProjectFromFunctionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFunctionName', () => { + const result = client.matchLocationFromFunctionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFunctionFromFunctionName', () => { + const result = client.matchFunctionFromFunctionName(fakePath); + assert.strictEqual(result, "functionValue"); + assert((client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + 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('repository', () => { + const fakePath = "/rendered/path/repository"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.repositoryPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.repositoryPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('repositoryPath', () => { + const result = client.repositoryPath("projectValue", "locationValue", "repositoryValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.repositoryPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromRepositoryName', () => { + const result = client.matchProjectFromRepositoryName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromRepositoryName', () => { + const result = client.matchLocationFromRepositoryName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromRepositoryName', () => { + const result = client.matchRepositoryFromRepositoryName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath("projectValue", "locationValue", "serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('topic', () => { + const fakePath = "/rendered/path/topic"; + const expectedParameters = { + project: "projectValue", + topic: "topicValue", + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.topicPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.topicPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('topicPath', () => { + const result = client.topicPath("projectValue", "topicValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.topicPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTopicName', () => { + const result = client.matchProjectFromTopicName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.topicPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTopicFromTopicName', () => { + const result = client.matchTopicFromTopicName(fakePath); + assert.strictEqual(result, "topicValue"); + assert((client.pathTemplates.topicPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('trigger', () => { + const fakePath = "/rendered/path/trigger"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + trigger: "triggerValue", + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.triggerPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.triggerPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('triggerPath', () => { + const result = client.triggerPath("projectValue", "locationValue", "triggerValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.triggerPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTriggerName', () => { + const result = client.matchProjectFromTriggerName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromTriggerName', () => { + const result = client.matchLocationFromTriggerName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTriggerFromTriggerName', () => { + const result = client.matchTriggerFromTriggerName(fakePath); + assert.strictEqual(result, "triggerValue"); + assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('workerPool', () => { + const fakePath = "/rendered/path/workerPool"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + worker_pool: "workerPoolValue", + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workerPoolPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workerPoolPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workerPoolPath', () => { + const result = client.workerPoolPath("projectValue", "locationValue", "workerPoolValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workerPoolPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkerPoolName', () => { + const result = client.matchProjectFromWorkerPoolName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkerPoolName', () => { + const result = client.matchLocationFromWorkerPoolName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkerPoolFromWorkerPoolName', () => { + const result = client.matchWorkerPoolFromWorkerPoolName(fakePath); + assert.strictEqual(result, "workerPoolValue"); + assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-functions/v2beta/tsconfig.json b/owl-bot-staging/google-cloud-functions/v2beta/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/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-functions/v2beta/webpack.config.js b/owl-bot-staging/google-cloud-functions/v2beta/webpack.config.js new file mode 100644 index 00000000000..527abad554f --- /dev/null +++ b/owl-bot-staging/google-cloud-functions/v2beta/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: 'FunctionService', + filename: './function-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-gkebackup/v1/.eslintignore b/owl-bot-staging/google-cloud-gkebackup/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/.eslintrc.json b/owl-bot-staging/google-cloud-gkebackup/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/.gitignore b/owl-bot-staging/google-cloud-gkebackup/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/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-gkebackup/v1/.jsdoc.js b/owl-bot-staging/google-cloud-gkebackup/v1/.jsdoc.js new file mode 100644 index 00000000000..b81e717f4c5 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/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/gke-backup', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/.mocharc.js b/owl-bot-staging/google-cloud-gkebackup/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/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-gkebackup/v1/.prettierrc.js b/owl-bot-staging/google-cloud-gkebackup/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/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-gkebackup/v1/README.md b/owl-bot-staging/google-cloud-gkebackup/v1/README.md new file mode 100644 index 00000000000..095871c3b72 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/README.md @@ -0,0 +1 @@ +Gkebackup: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/package.json b/owl-bot-staging/google-cloud-gkebackup/v1/package.json new file mode 100644 index 00000000000..77c3f209041 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/gke-backup", + "version": "0.1.0", + "description": "Gkebackup client for Node.js", + "repository": "googleapis/nodejs-gkebackup", + "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 gkebackup", + "gkebackup", + "backup for g k e" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/backup.proto b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/backup.proto new file mode 100644 index 00000000000..88a95493ada --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/backup.proto @@ -0,0 +1,242 @@ +// 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 +// +// 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.gkebackup.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/gkebackup/v1/common.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeBackup.V1"; +option go_package = "cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppb"; +option java_multiple_files = true; +option java_outer_classname = "BackupProto"; +option java_package = "com.google.cloud.gkebackup.v1"; +option php_namespace = "Google\\Cloud\\GkeBackup\\V1"; +option ruby_package = "Google::Cloud::GkeBackup::V1"; + +// Represents a request to perform a single point-in-time capture of +// some portion of the state of a GKE cluster, the record of the backup +// operation itself, and an anchor for the underlying artifacts that +// comprise the Backup (the config backup and VolumeBackups). +// Next id: 28 +message Backup { + option (google.api.resource) = { + type: "gkebackup.googleapis.com/Backup" + pattern: "projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}" + }; + + // Information about the GKE cluster from which this Backup was created. + message ClusterMetadata { + // The source cluster from which this Backup was created. + // Valid formats: + // + // - `projects/*/locations/*/clusters/*` + // - `projects/*/zones/*/clusters/*` + // + // This is inherited from the parent BackupPlan's + // [cluster][google.cloud.gkebackup.v1.BackupPlan.cluster] field. + string cluster = 1; + + // The Kubernetes server version of the source cluster. + string k8s_version = 2; + + // A list of the Backup for GKE CRD versions found in the cluster. + map backup_crd_versions = 3; + + // Platform-specific version + oneof platform_version { + // GKE version + string gke_version = 4; + + // Anthos version + string anthos_version = 5; + } + } + + // State + enum State { + // The Backup resource is in the process of being created. + STATE_UNSPECIFIED = 0; + + // The Backup resource has been created and the associated BackupJob + // Kubernetes resource has been injected into the source cluster. + CREATING = 1; + + // The gkebackup agent in the cluster has begun executing the backup + // operation. + IN_PROGRESS = 2; + + // The backup operation has completed successfully. + SUCCEEDED = 3; + + // The backup operation has failed. + FAILED = 4; + + // This Backup resource (and its associated artifacts) is in the process + // of being deleted. + DELETING = 5; + } + + // Output only. The fully qualified name of the Backup. + // `projects/*/locations/*/backupPlans/*/backups/*` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server generated global unique identifier of + // [UUID4](https://en.wikipedia.org/wiki/Universally_unique_identifier) + string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when this Backup resource was created. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when this Backup resource was last updated. + google.protobuf.Timestamp update_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This flag indicates whether this Backup resource was created + // manually by a user or via a schedule in the BackupPlan. A value of True + // means that the Backup was created manually. + bool manual = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A set of custom labels supplied by user. + map labels = 6; + + // Minimum age for this Backup (in days). If this field is set to a non-zero + // value, the Backup will be "locked" against deletion (either manual or + // automatic deletion) for the number of days provided (measured from the + // creation time of the Backup). MUST be an integer value between 0-90 + // (inclusive). + // + // Defaults to parent BackupPlan's + // [backup_delete_lock_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days] + // setting and may only be increased + // (either at creation time or in a subsequent update). + int32 delete_lock_days = 7; + + // Output only. The time at which an existing delete lock will expire for this + // backup (calculated from create_time + + // [delete_lock_days][google.cloud.gkebackup.v1.Backup.delete_lock_days]). + google.protobuf.Timestamp delete_lock_expire_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The age (in days) after which this Backup will be automatically deleted. + // Must be an integer value >= 0: + // + // - If 0, no automatic deletion will occur for this Backup. + // - If not 0, this must be >= + // [delete_lock_days][google.cloud.gkebackup.v1.Backup.delete_lock_days] and + // <= 365. + // + // Once a Backup is created, this value may only be increased. + // + // Defaults to the parent BackupPlan's + // [backup_retain_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days] + // value. + int32 retain_days = 9; + + // Output only. The time at which this Backup will be automatically deleted + // (calculated from create_time + + // [retain_days][google.cloud.gkebackup.v1.Backup.retain_days]). + google.protobuf.Timestamp retain_expire_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The customer managed encryption key that was used to encrypt + // the Backup's artifacts. Inherited from the parent BackupPlan's + // [encryption_key][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.encryption_key] + // value. + EncryptionKey encryption_key = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Defines the "scope" of the Backup - which namespaced resources in the + // cluster were included in the Backup. Inherited from the parent + // BackupPlan's + // [backup_scope][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.backup_scope] + // value. + oneof backup_scope { + // Output only. If True, all namespaces were included in the Backup. + bool all_namespaces = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. If set, the list of namespaces that were included in the + // Backup. + Namespaces selected_namespaces = 13 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. If set, the list of ProtectedApplications whose resources + // were included in the Backup. + NamespacedNames selected_applications = 14 + [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Output only. Whether or not the Backup contains volume data. Controlled by + // the parent BackupPlan's + // [include_volume_data][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_volume_data] + // value. + bool contains_volume_data = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Whether or not the Backup contains Kubernetes Secrets. + // Controlled by the parent BackupPlan's + // [include_secrets][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_secrets] + // value. + bool contains_secrets = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Information about the GKE cluster from which this Backup was + // created. + ClusterMetadata cluster_metadata = 17 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Current state of the Backup + State state = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable description of why the backup is in the current + // `state`. + string state_reason = 19 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Completion time of the Backup + google.protobuf.Timestamp complete_time = 20 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The total number of Kubernetes resources included in the + // Backup. + int32 resource_count = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The total number of volume backups contained in the Backup. + int32 volume_count = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The total size of the Backup in bytes = config backup size + + // sum(volume backup sizes) + int64 size_bytes = 23 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. `etag` is used for optimistic concurrency control as a way to + // help prevent simultaneous updates of a backup from overwriting each other. + // It is strongly suggested that systems make use of the `etag` in the + // read-modify-write cycle to perform backup updates in order to avoid + // race conditions: An `etag` is returned in the response to `GetBackup`, + // and systems are expected to put that etag in the request to + // `UpdateBackup` or `DeleteBackup` to ensure that their change will be + // applied to the same version of the resource. + string etag = 24 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User specified descriptive string for this Backup. + string description = 25; + + // Output only. The total number of Kubernetes Pods contained in the Backup. + int32 pod_count = 26 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The size of the config backup in bytes. + int64 config_backup_size_bytes = 27 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/backup_plan.proto b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/backup_plan.proto new file mode 100644 index 00000000000..42ed47db4a9 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/backup_plan.proto @@ -0,0 +1,238 @@ +// 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 +// +// 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.gkebackup.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/gkebackup/v1/common.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeBackup.V1"; +option go_package = "cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppb"; +option java_multiple_files = true; +option java_outer_classname = "BackupPlanProto"; +option java_package = "com.google.cloud.gkebackup.v1"; +option php_namespace = "Google\\Cloud\\GkeBackup\\V1"; +option ruby_package = "Google::Cloud::GkeBackup::V1"; + +// Defines the configuration and scheduling for a "line" of Backups. +message BackupPlan { + option (google.api.resource) = { + type: "gkebackup.googleapis.com/BackupPlan" + pattern: "projects/{project}/locations/{location}/backupPlans/{backup_plan}" + }; + + // RetentionPolicy defines a Backup retention policy for a BackupPlan. + message RetentionPolicy { + // Minimum age for Backups created via this BackupPlan (in days). + // This field MUST be an integer value between 0-90 (inclusive). + // A Backup created under this BackupPlan will NOT be deletable until it + // reaches Backup's (create_time + backup_delete_lock_days). + // Updating this field of a BackupPlan does NOT affect existing Backups + // under it. Backups created AFTER a successful update will inherit + // the new value. + // + // Default: 0 (no delete blocking) + int32 backup_delete_lock_days = 1; + + // The default maximum age of a Backup created via this BackupPlan. + // This field MUST be an integer value >= 0 and <= 365. + // If specified, a Backup created under this BackupPlan will be + // automatically deleted after its age reaches (create_time + + // backup_retain_days). + // If not specified, Backups created under this BackupPlan will NOT be + // subject to automatic deletion. + // Updating this field does NOT affect existing Backups under it. Backups + // created AFTER a successful update will automatically pick up the new + // value. + // NOTE: backup_retain_days must be >= + // [backup_delete_lock_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days]. + // If + // [cron_schedule][google.cloud.gkebackup.v1.BackupPlan.Schedule.cron_schedule] + // is defined, then this must be + // <= 360 * the creation interval. + // + // Default: 0 (no automatic deletion) + int32 backup_retain_days = 2; + + // This flag denotes whether the retention policy of this BackupPlan is + // locked. If set to True, no further update is allowed on this policy, + // including the `locked` field itself. + // + // Default: False + bool locked = 3; + } + + // Defines scheduling parameters for automatically creating Backups + // via this BackupPlan. + message Schedule { + // A standard [cron](https://wikipedia.com/wiki/cron) string that defines a + // repeating schedule for creating Backups via this BackupPlan. If this is + // defined, then + // [backup_retain_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days] + // must also be defined. + // + // Default (empty): no automatic backup creation will occur. + string cron_schedule = 1; + + // This flag denotes whether automatic Backup creation is paused for this + // BackupPlan. + // + // Default: False + bool paused = 2; + } + + // BackupConfig defines the configuration of Backups created via this + // BackupPlan. + message BackupConfig { + // This defines the "scope" of the Backup - which namespaced + // resources in the cluster will be included in a Backup. + // Exactly one of the fields of backup_scope MUST be specified. + oneof backup_scope { + // If True, include all namespaced resources + bool all_namespaces = 1; + + // If set, include just the resources in the listed namespaces. + Namespaces selected_namespaces = 2; + + // If set, include just the resources referenced by the listed + // ProtectedApplications. + NamespacedNames selected_applications = 3; + } + + // This flag specifies whether volume data should be backed up when + // PVCs are included in the scope of a Backup. + // + // Default: False + bool include_volume_data = 4; + + // This flag specifies whether Kubernetes Secret resources should be + // included when they fall into the scope of Backups. + // + // Default: False + bool include_secrets = 5; + + // This defines a customer managed encryption key that will be used to + // encrypt the "config" portion (the Kubernetes resources) of Backups + // created via this plan. + // + // Default (empty): Config backup artifacts will not be encrypted. + EncryptionKey encryption_key = 6; + } + + // State + enum State { + // Default first value for Enums. + STATE_UNSPECIFIED = 0; + + // Waiting for cluster state to be RUNNING. + CLUSTER_PENDING = 1; + + // The BackupPlan is in the process of being created. + PROVISIONING = 2; + + // The BackupPlan has successfully been created and is ready for Backups. + READY = 3; + + // BackupPlan creation has failed. + FAILED = 4; + + // The BackupPlan has been deactivated. + DEACTIVATED = 5; + + // The BackupPlan is in the process of being deleted. + DELETING = 6; + } + + // Output only. The full name of the BackupPlan resource. + // Format: `projects/*/locations/*/backupPlans/*` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server generated global unique identifier of + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when this BackupPlan resource was created. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when this BackupPlan resource was last + // updated. + google.protobuf.Timestamp update_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User specified descriptive string for this BackupPlan. + string description = 5; + + // Required. Immutable. The source cluster from which Backups will be created + // via this BackupPlan. Valid formats: + // + // - `projects/*/locations/*/clusters/*` + // - `projects/*/zones/*/clusters/*` + string cluster = 6 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "container.googleapis.com/Cluster" + } + ]; + + // RetentionPolicy governs lifecycle of Backups created under this plan. + RetentionPolicy retention_policy = 7; + + // A set of custom labels supplied by user. + map labels = 8; + + // Defines a schedule for automatic Backup creation via this BackupPlan. + Schedule backup_schedule = 9; + + // Output only. `etag` is used for optimistic concurrency control as a way to + // help prevent simultaneous updates of a backup plan from overwriting each + // other. It is strongly suggested that systems make use of the 'etag' in the + // read-modify-write cycle to perform BackupPlan updates in order to avoid + // race conditions: An `etag` is returned in the response to `GetBackupPlan`, + // and systems are expected to put that etag in the request to + // `UpdateBackupPlan` or `DeleteBackupPlan` to ensure that their change + // will be applied to the same version of the resource. + string etag = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // This flag indicates whether this BackupPlan has been deactivated. + // Setting this field to True locks the BackupPlan such that no further + // updates will be allowed (except deletes), including the deactivated field + // itself. It also prevents any new Backups from being created via this + // BackupPlan (including scheduled Backups). + // + // Default: False + bool deactivated = 11; + + // Defines the configuration of Backups created via this BackupPlan. + BackupConfig backup_config = 12; + + // Output only. The number of Kubernetes Pods backed up in the + // last successful Backup created via this BackupPlan. + int32 protected_pod_count = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. State of the BackupPlan. This State field reflects the + // various stages a BackupPlan can be in + // during the Create operation. It will be set to "DEACTIVATED" + // if the BackupPlan is deactivated on an Update + State state = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable description of why BackupPlan is in the current + // `state` + string state_reason = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/common.proto b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/common.proto new file mode 100644 index 00000000000..7521d246832 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/common.proto @@ -0,0 +1,58 @@ +// 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 +// +// 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.gkebackup.v1; + +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.GkeBackup.V1"; +option go_package = "cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppb"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.cloud.gkebackup.v1"; +option php_namespace = "Google\\Cloud\\GkeBackup\\V1"; +option ruby_package = "Google::Cloud::GkeBackup::V1"; + +// A list of Kubernetes Namespaces +message Namespaces { + // A list of Kubernetes Namespaces + repeated string namespaces = 1; +} + +// A reference to a namespaced resource in Kubernetes. +message NamespacedName { + // The Namespace of the Kubernetes resource. + string namespace = 1; + + // The name of the Kubernetes resource. + string name = 2; +} + +// A list of namespaced Kubernetes resources. +message NamespacedNames { + // A list of namespaced Kubernetes resources. + repeated NamespacedName namespaced_names = 1; +} + +// Defined a customer managed encryption key that will be used to encrypt Backup +// artifacts. +message EncryptionKey { + // Google Cloud KMS encryption key. Format: + // `projects/*/locations/*/keyRings/*/cryptoKeys/*` + string gcp_kms_encryption_key = 1 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + }]; +} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/gkebackup.proto b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/gkebackup.proto new file mode 100644 index 00000000000..1a1bd10f5c4 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/gkebackup.proto @@ -0,0 +1,960 @@ +// 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 +// +// 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.gkebackup.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/gkebackup/v1/backup.proto"; +import "google/cloud/gkebackup/v1/backup_plan.proto"; +import "google/cloud/gkebackup/v1/restore.proto"; +import "google/cloud/gkebackup/v1/restore_plan.proto"; +import "google/cloud/gkebackup/v1/volume.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeBackup.V1"; +option go_package = "cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppb"; +option java_multiple_files = true; +option java_outer_classname = "GKEBackupProto"; +option java_package = "com.google.cloud.gkebackup.v1"; +option php_namespace = "Google\\Cloud\\GkeBackup\\V1"; +option ruby_package = "Google::Cloud::GkeBackup::V1"; +option (google.api.resource_definition) = { + type: "container.googleapis.com/Cluster" + pattern: "projects/{project}/locations/{location}/clusters/{cluster}" +}; +option (google.api.resource_definition) = { + type: "cloudkms.googleapis.com/CryptoKey" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" +}; + +// BackupForGKE allows Kubernetes administrators to configure, execute, and +// manage backup and restore operations for their GKE clusters. +service BackupForGKE { + option (google.api.default_host) = "gkebackup.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a new BackupPlan in a given location. + rpc CreateBackupPlan(CreateBackupPlanRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/backupPlans" + body: "backup_plan" + }; + option (google.api.method_signature) = "parent,backup_plan,backup_plan_id"; + option (google.longrunning.operation_info) = { + response_type: "BackupPlan" + metadata_type: "OperationMetadata" + }; + } + + // Lists BackupPlans in a given location. + rpc ListBackupPlans(ListBackupPlansRequest) + returns (ListBackupPlansResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/backupPlans" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieve the details of a single BackupPlan. + rpc GetBackupPlan(GetBackupPlanRequest) returns (BackupPlan) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/backupPlans/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Update a BackupPlan. + rpc UpdateBackupPlan(UpdateBackupPlanRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{backup_plan.name=projects/*/locations/*/backupPlans/*}" + body: "backup_plan" + }; + option (google.api.method_signature) = "backup_plan,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "BackupPlan" + metadata_type: "OperationMetadata" + }; + } + + // Deletes an existing BackupPlan. + rpc DeleteBackupPlan(DeleteBackupPlanRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/backupPlans/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Creates a Backup for the given BackupPlan. + rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/backupPlans/*}/backups" + body: "backup" + }; + option (google.api.method_signature) = "parent,backup,backup_id"; + option (google.longrunning.operation_info) = { + response_type: "Backup" + metadata_type: "OperationMetadata" + }; + } + + // Lists the Backups for a given BackupPlan. + rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/backupPlans/*}/backups" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieve the details of a single Backup. + rpc GetBackup(GetBackupRequest) returns (Backup) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/backupPlans/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Update a Backup. + rpc UpdateBackup(UpdateBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{backup.name=projects/*/locations/*/backupPlans/*/backups/*}" + body: "backup" + }; + option (google.api.method_signature) = "backup,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Backup" + metadata_type: "OperationMetadata" + }; + } + + // Deletes an existing Backup. + rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/backupPlans/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Lists the VolumeBackups for a given Backup. + rpc ListVolumeBackups(ListVolumeBackupsRequest) + returns (ListVolumeBackupsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/backupPlans/*/backups/*}/volumeBackups" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieve the details of a single VolumeBackup. + rpc GetVolumeBackup(GetVolumeBackupRequest) returns (VolumeBackup) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new RestorePlan in a given location. + rpc CreateRestorePlan(CreateRestorePlanRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/restorePlans" + body: "restore_plan" + }; + option (google.api.method_signature) = + "parent,restore_plan,restore_plan_id"; + option (google.longrunning.operation_info) = { + response_type: "RestorePlan" + metadata_type: "OperationMetadata" + }; + } + + // Lists RestorePlans in a given location. + rpc ListRestorePlans(ListRestorePlansRequest) + returns (ListRestorePlansResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/restorePlans" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieve the details of a single RestorePlan. + rpc GetRestorePlan(GetRestorePlanRequest) returns (RestorePlan) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/restorePlans/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Update a RestorePlan. + rpc UpdateRestorePlan(UpdateRestorePlanRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{restore_plan.name=projects/*/locations/*/restorePlans/*}" + body: "restore_plan" + }; + option (google.api.method_signature) = "restore_plan,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "RestorePlan" + metadata_type: "OperationMetadata" + }; + } + + // Deletes an existing RestorePlan. + rpc DeleteRestorePlan(DeleteRestorePlanRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/restorePlans/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Creates a new Restore for the given RestorePlan. + rpc CreateRestore(CreateRestoreRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/restorePlans/*}/restores" + body: "restore" + }; + option (google.api.method_signature) = "parent,restore,restore_id"; + option (google.longrunning.operation_info) = { + response_type: "Restore" + metadata_type: "OperationMetadata" + }; + } + + // Lists the Restores for a given RestorePlan. + rpc ListRestores(ListRestoresRequest) returns (ListRestoresResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/restorePlans/*}/restores" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the details of a single Restore. + rpc GetRestore(GetRestoreRequest) returns (Restore) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/restorePlans/*/restores/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Update a Restore. + rpc UpdateRestore(UpdateRestoreRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{restore.name=projects/*/locations/*/restorePlans/*/restores/*}" + body: "restore" + }; + option (google.api.method_signature) = "restore,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Restore" + metadata_type: "OperationMetadata" + }; + } + + // Deletes an existing Restore. + rpc DeleteRestore(DeleteRestoreRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/restorePlans/*/restores/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Lists the VolumeRestores for a given Restore. + rpc ListVolumeRestores(ListVolumeRestoresRequest) + returns (ListVolumeRestoresResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/restorePlans/*/restores/*}/volumeRestores" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieve the details of a single VolumeRestore. + rpc GetVolumeRestore(GetVolumeRestoreRequest) returns (VolumeRestore) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a + // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + // `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for CreateBackupPlan. +message CreateBackupPlanRequest { + // Required. The location within which to create the BackupPlan. + // Format: `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The BackupPlan resource object to create. + BackupPlan backup_plan = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The client-provided short name for the BackupPlan resource. + // This name must: + // + // - be between 1 and 63 characters long (inclusive) + // - consist of only lower-case ASCII letters, numbers, and dashes + // - start with a lower-case letter + // - end with a lower-case letter or number + // - be unique within the set of BackupPlans in this location + string backup_plan_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for ListBackupPlans. +message ListBackupPlansRequest { + // Required. The location that contains the BackupPlans to list. + // Format: `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The target number of results to return in a single response. + // If not specified, a default value will be chosen by the service. + // Note that the response may inclue a partial list and a caller should + // only rely on the response's + // [next_page_token][google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token] + // to determine if there are more instances left to be queried. + int32 page_size = 2; + + // The value of + // [next_page_token][google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token] + // received from a previous `ListBackupPlans` call. + // Provide this to retrieve the subsequent page in a multi-page list of + // results. When paginating, all other parameters provided to + // `ListBackupPlans` must match the call that provided the page token. + string page_token = 3; + + // Field match expression used to filter the results. + string filter = 4; + + // Field by which to sort the results. + string order_by = 5; +} + +// Response message for ListBackupPlans. +message ListBackupPlansResponse { + // The list of BackupPlans matching the given criteria. + repeated BackupPlan backup_plans = 1; + + // A token which may be sent as + // [page_token][google.cloud.gkebackup.v1.ListBackupPlansRequest.page_token] + // in a subsequent `ListBackupPlans` call to retrieve the next page of + // results. If this field is omitted or empty, then there are no more results + // to return. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for GetBackupPlan. +message GetBackupPlanRequest { + // Required. Fully qualified BackupPlan name. + // Format: `projects/*/locations/*/backupPlans/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/BackupPlan" + } + ]; +} + +// Request message for UpdateBackupPlan. +message UpdateBackupPlanRequest { + // Required. A new version of the BackupPlan resource that contains updated + // fields. This may be sparsely populated if an `update_mask` is provided. + BackupPlan backup_plan = 1 [(google.api.field_behavior) = REQUIRED]; + + // This is used to specify the fields to be overwritten in the + // BackupPlan targeted for update. The values for each of these + // updated fields will be taken from the `backup_plan` provided + // with this request. Field names are relative to the root of the resource + // (e.g., `description`, `backup_config.include_volume_data`, etc.) + // If no `update_mask` is provided, all fields in `backup_plan` will be + // written to the target BackupPlan resource. + // Note that OUTPUT_ONLY and IMMUTABLE fields in `backup_plan` are ignored + // and are not used to update the target BackupPlan. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for DeleteBackupPlan. +message DeleteBackupPlanRequest { + // Required. Fully qualified BackupPlan name. + // Format: `projects/*/locations/*/backupPlans/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/BackupPlan" + } + ]; + + // If provided, this value must match the current value of the + // target BackupPlan's [etag][google.cloud.gkebackup.v1.BackupPlan.etag] field + // or the request is rejected. + string etag = 2; +} + +// Request message for CreateBackup. +message CreateBackupRequest { + // Required. The BackupPlan within which to create the Backup. + // Format: `projects/*/locations/*/backupPlans/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/BackupPlan" + } + ]; + + // The Backup resource to create. + Backup backup = 2; + + // The client-provided short name for the Backup resource. + // This name must: + // + // - be between 1 and 63 characters long (inclusive) + // - consist of only lower-case ASCII letters, numbers, and dashes + // - start with a lower-case letter + // - end with a lower-case letter or number + // - be unique within the set of Backups in this BackupPlan + string backup_id = 3; +} + +// Request message for ListBackups. +message ListBackupsRequest { + // Required. The BackupPlan that contains the Backups to list. + // Format: `projects/*/locations/*/backupPlans/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/BackupPlan" + } + ]; + + // The target number of results to return in a single response. + // If not specified, a default value will be chosen by the service. + // Note that the response may inclue a partial list and a caller should + // only rely on the response's + // [next_page_token][google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token] + // to determine if there are more instances left to be queried. + int32 page_size = 2; + + // The value of + // [next_page_token][google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token] + // received from a previous `ListBackups` call. + // Provide this to retrieve the subsequent page in a multi-page list of + // results. When paginating, all other parameters provided to + // `ListBackups` must match the call that provided the page token. + string page_token = 3; + + // Field match expression used to filter the results. + string filter = 4; + + // Field by which to sort the results. + string order_by = 5; +} + +// Response message for ListBackups. +message ListBackupsResponse { + // The list of Backups matching the given criteria. + repeated Backup backups = 1; + + // A token which may be sent as + // [page_token][google.cloud.gkebackup.v1.ListBackupsRequest.page_token] in a + // subsequent `ListBackups` call to retrieve the next page of results. If this + // field is omitted or empty, then there are no more results to return. + string next_page_token = 2; +} + +// Request message for GetBackup. +message GetBackupRequest { + // Required. Full name of the Backup resource. + // Format: `projects/*/locations/*/backupPlans/*/backups/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/Backup" + } + ]; +} + +// Request message for UpdateBackup. +message UpdateBackupRequest { + // Required. A new version of the Backup resource that contains updated + // fields. This may be sparsely populated if an `update_mask` is provided. + Backup backup = 1 [(google.api.field_behavior) = REQUIRED]; + + // This is used to specify the fields to be overwritten in the + // Backup targeted for update. The values for each of these + // updated fields will be taken from the `backup_plan` provided + // with this request. Field names are relative to the root of the resource. + // If no `update_mask` is provided, all fields in `backup` will be + // written to the target Backup resource. + // Note that OUTPUT_ONLY and IMMUTABLE fields in `backup` are ignored + // and are not used to update the target Backup. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for DeleteBackup. +message DeleteBackupRequest { + // Required. Name of the Backup resource. + // Format: `projects/*/locations/*/backupPlans/*/backups/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/Backup" + } + ]; + + // If provided, this value must match the current value of the + // target Backup's [etag][google.cloud.gkebackup.v1.Backup.etag] field or the + // request is rejected. + string etag = 2; + + // If set to true, any VolumeBackups below this Backup will also be deleted. + // Otherwise, the request will only succeed if the Backup has no + // VolumeBackups. + bool force = 3; +} + +// Request message for ListVolumeBackups. +message ListVolumeBackupsRequest { + // Required. The Backup that contains the VolumeBackups to list. + // Format: `projects/*/locations/*/backupPlans/*/backups/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/Backup" + } + ]; + + // The target number of results to return in a single response. + // If not specified, a default value will be chosen by the service. + // Note that the response may inclue a partial list and a caller should + // only rely on the response's + // [next_page_token][google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token] + // to determine if there are more instances left to be queried. + int32 page_size = 2; + + // The value of + // [next_page_token][google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token] + // received from a previous `ListVolumeBackups` call. + // Provide this to retrieve the subsequent page in a multi-page list of + // results. When paginating, all other parameters provided to + // `ListVolumeBackups` must match the call that provided the page token. + string page_token = 3; + + // Field match expression used to filter the results. + string filter = 4; + + // Field by which to sort the results. + string order_by = 5; +} + +// Response message for ListVolumeBackups. +message ListVolumeBackupsResponse { + // The list of VolumeBackups matching the given criteria. + repeated VolumeBackup volume_backups = 1; + + // A token which may be sent as + // [page_token][google.cloud.gkebackup.v1.ListVolumeBackupsRequest.page_token] + // in a subsequent `ListVolumeBackups` call to retrieve the next page of + // results. If this field is omitted or empty, then there are no more results + // to return. + string next_page_token = 2; +} + +// Request message for GetVolumeBackup. +message GetVolumeBackupRequest { + // Required. Full name of the VolumeBackup resource. + // Format: `projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/VolumeBackup" + } + ]; +} + +// Request message for CreateRestorePlan. +message CreateRestorePlanRequest { + // Required. The location within which to create the RestorePlan. + // Format: `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The RestorePlan resource object to create. + RestorePlan restore_plan = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The client-provided short name for the RestorePlan resource. + // This name must: + // + // - be between 1 and 63 characters long (inclusive) + // - consist of only lower-case ASCII letters, numbers, and dashes + // - start with a lower-case letter + // - end with a lower-case letter or number + // - be unique within the set of RestorePlans in this location + string restore_plan_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for ListRestorePlans. +message ListRestorePlansRequest { + // Required. The location that contains the RestorePlans to list. + // Format: `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The target number of results to return in a single response. + // If not specified, a default value will be chosen by the service. + // Note that the response may inclue a partial list and a caller should + // only rely on the response's + // [next_page_token][google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token] + // to determine if there are more instances left to be queried. + int32 page_size = 2; + + // The value of + // [next_page_token][google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token] + // received from a previous `ListRestorePlans` call. + // Provide this to retrieve the subsequent page in a multi-page list of + // results. When paginating, all other parameters provided to + // `ListRestorePlans` must match the call that provided the page token. + string page_token = 3; + + // Field match expression used to filter the results. + string filter = 4; + + // Field by which to sort the results. + string order_by = 5; +} + +// Response message for ListRestorePlans. +message ListRestorePlansResponse { + // The list of RestorePlans matching the given criteria. + repeated RestorePlan restore_plans = 1; + + // A token which may be sent as + // [page_token][google.cloud.gkebackup.v1.ListRestorePlansRequest.page_token] + // in a subsequent `ListRestorePlans` call to retrieve the next page of + // results. If this field is omitted or empty, then there are no more results + // to return. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for GetRestorePlan. +message GetRestorePlanRequest { + // Required. Fully qualified RestorePlan name. + // Format: `projects/*/locations/*/restorePlans/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/RestorePlan" + } + ]; +} + +// Request message for UpdateRestorePlan. +message UpdateRestorePlanRequest { + // Required. A new version of the RestorePlan resource that contains updated + // fields. This may be sparsely populated if an `update_mask` is provided. + RestorePlan restore_plan = 1 [(google.api.field_behavior) = REQUIRED]; + + // This is used to specify the fields to be overwritten in the + // RestorePlan targeted for update. The values for each of these + // updated fields will be taken from the `restore_plan` provided + // with this request. Field names are relative to the root of the resource. + // If no `update_mask` is provided, all fields in `restore_plan` will be + // written to the target RestorePlan resource. + // Note that OUTPUT_ONLY and IMMUTABLE fields in `restore_plan` are ignored + // and are not used to update the target RestorePlan. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for DeleteRestorePlan. +message DeleteRestorePlanRequest { + // Required. Fully qualified RestorePlan name. + // Format: `projects/*/locations/*/restorePlans/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/RestorePlan" + } + ]; + + // If provided, this value must match the current value of the + // target RestorePlan's [etag][google.cloud.gkebackup.v1.RestorePlan.etag] + // field or the request is rejected. + string etag = 2; + + // If set to true, any Restores below this RestorePlan will also be deleted. + // Otherwise, the request will only succeed if the RestorePlan has no + // Restores. + bool force = 3; +} + +// Request message for CreateRestore. +message CreateRestoreRequest { + // Required. The RestorePlan within which to create the Restore. + // Format: `projects/*/locations/*/restorePlans/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/RestorePlan" + } + ]; + + // Required. The restore resource to create. + Restore restore = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The client-provided short name for the Restore resource. + // This name must: + // + // - be between 1 and 63 characters long (inclusive) + // - consist of only lower-case ASCII letters, numbers, and dashes + // - start with a lower-case letter + // - end with a lower-case letter or number + // - be unique within the set of Restores in this RestorePlan. + string restore_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for ListRestores. +message ListRestoresRequest { + // Required. The RestorePlan that contains the Restores to list. + // Format: `projects/*/locations/*/restorePlans/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/RestorePlan" + } + ]; + + // The target number of results to return in a single response. + // If not specified, a default value will be chosen by the service. + // Note that the response may inclue a partial list and a caller should + // only rely on the response's + // [next_page_token][google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token] + // to determine if there are more instances left to be queried. + int32 page_size = 2; + + // The value of + // [next_page_token][google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token] + // received from a previous `ListRestores` call. + // Provide this to retrieve the subsequent page in a multi-page list of + // results. When paginating, all other parameters provided to `ListRestores` + // must match the call that provided the page token. + string page_token = 3; + + // Field match expression used to filter the results. + string filter = 4; + + // Field by which to sort the results. + string order_by = 5; +} + +// Response message for ListRestores. +message ListRestoresResponse { + // The list of Restores matching the given criteria. + repeated Restore restores = 1; + + // A token which may be sent as + // [page_token][google.cloud.gkebackup.v1.ListRestoresRequest.page_token] in a + // subsequent `ListRestores` call to retrieve the next page of results. If + // this field is omitted or empty, then there are no more results to return. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for GetRestore. +message GetRestoreRequest { + // Required. Name of the restore resource. + // Format: `projects/*/locations/*/restorePlans/*/restores/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/Restore" + } + ]; +} + +// Request message for UpdateRestore. +message UpdateRestoreRequest { + // Required. A new version of the Restore resource that contains updated + // fields. This may be sparsely populated if an `update_mask` is provided. + Restore restore = 1 [(google.api.field_behavior) = REQUIRED]; + + // This is used to specify the fields to be overwritten in the + // Restore targeted for update. The values for each of these + // updated fields will be taken from the `restore` provided + // with this request. Field names are relative to the root of the resource. + // If no `update_mask` is provided, all fields in `restore` will be + // written to the target Restore resource. + // Note that OUTPUT_ONLY and IMMUTABLE fields in `restore` are ignored + // and are not used to update the target Restore. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for DeleteRestore. +message DeleteRestoreRequest { + // Required. Full name of the Restore + // Format: `projects/*/locations/*/restorePlans/*/restores/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/Restore" + } + ]; + + // If provided, this value must match the current value of the + // target Restore's [etag][google.cloud.gkebackup.v1.Restore.etag] field or + // the request is rejected. + string etag = 2; + + // If set to true, any VolumeRestores below this restore will also be deleted. + // Otherwise, the request will only succeed if the restore has no + // VolumeRestores. + bool force = 3; +} + +// Request message for ListVolumeRestores. +message ListVolumeRestoresRequest { + // Required. The Restore that contains the VolumeRestores to list. + // Format: `projects/*/locations/*/restorePlans/*/restores/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/Restore" + } + ]; + + // The target number of results to return in a single response. + // If not specified, a default value will be chosen by the service. + // Note that the response may inclue a partial list and a caller should + // only rely on the response's + // [next_page_token][google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token] + // to determine if there are more instances left to be queried. + int32 page_size = 2; + + // The value of + // [next_page_token][google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token] + // received from a previous `ListVolumeRestores` call. + // Provide this to retrieve the subsequent page in a multi-page list of + // results. When paginating, all other parameters provided to + // `ListVolumeRestores` must match the call that provided the page token. + string page_token = 3; + + // Field match expression used to filter the results. + string filter = 4; + + // Field by which to sort the results. + string order_by = 5; +} + +// Response message for ListVolumeRestores. +message ListVolumeRestoresResponse { + // The list of VolumeRestores matching the given criteria. + repeated VolumeRestore volume_restores = 1; + + // A token which may be sent as + // [page_token][google.cloud.gkebackup.v1.ListVolumeRestoresRequest.page_token] + // in a subsequent `ListVolumeRestores` call to retrieve the next page of + // results. If this field is omitted or empty, then there are no more results + // to return. + string next_page_token = 2; +} + +// Request message for GetVolumeRestore. +message GetVolumeRestoreRequest { + // Required. Full name of the VolumeRestore resource. + // Format: `projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/VolumeRestore" + } + ]; +} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/restore.proto b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/restore.proto new file mode 100644 index 00000000000..968b4f447d9 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/restore.proto @@ -0,0 +1,494 @@ +// 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 +// +// 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.gkebackup.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/gkebackup/v1/common.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeBackup.V1"; +option go_package = "cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppb"; +option java_multiple_files = true; +option java_outer_classname = "RestoreProto"; +option java_package = "com.google.cloud.gkebackup.v1"; +option php_namespace = "Google\\Cloud\\GkeBackup\\V1"; +option ruby_package = "Google::Cloud::GkeBackup::V1"; + +// Represents both a request to Restore some portion of a Backup into +// a target GKE cluster and a record of the restore operation itself. +// Next id: 18 +message Restore { + option (google.api.resource) = { + type: "gkebackup.googleapis.com/Restore" + pattern: "projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore}" + }; + + // Possible values for state of the Restore. + enum State { + // The Restore resource is in the process of being created. + STATE_UNSPECIFIED = 0; + + // The Restore resource has been created and the associated RestoreJob + // Kubernetes resource has been injected into target cluster. + CREATING = 1; + + // The gkebackup agent in the cluster has begun executing the restore + // operation. + IN_PROGRESS = 2; + + // The restore operation has completed successfully. Restored workloads may + // not yet be operational. + SUCCEEDED = 3; + + // The restore operation has failed. + FAILED = 4; + + // This Restore resource is in the process of being deleted. + DELETING = 5; + } + + // Output only. The full name of the Restore resource. + // Format: `projects/*/locations/*/restorePlans/*/restores/*` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server generated global unique identifier of + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when this Restore resource was created. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when this Restore resource was last + // updated. + google.protobuf.Timestamp update_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User specified descriptive string for this Restore. + string description = 5; + + // Required. Immutable. A reference to the + // [Backup][google.cloud.gkebackup.v1.Backup] used as the source from which + // this Restore will restore. Note that this Backup must be a sub-resource of + // the RestorePlan's + // [backup_plan][google.cloud.gkebackup.v1.RestorePlan.backup_plan]. Format: + // `projects/*/locations/*/backupPlans/*/backups/*`. + string backup = 6 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/Backup" + } + ]; + + // Output only. The target cluster into which this Restore will restore data. + // Valid formats: + // + // - `projects/*/locations/*/clusters/*` + // - `projects/*/zones/*/clusters/*` + // + // Inherited from parent RestorePlan's + // [cluster][google.cloud.gkebackup.v1.RestorePlan.cluster] value. + string cluster = 7 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "container.googleapis.com/Cluster" + } + ]; + + // Output only. Configuration of the Restore. Inherited from parent + // RestorePlan's + // [restore_config][google.cloud.gkebackup.v1.RestorePlan.restore_config]. + RestoreConfig restore_config = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A set of custom labels supplied by user. + map labels = 9; + + // Output only. The current state of the Restore. + State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable description of why the Restore is in its + // current state. + string state_reason = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp of when the restore operation completed. + google.protobuf.Timestamp complete_time = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Number of resources restored during the restore execution. + int32 resources_restored_count = 13 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Number of resources excluded during the restore execution. + int32 resources_excluded_count = 14 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Number of resources that failed to be restored during the + // restore execution. + int32 resources_failed_count = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Number of volumes restored during the restore execution. + int32 volumes_restored_count = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. `etag` is used for optimistic concurrency control as a way to + // help prevent simultaneous updates of a restore from overwriting each other. + // It is strongly suggested that systems make use of the `etag` in the + // read-modify-write cycle to perform restore updates in order to avoid + // race conditions: An `etag` is returned in the response to `GetRestore`, + // and systems are expected to put that etag in the request to + // `UpdateRestore` or `DeleteRestore` to ensure that their change will be + // applied to the same version of the resource. + string etag = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Configuration of a restore. +// Next id: 12 +message RestoreConfig { + // Defines how volume data should be restored. + enum VolumeDataRestorePolicy { + // Unspecified (illegal). + VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED = 0; + + // For each PVC to be restored, create a new underlying volume and PV + // from the corresponding VolumeBackup contained within the Backup. + RESTORE_VOLUME_DATA_FROM_BACKUP = 1; + + // For each PVC to be restored, attempt to reuse the original PV contained + // in the Backup (with its original underlying volume). This option + // is likely only usable when restoring a workload to its original cluster. + REUSE_VOLUME_HANDLE_FROM_BACKUP = 2; + + // For each PVC to be restored, create PVC without any particular + // action to restore data. In this case, the normal Kubernetes provisioning + // logic would kick in, and this would likely result in either dynamically + // provisioning blank PVs or binding to statically provisioned PVs. + NO_VOLUME_DATA_RESTORATION = 3; + } + + // Defines the behavior for handling the situation where cluster-scoped + // resources being restored already exist in the target cluster. + enum ClusterResourceConflictPolicy { + // Unspecified. Only allowed if no cluster-scoped resources will be + // restored. + CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED = 0; + + // Do not attempt to restore the conflicting resource. + USE_EXISTING_VERSION = 1; + + // Delete the existing version before re-creating it from the Backup. + // This is a dangerous option which could cause unintentional + // data loss if used inappropriately. For example, deleting a CRD will + // cause Kubernetes to delete all CRs of that type. + USE_BACKUP_VERSION = 2; + } + + // Defines the behavior for handling the situation where sets of namespaced + // resources being restored already exist in the target cluster. + enum NamespacedResourceRestoreMode { + // Unspecified (invalid). + NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED = 0; + + // When conflicting top-level resources (either Namespaces or + // ProtectedApplications, depending upon the scope) are encountered, this + // will first trigger a delete of the conflicting resource AND ALL OF ITS + // REFERENCED RESOURCES (e.g., all resources in the Namespace or all + // resources referenced by the ProtectedApplication) before restoring the + // resources from the Backup. This mode should only be used when you are + // intending to revert some portion of a cluster to an earlier state. + DELETE_AND_RESTORE = 1; + + // If conflicting top-level resources (either Namespaces or + // ProtectedApplications, depending upon the scope) are encountered at the + // beginning of a restore process, the Restore will fail. If a conflict + // occurs during the restore process itself (e.g., because an out of band + // process creates conflicting resources), a conflict will be reported. + FAIL_ON_CONFLICT = 2; + } + + // This is a direct map to the Kubernetes GroupKind type + // [GroupKind](https://godoc.org/k8s.io/apimachinery/pkg/runtime/schema#GroupKind) + // and is used for identifying specific "types" of resources to restore. + message GroupKind { + // API group string of a Kubernetes resource, e.g. + // "apiextensions.k8s.io", "storage.k8s.io", etc. + // Note: use empty string for core API group + string resource_group = 1; + + // Kind of a Kubernetes resource, e.g. + // "CustomResourceDefinition", "StorageClass", etc. + string resource_kind = 2; + } + + // Defines the scope of cluster-scoped resources to restore. + // + // Some group kinds are not reasonable choices for a restore, and will cause + // an error if selected here. Any scope selection that would restore + // "all valid" resources automatically excludes these group kinds. + // - gkebackup.gke.io/BackupJob + // - gkebackup.gke.io/RestoreJob + // - metrics.k8s.io/NodeMetrics + // - migration.k8s.io/StorageState + // - migration.k8s.io/StorageVersionMigration + // - Node + // - snapshot.storage.k8s.io/VolumeSnapshotContent + // - storage.k8s.io/CSINode + // + // Some group kinds are driven by restore configuration elsewhere, + // and will cause an error if selected here. + // - Namespace + // - PersistentVolume + message ClusterResourceRestoreScope { + // A list of cluster-scoped resource group kinds to restore from the + // backup. If specified, only the selected resources will be restored. + // Mutually exclusive to any other field in the message. + repeated GroupKind selected_group_kinds = 1; + + // A list of cluster-scoped resource group kinds to NOT restore from the + // backup. If specified, all valid cluster-scoped resources will be + // restored except for those specified in the list. + // Mutually exclusive to any other field in the message. + repeated GroupKind excluded_group_kinds = 2; + + // If True, all valid cluster-scoped resources will be restored. + // Mutually exclusive to any other field in the message. + bool all_group_kinds = 3; + + // If True, no cluster-scoped resources will be restored. + // This has the same restore scope as if the message is not defined. + // Mutually exclusive to any other field in the message. + bool no_group_kinds = 4; + } + + // A transformation rule to be applied against Kubernetes resources as they + // are selected for restoration from a Backup. A rule contains both filtering + // logic (which resources are subject to substitution) and substitution logic. + message SubstitutionRule { + // (Filtering parameter) Any resource subject to substitution must be + // contained within one of the listed Kubernetes Namespace in the Backup. + // If this field is not provided, no namespace filtering will be performed + // (all resources in all Namespaces, including all cluster-scoped resources, + // will be candidates for substitution). + // To mix cluster-scoped and namespaced resources in the same rule, use an + // empty string ("") as one of the target namespaces. + repeated string target_namespaces = 1; + + // (Filtering parameter) Any resource subject to substitution must belong to + // one of the listed "types". + // If this field is not provided, no type filtering will be performed (all + // resources of all types matching previous filtering parameters will be + // candidates for substitution). + repeated GroupKind target_group_kinds = 2; + + // Required. This is a [JSONPath] + // (https://kubernetes.io/docs/reference/kubectl/jsonpath/) + // expression that matches specific fields of candidate + // resources and it operates as both a filtering parameter (resources that + // are not matched with this expression will not be candidates for + // substitution) as well as a field identifier (identifies exactly which + // fields out of the candidate resources will be modified). + string target_json_path = 3 [(google.api.field_behavior) = REQUIRED]; + + // (Filtering parameter) This is a [regular expression] + // (https://en.wikipedia.org/wiki/Regular_expression) + // that is compared against the fields matched by the target_json_path + // expression (and must also have passed the previous filters). + // Substitution will not be performed against fields whose + // value does not match this expression. If this field is NOT specified, + // then ALL fields matched by the target_json_path expression will undergo + // substitution. Note that an empty (e.g., "", rather than unspecified) + // value for this field will only match empty fields. + string original_value_pattern = 4; + + // This is the new value to set for any fields that pass the filtering and + // selection criteria. To remove a value from a Kubernetes resource, either + // leave this field unspecified, or set it to the empty string (""). + string new_value = 5; + } + + // TransformationRuleAction defines a TransformationRule action based on the + // JSON Patch RFC (https://www.rfc-editor.org/rfc/rfc6902) + message TransformationRuleAction { + // Possible values for operations of a transformation rule action. + enum Op { + // Unspecified operation + OP_UNSPECIFIED = 0; + + // The "remove" operation removes the value at the target location. + REMOVE = 1; + + // The "move" operation removes the value at a specified location and + // adds it to the target location. + MOVE = 2; + + // The "copy" operation copies the value at a specified location to the + // target location. + COPY = 3; + + // The "add" operation performs one of the following functions, + // depending upon what the target location references: + // 1. If the target location specifies an array index, a new value is + // inserted into the array at the specified index. + // 2. If the target location specifies an object member that does not + // already exist, a new member is added to the object. + // 3. If the target location specifies an object member that does exist, + // that member's value is replaced. + ADD = 4; + + // The "test" operation tests that a value at the target location is + // equal to a specified value. + TEST = 5; + + // The "replace" operation replaces the value at the target location + // with a new value. The operation object MUST contain a "value" member + // whose content specifies the replacement value. + REPLACE = 6; + } + + // Required. op specifies the operation to perform. + Op op = 1 [(google.api.field_behavior) = REQUIRED]; + + // A string containing a JSON Pointer value that references the location in + // the target document to move the value from. + string from_path = 2; + + // A string containing a JSON-Pointer value that references a location + // within the target document where the operation is performed. + string path = 3; + + // A string that specifies the desired value in string format to + // use for transformation. + string value = 4; + } + + // ResourceFilter specifies matching criteria to limit the scope of a + // change to a specific set of kubernetes resources that are selected for + // restoration from a backup. + message ResourceFilter { + // (Filtering parameter) Any resource subject to transformation must be + // contained within one of the listed Kubernetes Namespace in the Backup. + // If this field is not provided, no namespace filtering will be performed + // (all resources in all Namespaces, including all cluster-scoped resources, + // will be candidates for transformation). + // To mix cluster-scoped and namespaced resources in the same rule, use an + // empty string ("") as one of the target namespaces. + repeated string namespaces = 1; + + // (Filtering parameter) Any resource subject to transformation must belong + // to one of the listed "types". If this field is not provided, no type + // filtering will be performed (all resources of all types matching previous + // filtering parameters will be candidates for transformation). + repeated GroupKind group_kinds = 2; + + // This is a [JSONPath] + // (https://github.com/json-path/JsonPath/blob/master/README.md) + // expression that matches specific fields of candidate + // resources and it operates as a filtering parameter (resources that + // are not matched with this expression will not be candidates for + // transformation). + string json_path = 3; + } + + // A transformation rule to be applied against Kubernetes resources as they + // are selected for restoration from a Backup. A rule contains both filtering + // logic (which resources are subject to transform) and transformation logic. + message TransformationRule { + // Required. A list of transformation rule actions to take against candidate + // resources. Actions are executed in order defined - this order matters, as + // they could potentially interfere with each other and the first operation + // could affect the outcome of the second operation. + repeated TransformationRuleAction field_actions = 1 + [(google.api.field_behavior) = REQUIRED]; + + // This field is used to specify a set of fields that should be used to + // determine which resources in backup should be acted upon by the supplied + // transformation rule actions, and this will ensure that only specific + // resources are affected by transformation rule actions. + ResourceFilter resource_filter = 2; + + // The description is a user specified string description of the + // transformation rule. + string description = 3; + } + + // Specifies the mechanism to be used to restore volume data. + // Default: VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED (will be treated as + // NO_VOLUME_DATA_RESTORATION). + VolumeDataRestorePolicy volume_data_restore_policy = 1; + + // Defines the behavior for handling the situation where cluster-scoped + // resources being restored already exist in the target cluster. This MUST be + // set to a value other than CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED if + // [cluster_resource_restore_scope][google.cloud.gkebackup.v1.RestoreConfig.cluster_resource_restore_scope] + // is not empty. + ClusterResourceConflictPolicy cluster_resource_conflict_policy = 2; + + // Defines the behavior for handling the situation where sets of namespaced + // resources being restored already exist in the target cluster. This MUST be + // set to a value other than NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED. + NamespacedResourceRestoreMode namespaced_resource_restore_mode = 3; + + // Identifies the cluster-scoped resources to restore from the Backup. + // Not specifying it means NO cluster resource will be restored. + ClusterResourceRestoreScope cluster_resource_restore_scope = 4; + + // Specifies the namespaced resources to restore from the Backup. + // Only one of the entries may be specified. If not specified, NO namespaced + // resources will be restored. + // + // Note: Resources will never be restored into *managed* namespaces such as + // `kube-system`, `kube-public`, or `kube-node-lease`. These namespaces + // are silently skipped when + // [all_namespaces][google.cloud.gkebackup.v1.RestoreConfig.all_namespaces] is + // selected. Listing them explicitly will result in an error. + oneof namespaced_resource_restore_scope { + // Restore all namespaced resources in the Backup if set to "True". + // Specifying this field to "False" is an error. + bool all_namespaces = 5; + + // A list of selected Namespaces to restore from the Backup. The listed + // Namespaces and all resources contained in them will be restored. + Namespaces selected_namespaces = 6; + + // A list of selected ProtectedApplications to restore. The listed + // ProtectedApplications and all the resources to which they refer will be + // restored. + NamespacedNames selected_applications = 7; + + // Do not restore any namespaced resources if set to "True". + // Specifying this field to "False" is not allowed. + bool no_namespaces = 9; + + // A list of selected namespaces excluded from restoration. All + // namespaces except those in this list will be restored. + Namespaces excluded_namespaces = 10; + } + + // A list of transformation rules to be applied against Kubernetes resources + // as they are selected for restoration from a Backup. Rules are executed in + // order defined - this order matters, as changes made by a rule may impact + // the filtering logic of subsequent rules. An empty list means no + // substitution will occur. + repeated SubstitutionRule substitution_rules = 8; + + // A list of transformation rules to be applied against Kubernetes resources + // as they are selected for restoration from a Backup. Rules are executed in + // order defined - this order matters, as changes made by a rule may impact + // the filtering logic of subsequent rules. An empty list means no + // transformation will occur. + repeated TransformationRule transformation_rules = 11; +} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/restore_plan.proto b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/restore_plan.proto new file mode 100644 index 00000000000..117412190ca --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/restore_plan.proto @@ -0,0 +1,130 @@ +// 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 +// +// 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.gkebackup.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/gkebackup/v1/restore.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeBackup.V1"; +option go_package = "cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppb"; +option java_multiple_files = true; +option java_outer_classname = "RestorePlanProto"; +option java_package = "com.google.cloud.gkebackup.v1"; +option php_namespace = "Google\\Cloud\\GkeBackup\\V1"; +option ruby_package = "Google::Cloud::GkeBackup::V1"; + +// The configuration of a potential series of Restore operations to be performed +// against Backups belong to a particular BackupPlan. +// Next id: 13 +message RestorePlan { + option (google.api.resource) = { + type: "gkebackup.googleapis.com/RestorePlan" + pattern: "projects/{project}/locations/{location}/restorePlans/{restore_plan}" + }; + + // State + enum State { + // Default first value for Enums. + STATE_UNSPECIFIED = 0; + + // Waiting for cluster state to be RUNNING. + CLUSTER_PENDING = 1; + + // The RestorePlan has successfully been created and is ready for Restores. + READY = 2; + + // RestorePlan creation has failed. + FAILED = 3; + + // The RestorePlan is in the process of being deleted. + DELETING = 4; + } + + // Output only. The full name of the RestorePlan resource. + // Format: `projects/*/locations/*/restorePlans/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server generated global unique identifier of + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when this RestorePlan resource was + // created. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when this RestorePlan resource was last + // updated. + google.protobuf.Timestamp update_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User specified descriptive string for this RestorePlan. + string description = 5; + + // Required. Immutable. A reference to the + // [BackupPlan][google.cloud.gkebackup.v1.BackupPlan] from which Backups may + // be used as the source for Restores created via this RestorePlan. Format: + // `projects/*/locations/*/backupPlans/*`. + string backup_plan = 6 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkebackup.googleapis.com/BackupPlan" + } + ]; + + // Required. Immutable. The target cluster into which Restores created via + // this RestorePlan will restore data. NOTE: the cluster's region must be the + // same as the RestorePlan. Valid formats: + // + // - `projects/*/locations/*/clusters/*` + // - `projects/*/zones/*/clusters/*` + string cluster = 7 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "container.googleapis.com/Cluster" + } + ]; + + // Required. Configuration of Restores created via this RestorePlan. + RestoreConfig restore_config = 8 [(google.api.field_behavior) = REQUIRED]; + + // A set of custom labels supplied by user. + map labels = 9; + + // Output only. `etag` is used for optimistic concurrency control as a way to + // help prevent simultaneous updates of a restore from overwriting each other. + // It is strongly suggested that systems make use of the `etag` in the + // read-modify-write cycle to perform restore updates in order to avoid + // race conditions: An `etag` is returned in the response to `GetRestorePlan`, + // and systems are expected to put that etag in the request to + // `UpdateRestorePlan` or `DeleteRestorePlan` to ensure that their change + // will be applied to the same version of the resource. + string etag = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. State of the RestorePlan. This State field reflects the + // various stages a RestorePlan can be in + // during the Create operation. + State state = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable description of why RestorePlan is in the + // current `state` + string state_reason = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/volume.proto b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/volume.proto new file mode 100644 index 00000000000..37c62f2c528 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/volume.proto @@ -0,0 +1,231 @@ +// 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 +// +// 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.gkebackup.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/gkebackup/v1/common.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeBackup.V1"; +option go_package = "cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppb"; +option java_multiple_files = true; +option java_outer_classname = "VolumeProto"; +option java_package = "com.google.cloud.gkebackup.v1"; +option php_namespace = "Google\\Cloud\\GkeBackup\\V1"; +option ruby_package = "Google::Cloud::GkeBackup::V1"; + +// Represents the backup of a specific persistent volume as a component of a +// Backup - both the record of the operation and a pointer to the underlying +// storage-specific artifacts. +// Next id: 14 +message VolumeBackup { + option (google.api.resource) = { + type: "gkebackup.googleapis.com/VolumeBackup" + pattern: "projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}/volumeBackups/{volume_backup}" + }; + + // Identifies the format used for the volume backup. + enum VolumeBackupFormat { + // Default value, not specified. + VOLUME_BACKUP_FORMAT_UNSPECIFIED = 0; + + // Compute Engine Persistent Disk snapshot based volume backup. + GCE_PERSISTENT_DISK = 1; + } + + // The current state of a VolumeBackup + enum State { + // This is an illegal state and should not be encountered. + STATE_UNSPECIFIED = 0; + + // A volume for the backup was identified and backup process is about to + // start. + CREATING = 1; + + // The volume backup operation has begun and is in the initial "snapshot" + // phase of the process. Any defined ProtectedApplication "pre" hooks will + // be executed before entering this state and "post" hooks will be executed + // upon leaving this state. + SNAPSHOTTING = 2; + + // The snapshot phase of the volume backup operation has completed and + // the snapshot is now being uploaded to backup storage. + UPLOADING = 3; + + // The volume backup operation has completed successfully. + SUCCEEDED = 4; + + // The volume backup operation has failed. + FAILED = 5; + + // This VolumeBackup resource (and its associated artifacts) is in the + // process of being deleted. + DELETING = 6; + } + + // Output only. The full name of the VolumeBackup resource. + // Format: `projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server generated global unique identifier of + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when this VolumeBackup resource was + // created. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when this VolumeBackup resource was last + // updated. + google.protobuf.Timestamp update_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A reference to the source Kubernetes PVC from which this + // VolumeBackup was created. + NamespacedName source_pvc = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A storage system-specific opaque handle to the underlying + // volume backup. + string volume_backup_handle = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The format used for the volume backup. + VolumeBackupFormat format = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The aggregate size of the underlying artifacts associated with + // this VolumeBackup in the backup storage. This may change over time when + // multiple backups of the same volume share the same backup storage + // location. In particular, this is likely to increase in size when + // the immediately preceding backup of the same volume is deleted. + int64 storage_bytes = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The minimum size of the disk to which this VolumeBackup can be + // restored. + int64 disk_size_bytes = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when the associated underlying volume backup + // operation completed. + google.protobuf.Timestamp complete_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of this VolumeBackup. + State state = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A human readable message explaining why the VolumeBackup is in + // its current state. + string state_message = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. `etag` is used for optimistic concurrency control as a way to + // help prevent simultaneous updates of a volume backup from overwriting each + // other. It is strongly suggested that systems make use of the `etag` in the + // read-modify-write cycle to perform volume backup updates in order to avoid + // race conditions. + string etag = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents the operation of restoring a volume from a VolumeBackup. +// Next id: 13 +message VolumeRestore { + option (google.api.resource) = { + type: "gkebackup.googleapis.com/VolumeRestore" + pattern: "projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore}/volumeRestores/{volume_restore}" + }; + + // Supported volume types. + enum VolumeType { + // Default + VOLUME_TYPE_UNSPECIFIED = 0; + + // Compute Engine Persistent Disk volume + GCE_PERSISTENT_DISK = 1; + } + + // The current state of a VolumeRestore + enum State { + // This is an illegal state and should not be encountered. + STATE_UNSPECIFIED = 0; + + // A volume for the restore was identified and restore process is about to + // start. + CREATING = 1; + + // The volume is currently being restored. + RESTORING = 2; + + // The volume has been successfully restored. + SUCCEEDED = 3; + + // The volume restoration process failed. + FAILED = 4; + + // This VolumeRestore resource is in the process of being deleted. + DELETING = 5; + } + + // Output only. Full name of the VolumeRestore resource. + // Format: `projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server generated global unique identifier of + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. + string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when this VolumeRestore resource was + // created. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when this VolumeRestore resource was last + // updated. + google.protobuf.Timestamp update_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The full name of the VolumeBackup from which the volume will + // be restored. Format: + // `projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*`. + string volume_backup = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The reference to the target Kubernetes PVC to be restored. + NamespacedName target_pvc = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A storage system-specific opaque handler to the underlying + // volume created for the target PVC from the volume backup. + string volume_handle = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The type of volume provisioned + VolumeType volume_type = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when the associated underlying volume + // restoration completed. + google.protobuf.Timestamp complete_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of this VolumeRestore. + State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A human readable message explaining why the VolumeRestore is + // in its current state. + string state_message = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. `etag` is used for optimistic concurrency control as a way to + // help prevent simultaneous updates of a volume restore from overwriting each + // other. It is strongly suggested that systems make use of the `etag` in the + // read-modify-write cycle to perform volume restore updates in order to avoid + // race conditions. + string etag = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_backup.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_backup.js new file mode 100644 index 00000000000..9388e7da332 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_backup.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(parent) { + // [START gkebackup_v1_generated_BackupForGKE_CreateBackup_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 BackupPlan within which to create the Backup. + * Format: `projects/* /locations/* /backupPlans/*` + */ + // const parent = 'abc123' + /** + * The Backup resource to create. + */ + // const backup = {} + /** + * The client-provided short name for the Backup resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of Backups in this BackupPlan + */ + // const backupId = 'abc123' + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callCreateBackup() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await gkebackupClient.createBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateBackup(); + // [END gkebackup_v1_generated_BackupForGKE_CreateBackup_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_backup_plan.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_backup_plan.js new file mode 100644 index 00000000000..a2d2b30919d --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_backup_plan.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, backupPlan, backupPlanId) { + // [START gkebackup_v1_generated_BackupForGKE_CreateBackupPlan_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 location within which to create the BackupPlan. + * Format: `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * Required. The BackupPlan resource object to create. + */ + // const backupPlan = {} + /** + * Required. The client-provided short name for the BackupPlan resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of BackupPlans in this location + */ + // const backupPlanId = 'abc123' + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callCreateBackupPlan() { + // Construct request + const request = { + parent, + backupPlan, + backupPlanId, + }; + + // Run request + const [operation] = await gkebackupClient.createBackupPlan(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateBackupPlan(); + // [END gkebackup_v1_generated_BackupForGKE_CreateBackupPlan_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_restore.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_restore.js new file mode 100644 index 00000000000..c42ba9c42c9 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_restore.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, restore, restoreId) { + // [START gkebackup_v1_generated_BackupForGKE_CreateRestore_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 RestorePlan within which to create the Restore. + * Format: `projects/* /locations/* /restorePlans/*` + */ + // const parent = 'abc123' + /** + * Required. The restore resource to create. + */ + // const restore = {} + /** + * Required. The client-provided short name for the Restore resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of Restores in this RestorePlan. + */ + // const restoreId = 'abc123' + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callCreateRestore() { + // Construct request + const request = { + parent, + restore, + restoreId, + }; + + // Run request + const [operation] = await gkebackupClient.createRestore(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateRestore(); + // [END gkebackup_v1_generated_BackupForGKE_CreateRestore_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_restore_plan.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_restore_plan.js new file mode 100644 index 00000000000..866d26ff959 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_restore_plan.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, restorePlan, restorePlanId) { + // [START gkebackup_v1_generated_BackupForGKE_CreateRestorePlan_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 location within which to create the RestorePlan. + * Format: `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * Required. The RestorePlan resource object to create. + */ + // const restorePlan = {} + /** + * Required. The client-provided short name for the RestorePlan resource. + * This name must: + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of RestorePlans in this location + */ + // const restorePlanId = 'abc123' + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callCreateRestorePlan() { + // Construct request + const request = { + parent, + restorePlan, + restorePlanId, + }; + + // Run request + const [operation] = await gkebackupClient.createRestorePlan(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateRestorePlan(); + // [END gkebackup_v1_generated_BackupForGKE_CreateRestorePlan_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_backup.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_backup.js new file mode 100644 index 00000000000..c6e2561ad2e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_backup.js @@ -0,0 +1,75 @@ +// 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 gkebackup_v1_generated_BackupForGKE_DeleteBackup_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 Backup resource. + * Format: `projects/* /locations/* /backupPlans/* /backups/*` + */ + // const name = 'abc123' + /** + * If provided, this value must match the current value of the + * target Backup's etag google.cloud.gkebackup.v1.Backup.etag field or the + * request is rejected. + */ + // const etag = 'abc123' + /** + * If set to true, any VolumeBackups below this Backup will also be deleted. + * Otherwise, the request will only succeed if the Backup has no + * VolumeBackups. + */ + // const force = true + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callDeleteBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gkebackupClient.deleteBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteBackup(); + // [END gkebackup_v1_generated_BackupForGKE_DeleteBackup_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_backup_plan.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_backup_plan.js new file mode 100644 index 00000000000..77fa7928e78 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_backup_plan.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(name) { + // [START gkebackup_v1_generated_BackupForGKE_DeleteBackupPlan_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. Fully qualified BackupPlan name. + * Format: `projects/* /locations/* /backupPlans/*` + */ + // const name = 'abc123' + /** + * If provided, this value must match the current value of the + * target BackupPlan's etag google.cloud.gkebackup.v1.BackupPlan.etag field + * or the request is rejected. + */ + // const etag = 'abc123' + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callDeleteBackupPlan() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gkebackupClient.deleteBackupPlan(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteBackupPlan(); + // [END gkebackup_v1_generated_BackupForGKE_DeleteBackupPlan_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_restore.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_restore.js new file mode 100644 index 00000000000..d40ce70f44f --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_restore.js @@ -0,0 +1,75 @@ +// 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 gkebackup_v1_generated_BackupForGKE_DeleteRestore_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 name of the Restore + * Format: `projects/* /locations/* /restorePlans/* /restores/*` + */ + // const name = 'abc123' + /** + * If provided, this value must match the current value of the + * target Restore's etag google.cloud.gkebackup.v1.Restore.etag field or + * the request is rejected. + */ + // const etag = 'abc123' + /** + * If set to true, any VolumeRestores below this restore will also be deleted. + * Otherwise, the request will only succeed if the restore has no + * VolumeRestores. + */ + // const force = true + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callDeleteRestore() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gkebackupClient.deleteRestore(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteRestore(); + // [END gkebackup_v1_generated_BackupForGKE_DeleteRestore_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_restore_plan.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_restore_plan.js new file mode 100644 index 00000000000..6bde8df7d83 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_restore_plan.js @@ -0,0 +1,75 @@ +// 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 gkebackup_v1_generated_BackupForGKE_DeleteRestorePlan_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. Fully qualified RestorePlan name. + * Format: `projects/* /locations/* /restorePlans/*` + */ + // const name = 'abc123' + /** + * If provided, this value must match the current value of the + * target RestorePlan's etag google.cloud.gkebackup.v1.RestorePlan.etag + * field or the request is rejected. + */ + // const etag = 'abc123' + /** + * If set to true, any Restores below this RestorePlan will also be deleted. + * Otherwise, the request will only succeed if the RestorePlan has no + * Restores. + */ + // const force = true + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callDeleteRestorePlan() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gkebackupClient.deleteRestorePlan(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteRestorePlan(); + // [END gkebackup_v1_generated_BackupForGKE_DeleteRestorePlan_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_backup.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_backup.js new file mode 100644 index 00000000000..e6af6b59405 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_backup.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 gkebackup_v1_generated_BackupForGKE_GetBackup_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 name of the Backup resource. + * Format: `projects/* /locations/* /backupPlans/* /backups/*` + */ + // const name = 'abc123' + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callGetBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkebackupClient.getBackup(request); + console.log(response); + } + + callGetBackup(); + // [END gkebackup_v1_generated_BackupForGKE_GetBackup_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_backup_plan.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_backup_plan.js new file mode 100644 index 00000000000..dc49b190bd5 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_backup_plan.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 gkebackup_v1_generated_BackupForGKE_GetBackupPlan_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. Fully qualified BackupPlan name. + * Format: `projects/* /locations/* /backupPlans/*` + */ + // const name = 'abc123' + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callGetBackupPlan() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkebackupClient.getBackupPlan(request); + console.log(response); + } + + callGetBackupPlan(); + // [END gkebackup_v1_generated_BackupForGKE_GetBackupPlan_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_restore.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_restore.js new file mode 100644 index 00000000000..2029130e967 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_restore.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 gkebackup_v1_generated_BackupForGKE_GetRestore_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 restore resource. + * Format: `projects/* /locations/* /restorePlans/* /restores/*` + */ + // const name = 'abc123' + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callGetRestore() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkebackupClient.getRestore(request); + console.log(response); + } + + callGetRestore(); + // [END gkebackup_v1_generated_BackupForGKE_GetRestore_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_restore_plan.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_restore_plan.js new file mode 100644 index 00000000000..a87d83e5bd6 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_restore_plan.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 gkebackup_v1_generated_BackupForGKE_GetRestorePlan_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. Fully qualified RestorePlan name. + * Format: `projects/* /locations/* /restorePlans/*` + */ + // const name = 'abc123' + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callGetRestorePlan() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkebackupClient.getRestorePlan(request); + console.log(response); + } + + callGetRestorePlan(); + // [END gkebackup_v1_generated_BackupForGKE_GetRestorePlan_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_volume_backup.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_volume_backup.js new file mode 100644 index 00000000000..b3cd5d78a73 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_volume_backup.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 gkebackup_v1_generated_BackupForGKE_GetVolumeBackup_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 name of the VolumeBackup resource. + * Format: `projects/* /locations/* /backupPlans/* /backups/* /volumeBackups/*` + */ + // const name = 'abc123' + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callGetVolumeBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkebackupClient.getVolumeBackup(request); + console.log(response); + } + + callGetVolumeBackup(); + // [END gkebackup_v1_generated_BackupForGKE_GetVolumeBackup_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_volume_restore.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_volume_restore.js new file mode 100644 index 00000000000..545ef9b8f5e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_volume_restore.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 gkebackup_v1_generated_BackupForGKE_GetVolumeRestore_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 name of the VolumeRestore resource. + * Format: `projects/* /locations/* /restorePlans/* /restores/* /volumeRestores/*` + */ + // const name = 'abc123' + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callGetVolumeRestore() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkebackupClient.getVolumeRestore(request); + console.log(response); + } + + callGetVolumeRestore(); + // [END gkebackup_v1_generated_BackupForGKE_GetVolumeRestore_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_backup_plans.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_backup_plans.js new file mode 100644 index 00000000000..e81931bff1d --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_backup_plans.js @@ -0,0 +1,90 @@ +// 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 gkebackup_v1_generated_BackupForGKE_ListBackupPlans_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 location that contains the BackupPlans to list. + * Format: `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * next_page_token google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token + * to determine if there are more instances left to be queried. + */ + // const pageSize = 1234 + /** + * The value of + * next_page_token google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token + * received from a previous `ListBackupPlans` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListBackupPlans` must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Field match expression used to filter the results. + */ + // const filter = 'abc123' + /** + * Field by which to sort the results. + */ + // const orderBy = 'abc123' + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callListBackupPlans() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gkebackupClient.listBackupPlansAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBackupPlans(); + // [END gkebackup_v1_generated_BackupForGKE_ListBackupPlans_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_backups.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_backups.js new file mode 100644 index 00000000000..90c2a8a7d29 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_backups.js @@ -0,0 +1,90 @@ +// 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 gkebackup_v1_generated_BackupForGKE_ListBackups_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 BackupPlan that contains the Backups to list. + * Format: `projects/* /locations/* /backupPlans/*` + */ + // const parent = 'abc123' + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * next_page_token google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token + * to determine if there are more instances left to be queried. + */ + // const pageSize = 1234 + /** + * The value of + * next_page_token google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token + * received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListBackups` must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Field match expression used to filter the results. + */ + // const filter = 'abc123' + /** + * Field by which to sort the results. + */ + // const orderBy = 'abc123' + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callListBackups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gkebackupClient.listBackupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBackups(); + // [END gkebackup_v1_generated_BackupForGKE_ListBackups_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_restore_plans.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_restore_plans.js new file mode 100644 index 00000000000..3163e412a3e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_restore_plans.js @@ -0,0 +1,90 @@ +// 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 gkebackup_v1_generated_BackupForGKE_ListRestorePlans_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 location that contains the RestorePlans to list. + * Format: `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * next_page_token google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token + * to determine if there are more instances left to be queried. + */ + // const pageSize = 1234 + /** + * The value of + * next_page_token google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token + * received from a previous `ListRestorePlans` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListRestorePlans` must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Field match expression used to filter the results. + */ + // const filter = 'abc123' + /** + * Field by which to sort the results. + */ + // const orderBy = 'abc123' + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callListRestorePlans() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gkebackupClient.listRestorePlansAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListRestorePlans(); + // [END gkebackup_v1_generated_BackupForGKE_ListRestorePlans_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_restores.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_restores.js new file mode 100644 index 00000000000..16d1bf0fceb --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_restores.js @@ -0,0 +1,90 @@ +// 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 gkebackup_v1_generated_BackupForGKE_ListRestores_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 RestorePlan that contains the Restores to list. + * Format: `projects/* /locations/* /restorePlans/*` + */ + // const parent = 'abc123' + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * next_page_token google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token + * to determine if there are more instances left to be queried. + */ + // const pageSize = 1234 + /** + * The value of + * next_page_token google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token + * received from a previous `ListRestores` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to `ListRestores` + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Field match expression used to filter the results. + */ + // const filter = 'abc123' + /** + * Field by which to sort the results. + */ + // const orderBy = 'abc123' + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callListRestores() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gkebackupClient.listRestoresAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListRestores(); + // [END gkebackup_v1_generated_BackupForGKE_ListRestores_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_volume_backups.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_volume_backups.js new file mode 100644 index 00000000000..c7503443c4b --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_volume_backups.js @@ -0,0 +1,90 @@ +// 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 gkebackup_v1_generated_BackupForGKE_ListVolumeBackups_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 Backup that contains the VolumeBackups to list. + * Format: `projects/* /locations/* /backupPlans/* /backups/*` + */ + // const parent = 'abc123' + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * next_page_token google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token + * to determine if there are more instances left to be queried. + */ + // const pageSize = 1234 + /** + * The value of + * next_page_token google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token + * received from a previous `ListVolumeBackups` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListVolumeBackups` must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Field match expression used to filter the results. + */ + // const filter = 'abc123' + /** + * Field by which to sort the results. + */ + // const orderBy = 'abc123' + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callListVolumeBackups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gkebackupClient.listVolumeBackupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListVolumeBackups(); + // [END gkebackup_v1_generated_BackupForGKE_ListVolumeBackups_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_volume_restores.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_volume_restores.js new file mode 100644 index 00000000000..1a27640625d --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_volume_restores.js @@ -0,0 +1,90 @@ +// 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 gkebackup_v1_generated_BackupForGKE_ListVolumeRestores_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 Restore that contains the VolumeRestores to list. + * Format: `projects/* /locations/* /restorePlans/* /restores/*` + */ + // const parent = 'abc123' + /** + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * next_page_token google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token + * to determine if there are more instances left to be queried. + */ + // const pageSize = 1234 + /** + * The value of + * next_page_token google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token + * received from a previous `ListVolumeRestores` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListVolumeRestores` must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Field match expression used to filter the results. + */ + // const filter = 'abc123' + /** + * Field by which to sort the results. + */ + // const orderBy = 'abc123' + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callListVolumeRestores() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gkebackupClient.listVolumeRestoresAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListVolumeRestores(); + // [END gkebackup_v1_generated_BackupForGKE_ListVolumeRestores_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_backup.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_backup.js new file mode 100644 index 00000000000..a042cccd180 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_backup.js @@ -0,0 +1,74 @@ +// 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(backup) { + // [START gkebackup_v1_generated_BackupForGKE_UpdateBackup_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. A new version of the Backup resource that contains updated + * fields. This may be sparsely populated if an `update_mask` is provided. + */ + // const backup = {} + /** + * This is used to specify the fields to be overwritten in the + * Backup targeted for update. The values for each of these + * updated fields will be taken from the `backup_plan` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `backup` will be + * written to the target Backup resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup` are ignored + * and are not used to update the target Backup. + */ + // const updateMask = {} + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callUpdateBackup() { + // Construct request + const request = { + backup, + }; + + // Run request + const [operation] = await gkebackupClient.updateBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateBackup(); + // [END gkebackup_v1_generated_BackupForGKE_UpdateBackup_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_backup_plan.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_backup_plan.js new file mode 100644 index 00000000000..b7556d4835a --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_backup_plan.js @@ -0,0 +1,75 @@ +// 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(backupPlan) { + // [START gkebackup_v1_generated_BackupForGKE_UpdateBackupPlan_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. A new version of the BackupPlan resource that contains updated + * fields. This may be sparsely populated if an `update_mask` is provided. + */ + // const backupPlan = {} + /** + * This is used to specify the fields to be overwritten in the + * BackupPlan targeted for update. The values for each of these + * updated fields will be taken from the `backup_plan` provided + * with this request. Field names are relative to the root of the resource + * (e.g., `description`, `backup_config.include_volume_data`, etc.) + * If no `update_mask` is provided, all fields in `backup_plan` will be + * written to the target BackupPlan resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup_plan` are ignored + * and are not used to update the target BackupPlan. + */ + // const updateMask = {} + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callUpdateBackupPlan() { + // Construct request + const request = { + backupPlan, + }; + + // Run request + const [operation] = await gkebackupClient.updateBackupPlan(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateBackupPlan(); + // [END gkebackup_v1_generated_BackupForGKE_UpdateBackupPlan_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_restore.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_restore.js new file mode 100644 index 00000000000..335e0a8f149 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_restore.js @@ -0,0 +1,74 @@ +// 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(restore) { + // [START gkebackup_v1_generated_BackupForGKE_UpdateRestore_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. A new version of the Restore resource that contains updated + * fields. This may be sparsely populated if an `update_mask` is provided. + */ + // const restore = {} + /** + * This is used to specify the fields to be overwritten in the + * Restore targeted for update. The values for each of these + * updated fields will be taken from the `restore` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `restore` will be + * written to the target Restore resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore` are ignored + * and are not used to update the target Restore. + */ + // const updateMask = {} + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callUpdateRestore() { + // Construct request + const request = { + restore, + }; + + // Run request + const [operation] = await gkebackupClient.updateRestore(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateRestore(); + // [END gkebackup_v1_generated_BackupForGKE_UpdateRestore_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_restore_plan.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_restore_plan.js new file mode 100644 index 00000000000..d13113bd688 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_restore_plan.js @@ -0,0 +1,74 @@ +// 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(restorePlan) { + // [START gkebackup_v1_generated_BackupForGKE_UpdateRestorePlan_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. A new version of the RestorePlan resource that contains updated + * fields. This may be sparsely populated if an `update_mask` is provided. + */ + // const restorePlan = {} + /** + * This is used to specify the fields to be overwritten in the + * RestorePlan targeted for update. The values for each of these + * updated fields will be taken from the `restore_plan` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `restore_plan` will be + * written to the target RestorePlan resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore_plan` are ignored + * and are not used to update the target RestorePlan. + */ + // const updateMask = {} + + // Imports the Gkebackup library + const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; + + // Instantiates a client + const gkebackupClient = new BackupForGKEClient(); + + async function callUpdateRestorePlan() { + // Construct request + const request = { + restorePlan, + }; + + // Run request + const [operation] = await gkebackupClient.updateRestorePlan(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateRestorePlan(); + // [END gkebackup_v1_generated_BackupForGKE_UpdateRestorePlan_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-gkebackup/v1/samples/generated/v1/snippet_metadata_google.cloud.gkebackup.v1.json b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/snippet_metadata_google.cloud.gkebackup.v1.json new file mode 100644 index 00000000000..d3f46929343 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/snippet_metadata_google.cloud.gkebackup.v1.json @@ -0,0 +1,1147 @@ +{ + "clientLibrary": { + "name": "nodejs-gkebackup", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.gkebackup.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_CreateBackupPlan_async", + "title": "BackupForGKE createBackupPlan Sample", + "origin": "API_DEFINITION", + "description": " Creates a new BackupPlan in a given location.", + "canonical": true, + "file": "backup_for_g_k_e.create_backup_plan.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBackupPlan", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.CreateBackupPlan", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "backup_plan", + "type": ".google.cloud.gkebackup.v1.BackupPlan" + }, + { + "name": "backup_plan_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "CreateBackupPlan", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.CreateBackupPlan", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_ListBackupPlans_async", + "title": "BackupForGKE listBackupPlans Sample", + "origin": "API_DEFINITION", + "description": " Lists BackupPlans in a given location.", + "canonical": true, + "file": "backup_for_g_k_e.list_backup_plans.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBackupPlans", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListBackupPlans", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkebackup.v1.ListBackupPlansResponse", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "ListBackupPlans", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListBackupPlans", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_GetBackupPlan_async", + "title": "BackupForGKE getBackupPlan Sample", + "origin": "API_DEFINITION", + "description": " Retrieve the details of a single BackupPlan.", + "canonical": true, + "file": "backup_for_g_k_e.get_backup_plan.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBackupPlan", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetBackupPlan", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkebackup.v1.BackupPlan", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "GetBackupPlan", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetBackupPlan", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_UpdateBackupPlan_async", + "title": "BackupForGKE updateBackupPlan Sample", + "origin": "API_DEFINITION", + "description": " Update a BackupPlan.", + "canonical": true, + "file": "backup_for_g_k_e.update_backup_plan.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBackupPlan", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.UpdateBackupPlan", + "async": true, + "parameters": [ + { + "name": "backup_plan", + "type": ".google.cloud.gkebackup.v1.BackupPlan" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "UpdateBackupPlan", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.UpdateBackupPlan", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_DeleteBackupPlan_async", + "title": "BackupForGKE deleteBackupPlan Sample", + "origin": "API_DEFINITION", + "description": " Deletes an existing BackupPlan.", + "canonical": true, + "file": "backup_for_g_k_e.delete_backup_plan.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBackupPlan", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.DeleteBackupPlan", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "DeleteBackupPlan", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.DeleteBackupPlan", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_CreateBackup_async", + "title": "BackupForGKE createBackup Sample", + "origin": "API_DEFINITION", + "description": " Creates a Backup for the given BackupPlan.", + "canonical": true, + "file": "backup_for_g_k_e.create_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBackup", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.CreateBackup", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": ".google.cloud.gkebackup.v1.Backup" + }, + { + "name": "backup_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "CreateBackup", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.CreateBackup", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_ListBackups_async", + "title": "BackupForGKE listBackups Sample", + "origin": "API_DEFINITION", + "description": " Lists the Backups for a given BackupPlan.", + "canonical": true, + "file": "backup_for_g_k_e.list_backups.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBackups", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListBackups", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkebackup.v1.ListBackupsResponse", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "ListBackups", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListBackups", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_GetBackup_async", + "title": "BackupForGKE getBackup Sample", + "origin": "API_DEFINITION", + "description": " Retrieve the details of a single Backup.", + "canonical": true, + "file": "backup_for_g_k_e.get_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBackup", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkebackup.v1.Backup", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "GetBackup", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetBackup", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_UpdateBackup_async", + "title": "BackupForGKE updateBackup Sample", + "origin": "API_DEFINITION", + "description": " Update a Backup.", + "canonical": true, + "file": "backup_for_g_k_e.update_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBackup", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.UpdateBackup", + "async": true, + "parameters": [ + { + "name": "backup", + "type": ".google.cloud.gkebackup.v1.Backup" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "UpdateBackup", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.UpdateBackup", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_DeleteBackup_async", + "title": "BackupForGKE deleteBackup Sample", + "origin": "API_DEFINITION", + "description": " Deletes an existing Backup.", + "canonical": true, + "file": "backup_for_g_k_e.delete_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.DeleteBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.DeleteBackup", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_ListVolumeBackups_async", + "title": "BackupForGKE listVolumeBackups Sample", + "origin": "API_DEFINITION", + "description": " Lists the VolumeBackups for a given Backup.", + "canonical": true, + "file": "backup_for_g_k_e.list_volume_backups.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListVolumeBackups", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListVolumeBackups", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkebackup.v1.ListVolumeBackupsResponse", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "ListVolumeBackups", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListVolumeBackups", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_GetVolumeBackup_async", + "title": "BackupForGKE getVolumeBackup Sample", + "origin": "API_DEFINITION", + "description": " Retrieve the details of a single VolumeBackup.", + "canonical": true, + "file": "backup_for_g_k_e.get_volume_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetVolumeBackup", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetVolumeBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkebackup.v1.VolumeBackup", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "GetVolumeBackup", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetVolumeBackup", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_CreateRestorePlan_async", + "title": "BackupForGKE createRestorePlan Sample", + "origin": "API_DEFINITION", + "description": " Creates a new RestorePlan in a given location.", + "canonical": true, + "file": "backup_for_g_k_e.create_restore_plan.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateRestorePlan", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.CreateRestorePlan", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "restore_plan", + "type": ".google.cloud.gkebackup.v1.RestorePlan" + }, + { + "name": "restore_plan_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "CreateRestorePlan", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.CreateRestorePlan", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_ListRestorePlans_async", + "title": "BackupForGKE listRestorePlans Sample", + "origin": "API_DEFINITION", + "description": " Lists RestorePlans in a given location.", + "canonical": true, + "file": "backup_for_g_k_e.list_restore_plans.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRestorePlans", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListRestorePlans", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkebackup.v1.ListRestorePlansResponse", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "ListRestorePlans", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListRestorePlans", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_GetRestorePlan_async", + "title": "BackupForGKE getRestorePlan Sample", + "origin": "API_DEFINITION", + "description": " Retrieve the details of a single RestorePlan.", + "canonical": true, + "file": "backup_for_g_k_e.get_restore_plan.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetRestorePlan", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetRestorePlan", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkebackup.v1.RestorePlan", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "GetRestorePlan", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetRestorePlan", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_UpdateRestorePlan_async", + "title": "BackupForGKE updateRestorePlan Sample", + "origin": "API_DEFINITION", + "description": " Update a RestorePlan.", + "canonical": true, + "file": "backup_for_g_k_e.update_restore_plan.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateRestorePlan", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.UpdateRestorePlan", + "async": true, + "parameters": [ + { + "name": "restore_plan", + "type": ".google.cloud.gkebackup.v1.RestorePlan" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "UpdateRestorePlan", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.UpdateRestorePlan", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_DeleteRestorePlan_async", + "title": "BackupForGKE deleteRestorePlan Sample", + "origin": "API_DEFINITION", + "description": " Deletes an existing RestorePlan.", + "canonical": true, + "file": "backup_for_g_k_e.delete_restore_plan.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteRestorePlan", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.DeleteRestorePlan", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "DeleteRestorePlan", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.DeleteRestorePlan", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_CreateRestore_async", + "title": "BackupForGKE createRestore Sample", + "origin": "API_DEFINITION", + "description": " Creates a new Restore for the given RestorePlan.", + "canonical": true, + "file": "backup_for_g_k_e.create_restore.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateRestore", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.CreateRestore", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "restore", + "type": ".google.cloud.gkebackup.v1.Restore" + }, + { + "name": "restore_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "CreateRestore", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.CreateRestore", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_ListRestores_async", + "title": "BackupForGKE listRestores Sample", + "origin": "API_DEFINITION", + "description": " Lists the Restores for a given RestorePlan.", + "canonical": true, + "file": "backup_for_g_k_e.list_restores.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRestores", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListRestores", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkebackup.v1.ListRestoresResponse", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "ListRestores", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListRestores", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_GetRestore_async", + "title": "BackupForGKE getRestore Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the details of a single Restore.", + "canonical": true, + "file": "backup_for_g_k_e.get_restore.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetRestore", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetRestore", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkebackup.v1.Restore", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "GetRestore", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetRestore", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_UpdateRestore_async", + "title": "BackupForGKE updateRestore Sample", + "origin": "API_DEFINITION", + "description": " Update a Restore.", + "canonical": true, + "file": "backup_for_g_k_e.update_restore.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateRestore", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.UpdateRestore", + "async": true, + "parameters": [ + { + "name": "restore", + "type": ".google.cloud.gkebackup.v1.Restore" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "UpdateRestore", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.UpdateRestore", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_DeleteRestore_async", + "title": "BackupForGKE deleteRestore Sample", + "origin": "API_DEFINITION", + "description": " Deletes an existing Restore.", + "canonical": true, + "file": "backup_for_g_k_e.delete_restore.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteRestore", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.DeleteRestore", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "DeleteRestore", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.DeleteRestore", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_ListVolumeRestores_async", + "title": "BackupForGKE listVolumeRestores Sample", + "origin": "API_DEFINITION", + "description": " Lists the VolumeRestores for a given Restore.", + "canonical": true, + "file": "backup_for_g_k_e.list_volume_restores.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListVolumeRestores", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListVolumeRestores", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkebackup.v1.ListVolumeRestoresResponse", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "ListVolumeRestores", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListVolumeRestores", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + }, + { + "regionTag": "gkebackup_v1_generated_BackupForGKE_GetVolumeRestore_async", + "title": "BackupForGKE getVolumeRestore Sample", + "origin": "API_DEFINITION", + "description": " Retrieve the details of a single VolumeRestore.", + "canonical": true, + "file": "backup_for_g_k_e.get_volume_restore.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetVolumeRestore", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetVolumeRestore", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkebackup.v1.VolumeRestore", + "client": { + "shortName": "BackupForGKEClient", + "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" + }, + "method": { + "shortName": "GetVolumeRestore", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetVolumeRestore", + "service": { + "shortName": "BackupForGKE", + "fullName": "google.cloud.gkebackup.v1.BackupForGKE" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/src/index.ts b/owl-bot-staging/google-cloud-gkebackup/v1/src/index.ts new file mode 100644 index 00000000000..4af80ba6308 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/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 v1 from './v1'; +const BackupForGKEClient = v1.BackupForGKEClient; +type BackupForGKEClient = v1.BackupForGKEClient; +export {v1, BackupForGKEClient}; +export default {v1, BackupForGKEClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_client.ts b/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_client.ts new file mode 100644 index 00000000000..4b55b41380e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_client.ts @@ -0,0 +1,4191 @@ +// 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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/backup_for_g_k_e_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './backup_for_g_k_e_client_config.json'; +const version = require('../../../package.json').version; + +/** + * BackupForGKE allows Kubernetes administrators to configure, execute, and + * manage backup and restore operations for their GKE clusters. + * @class + * @memberof v1 + */ +export class BackupForGKEClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + backupForGKEStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of BackupForGKEClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 BackupForGKEClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof BackupForGKEClient; + 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; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + 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 = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}' + ), + backupPlanPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/backupPlans/{backup_plan}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + restorePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore}' + ), + restorePlanPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/restorePlans/{restore_plan}' + ), + volumeBackupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}/volumeBackups/{volume_backup}' + ), + volumeRestorePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore}/volumeRestores/{volume_restore}' + ), + }; + + // 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 = { + listBackupPlans: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backupPlans'), + listBackups: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups'), + listVolumeBackups: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'volumeBackups'), + listRestorePlans: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'restorePlans'), + listRestores: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'restores'), + listVolumeRestores: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'volumeRestores') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/backupPlans/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/restorePlans/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/backupPlans/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/restorePlans/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/backupPlans/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/restorePlans/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*}/operations',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createBackupPlanResponse = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.BackupPlan') as gax.protobuf.Type; + const createBackupPlanMetadata = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; + const updateBackupPlanResponse = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.BackupPlan') as gax.protobuf.Type; + const updateBackupPlanMetadata = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; + const deleteBackupPlanResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteBackupPlanMetadata = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; + const createBackupResponse = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.Backup') as gax.protobuf.Type; + const createBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; + const updateBackupResponse = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.Backup') as gax.protobuf.Type; + const updateBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; + const deleteBackupResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; + const createRestorePlanResponse = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.RestorePlan') as gax.protobuf.Type; + const createRestorePlanMetadata = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; + const updateRestorePlanResponse = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.RestorePlan') as gax.protobuf.Type; + const updateRestorePlanMetadata = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; + const deleteRestorePlanResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteRestorePlanMetadata = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; + const createRestoreResponse = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.Restore') as gax.protobuf.Type; + const createRestoreMetadata = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; + const updateRestoreResponse = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.Restore') as gax.protobuf.Type; + const updateRestoreMetadata = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; + const deleteRestoreResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteRestoreMetadata = protoFilesRoot.lookup( + '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createBackupPlan: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBackupPlanResponse.decode.bind(createBackupPlanResponse), + createBackupPlanMetadata.decode.bind(createBackupPlanMetadata)), + updateBackupPlan: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateBackupPlanResponse.decode.bind(updateBackupPlanResponse), + updateBackupPlanMetadata.decode.bind(updateBackupPlanMetadata)), + deleteBackupPlan: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteBackupPlanResponse.decode.bind(deleteBackupPlanResponse), + deleteBackupPlanMetadata.decode.bind(deleteBackupPlanMetadata)), + createBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBackupResponse.decode.bind(createBackupResponse), + createBackupMetadata.decode.bind(createBackupMetadata)), + updateBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateBackupResponse.decode.bind(updateBackupResponse), + updateBackupMetadata.decode.bind(updateBackupMetadata)), + deleteBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteBackupResponse.decode.bind(deleteBackupResponse), + deleteBackupMetadata.decode.bind(deleteBackupMetadata)), + createRestorePlan: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createRestorePlanResponse.decode.bind(createRestorePlanResponse), + createRestorePlanMetadata.decode.bind(createRestorePlanMetadata)), + updateRestorePlan: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateRestorePlanResponse.decode.bind(updateRestorePlanResponse), + updateRestorePlanMetadata.decode.bind(updateRestorePlanMetadata)), + deleteRestorePlan: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteRestorePlanResponse.decode.bind(deleteRestorePlanResponse), + deleteRestorePlanMetadata.decode.bind(deleteRestorePlanMetadata)), + createRestore: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createRestoreResponse.decode.bind(createRestoreResponse), + createRestoreMetadata.decode.bind(createRestoreMetadata)), + updateRestore: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateRestoreResponse.decode.bind(updateRestoreResponse), + updateRestoreMetadata.decode.bind(updateRestoreMetadata)), + deleteRestore: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteRestoreResponse.decode.bind(deleteRestoreResponse), + deleteRestoreMetadata.decode.bind(deleteRestoreMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.gkebackup.v1.BackupForGKE', 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.backupForGKEStub) { + return this.backupForGKEStub; + } + + // Put together the "service stub" for + // google.cloud.gkebackup.v1.BackupForGKE. + this.backupForGKEStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.gkebackup.v1.BackupForGKE') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.gkebackup.v1.BackupForGKE, + 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 backupForGKEStubMethods = + ['createBackupPlan', 'listBackupPlans', 'getBackupPlan', 'updateBackupPlan', 'deleteBackupPlan', 'createBackup', 'listBackups', 'getBackup', 'updateBackup', 'deleteBackup', 'listVolumeBackups', 'getVolumeBackup', 'createRestorePlan', 'listRestorePlans', 'getRestorePlan', 'updateRestorePlan', 'deleteRestorePlan', 'createRestore', 'listRestores', 'getRestore', 'updateRestore', 'deleteRestore', 'listVolumeRestores', 'getVolumeRestore']; + for (const methodName of backupForGKEStubMethods) { + const callPromise = this.backupForGKEStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.backupForGKEStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'gkebackup.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 'gkebackup.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 -- + // ------------------- +/** + * Retrieve the details of a single BackupPlan. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Fully qualified BackupPlan name. + * Format: `projects/* /locations/* /backupPlans/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkebackup.v1.BackupPlan|BackupPlan}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.get_backup_plan.js + * region_tag:gkebackup_v1_generated_BackupForGKE_GetBackupPlan_async + */ + getBackupPlan( + request?: protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkebackup.v1.IBackupPlan, + protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest|undefined, {}|undefined + ]>; + getBackupPlan( + request: protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkebackup.v1.IBackupPlan, + protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest|null|undefined, + {}|null|undefined>): void; + getBackupPlan( + request: protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest, + callback: Callback< + protos.google.cloud.gkebackup.v1.IBackupPlan, + protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest|null|undefined, + {}|null|undefined>): void; + getBackupPlan( + request?: protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkebackup.v1.IBackupPlan, + protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkebackup.v1.IBackupPlan, + protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkebackup.v1.IBackupPlan, + protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest|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.getBackupPlan(request, options, callback); + } +/** + * Retrieve the details of a single Backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full name of the Backup resource. + * Format: `projects/* /locations/* /backupPlans/* /backups/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkebackup.v1.Backup|Backup}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.get_backup.js + * region_tag:gkebackup_v1_generated_BackupForGKE_GetBackup_async + */ + getBackup( + request?: protos.google.cloud.gkebackup.v1.IGetBackupRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkebackup.v1.IBackup, + protos.google.cloud.gkebackup.v1.IGetBackupRequest|undefined, {}|undefined + ]>; + getBackup( + request: protos.google.cloud.gkebackup.v1.IGetBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkebackup.v1.IBackup, + protos.google.cloud.gkebackup.v1.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request: protos.google.cloud.gkebackup.v1.IGetBackupRequest, + callback: Callback< + protos.google.cloud.gkebackup.v1.IBackup, + protos.google.cloud.gkebackup.v1.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request?: protos.google.cloud.gkebackup.v1.IGetBackupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkebackup.v1.IBackup, + protos.google.cloud.gkebackup.v1.IGetBackupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkebackup.v1.IBackup, + protos.google.cloud.gkebackup.v1.IGetBackupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkebackup.v1.IBackup, + protos.google.cloud.gkebackup.v1.IGetBackupRequest|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.getBackup(request, options, callback); + } +/** + * Retrieve the details of a single VolumeBackup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full name of the VolumeBackup resource. + * Format: `projects/* /locations/* /backupPlans/* /backups/* /volumeBackups/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkebackup.v1.VolumeBackup|VolumeBackup}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.get_volume_backup.js + * region_tag:gkebackup_v1_generated_BackupForGKE_GetVolumeBackup_async + */ + getVolumeBackup( + request?: protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkebackup.v1.IVolumeBackup, + protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest|undefined, {}|undefined + ]>; + getVolumeBackup( + request: protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkebackup.v1.IVolumeBackup, + protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest|null|undefined, + {}|null|undefined>): void; + getVolumeBackup( + request: protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest, + callback: Callback< + protos.google.cloud.gkebackup.v1.IVolumeBackup, + protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest|null|undefined, + {}|null|undefined>): void; + getVolumeBackup( + request?: protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkebackup.v1.IVolumeBackup, + protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkebackup.v1.IVolumeBackup, + protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkebackup.v1.IVolumeBackup, + protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest|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.getVolumeBackup(request, options, callback); + } +/** + * Retrieve the details of a single RestorePlan. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Fully qualified RestorePlan name. + * Format: `projects/* /locations/* /restorePlans/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkebackup.v1.RestorePlan|RestorePlan}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.get_restore_plan.js + * region_tag:gkebackup_v1_generated_BackupForGKE_GetRestorePlan_async + */ + getRestorePlan( + request?: protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkebackup.v1.IRestorePlan, + protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest|undefined, {}|undefined + ]>; + getRestorePlan( + request: protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkebackup.v1.IRestorePlan, + protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest|null|undefined, + {}|null|undefined>): void; + getRestorePlan( + request: protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest, + callback: Callback< + protos.google.cloud.gkebackup.v1.IRestorePlan, + protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest|null|undefined, + {}|null|undefined>): void; + getRestorePlan( + request?: protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkebackup.v1.IRestorePlan, + protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkebackup.v1.IRestorePlan, + protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkebackup.v1.IRestorePlan, + protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest|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.getRestorePlan(request, options, callback); + } +/** + * Retrieves the details of a single Restore. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the restore resource. + * Format: `projects/* /locations/* /restorePlans/* /restores/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkebackup.v1.Restore|Restore}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.get_restore.js + * region_tag:gkebackup_v1_generated_BackupForGKE_GetRestore_async + */ + getRestore( + request?: protos.google.cloud.gkebackup.v1.IGetRestoreRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkebackup.v1.IRestore, + protos.google.cloud.gkebackup.v1.IGetRestoreRequest|undefined, {}|undefined + ]>; + getRestore( + request: protos.google.cloud.gkebackup.v1.IGetRestoreRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkebackup.v1.IRestore, + protos.google.cloud.gkebackup.v1.IGetRestoreRequest|null|undefined, + {}|null|undefined>): void; + getRestore( + request: protos.google.cloud.gkebackup.v1.IGetRestoreRequest, + callback: Callback< + protos.google.cloud.gkebackup.v1.IRestore, + protos.google.cloud.gkebackup.v1.IGetRestoreRequest|null|undefined, + {}|null|undefined>): void; + getRestore( + request?: protos.google.cloud.gkebackup.v1.IGetRestoreRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkebackup.v1.IRestore, + protos.google.cloud.gkebackup.v1.IGetRestoreRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkebackup.v1.IRestore, + protos.google.cloud.gkebackup.v1.IGetRestoreRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkebackup.v1.IRestore, + protos.google.cloud.gkebackup.v1.IGetRestoreRequest|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.getRestore(request, options, callback); + } +/** + * Retrieve the details of a single VolumeRestore. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full name of the VolumeRestore resource. + * Format: `projects/* /locations/* /restorePlans/* /restores/* /volumeRestores/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkebackup.v1.VolumeRestore|VolumeRestore}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.get_volume_restore.js + * region_tag:gkebackup_v1_generated_BackupForGKE_GetVolumeRestore_async + */ + getVolumeRestore( + request?: protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkebackup.v1.IVolumeRestore, + protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest|undefined, {}|undefined + ]>; + getVolumeRestore( + request: protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkebackup.v1.IVolumeRestore, + protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest|null|undefined, + {}|null|undefined>): void; + getVolumeRestore( + request: protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest, + callback: Callback< + protos.google.cloud.gkebackup.v1.IVolumeRestore, + protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest|null|undefined, + {}|null|undefined>): void; + getVolumeRestore( + request?: protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkebackup.v1.IVolumeRestore, + protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkebackup.v1.IVolumeRestore, + protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkebackup.v1.IVolumeRestore, + protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest|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.getVolumeRestore(request, options, callback); + } + +/** + * Creates a new BackupPlan in a given location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location within which to create the BackupPlan. + * Format: `projects/* /locations/*` + * @param {google.cloud.gkebackup.v1.BackupPlan} request.backupPlan + * Required. The BackupPlan resource object to create. + * @param {string} request.backupPlanId + * Required. The client-provided short name for the BackupPlan resource. + * This name must: + * + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of BackupPlans in this location + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.create_backup_plan.js + * region_tag:gkebackup_v1_generated_BackupForGKE_CreateBackupPlan_async + */ + createBackupPlan( + request?: protos.google.cloud.gkebackup.v1.ICreateBackupPlanRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createBackupPlan( + request: protos.google.cloud.gkebackup.v1.ICreateBackupPlanRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackupPlan( + request: protos.google.cloud.gkebackup.v1.ICreateBackupPlanRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackupPlan( + request?: protos.google.cloud.gkebackup.v1.ICreateBackupPlanRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createBackupPlan(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createBackupPlan()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.create_backup_plan.js + * region_tag:gkebackup_v1_generated_BackupForGKE_CreateBackupPlan_async + */ + async checkCreateBackupPlanProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackupPlan, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Update a BackupPlan. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.gkebackup.v1.BackupPlan} request.backupPlan + * Required. A new version of the BackupPlan resource that contains updated + * fields. This may be sparsely populated if an `update_mask` is provided. + * @param {google.protobuf.FieldMask} request.updateMask + * This is used to specify the fields to be overwritten in the + * BackupPlan targeted for update. The values for each of these + * updated fields will be taken from the `backup_plan` provided + * with this request. Field names are relative to the root of the resource + * (e.g., `description`, `backup_config.include_volume_data`, etc.) + * If no `update_mask` is provided, all fields in `backup_plan` will be + * written to the target BackupPlan resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup_plan` are ignored + * and are not used to update the target BackupPlan. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.update_backup_plan.js + * region_tag:gkebackup_v1_generated_BackupForGKE_UpdateBackupPlan_async + */ + updateBackupPlan( + request?: protos.google.cloud.gkebackup.v1.IUpdateBackupPlanRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateBackupPlan( + request: protos.google.cloud.gkebackup.v1.IUpdateBackupPlanRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateBackupPlan( + request: protos.google.cloud.gkebackup.v1.IUpdateBackupPlanRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateBackupPlan( + request?: protos.google.cloud.gkebackup.v1.IUpdateBackupPlanRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'backup_plan.name': request.backupPlan!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateBackupPlan(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateBackupPlan()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.update_backup_plan.js + * region_tag:gkebackup_v1_generated_BackupForGKE_UpdateBackupPlan_async + */ + async checkUpdateBackupPlanProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateBackupPlan, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes an existing BackupPlan. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Fully qualified BackupPlan name. + * Format: `projects/* /locations/* /backupPlans/*` + * @param {string} request.etag + * If provided, this value must match the current value of the + * target BackupPlan's {@link protos.google.cloud.gkebackup.v1.BackupPlan.etag|etag} field + * or the request is rejected. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.delete_backup_plan.js + * region_tag:gkebackup_v1_generated_BackupForGKE_DeleteBackupPlan_async + */ + deleteBackupPlan( + request?: protos.google.cloud.gkebackup.v1.IDeleteBackupPlanRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteBackupPlan( + request: protos.google.cloud.gkebackup.v1.IDeleteBackupPlanRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackupPlan( + request: protos.google.cloud.gkebackup.v1.IDeleteBackupPlanRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackupPlan( + request?: protos.google.cloud.gkebackup.v1.IDeleteBackupPlanRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteBackupPlan(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteBackupPlan()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.delete_backup_plan.js + * region_tag:gkebackup_v1_generated_BackupForGKE_DeleteBackupPlan_async + */ + async checkDeleteBackupPlanProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteBackupPlan, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a Backup for the given BackupPlan. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The BackupPlan within which to create the Backup. + * Format: `projects/* /locations/* /backupPlans/*` + * @param {google.cloud.gkebackup.v1.Backup} request.backup + * The Backup resource to create. + * @param {string} request.backupId + * The client-provided short name for the Backup resource. + * This name must: + * + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of Backups in this BackupPlan + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.create_backup.js + * region_tag:gkebackup_v1_generated_BackupForGKE_CreateBackup_async + */ + createBackup( + request?: protos.google.cloud.gkebackup.v1.ICreateBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createBackup( + request: protos.google.cloud.gkebackup.v1.ICreateBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request: protos.google.cloud.gkebackup.v1.ICreateBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request?: protos.google.cloud.gkebackup.v1.ICreateBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.create_backup.js + * region_tag:gkebackup_v1_generated_BackupForGKE_CreateBackup_async + */ + async checkCreateBackupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Update a Backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.gkebackup.v1.Backup} request.backup + * Required. A new version of the Backup resource that contains updated + * fields. This may be sparsely populated if an `update_mask` is provided. + * @param {google.protobuf.FieldMask} request.updateMask + * This is used to specify the fields to be overwritten in the + * Backup targeted for update. The values for each of these + * updated fields will be taken from the `backup_plan` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `backup` will be + * written to the target Backup resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup` are ignored + * and are not used to update the target Backup. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.update_backup.js + * region_tag:gkebackup_v1_generated_BackupForGKE_UpdateBackup_async + */ + updateBackup( + request?: protos.google.cloud.gkebackup.v1.IUpdateBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateBackup( + request: protos.google.cloud.gkebackup.v1.IUpdateBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateBackup( + request: protos.google.cloud.gkebackup.v1.IUpdateBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateBackup( + request?: protos.google.cloud.gkebackup.v1.IUpdateBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'backup.name': request.backup!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.update_backup.js + * region_tag:gkebackup_v1_generated_BackupForGKE_UpdateBackup_async + */ + async checkUpdateBackupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateBackup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes an existing Backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the Backup resource. + * Format: `projects/* /locations/* /backupPlans/* /backups/*` + * @param {string} request.etag + * If provided, this value must match the current value of the + * target Backup's {@link protos.google.cloud.gkebackup.v1.Backup.etag|etag} field or the + * request is rejected. + * @param {boolean} request.force + * If set to true, any VolumeBackups below this Backup will also be deleted. + * Otherwise, the request will only succeed if the Backup has no + * VolumeBackups. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.delete_backup.js + * region_tag:gkebackup_v1_generated_BackupForGKE_DeleteBackup_async + */ + deleteBackup( + request?: protos.google.cloud.gkebackup.v1.IDeleteBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteBackup( + request: protos.google.cloud.gkebackup.v1.IDeleteBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request: protos.google.cloud.gkebackup.v1.IDeleteBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request?: protos.google.cloud.gkebackup.v1.IDeleteBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.delete_backup.js + * region_tag:gkebackup_v1_generated_BackupForGKE_DeleteBackup_async + */ + async checkDeleteBackupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteBackup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new RestorePlan in a given location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location within which to create the RestorePlan. + * Format: `projects/* /locations/*` + * @param {google.cloud.gkebackup.v1.RestorePlan} request.restorePlan + * Required. The RestorePlan resource object to create. + * @param {string} request.restorePlanId + * Required. The client-provided short name for the RestorePlan resource. + * This name must: + * + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of RestorePlans in this location + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.create_restore_plan.js + * region_tag:gkebackup_v1_generated_BackupForGKE_CreateRestorePlan_async + */ + createRestorePlan( + request?: protos.google.cloud.gkebackup.v1.ICreateRestorePlanRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createRestorePlan( + request: protos.google.cloud.gkebackup.v1.ICreateRestorePlanRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createRestorePlan( + request: protos.google.cloud.gkebackup.v1.ICreateRestorePlanRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createRestorePlan( + request?: protos.google.cloud.gkebackup.v1.ICreateRestorePlanRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createRestorePlan(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createRestorePlan()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.create_restore_plan.js + * region_tag:gkebackup_v1_generated_BackupForGKE_CreateRestorePlan_async + */ + async checkCreateRestorePlanProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createRestorePlan, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Update a RestorePlan. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.gkebackup.v1.RestorePlan} request.restorePlan + * Required. A new version of the RestorePlan resource that contains updated + * fields. This may be sparsely populated if an `update_mask` is provided. + * @param {google.protobuf.FieldMask} request.updateMask + * This is used to specify the fields to be overwritten in the + * RestorePlan targeted for update. The values for each of these + * updated fields will be taken from the `restore_plan` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `restore_plan` will be + * written to the target RestorePlan resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore_plan` are ignored + * and are not used to update the target RestorePlan. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.update_restore_plan.js + * region_tag:gkebackup_v1_generated_BackupForGKE_UpdateRestorePlan_async + */ + updateRestorePlan( + request?: protos.google.cloud.gkebackup.v1.IUpdateRestorePlanRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateRestorePlan( + request: protos.google.cloud.gkebackup.v1.IUpdateRestorePlanRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateRestorePlan( + request: protos.google.cloud.gkebackup.v1.IUpdateRestorePlanRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateRestorePlan( + request?: protos.google.cloud.gkebackup.v1.IUpdateRestorePlanRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'restore_plan.name': request.restorePlan!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateRestorePlan(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateRestorePlan()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.update_restore_plan.js + * region_tag:gkebackup_v1_generated_BackupForGKE_UpdateRestorePlan_async + */ + async checkUpdateRestorePlanProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateRestorePlan, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes an existing RestorePlan. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Fully qualified RestorePlan name. + * Format: `projects/* /locations/* /restorePlans/*` + * @param {string} request.etag + * If provided, this value must match the current value of the + * target RestorePlan's {@link protos.google.cloud.gkebackup.v1.RestorePlan.etag|etag} + * field or the request is rejected. + * @param {boolean} request.force + * If set to true, any Restores below this RestorePlan will also be deleted. + * Otherwise, the request will only succeed if the RestorePlan has no + * Restores. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.delete_restore_plan.js + * region_tag:gkebackup_v1_generated_BackupForGKE_DeleteRestorePlan_async + */ + deleteRestorePlan( + request?: protos.google.cloud.gkebackup.v1.IDeleteRestorePlanRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteRestorePlan( + request: protos.google.cloud.gkebackup.v1.IDeleteRestorePlanRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteRestorePlan( + request: protos.google.cloud.gkebackup.v1.IDeleteRestorePlanRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteRestorePlan( + request?: protos.google.cloud.gkebackup.v1.IDeleteRestorePlanRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteRestorePlan(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteRestorePlan()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.delete_restore_plan.js + * region_tag:gkebackup_v1_generated_BackupForGKE_DeleteRestorePlan_async + */ + async checkDeleteRestorePlanProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteRestorePlan, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new Restore for the given RestorePlan. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The RestorePlan within which to create the Restore. + * Format: `projects/* /locations/* /restorePlans/*` + * @param {google.cloud.gkebackup.v1.Restore} request.restore + * Required. The restore resource to create. + * @param {string} request.restoreId + * Required. The client-provided short name for the Restore resource. + * This name must: + * + * - be between 1 and 63 characters long (inclusive) + * - consist of only lower-case ASCII letters, numbers, and dashes + * - start with a lower-case letter + * - end with a lower-case letter or number + * - be unique within the set of Restores in this RestorePlan. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.create_restore.js + * region_tag:gkebackup_v1_generated_BackupForGKE_CreateRestore_async + */ + createRestore( + request?: protos.google.cloud.gkebackup.v1.ICreateRestoreRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createRestore( + request: protos.google.cloud.gkebackup.v1.ICreateRestoreRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createRestore( + request: protos.google.cloud.gkebackup.v1.ICreateRestoreRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createRestore( + request?: protos.google.cloud.gkebackup.v1.ICreateRestoreRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createRestore(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createRestore()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.create_restore.js + * region_tag:gkebackup_v1_generated_BackupForGKE_CreateRestore_async + */ + async checkCreateRestoreProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createRestore, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Update a Restore. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.gkebackup.v1.Restore} request.restore + * Required. A new version of the Restore resource that contains updated + * fields. This may be sparsely populated if an `update_mask` is provided. + * @param {google.protobuf.FieldMask} request.updateMask + * This is used to specify the fields to be overwritten in the + * Restore targeted for update. The values for each of these + * updated fields will be taken from the `restore` provided + * with this request. Field names are relative to the root of the resource. + * If no `update_mask` is provided, all fields in `restore` will be + * written to the target Restore resource. + * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore` are ignored + * and are not used to update the target Restore. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.update_restore.js + * region_tag:gkebackup_v1_generated_BackupForGKE_UpdateRestore_async + */ + updateRestore( + request?: protos.google.cloud.gkebackup.v1.IUpdateRestoreRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateRestore( + request: protos.google.cloud.gkebackup.v1.IUpdateRestoreRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateRestore( + request: protos.google.cloud.gkebackup.v1.IUpdateRestoreRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateRestore( + request?: protos.google.cloud.gkebackup.v1.IUpdateRestoreRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'restore.name': request.restore!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateRestore(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateRestore()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.update_restore.js + * region_tag:gkebackup_v1_generated_BackupForGKE_UpdateRestore_async + */ + async checkUpdateRestoreProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateRestore, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes an existing Restore. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full name of the Restore + * Format: `projects/* /locations/* /restorePlans/* /restores/*` + * @param {string} request.etag + * If provided, this value must match the current value of the + * target Restore's {@link protos.google.cloud.gkebackup.v1.Restore.etag|etag} field or + * the request is rejected. + * @param {boolean} request.force + * If set to true, any VolumeRestores below this restore will also be deleted. + * Otherwise, the request will only succeed if the restore has no + * VolumeRestores. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.delete_restore.js + * region_tag:gkebackup_v1_generated_BackupForGKE_DeleteRestore_async + */ + deleteRestore( + request?: protos.google.cloud.gkebackup.v1.IDeleteRestoreRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteRestore( + request: protos.google.cloud.gkebackup.v1.IDeleteRestoreRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteRestore( + request: protos.google.cloud.gkebackup.v1.IDeleteRestoreRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteRestore( + request?: protos.google.cloud.gkebackup.v1.IDeleteRestoreRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteRestore(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteRestore()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.delete_restore.js + * region_tag:gkebackup_v1_generated_BackupForGKE_DeleteRestore_async + */ + async checkDeleteRestoreProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteRestore, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists BackupPlans in a given location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location that contains the BackupPlans to list. + * Format: `projects/* /locations/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token|next_page_token} + * received from a previous `ListBackupPlans` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListBackupPlans` must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.gkebackup.v1.BackupPlan|BackupPlan}. + * 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 `listBackupPlansAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBackupPlans( + request?: protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkebackup.v1.IBackupPlan[], + protos.google.cloud.gkebackup.v1.IListBackupPlansRequest|null, + protos.google.cloud.gkebackup.v1.IListBackupPlansResponse + ]>; + listBackupPlans( + request: protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, + protos.google.cloud.gkebackup.v1.IListBackupPlansResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IBackupPlan>): void; + listBackupPlans( + request: protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, + callback: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, + protos.google.cloud.gkebackup.v1.IListBackupPlansResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IBackupPlan>): void; + listBackupPlans( + request?: protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, + protos.google.cloud.gkebackup.v1.IListBackupPlansResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IBackupPlan>, + callback?: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, + protos.google.cloud.gkebackup.v1.IListBackupPlansResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IBackupPlan>): + Promise<[ + protos.google.cloud.gkebackup.v1.IBackupPlan[], + protos.google.cloud.gkebackup.v1.IListBackupPlansRequest|null, + protos.google.cloud.gkebackup.v1.IListBackupPlansResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listBackupPlans(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location that contains the BackupPlans to list. + * Format: `projects/* /locations/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token|next_page_token} + * received from a previous `ListBackupPlans` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListBackupPlans` must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.gkebackup.v1.BackupPlan|BackupPlan} 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 `listBackupPlansAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBackupPlansStream( + request?: protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, + 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['listBackupPlans']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackupPlans.createStream( + this.innerApiCalls.listBackupPlans as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBackupPlans`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location that contains the BackupPlans to list. + * Format: `projects/* /locations/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token|next_page_token} + * received from a previous `ListBackupPlans` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListBackupPlans` must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkebackup.v1.BackupPlan|BackupPlan}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.list_backup_plans.js + * region_tag:gkebackup_v1_generated_BackupForGKE_ListBackupPlans_async + */ + listBackupPlansAsync( + request?: protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, + 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['listBackupPlans']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackupPlans.asyncIterate( + this.innerApiCalls['listBackupPlans'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists the Backups for a given BackupPlan. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The BackupPlan that contains the Backups to list. + * Format: `projects/* /locations/* /backupPlans/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token|next_page_token} + * received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListBackups` must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.gkebackup.v1.Backup|Backup}. + * 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 `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBackups( + request?: protos.google.cloud.gkebackup.v1.IListBackupsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkebackup.v1.IBackup[], + protos.google.cloud.gkebackup.v1.IListBackupsRequest|null, + protos.google.cloud.gkebackup.v1.IListBackupsResponse + ]>; + listBackups( + request: protos.google.cloud.gkebackup.v1.IListBackupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListBackupsRequest, + protos.google.cloud.gkebackup.v1.IListBackupsResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IBackup>): void; + listBackups( + request: protos.google.cloud.gkebackup.v1.IListBackupsRequest, + callback: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListBackupsRequest, + protos.google.cloud.gkebackup.v1.IListBackupsResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IBackup>): void; + listBackups( + request?: protos.google.cloud.gkebackup.v1.IListBackupsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkebackup.v1.IListBackupsRequest, + protos.google.cloud.gkebackup.v1.IListBackupsResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IBackup>, + callback?: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListBackupsRequest, + protos.google.cloud.gkebackup.v1.IListBackupsResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IBackup>): + Promise<[ + protos.google.cloud.gkebackup.v1.IBackup[], + protos.google.cloud.gkebackup.v1.IListBackupsRequest|null, + protos.google.cloud.gkebackup.v1.IListBackupsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listBackups(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The BackupPlan that contains the Backups to list. + * Format: `projects/* /locations/* /backupPlans/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token|next_page_token} + * received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListBackups` must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.gkebackup.v1.Backup|Backup} 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 `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBackupsStream( + request?: protos.google.cloud.gkebackup.v1.IListBackupsRequest, + 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['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.createStream( + this.innerApiCalls.listBackups as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBackups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The BackupPlan that contains the Backups to list. + * Format: `projects/* /locations/* /backupPlans/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token|next_page_token} + * received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListBackups` must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkebackup.v1.Backup|Backup}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.list_backups.js + * region_tag:gkebackup_v1_generated_BackupForGKE_ListBackups_async + */ + listBackupsAsync( + request?: protos.google.cloud.gkebackup.v1.IListBackupsRequest, + 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['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.asyncIterate( + this.innerApiCalls['listBackups'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists the VolumeBackups for a given Backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The Backup that contains the VolumeBackups to list. + * Format: `projects/* /locations/* /backupPlans/* /backups/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token|next_page_token} + * received from a previous `ListVolumeBackups` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListVolumeBackups` must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.gkebackup.v1.VolumeBackup|VolumeBackup}. + * 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 `listVolumeBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listVolumeBackups( + request?: protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkebackup.v1.IVolumeBackup[], + protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest|null, + protos.google.cloud.gkebackup.v1.IListVolumeBackupsResponse + ]>; + listVolumeBackups( + request: protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, + protos.google.cloud.gkebackup.v1.IListVolumeBackupsResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IVolumeBackup>): void; + listVolumeBackups( + request: protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, + callback: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, + protos.google.cloud.gkebackup.v1.IListVolumeBackupsResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IVolumeBackup>): void; + listVolumeBackups( + request?: protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, + protos.google.cloud.gkebackup.v1.IListVolumeBackupsResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IVolumeBackup>, + callback?: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, + protos.google.cloud.gkebackup.v1.IListVolumeBackupsResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IVolumeBackup>): + Promise<[ + protos.google.cloud.gkebackup.v1.IVolumeBackup[], + protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest|null, + protos.google.cloud.gkebackup.v1.IListVolumeBackupsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listVolumeBackups(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The Backup that contains the VolumeBackups to list. + * Format: `projects/* /locations/* /backupPlans/* /backups/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token|next_page_token} + * received from a previous `ListVolumeBackups` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListVolumeBackups` must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.gkebackup.v1.VolumeBackup|VolumeBackup} 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 `listVolumeBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listVolumeBackupsStream( + request?: protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, + 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['listVolumeBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVolumeBackups.createStream( + this.innerApiCalls.listVolumeBackups as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listVolumeBackups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The Backup that contains the VolumeBackups to list. + * Format: `projects/* /locations/* /backupPlans/* /backups/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token|next_page_token} + * received from a previous `ListVolumeBackups` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListVolumeBackups` must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkebackup.v1.VolumeBackup|VolumeBackup}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.list_volume_backups.js + * region_tag:gkebackup_v1_generated_BackupForGKE_ListVolumeBackups_async + */ + listVolumeBackupsAsync( + request?: protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, + 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['listVolumeBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVolumeBackups.asyncIterate( + this.innerApiCalls['listVolumeBackups'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists RestorePlans in a given location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location that contains the RestorePlans to list. + * Format: `projects/* /locations/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token|next_page_token} + * received from a previous `ListRestorePlans` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListRestorePlans` must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.gkebackup.v1.RestorePlan|RestorePlan}. + * 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 `listRestorePlansAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listRestorePlans( + request?: protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkebackup.v1.IRestorePlan[], + protos.google.cloud.gkebackup.v1.IListRestorePlansRequest|null, + protos.google.cloud.gkebackup.v1.IListRestorePlansResponse + ]>; + listRestorePlans( + request: protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, + protos.google.cloud.gkebackup.v1.IListRestorePlansResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IRestorePlan>): void; + listRestorePlans( + request: protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, + callback: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, + protos.google.cloud.gkebackup.v1.IListRestorePlansResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IRestorePlan>): void; + listRestorePlans( + request?: protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, + protos.google.cloud.gkebackup.v1.IListRestorePlansResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IRestorePlan>, + callback?: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, + protos.google.cloud.gkebackup.v1.IListRestorePlansResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IRestorePlan>): + Promise<[ + protos.google.cloud.gkebackup.v1.IRestorePlan[], + protos.google.cloud.gkebackup.v1.IListRestorePlansRequest|null, + protos.google.cloud.gkebackup.v1.IListRestorePlansResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listRestorePlans(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location that contains the RestorePlans to list. + * Format: `projects/* /locations/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token|next_page_token} + * received from a previous `ListRestorePlans` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListRestorePlans` must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.gkebackup.v1.RestorePlan|RestorePlan} 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 `listRestorePlansAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listRestorePlansStream( + request?: protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, + 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['listRestorePlans']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRestorePlans.createStream( + this.innerApiCalls.listRestorePlans as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listRestorePlans`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location that contains the RestorePlans to list. + * Format: `projects/* /locations/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token|next_page_token} + * received from a previous `ListRestorePlans` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListRestorePlans` must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkebackup.v1.RestorePlan|RestorePlan}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.list_restore_plans.js + * region_tag:gkebackup_v1_generated_BackupForGKE_ListRestorePlans_async + */ + listRestorePlansAsync( + request?: protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, + 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['listRestorePlans']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRestorePlans.asyncIterate( + this.innerApiCalls['listRestorePlans'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists the Restores for a given RestorePlan. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The RestorePlan that contains the Restores to list. + * Format: `projects/* /locations/* /restorePlans/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token|next_page_token} + * received from a previous `ListRestores` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to `ListRestores` + * must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.gkebackup.v1.Restore|Restore}. + * 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 `listRestoresAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listRestores( + request?: protos.google.cloud.gkebackup.v1.IListRestoresRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkebackup.v1.IRestore[], + protos.google.cloud.gkebackup.v1.IListRestoresRequest|null, + protos.google.cloud.gkebackup.v1.IListRestoresResponse + ]>; + listRestores( + request: protos.google.cloud.gkebackup.v1.IListRestoresRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListRestoresRequest, + protos.google.cloud.gkebackup.v1.IListRestoresResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IRestore>): void; + listRestores( + request: protos.google.cloud.gkebackup.v1.IListRestoresRequest, + callback: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListRestoresRequest, + protos.google.cloud.gkebackup.v1.IListRestoresResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IRestore>): void; + listRestores( + request?: protos.google.cloud.gkebackup.v1.IListRestoresRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkebackup.v1.IListRestoresRequest, + protos.google.cloud.gkebackup.v1.IListRestoresResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IRestore>, + callback?: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListRestoresRequest, + protos.google.cloud.gkebackup.v1.IListRestoresResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IRestore>): + Promise<[ + protos.google.cloud.gkebackup.v1.IRestore[], + protos.google.cloud.gkebackup.v1.IListRestoresRequest|null, + protos.google.cloud.gkebackup.v1.IListRestoresResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listRestores(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The RestorePlan that contains the Restores to list. + * Format: `projects/* /locations/* /restorePlans/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token|next_page_token} + * received from a previous `ListRestores` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to `ListRestores` + * must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.gkebackup.v1.Restore|Restore} 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 `listRestoresAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listRestoresStream( + request?: protos.google.cloud.gkebackup.v1.IListRestoresRequest, + 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['listRestores']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRestores.createStream( + this.innerApiCalls.listRestores as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listRestores`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The RestorePlan that contains the Restores to list. + * Format: `projects/* /locations/* /restorePlans/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token|next_page_token} + * received from a previous `ListRestores` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to `ListRestores` + * must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkebackup.v1.Restore|Restore}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.list_restores.js + * region_tag:gkebackup_v1_generated_BackupForGKE_ListRestores_async + */ + listRestoresAsync( + request?: protos.google.cloud.gkebackup.v1.IListRestoresRequest, + 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['listRestores']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRestores.asyncIterate( + this.innerApiCalls['listRestores'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists the VolumeRestores for a given Restore. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The Restore that contains the VolumeRestores to list. + * Format: `projects/* /locations/* /restorePlans/* /restores/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token|next_page_token} + * received from a previous `ListVolumeRestores` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListVolumeRestores` must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.gkebackup.v1.VolumeRestore|VolumeRestore}. + * 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 `listVolumeRestoresAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listVolumeRestores( + request?: protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkebackup.v1.IVolumeRestore[], + protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest|null, + protos.google.cloud.gkebackup.v1.IListVolumeRestoresResponse + ]>; + listVolumeRestores( + request: protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, + protos.google.cloud.gkebackup.v1.IListVolumeRestoresResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IVolumeRestore>): void; + listVolumeRestores( + request: protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, + callback: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, + protos.google.cloud.gkebackup.v1.IListVolumeRestoresResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IVolumeRestore>): void; + listVolumeRestores( + request?: protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, + protos.google.cloud.gkebackup.v1.IListVolumeRestoresResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IVolumeRestore>, + callback?: PaginationCallback< + protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, + protos.google.cloud.gkebackup.v1.IListVolumeRestoresResponse|null|undefined, + protos.google.cloud.gkebackup.v1.IVolumeRestore>): + Promise<[ + protos.google.cloud.gkebackup.v1.IVolumeRestore[], + protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest|null, + protos.google.cloud.gkebackup.v1.IListVolumeRestoresResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listVolumeRestores(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The Restore that contains the VolumeRestores to list. + * Format: `projects/* /locations/* /restorePlans/* /restores/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token|next_page_token} + * received from a previous `ListVolumeRestores` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListVolumeRestores` must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.gkebackup.v1.VolumeRestore|VolumeRestore} 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 `listVolumeRestoresAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listVolumeRestoresStream( + request?: protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, + 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['listVolumeRestores']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVolumeRestores.createStream( + this.innerApiCalls.listVolumeRestores as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listVolumeRestores`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The Restore that contains the VolumeRestores to list. + * Format: `projects/* /locations/* /restorePlans/* /restores/*` + * @param {number} request.pageSize + * The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may inclue a partial list and a caller should + * only rely on the response's + * {@link protos.google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token|next_page_token} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The value of + * {@link protos.google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token|next_page_token} + * received from a previous `ListVolumeRestores` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `ListVolumeRestores` must match the call that provided the page token. + * @param {string} request.filter + * Field match expression used to filter the results. + * @param {string} request.orderBy + * Field by which to sort the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkebackup.v1.VolumeRestore|VolumeRestore}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_for_g_k_e.list_volume_restores.js + * region_tag:gkebackup_v1_generated_BackupForGKE_ListVolumeRestores_async + */ + listVolumeRestoresAsync( + request?: protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, + 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['listVolumeRestores']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVolumeRestores.asyncIterate( + this.innerApiCalls['listVolumeRestores'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} backup_plan + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,location:string,backupPlan:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + backup_plan: backupPlan, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the backup_plan from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup_plan. + */ + matchBackupPlanFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup_plan; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified backupPlan resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} backup_plan + * @returns {string} Resource name string. + */ + backupPlanPath(project:string,location:string,backupPlan:string) { + return this.pathTemplates.backupPlanPathTemplate.render({ + project: project, + location: location, + backup_plan: backupPlan, + }); + } + + /** + * Parse the project from BackupPlan resource. + * + * @param {string} backupPlanName + * A fully-qualified path representing BackupPlan resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupPlanName(backupPlanName: string) { + return this.pathTemplates.backupPlanPathTemplate.match(backupPlanName).project; + } + + /** + * Parse the location from BackupPlan resource. + * + * @param {string} backupPlanName + * A fully-qualified path representing BackupPlan resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupPlanName(backupPlanName: string) { + return this.pathTemplates.backupPlanPathTemplate.match(backupPlanName).location; + } + + /** + * Parse the backup_plan from BackupPlan resource. + * + * @param {string} backupPlanName + * A fully-qualified path representing BackupPlan resource. + * @returns {string} A string representing the backup_plan. + */ + matchBackupPlanFromBackupPlanName(backupPlanName: string) { + return this.pathTemplates.backupPlanPathTemplate.match(backupPlanName).backup_plan; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified restore resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} restore_plan + * @param {string} restore + * @returns {string} Resource name string. + */ + restorePath(project:string,location:string,restorePlan:string,restore:string) { + return this.pathTemplates.restorePathTemplate.render({ + project: project, + location: location, + restore_plan: restorePlan, + restore: restore, + }); + } + + /** + * Parse the project from Restore resource. + * + * @param {string} restoreName + * A fully-qualified path representing Restore resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRestoreName(restoreName: string) { + return this.pathTemplates.restorePathTemplate.match(restoreName).project; + } + + /** + * Parse the location from Restore resource. + * + * @param {string} restoreName + * A fully-qualified path representing Restore resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRestoreName(restoreName: string) { + return this.pathTemplates.restorePathTemplate.match(restoreName).location; + } + + /** + * Parse the restore_plan from Restore resource. + * + * @param {string} restoreName + * A fully-qualified path representing Restore resource. + * @returns {string} A string representing the restore_plan. + */ + matchRestorePlanFromRestoreName(restoreName: string) { + return this.pathTemplates.restorePathTemplate.match(restoreName).restore_plan; + } + + /** + * Parse the restore from Restore resource. + * + * @param {string} restoreName + * A fully-qualified path representing Restore resource. + * @returns {string} A string representing the restore. + */ + matchRestoreFromRestoreName(restoreName: string) { + return this.pathTemplates.restorePathTemplate.match(restoreName).restore; + } + + /** + * Return a fully-qualified restorePlan resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} restore_plan + * @returns {string} Resource name string. + */ + restorePlanPath(project:string,location:string,restorePlan:string) { + return this.pathTemplates.restorePlanPathTemplate.render({ + project: project, + location: location, + restore_plan: restorePlan, + }); + } + + /** + * Parse the project from RestorePlan resource. + * + * @param {string} restorePlanName + * A fully-qualified path representing RestorePlan resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRestorePlanName(restorePlanName: string) { + return this.pathTemplates.restorePlanPathTemplate.match(restorePlanName).project; + } + + /** + * Parse the location from RestorePlan resource. + * + * @param {string} restorePlanName + * A fully-qualified path representing RestorePlan resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRestorePlanName(restorePlanName: string) { + return this.pathTemplates.restorePlanPathTemplate.match(restorePlanName).location; + } + + /** + * Parse the restore_plan from RestorePlan resource. + * + * @param {string} restorePlanName + * A fully-qualified path representing RestorePlan resource. + * @returns {string} A string representing the restore_plan. + */ + matchRestorePlanFromRestorePlanName(restorePlanName: string) { + return this.pathTemplates.restorePlanPathTemplate.match(restorePlanName).restore_plan; + } + + /** + * Return a fully-qualified volumeBackup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} backup_plan + * @param {string} backup + * @param {string} volume_backup + * @returns {string} Resource name string. + */ + volumeBackupPath(project:string,location:string,backupPlan:string,backup:string,volumeBackup:string) { + return this.pathTemplates.volumeBackupPathTemplate.render({ + project: project, + location: location, + backup_plan: backupPlan, + backup: backup, + volume_backup: volumeBackup, + }); + } + + /** + * Parse the project from VolumeBackup resource. + * + * @param {string} volumeBackupName + * A fully-qualified path representing VolumeBackup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVolumeBackupName(volumeBackupName: string) { + return this.pathTemplates.volumeBackupPathTemplate.match(volumeBackupName).project; + } + + /** + * Parse the location from VolumeBackup resource. + * + * @param {string} volumeBackupName + * A fully-qualified path representing VolumeBackup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVolumeBackupName(volumeBackupName: string) { + return this.pathTemplates.volumeBackupPathTemplate.match(volumeBackupName).location; + } + + /** + * Parse the backup_plan from VolumeBackup resource. + * + * @param {string} volumeBackupName + * A fully-qualified path representing VolumeBackup resource. + * @returns {string} A string representing the backup_plan. + */ + matchBackupPlanFromVolumeBackupName(volumeBackupName: string) { + return this.pathTemplates.volumeBackupPathTemplate.match(volumeBackupName).backup_plan; + } + + /** + * Parse the backup from VolumeBackup resource. + * + * @param {string} volumeBackupName + * A fully-qualified path representing VolumeBackup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromVolumeBackupName(volumeBackupName: string) { + return this.pathTemplates.volumeBackupPathTemplate.match(volumeBackupName).backup; + } + + /** + * Parse the volume_backup from VolumeBackup resource. + * + * @param {string} volumeBackupName + * A fully-qualified path representing VolumeBackup resource. + * @returns {string} A string representing the volume_backup. + */ + matchVolumeBackupFromVolumeBackupName(volumeBackupName: string) { + return this.pathTemplates.volumeBackupPathTemplate.match(volumeBackupName).volume_backup; + } + + /** + * Return a fully-qualified volumeRestore resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} restore_plan + * @param {string} restore + * @param {string} volume_restore + * @returns {string} Resource name string. + */ + volumeRestorePath(project:string,location:string,restorePlan:string,restore:string,volumeRestore:string) { + return this.pathTemplates.volumeRestorePathTemplate.render({ + project: project, + location: location, + restore_plan: restorePlan, + restore: restore, + volume_restore: volumeRestore, + }); + } + + /** + * Parse the project from VolumeRestore resource. + * + * @param {string} volumeRestoreName + * A fully-qualified path representing VolumeRestore resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVolumeRestoreName(volumeRestoreName: string) { + return this.pathTemplates.volumeRestorePathTemplate.match(volumeRestoreName).project; + } + + /** + * Parse the location from VolumeRestore resource. + * + * @param {string} volumeRestoreName + * A fully-qualified path representing VolumeRestore resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVolumeRestoreName(volumeRestoreName: string) { + return this.pathTemplates.volumeRestorePathTemplate.match(volumeRestoreName).location; + } + + /** + * Parse the restore_plan from VolumeRestore resource. + * + * @param {string} volumeRestoreName + * A fully-qualified path representing VolumeRestore resource. + * @returns {string} A string representing the restore_plan. + */ + matchRestorePlanFromVolumeRestoreName(volumeRestoreName: string) { + return this.pathTemplates.volumeRestorePathTemplate.match(volumeRestoreName).restore_plan; + } + + /** + * Parse the restore from VolumeRestore resource. + * + * @param {string} volumeRestoreName + * A fully-qualified path representing VolumeRestore resource. + * @returns {string} A string representing the restore. + */ + matchRestoreFromVolumeRestoreName(volumeRestoreName: string) { + return this.pathTemplates.volumeRestorePathTemplate.match(volumeRestoreName).restore; + } + + /** + * Parse the volume_restore from VolumeRestore resource. + * + * @param {string} volumeRestoreName + * A fully-qualified path representing VolumeRestore resource. + * @returns {string} A string representing the volume_restore. + */ + matchVolumeRestoreFromVolumeRestoreName(volumeRestoreName: string) { + return this.pathTemplates.volumeRestorePathTemplate.match(volumeRestoreName).volume_restore; + } + + /** + * 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.backupForGKEStub && !this._terminated) { + return this.backupForGKEStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_client_config.json b/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_client_config.json new file mode 100644 index 00000000000..5b662185052 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_client_config.json @@ -0,0 +1,158 @@ +{ + "interfaces": { + "google.cloud.gkebackup.v1.BackupForGKE": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c": { + "initial_retry_delay_millis": 1000, + "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": { + "CreateBackupPlan": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBackupPlans": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + }, + "GetBackupPlan": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + }, + "UpdateBackupPlan": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBackupPlan": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateBackup": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + }, + "UpdateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBackup": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListVolumeBackups": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + }, + "GetVolumeBackup": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + }, + "CreateRestorePlan": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListRestorePlans": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + }, + "GetRestorePlan": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + }, + "UpdateRestorePlan": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteRestorePlan": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateRestore": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListRestores": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + }, + "GetRestore": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + }, + "UpdateRestore": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteRestore": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListVolumeRestores": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + }, + "GetVolumeRestore": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_proto_list.json b/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_proto_list.json new file mode 100644 index 00000000000..30bdfe50d4f --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/cloud/gkebackup/v1/backup.proto", + "../../protos/google/cloud/gkebackup/v1/backup_plan.proto", + "../../protos/google/cloud/gkebackup/v1/common.proto", + "../../protos/google/cloud/gkebackup/v1/gkebackup.proto", + "../../protos/google/cloud/gkebackup/v1/restore.proto", + "../../protos/google/cloud/gkebackup/v1/restore_plan.proto", + "../../protos/google/cloud/gkebackup/v1/volume.proto" +] diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..f3498121c6e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/gapic_metadata.json @@ -0,0 +1,287 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.gkebackup.v1", + "libraryPackage": "@google-cloud/gke-backup", + "services": { + "BackupForGKE": { + "clients": { + "grpc": { + "libraryClient": "BackupForGKEClient", + "rpcs": { + "GetBackupPlan": { + "methods": [ + "getBackupPlan" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "GetVolumeBackup": { + "methods": [ + "getVolumeBackup" + ] + }, + "GetRestorePlan": { + "methods": [ + "getRestorePlan" + ] + }, + "GetRestore": { + "methods": [ + "getRestore" + ] + }, + "GetVolumeRestore": { + "methods": [ + "getVolumeRestore" + ] + }, + "CreateBackupPlan": { + "methods": [ + "createBackupPlan" + ] + }, + "UpdateBackupPlan": { + "methods": [ + "updateBackupPlan" + ] + }, + "DeleteBackupPlan": { + "methods": [ + "deleteBackupPlan" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "CreateRestorePlan": { + "methods": [ + "createRestorePlan" + ] + }, + "UpdateRestorePlan": { + "methods": [ + "updateRestorePlan" + ] + }, + "DeleteRestorePlan": { + "methods": [ + "deleteRestorePlan" + ] + }, + "CreateRestore": { + "methods": [ + "createRestore" + ] + }, + "UpdateRestore": { + "methods": [ + "updateRestore" + ] + }, + "DeleteRestore": { + "methods": [ + "deleteRestore" + ] + }, + "ListBackupPlans": { + "methods": [ + "listBackupPlans", + "listBackupPlansStream", + "listBackupPlansAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + }, + "ListVolumeBackups": { + "methods": [ + "listVolumeBackups", + "listVolumeBackupsStream", + "listVolumeBackupsAsync" + ] + }, + "ListRestorePlans": { + "methods": [ + "listRestorePlans", + "listRestorePlansStream", + "listRestorePlansAsync" + ] + }, + "ListRestores": { + "methods": [ + "listRestores", + "listRestoresStream", + "listRestoresAsync" + ] + }, + "ListVolumeRestores": { + "methods": [ + "listVolumeRestores", + "listVolumeRestoresStream", + "listVolumeRestoresAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "BackupForGKEClient", + "rpcs": { + "GetBackupPlan": { + "methods": [ + "getBackupPlan" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "GetVolumeBackup": { + "methods": [ + "getVolumeBackup" + ] + }, + "GetRestorePlan": { + "methods": [ + "getRestorePlan" + ] + }, + "GetRestore": { + "methods": [ + "getRestore" + ] + }, + "GetVolumeRestore": { + "methods": [ + "getVolumeRestore" + ] + }, + "CreateBackupPlan": { + "methods": [ + "createBackupPlan" + ] + }, + "UpdateBackupPlan": { + "methods": [ + "updateBackupPlan" + ] + }, + "DeleteBackupPlan": { + "methods": [ + "deleteBackupPlan" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "CreateRestorePlan": { + "methods": [ + "createRestorePlan" + ] + }, + "UpdateRestorePlan": { + "methods": [ + "updateRestorePlan" + ] + }, + "DeleteRestorePlan": { + "methods": [ + "deleteRestorePlan" + ] + }, + "CreateRestore": { + "methods": [ + "createRestore" + ] + }, + "UpdateRestore": { + "methods": [ + "updateRestore" + ] + }, + "DeleteRestore": { + "methods": [ + "deleteRestore" + ] + }, + "ListBackupPlans": { + "methods": [ + "listBackupPlans", + "listBackupPlansStream", + "listBackupPlansAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + }, + "ListVolumeBackups": { + "methods": [ + "listVolumeBackups", + "listVolumeBackupsStream", + "listVolumeBackupsAsync" + ] + }, + "ListRestorePlans": { + "methods": [ + "listRestorePlans", + "listRestorePlansStream", + "listRestorePlansAsync" + ] + }, + "ListRestores": { + "methods": [ + "listRestores", + "listRestoresStream", + "listRestoresAsync" + ] + }, + "ListVolumeRestores": { + "methods": [ + "listVolumeRestores", + "listVolumeRestoresStream", + "listVolumeRestoresAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/index.ts new file mode 100644 index 00000000000..fcc504ab5a1 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/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 {BackupForGKEClient} from './backup_for_g_k_e_client'; diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gkebackup/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..3214dcb132a --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/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 gkebackup = require('@google-cloud/gke-backup'); + +function main() { + const backupForGKEClient = new gkebackup.BackupForGKEClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gkebackup/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..ad85b8b7446 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/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 {BackupForGKEClient} from '@google-cloud/gke-backup'; + +// check that the client class type name can be used +function doStuffWithBackupForGKEClient(client: BackupForGKEClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const backupForGKEClient = new BackupForGKEClient(); + doStuffWithBackupForGKEClient(backupForGKEClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/system-test/install.ts b/owl-bot-staging/google-cloud-gkebackup/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/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-gkebackup/v1/test/gapic_backup_for_g_k_e_v1.ts b/owl-bot-staging/google-cloud-gkebackup/v1/test/gapic_backup_for_g_k_e_v1.ts new file mode 100644 index 00000000000..04fd6e4db23 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/v1/test/gapic_backup_for_g_k_e_v1.ts @@ -0,0 +1,5257 @@ +// 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 backupforgkeModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.BackupForGKEClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = backupforgkeModule.v1.BackupForGKEClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = backupforgkeModule.v1.BackupForGKEClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = backupforgkeModule.v1.BackupForGKEClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new backupforgkeModule.v1.BackupForGKEClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.backupForGKEStub, undefined); + await client.initialize(); + assert(client.backupForGKEStub); + }); + + it('has close method for the initialized client', done => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.backupForGKEStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.backupForGKEStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new backupforgkeModule.v1.BackupForGKEClient({ + 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 backupforgkeModule.v1.BackupForGKEClient({ + 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('getBackupPlan', () => { + it('invokes getBackupPlan without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetBackupPlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetBackupPlanRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.BackupPlan() + ); + client.innerApiCalls.getBackupPlan = stubSimpleCall(expectedResponse); + const [response] = await client.getBackupPlan(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBackupPlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackupPlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackupPlan without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetBackupPlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetBackupPlanRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.BackupPlan() + ); + client.innerApiCalls.getBackupPlan = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackupPlan( + request, + (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IBackupPlan|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBackupPlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackupPlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackupPlan with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetBackupPlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetBackupPlanRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackupPlan = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBackupPlan(request), expectedError); + const actualRequest = (client.innerApiCalls.getBackupPlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackupPlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackupPlan with closed client', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetBackupPlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetBackupPlanRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBackupPlan(request), expectedError); + }); + }); + + describe('getBackup', () => { + it('invokes getBackup without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.Backup() + ); + client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); + const [response] = await client.getBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.Backup() + ); + client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackup( + request, + (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IBackup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with closed client', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBackup(request), expectedError); + }); + }); + + describe('getVolumeBackup', () => { + it('invokes getVolumeBackup without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetVolumeBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetVolumeBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.VolumeBackup() + ); + client.innerApiCalls.getVolumeBackup = stubSimpleCall(expectedResponse); + const [response] = await client.getVolumeBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getVolumeBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVolumeBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVolumeBackup without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetVolumeBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetVolumeBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.VolumeBackup() + ); + client.innerApiCalls.getVolumeBackup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getVolumeBackup( + request, + (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IVolumeBackup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getVolumeBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVolumeBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVolumeBackup with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetVolumeBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetVolumeBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getVolumeBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getVolumeBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.getVolumeBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVolumeBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVolumeBackup with closed client', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetVolumeBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetVolumeBackupRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getVolumeBackup(request), expectedError); + }); + }); + + describe('getRestorePlan', () => { + it('invokes getRestorePlan without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetRestorePlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetRestorePlanRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.RestorePlan() + ); + client.innerApiCalls.getRestorePlan = stubSimpleCall(expectedResponse); + const [response] = await client.getRestorePlan(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRestorePlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRestorePlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRestorePlan without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetRestorePlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetRestorePlanRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.RestorePlan() + ); + client.innerApiCalls.getRestorePlan = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getRestorePlan( + request, + (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IRestorePlan|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRestorePlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRestorePlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRestorePlan with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetRestorePlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetRestorePlanRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getRestorePlan = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getRestorePlan(request), expectedError); + const actualRequest = (client.innerApiCalls.getRestorePlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRestorePlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRestorePlan with closed client', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetRestorePlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetRestorePlanRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getRestorePlan(request), expectedError); + }); + }); + + describe('getRestore', () => { + it('invokes getRestore without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetRestoreRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetRestoreRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.Restore() + ); + client.innerApiCalls.getRestore = stubSimpleCall(expectedResponse); + const [response] = await client.getRestore(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRestore without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetRestoreRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetRestoreRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.Restore() + ); + client.innerApiCalls.getRestore = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getRestore( + request, + (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IRestore|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRestore with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetRestoreRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetRestoreRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getRestore = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getRestore(request), expectedError); + const actualRequest = (client.innerApiCalls.getRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRestore with closed client', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetRestoreRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetRestoreRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getRestore(request), expectedError); + }); + }); + + describe('getVolumeRestore', () => { + it('invokes getVolumeRestore without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetVolumeRestoreRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetVolumeRestoreRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.VolumeRestore() + ); + client.innerApiCalls.getVolumeRestore = stubSimpleCall(expectedResponse); + const [response] = await client.getVolumeRestore(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getVolumeRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVolumeRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVolumeRestore without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetVolumeRestoreRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetVolumeRestoreRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.VolumeRestore() + ); + client.innerApiCalls.getVolumeRestore = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getVolumeRestore( + request, + (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IVolumeRestore|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getVolumeRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVolumeRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVolumeRestore with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetVolumeRestoreRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetVolumeRestoreRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getVolumeRestore = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getVolumeRestore(request), expectedError); + const actualRequest = (client.innerApiCalls.getVolumeRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVolumeRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVolumeRestore with closed client', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.GetVolumeRestoreRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.GetVolumeRestoreRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getVolumeRestore(request), expectedError); + }); + }); + + describe('createBackupPlan', () => { + it('invokes createBackupPlan without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.CreateBackupPlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateBackupPlanRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBackupPlan = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBackupPlan(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBackupPlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackupPlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackupPlan without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.CreateBackupPlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateBackupPlanRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBackupPlan = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackupPlan( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBackupPlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackupPlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackupPlan with call error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.CreateBackupPlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateBackupPlanRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackupPlan = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBackupPlan(request), expectedError); + const actualRequest = (client.innerApiCalls.createBackupPlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackupPlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackupPlan with LRO error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.CreateBackupPlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateBackupPlanRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackupPlan = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBackupPlan(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createBackupPlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackupPlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateBackupPlanProgress without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateBackupPlanProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateBackupPlanProgress with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateBackupPlanProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateBackupPlan', () => { + it('invokes updateBackupPlan without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.UpdateBackupPlanRequest() + ); + request.backupPlan ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateBackupPlanRequest', ['backupPlan', 'name']); + request.backupPlan.name = defaultValue1; + const expectedHeaderRequestParams = `backup_plan.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateBackupPlan = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateBackupPlan(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBackupPlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBackupPlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBackupPlan without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.UpdateBackupPlanRequest() + ); + request.backupPlan ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateBackupPlanRequest', ['backupPlan', 'name']); + request.backupPlan.name = defaultValue1; + const expectedHeaderRequestParams = `backup_plan.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateBackupPlan = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBackupPlan( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBackupPlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBackupPlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBackupPlan with call error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.UpdateBackupPlanRequest() + ); + request.backupPlan ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateBackupPlanRequest', ['backupPlan', 'name']); + request.backupPlan.name = defaultValue1; + const expectedHeaderRequestParams = `backup_plan.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackupPlan = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateBackupPlan(request), expectedError); + const actualRequest = (client.innerApiCalls.updateBackupPlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBackupPlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBackupPlan with LRO error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.UpdateBackupPlanRequest() + ); + request.backupPlan ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateBackupPlanRequest', ['backupPlan', 'name']); + request.backupPlan.name = defaultValue1; + const expectedHeaderRequestParams = `backup_plan.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackupPlan = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateBackupPlan(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateBackupPlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBackupPlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateBackupPlanProgress without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateBackupPlanProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateBackupPlanProgress with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateBackupPlanProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteBackupPlan', () => { + it('invokes deleteBackupPlan without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.DeleteBackupPlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteBackupPlanRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteBackupPlan = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteBackupPlan(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBackupPlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackupPlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackupPlan without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.DeleteBackupPlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteBackupPlanRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteBackupPlan = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackupPlan( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBackupPlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackupPlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackupPlan with call error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.DeleteBackupPlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteBackupPlanRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackupPlan = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteBackupPlan(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteBackupPlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackupPlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackupPlan with LRO error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.DeleteBackupPlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteBackupPlanRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackupPlan = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteBackupPlan(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteBackupPlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackupPlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteBackupPlanProgress without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteBackupPlanProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteBackupPlanProgress with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteBackupPlanProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createBackup', () => { + it('invokes createBackup without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with call error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with LRO error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBackup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateBackupProgress without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateBackupProgress with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateBackup', () => { + it('invokes updateBackup without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.UpdateBackupRequest() + ); + request.backup ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateBackupRequest', ['backup', 'name']); + request.backup.name = defaultValue1; + const expectedHeaderRequestParams = `backup.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBackup without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.UpdateBackupRequest() + ); + request.backup ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateBackupRequest', ['backup', 'name']); + request.backup.name = defaultValue1; + const expectedHeaderRequestParams = `backup.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBackup with call error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.UpdateBackupRequest() + ); + request.backup ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateBackupRequest', ['backup', 'name']); + request.backup.name = defaultValue1; + const expectedHeaderRequestParams = `backup.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBackup with LRO error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.UpdateBackupRequest() + ); + request.backup ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateBackupRequest', ['backup', 'name']); + request.backup.name = defaultValue1; + const expectedHeaderRequestParams = `backup.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateBackup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateBackupProgress without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateBackupProgress with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteBackup', () => { + it('invokes deleteBackup without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with call error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with LRO error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteBackup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteBackupProgress without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteBackupProgress with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createRestorePlan', () => { + it('invokes createRestorePlan without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.CreateRestorePlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateRestorePlanRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createRestorePlan = stubLongRunningCall(expectedResponse); + const [operation] = await client.createRestorePlan(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createRestorePlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRestorePlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRestorePlan without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.CreateRestorePlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateRestorePlanRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createRestorePlan = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createRestorePlan( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createRestorePlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRestorePlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRestorePlan with call error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.CreateRestorePlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateRestorePlanRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createRestorePlan = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createRestorePlan(request), expectedError); + const actualRequest = (client.innerApiCalls.createRestorePlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRestorePlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRestorePlan with LRO error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.CreateRestorePlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateRestorePlanRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createRestorePlan = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createRestorePlan(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createRestorePlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRestorePlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateRestorePlanProgress without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateRestorePlanProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateRestorePlanProgress with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateRestorePlanProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateRestorePlan', () => { + it('invokes updateRestorePlan without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.UpdateRestorePlanRequest() + ); + request.restorePlan ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateRestorePlanRequest', ['restorePlan', 'name']); + request.restorePlan.name = defaultValue1; + const expectedHeaderRequestParams = `restore_plan.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateRestorePlan = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateRestorePlan(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateRestorePlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateRestorePlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateRestorePlan without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.UpdateRestorePlanRequest() + ); + request.restorePlan ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateRestorePlanRequest', ['restorePlan', 'name']); + request.restorePlan.name = defaultValue1; + const expectedHeaderRequestParams = `restore_plan.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateRestorePlan = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateRestorePlan( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateRestorePlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateRestorePlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateRestorePlan with call error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.UpdateRestorePlanRequest() + ); + request.restorePlan ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateRestorePlanRequest', ['restorePlan', 'name']); + request.restorePlan.name = defaultValue1; + const expectedHeaderRequestParams = `restore_plan.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateRestorePlan = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateRestorePlan(request), expectedError); + const actualRequest = (client.innerApiCalls.updateRestorePlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateRestorePlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateRestorePlan with LRO error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.UpdateRestorePlanRequest() + ); + request.restorePlan ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateRestorePlanRequest', ['restorePlan', 'name']); + request.restorePlan.name = defaultValue1; + const expectedHeaderRequestParams = `restore_plan.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateRestorePlan = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateRestorePlan(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateRestorePlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateRestorePlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateRestorePlanProgress without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateRestorePlanProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateRestorePlanProgress with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateRestorePlanProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteRestorePlan', () => { + it('invokes deleteRestorePlan without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.DeleteRestorePlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteRestorePlanRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteRestorePlan = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteRestorePlan(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteRestorePlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRestorePlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRestorePlan without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.DeleteRestorePlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteRestorePlanRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteRestorePlan = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteRestorePlan( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteRestorePlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRestorePlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRestorePlan with call error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.DeleteRestorePlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteRestorePlanRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteRestorePlan = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteRestorePlan(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteRestorePlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRestorePlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRestorePlan with LRO error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.DeleteRestorePlanRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteRestorePlanRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteRestorePlan = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteRestorePlan(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteRestorePlan as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRestorePlan as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteRestorePlanProgress without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteRestorePlanProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteRestorePlanProgress with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteRestorePlanProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createRestore', () => { + it('invokes createRestore without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.CreateRestoreRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateRestoreRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createRestore = stubLongRunningCall(expectedResponse); + const [operation] = await client.createRestore(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRestore without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.CreateRestoreRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateRestoreRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createRestore = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createRestore( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRestore with call error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.CreateRestoreRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateRestoreRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createRestore = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createRestore(request), expectedError); + const actualRequest = (client.innerApiCalls.createRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRestore with LRO error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.CreateRestoreRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateRestoreRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createRestore = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createRestore(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateRestoreProgress without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateRestoreProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateRestoreProgress with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateRestoreProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateRestore', () => { + it('invokes updateRestore without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.UpdateRestoreRequest() + ); + request.restore ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateRestoreRequest', ['restore', 'name']); + request.restore.name = defaultValue1; + const expectedHeaderRequestParams = `restore.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateRestore = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateRestore(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateRestore without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.UpdateRestoreRequest() + ); + request.restore ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateRestoreRequest', ['restore', 'name']); + request.restore.name = defaultValue1; + const expectedHeaderRequestParams = `restore.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateRestore = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateRestore( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateRestore with call error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.UpdateRestoreRequest() + ); + request.restore ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateRestoreRequest', ['restore', 'name']); + request.restore.name = defaultValue1; + const expectedHeaderRequestParams = `restore.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateRestore = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateRestore(request), expectedError); + const actualRequest = (client.innerApiCalls.updateRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateRestore with LRO error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.UpdateRestoreRequest() + ); + request.restore ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateRestoreRequest', ['restore', 'name']); + request.restore.name = defaultValue1; + const expectedHeaderRequestParams = `restore.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateRestore = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateRestore(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateRestoreProgress without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateRestoreProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateRestoreProgress with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateRestoreProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteRestore', () => { + it('invokes deleteRestore without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.DeleteRestoreRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteRestoreRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteRestore = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteRestore(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRestore without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.DeleteRestoreRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteRestoreRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteRestore = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteRestore( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRestore with call error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.DeleteRestoreRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteRestoreRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteRestore = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteRestore(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRestore with LRO error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.DeleteRestoreRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteRestoreRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteRestore = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteRestore(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteRestore as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRestore as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteRestoreProgress without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteRestoreProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteRestoreProgress with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteRestoreProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listBackupPlans', () => { + it('invokes listBackupPlans without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListBackupPlansRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupPlansRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), + ]; + client.innerApiCalls.listBackupPlans = stubSimpleCall(expectedResponse); + const [response] = await client.listBackupPlans(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBackupPlans as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackupPlans as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackupPlans without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListBackupPlansRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupPlansRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), + ]; + client.innerApiCalls.listBackupPlans = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackupPlans( + request, + (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IBackupPlan[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBackupPlans as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackupPlans as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackupPlans with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListBackupPlansRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupPlansRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackupPlans = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBackupPlans(request), expectedError); + const actualRequest = (client.innerApiCalls.listBackupPlans as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackupPlans as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackupPlansStream without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListBackupPlansRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupPlansRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), + ]; + client.descriptors.page.listBackupPlans.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBackupPlansStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkebackup.v1.BackupPlan[] = []; + stream.on('data', (response: protos.google.cloud.gkebackup.v1.BackupPlan) => { + 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.listBackupPlans.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackupPlans, request)); + assert( + (client.descriptors.page.listBackupPlans.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listBackupPlansStream with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListBackupPlansRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupPlansRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackupPlans.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBackupPlansStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkebackup.v1.BackupPlan[] = []; + stream.on('data', (response: protos.google.cloud.gkebackup.v1.BackupPlan) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBackupPlans.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackupPlans, request)); + assert( + (client.descriptors.page.listBackupPlans.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBackupPlans without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListBackupPlansRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupPlansRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), + ]; + client.descriptors.page.listBackupPlans.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkebackup.v1.IBackupPlan[] = []; + const iterable = client.listBackupPlansAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBackupPlans.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBackupPlans.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBackupPlans with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListBackupPlansRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupPlansRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackupPlans.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBackupPlansAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkebackup.v1.IBackupPlan[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBackupPlans.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBackupPlans.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listBackups', () => { + it('invokes listBackups without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listBackups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackups( + request, + (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IBackup[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBackups(request), expectedError); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackupsStream without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), + ]; + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkebackup.v1.Backup[] = []; + stream.on('data', (response: protos.google.cloud.gkebackup.v1.Backup) => { + 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.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listBackupsStream with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkebackup.v1.Backup[] = []; + stream.on('data', (response: protos.google.cloud.gkebackup.v1.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBackups without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), + ]; + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkebackup.v1.IBackup[] = []; + const iterable = client.listBackupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBackups with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBackupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkebackup.v1.IBackup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listVolumeBackups', () => { + it('invokes listVolumeBackups without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListVolumeBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), + ]; + client.innerApiCalls.listVolumeBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listVolumeBackups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listVolumeBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVolumeBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVolumeBackups without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListVolumeBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), + ]; + client.innerApiCalls.listVolumeBackups = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listVolumeBackups( + request, + (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IVolumeBackup[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listVolumeBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVolumeBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVolumeBackups with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListVolumeBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listVolumeBackups = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listVolumeBackups(request), expectedError); + const actualRequest = (client.innerApiCalls.listVolumeBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVolumeBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVolumeBackupsStream without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListVolumeBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), + ]; + client.descriptors.page.listVolumeBackups.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listVolumeBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkebackup.v1.VolumeBackup[] = []; + stream.on('data', (response: protos.google.cloud.gkebackup.v1.VolumeBackup) => { + 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.listVolumeBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listVolumeBackups, request)); + assert( + (client.descriptors.page.listVolumeBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listVolumeBackupsStream with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListVolumeBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVolumeBackups.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listVolumeBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkebackup.v1.VolumeBackup[] = []; + stream.on('data', (response: protos.google.cloud.gkebackup.v1.VolumeBackup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listVolumeBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listVolumeBackups, request)); + assert( + (client.descriptors.page.listVolumeBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listVolumeBackups without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListVolumeBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), + ]; + client.descriptors.page.listVolumeBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkebackup.v1.IVolumeBackup[] = []; + const iterable = client.listVolumeBackupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listVolumeBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listVolumeBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listVolumeBackups with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListVolumeBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVolumeBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listVolumeBackupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkebackup.v1.IVolumeBackup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listVolumeBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listVolumeBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listRestorePlans', () => { + it('invokes listRestorePlans without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListRestorePlansRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestorePlansRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), + ]; + client.innerApiCalls.listRestorePlans = stubSimpleCall(expectedResponse); + const [response] = await client.listRestorePlans(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRestorePlans as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRestorePlans as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRestorePlans without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListRestorePlansRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestorePlansRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), + ]; + client.innerApiCalls.listRestorePlans = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRestorePlans( + request, + (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IRestorePlan[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRestorePlans as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRestorePlans as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRestorePlans with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListRestorePlansRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestorePlansRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRestorePlans = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listRestorePlans(request), expectedError); + const actualRequest = (client.innerApiCalls.listRestorePlans as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRestorePlans as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRestorePlansStream without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListRestorePlansRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestorePlansRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), + ]; + client.descriptors.page.listRestorePlans.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listRestorePlansStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkebackup.v1.RestorePlan[] = []; + stream.on('data', (response: protos.google.cloud.gkebackup.v1.RestorePlan) => { + 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.listRestorePlans.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRestorePlans, request)); + assert( + (client.descriptors.page.listRestorePlans.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listRestorePlansStream with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListRestorePlansRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestorePlansRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRestorePlans.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listRestorePlansStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkebackup.v1.RestorePlan[] = []; + stream.on('data', (response: protos.google.cloud.gkebackup.v1.RestorePlan) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listRestorePlans.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRestorePlans, request)); + assert( + (client.descriptors.page.listRestorePlans.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRestorePlans without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListRestorePlansRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestorePlansRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), + ]; + client.descriptors.page.listRestorePlans.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkebackup.v1.IRestorePlan[] = []; + const iterable = client.listRestorePlansAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listRestorePlans.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRestorePlans.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRestorePlans with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListRestorePlansRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestorePlansRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRestorePlans.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listRestorePlansAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkebackup.v1.IRestorePlan[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listRestorePlans.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRestorePlans.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listRestores', () => { + it('invokes listRestores without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListRestoresRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestoresRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), + ]; + client.innerApiCalls.listRestores = stubSimpleCall(expectedResponse); + const [response] = await client.listRestores(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRestores as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRestores as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRestores without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListRestoresRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestoresRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), + ]; + client.innerApiCalls.listRestores = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRestores( + request, + (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IRestore[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRestores as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRestores as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRestores with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListRestoresRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestoresRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRestores = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listRestores(request), expectedError); + const actualRequest = (client.innerApiCalls.listRestores as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRestores as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRestoresStream without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListRestoresRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestoresRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), + ]; + client.descriptors.page.listRestores.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listRestoresStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkebackup.v1.Restore[] = []; + stream.on('data', (response: protos.google.cloud.gkebackup.v1.Restore) => { + 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.listRestores.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRestores, request)); + assert( + (client.descriptors.page.listRestores.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listRestoresStream with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListRestoresRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestoresRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRestores.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listRestoresStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkebackup.v1.Restore[] = []; + stream.on('data', (response: protos.google.cloud.gkebackup.v1.Restore) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listRestores.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRestores, request)); + assert( + (client.descriptors.page.listRestores.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRestores without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListRestoresRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestoresRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), + ]; + client.descriptors.page.listRestores.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkebackup.v1.IRestore[] = []; + const iterable = client.listRestoresAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listRestores.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRestores.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRestores with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListRestoresRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestoresRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRestores.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listRestoresAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkebackup.v1.IRestore[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listRestores.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRestores.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listVolumeRestores', () => { + it('invokes listVolumeRestores without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListVolumeRestoresRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeRestoresRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), + ]; + client.innerApiCalls.listVolumeRestores = stubSimpleCall(expectedResponse); + const [response] = await client.listVolumeRestores(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listVolumeRestores as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVolumeRestores as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVolumeRestores without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListVolumeRestoresRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeRestoresRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), + ]; + client.innerApiCalls.listVolumeRestores = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listVolumeRestores( + request, + (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IVolumeRestore[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listVolumeRestores as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVolumeRestores as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVolumeRestores with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListVolumeRestoresRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeRestoresRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listVolumeRestores = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listVolumeRestores(request), expectedError); + const actualRequest = (client.innerApiCalls.listVolumeRestores as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVolumeRestores as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVolumeRestoresStream without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListVolumeRestoresRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeRestoresRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), + ]; + client.descriptors.page.listVolumeRestores.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listVolumeRestoresStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkebackup.v1.VolumeRestore[] = []; + stream.on('data', (response: protos.google.cloud.gkebackup.v1.VolumeRestore) => { + 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.listVolumeRestores.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listVolumeRestores, request)); + assert( + (client.descriptors.page.listVolumeRestores.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listVolumeRestoresStream with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListVolumeRestoresRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeRestoresRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVolumeRestores.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listVolumeRestoresStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkebackup.v1.VolumeRestore[] = []; + stream.on('data', (response: protos.google.cloud.gkebackup.v1.VolumeRestore) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listVolumeRestores.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listVolumeRestores, request)); + assert( + (client.descriptors.page.listVolumeRestores.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listVolumeRestores without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListVolumeRestoresRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeRestoresRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), + generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), + ]; + client.descriptors.page.listVolumeRestores.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkebackup.v1.IVolumeRestore[] = []; + const iterable = client.listVolumeRestoresAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listVolumeRestores.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listVolumeRestores.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listVolumeRestores with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkebackup.v1.ListVolumeRestoresRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeRestoresRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVolumeRestores.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listVolumeRestoresAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkebackup.v1.IVolumeRestore[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listVolumeRestores.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listVolumeRestores.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + backup_plan: "backupPlanValue", + backup: "backupValue", + }; + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "locationValue", "backupPlanValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupPlanFromBackupName', () => { + const result = client.matchBackupPlanFromBackupName(fakePath); + assert.strictEqual(result, "backupPlanValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('backupPlan', () => { + const fakePath = "/rendered/path/backupPlan"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + backup_plan: "backupPlanValue", + }; + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPlanPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPlanPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPlanPath', () => { + const result = client.backupPlanPath("projectValue", "locationValue", "backupPlanValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPlanPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupPlanName', () => { + const result = client.matchProjectFromBackupPlanName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPlanPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupPlanName', () => { + const result = client.matchLocationFromBackupPlanName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPlanPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupPlanFromBackupPlanName', () => { + const result = client.matchBackupPlanFromBackupPlanName(fakePath); + assert.strictEqual(result, "backupPlanValue"); + assert((client.pathTemplates.backupPlanPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('restore', () => { + const fakePath = "/rendered/path/restore"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + restore_plan: "restorePlanValue", + restore: "restoreValue", + }; + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.restorePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.restorePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('restorePath', () => { + const result = client.restorePath("projectValue", "locationValue", "restorePlanValue", "restoreValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.restorePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromRestoreName', () => { + const result = client.matchProjectFromRestoreName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.restorePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromRestoreName', () => { + const result = client.matchLocationFromRestoreName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.restorePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRestorePlanFromRestoreName', () => { + const result = client.matchRestorePlanFromRestoreName(fakePath); + assert.strictEqual(result, "restorePlanValue"); + assert((client.pathTemplates.restorePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRestoreFromRestoreName', () => { + const result = client.matchRestoreFromRestoreName(fakePath); + assert.strictEqual(result, "restoreValue"); + assert((client.pathTemplates.restorePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('restorePlan', () => { + const fakePath = "/rendered/path/restorePlan"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + restore_plan: "restorePlanValue", + }; + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.restorePlanPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.restorePlanPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('restorePlanPath', () => { + const result = client.restorePlanPath("projectValue", "locationValue", "restorePlanValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.restorePlanPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromRestorePlanName', () => { + const result = client.matchProjectFromRestorePlanName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.restorePlanPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromRestorePlanName', () => { + const result = client.matchLocationFromRestorePlanName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.restorePlanPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRestorePlanFromRestorePlanName', () => { + const result = client.matchRestorePlanFromRestorePlanName(fakePath); + assert.strictEqual(result, "restorePlanValue"); + assert((client.pathTemplates.restorePlanPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('volumeBackup', () => { + const fakePath = "/rendered/path/volumeBackup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + backup_plan: "backupPlanValue", + backup: "backupValue", + volume_backup: "volumeBackupValue", + }; + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.volumeBackupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.volumeBackupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('volumeBackupPath', () => { + const result = client.volumeBackupPath("projectValue", "locationValue", "backupPlanValue", "backupValue", "volumeBackupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.volumeBackupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromVolumeBackupName', () => { + const result = client.matchProjectFromVolumeBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.volumeBackupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromVolumeBackupName', () => { + const result = client.matchLocationFromVolumeBackupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.volumeBackupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupPlanFromVolumeBackupName', () => { + const result = client.matchBackupPlanFromVolumeBackupName(fakePath); + assert.strictEqual(result, "backupPlanValue"); + assert((client.pathTemplates.volumeBackupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromVolumeBackupName', () => { + const result = client.matchBackupFromVolumeBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.volumeBackupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVolumeBackupFromVolumeBackupName', () => { + const result = client.matchVolumeBackupFromVolumeBackupName(fakePath); + assert.strictEqual(result, "volumeBackupValue"); + assert((client.pathTemplates.volumeBackupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('volumeRestore', () => { + const fakePath = "/rendered/path/volumeRestore"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + restore_plan: "restorePlanValue", + restore: "restoreValue", + volume_restore: "volumeRestoreValue", + }; + const client = new backupforgkeModule.v1.BackupForGKEClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.volumeRestorePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.volumeRestorePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('volumeRestorePath', () => { + const result = client.volumeRestorePath("projectValue", "locationValue", "restorePlanValue", "restoreValue", "volumeRestoreValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.volumeRestorePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromVolumeRestoreName', () => { + const result = client.matchProjectFromVolumeRestoreName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.volumeRestorePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromVolumeRestoreName', () => { + const result = client.matchLocationFromVolumeRestoreName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.volumeRestorePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRestorePlanFromVolumeRestoreName', () => { + const result = client.matchRestorePlanFromVolumeRestoreName(fakePath); + assert.strictEqual(result, "restorePlanValue"); + assert((client.pathTemplates.volumeRestorePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRestoreFromVolumeRestoreName', () => { + const result = client.matchRestoreFromVolumeRestoreName(fakePath); + assert.strictEqual(result, "restoreValue"); + assert((client.pathTemplates.volumeRestorePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVolumeRestoreFromVolumeRestoreName', () => { + const result = client.matchVolumeRestoreFromVolumeRestoreName(fakePath); + assert.strictEqual(result, "volumeRestoreValue"); + assert((client.pathTemplates.volumeRestorePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/tsconfig.json b/owl-bot-staging/google-cloud-gkebackup/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/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-gkebackup/v1/webpack.config.js b/owl-bot-staging/google-cloud-gkebackup/v1/webpack.config.js new file mode 100644 index 00000000000..dd31bf29da9 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkebackup/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: 'BackupForGKE', + filename: './backup-for-g-k-e.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-gkeconnect-gateway/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.gitignore b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/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-gkeconnect-gateway/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.jsdoc.js new file mode 100644 index 00000000000..69ac743e1fe --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/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/gke-connect-gateway', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/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-gkeconnect-gateway/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/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-gkeconnect-gateway/v1beta1/README.md b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/README.md new file mode 100644 index 00000000000..796832af022 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/README.md @@ -0,0 +1 @@ +Gateway: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/package.json b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/package.json new file mode 100644 index 00000000000..6e17cee6b12 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/gke-connect-gateway", + "version": "0.1.0", + "description": "Gateway client for Node.js", + "repository": "googleapis/nodejs-gateway", + "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 gateway", + "gateway", + "gateway service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto new file mode 100644 index 00000000000..5dc600c1c01 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto @@ -0,0 +1,75 @@ +// 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.gkeconnect.gateway.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/httpbody.proto"; + +option csharp_namespace = "Google.Cloud.GkeConnect.Gateway.V1Beta1"; +option go_package = "cloud.google.com/go/gkeconnect/gateway/apiv1beta1/gatewaypb;gatewaypb"; +option java_multiple_files = true; +option java_outer_classname = "GatewayProto"; +option java_package = "com.google.cloud.gkeconnect.gateway.v1beta1"; +option php_namespace = "Google\\Cloud\\GkeConnect\\Gateway\\V1beta1"; +option ruby_package = "Google::Cloud::GkeConnect::Gateway::V1beta1"; + +// Gateway service is a public API which works as a Kubernetes resource model +// proxy between end users and registered Kubernetes clusters. Each RPC in this +// service matches with an HTTP verb. End user will initiate kubectl commands +// against the Gateway service, and Gateway service will forward user requests +// to clusters. +service GatewayService { + option (google.api.default_host) = "connectgateway.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // GetResource performs an HTTP GET request on the Kubernetes API Server. + rpc GetResource(google.api.HttpBody) returns (google.api.HttpBody) { + option (google.api.http) = { + get: "/v1beta1/**" + }; + } + + // PostResource performs an HTTP POST on the Kubernetes API Server. + rpc PostResource(google.api.HttpBody) returns (google.api.HttpBody) { + option (google.api.http) = { + post: "/v1beta1/**" + }; + } + + // DeleteResource performs an HTTP DELETE on the Kubernetes API Server. + rpc DeleteResource(google.api.HttpBody) returns (google.api.HttpBody) { + option (google.api.http) = { + delete: "/v1beta1/**" + }; + } + + // PutResource performs an HTTP PUT on the Kubernetes API Server. + rpc PutResource(google.api.HttpBody) returns (google.api.HttpBody) { + option (google.api.http) = { + put: "/v1beta1/**" + }; + } + + // PatchResource performs an HTTP PATCH on the Kubernetes API Server. + rpc PatchResource(google.api.HttpBody) returns (google.api.HttpBody) { + option (google.api.http) = { + patch: "/v1beta1/**" + }; + } +} diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.delete_resource.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.delete_resource.js new file mode 100644 index 00000000000..6ebdb5dfa3e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.delete_resource.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() { + // [START connectgateway_v1beta1_generated_GatewayService_DeleteResource_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The HTTP Content-Type header value specifying the content type of the body. + */ + // const contentType = 'abc123' + /** + * The HTTP request/response body as raw binary. + */ + // const data = Buffer.from('string') + /** + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + */ + // const extensions = [1,2,3,4] + + // Imports the Gateway library + const {GatewayServiceClient} = require('@google-cloud/gke-connect-gateway').v1beta1; + + // Instantiates a client + const gatewayClient = new GatewayServiceClient(); + + async function callDeleteResource() { + // Construct request + const request = { + }; + + // Run request + const response = await gatewayClient.deleteResource(request); + console.log(response); + } + + callDeleteResource(); + // [END connectgateway_v1beta1_generated_GatewayService_DeleteResource_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-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.get_resource.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.get_resource.js new file mode 100644 index 00000000000..57fe1fbea62 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.get_resource.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() { + // [START connectgateway_v1beta1_generated_GatewayService_GetResource_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The HTTP Content-Type header value specifying the content type of the body. + */ + // const contentType = 'abc123' + /** + * The HTTP request/response body as raw binary. + */ + // const data = Buffer.from('string') + /** + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + */ + // const extensions = [1,2,3,4] + + // Imports the Gateway library + const {GatewayServiceClient} = require('@google-cloud/gke-connect-gateway').v1beta1; + + // Instantiates a client + const gatewayClient = new GatewayServiceClient(); + + async function callGetResource() { + // Construct request + const request = { + }; + + // Run request + const response = await gatewayClient.getResource(request); + console.log(response); + } + + callGetResource(); + // [END connectgateway_v1beta1_generated_GatewayService_GetResource_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-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.patch_resource.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.patch_resource.js new file mode 100644 index 00000000000..13f9c59cd99 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.patch_resource.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() { + // [START connectgateway_v1beta1_generated_GatewayService_PatchResource_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The HTTP Content-Type header value specifying the content type of the body. + */ + // const contentType = 'abc123' + /** + * The HTTP request/response body as raw binary. + */ + // const data = Buffer.from('string') + /** + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + */ + // const extensions = [1,2,3,4] + + // Imports the Gateway library + const {GatewayServiceClient} = require('@google-cloud/gke-connect-gateway').v1beta1; + + // Instantiates a client + const gatewayClient = new GatewayServiceClient(); + + async function callPatchResource() { + // Construct request + const request = { + }; + + // Run request + const response = await gatewayClient.patchResource(request); + console.log(response); + } + + callPatchResource(); + // [END connectgateway_v1beta1_generated_GatewayService_PatchResource_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-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.post_resource.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.post_resource.js new file mode 100644 index 00000000000..2d27942f42f --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.post_resource.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() { + // [START connectgateway_v1beta1_generated_GatewayService_PostResource_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The HTTP Content-Type header value specifying the content type of the body. + */ + // const contentType = 'abc123' + /** + * The HTTP request/response body as raw binary. + */ + // const data = Buffer.from('string') + /** + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + */ + // const extensions = [1,2,3,4] + + // Imports the Gateway library + const {GatewayServiceClient} = require('@google-cloud/gke-connect-gateway').v1beta1; + + // Instantiates a client + const gatewayClient = new GatewayServiceClient(); + + async function callPostResource() { + // Construct request + const request = { + }; + + // Run request + const response = await gatewayClient.postResource(request); + console.log(response); + } + + callPostResource(); + // [END connectgateway_v1beta1_generated_GatewayService_PostResource_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-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.put_resource.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.put_resource.js new file mode 100644 index 00000000000..74de65ce1ef --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.put_resource.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() { + // [START connectgateway_v1beta1_generated_GatewayService_PutResource_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The HTTP Content-Type header value specifying the content type of the body. + */ + // const contentType = 'abc123' + /** + * The HTTP request/response body as raw binary. + */ + // const data = Buffer.from('string') + /** + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + */ + // const extensions = [1,2,3,4] + + // Imports the Gateway library + const {GatewayServiceClient} = require('@google-cloud/gke-connect-gateway').v1beta1; + + // Instantiates a client + const gatewayClient = new GatewayServiceClient(); + + async function callPutResource() { + // Construct request + const request = { + }; + + // Run request + const response = await gatewayClient.putResource(request); + console.log(response); + } + + callPutResource(); + // [END connectgateway_v1beta1_generated_GatewayService_PutResource_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-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.gkeconnect.gateway.v1beta1.json b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.gkeconnect.gateway.v1beta1.json new file mode 100644 index 00000000000..4e4047a3e74 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.gkeconnect.gateway.v1beta1.json @@ -0,0 +1,255 @@ +{ + "clientLibrary": { + "name": "nodejs-gateway", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.gkeconnect.gateway.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "connectgateway_v1beta1_generated_GatewayService_GetResource_async", + "title": "GatewayService getResource Sample", + "origin": "API_DEFINITION", + "description": " GetResource performs an HTTP GET request on the Kubernetes API Server.", + "canonical": true, + "file": "gateway_service.get_resource.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetResource", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.GetResource", + "async": true, + "parameters": [ + { + "name": "content_type", + "type": "TYPE_STRING" + }, + { + "name": "data", + "type": "TYPE_BYTES" + }, + { + "name": "extensions", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.api.HttpBody", + "client": { + "shortName": "GatewayServiceClient", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayServiceClient" + }, + "method": { + "shortName": "GetResource", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.GetResource", + "service": { + "shortName": "GatewayService", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService" + } + } + } + }, + { + "regionTag": "connectgateway_v1beta1_generated_GatewayService_PostResource_async", + "title": "GatewayService postResource Sample", + "origin": "API_DEFINITION", + "description": " PostResource performs an HTTP POST on the Kubernetes API Server.", + "canonical": true, + "file": "gateway_service.post_resource.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PostResource", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.PostResource", + "async": true, + "parameters": [ + { + "name": "content_type", + "type": "TYPE_STRING" + }, + { + "name": "data", + "type": "TYPE_BYTES" + }, + { + "name": "extensions", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.api.HttpBody", + "client": { + "shortName": "GatewayServiceClient", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayServiceClient" + }, + "method": { + "shortName": "PostResource", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.PostResource", + "service": { + "shortName": "GatewayService", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService" + } + } + } + }, + { + "regionTag": "connectgateway_v1beta1_generated_GatewayService_DeleteResource_async", + "title": "GatewayService deleteResource Sample", + "origin": "API_DEFINITION", + "description": " DeleteResource performs an HTTP DELETE on the Kubernetes API Server.", + "canonical": true, + "file": "gateway_service.delete_resource.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteResource", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.DeleteResource", + "async": true, + "parameters": [ + { + "name": "content_type", + "type": "TYPE_STRING" + }, + { + "name": "data", + "type": "TYPE_BYTES" + }, + { + "name": "extensions", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.api.HttpBody", + "client": { + "shortName": "GatewayServiceClient", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayServiceClient" + }, + "method": { + "shortName": "DeleteResource", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.DeleteResource", + "service": { + "shortName": "GatewayService", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService" + } + } + } + }, + { + "regionTag": "connectgateway_v1beta1_generated_GatewayService_PutResource_async", + "title": "GatewayService putResource Sample", + "origin": "API_DEFINITION", + "description": " PutResource performs an HTTP PUT on the Kubernetes API Server.", + "canonical": true, + "file": "gateway_service.put_resource.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PutResource", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.PutResource", + "async": true, + "parameters": [ + { + "name": "content_type", + "type": "TYPE_STRING" + }, + { + "name": "data", + "type": "TYPE_BYTES" + }, + { + "name": "extensions", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.api.HttpBody", + "client": { + "shortName": "GatewayServiceClient", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayServiceClient" + }, + "method": { + "shortName": "PutResource", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.PutResource", + "service": { + "shortName": "GatewayService", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService" + } + } + } + }, + { + "regionTag": "connectgateway_v1beta1_generated_GatewayService_PatchResource_async", + "title": "GatewayService patchResource Sample", + "origin": "API_DEFINITION", + "description": " PatchResource performs an HTTP PATCH on the Kubernetes API Server.", + "canonical": true, + "file": "gateway_service.patch_resource.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PatchResource", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.PatchResource", + "async": true, + "parameters": [ + { + "name": "content_type", + "type": "TYPE_STRING" + }, + { + "name": "data", + "type": "TYPE_BYTES" + }, + { + "name": "extensions", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.api.HttpBody", + "client": { + "shortName": "GatewayServiceClient", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayServiceClient" + }, + "method": { + "shortName": "PatchResource", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.PatchResource", + "service": { + "shortName": "GatewayService", + "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/index.ts new file mode 100644 index 00000000000..394ba8ced0f --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/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 GatewayServiceClient = v1beta1.GatewayServiceClient; +type GatewayServiceClient = v1beta1.GatewayServiceClient; +export {v1beta1, GatewayServiceClient}; +export default {v1beta1, GatewayServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gapic_metadata.json new file mode 100644 index 00000000000..5c3d96707e3 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gapic_metadata.json @@ -0,0 +1,73 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.gkeconnect.gateway.v1beta1", + "libraryPackage": "@google-cloud/gke-connect-gateway", + "services": { + "GatewayService": { + "clients": { + "grpc": { + "libraryClient": "GatewayServiceClient", + "rpcs": { + "GetResource": { + "methods": [ + "getResource" + ] + }, + "PostResource": { + "methods": [ + "postResource" + ] + }, + "DeleteResource": { + "methods": [ + "deleteResource" + ] + }, + "PutResource": { + "methods": [ + "putResource" + ] + }, + "PatchResource": { + "methods": [ + "patchResource" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "GatewayServiceClient", + "rpcs": { + "GetResource": { + "methods": [ + "getResource" + ] + }, + "PostResource": { + "methods": [ + "postResource" + ] + }, + "DeleteResource": { + "methods": [ + "deleteResource" + ] + }, + "PutResource": { + "methods": [ + "putResource" + ] + }, + "PatchResource": { + "methods": [ + "patchResource" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_client.ts b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_client.ts new file mode 100644 index 00000000000..be4f1a9820f --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_client.ts @@ -0,0 +1,657 @@ +// 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/gateway_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './gateway_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Gateway service is a public API which works as a Kubernetes resource model + * proxy between end users and registered Kubernetes clusters. Each RPC in this + * service matches with an HTTP verb. End user will initiate kubectl commands + * against the Gateway service, and Gateway service will forward user requests + * to clusters. + * @class + * @memberof v1beta1 + */ +export class GatewayServiceClient { + 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}; + gatewayServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of GatewayServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 GatewayServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof GatewayServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // 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 { + 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.gkeconnect.gateway.v1beta1.GatewayService', 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.gatewayServiceStub) { + return this.gatewayServiceStub; + } + + // Put together the "service stub" for + // google.cloud.gkeconnect.gateway.v1beta1.GatewayService. + this.gatewayServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.gkeconnect.gateway.v1beta1.GatewayService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.gkeconnect.gateway.v1beta1.GatewayService, + 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 gatewayServiceStubMethods = + ['getResource', 'postResource', 'deleteResource', 'putResource', 'patchResource']; + for (const methodName of gatewayServiceStubMethods) { + const callPromise = this.gatewayServiceStub.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.gatewayServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'connectgateway.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 'connectgateway.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 -- + // ------------------- +/** + * GetResource performs an HTTP GET request on the Kubernetes API Server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.contentType + * The HTTP Content-Type header value specifying the content type of the body. + * @param {Buffer} request.data + * The HTTP request/response body as raw binary. + * @param {number[]} request.extensions + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.api.HttpBody|HttpBody}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/gateway_service.get_resource.js + * region_tag:connectgateway_v1beta1_generated_GatewayService_GetResource_async + */ + getResource( + request?: protos.google.api.IHttpBody, + options?: CallOptions): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|undefined, {}|undefined + ]>; + getResource( + request: protos.google.api.IHttpBody, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; + getResource( + request: protos.google.api.IHttpBody, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; + getResource( + request?: protos.google.api.IHttpBody, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|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 || {}; + this.initialize(); + return this.innerApiCalls.getResource(request, options, callback); + } +/** + * PostResource performs an HTTP POST on the Kubernetes API Server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.contentType + * The HTTP Content-Type header value specifying the content type of the body. + * @param {Buffer} request.data + * The HTTP request/response body as raw binary. + * @param {number[]} request.extensions + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.api.HttpBody|HttpBody}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/gateway_service.post_resource.js + * region_tag:connectgateway_v1beta1_generated_GatewayService_PostResource_async + */ + postResource( + request?: protos.google.api.IHttpBody, + options?: CallOptions): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|undefined, {}|undefined + ]>; + postResource( + request: protos.google.api.IHttpBody, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; + postResource( + request: protos.google.api.IHttpBody, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; + postResource( + request?: protos.google.api.IHttpBody, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|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 || {}; + this.initialize(); + return this.innerApiCalls.postResource(request, options, callback); + } +/** + * DeleteResource performs an HTTP DELETE on the Kubernetes API Server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.contentType + * The HTTP Content-Type header value specifying the content type of the body. + * @param {Buffer} request.data + * The HTTP request/response body as raw binary. + * @param {number[]} request.extensions + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.api.HttpBody|HttpBody}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/gateway_service.delete_resource.js + * region_tag:connectgateway_v1beta1_generated_GatewayService_DeleteResource_async + */ + deleteResource( + request?: protos.google.api.IHttpBody, + options?: CallOptions): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|undefined, {}|undefined + ]>; + deleteResource( + request: protos.google.api.IHttpBody, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; + deleteResource( + request: protos.google.api.IHttpBody, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; + deleteResource( + request?: protos.google.api.IHttpBody, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|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 || {}; + this.initialize(); + return this.innerApiCalls.deleteResource(request, options, callback); + } +/** + * PutResource performs an HTTP PUT on the Kubernetes API Server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.contentType + * The HTTP Content-Type header value specifying the content type of the body. + * @param {Buffer} request.data + * The HTTP request/response body as raw binary. + * @param {number[]} request.extensions + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.api.HttpBody|HttpBody}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/gateway_service.put_resource.js + * region_tag:connectgateway_v1beta1_generated_GatewayService_PutResource_async + */ + putResource( + request?: protos.google.api.IHttpBody, + options?: CallOptions): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|undefined, {}|undefined + ]>; + putResource( + request: protos.google.api.IHttpBody, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; + putResource( + request: protos.google.api.IHttpBody, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; + putResource( + request?: protos.google.api.IHttpBody, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|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 || {}; + this.initialize(); + return this.innerApiCalls.putResource(request, options, callback); + } +/** + * PatchResource performs an HTTP PATCH on the Kubernetes API Server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.contentType + * The HTTP Content-Type header value specifying the content type of the body. + * @param {Buffer} request.data + * The HTTP request/response body as raw binary. + * @param {number[]} request.extensions + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.api.HttpBody|HttpBody}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/gateway_service.patch_resource.js + * region_tag:connectgateway_v1beta1_generated_GatewayService_PatchResource_async + */ + patchResource( + request?: protos.google.api.IHttpBody, + options?: CallOptions): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|undefined, {}|undefined + ]>; + patchResource( + request: protos.google.api.IHttpBody, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; + patchResource( + request: protos.google.api.IHttpBody, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; + patchResource( + request?: protos.google.api.IHttpBody, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|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 || {}; + this.initialize(); + return this.innerApiCalls.patchResource(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.gatewayServiceStub && !this._terminated) { + return this.gatewayServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_client_config.json b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_client_config.json new file mode 100644 index 00000000000..d733656e755 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.gkeconnect.gateway.v1beta1.GatewayService": { + "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": { + "GetResource": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PostResource": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteResource": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PutResource": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PatchResource": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_proto_list.json b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_proto_list.json new file mode 100644 index 00000000000..634a5e135a8 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto" +] diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/index.ts new file mode 100644 index 00000000000..18ba6ccd01b --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/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 {GatewayServiceClient} from './gateway_service_client'; diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..5da58fffd69 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/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 gateway = require('@google-cloud/gke-connect-gateway'); + +function main() { + const gatewayServiceClient = new gateway.GatewayServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..6f3d526aa23 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/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 {GatewayServiceClient} from '@google-cloud/gke-connect-gateway'; + +// check that the client class type name can be used +function doStuffWithGatewayServiceClient(client: GatewayServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const gatewayServiceClient = new GatewayServiceClient(); + doStuffWithGatewayServiceClient(gatewayServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/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-gkeconnect-gateway/v1beta1/test/gapic_gateway_service_v1beta1.ts b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/test/gapic_gateway_service_v1beta1.ts new file mode 100644 index 00000000000..845934d172d --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/test/gapic_gateway_service_v1beta1.ts @@ -0,0 +1,525 @@ +// 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 gatewayserviceModule 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.GatewayServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = gatewayserviceModule.v1beta1.GatewayServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = gatewayserviceModule.v1beta1.GatewayServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = gatewayserviceModule.v1beta1.GatewayServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.gatewayServiceStub, undefined); + await client.initialize(); + assert(client.gatewayServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.gatewayServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.gatewayServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + 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 gatewayserviceModule.v1beta1.GatewayServiceClient({ + 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('getResource', () => { + it('invokes getResource without error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.getResource = stubSimpleCall(expectedResponse); + const [response] = await client.getResource(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes getResource without error using callback', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.getResource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getResource( + request, + (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes getResource with error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.getResource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getResource(request), expectedError); + }); + + it('invokes getResource with closed client', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getResource(request), expectedError); + }); + }); + + describe('postResource', () => { + it('invokes postResource without error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.postResource = stubSimpleCall(expectedResponse); + const [response] = await client.postResource(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes postResource without error using callback', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.postResource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.postResource( + request, + (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes postResource with error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.postResource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.postResource(request), expectedError); + }); + + it('invokes postResource with closed client', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.postResource(request), expectedError); + }); + }); + + describe('deleteResource', () => { + it('invokes deleteResource without error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.deleteResource = stubSimpleCall(expectedResponse); + const [response] = await client.deleteResource(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes deleteResource without error using callback', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.deleteResource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteResource( + request, + (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes deleteResource with error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.deleteResource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteResource(request), expectedError); + }); + + it('invokes deleteResource with closed client', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteResource(request), expectedError); + }); + }); + + describe('putResource', () => { + it('invokes putResource without error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.putResource = stubSimpleCall(expectedResponse); + const [response] = await client.putResource(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes putResource without error using callback', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.putResource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.putResource( + request, + (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes putResource with error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.putResource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.putResource(request), expectedError); + }); + + it('invokes putResource with closed client', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.putResource(request), expectedError); + }); + }); + + describe('patchResource', () => { + it('invokes patchResource without error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.patchResource = stubSimpleCall(expectedResponse); + const [response] = await client.patchResource(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes patchResource without error using callback', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.patchResource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.patchResource( + request, + (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes patchResource with error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.patchResource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.patchResource(request), expectedError); + }); + + it('invokes patchResource with closed client', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.HttpBody() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.patchResource(request), expectedError); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/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-gkeconnect-gateway/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/webpack.config.js new file mode 100644 index 00000000000..32921119d6c --- /dev/null +++ b/owl-bot-staging/google-cloud-gkeconnect-gateway/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: 'GatewayService', + filename: './gateway-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-gkehub/v1/.eslintignore b/owl-bot-staging/google-cloud-gkehub/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-gkehub/v1/.eslintrc.json b/owl-bot-staging/google-cloud-gkehub/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/.gitignore b/owl-bot-staging/google-cloud-gkehub/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1/.jsdoc.js b/owl-bot-staging/google-cloud-gkehub/v1/.jsdoc.js new file mode 100644 index 00000000000..b83282dcebb --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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/gke-hub', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-gkehub/v1/.mocharc.js b/owl-bot-staging/google-cloud-gkehub/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1/.prettierrc.js b/owl-bot-staging/google-cloud-gkehub/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1/README.md b/owl-bot-staging/google-cloud-gkehub/v1/README.md new file mode 100644 index 00000000000..f922950c787 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/README.md @@ -0,0 +1 @@ +Gkehub: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gkehub/v1/package.json b/owl-bot-staging/google-cloud-gkehub/v1/package.json new file mode 100644 index 00000000000..25f7a0fc625 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/gke-hub", + "version": "0.1.0", + "description": "Gkehub client for Node.js", + "repository": "googleapis/nodejs-gkehub", + "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 gkehub", + "gkehub", + "gke hub" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/configmanagement/configmanagement.proto b/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/configmanagement/configmanagement.proto new file mode 100644 index 00000000000..978276dc5c6 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/configmanagement/configmanagement.proto @@ -0,0 +1,382 @@ +// 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.gkehub.configmanagement.v1; + +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeHub.ConfigManagement.V1"; +option go_package = "cloud.google.com/go/gkehub/configmanagement/apiv1/configmanagementpb;configmanagementpb"; +option java_multiple_files = true; +option java_outer_classname = "ConfigManagementProto"; +option java_package = "com.google.cloud.gkehub.configmanagement.v1"; +option php_namespace = "Google\\Cloud\\GkeHub\\ConfigManagement\\V1"; +option ruby_package = "Google::Cloud::GkeHub::ConfigManagement::V1"; + +// Enum representing the state of an ACM's deployment on a cluster +enum DeploymentState { + // Deployment's state cannot be determined + DEPLOYMENT_STATE_UNSPECIFIED = 0; + + // Deployment is not installed + NOT_INSTALLED = 1; + + // Deployment is installed + INSTALLED = 2; + + // Deployment was attempted to be installed, but has errors + ERROR = 3; +} + +// **Anthos Config Management**: State for a single cluster. +message MembershipState { + // The user-defined name for the cluster used by ClusterSelectors to group + // clusters together. This should match Membership's membership_name, + // unless the user installed ACM on the cluster manually prior to enabling + // the ACM hub feature. + // Unique within a Anthos Config Management installation. + string cluster_name = 1; + + // Membership configuration in the cluster. This represents the actual state + // in the cluster, while the MembershipSpec in the FeatureSpec represents + // the intended state + MembershipSpec membership_spec = 2; + + // Current install status of ACM's Operator + OperatorState operator_state = 3; + + // Current sync status + ConfigSyncState config_sync_state = 4; + + // PolicyController status + PolicyControllerState policy_controller_state = 5; + + // Hierarchy Controller status + HierarchyControllerState hierarchy_controller_state = 7; +} + +// **Anthos Config Management**: Configuration for a single cluster. +// Intended to parallel the ConfigManagement CR. +message MembershipSpec { + // Config Sync configuration for the cluster. + ConfigSync config_sync = 1; + + // Policy Controller configuration for the cluster. + PolicyController policy_controller = 2; + + // Hierarchy Controller configuration for the cluster. + HierarchyControllerConfig hierarchy_controller = 4; + + // Version of ACM installed. + string version = 10; +} + +// Configuration for Config Sync +message ConfigSync { + // Git repo configuration for the cluster. + GitConfig git = 7; + + // Specifies whether the Config Sync Repo is + // in “hierarchical” or “unstructured” mode. + string source_format = 8; +} + +// Git repo configuration for a single cluster. +message GitConfig { + // The URL of the Git repository to use as the source of truth. + string sync_repo = 1; + + // The branch of the repository to sync from. Default: master. + string sync_branch = 2; + + // The path within the Git repository that represents the top level of the + // repo to sync. Default: the root directory of the repository. + string policy_dir = 3; + + // Period in seconds between consecutive syncs. Default: 15. + int64 sync_wait_secs = 4; + + // Git revision (tag or hash) to check out. Default HEAD. + string sync_rev = 5; + + // Type of secret configured for access to the Git repo. + string secret_type = 6; + + // URL for the HTTPS proxy to be used when communicating with the Git repo. + string https_proxy = 7; + + // The GCP Service Account Email used for auth when secret_type is + // gcpServiceAccount. + string gcp_service_account_email = 8; +} + +// Configuration for Policy Controller +message PolicyController { + // Enables the installation of Policy Controller. + // If false, the rest of PolicyController fields take no + // effect. + bool enabled = 1; + + // Installs the default template library along with Policy Controller. + optional bool template_library_installed = 2; + + // Sets the interval for Policy Controller Audit Scans (in seconds). + // When set to 0, this disables audit functionality altogether. + optional int64 audit_interval_seconds = 3; + + // The set of namespaces that are excluded from Policy Controller checks. + // Namespaces do not need to currently exist on the cluster. + repeated string exemptable_namespaces = 4; + + // Enables the ability to use Constraint Templates that reference to objects + // other than the object currently being evaluated. + bool referential_rules_enabled = 5; + + // Logs all denies and dry run failures. + bool log_denies_enabled = 6; +} + +// Configuration for Hierarchy Controller +message HierarchyControllerConfig { + // Whether Hierarchy Controller is enabled in this cluster. + bool enabled = 1; + + // Whether pod tree labels are enabled in this cluster. + bool enable_pod_tree_labels = 2; + + // Whether hierarchical resource quota is enabled in this cluster. + bool enable_hierarchical_resource_quota = 3; +} + +// Deployment state for Hierarchy Controller +message HierarchyControllerDeploymentState { + // The deployment state for open source HNC (e.g. v0.7.0-hc.0) + DeploymentState hnc = 1; + + // The deployment state for Hierarchy Controller extension (e.g. v0.7.0-hc.1) + DeploymentState extension = 2; +} + +// Version for Hierarchy Controller +message HierarchyControllerVersion { + // Version for open source HNC + string hnc = 1; + + // Version for Hierarchy Controller extension + string extension = 2; +} + +// State for Hierarchy Controller +message HierarchyControllerState { + // The version for Hierarchy Controller + HierarchyControllerVersion version = 1; + + // The deployment state for Hierarchy Controller + HierarchyControllerDeploymentState state = 2; +} + +// State information for an ACM's Operator +message OperatorState { + // The semenatic version number of the operator + string version = 1; + + // The state of the Operator's deployment + DeploymentState deployment_state = 2; + + // Install errors. + repeated InstallError errors = 3; +} + +// Errors pertaining to the installation of ACM +message InstallError { + // A string representing the user facing error message + string error_message = 1; +} + +// State information for ConfigSync +message ConfigSyncState { + // The version of ConfigSync deployed + ConfigSyncVersion version = 1; + + // Information about the deployment of ConfigSync, including the version + // of the various Pods deployed + ConfigSyncDeploymentState deployment_state = 2; + + // The state of ConfigSync's process to sync configs to a cluster + SyncState sync_state = 3; +} + +// Specific versioning information pertaining to ConfigSync's Pods +message ConfigSyncVersion { + // Version of the deployed importer pod + string importer = 1; + + // Version of the deployed syncer pod + string syncer = 2; + + // Version of the deployed git-sync pod + string git_sync = 3; + + // Version of the deployed monitor pod + string monitor = 4; + + // Version of the deployed reconciler-manager pod + string reconciler_manager = 5; + + // Version of the deployed reconciler container in root-reconciler pod + string root_reconciler = 6; +} + +// The state of ConfigSync's deployment on a cluster +message ConfigSyncDeploymentState { + // Deployment state of the importer pod + DeploymentState importer = 1; + + // Deployment state of the syncer pod + DeploymentState syncer = 2; + + // Deployment state of the git-sync pod + DeploymentState git_sync = 3; + + // Deployment state of the monitor pod + DeploymentState monitor = 4; + + // Deployment state of reconciler-manager pod + DeploymentState reconciler_manager = 5; + + // Deployment state of root-reconciler + DeploymentState root_reconciler = 6; +} + +// State indicating an ACM's progress syncing configurations to a cluster +message SyncState { + // An enum representing an ACM's status syncing configs to a cluster + enum SyncCode { + // ACM cannot determine a sync code + SYNC_CODE_UNSPECIFIED = 0; + + // ACM successfully synced the git Repo with the cluster + SYNCED = 1; + + // ACM is in the progress of syncing a new change + PENDING = 2; + + // Indicates an error configuring ACM, and user action is required + ERROR = 3; + + // ACM has been installed (operator manifest deployed), + // but not configured. + NOT_CONFIGURED = 4; + + // ACM has not been installed (no operator pod found) + NOT_INSTALLED = 5; + + // Error authorizing with the cluster + UNAUTHORIZED = 6; + + // Cluster could not be reached + UNREACHABLE = 7; + } + + // Token indicating the state of the repo. + string source_token = 1; + + // Token indicating the state of the importer. + string import_token = 2; + + // Token indicating the state of the syncer. + string sync_token = 3; + + // Deprecated: use last_sync_time instead. + // Timestamp of when ACM last successfully synced the repo + // The time format is specified in https://golang.org/pkg/time/#Time.String + string last_sync = 4 [deprecated = true]; + + // Timestamp type of when ACM last successfully synced the repo + google.protobuf.Timestamp last_sync_time = 7; + + // Sync status code + SyncCode code = 5; + + // A list of errors resulting from problematic configs. + // This list will be truncated after 100 errors, although it is + // unlikely for that many errors to simultaneously exist. + repeated SyncError errors = 6; +} + +// An ACM created error representing a problem syncing configurations +message SyncError { + // An ACM defined error code + string code = 1; + + // A description of the error + string error_message = 2; + + // A list of config(s) associated with the error, if any + repeated ErrorResource error_resources = 3; +} + +// Model for a config file in the git repo with an associated Sync error +message ErrorResource { + // Path in the git repo of the erroneous config + string source_path = 1; + + // Metadata name of the resource that is causing an error + string resource_name = 2; + + // Namespace of the resource that is causing an error + string resource_namespace = 3; + + // Group/version/kind of the resource that is causing an error + GroupVersionKind resource_gvk = 4; +} + +// A Kubernetes object's GVK +message GroupVersionKind { + // Kubernetes Group + string group = 1; + + // Kubernetes Version + string version = 2; + + // Kubernetes Kind + string kind = 3; +} + +// State for PolicyControllerState. +message PolicyControllerState { + // The version of Gatekeeper Policy Controller deployed. + PolicyControllerVersion version = 1; + + // The state about the policy controller installation. + GatekeeperDeploymentState deployment_state = 2; +} + +// The build version of Gatekeeper Policy Controller is using. +message PolicyControllerVersion { + // The gatekeeper image tag that is composed of ACM version, git tag, build + // number. + string version = 1; +} + +// State of Policy Controller installation. +message GatekeeperDeploymentState { + // Status of gatekeeper-controller-manager pod. + DeploymentState gatekeeper_controller_manager_state = 1; + + // Status of gatekeeper-audit deployment. + DeploymentState gatekeeper_audit = 2; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/feature.proto b/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/feature.proto new file mode 100644 index 00000000000..6b48661b4fd --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/feature.proto @@ -0,0 +1,198 @@ +// 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.gkehub.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/gkehub/v1/configmanagement/configmanagement.proto"; +import "google/cloud/gkehub/v1/multiclusteringress/multiclusteringress.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeHub.V1"; +option go_package = "cloud.google.com/go/gkehub/apiv1/gkehubpb;gkehubpb"; +option java_multiple_files = true; +option java_outer_classname = "FeatureProto"; +option java_package = "com.google.cloud.gkehub.v1"; +option php_namespace = "Google\\Cloud\\GkeHub\\V1"; +option ruby_package = "Google::Cloud::GkeHub::V1"; + +// Feature represents the settings and status of any Hub Feature. +message Feature { + option (google.api.resource) = { + type: "gkehub.googleapis.com/Feature" + pattern: "projects/{project}/locations/{location}/features/{feature}" + }; + + // Output only. The full, unique name of this Feature resource in the format + // `projects/*/locations/*/features/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // GCP labels for this Feature. + map labels = 2; + + // Output only. State of the Feature resource itself. + FeatureResourceState resource_state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Hub-wide Feature configuration. If this Feature does not support any + // Hub-wide configuration, this field may be unused. + CommonFeatureSpec spec = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Membership-specific configuration for this Feature. If this Feature does + // not support any per-Membership configuration, this field may be unused. + // + // The keys indicate which Membership the configuration is for, in the form: + // + // projects/{p}/locations/{l}/memberships/{m} + // + // Where {p} is the project, {l} is a valid location and {m} is a valid + // Membership in this project at that location. {p} WILL match the Feature's + // project. + // + // {p} will always be returned as the project number, but the project ID is + // also accepted during input. If the same Membership is specified in the map + // twice (using the project ID form, and the project number form), exactly + // ONE of the entries will be saved, with no guarantees as to which. For this + // reason, it is recommended the same format be used for all entries when + // mutating a Feature. + map membership_specs = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The Hub-wide Feature state. + CommonFeatureState state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Membership-specific Feature status. If this Feature does + // report any per-Membership status, this field may be unused. + // + // The keys indicate which Membership the state is for, in the form: + // + // projects/{p}/locations/{l}/memberships/{m} + // + // Where {p} is the project number, {l} is a valid location and {m} is a valid + // Membership in this project at that location. {p} MUST match the Feature's + // project number. + map membership_states = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the Feature resource was created. + google.protobuf.Timestamp create_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the Feature resource was last updated. + google.protobuf.Timestamp update_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the Feature resource was deleted. + google.protobuf.Timestamp delete_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// FeatureResourceState describes the state of a Feature *resource* in the +// GkeHub API. See `FeatureState` for the "running state" of the Feature in the +// Hub and across Memberships. +message FeatureResourceState { + // State describes the lifecycle status of a Feature. + enum State { + // State is unknown or not set. + STATE_UNSPECIFIED = 0; + + // The Feature is being enabled, and the Feature resource is being created. + // Once complete, the corresponding Feature will be enabled in this Hub. + ENABLING = 1; + + // The Feature is enabled in this Hub, and the Feature resource is fully + // available. + ACTIVE = 2; + + // The Feature is being disabled in this Hub, and the Feature resource + // is being deleted. + DISABLING = 3; + + // The Feature resource is being updated. + UPDATING = 4; + + // The Feature resource is being updated by the Hub Service. + SERVICE_UPDATING = 5; + } + + // The current state of the Feature resource in the Hub API. + State state = 1; +} + +// FeatureState describes the high-level state of a Feature. It may be used to +// describe a Feature's state at the environ-level, or per-membershop, depending +// on the context. +message FeatureState { + // Code represents a machine-readable, high-level status of the Feature. + enum Code { + // Unknown or not set. + CODE_UNSPECIFIED = 0; + + // The Feature is operating normally. + OK = 1; + + // The Feature has encountered an issue, and is operating in a degraded + // state. The Feature may need intervention to return to normal operation. + // See the description and any associated Feature-specific details for more + // information. + WARNING = 2; + + // The Feature is not operating or is in a severely degraded state. + // The Feature may need intervention to return to normal operation. + // See the description and any associated Feature-specific details for more + // information. + ERROR = 3; + } + + // The high-level, machine-readable status of this Feature. + Code code = 1; + + // A human-readable description of the current status. + string description = 2; + + // The time this status and any related Feature-specific details were updated. + google.protobuf.Timestamp update_time = 3; +} + +// CommonFeatureSpec contains Hub-wide configuration information +message CommonFeatureSpec { + oneof feature_spec { + // Multicluster Ingress-specific spec. + google.cloud.gkehub.multiclusteringress.v1.FeatureSpec multiclusteringress = 102; + } +} + +// CommonFeatureState contains Hub-wide Feature status information. +message CommonFeatureState { + // Output only. The "running state" of the Feature in this Hub. + FeatureState state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// MembershipFeatureSpec contains configuration information for a single +// Membership. +message MembershipFeatureSpec { + oneof feature_spec { + // Config Management-specific spec. + google.cloud.gkehub.configmanagement.v1.MembershipSpec configmanagement = 106; + } +} + +// MembershipFeatureState contains Feature status information for a single +// Membership. +message MembershipFeatureState { + oneof feature_state { + // Config Management-specific state. + google.cloud.gkehub.configmanagement.v1.MembershipState configmanagement = 106; + } + + // The high-level state of this Feature for a single membership. + FeatureState state = 1; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/membership.proto b/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/membership.proto new file mode 100644 index 00000000000..ae4337cc26e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/membership.proto @@ -0,0 +1,348 @@ +// 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 +// +// 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.gkehub.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeHub.V1"; +option go_package = "cloud.google.com/go/gkehub/apiv1/gkehubpb;gkehubpb"; +option java_multiple_files = true; +option java_outer_classname = "MembershipProto"; +option java_package = "com.google.cloud.gkehub.v1"; +option php_namespace = "Google\\Cloud\\GkeHub\\V1"; +option ruby_package = "Google::Cloud::GkeHub::V1"; + +// Membership contains information about a member cluster. +message Membership { + option (google.api.resource) = { + type: "gkehub.googleapis.com/Membership" + pattern: "projects/{project}/locations/{location}/memberships/{membership}" + }; + + // Type of resource represented by this Membership + oneof type { + // Optional. Endpoint information to reach this member. + MembershipEndpoint endpoint = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // Output only. The full, unique name of this Membership resource in the + // format `projects/*/locations/*/memberships/{membership_id}`, set during + // creation. + // + // `membership_id` must be a valid RFC 1123 compliant DNS label: + // + // 1. At most 63 characters in length + // 2. It must consist of lower case alphanumeric characters or `-` + // 3. It must start and end with an alphanumeric character + // + // Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, + // with a maximum length of 63 characters. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Labels for this membership. + map labels = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Description of this membership, limited to 63 characters. + // Must match the regex: `[a-zA-Z0-9][a-zA-Z0-9_\-\.\ ]*` + // + // This field is present for legacy purposes. + string description = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. State of the Membership resource. + MembershipState state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the Membership was created. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the Membership was last updated. + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the Membership was deleted. + google.protobuf.Timestamp delete_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. An externally-generated and managed ID for this Membership. This + // ID may be modified after creation, but this is not recommended. + // + // The ID must match the regex: `[a-zA-Z0-9][a-zA-Z0-9_\-\.]*` + // + // If this Membership represents a Kubernetes cluster, this value should be + // set to the UID of the `kube-system` namespace object. + string external_id = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. For clusters using Connect, the timestamp of the most recent + // connection established with Google Cloud. This time is updated every + // several minutes, not continuously. For clusters that do not use GKE + // Connect, or that have never connected successfully, this field will be + // unset. + google.protobuf.Timestamp last_connection_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Google-generated UUID for this resource. This is unique across + // all Membership resources. If a Membership resource is deleted and another + // resource with the same name is created, it gets a different unique_id. + string unique_id = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. How to identify workloads from this Membership. + // See the documentation on Workload Identity for more details: + // https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity + Authority authority = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The monitoring config information for this membership. + MonitoringConfig monitoring_config = 14 + [(google.api.field_behavior) = OPTIONAL]; +} + +// MembershipEndpoint contains information needed to contact a Kubernetes API, +// endpoint and any additional Kubernetes metadata. +message MembershipEndpoint { + // Optional. GKE-specific information. Only present if this Membership is a GKE cluster. + GkeCluster gke_cluster = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Useful Kubernetes-specific metadata. + KubernetesMetadata kubernetes_metadata = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The in-cluster Kubernetes Resources that should be applied for a + // correctly registered cluster, in the steady state. These resources: + // + // * Ensure that the cluster is exclusively registered to one and only one + // Hub Membership. + // * Propagate Workload Pool Information available in the Membership + // Authority field. + // * Ensure proper initial configuration of default Hub Features. + KubernetesResource kubernetes_resource = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Whether the lifecycle of this membership is managed by a + // google cluster platform service. + bool google_managed = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// KubernetesResource contains the YAML manifests and configuration for +// Membership Kubernetes resources in the cluster. After CreateMembership or +// UpdateMembership, these resources should be re-applied in the cluster. +message KubernetesResource { + // Input only. The YAML representation of the Membership CR. This field is + // ignored for GKE clusters where Hub can read the CR directly. + // + // Callers should provide the CR that is currently present in the cluster + // during CreateMembership or UpdateMembership, or leave this field empty if + // none exists. The CR manifest is used to validate the cluster has not been + // registered with another Membership. + string membership_cr_manifest = 1 [(google.api.field_behavior) = INPUT_ONLY]; + + // Output only. Additional Kubernetes resources that need to be applied to the + // cluster after Membership creation, and after every update. + // + // This field is only populated in the Membership returned from a successful + // long-running operation from CreateMembership or UpdateMembership. It is not + // populated during normal GetMembership or ListMemberships requests. To get + // the resource manifest after the initial registration, the caller should + // make a UpdateMembership call with an empty field mask. + repeated ResourceManifest membership_resources = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Kubernetes resources for installing the GKE Connect agent + // + // This field is only populated in the Membership returned from a successful + // long-running operation from CreateMembership or UpdateMembership. It is not + // populated during normal GetMembership or ListMemberships requests. To get + // the resource manifest after the initial registration, the caller should + // make a UpdateMembership call with an empty field mask. + repeated ResourceManifest connect_resources = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Options for Kubernetes resource generation. + ResourceOptions resource_options = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// ResourceOptions represent options for Kubernetes resource generation. +message ResourceOptions { + // Optional. The Connect agent version to use for connect_resources. Defaults + // to the latest GKE Connect version. The version must be a currently + // supported version, obsolete versions will be rejected. + string connect_version = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Use `apiextensions/v1beta1` instead of `apiextensions/v1` for + // CustomResourceDefinition resources. + // This option should be set for clusters with Kubernetes apiserver versions + // <1.16. + bool v1beta1_crd = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Major version of the Kubernetes cluster. This is only used to + // determine which version to use for the CustomResourceDefinition resources, + // `apiextensions/v1beta1` or`apiextensions/v1`. + string k8s_version = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// ResourceManifest represents a single Kubernetes resource to be applied to +// the cluster. +message ResourceManifest { + // YAML manifest of the resource. + string manifest = 1; + + // Whether the resource provided in the manifest is `cluster_scoped`. + // If unset, the manifest is assumed to be namespace scoped. + // + // This field is used for REST mapping when applying the resource in a + // cluster. + bool cluster_scoped = 2; +} + +// GkeCluster contains information specific to GKE clusters. +message GkeCluster { + // Immutable. Self-link of the Google Cloud resource for the GKE cluster. For + // example: + // + // //container.googleapis.com/projects/my-project/locations/us-west1-a/clusters/my-cluster + // + // Zonal clusters are also supported. + string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. If cluster_missing is set then it denotes that the GKE cluster + // no longer exists in the GKE Control Plane. + bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// KubernetesMetadata provides informational metadata for Memberships +// representing Kubernetes clusters. +message KubernetesMetadata { + // Output only. Kubernetes API server version string as reported by + // `/version`. + string kubernetes_api_server_version = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Node providerID as reported by the first node in the list of + // nodes on the Kubernetes endpoint. On Kubernetes platforms that support + // zero-node clusters (like GKE-on-GCP), the node_count will be zero and the + // node_provider_id will be empty. + string node_provider_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Node count as reported by Kubernetes nodes resources. + int32 node_count = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. vCPU count as reported by Kubernetes nodes resources. + int32 vcpu_count = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The total memory capacity as reported by the sum of all + // Kubernetes nodes resources, defined in MB. + int32 memory_mb = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which these details were last updated. This + // update_time is different from the Membership-level update_time since + // EndpointDetails are updated internally for API consumers. + google.protobuf.Timestamp update_time = 100 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// This field informs Fleet-based applications/services/UIs with the necessary +// information for where each underlying Cluster reports its metrics. +message MonitoringConfig { + // Immutable. Project used to report Metrics + string project_id = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. Location used to report Metrics + string location = 2 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. Cluster name used to report metrics. + // For Anthos on VMWare/Baremetal, it would be in format + // `memberClusters/cluster_name`; And for Anthos on MultiCloud, it would be in + // format + // `{azureClusters, awsClusters}/cluster_name`. + string cluster = 3 [(google.api.field_behavior) = IMMUTABLE]; + + // Kubernetes system metrics, if available, are written to this prefix. + // This defaults to kubernetes.io for GKE, and kubernetes.io/anthos for Anthos + // eventually. Noted: Anthos MultiCloud will have kubernetes.io prefix today + // but will migration to be under kubernetes.io/anthos + string kubernetes_metrics_prefix = 4; + + // Immutable. Cluster hash, this is a unique string generated by google code, + // which does not contain any PII, which we can use to reference the cluster. + // This is expected to be created by the monitoring stack and persisted into + // the Cluster object as well as to GKE-Hub. + string cluster_hash = 5 [(google.api.field_behavior) = IMMUTABLE]; +} + +// MembershipState describes the state of a Membership resource. +message MembershipState { + // Code describes the state of a Membership resource. + enum Code { + // The code is not set. + CODE_UNSPECIFIED = 0; + + // The cluster is being registered. + CREATING = 1; + + // The cluster is registered. + READY = 2; + + // The cluster is being unregistered. + DELETING = 3; + + // The Membership is being updated. + UPDATING = 4; + + // The Membership is being updated by the Hub Service. + SERVICE_UPDATING = 5; + } + + // Output only. The current state of the Membership resource. + Code code = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Authority encodes how Google will recognize identities from this Membership. +// See the workload identity documentation for more details: +// https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity +message Authority { + // Optional. A JSON Web Token (JWT) issuer URI. `issuer` must start with + // `https://` and be a valid URL with length <2000 characters. + // + // If set, then Google will allow valid OIDC tokens from this issuer to + // authenticate within the workload_identity_pool. OIDC discovery will be + // performed on this URI to validate tokens from the issuer. + // + // Clearing `issuer` disables Workload Identity. `issuer` cannot be directly + // modified; it must be cleared (and Workload Identity disabled) before using + // a new issuer (and re-enabling Workload Identity). + string issuer = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The name of the workload identity pool in which `issuer` will + // be recognized. + // + // There is a single Workload Identity Pool per Hub that is shared + // between all Memberships that belong to that Hub. For a Hub hosted in + // {PROJECT_ID}, the workload pool format is `{PROJECT_ID}.hub.id.goog`, + // although this is subject to change in newer versions of this API. + string workload_identity_pool = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. An identity provider that reflects the `issuer` in the + // workload identity pool. + string identity_provider = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. OIDC verification keys for this Membership in JWKS format (RFC + // 7517). + // + // When this field is set, OIDC discovery will NOT be performed on `issuer`, + // and instead OIDC tokens will be validated using this field. + bytes oidc_jwks = 4 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/multiclusteringress/multiclusteringress.proto b/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/multiclusteringress/multiclusteringress.proto new file mode 100644 index 00000000000..ce9a72514d7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/multiclusteringress/multiclusteringress.proto @@ -0,0 +1,33 @@ +// 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.gkehub.multiclusteringress.v1; + +option csharp_namespace = "Google.Cloud.GkeHub.MultiClusterIngress.V1"; +option go_package = "cloud.google.com/go/gkehub/multiclusteringress/apiv1/multiclusteringresspb;multiclusteringresspb"; +option java_multiple_files = true; +option java_outer_classname = "MultiClusterIngressProto"; +option java_package = "com.google.cloud.gkehub.multiclusteringress.v1"; +option php_namespace = "Google\\Cloud\\GkeHub\\MultiClusterIngress\\V1"; +option ruby_package = "Google::Cloud::GkeHub::MultiClusterIngress::V1"; + +// **Multi-cluster Ingress**: The configuration for the MultiClusterIngress +// feature. +message FeatureSpec { + // Fully-qualified Membership name which hosts the MultiClusterIngress CRD. + // Example: `projects/foo-proj/locations/global/memberships/bar` + string config_membership = 1; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/service.proto b/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/service.proto new file mode 100644 index 00000000000..cecf242e41a --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/service.proto @@ -0,0 +1,648 @@ +// 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 +// +// 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.gkehub.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/gkehub/v1/feature.proto"; +import "google/cloud/gkehub/v1/membership.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeHub.V1"; +option go_package = "cloud.google.com/go/gkehub/apiv1/gkehubpb;gkehubpb"; +option java_multiple_files = true; +option java_outer_classname = "ServiceProto"; +option java_package = "com.google.cloud.gkehub.v1"; +option php_namespace = "Google\\Cloud\\GkeHub\\V1"; +option ruby_package = "Google::Cloud::GkeHub::V1"; + +// The GKE Hub service handles the registration of many Kubernetes clusters to +// Google Cloud, and the management of multi-cluster features over those +// clusters. +// +// The GKE Hub service operates on the following resources: +// +// * [Membership][google.cloud.gkehub.v1.Membership] +// * [Feature][google.cloud.gkehub.v1.Feature] +// +// GKE Hub is currently available in the global region and all regions in +// https://cloud.google.com/compute/docs/regions-zones. Feature is only +// available in global region while membership is global region and all the +// regions. +// +// **Membership management may be non-trivial:** it is recommended to use one +// of the Google-provided client libraries or tools where possible when working +// with Membership resources. +service GkeHub { + option (google.api.default_host) = "gkehub.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists Memberships in a given project and location. + rpc ListMemberships(ListMembershipsRequest) + returns (ListMembershipsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/memberships" + }; + option (google.api.method_signature) = "parent"; + } + + // Lists Features in a given project and location. + rpc ListFeatures(ListFeaturesRequest) returns (ListFeaturesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/features" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a Membership. + rpc GetMembership(GetMembershipRequest) returns (Membership) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/memberships/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets details of a single Feature. + rpc GetFeature(GetFeatureRequest) returns (Feature) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/features/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new Membership. + // + // **This is currently only supported for GKE clusters on Google Cloud**. + // To register other clusters, follow the instructions at + // https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster. + rpc CreateMembership(CreateMembershipRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/memberships" + body: "resource" + }; + option (google.api.method_signature) = "parent,resource,membership_id"; + option (google.longrunning.operation_info) = { + response_type: "Membership" + metadata_type: "OperationMetadata" + }; + } + + // Adds a new Feature. + rpc CreateFeature(CreateFeatureRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/features" + body: "resource" + }; + option (google.api.method_signature) = "parent,resource,feature_id"; + option (google.longrunning.operation_info) = { + response_type: "Feature" + metadata_type: "OperationMetadata" + }; + } + + // Removes a Membership. + // + // **This is currently only supported for GKE clusters on Google Cloud**. + // To unregister other clusters, follow the instructions at + // https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. + rpc DeleteMembership(DeleteMembershipRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/memberships/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Removes a Feature. + rpc DeleteFeature(DeleteFeatureRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/features/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Updates an existing Membership. + rpc UpdateMembership(UpdateMembershipRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{name=projects/*/locations/*/memberships/*}" + body: "resource" + }; + option (google.api.method_signature) = "name,resource,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Membership" + metadata_type: "OperationMetadata" + }; + } + + // Updates an existing Feature. + rpc UpdateFeature(UpdateFeatureRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{name=projects/*/locations/*/features/*}" + body: "resource" + }; + option (google.api.method_signature) = "name,resource,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Feature" + metadata_type: "OperationMetadata" + }; + } + + // Generates the manifest for deployment of the GKE connect agent. + // + // **This method is used internally by Google-provided libraries.** + // Most clients should not need to call this method directly. + rpc GenerateConnectManifest(GenerateConnectManifestRequest) + returns (GenerateConnectManifestResponse) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/memberships/*}:generateConnectManifest" + }; + } +} + +// Request message for `GkeHub.ListMemberships` method. +message ListMembershipsRequest { + // Required. The parent (project and location) where the Memberships will be + // listed. Specified in the format `projects/*/locations/*`. + // `projects/*/locations/-` list memberships in all the regions. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkehub.googleapis.com/Membership" + } + ]; + + // Optional. When requesting a 'page' of resources, `page_size` specifies + // number of resources to return. If unspecified or set to 0, all resources + // will be returned. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Token returned by previous call to `ListMemberships` which + // specifies the position in the list from where to continue listing the + // resources. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Lists Memberships that match the filter expression, following the + // syntax outlined in https://google.aip.dev/160. + // + // Examples: + // + // - Name is `bar` in project `foo-proj` and location `global`: + // + // name = "projects/foo-proj/locations/global/membership/bar" + // + // - Memberships that have a label called `foo`: + // + // labels.foo:* + // + // - Memberships that have a label called `foo` whose value is `bar`: + // + // labels.foo = bar + // + // - Memberships in the CREATING state: + // + // state = CREATING + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. One or more fields to compare and use to sort the output. + // See https://google.aip.dev/132#ordering. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for the `GkeHub.ListMemberships` method. +message ListMembershipsResponse { + // The list of matching Memberships. + repeated Membership resources = 1; + + // A token to request the next page of resources from the + // `ListMemberships` method. The value of an empty string means that + // there are no more resources to return. + string next_page_token = 2; + + // List of locations that could not be reached while fetching this list. + repeated string unreachable = 3; +} + +// Request message for `GkeHub.GetMembership` method. +message GetMembershipRequest { + // Required. The Membership resource name in the format + // `projects/*/locations/*/memberships/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkehub.googleapis.com/Membership" + } + ]; +} + +// Request message for the `GkeHub.CreateMembership` method. +message CreateMembershipRequest { + // Required. The parent (project and location) where the Memberships will be + // created. Specified in the format `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkehub.googleapis.com/Membership" + } + ]; + + // Required. Client chosen ID for the membership. `membership_id` must be a + // valid RFC 1123 compliant DNS label: + // + // 1. At most 63 characters in length + // 2. It must consist of lower case alphanumeric characters or `-` + // 3. It must start and end with an alphanumeric character + // + // Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, + // with a maximum length of 63 characters. + string membership_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The membership to create. + Membership resource = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for `GkeHub.DeleteMembership` method. +message DeleteMembershipRequest { + // Required. The Membership resource name in the format + // `projects/*/locations/*/memberships/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkehub.googleapis.com/Membership" + } + ]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set to true, any subresource from this Membership will also be + // deleted. Otherwise, the request will only work if the Membership has no + // subresource. + bool force = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for `GkeHub.UpdateMembership` method. +message UpdateMembershipRequest { + // Required. The Membership resource name in the format + // `projects/*/locations/*/memberships/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkehub.googleapis.com/Membership" + } + ]; + + // Required. Mask of fields to update. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Only fields specified in update_mask are updated. + // If you specify a field in the update_mask but don't specify its value here + // that field will be deleted. + // If you are updating a map field, set the value of a key to null or empty + // string to delete the key from the map. It's not possible to update a key's + // value to the empty string. + // If you specify the update_mask to be a special path "*", fully replaces all + // user-modifiable fields to match `resource`. + Membership resource = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for `GkeHub.GenerateConnectManifest` +// method. +// . +message GenerateConnectManifestRequest { + // Required. The Membership resource name the Agent will associate with, in + // the format `projects/*/locations/*/memberships/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkehub.googleapis.com/Membership" + } + ]; + + // Optional. Namespace for GKE Connect agent resources. Defaults to + // `gke-connect`. + // + // The Connect Agent is authorized automatically when run in the default + // namespace. Otherwise, explicit authorization must be granted with an + // additional IAM binding. + string namespace = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. URI of a proxy if connectivity from the agent to + // gkeconnect.googleapis.com requires the use of a proxy. Format must be in + // the form `http(s)://{proxy_address}`, depending on the HTTP/HTTPS protocol + // supported by the proxy. This will direct the connect agent's outbound + // traffic through a HTTP(S) proxy. + bytes proxy = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Connect agent version to use. Defaults to the most current + // version. + string version = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, generate the resources for upgrade only. Some resources + // generated only for installation (e.g. secrets) will be excluded. + bool is_upgrade = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The registry to fetch the connect agent image from. Defaults to + // gcr.io/gkeconnect. + string registry = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The image pull secret content for the registry, if not public. + bytes image_pull_secret_content = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// GenerateConnectManifestResponse contains manifest information for +// installing/upgrading a Connect agent. +message GenerateConnectManifestResponse { + // The ordered list of Kubernetes resources that need to be applied to the + // cluster for GKE Connect agent installation/upgrade. + repeated ConnectAgentResource manifest = 1; +} + +// ConnectAgentResource represents a Kubernetes resource manifest for Connect +// Agent deployment. +message ConnectAgentResource { + // Kubernetes type of the resource. + TypeMeta type = 1; + + // YAML manifest of the resource. + string manifest = 2; +} + +// TypeMeta is the type information needed for content unmarshalling of +// Kubernetes resources in the manifest. +message TypeMeta { + // Kind of the resource (e.g. Deployment). + string kind = 1; + + // APIVersion of the resource (e.g. v1). + string api_version = 2; +} + +// Request message for `GkeHub.ListFeatures` method. +message ListFeaturesRequest { + // Required. The parent (project and location) where the Features will be listed. + // Specified in the format `projects/*/locations/*`. + string parent = 1 [ + (google.api.resource_reference) = { + child_type: "gkehub.googleapis.com/Feature" + } + ]; + + // When requesting a 'page' of resources, `page_size` specifies number of + // resources to return. If unspecified or set to 0, all resources will + // be returned. + int32 page_size = 2; + + // Token returned by previous call to `ListFeatures` which + // specifies the position in the list from where to continue listing the + // resources. + string page_token = 3; + + // Lists Features that match the filter expression, following the syntax + // outlined in https://google.aip.dev/160. + // + // Examples: + // + // - Feature with the name "servicemesh" in project "foo-proj": + // + // name = "projects/foo-proj/locations/global/features/servicemesh" + // + // - Features that have a label called `foo`: + // + // labels.foo:* + // + // - Features that have a label called `foo` whose value is `bar`: + // + // labels.foo = bar + string filter = 4; + + // One or more fields to compare and use to sort the output. + // See https://google.aip.dev/132#ordering. + string order_by = 5; +} + +// Response message for the `GkeHub.ListFeatures` method. +message ListFeaturesResponse { + // The list of matching Features + repeated Feature resources = 1; + + // A token to request the next page of resources from the + // `ListFeatures` method. The value of an empty string means + // that there are no more resources to return. + string next_page_token = 2; +} + +// Request message for `GkeHub.GetFeature` method. +message GetFeatureRequest { + // Required. The Feature resource name in the format + // `projects/*/locations/*/features/*` + string name = 1 [ + (google.api.resource_reference) = { + type: "gkehub.googleapis.com/Feature" + } + ]; +} + +// Request message for the `GkeHub.CreateFeature` method. +message CreateFeatureRequest { + // Required. The parent (project and location) where the Feature will be created. + // Specified in the format `projects/*/locations/*`. + string parent = 1 [ + (google.api.resource_reference) = { + child_type: "gkehub.googleapis.com/Feature" + } + ]; + + // The ID of the feature to create. + string feature_id = 2; + + // The Feature resource to create. + Feature resource = 3; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4; +} + +// Request message for `GkeHub.DeleteFeature` method. +message DeleteFeatureRequest { + // Required. The Feature resource name in the format + // `projects/*/locations/*/features/*`. + string name = 1 [ + (google.api.resource_reference) = { + type: "gkehub.googleapis.com/Feature" + } + ]; + + // If set to true, the delete will ignore any outstanding resources for + // this Feature (that is, `FeatureState.has_resources` is set to true). These + // resources will NOT be cleaned up or modified in any way. + bool force = 2; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for `GkeHub.UpdateFeature` method. +message UpdateFeatureRequest { + // Required. The Feature resource name in the format + // `projects/*/locations/*/features/*`. + string name = 1 [ + (google.api.resource_reference) = { + type: "gkehub.googleapis.com/Feature" + } + ]; + + // Mask of fields to update. + google.protobuf.FieldMask update_mask = 2; + + // Only fields specified in update_mask are updated. + // If you specify a field in the update_mask but don't specify its value here + // that field will be deleted. + // If you are updating a map field, set the value of a key to null or empty + // string to delete the key from the map. It's not possible to update a key's + // value to the empty string. + // If you specify the update_mask to be a special path "*", fully replaces all + // user-modifiable fields to match `resource`. + Feature resource = 3; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_detail = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.create_feature.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.create_feature.js new file mode 100644 index 00000000000..d6daf14f31b --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.create_feature.js @@ -0,0 +1,84 @@ +// 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() { + // [START gkehub_v1_generated_GkeHub_CreateFeature_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 parent (project and location) where the Feature will be created. + * Specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * The ID of the feature to create. + */ + // const featureId = 'abc123' + /** + * The Feature resource to create. + */ + // const resource = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callCreateFeature() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await gkehubClient.createFeature(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFeature(); + // [END gkehub_v1_generated_GkeHub_CreateFeature_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-gkehub/v1/samples/generated/v1/gke_hub.create_membership.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.create_membership.js new file mode 100644 index 00000000000..62b23a56aa5 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.create_membership.js @@ -0,0 +1,93 @@ +// 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, membershipId, resource) { + // [START gkehub_v1_generated_GkeHub_CreateMembership_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 parent (project and location) where the Memberships will be + * created. Specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Required. Client chosen ID for the membership. `membership_id` must be a + * valid RFC 1123 compliant DNS label: + * 1. At most 63 characters in length + * 2. It must consist of lower case alphanumeric characters or `-` + * 3. It must start and end with an alphanumeric character + * Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, + * with a maximum length of 63 characters. + */ + // const membershipId = 'abc123' + /** + * Required. The membership to create. + */ + // const resource = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callCreateMembership() { + // Construct request + const request = { + parent, + membershipId, + resource, + }; + + // Run request + const [operation] = await gkehubClient.createMembership(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateMembership(); + // [END gkehub_v1_generated_GkeHub_CreateMembership_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-gkehub/v1/samples/generated/v1/gke_hub.delete_feature.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.delete_feature.js new file mode 100644 index 00000000000..0b47b75b4a1 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.delete_feature.js @@ -0,0 +1,82 @@ +// 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() { + // [START gkehub_v1_generated_GkeHub_DeleteFeature_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 Feature resource name in the format + * `projects/* /locations/* /features/*`. + */ + // const name = 'abc123' + /** + * If set to true, the delete will ignore any outstanding resources for + * this Feature (that is, `FeatureState.has_resources` is set to true). These + * resources will NOT be cleaned up or modified in any way. + */ + // const force = true + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callDeleteFeature() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await gkehubClient.deleteFeature(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFeature(); + // [END gkehub_v1_generated_GkeHub_DeleteFeature_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-gkehub/v1/samples/generated/v1/gke_hub.delete_membership.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.delete_membership.js new file mode 100644 index 00000000000..a0a28853539 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.delete_membership.js @@ -0,0 +1,83 @@ +// 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 gkehub_v1_generated_GkeHub_DeleteMembership_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 Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + */ + // const name = 'abc123' + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + /** + * Optional. If set to true, any subresource from this Membership will also be + * deleted. Otherwise, the request will only work if the Membership has no + * subresource. + */ + // const force = true + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callDeleteMembership() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gkehubClient.deleteMembership(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteMembership(); + // [END gkehub_v1_generated_GkeHub_DeleteMembership_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-gkehub/v1/samples/generated/v1/gke_hub.generate_connect_manifest.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.generate_connect_manifest.js new file mode 100644 index 00000000000..aea17b705e6 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.generate_connect_manifest.js @@ -0,0 +1,97 @@ +// 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 gkehub_v1_generated_GkeHub_GenerateConnectManifest_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 Membership resource name the Agent will associate with, in + * the format `projects/* /locations/* /memberships/*`. + */ + // const name = 'abc123' + /** + * Optional. Namespace for GKE Connect agent resources. Defaults to + * `gke-connect`. + * The Connect Agent is authorized automatically when run in the default + * namespace. Otherwise, explicit authorization must be granted with an + * additional IAM binding. + */ + // const namespace = 'abc123' + /** + * Optional. URI of a proxy if connectivity from the agent to + * gkeconnect.googleapis.com requires the use of a proxy. Format must be in + * the form `http(s)://{proxy_address}`, depending on the HTTP/HTTPS protocol + * supported by the proxy. This will direct the connect agent's outbound + * traffic through a HTTP(S) proxy. + */ + // const proxy = Buffer.from('string') + /** + * Optional. The Connect agent version to use. Defaults to the most current + * version. + */ + // const version = 'abc123' + /** + * Optional. If true, generate the resources for upgrade only. Some resources + * generated only for installation (e.g. secrets) will be excluded. + */ + // const isUpgrade = true + /** + * Optional. The registry to fetch the connect agent image from. Defaults to + * gcr.io/gkeconnect. + */ + // const registry = 'abc123' + /** + * Optional. The image pull secret content for the registry, if not public. + */ + // const imagePullSecretContent = Buffer.from('string') + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callGenerateConnectManifest() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkehubClient.generateConnectManifest(request); + console.log(response); + } + + callGenerateConnectManifest(); + // [END gkehub_v1_generated_GkeHub_GenerateConnectManifest_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-gkehub/v1/samples/generated/v1/gke_hub.get_feature.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.get_feature.js new file mode 100644 index 00000000000..c9be528d16a --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.get_feature.js @@ -0,0 +1,61 @@ +// 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() { + // [START gkehub_v1_generated_GkeHub_GetFeature_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 Feature resource name in the format + * `projects/* /locations/* /features/*` + */ + // const name = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callGetFeature() { + // Construct request + const request = { + }; + + // Run request + const response = await gkehubClient.getFeature(request); + console.log(response); + } + + callGetFeature(); + // [END gkehub_v1_generated_GkeHub_GetFeature_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-gkehub/v1/samples/generated/v1/gke_hub.get_membership.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.get_membership.js new file mode 100644 index 00000000000..106b54a33d5 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.get_membership.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 gkehub_v1_generated_GkeHub_GetMembership_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 Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + */ + // const name = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callGetMembership() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkehubClient.getMembership(request); + console.log(response); + } + + callGetMembership(); + // [END gkehub_v1_generated_GkeHub_GetMembership_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-gkehub/v1/samples/generated/v1/gke_hub.list_features.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.list_features.js new file mode 100644 index 00000000000..8dae5e2ffeb --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.list_features.js @@ -0,0 +1,92 @@ +// 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() { + // [START gkehub_v1_generated_GkeHub_ListFeatures_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 parent (project and location) where the Features will be listed. + * Specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * When requesting a 'page' of resources, `page_size` specifies number of + * resources to return. If unspecified or set to 0, all resources will + * be returned. + */ + // const pageSize = 1234 + /** + * Token returned by previous call to `ListFeatures` which + * specifies the position in the list from where to continue listing the + * resources. + */ + // const pageToken = 'abc123' + /** + * Lists Features that match the filter expression, following the syntax + * outlined in https://google.aip.dev/160. + * Examples: + * - Feature with the name "servicemesh" in project "foo-proj": + * name = "projects/foo-proj/locations/global/features/servicemesh" + * - Features that have a label called `foo`: + * labels.foo:* + * - Features that have a label called `foo` whose value is `bar`: + * labels.foo = bar + */ + // const filter = 'abc123' + /** + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callListFeatures() { + // Construct request + const request = { + }; + + // Run request + const iterable = await gkehubClient.listFeaturesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFeatures(); + // [END gkehub_v1_generated_GkeHub_ListFeatures_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-gkehub/v1/samples/generated/v1/gke_hub.list_memberships.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.list_memberships.js new file mode 100644 index 00000000000..cde7e9d0e3f --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.list_memberships.js @@ -0,0 +1,96 @@ +// 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 gkehub_v1_generated_GkeHub_ListMemberships_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 parent (project and location) where the Memberships will be + * listed. Specified in the format `projects/* /locations/*`. + * `projects/* /locations/-` list memberships in all the regions. + */ + // const parent = 'abc123' + /** + * Optional. When requesting a 'page' of resources, `page_size` specifies + * number of resources to return. If unspecified or set to 0, all resources + * will be returned. + */ + // const pageSize = 1234 + /** + * Optional. Token returned by previous call to `ListMemberships` which + * specifies the position in the list from where to continue listing the + * resources. + */ + // const pageToken = 'abc123' + /** + * Optional. Lists Memberships that match the filter expression, following the + * syntax outlined in https://google.aip.dev/160. + * Examples: + * - Name is `bar` in project `foo-proj` and location `global`: + * name = "projects/foo-proj/locations/global/membership/bar" + * - Memberships that have a label called `foo`: + * labels.foo:* + * - Memberships that have a label called `foo` whose value is `bar`: + * labels.foo = bar + * - Memberships in the CREATING state: + * state = CREATING + */ + // const filter = 'abc123' + /** + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callListMemberships() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gkehubClient.listMembershipsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMemberships(); + // [END gkehub_v1_generated_GkeHub_ListMemberships_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-gkehub/v1/samples/generated/v1/gke_hub.update_feature.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.update_feature.js new file mode 100644 index 00000000000..dc853f8d77b --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.update_feature.js @@ -0,0 +1,91 @@ +// 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() { + // [START gkehub_v1_generated_GkeHub_UpdateFeature_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 Feature resource name in the format + * `projects/* /locations/* /features/*`. + */ + // const name = 'abc123' + /** + * Mask of fields to update. + */ + // const updateMask = {} + /** + * Only fields specified in update_mask are updated. + * If you specify a field in the update_mask but don't specify its value here + * that field will be deleted. + * If you are updating a map field, set the value of a key to null or empty + * string to delete the key from the map. It's not possible to update a key's + * value to the empty string. + * If you specify the update_mask to be a special path "*", fully replaces all + * user-modifiable fields to match `resource`. + */ + // const resource = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callUpdateFeature() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await gkehubClient.updateFeature(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFeature(); + // [END gkehub_v1_generated_GkeHub_UpdateFeature_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-gkehub/v1/samples/generated/v1/gke_hub.update_membership.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.update_membership.js new file mode 100644 index 00000000000..ca340c18ed7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.update_membership.js @@ -0,0 +1,94 @@ +// 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, updateMask, resource) { + // [START gkehub_v1_generated_GkeHub_UpdateMembership_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 Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + */ + // const name = 'abc123' + /** + * Required. Mask of fields to update. + */ + // const updateMask = {} + /** + * Required. Only fields specified in update_mask are updated. + * If you specify a field in the update_mask but don't specify its value here + * that field will be deleted. + * If you are updating a map field, set the value of a key to null or empty + * string to delete the key from the map. It's not possible to update a key's + * value to the empty string. + * If you specify the update_mask to be a special path "*", fully replaces all + * user-modifiable fields to match `resource`. + */ + // const resource = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callUpdateMembership() { + // Construct request + const request = { + name, + updateMask, + resource, + }; + + // Run request + const [operation] = await gkehubClient.updateMembership(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateMembership(); + // [END gkehub_v1_generated_GkeHub_UpdateMembership_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-gkehub/v1/samples/generated/v1/snippet_metadata_google.cloud.gkehub.v1.json b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/snippet_metadata_google.cloud.gkehub.v1.json new file mode 100644 index 00000000000..70bea948783 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/snippet_metadata_google.cloud.gkehub.v1.json @@ -0,0 +1,575 @@ +{ + "clientLibrary": { + "name": "nodejs-gkehub", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.gkehub.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "gkehub_v1_generated_GkeHub_ListMemberships_async", + "title": "GkeHub listMemberships Sample", + "origin": "API_DEFINITION", + "description": " Lists Memberships in a given project and location.", + "canonical": true, + "file": "gke_hub.list_memberships.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 88, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMemberships", + "fullName": "google.cloud.gkehub.v1.GkeHub.ListMemberships", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkehub.v1.ListMembershipsResponse", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1.GkeHubClient" + }, + "method": { + "shortName": "ListMemberships", + "fullName": "google.cloud.gkehub.v1.GkeHub.ListMemberships", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1_generated_GkeHub_ListFeatures_async", + "title": "GkeHub listFeatures Sample", + "origin": "API_DEFINITION", + "description": " Lists Features in a given project and location.", + "canonical": true, + "file": "gke_hub.list_features.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFeatures", + "fullName": "google.cloud.gkehub.v1.GkeHub.ListFeatures", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkehub.v1.ListFeaturesResponse", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1.GkeHubClient" + }, + "method": { + "shortName": "ListFeatures", + "fullName": "google.cloud.gkehub.v1.GkeHub.ListFeatures", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1_generated_GkeHub_GetMembership_async", + "title": "GkeHub getMembership Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a Membership.", + "canonical": true, + "file": "gke_hub.get_membership.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetMembership", + "fullName": "google.cloud.gkehub.v1.GkeHub.GetMembership", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkehub.v1.Membership", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1.GkeHubClient" + }, + "method": { + "shortName": "GetMembership", + "fullName": "google.cloud.gkehub.v1.GkeHub.GetMembership", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1_generated_GkeHub_GetFeature_async", + "title": "GkeHub getFeature Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single Feature.", + "canonical": true, + "file": "gke_hub.get_feature.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFeature", + "fullName": "google.cloud.gkehub.v1.GkeHub.GetFeature", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkehub.v1.Feature", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1.GkeHubClient" + }, + "method": { + "shortName": "GetFeature", + "fullName": "google.cloud.gkehub.v1.GkeHub.GetFeature", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1_generated_GkeHub_CreateMembership_async", + "title": "GkeHub createMembership Sample", + "origin": "API_DEFINITION", + "description": " Creates a new Membership. **This is currently only supported for GKE clusters on Google Cloud**. To register other clusters, follow the instructions at https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster.", + "canonical": true, + "file": "gke_hub.create_membership.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateMembership", + "fullName": "google.cloud.gkehub.v1.GkeHub.CreateMembership", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "membership_id", + "type": "TYPE_STRING" + }, + { + "name": "resource", + "type": ".google.cloud.gkehub.v1.Membership" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1.GkeHubClient" + }, + "method": { + "shortName": "CreateMembership", + "fullName": "google.cloud.gkehub.v1.GkeHub.CreateMembership", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1_generated_GkeHub_CreateFeature_async", + "title": "GkeHub createFeature Sample", + "origin": "API_DEFINITION", + "description": " Adds a new Feature.", + "canonical": true, + "file": "gke_hub.create_feature.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFeature", + "fullName": "google.cloud.gkehub.v1.GkeHub.CreateFeature", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "feature_id", + "type": "TYPE_STRING" + }, + { + "name": "resource", + "type": ".google.cloud.gkehub.v1.Feature" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1.GkeHubClient" + }, + "method": { + "shortName": "CreateFeature", + "fullName": "google.cloud.gkehub.v1.GkeHub.CreateFeature", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1_generated_GkeHub_DeleteMembership_async", + "title": "GkeHub deleteMembership Sample", + "origin": "API_DEFINITION", + "description": " Removes a Membership. **This is currently only supported for GKE clusters on Google Cloud**. To unregister other clusters, follow the instructions at https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster.", + "canonical": true, + "file": "gke_hub.delete_membership.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteMembership", + "fullName": "google.cloud.gkehub.v1.GkeHub.DeleteMembership", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1.GkeHubClient" + }, + "method": { + "shortName": "DeleteMembership", + "fullName": "google.cloud.gkehub.v1.GkeHub.DeleteMembership", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1_generated_GkeHub_DeleteFeature_async", + "title": "GkeHub deleteFeature Sample", + "origin": "API_DEFINITION", + "description": " Removes a Feature.", + "canonical": true, + "file": "gke_hub.delete_feature.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFeature", + "fullName": "google.cloud.gkehub.v1.GkeHub.DeleteFeature", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1.GkeHubClient" + }, + "method": { + "shortName": "DeleteFeature", + "fullName": "google.cloud.gkehub.v1.GkeHub.DeleteFeature", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1_generated_GkeHub_UpdateMembership_async", + "title": "GkeHub updateMembership Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing Membership.", + "canonical": true, + "file": "gke_hub.update_membership.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 86, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateMembership", + "fullName": "google.cloud.gkehub.v1.GkeHub.UpdateMembership", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "resource", + "type": ".google.cloud.gkehub.v1.Membership" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1.GkeHubClient" + }, + "method": { + "shortName": "UpdateMembership", + "fullName": "google.cloud.gkehub.v1.GkeHub.UpdateMembership", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1_generated_GkeHub_UpdateFeature_async", + "title": "GkeHub updateFeature Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing Feature.", + "canonical": true, + "file": "gke_hub.update_feature.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFeature", + "fullName": "google.cloud.gkehub.v1.GkeHub.UpdateFeature", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "resource", + "type": ".google.cloud.gkehub.v1.Feature" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1.GkeHubClient" + }, + "method": { + "shortName": "UpdateFeature", + "fullName": "google.cloud.gkehub.v1.GkeHub.UpdateFeature", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1_generated_GkeHub_GenerateConnectManifest_async", + "title": "GkeHub generateConnectManifest Sample", + "origin": "API_DEFINITION", + "description": " Generates the manifest for deployment of the GKE connect agent. **This method is used internally by Google-provided libraries.** Most clients should not need to call this method directly.", + "canonical": true, + "file": "gke_hub.generate_connect_manifest.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 89, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateConnectManifest", + "fullName": "google.cloud.gkehub.v1.GkeHub.GenerateConnectManifest", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "namespace", + "type": "TYPE_STRING" + }, + { + "name": "proxy", + "type": "TYPE_BYTES" + }, + { + "name": "version", + "type": "TYPE_STRING" + }, + { + "name": "is_upgrade", + "type": "TYPE_BOOL" + }, + { + "name": "registry", + "type": "TYPE_STRING" + }, + { + "name": "image_pull_secret_content", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.gkehub.v1.GenerateConnectManifestResponse", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1.GkeHubClient" + }, + "method": { + "shortName": "GenerateConnectManifest", + "fullName": "google.cloud.gkehub.v1.GkeHub.GenerateConnectManifest", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1.GkeHub" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1/src/index.ts new file mode 100644 index 00000000000..38d16b6b8ee --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/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 v1 from './v1'; +const GkeHubClient = v1.GkeHubClient; +type GkeHubClient = v1.GkeHubClient; +export {v1, GkeHubClient}; +export default {v1, GkeHubClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..d63689a48a5 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gapic_metadata.json @@ -0,0 +1,141 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.gkehub.v1", + "libraryPackage": "@google-cloud/gke-hub", + "services": { + "GkeHub": { + "clients": { + "grpc": { + "libraryClient": "GkeHubClient", + "rpcs": { + "GetMembership": { + "methods": [ + "getMembership" + ] + }, + "GetFeature": { + "methods": [ + "getFeature" + ] + }, + "GenerateConnectManifest": { + "methods": [ + "generateConnectManifest" + ] + }, + "CreateMembership": { + "methods": [ + "createMembership" + ] + }, + "CreateFeature": { + "methods": [ + "createFeature" + ] + }, + "DeleteMembership": { + "methods": [ + "deleteMembership" + ] + }, + "DeleteFeature": { + "methods": [ + "deleteFeature" + ] + }, + "UpdateMembership": { + "methods": [ + "updateMembership" + ] + }, + "UpdateFeature": { + "methods": [ + "updateFeature" + ] + }, + "ListMemberships": { + "methods": [ + "listMemberships", + "listMembershipsStream", + "listMembershipsAsync" + ] + }, + "ListFeatures": { + "methods": [ + "listFeatures", + "listFeaturesStream", + "listFeaturesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "GkeHubClient", + "rpcs": { + "GetMembership": { + "methods": [ + "getMembership" + ] + }, + "GetFeature": { + "methods": [ + "getFeature" + ] + }, + "GenerateConnectManifest": { + "methods": [ + "generateConnectManifest" + ] + }, + "CreateMembership": { + "methods": [ + "createMembership" + ] + }, + "CreateFeature": { + "methods": [ + "createFeature" + ] + }, + "DeleteMembership": { + "methods": [ + "deleteMembership" + ] + }, + "DeleteFeature": { + "methods": [ + "deleteFeature" + ] + }, + "UpdateMembership": { + "methods": [ + "updateMembership" + ] + }, + "UpdateFeature": { + "methods": [ + "updateFeature" + ] + }, + "ListMemberships": { + "methods": [ + "listMemberships", + "listMembershipsStream", + "listMembershipsAsync" + ] + }, + "ListFeatures": { + "methods": [ + "listFeatures", + "listFeaturesStream", + "listFeaturesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_client.ts b/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_client.ts new file mode 100644 index 00000000000..47d2608aa01 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_client.ts @@ -0,0 +1,2006 @@ +// 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, GrpcClientOptions, LROperation, 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/gke_hub_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './gke_hub_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The GKE Hub service handles the registration of many Kubernetes clusters to + * Google Cloud, and the management of multi-cluster features over those + * clusters. + * + * The GKE Hub service operates on the following resources: + * + * * {@link protos.google.cloud.gkehub.v1.Membership|Membership} + * * {@link protos.google.cloud.gkehub.v1.Feature|Feature} + * + * GKE Hub is currently available in the global region and all regions in + * https://cloud.google.com/compute/docs/regions-zones. Feature is only + * available in global region while membership is global region and all the + * regions. + * + * **Membership management may be non-trivial:** it is recommended to use one + * of the Google-provided client libraries or tools where possible when working + * with Membership resources. + * @class + * @memberof v1 + */ +export class GkeHubClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + gkeHubStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of GkeHubClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 GkeHubClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof GkeHubClient; + 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 { + 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 = { + featurePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/features/{feature}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + membershipPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/memberships/{membership}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // 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 = { + listMemberships: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources'), + listFeatures: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/memberships/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/features/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/memberships/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/features/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/memberships/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/features/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createMembershipResponse = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1.Membership') as gax.protobuf.Type; + const createMembershipMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1.OperationMetadata') as gax.protobuf.Type; + const createFeatureResponse = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1.Feature') as gax.protobuf.Type; + const createFeatureMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1.OperationMetadata') as gax.protobuf.Type; + const deleteMembershipResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteMembershipMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1.OperationMetadata') as gax.protobuf.Type; + const deleteFeatureResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteFeatureMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1.OperationMetadata') as gax.protobuf.Type; + const updateMembershipResponse = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1.Membership') as gax.protobuf.Type; + const updateMembershipMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1.OperationMetadata') as gax.protobuf.Type; + const updateFeatureResponse = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1.Feature') as gax.protobuf.Type; + const updateFeatureMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createMembership: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createMembershipResponse.decode.bind(createMembershipResponse), + createMembershipMetadata.decode.bind(createMembershipMetadata)), + createFeature: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFeatureResponse.decode.bind(createFeatureResponse), + createFeatureMetadata.decode.bind(createFeatureMetadata)), + deleteMembership: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteMembershipResponse.decode.bind(deleteMembershipResponse), + deleteMembershipMetadata.decode.bind(deleteMembershipMetadata)), + deleteFeature: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFeatureResponse.decode.bind(deleteFeatureResponse), + deleteFeatureMetadata.decode.bind(deleteFeatureMetadata)), + updateMembership: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateMembershipResponse.decode.bind(updateMembershipResponse), + updateMembershipMetadata.decode.bind(updateMembershipMetadata)), + updateFeature: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFeatureResponse.decode.bind(updateFeatureResponse), + updateFeatureMetadata.decode.bind(updateFeatureMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.gkehub.v1.GkeHub', 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.gkeHubStub) { + return this.gkeHubStub; + } + + // Put together the "service stub" for + // google.cloud.gkehub.v1.GkeHub. + this.gkeHubStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.gkehub.v1.GkeHub') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.gkehub.v1.GkeHub, + 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 gkeHubStubMethods = + ['listMemberships', 'listFeatures', 'getMembership', 'getFeature', 'createMembership', 'createFeature', 'deleteMembership', 'deleteFeature', 'updateMembership', 'updateFeature', 'generateConnectManifest']; + for (const methodName of gkeHubStubMethods) { + const callPromise = this.gkeHubStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.gkeHubStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'gkehub.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 'gkehub.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 -- + // ------------------- +/** + * Gets the details of a Membership. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1.Membership|Membership}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/gke_hub.get_membership.js + * region_tag:gkehub_v1_generated_GkeHub_GetMembership_async + */ + getMembership( + request?: protos.google.cloud.gkehub.v1.IGetMembershipRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1.IMembership, + protos.google.cloud.gkehub.v1.IGetMembershipRequest|undefined, {}|undefined + ]>; + getMembership( + request: protos.google.cloud.gkehub.v1.IGetMembershipRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkehub.v1.IMembership, + protos.google.cloud.gkehub.v1.IGetMembershipRequest|null|undefined, + {}|null|undefined>): void; + getMembership( + request: protos.google.cloud.gkehub.v1.IGetMembershipRequest, + callback: Callback< + protos.google.cloud.gkehub.v1.IMembership, + protos.google.cloud.gkehub.v1.IGetMembershipRequest|null|undefined, + {}|null|undefined>): void; + getMembership( + request?: protos.google.cloud.gkehub.v1.IGetMembershipRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkehub.v1.IMembership, + protos.google.cloud.gkehub.v1.IGetMembershipRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkehub.v1.IMembership, + protos.google.cloud.gkehub.v1.IGetMembershipRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkehub.v1.IMembership, + protos.google.cloud.gkehub.v1.IGetMembershipRequest|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.getMembership(request, options, callback); + } +/** + * Gets details of a single Feature. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Feature resource name in the format + * `projects/* /locations/* /features/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1.Feature|Feature}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/gke_hub.get_feature.js + * region_tag:gkehub_v1_generated_GkeHub_GetFeature_async + */ + getFeature( + request?: protos.google.cloud.gkehub.v1.IGetFeatureRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1.IFeature, + protos.google.cloud.gkehub.v1.IGetFeatureRequest|undefined, {}|undefined + ]>; + getFeature( + request: protos.google.cloud.gkehub.v1.IGetFeatureRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkehub.v1.IFeature, + protos.google.cloud.gkehub.v1.IGetFeatureRequest|null|undefined, + {}|null|undefined>): void; + getFeature( + request: protos.google.cloud.gkehub.v1.IGetFeatureRequest, + callback: Callback< + protos.google.cloud.gkehub.v1.IFeature, + protos.google.cloud.gkehub.v1.IGetFeatureRequest|null|undefined, + {}|null|undefined>): void; + getFeature( + request?: protos.google.cloud.gkehub.v1.IGetFeatureRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkehub.v1.IFeature, + protos.google.cloud.gkehub.v1.IGetFeatureRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkehub.v1.IFeature, + protos.google.cloud.gkehub.v1.IGetFeatureRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkehub.v1.IFeature, + protos.google.cloud.gkehub.v1.IGetFeatureRequest|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.getFeature(request, options, callback); + } +/** + * Generates the manifest for deployment of the GKE connect agent. + * + * **This method is used internally by Google-provided libraries.** + * Most clients should not need to call this method directly. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Membership resource name the Agent will associate with, in + * the format `projects/* /locations/* /memberships/*`. + * @param {string} [request.namespace] + * Optional. Namespace for GKE Connect agent resources. Defaults to + * `gke-connect`. + * + * The Connect Agent is authorized automatically when run in the default + * namespace. Otherwise, explicit authorization must be granted with an + * additional IAM binding. + * @param {Buffer} [request.proxy] + * Optional. URI of a proxy if connectivity from the agent to + * gkeconnect.googleapis.com requires the use of a proxy. Format must be in + * the form `http(s)://{proxy_address}`, depending on the HTTP/HTTPS protocol + * supported by the proxy. This will direct the connect agent's outbound + * traffic through a HTTP(S) proxy. + * @param {string} [request.version] + * Optional. The Connect agent version to use. Defaults to the most current + * version. + * @param {boolean} [request.isUpgrade] + * Optional. If true, generate the resources for upgrade only. Some resources + * generated only for installation (e.g. secrets) will be excluded. + * @param {string} [request.registry] + * Optional. The registry to fetch the connect agent image from. Defaults to + * gcr.io/gkeconnect. + * @param {Buffer} [request.imagePullSecretContent] + * Optional. The image pull secret content for the registry, if not public. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1.GenerateConnectManifestResponse|GenerateConnectManifestResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/gke_hub.generate_connect_manifest.js + * region_tag:gkehub_v1_generated_GkeHub_GenerateConnectManifest_async + */ + generateConnectManifest( + request?: protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest|undefined, {}|undefined + ]>; + generateConnectManifest( + request: protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkehub.v1.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest|null|undefined, + {}|null|undefined>): void; + generateConnectManifest( + request: protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest, + callback: Callback< + protos.google.cloud.gkehub.v1.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest|null|undefined, + {}|null|undefined>): void; + generateConnectManifest( + request?: protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkehub.v1.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkehub.v1.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkehub.v1.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest|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.generateConnectManifest(request, options, callback); + } + +/** + * Creates a new Membership. + * + * **This is currently only supported for GKE clusters on Google Cloud**. + * To register other clusters, follow the instructions at + * https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) where the Memberships will be + * created. Specified in the format `projects/* /locations/*`. + * @param {string} request.membershipId + * Required. Client chosen ID for the membership. `membership_id` must be a + * valid RFC 1123 compliant DNS label: + * + * 1. At most 63 characters in length + * 2. It must consist of lower case alphanumeric characters or `-` + * 3. It must start and end with an alphanumeric character + * + * Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, + * with a maximum length of 63 characters. + * @param {google.cloud.gkehub.v1.Membership} request.resource + * Required. The membership to create. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/gke_hub.create_membership.js + * region_tag:gkehub_v1_generated_GkeHub_CreateMembership_async + */ + createMembership( + request?: protos.google.cloud.gkehub.v1.ICreateMembershipRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createMembership( + request: protos.google.cloud.gkehub.v1.ICreateMembershipRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMembership( + request: protos.google.cloud.gkehub.v1.ICreateMembershipRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMembership( + request?: protos.google.cloud.gkehub.v1.ICreateMembershipRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createMembership(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createMembership()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/gke_hub.create_membership.js + * region_tag:gkehub_v1_generated_GkeHub_CreateMembership_async + */ + async checkCreateMembershipProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMembership, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Adds a new Feature. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) where the Feature will be created. + * Specified in the format `projects/* /locations/*`. + * @param {string} request.featureId + * The ID of the feature to create. + * @param {google.cloud.gkehub.v1.Feature} request.resource + * The Feature resource to create. + * @param {string} request.requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/gke_hub.create_feature.js + * region_tag:gkehub_v1_generated_GkeHub_CreateFeature_async + */ + createFeature( + request?: protos.google.cloud.gkehub.v1.ICreateFeatureRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createFeature( + request: protos.google.cloud.gkehub.v1.ICreateFeatureRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFeature( + request: protos.google.cloud.gkehub.v1.ICreateFeatureRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFeature( + request?: protos.google.cloud.gkehub.v1.ICreateFeatureRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFeature(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createFeature()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/gke_hub.create_feature.js + * region_tag:gkehub_v1_generated_GkeHub_CreateFeature_async + */ + async checkCreateFeatureProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFeature, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Removes a Membership. + * + * **This is currently only supported for GKE clusters on Google Cloud**. + * To unregister other clusters, follow the instructions at + * https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.force] + * Optional. If set to true, any subresource from this Membership will also be + * deleted. Otherwise, the request will only work if the Membership has no + * subresource. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/gke_hub.delete_membership.js + * region_tag:gkehub_v1_generated_GkeHub_DeleteMembership_async + */ + deleteMembership( + request?: protos.google.cloud.gkehub.v1.IDeleteMembershipRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteMembership( + request: protos.google.cloud.gkehub.v1.IDeleteMembershipRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteMembership( + request: protos.google.cloud.gkehub.v1.IDeleteMembershipRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteMembership( + request?: protos.google.cloud.gkehub.v1.IDeleteMembershipRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteMembership(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteMembership()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/gke_hub.delete_membership.js + * region_tag:gkehub_v1_generated_GkeHub_DeleteMembership_async + */ + async checkDeleteMembershipProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteMembership, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Removes a Feature. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Feature resource name in the format + * `projects/* /locations/* /features/*`. + * @param {boolean} request.force + * If set to true, the delete will ignore any outstanding resources for + * this Feature (that is, `FeatureState.has_resources` is set to true). These + * resources will NOT be cleaned up or modified in any way. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/gke_hub.delete_feature.js + * region_tag:gkehub_v1_generated_GkeHub_DeleteFeature_async + */ + deleteFeature( + request?: protos.google.cloud.gkehub.v1.IDeleteFeatureRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteFeature( + request: protos.google.cloud.gkehub.v1.IDeleteFeatureRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFeature( + request: protos.google.cloud.gkehub.v1.IDeleteFeatureRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFeature( + request?: protos.google.cloud.gkehub.v1.IDeleteFeatureRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteFeature(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteFeature()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/gke_hub.delete_feature.js + * region_tag:gkehub_v1_generated_GkeHub_DeleteFeature_async + */ + async checkDeleteFeatureProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFeature, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an existing Membership. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. + * @param {google.cloud.gkehub.v1.Membership} request.resource + * Required. Only fields specified in update_mask are updated. + * If you specify a field in the update_mask but don't specify its value here + * that field will be deleted. + * If you are updating a map field, set the value of a key to null or empty + * string to delete the key from the map. It's not possible to update a key's + * value to the empty string. + * If you specify the update_mask to be a special path "*", fully replaces all + * user-modifiable fields to match `resource`. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/gke_hub.update_membership.js + * region_tag:gkehub_v1_generated_GkeHub_UpdateMembership_async + */ + updateMembership( + request?: protos.google.cloud.gkehub.v1.IUpdateMembershipRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateMembership( + request: protos.google.cloud.gkehub.v1.IUpdateMembershipRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMembership( + request: protos.google.cloud.gkehub.v1.IUpdateMembershipRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMembership( + request?: protos.google.cloud.gkehub.v1.IUpdateMembershipRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateMembership(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateMembership()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/gke_hub.update_membership.js + * region_tag:gkehub_v1_generated_GkeHub_UpdateMembership_async + */ + async checkUpdateMembershipProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMembership, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an existing Feature. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Feature resource name in the format + * `projects/* /locations/* /features/*`. + * @param {google.protobuf.FieldMask} request.updateMask + * Mask of fields to update. + * @param {google.cloud.gkehub.v1.Feature} request.resource + * Only fields specified in update_mask are updated. + * If you specify a field in the update_mask but don't specify its value here + * that field will be deleted. + * If you are updating a map field, set the value of a key to null or empty + * string to delete the key from the map. It's not possible to update a key's + * value to the empty string. + * If you specify the update_mask to be a special path "*", fully replaces all + * user-modifiable fields to match `resource`. + * @param {string} request.requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/gke_hub.update_feature.js + * region_tag:gkehub_v1_generated_GkeHub_UpdateFeature_async + */ + updateFeature( + request?: protos.google.cloud.gkehub.v1.IUpdateFeatureRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateFeature( + request: protos.google.cloud.gkehub.v1.IUpdateFeatureRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFeature( + request: protos.google.cloud.gkehub.v1.IUpdateFeatureRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFeature( + request?: protos.google.cloud.gkehub.v1.IUpdateFeatureRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFeature(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateFeature()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/gke_hub.update_feature.js + * region_tag:gkehub_v1_generated_GkeHub_UpdateFeature_async + */ + async checkUpdateFeatureProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFeature, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists Memberships in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) where the Memberships will be + * listed. Specified in the format `projects/* /locations/*`. + * `projects/* /locations/-` list memberships in all the regions. + * @param {number} [request.pageSize] + * Optional. When requesting a 'page' of resources, `page_size` specifies + * number of resources to return. If unspecified or set to 0, all resources + * will be returned. + * @param {string} [request.pageToken] + * Optional. Token returned by previous call to `ListMemberships` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} [request.filter] + * Optional. Lists Memberships that match the filter expression, following the + * syntax outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Name is `bar` in project `foo-proj` and location `global`: + * + * name = "projects/foo-proj/locations/global/membership/bar" + * + * - Memberships that have a label called `foo`: + * + * labels.foo:* + * + * - Memberships that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * + * - Memberships in the CREATING state: + * + * state = CREATING + * @param {string} [request.orderBy] + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1.Membership|Membership}. + * 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 `listMembershipsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMemberships( + request?: protos.google.cloud.gkehub.v1.IListMembershipsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1.IMembership[], + protos.google.cloud.gkehub.v1.IListMembershipsRequest|null, + protos.google.cloud.gkehub.v1.IListMembershipsResponse + ]>; + listMemberships( + request: protos.google.cloud.gkehub.v1.IListMembershipsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkehub.v1.IListMembershipsRequest, + protos.google.cloud.gkehub.v1.IListMembershipsResponse|null|undefined, + protos.google.cloud.gkehub.v1.IMembership>): void; + listMemberships( + request: protos.google.cloud.gkehub.v1.IListMembershipsRequest, + callback: PaginationCallback< + protos.google.cloud.gkehub.v1.IListMembershipsRequest, + protos.google.cloud.gkehub.v1.IListMembershipsResponse|null|undefined, + protos.google.cloud.gkehub.v1.IMembership>): void; + listMemberships( + request?: protos.google.cloud.gkehub.v1.IListMembershipsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkehub.v1.IListMembershipsRequest, + protos.google.cloud.gkehub.v1.IListMembershipsResponse|null|undefined, + protos.google.cloud.gkehub.v1.IMembership>, + callback?: PaginationCallback< + protos.google.cloud.gkehub.v1.IListMembershipsRequest, + protos.google.cloud.gkehub.v1.IListMembershipsResponse|null|undefined, + protos.google.cloud.gkehub.v1.IMembership>): + Promise<[ + protos.google.cloud.gkehub.v1.IMembership[], + protos.google.cloud.gkehub.v1.IListMembershipsRequest|null, + protos.google.cloud.gkehub.v1.IListMembershipsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listMemberships(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) where the Memberships will be + * listed. Specified in the format `projects/* /locations/*`. + * `projects/* /locations/-` list memberships in all the regions. + * @param {number} [request.pageSize] + * Optional. When requesting a 'page' of resources, `page_size` specifies + * number of resources to return. If unspecified or set to 0, all resources + * will be returned. + * @param {string} [request.pageToken] + * Optional. Token returned by previous call to `ListMemberships` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} [request.filter] + * Optional. Lists Memberships that match the filter expression, following the + * syntax outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Name is `bar` in project `foo-proj` and location `global`: + * + * name = "projects/foo-proj/locations/global/membership/bar" + * + * - Memberships that have a label called `foo`: + * + * labels.foo:* + * + * - Memberships that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * + * - Memberships in the CREATING state: + * + * state = CREATING + * @param {string} [request.orderBy] + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 protos.google.cloud.gkehub.v1.Membership|Membership} 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 `listMembershipsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMembershipsStream( + request?: protos.google.cloud.gkehub.v1.IListMembershipsRequest, + 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['listMemberships']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMemberships.createStream( + this.innerApiCalls.listMemberships as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMemberships`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) where the Memberships will be + * listed. Specified in the format `projects/* /locations/*`. + * `projects/* /locations/-` list memberships in all the regions. + * @param {number} [request.pageSize] + * Optional. When requesting a 'page' of resources, `page_size` specifies + * number of resources to return. If unspecified or set to 0, all resources + * will be returned. + * @param {string} [request.pageToken] + * Optional. Token returned by previous call to `ListMemberships` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} [request.filter] + * Optional. Lists Memberships that match the filter expression, following the + * syntax outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Name is `bar` in project `foo-proj` and location `global`: + * + * name = "projects/foo-proj/locations/global/membership/bar" + * + * - Memberships that have a label called `foo`: + * + * labels.foo:* + * + * - Memberships that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * + * - Memberships in the CREATING state: + * + * state = CREATING + * @param {string} [request.orderBy] + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkehub.v1.Membership|Membership}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/gke_hub.list_memberships.js + * region_tag:gkehub_v1_generated_GkeHub_ListMemberships_async + */ + listMembershipsAsync( + request?: protos.google.cloud.gkehub.v1.IListMembershipsRequest, + 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['listMemberships']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMemberships.asyncIterate( + this.innerApiCalls['listMemberships'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists Features in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) where the Features will be listed. + * Specified in the format `projects/* /locations/*`. + * @param {number} request.pageSize + * When requesting a 'page' of resources, `page_size` specifies number of + * resources to return. If unspecified or set to 0, all resources will + * be returned. + * @param {string} request.pageToken + * Token returned by previous call to `ListFeatures` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} request.filter + * Lists Features that match the filter expression, following the syntax + * outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Feature with the name "servicemesh" in project "foo-proj": + * + * name = "projects/foo-proj/locations/global/features/servicemesh" + * + * - Features that have a label called `foo`: + * + * labels.foo:* + * + * - Features that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * @param {string} request.orderBy + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1.Feature|Feature}. + * 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 `listFeaturesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFeatures( + request?: protos.google.cloud.gkehub.v1.IListFeaturesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1.IFeature[], + protos.google.cloud.gkehub.v1.IListFeaturesRequest|null, + protos.google.cloud.gkehub.v1.IListFeaturesResponse + ]>; + listFeatures( + request: protos.google.cloud.gkehub.v1.IListFeaturesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkehub.v1.IListFeaturesRequest, + protos.google.cloud.gkehub.v1.IListFeaturesResponse|null|undefined, + protos.google.cloud.gkehub.v1.IFeature>): void; + listFeatures( + request: protos.google.cloud.gkehub.v1.IListFeaturesRequest, + callback: PaginationCallback< + protos.google.cloud.gkehub.v1.IListFeaturesRequest, + protos.google.cloud.gkehub.v1.IListFeaturesResponse|null|undefined, + protos.google.cloud.gkehub.v1.IFeature>): void; + listFeatures( + request?: protos.google.cloud.gkehub.v1.IListFeaturesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkehub.v1.IListFeaturesRequest, + protos.google.cloud.gkehub.v1.IListFeaturesResponse|null|undefined, + protos.google.cloud.gkehub.v1.IFeature>, + callback?: PaginationCallback< + protos.google.cloud.gkehub.v1.IListFeaturesRequest, + protos.google.cloud.gkehub.v1.IListFeaturesResponse|null|undefined, + protos.google.cloud.gkehub.v1.IFeature>): + Promise<[ + protos.google.cloud.gkehub.v1.IFeature[], + protos.google.cloud.gkehub.v1.IListFeaturesRequest|null, + protos.google.cloud.gkehub.v1.IListFeaturesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listFeatures(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) where the Features will be listed. + * Specified in the format `projects/* /locations/*`. + * @param {number} request.pageSize + * When requesting a 'page' of resources, `page_size` specifies number of + * resources to return. If unspecified or set to 0, all resources will + * be returned. + * @param {string} request.pageToken + * Token returned by previous call to `ListFeatures` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} request.filter + * Lists Features that match the filter expression, following the syntax + * outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Feature with the name "servicemesh" in project "foo-proj": + * + * name = "projects/foo-proj/locations/global/features/servicemesh" + * + * - Features that have a label called `foo`: + * + * labels.foo:* + * + * - Features that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * @param {string} request.orderBy + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 protos.google.cloud.gkehub.v1.Feature|Feature} 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 `listFeaturesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFeaturesStream( + request?: protos.google.cloud.gkehub.v1.IListFeaturesRequest, + 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['listFeatures']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFeatures.createStream( + this.innerApiCalls.listFeatures as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFeatures`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) where the Features will be listed. + * Specified in the format `projects/* /locations/*`. + * @param {number} request.pageSize + * When requesting a 'page' of resources, `page_size` specifies number of + * resources to return. If unspecified or set to 0, all resources will + * be returned. + * @param {string} request.pageToken + * Token returned by previous call to `ListFeatures` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} request.filter + * Lists Features that match the filter expression, following the syntax + * outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Feature with the name "servicemesh" in project "foo-proj": + * + * name = "projects/foo-proj/locations/global/features/servicemesh" + * + * - Features that have a label called `foo`: + * + * labels.foo:* + * + * - Features that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * @param {string} request.orderBy + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkehub.v1.Feature|Feature}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/gke_hub.list_features.js + * region_tag:gkehub_v1_generated_GkeHub_ListFeatures_async + */ + listFeaturesAsync( + request?: protos.google.cloud.gkehub.v1.IListFeaturesRequest, + 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['listFeatures']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFeatures.asyncIterate( + this.innerApiCalls['listFeatures'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified feature resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} feature + * @returns {string} Resource name string. + */ + featurePath(project:string,location:string,feature:string) { + return this.pathTemplates.featurePathTemplate.render({ + project: project, + location: location, + feature: feature, + }); + } + + /** + * Parse the project from Feature resource. + * + * @param {string} featureName + * A fully-qualified path representing Feature resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFeatureName(featureName: string) { + return this.pathTemplates.featurePathTemplate.match(featureName).project; + } + + /** + * Parse the location from Feature resource. + * + * @param {string} featureName + * A fully-qualified path representing Feature resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFeatureName(featureName: string) { + return this.pathTemplates.featurePathTemplate.match(featureName).location; + } + + /** + * Parse the feature from Feature resource. + * + * @param {string} featureName + * A fully-qualified path representing Feature resource. + * @returns {string} A string representing the feature. + */ + matchFeatureFromFeatureName(featureName: string) { + return this.pathTemplates.featurePathTemplate.match(featureName).feature; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified membership resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} membership + * @returns {string} Resource name string. + */ + membershipPath(project:string,location:string,membership:string) { + return this.pathTemplates.membershipPathTemplate.render({ + project: project, + location: location, + membership: membership, + }); + } + + /** + * Parse the project from Membership resource. + * + * @param {string} membershipName + * A fully-qualified path representing Membership resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMembershipName(membershipName: string) { + return this.pathTemplates.membershipPathTemplate.match(membershipName).project; + } + + /** + * Parse the location from Membership resource. + * + * @param {string} membershipName + * A fully-qualified path representing Membership resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMembershipName(membershipName: string) { + return this.pathTemplates.membershipPathTemplate.match(membershipName).location; + } + + /** + * Parse the membership from Membership resource. + * + * @param {string} membershipName + * A fully-qualified path representing Membership resource. + * @returns {string} A string representing the membership. + */ + matchMembershipFromMembershipName(membershipName: string) { + return this.pathTemplates.membershipPathTemplate.match(membershipName).membership; + } + + /** + * 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; + } + + /** + * 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.gkeHubStub && !this._terminated) { + return this.gkeHubStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_client_config.json b/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_client_config.json new file mode 100644 index 00000000000..e5baeaac099 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_client_config.json @@ -0,0 +1,93 @@ +{ + "interfaces": { + "google.cloud.gkehub.v1.GkeHub": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListMemberships": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListFeatures": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetMembership": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetFeature": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateMembership": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateFeature": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteMembership": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteFeature": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdateMembership": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdateFeature": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GenerateConnectManifest": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_proto_list.json b/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_proto_list.json new file mode 100644 index 00000000000..a96b9a7a883 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_proto_list.json @@ -0,0 +1,7 @@ +[ + "../../protos/google/cloud/gkehub/v1/configmanagement/configmanagement.proto", + "../../protos/google/cloud/gkehub/v1/feature.proto", + "../../protos/google/cloud/gkehub/v1/membership.proto", + "../../protos/google/cloud/gkehub/v1/multiclusteringress/multiclusteringress.proto", + "../../protos/google/cloud/gkehub/v1/service.proto" +] diff --git a/owl-bot-staging/google-cloud-gkehub/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-gkehub/v1/src/v1/index.ts new file mode 100644 index 00000000000..aaf819215ae --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/src/v1/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 {GkeHubClient} from './gke_hub_client'; diff --git a/owl-bot-staging/google-cloud-gkehub/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gkehub/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..723143457a0 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/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 gkehub = require('@google-cloud/gke-hub'); + +function main() { + const gkeHubClient = new gkehub.GkeHubClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..832fe8321c7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/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 {GkeHubClient} from '@google-cloud/gke-hub'; + +// check that the client class type name can be used +function doStuffWithGkeHubClient(client: GkeHubClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const gkeHubClient = new GkeHubClient(); + doStuffWithGkeHubClient(gkeHubClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1/system-test/install.ts b/owl-bot-staging/google-cloud-gkehub/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1/test/gapic_gke_hub_v1.ts b/owl-bot-staging/google-cloud-gkehub/v1/test/gapic_gke_hub_v1.ts new file mode 100644 index 00000000000..ae43e9f2a42 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1/test/gapic_gke_hub_v1.ts @@ -0,0 +1,2114 @@ +// 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 gkehubModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.GkeHubClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = gkehubModule.v1.GkeHubClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = gkehubModule.v1.GkeHubClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = gkehubModule.v1.GkeHubClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new gkehubModule.v1.GkeHubClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new gkehubModule.v1.GkeHubClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.gkeHubStub, undefined); + await client.initialize(); + assert(client.gkeHubStub); + }); + + it('has close method for the initialized client', done => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.gkeHubStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.gkeHubStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new gkehubModule.v1.GkeHubClient({ + 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 gkehubModule.v1.GkeHubClient({ + 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('getMembership', () => { + it('invokes getMembership without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.GetMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.GetMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1.Membership() + ); + client.innerApiCalls.getMembership = stubSimpleCall(expectedResponse); + const [response] = await client.getMembership(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMembership without error using callback', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.GetMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.GetMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1.Membership() + ); + client.innerApiCalls.getMembership = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMembership( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1.IMembership|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMembership with error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.GetMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.GetMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMembership = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getMembership(request), expectedError); + const actualRequest = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMembership with closed client', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.GetMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.GetMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getMembership(request), expectedError); + }); + }); + + describe('getFeature', () => { + it('invokes getFeature without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.GetFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.GetFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1.Feature() + ); + client.innerApiCalls.getFeature = stubSimpleCall(expectedResponse); + const [response] = await client.getFeature(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFeature without error using callback', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.GetFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.GetFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1.Feature() + ); + client.innerApiCalls.getFeature = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFeature( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1.IFeature|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFeature with error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.GetFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.GetFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFeature = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFeature(request), expectedError); + const actualRequest = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFeature with closed client', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.GetFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.GetFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFeature(request), expectedError); + }); + }); + + describe('generateConnectManifest', () => { + it('invokes generateConnectManifest without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.GenerateConnectManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.GenerateConnectManifestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1.GenerateConnectManifestResponse() + ); + client.innerApiCalls.generateConnectManifest = stubSimpleCall(expectedResponse); + const [response] = await client.generateConnectManifest(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateConnectManifest without error using callback', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.GenerateConnectManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.GenerateConnectManifestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1.GenerateConnectManifestResponse() + ); + client.innerApiCalls.generateConnectManifest = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateConnectManifest( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1.IGenerateConnectManifestResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateConnectManifest with error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.GenerateConnectManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.GenerateConnectManifestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateConnectManifest = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateConnectManifest(request), expectedError); + const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateConnectManifest with closed client', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.GenerateConnectManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.GenerateConnectManifestRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateConnectManifest(request), expectedError); + }); + }); + + describe('createMembership', () => { + it('invokes createMembership without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.CreateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.CreateMembershipRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMembership = stubLongRunningCall(expectedResponse); + const [operation] = await client.createMembership(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMembership without error using callback', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.CreateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.CreateMembershipRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMembership = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMembership( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMembership with call error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.CreateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.CreateMembershipRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMembership = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createMembership(request), expectedError); + const actualRequest = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMembership with LRO error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.CreateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.CreateMembershipRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMembership = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createMembership(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateMembershipProgress without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateMembershipProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateMembershipProgress with error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateMembershipProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createFeature', () => { + it('invokes createFeature without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.CreateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.CreateFeatureRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFeature = stubLongRunningCall(expectedResponse); + const [operation] = await client.createFeature(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFeature without error using callback', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.CreateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.CreateFeatureRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFeature = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFeature( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFeature with call error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.CreateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.CreateFeatureRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFeature = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createFeature(request), expectedError); + const actualRequest = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFeature with LRO error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.CreateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.CreateFeatureRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFeature = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createFeature(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateFeatureProgress without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateFeatureProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFeatureProgress with error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateFeatureProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteMembership', () => { + it('invokes deleteMembership without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.DeleteMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.DeleteMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteMembership = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteMembership(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteMembership without error using callback', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.DeleteMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.DeleteMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteMembership = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteMembership( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteMembership with call error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.DeleteMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.DeleteMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMembership = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteMembership(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteMembership with LRO error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.DeleteMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.DeleteMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMembership = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteMembership(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteMembershipProgress without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteMembershipProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteMembershipProgress with error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteMembershipProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteFeature', () => { + it('invokes deleteFeature without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.DeleteFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.DeleteFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFeature = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFeature(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFeature without error using callback', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.DeleteFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.DeleteFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFeature = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFeature( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFeature with call error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.DeleteFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.DeleteFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFeature = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteFeature(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFeature with LRO error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.DeleteFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.DeleteFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFeature = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteFeature(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteFeatureProgress without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteFeatureProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFeatureProgress with error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteFeatureProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateMembership', () => { + it('invokes updateMembership without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.UpdateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.UpdateMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMembership = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateMembership(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMembership without error using callback', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.UpdateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.UpdateMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMembership = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMembership( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMembership with call error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.UpdateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.UpdateMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMembership = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateMembership(request), expectedError); + const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMembership with LRO error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.UpdateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.UpdateMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMembership = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateMembership(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateMembershipProgress without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateMembershipProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateMembershipProgress with error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateMembershipProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateFeature', () => { + it('invokes updateFeature without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.UpdateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.UpdateFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFeature = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFeature(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFeature without error using callback', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.UpdateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.UpdateFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFeature = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFeature( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFeature with call error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.UpdateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.UpdateFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFeature = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateFeature(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFeature with LRO error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.UpdateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.UpdateFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFeature = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateFeature(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateFeatureProgress without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateFeatureProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFeatureProgress with error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateFeatureProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listMemberships', () => { + it('invokes listMemberships without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), + ]; + client.innerApiCalls.listMemberships = stubSimpleCall(expectedResponse); + const [response] = await client.listMemberships(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMemberships without error using callback', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), + ]; + client.innerApiCalls.listMemberships = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMemberships( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1.IMembership[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMemberships with error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMemberships = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMemberships(request), expectedError); + const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMembershipsStream without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), + ]; + client.descriptors.page.listMemberships.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMembershipsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkehub.v1.Membership[] = []; + stream.on('data', (response: protos.google.cloud.gkehub.v1.Membership) => { + 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.listMemberships.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMemberships, request)); + assert( + (client.descriptors.page.listMemberships.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listMembershipsStream with error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMemberships.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMembershipsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkehub.v1.Membership[] = []; + stream.on('data', (response: protos.google.cloud.gkehub.v1.Membership) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMemberships.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMemberships, request)); + assert( + (client.descriptors.page.listMemberships.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMemberships without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), + ]; + client.descriptors.page.listMemberships.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkehub.v1.IMembership[] = []; + const iterable = client.listMembershipsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMemberships with error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMemberships.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMembershipsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkehub.v1.IMembership[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listFeatures', () => { + it('invokes listFeatures without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), + ]; + client.innerApiCalls.listFeatures = stubSimpleCall(expectedResponse); + const [response] = await client.listFeatures(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFeatures without error using callback', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), + ]; + client.innerApiCalls.listFeatures = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFeatures( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1.IFeature[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFeatures with error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFeatures = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFeatures(request), expectedError); + const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFeaturesStream without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), + ]; + client.descriptors.page.listFeatures.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFeaturesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkehub.v1.Feature[] = []; + stream.on('data', (response: protos.google.cloud.gkehub.v1.Feature) => { + 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.listFeatures.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFeatures, request)); + assert( + (client.descriptors.page.listFeatures.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFeaturesStream with error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFeatures.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFeaturesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkehub.v1.Feature[] = []; + stream.on('data', (response: protos.google.cloud.gkehub.v1.Feature) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFeatures.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFeatures, request)); + assert( + (client.descriptors.page.listFeatures.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFeatures without error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), + ]; + client.descriptors.page.listFeatures.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkehub.v1.IFeature[] = []; + const iterable = client.listFeaturesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFeatures.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFeatures.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFeatures with error', async () => { + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFeatures.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFeaturesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkehub.v1.IFeature[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFeatures.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFeatures.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('feature', () => { + const fakePath = "/rendered/path/feature"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + feature: "featureValue", + }; + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.featurePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.featurePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('featurePath', () => { + const result = client.featurePath("projectValue", "locationValue", "featureValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.featurePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFeatureName', () => { + const result = client.matchProjectFromFeatureName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.featurePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFeatureName', () => { + const result = client.matchLocationFromFeatureName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.featurePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFeatureFromFeatureName', () => { + const result = client.matchFeatureFromFeatureName(fakePath); + assert.strictEqual(result, "featureValue"); + assert((client.pathTemplates.featurePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('membership', () => { + const fakePath = "/rendered/path/membership"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + membership: "membershipValue", + }; + const client = new gkehubModule.v1.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.membershipPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.membershipPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('membershipPath', () => { + const result = client.membershipPath("projectValue", "locationValue", "membershipValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.membershipPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromMembershipName', () => { + const result = client.matchProjectFromMembershipName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromMembershipName', () => { + const result = client.matchLocationFromMembershipName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMembershipFromMembershipName', () => { + const result = client.matchMembershipFromMembershipName(fakePath); + assert.strictEqual(result, "membershipValue"); + assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new gkehubModule.v1.GkeHubClient({ + 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)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-gkehub/v1/tsconfig.json b/owl-bot-staging/google-cloud-gkehub/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1/webpack.config.js b/owl-bot-staging/google-cloud-gkehub/v1/webpack.config.js new file mode 100644 index 00000000000..71afa3a607d --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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: 'GkeHub', + filename: './gke-hub.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-gkehub/v1alpha/.eslintignore b/owl-bot-staging/google-cloud-gkehub/v1alpha/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/.eslintrc.json b/owl-bot-staging/google-cloud-gkehub/v1alpha/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/.gitignore b/owl-bot-staging/google-cloud-gkehub/v1alpha/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/.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-gkehub/v1alpha/.jsdoc.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/.jsdoc.js new file mode 100644 index 00000000000..b83282dcebb --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/.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/gke-hub', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/.mocharc.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/.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-gkehub/v1alpha/.prettierrc.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/.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-gkehub/v1alpha/README.md b/owl-bot-staging/google-cloud-gkehub/v1alpha/README.md new file mode 100644 index 00000000000..f922950c787 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/README.md @@ -0,0 +1 @@ +Gkehub: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/package.json b/owl-bot-staging/google-cloud-gkehub/v1alpha/package.json new file mode 100644 index 00000000000..25f7a0fc625 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/gke-hub", + "version": "0.1.0", + "description": "Gkehub client for Node.js", + "repository": "googleapis/nodejs-gkehub", + "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 gkehub", + "gkehub", + "gke hub" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/cloudauditlogging/cloudauditlogging.proto b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/cloudauditlogging/cloudauditlogging.proto new file mode 100644 index 00000000000..e8b3bb0caaf --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/cloudauditlogging/cloudauditlogging.proto @@ -0,0 +1,36 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.gkehub.cloudauditlogging.v1alpha; + + +option csharp_namespace = "Google.Cloud.GkeHub.CloudAuditLogging.V1Alpha"; +option go_package = "cloud.google.com/go/gkehub/cloudauditlogging/apiv1alpha/cloudauditloggingpb;cloudauditloggingpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudAuditLoggingProto"; +option java_package = "com.google.cloud.gkehub.cloudauditlogging.v1alpha"; +option php_namespace = "Google\\Cloud\\GkeHub\\CloudAuditLogging\\V1alpha"; +option ruby_package = "Google::Cloud::GkeHub::CloudAuditLogging::V1alpha"; + +// **Cloud Audit Logging**: Spec for Audit Logging Allowlisting. +message FeatureSpec { + // Service account that should be allowlisted to send the audit logs; eg + // cloudauditlogging@gcp-project.iam.gserviceaccount.com. These accounts must + // already exist, but do not need to have any permissions granted to them. + // The customer's entitlements will be checked prior to allowlisting (i.e. + // the customer must be an Anthos customer.) + repeated string allowlisted_service_accounts = 1; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/configmanagement/configmanagement.proto b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/configmanagement/configmanagement.proto new file mode 100644 index 00000000000..bca2e55108e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/configmanagement/configmanagement.proto @@ -0,0 +1,415 @@ +// 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.gkehub.configmanagement.v1alpha; + +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeHub.ConfigManagement.V1Alpha"; +option go_package = "cloud.google.com/go/gkehub/configmanagement/apiv1alpha/configmanagementpb;configmanagementpb"; +option java_multiple_files = true; +option java_outer_classname = "ConfigManagementProto"; +option java_package = "com.google.cloud.gkehub.configmanagement.v1alpha"; +option php_namespace = "Google\\Cloud\\GkeHub\\ConfigManagement\\V1alpha"; +option ruby_package = "Google::Cloud::GkeHub::ConfigManagement::V1alpha"; + +// Enum representing the state of an ACM's deployment on a cluster +enum DeploymentState { + // Deployment's state cannot be determined + DEPLOYMENT_STATE_UNSPECIFIED = 0; + + // Deployment is not installed + NOT_INSTALLED = 1; + + // Deployment is installed + INSTALLED = 2; + + // Deployment was attempted to be installed, but has errors + ERROR = 3; +} + +// **Anthos Config Management**: State for a single cluster. +message MembershipState { + // The user-defined name for the cluster used by ClusterSelectors to group + // clusters together. This should match Membership's membership_name, + // unless the user installed ACM on the cluster manually prior to enabling + // the ACM hub feature. + // Unique within a Anthos Config Management installation. + string cluster_name = 1; + + // Membership configuration in the cluster. This represents the actual state + // in the cluster, while the MembershipSpec in the FeatureSpec represents + // the intended state + MembershipSpec membership_spec = 2; + + // Current install status of ACM's Operator + OperatorState operator_state = 3; + + // Current sync status + ConfigSyncState config_sync_state = 4; + + // PolicyController status + PolicyControllerState policy_controller_state = 5; + + // Binauthz status + BinauthzState binauthz_state = 6; + + // Hierarchy Controller status + HierarchyControllerState hierarchy_controller_state = 7; +} + +// **Anthos Config Management**: Configuration for a single cluster. +// Intended to parallel the ConfigManagement CR. +message MembershipSpec { + // Config Sync configuration for the cluster. + ConfigSync config_sync = 1; + + // Policy Controller configuration for the cluster. + PolicyController policy_controller = 2; + + // Binauthz conifguration for the cluster. + BinauthzConfig binauthz = 3; + + // Hierarchy Controller configuration for the cluster. + HierarchyControllerConfig hierarchy_controller = 4; + + // Version of ACM installed. + string version = 10; +} + +// Configuration for Config Sync +message ConfigSync { + // Git repo configuration for the cluster. + GitConfig git = 7; + + // Specifies whether the Config Sync Repo is + // in “hierarchical” or “unstructured” mode. + string source_format = 8; +} + +// Git repo configuration for a single cluster. +message GitConfig { + // The URL of the Git repository to use as the source of truth. + string sync_repo = 1; + + // The branch of the repository to sync from. Default: master. + string sync_branch = 2; + + // The path within the Git repository that represents the top level of the + // repo to sync. Default: the root directory of the repository. + string policy_dir = 3; + + // Period in seconds between consecutive syncs. Default: 15. + int64 sync_wait_secs = 4; + + // Git revision (tag or hash) to check out. Default HEAD. + string sync_rev = 5; + + // Type of secret configured for access to the Git repo. + string secret_type = 6; + + // URL for the HTTPS proxy to be used when communicating with the Git repo. + string https_proxy = 7; + + // The GCP Service Account Email used for auth when secret_type is + // gcpServiceAccount. + string gcp_service_account_email = 8; +} + +// Configuration for Policy Controller +message PolicyController { + // Enables the installation of Policy Controller. + // If false, the rest of PolicyController fields take no + // effect. + bool enabled = 1; + + // Installs the default template library along with Policy Controller. + optional bool template_library_installed = 2; + + // Sets the interval for Policy Controller Audit Scans (in seconds). + // When set to 0, this disables audit functionality altogether. + optional int64 audit_interval_seconds = 3; + + // The set of namespaces that are excluded from Policy Controller checks. + // Namespaces do not need to currently exist on the cluster. + repeated string exemptable_namespaces = 4; + + // Enables the ability to use Constraint Templates that reference to objects + // other than the object currently being evaluated. + bool referential_rules_enabled = 5; + + // Logs all denies and dry run failures. + bool log_denies_enabled = 6; + + // Enable users to try out mutation for PolicyController. + bool mutation_enabled = 7; +} + +// Configuration for Binauthz +message BinauthzConfig { + // Whether binauthz is enabled in this cluster. + bool enabled = 1; +} + +// Configuration for Hierarchy Controller +message HierarchyControllerConfig { + // Whether Hierarchy Controller is enabled in this cluster. + bool enabled = 1; + + // Whether pod tree labels are enabled in this cluster. + bool enable_pod_tree_labels = 2; + + // Whether hierarchical resource quota is enabled in this cluster. + bool enable_hierarchical_resource_quota = 3; +} + +// Deployment state for Hierarchy Controller +message HierarchyControllerDeploymentState { + // The deployment state for open source HNC (e.g. v0.7.0-hc.0) + DeploymentState hnc = 1; + + // The deployment state for Hierarchy Controller extension (e.g. v0.7.0-hc.1) + DeploymentState extension = 2; +} + +// Version for Hierarchy Controller +message HierarchyControllerVersion { + // Version for open source HNC + string hnc = 1; + + // Version for Hierarchy Controller extension + string extension = 2; +} + +// State for Hierarchy Controller +message HierarchyControllerState { + // The version for Hierarchy Controller + HierarchyControllerVersion version = 1; + + // The deployment state for Hierarchy Controller + HierarchyControllerDeploymentState state = 2; +} + +// State information for an ACM's Operator +message OperatorState { + // The semenatic version number of the operator + string version = 1; + + // The state of the Operator's deployment + DeploymentState deployment_state = 2; + + // Install errors. + repeated InstallError errors = 3; +} + +// Errors pertaining to the installation of ACM +message InstallError { + // A string representing the user facing error message + string error_message = 1; +} + +// State information for ConfigSync +message ConfigSyncState { + // The version of ConfigSync deployed + ConfigSyncVersion version = 1; + + // Information about the deployment of ConfigSync, including the version + // of the various Pods deployed + ConfigSyncDeploymentState deployment_state = 2; + + // The state of ConfigSync's process to sync configs to a cluster + SyncState sync_state = 3; +} + +// Specific versioning information pertaining to ConfigSync's Pods +message ConfigSyncVersion { + // Version of the deployed importer pod + string importer = 1; + + // Version of the deployed syncer pod + string syncer = 2; + + // Version of the deployed git-sync pod + string git_sync = 3; + + // Version of the deployed monitor pod + string monitor = 4; + + // Version of the deployed reconciler-manager pod + string reconciler_manager = 5; + + // Version of the deployed reconciler container in root-reconciler pod + string root_reconciler = 6; +} + +// The state of ConfigSync's deployment on a cluster +message ConfigSyncDeploymentState { + // Deployment state of the importer pod + DeploymentState importer = 1; + + // Deployment state of the syncer pod + DeploymentState syncer = 2; + + // Deployment state of the git-sync pod + DeploymentState git_sync = 3; + + // Deployment state of the monitor pod + DeploymentState monitor = 4; + + // Deployment state of reconciler-manager pod + DeploymentState reconciler_manager = 5; + + // Deployment state of root-reconciler + DeploymentState root_reconciler = 6; +} + +// State indicating an ACM's progress syncing configurations to a cluster +message SyncState { + // An enum representing an ACM's status syncing configs to a cluster + enum SyncCode { + // ACM cannot determine a sync code + SYNC_CODE_UNSPECIFIED = 0; + + // ACM successfully synced the git Repo with the cluster + SYNCED = 1; + + // ACM is in the progress of syncing a new change + PENDING = 2; + + // Indicates an error configuring ACM, and user action is required + ERROR = 3; + + // ACM has been installed (operator manifest deployed), + // but not configured. + NOT_CONFIGURED = 4; + + // ACM has not been installed (no operator pod found) + NOT_INSTALLED = 5; + + // Error authorizing with the cluster + UNAUTHORIZED = 6; + + // Cluster could not be reached + UNREACHABLE = 7; + } + + // Token indicating the state of the repo. + string source_token = 1; + + // Token indicating the state of the importer. + string import_token = 2; + + // Token indicating the state of the syncer. + string sync_token = 3; + + // Deprecated: use last_sync_time instead. + // Timestamp of when ACM last successfully synced the repo + // The time format is specified in https://golang.org/pkg/time/#Time.String + string last_sync = 4 [deprecated = true]; + + // Timestamp type of when ACM last successfully synced the repo + google.protobuf.Timestamp last_sync_time = 7; + + // Sync status code + SyncCode code = 5; + + // A list of errors resulting from problematic configs. + // This list will be truncated after 100 errors, although it is + // unlikely for that many errors to simultaneously exist. + repeated SyncError errors = 6; +} + +// An ACM created error representing a problem syncing configurations +message SyncError { + // An ACM defined error code + string code = 1; + + // A description of the error + string error_message = 2; + + // A list of config(s) associated with the error, if any + repeated ErrorResource error_resources = 3; +} + +// Model for a config file in the git repo with an associated Sync error +message ErrorResource { + // Path in the git repo of the erroneous config + string source_path = 1; + + // Metadata name of the resource that is causing an error + string resource_name = 2; + + // Namespace of the resource that is causing an error + string resource_namespace = 3; + + // Group/version/kind of the resource that is causing an error + GroupVersionKind resource_gvk = 4; +} + +// A Kubernetes object's GVK +message GroupVersionKind { + // Kubernetes Group + string group = 1; + + // Kubernetes Version + string version = 2; + + // Kubernetes Kind + string kind = 3; +} + +// State for PolicyControllerState. +message PolicyControllerState { + // The version of Gatekeeper Policy Controller deployed. + PolicyControllerVersion version = 1; + + // The state about the policy controller installation. + GatekeeperDeploymentState deployment_state = 2; +} + +// The build version of Gatekeeper Policy Controller is using. +message PolicyControllerVersion { + // The gatekeeper image tag that is composed of ACM version, git tag, build + // number. + string version = 1; +} + +// State for Binauthz +message BinauthzState { + // The state of the binauthz webhook. + DeploymentState webhook = 1; + + // The version of binauthz that is installed. + BinauthzVersion version = 2; +} + +// The version of binauthz. +message BinauthzVersion { + // The version of the binauthz webhook. + string webhook_version = 1; +} + +// State of Policy Controller installation. +message GatekeeperDeploymentState { + // Status of gatekeeper-controller-manager pod. + DeploymentState gatekeeper_controller_manager_state = 1; + + // Status of gatekeeper-audit deployment. + DeploymentState gatekeeper_audit = 2; + + // Status of the pod serving the mutation webhook. + DeploymentState gatekeeper_mutation = 3; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/feature.proto b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/feature.proto new file mode 100644 index 00000000000..e8557d90ab7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/feature.proto @@ -0,0 +1,215 @@ +// 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.gkehub.v1alpha; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/gkehub/v1alpha/cloudauditlogging/cloudauditlogging.proto"; +import "google/cloud/gkehub/v1alpha/configmanagement/configmanagement.proto"; +import "google/cloud/gkehub/v1alpha/metering/metering.proto"; +import "google/cloud/gkehub/v1alpha/multiclusteringress/multiclusteringress.proto"; +import "google/cloud/gkehub/v1alpha/servicemesh/servicemesh.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeHub.V1Alpha"; +option go_package = "cloud.google.com/go/gkehub/apiv1alpha/gkehubpb;gkehubpb"; +option java_multiple_files = true; +option java_outer_classname = "FeatureProto"; +option java_package = "com.google.cloud.gkehub.v1alpha"; +option php_namespace = "Google\\Cloud\\GkeHub\\V1alpha"; +option ruby_package = "Google::Cloud::GkeHub::V1alpha"; + +// Feature represents the settings and status of any Hub Feature. +message Feature { + option (google.api.resource) = { + type: "gkehub.googleapis.com/Feature" + pattern: "projects/{project}/locations/{location}/features/{feature}" + }; + + // Output only. The full, unique name of this Feature resource in the format + // `projects/*/locations/*/features/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // GCP labels for this Feature. + map labels = 2; + + // Output only. State of the Feature resource itself. + FeatureResourceState resource_state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Hub-wide Feature configuration. If this Feature does not support any + // Hub-wide configuration, this field may be unused. + CommonFeatureSpec spec = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Membership-specific configuration for this Feature. If this Feature does + // not support any per-Membership configuration, this field may be unused. + // + // The keys indicate which Membership the configuration is for, in the form: + // + // projects/{p}/locations/{l}/memberships/{m} + // + // Where {p} is the project, {l} is a valid location and {m} is a valid + // Membership in this project at that location. {p} WILL match the Feature's + // project. + // + // {p} will always be returned as the project number, but the project ID is + // also accepted during input. If the same Membership is specified in the map + // twice (using the project ID form, and the project number form), exactly + // ONE of the entries will be saved, with no guarantees as to which. For this + // reason, it is recommended the same format be used for all entries when + // mutating a Feature. + map membership_specs = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The Hub-wide Feature state. + CommonFeatureState state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Membership-specific Feature status. If this Feature does + // report any per-Membership status, this field may be unused. + // + // The keys indicate which Membership the state is for, in the form: + // + // projects/{p}/locations/{l}/memberships/{m} + // + // Where {p} is the project number, {l} is a valid location and {m} is a valid + // Membership in this project at that location. {p} MUST match the Feature's + // project number. + map membership_states = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the Feature resource was created. + google.protobuf.Timestamp create_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the Feature resource was last updated. + google.protobuf.Timestamp update_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the Feature resource was deleted. + google.protobuf.Timestamp delete_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// FeatureResourceState describes the state of a Feature *resource* in the +// GkeHub API. See `FeatureState` for the "running state" of the Feature in the +// Hub and across Memberships. +message FeatureResourceState { + // State describes the lifecycle status of a Feature. + enum State { + // State is unknown or not set. + STATE_UNSPECIFIED = 0; + + // The Feature is being enabled, and the Feature resource is being created. + // Once complete, the corresponding Feature will be enabled in this Hub. + ENABLING = 1; + + // The Feature is enabled in this Hub, and the Feature resource is fully + // available. + ACTIVE = 2; + + // The Feature is being disabled in this Hub, and the Feature resource + // is being deleted. + DISABLING = 3; + + // The Feature resource is being updated. + UPDATING = 4; + + // The Feature resource is being updated by the Hub Service. + SERVICE_UPDATING = 5; + } + + // The current state of the Feature resource in the Hub API. + State state = 1; +} + +// FeatureState describes the high-level state of a Feature. It may be used to +// describe a Feature's state at the environ-level, or per-membershop, depending +// on the context. +message FeatureState { + // Code represents a machine-readable, high-level status of the Feature. + enum Code { + // Unknown or not set. + CODE_UNSPECIFIED = 0; + + // The Feature is operating normally. + OK = 1; + + // The Feature has encountered an issue, and is operating in a degraded + // state. The Feature may need intervention to return to normal operation. + // See the description and any associated Feature-specific details for more + // information. + WARNING = 2; + + // The Feature is not operating or is in a severely degraded state. + // The Feature may need intervention to return to normal operation. + // See the description and any associated Feature-specific details for more + // information. + ERROR = 3; + } + + // The high-level, machine-readable status of this Feature. + Code code = 1; + + // A human-readable description of the current status. + string description = 2; + + // The time this status and any related Feature-specific details were updated. + google.protobuf.Timestamp update_time = 3; +} + +// CommonFeatureSpec contains Hub-wide configuration information +message CommonFeatureSpec { + oneof feature_spec { + // Multicluster Ingress-specific spec. + google.cloud.gkehub.multiclusteringress.v1alpha.FeatureSpec multiclusteringress = 102; + + // Cloud Audit Logging-specific spec. + google.cloud.gkehub.cloudauditlogging.v1alpha.FeatureSpec cloudauditlogging = 108; + } +} + +// CommonFeatureState contains Hub-wide Feature status information. +message CommonFeatureState { + oneof feature_state { + // Service Mesh-specific state. + google.cloud.gkehub.servicemesh.v1alpha.FeatureState servicemesh = 100; + } + + // Output only. The "running state" of the Feature in this Hub. + FeatureState state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// MembershipFeatureSpec contains configuration information for a single +// Membership. +message MembershipFeatureSpec { + oneof feature_spec { + // Config Management-specific spec. + google.cloud.gkehub.configmanagement.v1alpha.MembershipSpec configmanagement = 106; + } +} + +// MembershipFeatureState contains Feature status information for a single +// Membership. +message MembershipFeatureState { + oneof feature_state { + // Service Mesh-specific state. + google.cloud.gkehub.servicemesh.v1alpha.MembershipState servicemesh = 100; + + // Metering-specific spec. + google.cloud.gkehub.metering.v1alpha.MembershipState metering = 104; + + // Config Management-specific state. + google.cloud.gkehub.configmanagement.v1alpha.MembershipState configmanagement = 106; + } + + // The high-level state of this Feature for a single membership. + FeatureState state = 1; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/metering/metering.proto b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/metering/metering.proto new file mode 100644 index 00000000000..6bb7e55a721 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/metering/metering.proto @@ -0,0 +1,38 @@ +// 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.gkehub.metering.v1alpha; + +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeHub.Metering.V1Alpha"; +option go_package = "cloud.google.com/go/gkehub/metering/apiv1alpha/meteringpb;meteringpb"; +option java_multiple_files = true; +option java_outer_classname = "MeteringProto"; +option java_package = "com.google.cloud.gkehub.metering.v1alpha"; +option php_namespace = "Google\\Cloud\\GkeHub\\Metering\\V1alpha"; +option ruby_package = "Google::Cloud::GkeHub::Metering::V1alpha"; + +// **Metering**: Per-Membership Feature State. +message MembershipState { + // The time stamp of the most recent measurement of the number of vCPUs + // in the cluster. + google.protobuf.Timestamp last_measurement_time = 1; + + // The vCPUs capacity in the cluster according to the most recent + // measurement (1/1000 precision). + float precise_last_measured_cluster_vcpu_capacity = 3; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/multiclusteringress/multiclusteringress.proto b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/multiclusteringress/multiclusteringress.proto new file mode 100644 index 00000000000..2d4ce5c7f2f --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/multiclusteringress/multiclusteringress.proto @@ -0,0 +1,49 @@ +// 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.gkehub.multiclusteringress.v1alpha; + + +option csharp_namespace = "Google.Cloud.GkeHub.MultiClusterIngress.V1Alpha"; +option go_package = "cloud.google.com/go/gkehub/multiclusteringress/apiv1alpha/multiclusteringresspb;multiclusteringresspb"; +option java_multiple_files = true; +option java_outer_classname = "MultiClusterIngressProto"; +option java_package = "com.google.cloud.gkehub.multiclusteringress.v1alpha"; +option php_namespace = "Google\\Cloud\\GkeHub\\MultiClusterIngress\\V1alpha"; +option ruby_package = "Google::Cloud::GkeHub::MultiClusterIngress::V1alpha"; + +// Billing identifies which billing structure the customer is using. +enum Billing { + // Unknown + BILLING_UNSPECIFIED = 0; + + // User pays a fee per-endpoint. + PAY_AS_YOU_GO = 1; + + // User is paying for Anthos as a whole. + ANTHOS_LICENSE = 2; +} + +// **Multi-cluster Ingress**: The configuration for the MultiClusterIngress +// feature. +message FeatureSpec { + // Fully-qualified Membership name which hosts the MultiClusterIngress CRD. + // Example: `projects/foo-proj/locations/global/memberships/bar` + string config_membership = 1; + + // Customer's billing structure + Billing billing = 2; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/service.proto b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/service.proto new file mode 100644 index 00000000000..f90a53a5129 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/service.proto @@ -0,0 +1,280 @@ +// 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.gkehub.v1alpha; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/gkehub/v1alpha/feature.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeHub.V1Alpha"; +option go_package = "cloud.google.com/go/gkehub/apiv1alpha/gkehubpb;gkehubpb"; +option java_multiple_files = true; +option java_outer_classname = "ServiceProto"; +option java_package = "com.google.cloud.gkehub.v1alpha"; +option php_namespace = "Google\\Cloud\\GkeHub\\V1alpha"; +option ruby_package = "Google::Cloud::GkeHub::V1alpha"; + +// The GKE Hub service handles the registration of many Kubernetes clusters to +// Google Cloud, and the management of multi-cluster features over those +// clusters. +// +// The GKE Hub service operates on the following resources: +// +// * [Membership][google.cloud.gkehub.v1alpha.Membership] +// * [Feature][google.cloud.gkehub.v1alpha.Feature] +// +// GKE Hub is currently only available in the global region. +// +// **Membership management may be non-trivial:** it is recommended to use one +// of the Google-provided client libraries or tools where possible when working +// with Membership resources. +service GkeHub { + option (google.api.default_host) = "gkehub.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists Features in a given project and location. + rpc ListFeatures(ListFeaturesRequest) returns (ListFeaturesResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/locations/*}/features" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single Feature. + rpc GetFeature(GetFeatureRequest) returns (Feature) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/locations/*/features/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Adds a new Feature. + rpc CreateFeature(CreateFeatureRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha/{parent=projects/*/locations/*}/features" + body: "resource" + }; + option (google.api.method_signature) = "parent,resource,feature_id"; + option (google.longrunning.operation_info) = { + response_type: "Feature" + metadata_type: "OperationMetadata" + }; + } + + // Removes a Feature. + rpc DeleteFeature(DeleteFeatureRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1alpha/{name=projects/*/locations/*/features/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Updates an existing Feature. + rpc UpdateFeature(UpdateFeatureRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1alpha/{name=projects/*/locations/*/features/*}" + body: "resource" + }; + option (google.api.method_signature) = "name,resource,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Feature" + metadata_type: "OperationMetadata" + }; + } +} + +// Request message for `GkeHub.ListFeatures` method. +message ListFeaturesRequest { + // The parent (project and location) where the Features will be listed. + // Specified in the format `projects/*/locations/*`. + string parent = 1; + + // When requesting a 'page' of resources, `page_size` specifies number of + // resources to return. If unspecified or set to 0, all resources will + // be returned. + int32 page_size = 2; + + // Token returned by previous call to `ListFeatures` which + // specifies the position in the list from where to continue listing the + // resources. + string page_token = 3; + + // Lists Features that match the filter expression, following the syntax + // outlined in https://google.aip.dev/160. + // + // Examples: + // + // - Feature with the name "servicemesh" in project "foo-proj": + // + // name = "projects/foo-proj/locations/global/features/servicemesh" + // + // - Features that have a label called `foo`: + // + // labels.foo:* + // + // - Features that have a label called `foo` whose value is `bar`: + // + // labels.foo = bar + string filter = 4; + + // One or more fields to compare and use to sort the output. + // See https://google.aip.dev/132#ordering. + string order_by = 5; +} + +// Response message for the `GkeHub.ListFeatures` method. +message ListFeaturesResponse { + // The list of matching Features + repeated Feature resources = 1; + + // A token to request the next page of resources from the + // `ListFeatures` method. The value of an empty string means + // that there are no more resources to return. + string next_page_token = 2; +} + +// Request message for `GkeHub.GetFeature` method. +message GetFeatureRequest { + // The Feature resource name in the format + // `projects/*/locations/*/features/*` + string name = 1; +} + +// Request message for the `GkeHub.CreateFeature` method. +message CreateFeatureRequest { + // The parent (project and location) where the Feature will be created. + // Specified in the format `projects/*/locations/*`. + string parent = 1; + + // The ID of the feature to create. + string feature_id = 2; + + // The Feature resource to create. + Feature resource = 3; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for `GkeHub.DeleteFeature` method. +message DeleteFeatureRequest { + // The Feature resource name in the format + // `projects/*/locations/*/features/*`. + string name = 1; + + // If set to true, the delete will ignore any outstanding resources for + // this Feature (that is, `FeatureState.has_resources` is set to true). These + // resources will NOT be cleaned up or modified in any way. + bool force = 2; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for `GkeHub.UpdateFeature` method. +message UpdateFeatureRequest { + // The Feature resource name in the format + // `projects/*/locations/*/features/*`. + string name = 1; + + // Mask of fields to update. + google.protobuf.FieldMask update_mask = 2; + + // Only fields specified in update_mask are updated. + // If you specify a field in the update_mask but don't specify its value here + // that field will be deleted. + // If you are updating a map field, set the value of a key to null or empty + // string to delete the key from the map. It's not possible to update a key's + // value to the empty string. + // If you specify the update_mask to be a special path "*", fully replaces all + // user-modifiable fields to match `resource`. + Feature resource = 3; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_detail = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/servicemesh/servicemesh.proto b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/servicemesh/servicemesh.proto new file mode 100644 index 00000000000..927c15a5994 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/servicemesh/servicemesh.proto @@ -0,0 +1,114 @@ +// 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.gkehub.servicemesh.v1alpha; + +import "google/api/field_behavior.proto"; +import "google/protobuf/struct.proto"; + +option csharp_namespace = "Google.Cloud.GkeHub.ServiceMesh.V1Alpha"; +option go_package = "cloud.google.com/go/gkehub/servicemesh/apiv1alpha/servicemeshpb;servicemeshpb"; +option java_multiple_files = true; +option java_outer_classname = "ServiceMeshProto"; +option java_package = "com.google.cloud.gkehub.servicemesh.v1alpha"; +option php_namespace = "Google\\Cloud\\GkeHub\\ServiceMesh\\V1alpha"; +option ruby_package = "Google::Cloud::GkeHub::ServiceMesh::V1alpha"; + +// **Service Mesh**: State for the whole Hub, as analyzed by the Service Mesh +// Hub Controller. +message FeatureState { + // Output only. Results of running Service Mesh analyzers. + repeated AnalysisMessage analysis_messages = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// **Service Mesh**: State for a single Membership, as analyzed by the Service +// Mesh Hub Controller. +message MembershipState { + // Output only. Results of running Service Mesh analyzers. + repeated AnalysisMessage analysis_messages = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// AnalysisMessageBase describes some common information that is +// needed for all messages. +message AnalysisMessageBase { + // A unique identifier for the type of message. Display_name is intended to be + // human-readable, code is intended to be machine readable. There should be a + // one-to-one mapping between display_name and code. (i.e. do not re-use + // display_names or codes between message types.) + // See istio.analysis.v1alpha1.AnalysisMessageBase.Type + message Type { + // A human-readable name for the message type. e.g. "InternalError", + // "PodMissingProxy". This should be the same for all messages of the same + // type. (This corresponds to the `name` field in open-source Istio.) + string display_name = 1; + + // A 7 character code matching `^IST[0-9]{4}$` or `^ASM[0-9]{4}$`, intended + // to uniquely identify the message type. (e.g. "IST0001" is mapped to the + // "InternalError" message type.) + string code = 2; + } + + // The values here are chosen so that more severe messages get sorted higher, + // as well as leaving space in between to add more later + // See istio.analysis.v1alpha1.AnalysisMessageBase.Level + enum Level { + // Illegal. Same istio.analysis.v1alpha1.AnalysisMessageBase.Level.UNKNOWN. + LEVEL_UNSPECIFIED = 0; + + // ERROR represents a misconfiguration that must be fixed. + ERROR = 3; + + // WARNING represents a misconfiguration that should be fixed. + WARNING = 8; + + // INFO represents an informational finding. + INFO = 12; + } + + // Represents the specific type of a message. + Type type = 1; + + // Represents how severe a message is. + Level level = 2; + + // A url pointing to the Service Mesh or Istio documentation for this specific + // error type. + string documentation_url = 3; +} + +// AnalysisMessage is a single message produced by an analyzer, and +// it used to communicate to the end user about the state of their Service +// Mesh configuration. +message AnalysisMessage { + // Details common to all types of Istio and ServiceMesh analysis messages. + AnalysisMessageBase message_base = 1; + + // A human readable description of what the error means. It is suitable for + // non-internationalize display purposes. + string description = 2; + + // A list of strings specifying the resource identifiers that were the cause + // of message generation. + // A "path" here may be: + // * MEMBERSHIP_ID if the cause is a specific member cluster + // * MEMBERSHIP_ID/(NAMESPACE\/)?RESOURCETYPE/NAME if the cause is a resource + // in a cluster + repeated string resource_paths = 3; + + // A UI can combine these args with a template (based on message_base.type) + // to produce an internationalized message. + google.protobuf.Struct args = 4; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.create_feature.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.create_feature.js new file mode 100644 index 00000000000..a5845935054 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.create_feature.js @@ -0,0 +1,84 @@ +// 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() { + // [START gkehub_v1alpha_generated_GkeHub_CreateFeature_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The parent (project and location) where the Feature will be created. + * Specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * The ID of the feature to create. + */ + // const featureId = 'abc123' + /** + * The Feature resource to create. + */ + // const resource = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callCreateFeature() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await gkehubClient.createFeature(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFeature(); + // [END gkehub_v1alpha_generated_GkeHub_CreateFeature_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-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.delete_feature.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.delete_feature.js new file mode 100644 index 00000000000..e6ecc51192f --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.delete_feature.js @@ -0,0 +1,82 @@ +// 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() { + // [START gkehub_v1alpha_generated_GkeHub_DeleteFeature_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The Feature resource name in the format + * `projects/* /locations/* /features/*`. + */ + // const name = 'abc123' + /** + * If set to true, the delete will ignore any outstanding resources for + * this Feature (that is, `FeatureState.has_resources` is set to true). These + * resources will NOT be cleaned up or modified in any way. + */ + // const force = true + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callDeleteFeature() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await gkehubClient.deleteFeature(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFeature(); + // [END gkehub_v1alpha_generated_GkeHub_DeleteFeature_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-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.get_feature.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.get_feature.js new file mode 100644 index 00000000000..f93adaaa241 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.get_feature.js @@ -0,0 +1,61 @@ +// 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() { + // [START gkehub_v1alpha_generated_GkeHub_GetFeature_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The Feature resource name in the format + * `projects/* /locations/* /features/*` + */ + // const name = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callGetFeature() { + // Construct request + const request = { + }; + + // Run request + const response = await gkehubClient.getFeature(request); + console.log(response); + } + + callGetFeature(); + // [END gkehub_v1alpha_generated_GkeHub_GetFeature_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-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.list_features.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.list_features.js new file mode 100644 index 00000000000..f1ad6170112 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.list_features.js @@ -0,0 +1,92 @@ +// 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() { + // [START gkehub_v1alpha_generated_GkeHub_ListFeatures_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The parent (project and location) where the Features will be listed. + * Specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * When requesting a 'page' of resources, `page_size` specifies number of + * resources to return. If unspecified or set to 0, all resources will + * be returned. + */ + // const pageSize = 1234 + /** + * Token returned by previous call to `ListFeatures` which + * specifies the position in the list from where to continue listing the + * resources. + */ + // const pageToken = 'abc123' + /** + * Lists Features that match the filter expression, following the syntax + * outlined in https://google.aip.dev/160. + * Examples: + * - Feature with the name "servicemesh" in project "foo-proj": + * name = "projects/foo-proj/locations/global/features/servicemesh" + * - Features that have a label called `foo`: + * labels.foo:* + * - Features that have a label called `foo` whose value is `bar`: + * labels.foo = bar + */ + // const filter = 'abc123' + /** + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callListFeatures() { + // Construct request + const request = { + }; + + // Run request + const iterable = await gkehubClient.listFeaturesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFeatures(); + // [END gkehub_v1alpha_generated_GkeHub_ListFeatures_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-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.update_feature.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.update_feature.js new file mode 100644 index 00000000000..951cd95ffc7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.update_feature.js @@ -0,0 +1,91 @@ +// 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() { + // [START gkehub_v1alpha_generated_GkeHub_UpdateFeature_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The Feature resource name in the format + * `projects/* /locations/* /features/*`. + */ + // const name = 'abc123' + /** + * Mask of fields to update. + */ + // const updateMask = {} + /** + * Only fields specified in update_mask are updated. + * If you specify a field in the update_mask but don't specify its value here + * that field will be deleted. + * If you are updating a map field, set the value of a key to null or empty + * string to delete the key from the map. It's not possible to update a key's + * value to the empty string. + * If you specify the update_mask to be a special path "*", fully replaces all + * user-modifiable fields to match `resource`. + */ + // const resource = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callUpdateFeature() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await gkehubClient.updateFeature(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFeature(); + // [END gkehub_v1alpha_generated_GkeHub_UpdateFeature_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-gkehub/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.gkehub.v1alpha.json b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.gkehub.v1alpha.json new file mode 100644 index 00000000000..f2c6d5fd175 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.gkehub.v1alpha.json @@ -0,0 +1,263 @@ +{ + "clientLibrary": { + "name": "nodejs-gkehub", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.gkehub.v1alpha", + "version": "v1alpha" + } + ] + }, + "snippets": [ + { + "regionTag": "gkehub_v1alpha_generated_GkeHub_ListFeatures_async", + "title": "GkeHub listFeatures Sample", + "origin": "API_DEFINITION", + "description": " Lists Features in a given project and location.", + "canonical": true, + "file": "gke_hub.list_features.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFeatures", + "fullName": "google.cloud.gkehub.v1alpha.GkeHub.ListFeatures", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkehub.v1alpha.ListFeaturesResponse", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1alpha.GkeHubClient" + }, + "method": { + "shortName": "ListFeatures", + "fullName": "google.cloud.gkehub.v1alpha.GkeHub.ListFeatures", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1alpha.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1alpha_generated_GkeHub_GetFeature_async", + "title": "GkeHub getFeature Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single Feature.", + "canonical": true, + "file": "gke_hub.get_feature.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFeature", + "fullName": "google.cloud.gkehub.v1alpha.GkeHub.GetFeature", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkehub.v1alpha.Feature", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1alpha.GkeHubClient" + }, + "method": { + "shortName": "GetFeature", + "fullName": "google.cloud.gkehub.v1alpha.GkeHub.GetFeature", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1alpha.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1alpha_generated_GkeHub_CreateFeature_async", + "title": "GkeHub createFeature Sample", + "origin": "API_DEFINITION", + "description": " Adds a new Feature.", + "canonical": true, + "file": "gke_hub.create_feature.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFeature", + "fullName": "google.cloud.gkehub.v1alpha.GkeHub.CreateFeature", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "feature_id", + "type": "TYPE_STRING" + }, + { + "name": "resource", + "type": ".google.cloud.gkehub.v1alpha.Feature" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1alpha.GkeHubClient" + }, + "method": { + "shortName": "CreateFeature", + "fullName": "google.cloud.gkehub.v1alpha.GkeHub.CreateFeature", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1alpha.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1alpha_generated_GkeHub_DeleteFeature_async", + "title": "GkeHub deleteFeature Sample", + "origin": "API_DEFINITION", + "description": " Removes a Feature.", + "canonical": true, + "file": "gke_hub.delete_feature.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFeature", + "fullName": "google.cloud.gkehub.v1alpha.GkeHub.DeleteFeature", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1alpha.GkeHubClient" + }, + "method": { + "shortName": "DeleteFeature", + "fullName": "google.cloud.gkehub.v1alpha.GkeHub.DeleteFeature", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1alpha.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1alpha_generated_GkeHub_UpdateFeature_async", + "title": "GkeHub updateFeature Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing Feature.", + "canonical": true, + "file": "gke_hub.update_feature.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFeature", + "fullName": "google.cloud.gkehub.v1alpha.GkeHub.UpdateFeature", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "resource", + "type": ".google.cloud.gkehub.v1alpha.Feature" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1alpha.GkeHubClient" + }, + "method": { + "shortName": "UpdateFeature", + "fullName": "google.cloud.gkehub.v1alpha.GkeHub.UpdateFeature", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1alpha.GkeHub" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha/src/index.ts new file mode 100644 index 00000000000..f559a8869eb --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/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 v1alpha from './v1alpha'; +const GkeHubClient = v1alpha.GkeHubClient; +type GkeHubClient = v1alpha.GkeHubClient; +export {v1alpha, GkeHubClient}; +export default {v1alpha, GkeHubClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gapic_metadata.json b/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gapic_metadata.json new file mode 100644 index 00000000000..bd65d90c5be --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gapic_metadata.json @@ -0,0 +1,77 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.gkehub.v1alpha", + "libraryPackage": "@google-cloud/gke-hub", + "services": { + "GkeHub": { + "clients": { + "grpc": { + "libraryClient": "GkeHubClient", + "rpcs": { + "GetFeature": { + "methods": [ + "getFeature" + ] + }, + "CreateFeature": { + "methods": [ + "createFeature" + ] + }, + "DeleteFeature": { + "methods": [ + "deleteFeature" + ] + }, + "UpdateFeature": { + "methods": [ + "updateFeature" + ] + }, + "ListFeatures": { + "methods": [ + "listFeatures", + "listFeaturesStream", + "listFeaturesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "GkeHubClient", + "rpcs": { + "GetFeature": { + "methods": [ + "getFeature" + ] + }, + "CreateFeature": { + "methods": [ + "createFeature" + ] + }, + "DeleteFeature": { + "methods": [ + "deleteFeature" + ] + }, + "UpdateFeature": { + "methods": [ + "updateFeature" + ] + }, + "ListFeatures": { + "methods": [ + "listFeatures", + "listFeaturesStream", + "listFeaturesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_client.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_client.ts new file mode 100644 index 00000000000..7853ea12bf5 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_client.ts @@ -0,0 +1,1084 @@ +// 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, GrpcClientOptions, LROperation, 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/v1alpha/gke_hub_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './gke_hub_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The GKE Hub service handles the registration of many Kubernetes clusters to + * Google Cloud, and the management of multi-cluster features over those + * clusters. + * + * The GKE Hub service operates on the following resources: + * + * * {@link protos.google.cloud.gkehub.v1alpha.Membership|Membership} + * * {@link protos.google.cloud.gkehub.v1alpha.Feature|Feature} + * + * GKE Hub is currently only available in the global region. + * + * **Membership management may be non-trivial:** it is recommended to use one + * of the Google-provided client libraries or tools where possible when working + * with Membership resources. + * @class + * @memberof v1alpha + */ +export class GkeHubClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + gkeHubStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of GkeHubClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 GkeHubClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof GkeHubClient; + 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 { + 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 = { + featurePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/features/{feature}' + ), + }; + + // 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 = { + listFeatures: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha/{resource=projects/*/locations/*/memberships/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha/{resource=projects/*/locations/*/features/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha/{resource=projects/*/locations/*/memberships/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/features/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha/{resource=projects/*/locations/*/memberships/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/features/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createFeatureResponse = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1alpha.Feature') as gax.protobuf.Type; + const createFeatureMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1alpha.OperationMetadata') as gax.protobuf.Type; + const deleteFeatureResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteFeatureMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1alpha.OperationMetadata') as gax.protobuf.Type; + const updateFeatureResponse = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1alpha.Feature') as gax.protobuf.Type; + const updateFeatureMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1alpha.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createFeature: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFeatureResponse.decode.bind(createFeatureResponse), + createFeatureMetadata.decode.bind(createFeatureMetadata)), + deleteFeature: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFeatureResponse.decode.bind(deleteFeatureResponse), + deleteFeatureMetadata.decode.bind(deleteFeatureMetadata)), + updateFeature: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFeatureResponse.decode.bind(updateFeatureResponse), + updateFeatureMetadata.decode.bind(updateFeatureMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.gkehub.v1alpha.GkeHub', 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.gkeHubStub) { + return this.gkeHubStub; + } + + // Put together the "service stub" for + // google.cloud.gkehub.v1alpha.GkeHub. + this.gkeHubStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.gkehub.v1alpha.GkeHub') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.gkehub.v1alpha.GkeHub, + 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 gkeHubStubMethods = + ['listFeatures', 'getFeature', 'createFeature', 'deleteFeature', 'updateFeature']; + for (const methodName of gkeHubStubMethods) { + const callPromise = this.gkeHubStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.gkeHubStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'gkehub.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 'gkehub.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 -- + // ------------------- +/** + * Gets details of a single Feature. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The Feature resource name in the format + * `projects/* /locations/* /features/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1alpha.Feature|Feature}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/gke_hub.get_feature.js + * region_tag:gkehub_v1alpha_generated_GkeHub_GetFeature_async + */ + getFeature( + request?: protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1alpha.IFeature, + protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest|undefined, {}|undefined + ]>; + getFeature( + request: protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkehub.v1alpha.IFeature, + protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest|null|undefined, + {}|null|undefined>): void; + getFeature( + request: protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest, + callback: Callback< + protos.google.cloud.gkehub.v1alpha.IFeature, + protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest|null|undefined, + {}|null|undefined>): void; + getFeature( + request?: protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkehub.v1alpha.IFeature, + protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkehub.v1alpha.IFeature, + protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkehub.v1alpha.IFeature, + protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest|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.getFeature(request, options, callback); + } + +/** + * Adds a new Feature. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent (project and location) where the Feature will be created. + * Specified in the format `projects/* /locations/*`. + * @param {string} request.featureId + * The ID of the feature to create. + * @param {google.cloud.gkehub.v1alpha.Feature} request.resource + * The Feature resource to create. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/gke_hub.create_feature.js + * region_tag:gkehub_v1alpha_generated_GkeHub_CreateFeature_async + */ + createFeature( + request?: protos.google.cloud.gkehub.v1alpha.ICreateFeatureRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createFeature( + request: protos.google.cloud.gkehub.v1alpha.ICreateFeatureRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFeature( + request: protos.google.cloud.gkehub.v1alpha.ICreateFeatureRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFeature( + request?: protos.google.cloud.gkehub.v1alpha.ICreateFeatureRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFeature(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createFeature()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/gke_hub.create_feature.js + * region_tag:gkehub_v1alpha_generated_GkeHub_CreateFeature_async + */ + async checkCreateFeatureProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFeature, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Removes a Feature. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The Feature resource name in the format + * `projects/* /locations/* /features/*`. + * @param {boolean} request.force + * If set to true, the delete will ignore any outstanding resources for + * this Feature (that is, `FeatureState.has_resources` is set to true). These + * resources will NOT be cleaned up or modified in any way. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/gke_hub.delete_feature.js + * region_tag:gkehub_v1alpha_generated_GkeHub_DeleteFeature_async + */ + deleteFeature( + request?: protos.google.cloud.gkehub.v1alpha.IDeleteFeatureRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteFeature( + request: protos.google.cloud.gkehub.v1alpha.IDeleteFeatureRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFeature( + request: protos.google.cloud.gkehub.v1alpha.IDeleteFeatureRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFeature( + request?: protos.google.cloud.gkehub.v1alpha.IDeleteFeatureRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteFeature(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteFeature()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/gke_hub.delete_feature.js + * region_tag:gkehub_v1alpha_generated_GkeHub_DeleteFeature_async + */ + async checkDeleteFeatureProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFeature, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an existing Feature. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The Feature resource name in the format + * `projects/* /locations/* /features/*`. + * @param {google.protobuf.FieldMask} request.updateMask + * Mask of fields to update. + * @param {google.cloud.gkehub.v1alpha.Feature} request.resource + * Only fields specified in update_mask are updated. + * If you specify a field in the update_mask but don't specify its value here + * that field will be deleted. + * If you are updating a map field, set the value of a key to null or empty + * string to delete the key from the map. It's not possible to update a key's + * value to the empty string. + * If you specify the update_mask to be a special path "*", fully replaces all + * user-modifiable fields to match `resource`. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/gke_hub.update_feature.js + * region_tag:gkehub_v1alpha_generated_GkeHub_UpdateFeature_async + */ + updateFeature( + request?: protos.google.cloud.gkehub.v1alpha.IUpdateFeatureRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateFeature( + request: protos.google.cloud.gkehub.v1alpha.IUpdateFeatureRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFeature( + request: protos.google.cloud.gkehub.v1alpha.IUpdateFeatureRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFeature( + request?: protos.google.cloud.gkehub.v1alpha.IUpdateFeatureRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFeature(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateFeature()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/gke_hub.update_feature.js + * region_tag:gkehub_v1alpha_generated_GkeHub_UpdateFeature_async + */ + async checkUpdateFeatureProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFeature, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists Features in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent (project and location) where the Features will be listed. + * Specified in the format `projects/* /locations/*`. + * @param {number} request.pageSize + * When requesting a 'page' of resources, `page_size` specifies number of + * resources to return. If unspecified or set to 0, all resources will + * be returned. + * @param {string} request.pageToken + * Token returned by previous call to `ListFeatures` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} request.filter + * Lists Features that match the filter expression, following the syntax + * outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Feature with the name "servicemesh" in project "foo-proj": + * + * name = "projects/foo-proj/locations/global/features/servicemesh" + * + * - Features that have a label called `foo`: + * + * labels.foo:* + * + * - Features that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * @param {string} request.orderBy + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1alpha.Feature|Feature}. + * 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 `listFeaturesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFeatures( + request?: protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1alpha.IFeature[], + protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest|null, + protos.google.cloud.gkehub.v1alpha.IListFeaturesResponse + ]>; + listFeatures( + request: protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, + protos.google.cloud.gkehub.v1alpha.IListFeaturesResponse|null|undefined, + protos.google.cloud.gkehub.v1alpha.IFeature>): void; + listFeatures( + request: protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, + callback: PaginationCallback< + protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, + protos.google.cloud.gkehub.v1alpha.IListFeaturesResponse|null|undefined, + protos.google.cloud.gkehub.v1alpha.IFeature>): void; + listFeatures( + request?: protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, + protos.google.cloud.gkehub.v1alpha.IListFeaturesResponse|null|undefined, + protos.google.cloud.gkehub.v1alpha.IFeature>, + callback?: PaginationCallback< + protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, + protos.google.cloud.gkehub.v1alpha.IListFeaturesResponse|null|undefined, + protos.google.cloud.gkehub.v1alpha.IFeature>): + Promise<[ + protos.google.cloud.gkehub.v1alpha.IFeature[], + protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest|null, + protos.google.cloud.gkehub.v1alpha.IListFeaturesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listFeatures(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 + * The parent (project and location) where the Features will be listed. + * Specified in the format `projects/* /locations/*`. + * @param {number} request.pageSize + * When requesting a 'page' of resources, `page_size` specifies number of + * resources to return. If unspecified or set to 0, all resources will + * be returned. + * @param {string} request.pageToken + * Token returned by previous call to `ListFeatures` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} request.filter + * Lists Features that match the filter expression, following the syntax + * outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Feature with the name "servicemesh" in project "foo-proj": + * + * name = "projects/foo-proj/locations/global/features/servicemesh" + * + * - Features that have a label called `foo`: + * + * labels.foo:* + * + * - Features that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * @param {string} request.orderBy + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 protos.google.cloud.gkehub.v1alpha.Feature|Feature} 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 `listFeaturesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFeaturesStream( + request?: protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, + 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['listFeatures']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFeatures.createStream( + this.innerApiCalls.listFeatures as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFeatures`, 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 + * The parent (project and location) where the Features will be listed. + * Specified in the format `projects/* /locations/*`. + * @param {number} request.pageSize + * When requesting a 'page' of resources, `page_size` specifies number of + * resources to return. If unspecified or set to 0, all resources will + * be returned. + * @param {string} request.pageToken + * Token returned by previous call to `ListFeatures` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} request.filter + * Lists Features that match the filter expression, following the syntax + * outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Feature with the name "servicemesh" in project "foo-proj": + * + * name = "projects/foo-proj/locations/global/features/servicemesh" + * + * - Features that have a label called `foo`: + * + * labels.foo:* + * + * - Features that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * @param {string} request.orderBy + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkehub.v1alpha.Feature|Feature}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/gke_hub.list_features.js + * region_tag:gkehub_v1alpha_generated_GkeHub_ListFeatures_async + */ + listFeaturesAsync( + request?: protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, + 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['listFeatures']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFeatures.asyncIterate( + this.innerApiCalls['listFeatures'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified feature resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} feature + * @returns {string} Resource name string. + */ + featurePath(project:string,location:string,feature:string) { + return this.pathTemplates.featurePathTemplate.render({ + project: project, + location: location, + feature: feature, + }); + } + + /** + * Parse the project from Feature resource. + * + * @param {string} featureName + * A fully-qualified path representing Feature resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFeatureName(featureName: string) { + return this.pathTemplates.featurePathTemplate.match(featureName).project; + } + + /** + * Parse the location from Feature resource. + * + * @param {string} featureName + * A fully-qualified path representing Feature resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFeatureName(featureName: string) { + return this.pathTemplates.featurePathTemplate.match(featureName).location; + } + + /** + * Parse the feature from Feature resource. + * + * @param {string} featureName + * A fully-qualified path representing Feature resource. + * @returns {string} A string representing the feature. + */ + matchFeatureFromFeatureName(featureName: string) { + return this.pathTemplates.featurePathTemplate.match(featureName).feature; + } + + /** + * 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.gkeHubStub && !this._terminated) { + return this.gkeHubStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_client_config.json b/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_client_config.json new file mode 100644 index 00000000000..d972b7a4a13 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_client_config.json @@ -0,0 +1,63 @@ +{ + "interfaces": { + "google.cloud.gkehub.v1alpha.GkeHub": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListFeatures": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetFeature": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateFeature": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteFeature": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdateFeature": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_proto_list.json b/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_proto_list.json new file mode 100644 index 00000000000..4b8b6202159 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/cloud/gkehub/v1alpha/cloudauditlogging/cloudauditlogging.proto", + "../../protos/google/cloud/gkehub/v1alpha/configmanagement/configmanagement.proto", + "../../protos/google/cloud/gkehub/v1alpha/feature.proto", + "../../protos/google/cloud/gkehub/v1alpha/metering/metering.proto", + "../../protos/google/cloud/gkehub/v1alpha/multiclusteringress/multiclusteringress.proto", + "../../protos/google/cloud/gkehub/v1alpha/service.proto", + "../../protos/google/cloud/gkehub/v1alpha/servicemesh/servicemesh.proto" +] diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/index.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/index.ts new file mode 100644 index 00000000000..aaf819215ae --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/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 {GkeHubClient} from './gke_hub_client'; diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..723143457a0 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/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 gkehub = require('@google-cloud/gke-hub'); + +function main() { + const gkeHubClient = new gkehub.GkeHubClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..832fe8321c7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/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 {GkeHubClient} from '@google-cloud/gke-hub'; + +// check that the client class type name can be used +function doStuffWithGkeHubClient(client: GkeHubClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const gkeHubClient = new GkeHubClient(); + doStuffWithGkeHubClient(gkeHubClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/install.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/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-gkehub/v1alpha/test/gapic_gke_hub_v1alpha.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha/test/gapic_gke_hub_v1alpha.ts new file mode 100644 index 00000000000..3bc8ea391b4 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/test/gapic_gke_hub_v1alpha.ts @@ -0,0 +1,1077 @@ +// 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 gkehubModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1alpha.GkeHubClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = gkehubModule.v1alpha.GkeHubClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = gkehubModule.v1alpha.GkeHubClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = gkehubModule.v1alpha.GkeHubClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new gkehubModule.v1alpha.GkeHubClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.gkeHubStub, undefined); + await client.initialize(); + assert(client.gkeHubStub); + }); + + it('has close method for the initialized client', done => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.gkeHubStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.gkeHubStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new gkehubModule.v1alpha.GkeHubClient({ + 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 gkehubModule.v1alpha.GkeHubClient({ + 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('getFeature', () => { + it('invokes getFeature without error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.GetFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.GetFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.Feature() + ); + client.innerApiCalls.getFeature = stubSimpleCall(expectedResponse); + const [response] = await client.getFeature(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFeature without error using callback', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.GetFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.GetFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.Feature() + ); + client.innerApiCalls.getFeature = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFeature( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1alpha.IFeature|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFeature with error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.GetFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.GetFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFeature = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFeature(request), expectedError); + const actualRequest = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFeature with closed client', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.GetFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.GetFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFeature(request), expectedError); + }); + }); + + describe('createFeature', () => { + it('invokes createFeature without error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.CreateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.CreateFeatureRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFeature = stubLongRunningCall(expectedResponse); + const [operation] = await client.createFeature(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFeature without error using callback', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.CreateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.CreateFeatureRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFeature = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFeature( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFeature with call error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.CreateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.CreateFeatureRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFeature = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createFeature(request), expectedError); + const actualRequest = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFeature with LRO error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.CreateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.CreateFeatureRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFeature = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createFeature(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateFeatureProgress without error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateFeatureProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFeatureProgress with error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateFeatureProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteFeature', () => { + it('invokes deleteFeature without error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.DeleteFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.DeleteFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFeature = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFeature(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFeature without error using callback', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.DeleteFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.DeleteFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFeature = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFeature( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFeature with call error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.DeleteFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.DeleteFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFeature = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteFeature(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFeature with LRO error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.DeleteFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.DeleteFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFeature = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteFeature(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteFeatureProgress without error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteFeatureProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFeatureProgress with error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteFeatureProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateFeature', () => { + it('invokes updateFeature without error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.UpdateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.UpdateFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFeature = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFeature(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFeature without error using callback', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.UpdateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.UpdateFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFeature = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFeature( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFeature with call error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.UpdateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.UpdateFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFeature = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateFeature(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFeature with LRO error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.UpdateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.UpdateFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFeature = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateFeature(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateFeatureProgress without error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateFeatureProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFeatureProgress with error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateFeatureProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listFeatures', () => { + it('invokes listFeatures without error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), + ]; + client.innerApiCalls.listFeatures = stubSimpleCall(expectedResponse); + const [response] = await client.listFeatures(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFeatures without error using callback', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), + ]; + client.innerApiCalls.listFeatures = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFeatures( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1alpha.IFeature[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFeatures with error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFeatures = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFeatures(request), expectedError); + const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFeaturesStream without error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), + ]; + client.descriptors.page.listFeatures.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFeaturesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkehub.v1alpha.Feature[] = []; + stream.on('data', (response: protos.google.cloud.gkehub.v1alpha.Feature) => { + 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.listFeatures.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFeatures, request)); + assert( + (client.descriptors.page.listFeatures.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFeaturesStream with error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFeatures.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFeaturesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkehub.v1alpha.Feature[] = []; + stream.on('data', (response: protos.google.cloud.gkehub.v1alpha.Feature) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFeatures.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFeatures, request)); + assert( + (client.descriptors.page.listFeatures.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFeatures without error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), + ]; + client.descriptors.page.listFeatures.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkehub.v1alpha.IFeature[] = []; + const iterable = client.listFeaturesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFeatures.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFeatures.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFeatures with error', async () => { + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFeatures.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFeaturesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkehub.v1alpha.IFeature[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFeatures.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFeatures.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('feature', () => { + const fakePath = "/rendered/path/feature"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + feature: "featureValue", + }; + const client = new gkehubModule.v1alpha.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.featurePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.featurePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('featurePath', () => { + const result = client.featurePath("projectValue", "locationValue", "featureValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.featurePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFeatureName', () => { + const result = client.matchProjectFromFeatureName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.featurePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFeatureName', () => { + const result = client.matchLocationFromFeatureName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.featurePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFeatureFromFeatureName', () => { + const result = client.matchFeatureFromFeatureName(fakePath); + assert.strictEqual(result, "featureValue"); + assert((client.pathTemplates.featurePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/tsconfig.json b/owl-bot-staging/google-cloud-gkehub/v1alpha/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/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-gkehub/v1alpha/webpack.config.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/webpack.config.js new file mode 100644 index 00000000000..71afa3a607d --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha/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: 'GkeHub', + filename: './gke-hub.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-gkehub/v1alpha2/.eslintignore b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/.eslintrc.json b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/.gitignore b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.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-gkehub/v1alpha2/.jsdoc.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.jsdoc.js new file mode 100644 index 00000000000..b83282dcebb --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.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/gke-hub', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/.mocharc.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.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-gkehub/v1alpha2/.prettierrc.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.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-gkehub/v1alpha2/README.md b/owl-bot-staging/google-cloud-gkehub/v1alpha2/README.md new file mode 100644 index 00000000000..f922950c787 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/README.md @@ -0,0 +1 @@ +Gkehub: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/package.json b/owl-bot-staging/google-cloud-gkehub/v1alpha2/package.json new file mode 100644 index 00000000000..25f7a0fc625 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/gke-hub", + "version": "0.1.0", + "description": "Gkehub client for Node.js", + "repository": "googleapis/nodejs-gkehub", + "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 gkehub", + "gkehub", + "gke hub" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/protos/google/cloud/gkehub/v1alpha2/membership.proto b/owl-bot-staging/google-cloud-gkehub/v1alpha2/protos/google/cloud/gkehub/v1alpha2/membership.proto new file mode 100644 index 00000000000..1256ae45e8f --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/protos/google/cloud/gkehub/v1alpha2/membership.proto @@ -0,0 +1,713 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.gkehub.v1alpha2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeHub.V1Alpha2"; +option go_package = "cloud.google.com/go/gkehub/apiv1alpha2/gkehubpb;gkehubpb"; +option java_multiple_files = true; +option java_outer_classname = "MembershipProto"; +option java_package = "com.google.cloud.gkehub.v1alpha2"; +option php_namespace = "Google\\Cloud\\GkeHub\\V1alpha2"; +option ruby_package = "Google::Cloud::GkeHub::V1alpha2"; + +// The GKE Hub service handles the registration of many Kubernetes +// clusters to Google Cloud, represented with the [Membership][google.cloud.gkehub.v1alpha2.Membership] resource. +// +// GKE Hub is currently only available in the global region. +// +// **Membership management may be non-trivial:** it is recommended to use one +// of the Google-provided client libraries or tools where possible when working +// with Membership resources. +service GkeHub { + option (google.api.default_host) = "gkehub.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists Memberships in a given project and location. + rpc ListMemberships(ListMembershipsRequest) returns (ListMembershipsResponse) { + option (google.api.http) = { + get: "/v1alpha2/{parent=projects/*/locations/*}/memberships" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a Membership. + rpc GetMembership(GetMembershipRequest) returns (Membership) { + option (google.api.http) = { + get: "/v1alpha2/{name=projects/*/locations/*/memberships/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new Membership. + // + // **This is currently only supported for GKE clusters on Google Cloud**. + // To register other clusters, follow the instructions at + // https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster. + rpc CreateMembership(CreateMembershipRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha2/{parent=projects/*/locations/*}/memberships" + body: "resource" + }; + option (google.api.method_signature) = "parent,resource,membership_id"; + option (google.longrunning.operation_info) = { + response_type: "Membership" + metadata_type: "OperationMetadata" + }; + } + + // Removes a Membership. + // + // **This is currently only supported for GKE clusters on Google Cloud**. + // To unregister other clusters, follow the instructions at + // https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. + rpc DeleteMembership(DeleteMembershipRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1alpha2/{name=projects/*/locations/*/memberships/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Updates an existing Membership. + rpc UpdateMembership(UpdateMembershipRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1alpha2/{name=projects/*/locations/*/memberships/*}" + body: "resource" + }; + option (google.api.method_signature) = "name,resource,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Membership" + metadata_type: "OperationMetadata" + }; + } + + // Generates the manifest for deployment of the GKE connect agent. + // + // **This method is used internally by Google-provided libraries.** + // Most clients should not need to call this method directly. + rpc GenerateConnectManifest(GenerateConnectManifestRequest) returns (GenerateConnectManifestResponse) { + option (google.api.http) = { + get: "/v1alpha2/{name=projects/*/locations/*/memberships/*}:generateConnectManifest" + }; + } + + // Initializes the Hub in this project, which includes creating the default + // Hub Service Account and the Hub Workload Identity Pool. Initialization is + // optional, and happens automatically when the first Membership is created. + // + // InitializeHub should be called when the first Membership cannot be + // registered without these resources. A common example is granting the Hub + // Service Account access to another project, which requires the account to + // exist first. + rpc InitializeHub(InitializeHubRequest) returns (InitializeHubResponse) { + option (google.api.http) = { + post: "/v1alpha2/{project=projects/*/locations/global/memberships}:initializeHub" + body: "*" + }; + } +} + +// Membership contains information about a member cluster. +message Membership { + option (google.api.resource) = { + type: "gkehub.googleapis.com/Membership" + pattern: "projects/{project}/locations/{location}/memberships/{membership}" + }; + + // Specifies the infrastructure type of a Membership. Infrastructure type is + // used by Hub to control infrastructure-specific behavior, including pricing. + // + // Each GKE distribution (on-GCP, on-Prem, on-X,...) will set this field + // automatically, but Attached Clusters customers should specify a type + // during registration. + enum InfrastructureType { + // No type was specified. Some Hub functionality may require a type be + // specified, and will not support Memberships with this value. + INFRASTRUCTURE_TYPE_UNSPECIFIED = 0; + + // Private infrastructure that is owned or operated by customer. This + // includes GKE distributions such as GKE-OnPrem and GKE-OnBareMetal. + ON_PREM = 1; + + // Public cloud infrastructure. + MULTI_CLOUD = 2; + } + + // Output only. The full, unique name of this Membership resource in the format + // `projects/*/locations/*/memberships/{membership_id}`, set during creation. + // + // `membership_id` must be a valid RFC 1123 compliant DNS label: + // + // 1. At most 63 characters in length + // 2. It must consist of lower case alphanumeric characters or `-` + // 3. It must start and end with an alphanumeric character + // + // Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, + // with a maximum length of 63 characters. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. GCP labels for this membership. + map labels = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Description of this membership, limited to 63 characters. + // Must match the regex: `[a-zA-Z0-9][a-zA-Z0-9_\-\.\ ]*` + // + // This field is present for legacy purposes. + string description = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Type of resource represented by this Membership + oneof type { + // Optional. Endpoint information to reach this member. + MembershipEndpoint endpoint = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // Output only. State of the Membership resource. + MembershipState state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the Membership was created. + google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the Membership was last updated. + google.protobuf.Timestamp update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the Membership was deleted. + google.protobuf.Timestamp delete_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. An externally-generated and managed ID for this Membership. This ID may + // be modified after creation, but this is not recommended. For GKE clusters, + // external_id is managed by the Hub API and updates will be ignored. + // + // The ID must match the regex: `[a-zA-Z0-9][a-zA-Z0-9_\-\.]*` + // + // If this Membership represents a Kubernetes cluster, this value should be + // set to the UID of the `kube-system` namespace object. + string external_id = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. How to identify workloads from this Membership. + // See the documentation on Workload Identity for more details: + // https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity + Authority authority = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. For clusters using Connect, the timestamp of the most recent connection + // established with Google Cloud. This time is updated every several minutes, + // not continuously. For clusters that do not use GKE Connect, or that have + // never connected successfully, this field will be unset. + google.protobuf.Timestamp last_connection_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Google-generated UUID for this resource. This is unique across all + // Membership resources. If a Membership resource is deleted and another + // resource with the same name is created, it gets a different unique_id. + string unique_id = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The infrastructure type this Membership is running on. + InfrastructureType infrastructure_type = 13 [(google.api.field_behavior) = OPTIONAL]; +} + +// MembershipEndpoint contains information needed to contact a Kubernetes API, +// endpoint and any additional Kubernetes metadata. +message MembershipEndpoint { + // Cluster information of the registered cluster. + oneof type { + // Optional. Specific information for a GKE-on-GCP cluster. + GkeCluster gke_cluster = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specific information for a GKE On-Prem cluster. + OnPremCluster on_prem_cluster = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specific information for a GKE Multi-Cloud cluster. + MultiCloudCluster multi_cloud_cluster = 5 [(google.api.field_behavior) = OPTIONAL]; + } + + // Output only. Useful Kubernetes-specific metadata. + KubernetesMetadata kubernetes_metadata = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The in-cluster Kubernetes Resources that should be applied for a correctly + // registered cluster, in the steady state. These resources: + // + // * Ensure that the cluster is exclusively registered to one and only one + // Hub Membership. + // * Propagate Workload Pool Information available in the Membership + // Authority field. + // * Ensure proper initial configuration of default Hub Features. + KubernetesResource kubernetes_resource = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// KubernetesResource contains the YAML manifests and configuration for +// Membership Kubernetes resources in the cluster. After CreateMembership or +// UpdateMembership, these resources should be re-applied in the cluster. +message KubernetesResource { + // Input only. The YAML representation of the Membership CR. This field is ignored for GKE + // clusters where Hub can read the CR directly. + // + // Callers should provide the CR that is currently present in the cluster + // during Create or Update, or leave this field empty if none exists. The CR + // manifest is used to validate the cluster has not been registered with + // another Membership. + string membership_cr_manifest = 1 [(google.api.field_behavior) = INPUT_ONLY]; + + // Output only. Additional Kubernetes resources that need to be applied to the cluster + // after Membership creation, and after every update. + // + // This field is only populated in the Membership returned from a successful + // long-running operation from CreateMembership or UpdateMembership. It is not + // populated during normal GetMembership or ListMemberships requests. To get + // the resource manifest after the initial registration, the caller should + // make a UpdateMembership call with an empty field mask. + repeated ResourceManifest membership_resources = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Kubernetes resources for installing the GKE Connect agent. + // + // This field is only populated in the Membership returned from a successful + // long-running operation from CreateMembership or UpdateMembership. It is not + // populated during normal GetMembership or ListMemberships requests. To get + // the resource manifest after the initial registration, the caller should + // make a UpdateMembership call with an empty field mask. + repeated ResourceManifest connect_resources = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Options for Kubernetes resource generation. + ResourceOptions resource_options = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// ResourceOptions represent options for Kubernetes resource generation. +message ResourceOptions { + // Optional. The Connect agent version to use for connect_resources. Defaults to the + // latest GKE Connect version. The version must be a currently supported + // version, obsolete versions will be rejected. + string connect_version = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Use `apiextensions/v1beta1` instead of `apiextensions/v1` for + // CustomResourceDefinition resources. + // This option should be set for clusters with Kubernetes apiserver versions + // <1.16. + bool v1beta1_crd = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Major version of the Kubernetes cluster. This is only used to determine + // which version to use for the CustomResourceDefinition resources, + // `apiextensions/v1beta1` or`apiextensions/v1`. + string k8s_version = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// GkeCluster contains information specific to GKE clusters. +message GkeCluster { + // Immutable. Self-link of the GCP resource for the GKE cluster. For example: + // + // //container.googleapis.com/projects/my-project/locations/us-west1-a/clusters/my-cluster + // + // Zonal clusters are also supported. + string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. If cluster_missing is set then it denotes that the GKE cluster no longer + // exists in the GKE Control Plane. + bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// OnPremCluster contains information specific to GKE On-Prem clusters. +message OnPremCluster { + // Immutable. Self-link of the GCP resource for the GKE On-Prem cluster. For example: + // + // //gkeonprem.googleapis.com/projects/my-project/locations/us-west1-a/vmwareClusters/my-cluster + // //gkeonprem.googleapis.com/projects/my-project/locations/us-west1-a/bareMetalClusters/my-cluster + string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. If cluster_missing is set then it denotes that + // API(gkeonprem.googleapis.com) resource for this GKE On-Prem cluster no + // longer exists. + bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. Whether the cluster is an admin cluster. + bool admin_cluster = 3 [(google.api.field_behavior) = IMMUTABLE]; +} + +// MultiCloudCluster contains information specific to GKE Multi-Cloud clusters. +message MultiCloudCluster { + // Immutable. Self-link of the GCP resource for the GKE Multi-Cloud cluster. For + // example: + // + // //gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/awsClusters/my-cluster + // //gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/azureClusters/my-cluster + string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. If cluster_missing is set then it denotes that + // API(gkemulticloud.googleapis.com) resource for this GKE Multi-Cloud cluster + // no longer exists. + bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// KubernetesMetadata provides informational metadata for Memberships +// that are created from Kubernetes Endpoints (currently, these are equivalent +// to Kubernetes clusters). +message KubernetesMetadata { + // Output only. Kubernetes API server version string as reported by '/version'. + string kubernetes_api_server_version = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Node providerID as reported by the first node in the list of nodes on + // the Kubernetes endpoint. On Kubernetes platforms that support zero-node + // clusters (like GKE-on-GCP), the node_count will be zero and the + // node_provider_id will be empty. + string node_provider_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Node count as reported by Kubernetes nodes resources. + int32 node_count = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. vCPU count as reported by Kubernetes nodes resources. + int32 vcpu_count = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The total memory capacity as reported by the sum of all Kubernetes nodes + // resources, defined in MB. + int32 memory_mb = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which these details were last updated. This update_time is + // different from the Membership-level update_time since EndpointDetails are + // updated internally for API consumers. + google.protobuf.Timestamp update_time = 100 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Authority encodes how Google will recognize identities from this Membership. +// See the workload identity documentation for more details: +// https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity +message Authority { + // Optional. A JSON Web Token (JWT) issuer URI. `issuer` must start with `https://` and + // be a valid URL with length <2000 characters. + // + // If set, then Google will allow valid OIDC tokens from this issuer to + // authenticate within the workload_identity_pool. OIDC discovery will be + // performed on this URI to validate tokens from the issuer, unless + // `oidc_jwks` is set. + // + // Clearing `issuer` disables Workload Identity. `issuer` cannot be directly + // modified; it must be cleared (and Workload Identity disabled) before using + // a new issuer (and re-enabling Workload Identity). + string issuer = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. OIDC verification keys for this Membership in JWKS format (RFC 7517). + // + // When this field is set, OIDC discovery will NOT be performed on `issuer`, + // and instead OIDC tokens will be validated using this field. + bytes oidc_jwks = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. An identity provider that reflects the `issuer` in the workload identity + // pool. + string identity_provider = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The name of the workload identity pool in which `issuer` will be + // recognized. + // + // There is a single Workload Identity Pool per Hub that is shared + // between all Memberships that belong to that Hub. For a Hub hosted in + // {PROJECT_ID}, the workload pool format is `{PROJECT_ID}.hub.id.goog`, + // although this is subject to change in newer versions of this API. + string workload_identity_pool = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// MembershipState describes the state of a Membership resource. +message MembershipState { + // Code describes the state of a Membership resource. + enum Code { + // The code is not set. + CODE_UNSPECIFIED = 0; + + // The cluster is being registered. + CREATING = 1; + + // The cluster is registered. + READY = 2; + + // The cluster is being unregistered. + DELETING = 3; + + // The Membership is being updated. + UPDATING = 4; + + // The Membership is being updated by the Hub Service. + SERVICE_UPDATING = 5; + } + + // Output only. The current state of the Membership resource. + Code code = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for `GkeHub.ListMemberships` method. +message ListMembershipsRequest { + // Required. The parent (project and location) where the Memberships will be listed. + // Specified in the format `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkehub.googleapis.com/Membership" + } + ]; + + // Optional. When requesting a 'page' of resources, `page_size` specifies number of + // resources to return. If unspecified or set to 0, all resources will + // be returned. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Token returned by previous call to `ListMemberships` which + // specifies the position in the list from where to continue listing the + // resources. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Lists Memberships that match the filter expression, following the syntax + // outlined in https://google.aip.dev/160. + // + // Examples: + // + // - Name is `bar` in project `foo-proj` and location `global`: + // + // name = "projects/foo-proj/locations/global/membership/bar" + // + // - Memberships that have a label called `foo`: + // + // labels.foo:* + // + // - Memberships that have a label called `foo` whose value is `bar`: + // + // labels.foo = bar + // + // - Memberships in the CREATING state: + // + // state = CREATING + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. One or more fields to compare and use to sort the output. + // See https://google.aip.dev/132#ordering. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for the `GkeHub.ListMemberships` method. +message ListMembershipsResponse { + // The list of matching Memberships. + repeated Membership resources = 1; + + // A token to request the next page of resources from the + // `ListMemberships` method. The value of an empty string means that + // there are no more resources to return. + string next_page_token = 2; + + // List of locations that could not be reached while fetching this list. + repeated string unreachable = 3; +} + +// Request message for `GkeHub.GetMembership` method. +message GetMembershipRequest { + // Required. The Membership resource name in the format + // `projects/*/locations/*/memberships/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkehub.googleapis.com/Membership" + } + ]; +} + +// Request message for the `GkeHub.CreateMembership` method. +message CreateMembershipRequest { + // Required. The parent (project and location) where the Memberships will be created. + // Specified in the format `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkehub.googleapis.com/Membership" + } + ]; + + // Required. Client chosen ID for the membership. `membership_id` must be a valid RFC + // 1123 compliant DNS label: + // + // 1. At most 63 characters in length + // 2. It must consist of lower case alphanumeric characters or `-` + // 3. It must start and end with an alphanumeric character + // + // Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, + // with a maximum length of 63 characters. + string membership_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The membership to create. + Membership resource = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `GkeHub.DeleteMembership` method. +message DeleteMembershipRequest { + // Required. The Membership resource name in the format + // `projects/*/locations/*/memberships/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkehub.googleapis.com/Membership" + } + ]; +} + +// Request message for `GkeHub.UpdateMembership` method. +message UpdateMembershipRequest { + // Required. The Membership resource name in the format + // `projects/*/locations/*/memberships/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED]; + + // Required. Mask of fields to update. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Only fields specified in update_mask are updated. + // If you specify a field in the update_mask but don't specify its value here + // that field will be deleted. + // If you are updating a map field, set the value of a key to null or empty + // string to delete the key from the map. It's not possible to update a key's + // value to the empty string. + // If you specify the update_mask to be a special path "*", fully replaces all + // user-modifiable fields to match `resource`. + Membership resource = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `GkeHub.GenerateConnectManifest` +// method. +// . +message GenerateConnectManifestRequest { + // Required. The Membership resource name the Agent will associate with, in the format + // `projects/*/locations/*/memberships/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED]; + + // Optional. Namespace for GKE Connect agent resources. Defaults to `gke-connect`. + // + // The Connect Agent is authorized automatically when run in the default + // namespace. Otherwise, explicit authorization must be granted with an + // additional IAM binding. + string namespace = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. URI of a proxy if connectivity from the agent to gkeconnect.googleapis.com + // requires the use of a proxy. Format must be in the form + // `http(s)://{proxy_address}`, depending on the HTTP/HTTPS protocol + // supported by the proxy. This will direct the connect agent's outbound + // traffic through a HTTP(S) proxy. + bytes proxy = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Connect agent version to use. Defaults to the most current version. + string version = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, generate the resources for upgrade only. Some resources + // generated only for installation (e.g. secrets) will be excluded. + bool is_upgrade = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The registry to fetch the connect agent image from. Defaults to + // gcr.io/gkeconnect. + string registry = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The image pull secret content for the registry, if not public. + bytes image_pull_secret_content = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// GenerateConnectManifestResponse contains manifest information for +// installing/upgrading a Connect agent. +message GenerateConnectManifestResponse { + // The ordered list of Kubernetes resources that need to be applied to the + // cluster for GKE Connect agent installation/upgrade. + repeated ConnectAgentResource manifest = 1; +} + +// ConnectAgentResource represents a Kubernetes resource manifest for Connect +// Agent deployment. +message ConnectAgentResource { + // Kubernetes type of the resource. + TypeMeta type = 1; + + // YAML manifest of the resource. + string manifest = 2; +} + +// ResourceManifest represents a single Kubernetes resource to be applied to +// the cluster. +message ResourceManifest { + // YAML manifest of the resource. + string manifest = 1; + + // Whether the resource provided in the manifest is `cluster_scoped`. + // If unset, the manifest is assumed to be namespace scoped. + // + // This field is used for REST mapping when applying the resource in a + // cluster. + bool cluster_scoped = 2; +} + +// TypeMeta is the type information needed for content unmarshalling of +// Kubernetes resources in the manifest. +message TypeMeta { + // Kind of the resource (e.g. Deployment). + string kind = 1; + + // APIVersion of the resource (e.g. v1). + string api_version = 2; +} + +// Request message for the InitializeHub method. +message InitializeHubRequest { + // Required. The Hub to initialize, in the format + // `projects/*/locations/*/memberships/*`. + string project = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for the InitializeHub method. +message InitializeHubResponse { + // Name of the Hub default service identity, in the format: + // + // service-@gcp-sa-gkehub.iam.gserviceaccount.com + // + // The service account has `roles/gkehub.serviceAgent` in the Hub project. + string service_identity = 1; + + // The Workload Identity Pool used for Workload Identity-enabled clusters + // registered with this Hub. Format: `.hub.id.goog` + string workload_identity_pool = 2; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_detail = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.create_membership.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.create_membership.js new file mode 100644 index 00000000000..b377d1c1c2a --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.create_membership.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, membershipId, resource) { + // [START gkehub_v1alpha2_generated_GkeHub_CreateMembership_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 parent (project and location) where the Memberships will be created. + * Specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Required. Client chosen ID for the membership. `membership_id` must be a valid RFC + * 1123 compliant DNS label: + * 1. At most 63 characters in length + * 2. It must consist of lower case alphanumeric characters or `-` + * 3. It must start and end with an alphanumeric character + * Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, + * with a maximum length of 63 characters. + */ + // const membershipId = 'abc123' + /** + * Required. The membership to create. + */ + // const resource = {} + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha2; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callCreateMembership() { + // Construct request + const request = { + parent, + membershipId, + resource, + }; + + // Run request + const [operation] = await gkehubClient.createMembership(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateMembership(); + // [END gkehub_v1alpha2_generated_GkeHub_CreateMembership_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-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.delete_membership.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.delete_membership.js new file mode 100644 index 00000000000..f432295dd1c --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.delete_membership.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 gkehub_v1alpha2_generated_GkeHub_DeleteMembership_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 Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + */ + // const name = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha2; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callDeleteMembership() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gkehubClient.deleteMembership(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteMembership(); + // [END gkehub_v1alpha2_generated_GkeHub_DeleteMembership_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-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.generate_connect_manifest.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.generate_connect_manifest.js new file mode 100644 index 00000000000..302d3ab69f5 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.generate_connect_manifest.js @@ -0,0 +1,95 @@ +// 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 gkehub_v1alpha2_generated_GkeHub_GenerateConnectManifest_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 Membership resource name the Agent will associate with, in the format + * `projects/* /locations/* /memberships/*`. + */ + // const name = 'abc123' + /** + * Optional. Namespace for GKE Connect agent resources. Defaults to `gke-connect`. + * The Connect Agent is authorized automatically when run in the default + * namespace. Otherwise, explicit authorization must be granted with an + * additional IAM binding. + */ + // const namespace = 'abc123' + /** + * Optional. URI of a proxy if connectivity from the agent to gkeconnect.googleapis.com + * requires the use of a proxy. Format must be in the form + * `http(s)://{proxy_address}`, depending on the HTTP/HTTPS protocol + * supported by the proxy. This will direct the connect agent's outbound + * traffic through a HTTP(S) proxy. + */ + // const proxy = Buffer.from('string') + /** + * Optional. The Connect agent version to use. Defaults to the most current version. + */ + // const version = 'abc123' + /** + * Optional. If true, generate the resources for upgrade only. Some resources + * generated only for installation (e.g. secrets) will be excluded. + */ + // const isUpgrade = true + /** + * Optional. The registry to fetch the connect agent image from. Defaults to + * gcr.io/gkeconnect. + */ + // const registry = 'abc123' + /** + * Optional. The image pull secret content for the registry, if not public. + */ + // const imagePullSecretContent = Buffer.from('string') + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha2; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callGenerateConnectManifest() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkehubClient.generateConnectManifest(request); + console.log(response); + } + + callGenerateConnectManifest(); + // [END gkehub_v1alpha2_generated_GkeHub_GenerateConnectManifest_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-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.get_membership.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.get_membership.js new file mode 100644 index 00000000000..309d05ae5cf --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.get_membership.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 gkehub_v1alpha2_generated_GkeHub_GetMembership_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 Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + */ + // const name = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha2; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callGetMembership() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkehubClient.getMembership(request); + console.log(response); + } + + callGetMembership(); + // [END gkehub_v1alpha2_generated_GkeHub_GetMembership_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-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.initialize_hub.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.initialize_hub.js new file mode 100644 index 00000000000..dc7bd56a719 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.initialize_hub.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(project) { + // [START gkehub_v1alpha2_generated_GkeHub_InitializeHub_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 Hub to initialize, in the format + * `projects/* /locations/* /memberships/*`. + */ + // const project = 'my-project' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha2; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callInitializeHub() { + // Construct request + const request = { + project, + }; + + // Run request + const response = await gkehubClient.initializeHub(request); + console.log(response); + } + + callInitializeHub(); + // [END gkehub_v1alpha2_generated_GkeHub_InitializeHub_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-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.list_memberships.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.list_memberships.js new file mode 100644 index 00000000000..d646b42d9c6 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.list_memberships.js @@ -0,0 +1,95 @@ +// 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 gkehub_v1alpha2_generated_GkeHub_ListMemberships_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 parent (project and location) where the Memberships will be listed. + * Specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Optional. When requesting a 'page' of resources, `page_size` specifies number of + * resources to return. If unspecified or set to 0, all resources will + * be returned. + */ + // const pageSize = 1234 + /** + * Optional. Token returned by previous call to `ListMemberships` which + * specifies the position in the list from where to continue listing the + * resources. + */ + // const pageToken = 'abc123' + /** + * Optional. Lists Memberships that match the filter expression, following the syntax + * outlined in https://google.aip.dev/160. + * Examples: + * - Name is `bar` in project `foo-proj` and location `global`: + * name = "projects/foo-proj/locations/global/membership/bar" + * - Memberships that have a label called `foo`: + * labels.foo:* + * - Memberships that have a label called `foo` whose value is `bar`: + * labels.foo = bar + * - Memberships in the CREATING state: + * state = CREATING + */ + // const filter = 'abc123' + /** + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha2; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callListMemberships() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gkehubClient.listMembershipsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMemberships(); + // [END gkehub_v1alpha2_generated_GkeHub_ListMemberships_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-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.update_membership.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.update_membership.js new file mode 100644 index 00000000000..eb11d2ef91e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.update_membership.js @@ -0,0 +1,80 @@ +// 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, updateMask, resource) { + // [START gkehub_v1alpha2_generated_GkeHub_UpdateMembership_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 Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + */ + // const name = 'abc123' + /** + * Required. Mask of fields to update. + */ + // const updateMask = {} + /** + * Required. Only fields specified in update_mask are updated. + * If you specify a field in the update_mask but don't specify its value here + * that field will be deleted. + * If you are updating a map field, set the value of a key to null or empty + * string to delete the key from the map. It's not possible to update a key's + * value to the empty string. + * If you specify the update_mask to be a special path "*", fully replaces all + * user-modifiable fields to match `resource`. + */ + // const resource = {} + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha2; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callUpdateMembership() { + // Construct request + const request = { + name, + updateMask, + resource, + }; + + // Run request + const [operation] = await gkehubClient.updateMembership(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateMembership(); + // [END gkehub_v1alpha2_generated_GkeHub_UpdateMembership_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-gkehub/v1alpha2/samples/generated/v1alpha2/snippet_metadata_google.cloud.gkehub.v1alpha2.json b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/snippet_metadata_google.cloud.gkehub.v1alpha2.json new file mode 100644 index 00000000000..005ba9fbf95 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/snippet_metadata_google.cloud.gkehub.v1alpha2.json @@ -0,0 +1,351 @@ +{ + "clientLibrary": { + "name": "nodejs-gkehub", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.gkehub.v1alpha2", + "version": "v1alpha2" + } + ] + }, + "snippets": [ + { + "regionTag": "gkehub_v1alpha2_generated_GkeHub_ListMemberships_async", + "title": "GkeHub listMemberships Sample", + "origin": "API_DEFINITION", + "description": " Lists Memberships in a given project and location.", + "canonical": true, + "file": "gke_hub.list_memberships.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMemberships", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.ListMemberships", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkehub.v1alpha2.ListMembershipsResponse", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHubClient" + }, + "method": { + "shortName": "ListMemberships", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.ListMemberships", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1alpha2_generated_GkeHub_GetMembership_async", + "title": "GkeHub getMembership Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a Membership.", + "canonical": true, + "file": "gke_hub.get_membership.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetMembership", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.GetMembership", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkehub.v1alpha2.Membership", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHubClient" + }, + "method": { + "shortName": "GetMembership", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.GetMembership", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1alpha2_generated_GkeHub_CreateMembership_async", + "title": "GkeHub createMembership Sample", + "origin": "API_DEFINITION", + "description": " Creates a new Membership. **This is currently only supported for GKE clusters on Google Cloud**. To register other clusters, follow the instructions at https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster.", + "canonical": true, + "file": "gke_hub.create_membership.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateMembership", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.CreateMembership", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "membership_id", + "type": "TYPE_STRING" + }, + { + "name": "resource", + "type": ".google.cloud.gkehub.v1alpha2.Membership" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHubClient" + }, + "method": { + "shortName": "CreateMembership", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.CreateMembership", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1alpha2_generated_GkeHub_DeleteMembership_async", + "title": "GkeHub deleteMembership Sample", + "origin": "API_DEFINITION", + "description": " Removes a Membership. **This is currently only supported for GKE clusters on Google Cloud**. To unregister other clusters, follow the instructions at https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster.", + "canonical": true, + "file": "gke_hub.delete_membership.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteMembership", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.DeleteMembership", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHubClient" + }, + "method": { + "shortName": "DeleteMembership", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.DeleteMembership", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1alpha2_generated_GkeHub_UpdateMembership_async", + "title": "GkeHub updateMembership Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing Membership.", + "canonical": true, + "file": "gke_hub.update_membership.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateMembership", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.UpdateMembership", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "resource", + "type": ".google.cloud.gkehub.v1alpha2.Membership" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHubClient" + }, + "method": { + "shortName": "UpdateMembership", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.UpdateMembership", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1alpha2_generated_GkeHub_GenerateConnectManifest_async", + "title": "GkeHub generateConnectManifest Sample", + "origin": "API_DEFINITION", + "description": " Generates the manifest for deployment of the GKE connect agent. **This method is used internally by Google-provided libraries.** Most clients should not need to call this method directly.", + "canonical": true, + "file": "gke_hub.generate_connect_manifest.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateConnectManifest", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.GenerateConnectManifest", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "namespace", + "type": "TYPE_STRING" + }, + { + "name": "proxy", + "type": "TYPE_BYTES" + }, + { + "name": "version", + "type": "TYPE_STRING" + }, + { + "name": "is_upgrade", + "type": "TYPE_BOOL" + }, + { + "name": "registry", + "type": "TYPE_STRING" + }, + { + "name": "image_pull_secret_content", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.gkehub.v1alpha2.GenerateConnectManifestResponse", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHubClient" + }, + "method": { + "shortName": "GenerateConnectManifest", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.GenerateConnectManifest", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1alpha2_generated_GkeHub_InitializeHub_async", + "title": "GkeHub initializeHub Sample", + "origin": "API_DEFINITION", + "description": " Initializes the Hub in this project, which includes creating the default Hub Service Account and the Hub Workload Identity Pool. Initialization is optional, and happens automatically when the first Membership is created. InitializeHub should be called when the first Membership cannot be registered without these resources. A common example is granting the Hub Service Account access to another project, which requires the account to exist first.", + "canonical": true, + "file": "gke_hub.initialize_hub.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "InitializeHub", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.InitializeHub", + "async": true, + "parameters": [ + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkehub.v1alpha2.InitializeHubResponse", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHubClient" + }, + "method": { + "shortName": "InitializeHub", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.InitializeHub", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1alpha2.GkeHub" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/index.ts new file mode 100644 index 00000000000..5c4e8950527 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/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 v1alpha2 from './v1alpha2'; +const GkeHubClient = v1alpha2.GkeHubClient; +type GkeHubClient = v1alpha2.GkeHubClient; +export {v1alpha2, GkeHubClient}; +export default {v1alpha2, GkeHubClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gapic_metadata.json b/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gapic_metadata.json new file mode 100644 index 00000000000..9a8c3d88ba8 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gapic_metadata.json @@ -0,0 +1,97 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.gkehub.v1alpha2", + "libraryPackage": "@google-cloud/gke-hub", + "services": { + "GkeHub": { + "clients": { + "grpc": { + "libraryClient": "GkeHubClient", + "rpcs": { + "GetMembership": { + "methods": [ + "getMembership" + ] + }, + "GenerateConnectManifest": { + "methods": [ + "generateConnectManifest" + ] + }, + "InitializeHub": { + "methods": [ + "initializeHub" + ] + }, + "CreateMembership": { + "methods": [ + "createMembership" + ] + }, + "DeleteMembership": { + "methods": [ + "deleteMembership" + ] + }, + "UpdateMembership": { + "methods": [ + "updateMembership" + ] + }, + "ListMemberships": { + "methods": [ + "listMemberships", + "listMembershipsStream", + "listMembershipsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "GkeHubClient", + "rpcs": { + "GetMembership": { + "methods": [ + "getMembership" + ] + }, + "GenerateConnectManifest": { + "methods": [ + "generateConnectManifest" + ] + }, + "InitializeHub": { + "methods": [ + "initializeHub" + ] + }, + "CreateMembership": { + "methods": [ + "createMembership" + ] + }, + "DeleteMembership": { + "methods": [ + "deleteMembership" + ] + }, + "UpdateMembership": { + "methods": [ + "updateMembership" + ] + }, + "ListMemberships": { + "methods": [ + "listMemberships", + "listMembershipsStream", + "listMembershipsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_client.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_client.ts new file mode 100644 index 00000000000..b7674e073d7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_client.ts @@ -0,0 +1,1296 @@ +// 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, GrpcClientOptions, LROperation, 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/v1alpha2/gke_hub_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './gke_hub_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The GKE Hub service handles the registration of many Kubernetes + * clusters to Google Cloud, represented with the {@link protos.google.cloud.gkehub.v1alpha2.Membership|Membership} resource. + * + * GKE Hub is currently only available in the global region. + * + * **Membership management may be non-trivial:** it is recommended to use one + * of the Google-provided client libraries or tools where possible when working + * with Membership resources. + * @class + * @memberof v1alpha2 + */ +export class GkeHubClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + gkeHubStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of GkeHubClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 GkeHubClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof GkeHubClient; + 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 { + 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 = { + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + membershipPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/memberships/{membership}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // 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 = { + listMemberships: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha2/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha2/{resource=projects/*/locations/*/memberships/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha2/{resource=projects/*/locations/*/memberships/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha2/{resource=projects/*/locations/*/memberships/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha2/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha2/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha2/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha2/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createMembershipResponse = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1alpha2.Membership') as gax.protobuf.Type; + const createMembershipMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1alpha2.OperationMetadata') as gax.protobuf.Type; + const deleteMembershipResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteMembershipMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1alpha2.OperationMetadata') as gax.protobuf.Type; + const updateMembershipResponse = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1alpha2.Membership') as gax.protobuf.Type; + const updateMembershipMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1alpha2.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createMembership: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createMembershipResponse.decode.bind(createMembershipResponse), + createMembershipMetadata.decode.bind(createMembershipMetadata)), + deleteMembership: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteMembershipResponse.decode.bind(deleteMembershipResponse), + deleteMembershipMetadata.decode.bind(deleteMembershipMetadata)), + updateMembership: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateMembershipResponse.decode.bind(updateMembershipResponse), + updateMembershipMetadata.decode.bind(updateMembershipMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.gkehub.v1alpha2.GkeHub', 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.gkeHubStub) { + return this.gkeHubStub; + } + + // Put together the "service stub" for + // google.cloud.gkehub.v1alpha2.GkeHub. + this.gkeHubStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.gkehub.v1alpha2.GkeHub') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.gkehub.v1alpha2.GkeHub, + 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 gkeHubStubMethods = + ['listMemberships', 'getMembership', 'createMembership', 'deleteMembership', 'updateMembership', 'generateConnectManifest', 'initializeHub']; + for (const methodName of gkeHubStubMethods) { + const callPromise = this.gkeHubStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.gkeHubStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'gkehub.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 'gkehub.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 -- + // ------------------- +/** + * Gets the details of a Membership. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1alpha2.Membership|Membership}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha2/gke_hub.get_membership.js + * region_tag:gkehub_v1alpha2_generated_GkeHub_GetMembership_async + */ + getMembership( + request?: protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1alpha2.IMembership, + protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest|undefined, {}|undefined + ]>; + getMembership( + request: protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkehub.v1alpha2.IMembership, + protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest|null|undefined, + {}|null|undefined>): void; + getMembership( + request: protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest, + callback: Callback< + protos.google.cloud.gkehub.v1alpha2.IMembership, + protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest|null|undefined, + {}|null|undefined>): void; + getMembership( + request?: protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkehub.v1alpha2.IMembership, + protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkehub.v1alpha2.IMembership, + protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkehub.v1alpha2.IMembership, + protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest|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.getMembership(request, options, callback); + } +/** + * Generates the manifest for deployment of the GKE connect agent. + * + * **This method is used internally by Google-provided libraries.** + * Most clients should not need to call this method directly. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Membership resource name the Agent will associate with, in the format + * `projects/* /locations/* /memberships/*`. + * @param {string} [request.namespace] + * Optional. Namespace for GKE Connect agent resources. Defaults to `gke-connect`. + * + * The Connect Agent is authorized automatically when run in the default + * namespace. Otherwise, explicit authorization must be granted with an + * additional IAM binding. + * @param {Buffer} [request.proxy] + * Optional. URI of a proxy if connectivity from the agent to gkeconnect.googleapis.com + * requires the use of a proxy. Format must be in the form + * `http(s)://{proxy_address}`, depending on the HTTP/HTTPS protocol + * supported by the proxy. This will direct the connect agent's outbound + * traffic through a HTTP(S) proxy. + * @param {string} [request.version] + * Optional. The Connect agent version to use. Defaults to the most current version. + * @param {boolean} [request.isUpgrade] + * Optional. If true, generate the resources for upgrade only. Some resources + * generated only for installation (e.g. secrets) will be excluded. + * @param {string} [request.registry] + * Optional. The registry to fetch the connect agent image from. Defaults to + * gcr.io/gkeconnect. + * @param {Buffer} [request.imagePullSecretContent] + * Optional. The image pull secret content for the registry, if not public. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1alpha2.GenerateConnectManifestResponse|GenerateConnectManifestResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha2/gke_hub.generate_connect_manifest.js + * region_tag:gkehub_v1alpha2_generated_GkeHub_GenerateConnectManifest_async + */ + generateConnectManifest( + request?: protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest|undefined, {}|undefined + ]>; + generateConnectManifest( + request: protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest|null|undefined, + {}|null|undefined>): void; + generateConnectManifest( + request: protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest, + callback: Callback< + protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest|null|undefined, + {}|null|undefined>): void; + generateConnectManifest( + request?: protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest|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.generateConnectManifest(request, options, callback); + } +/** + * Initializes the Hub in this project, which includes creating the default + * Hub Service Account and the Hub Workload Identity Pool. Initialization is + * optional, and happens automatically when the first Membership is created. + * + * InitializeHub should be called when the first Membership cannot be + * registered without these resources. A common example is granting the Hub + * Service Account access to another project, which requires the account to + * exist first. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.project + * Required. The Hub to initialize, in the format + * `projects/* /locations/* /memberships/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1alpha2.InitializeHubResponse|InitializeHubResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha2/gke_hub.initialize_hub.js + * region_tag:gkehub_v1alpha2_generated_GkeHub_InitializeHub_async + */ + initializeHub( + request?: protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1alpha2.IInitializeHubResponse, + protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest|undefined, {}|undefined + ]>; + initializeHub( + request: protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkehub.v1alpha2.IInitializeHubResponse, + protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest|null|undefined, + {}|null|undefined>): void; + initializeHub( + request: protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest, + callback: Callback< + protos.google.cloud.gkehub.v1alpha2.IInitializeHubResponse, + protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest|null|undefined, + {}|null|undefined>): void; + initializeHub( + request?: protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkehub.v1alpha2.IInitializeHubResponse, + protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkehub.v1alpha2.IInitializeHubResponse, + protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkehub.v1alpha2.IInitializeHubResponse, + protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest|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({ + 'project': request.project ?? '', + }); + this.initialize(); + return this.innerApiCalls.initializeHub(request, options, callback); + } + +/** + * Creates a new Membership. + * + * **This is currently only supported for GKE clusters on Google Cloud**. + * To register other clusters, follow the instructions at + * https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) where the Memberships will be created. + * Specified in the format `projects/* /locations/*`. + * @param {string} request.membershipId + * Required. Client chosen ID for the membership. `membership_id` must be a valid RFC + * 1123 compliant DNS label: + * + * 1. At most 63 characters in length + * 2. It must consist of lower case alphanumeric characters or `-` + * 3. It must start and end with an alphanumeric character + * + * Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, + * with a maximum length of 63 characters. + * @param {google.cloud.gkehub.v1alpha2.Membership} request.resource + * Required. The membership to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha2/gke_hub.create_membership.js + * region_tag:gkehub_v1alpha2_generated_GkeHub_CreateMembership_async + */ + createMembership( + request?: protos.google.cloud.gkehub.v1alpha2.ICreateMembershipRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createMembership( + request: protos.google.cloud.gkehub.v1alpha2.ICreateMembershipRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMembership( + request: protos.google.cloud.gkehub.v1alpha2.ICreateMembershipRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMembership( + request?: protos.google.cloud.gkehub.v1alpha2.ICreateMembershipRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createMembership(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createMembership()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha2/gke_hub.create_membership.js + * region_tag:gkehub_v1alpha2_generated_GkeHub_CreateMembership_async + */ + async checkCreateMembershipProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMembership, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Removes a Membership. + * + * **This is currently only supported for GKE clusters on Google Cloud**. + * To unregister other clusters, follow the instructions at + * https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha2/gke_hub.delete_membership.js + * region_tag:gkehub_v1alpha2_generated_GkeHub_DeleteMembership_async + */ + deleteMembership( + request?: protos.google.cloud.gkehub.v1alpha2.IDeleteMembershipRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteMembership( + request: protos.google.cloud.gkehub.v1alpha2.IDeleteMembershipRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteMembership( + request: protos.google.cloud.gkehub.v1alpha2.IDeleteMembershipRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteMembership( + request?: protos.google.cloud.gkehub.v1alpha2.IDeleteMembershipRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteMembership(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteMembership()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha2/gke_hub.delete_membership.js + * region_tag:gkehub_v1alpha2_generated_GkeHub_DeleteMembership_async + */ + async checkDeleteMembershipProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteMembership, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an existing Membership. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. + * @param {google.cloud.gkehub.v1alpha2.Membership} request.resource + * Required. Only fields specified in update_mask are updated. + * If you specify a field in the update_mask but don't specify its value here + * that field will be deleted. + * If you are updating a map field, set the value of a key to null or empty + * string to delete the key from the map. It's not possible to update a key's + * value to the empty string. + * If you specify the update_mask to be a special path "*", fully replaces all + * user-modifiable fields to match `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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha2/gke_hub.update_membership.js + * region_tag:gkehub_v1alpha2_generated_GkeHub_UpdateMembership_async + */ + updateMembership( + request?: protos.google.cloud.gkehub.v1alpha2.IUpdateMembershipRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateMembership( + request: protos.google.cloud.gkehub.v1alpha2.IUpdateMembershipRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMembership( + request: protos.google.cloud.gkehub.v1alpha2.IUpdateMembershipRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMembership( + request?: protos.google.cloud.gkehub.v1alpha2.IUpdateMembershipRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateMembership(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateMembership()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha2/gke_hub.update_membership.js + * region_tag:gkehub_v1alpha2_generated_GkeHub_UpdateMembership_async + */ + async checkUpdateMembershipProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMembership, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists Memberships in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) where the Memberships will be listed. + * Specified in the format `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. When requesting a 'page' of resources, `page_size` specifies number of + * resources to return. If unspecified or set to 0, all resources will + * be returned. + * @param {string} [request.pageToken] + * Optional. Token returned by previous call to `ListMemberships` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} [request.filter] + * Optional. Lists Memberships that match the filter expression, following the syntax + * outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Name is `bar` in project `foo-proj` and location `global`: + * + * name = "projects/foo-proj/locations/global/membership/bar" + * + * - Memberships that have a label called `foo`: + * + * labels.foo:* + * + * - Memberships that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * + * - Memberships in the CREATING state: + * + * state = CREATING + * @param {string} [request.orderBy] + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1alpha2.Membership|Membership}. + * 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 `listMembershipsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMemberships( + request?: protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1alpha2.IMembership[], + protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest|null, + protos.google.cloud.gkehub.v1alpha2.IListMembershipsResponse + ]>; + listMemberships( + request: protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, + protos.google.cloud.gkehub.v1alpha2.IListMembershipsResponse|null|undefined, + protos.google.cloud.gkehub.v1alpha2.IMembership>): void; + listMemberships( + request: protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, + callback: PaginationCallback< + protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, + protos.google.cloud.gkehub.v1alpha2.IListMembershipsResponse|null|undefined, + protos.google.cloud.gkehub.v1alpha2.IMembership>): void; + listMemberships( + request?: protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, + protos.google.cloud.gkehub.v1alpha2.IListMembershipsResponse|null|undefined, + protos.google.cloud.gkehub.v1alpha2.IMembership>, + callback?: PaginationCallback< + protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, + protos.google.cloud.gkehub.v1alpha2.IListMembershipsResponse|null|undefined, + protos.google.cloud.gkehub.v1alpha2.IMembership>): + Promise<[ + protos.google.cloud.gkehub.v1alpha2.IMembership[], + protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest|null, + protos.google.cloud.gkehub.v1alpha2.IListMembershipsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listMemberships(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) where the Memberships will be listed. + * Specified in the format `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. When requesting a 'page' of resources, `page_size` specifies number of + * resources to return. If unspecified or set to 0, all resources will + * be returned. + * @param {string} [request.pageToken] + * Optional. Token returned by previous call to `ListMemberships` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} [request.filter] + * Optional. Lists Memberships that match the filter expression, following the syntax + * outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Name is `bar` in project `foo-proj` and location `global`: + * + * name = "projects/foo-proj/locations/global/membership/bar" + * + * - Memberships that have a label called `foo`: + * + * labels.foo:* + * + * - Memberships that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * + * - Memberships in the CREATING state: + * + * state = CREATING + * @param {string} [request.orderBy] + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 protos.google.cloud.gkehub.v1alpha2.Membership|Membership} 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 `listMembershipsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMembershipsStream( + request?: protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, + 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['listMemberships']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMemberships.createStream( + this.innerApiCalls.listMemberships as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMemberships`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) where the Memberships will be listed. + * Specified in the format `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. When requesting a 'page' of resources, `page_size` specifies number of + * resources to return. If unspecified or set to 0, all resources will + * be returned. + * @param {string} [request.pageToken] + * Optional. Token returned by previous call to `ListMemberships` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} [request.filter] + * Optional. Lists Memberships that match the filter expression, following the syntax + * outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Name is `bar` in project `foo-proj` and location `global`: + * + * name = "projects/foo-proj/locations/global/membership/bar" + * + * - Memberships that have a label called `foo`: + * + * labels.foo:* + * + * - Memberships that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * + * - Memberships in the CREATING state: + * + * state = CREATING + * @param {string} [request.orderBy] + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkehub.v1alpha2.Membership|Membership}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha2/gke_hub.list_memberships.js + * region_tag:gkehub_v1alpha2_generated_GkeHub_ListMemberships_async + */ + listMembershipsAsync( + request?: protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, + 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['listMemberships']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMemberships.asyncIterate( + this.innerApiCalls['listMemberships'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified membership resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} membership + * @returns {string} Resource name string. + */ + membershipPath(project:string,location:string,membership:string) { + return this.pathTemplates.membershipPathTemplate.render({ + project: project, + location: location, + membership: membership, + }); + } + + /** + * Parse the project from Membership resource. + * + * @param {string} membershipName + * A fully-qualified path representing Membership resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMembershipName(membershipName: string) { + return this.pathTemplates.membershipPathTemplate.match(membershipName).project; + } + + /** + * Parse the location from Membership resource. + * + * @param {string} membershipName + * A fully-qualified path representing Membership resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMembershipName(membershipName: string) { + return this.pathTemplates.membershipPathTemplate.match(membershipName).location; + } + + /** + * Parse the membership from Membership resource. + * + * @param {string} membershipName + * A fully-qualified path representing Membership resource. + * @returns {string} A string representing the membership. + */ + matchMembershipFromMembershipName(membershipName: string) { + return this.pathTemplates.membershipPathTemplate.match(membershipName).membership; + } + + /** + * 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; + } + + /** + * 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.gkeHubStub && !this._terminated) { + return this.gkeHubStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_client_config.json b/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_client_config.json new file mode 100644 index 00000000000..67d4326393f --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_client_config.json @@ -0,0 +1,73 @@ +{ + "interfaces": { + "google.cloud.gkehub.v1alpha2.GkeHub": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListMemberships": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetMembership": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateMembership": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteMembership": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdateMembership": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GenerateConnectManifest": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "InitializeHub": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_proto_list.json b/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_proto_list.json new file mode 100644 index 00000000000..1146076265d --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/gkehub/v1alpha2/membership.proto" +] diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/index.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/index.ts new file mode 100644 index 00000000000..aaf819215ae --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/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 {GkeHubClient} from './gke_hub_client'; diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..723143457a0 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/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 gkehub = require('@google-cloud/gke-hub'); + +function main() { + const gkeHubClient = new gkehub.GkeHubClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..832fe8321c7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/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 {GkeHubClient} from '@google-cloud/gke-hub'; + +// check that the client class type name can be used +function doStuffWithGkeHubClient(client: GkeHubClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const gkeHubClient = new GkeHubClient(); + doStuffWithGkeHubClient(gkeHubClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/install.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/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-gkehub/v1alpha2/test/gapic_gke_hub_v1alpha2.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha2/test/gapic_gke_hub_v1alpha2.ts new file mode 100644 index 00000000000..1bdc01eddce --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/test/gapic_gke_hub_v1alpha2.ts @@ -0,0 +1,1361 @@ +// 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 gkehubModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1alpha2.GkeHubClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = gkehubModule.v1alpha2.GkeHubClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = gkehubModule.v1alpha2.GkeHubClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = gkehubModule.v1alpha2.GkeHubClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new gkehubModule.v1alpha2.GkeHubClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.gkeHubStub, undefined); + await client.initialize(); + assert(client.gkeHubStub); + }); + + it('has close method for the initialized client', done => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.gkeHubStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.gkeHubStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new gkehubModule.v1alpha2.GkeHubClient({ + 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 gkehubModule.v1alpha2.GkeHubClient({ + 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('getMembership', () => { + it('invokes getMembership without error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.GetMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.GetMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.Membership() + ); + client.innerApiCalls.getMembership = stubSimpleCall(expectedResponse); + const [response] = await client.getMembership(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMembership without error using callback', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.GetMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.GetMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.Membership() + ); + client.innerApiCalls.getMembership = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMembership( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1alpha2.IMembership|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMembership with error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.GetMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.GetMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMembership = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getMembership(request), expectedError); + const actualRequest = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMembership with closed client', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.GetMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.GetMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getMembership(request), expectedError); + }); + }); + + describe('generateConnectManifest', () => { + it('invokes generateConnectManifest without error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.GenerateConnectManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.GenerateConnectManifestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.GenerateConnectManifestResponse() + ); + client.innerApiCalls.generateConnectManifest = stubSimpleCall(expectedResponse); + const [response] = await client.generateConnectManifest(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateConnectManifest without error using callback', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.GenerateConnectManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.GenerateConnectManifestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.GenerateConnectManifestResponse() + ); + client.innerApiCalls.generateConnectManifest = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateConnectManifest( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateConnectManifest with error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.GenerateConnectManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.GenerateConnectManifestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateConnectManifest = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateConnectManifest(request), expectedError); + const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateConnectManifest with closed client', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.GenerateConnectManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.GenerateConnectManifestRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateConnectManifest(request), expectedError); + }); + }); + + describe('initializeHub', () => { + it('invokes initializeHub without error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.InitializeHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.InitializeHubRequest', ['project']); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.InitializeHubResponse() + ); + client.innerApiCalls.initializeHub = stubSimpleCall(expectedResponse); + const [response] = await client.initializeHub(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.initializeHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.initializeHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes initializeHub without error using callback', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.InitializeHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.InitializeHubRequest', ['project']); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.InitializeHubResponse() + ); + client.innerApiCalls.initializeHub = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.initializeHub( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1alpha2.IInitializeHubResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.initializeHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.initializeHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes initializeHub with error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.InitializeHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.InitializeHubRequest', ['project']); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.initializeHub = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.initializeHub(request), expectedError); + const actualRequest = (client.innerApiCalls.initializeHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.initializeHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes initializeHub with closed client', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.InitializeHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.InitializeHubRequest', ['project']); + request.project = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.initializeHub(request), expectedError); + }); + }); + + describe('createMembership', () => { + it('invokes createMembership without error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.CreateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.CreateMembershipRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMembership = stubLongRunningCall(expectedResponse); + const [operation] = await client.createMembership(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMembership without error using callback', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.CreateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.CreateMembershipRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMembership = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMembership( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMembership with call error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.CreateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.CreateMembershipRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMembership = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createMembership(request), expectedError); + const actualRequest = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMembership with LRO error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.CreateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.CreateMembershipRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMembership = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createMembership(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateMembershipProgress without error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateMembershipProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateMembershipProgress with error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateMembershipProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteMembership', () => { + it('invokes deleteMembership without error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.DeleteMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.DeleteMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteMembership = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteMembership(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteMembership without error using callback', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.DeleteMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.DeleteMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteMembership = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteMembership( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteMembership with call error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.DeleteMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.DeleteMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMembership = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteMembership(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteMembership with LRO error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.DeleteMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.DeleteMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMembership = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteMembership(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteMembershipProgress without error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteMembershipProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteMembershipProgress with error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteMembershipProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateMembership', () => { + it('invokes updateMembership without error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.UpdateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.UpdateMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMembership = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateMembership(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMembership without error using callback', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.UpdateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.UpdateMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMembership = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMembership( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMembership with call error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.UpdateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.UpdateMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMembership = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateMembership(request), expectedError); + const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMembership with LRO error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.UpdateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.UpdateMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMembership = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateMembership(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateMembershipProgress without error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateMembershipProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateMembershipProgress with error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateMembershipProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listMemberships', () => { + it('invokes listMemberships without error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), + ]; + client.innerApiCalls.listMemberships = stubSimpleCall(expectedResponse); + const [response] = await client.listMemberships(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMemberships without error using callback', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), + ]; + client.innerApiCalls.listMemberships = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMemberships( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1alpha2.IMembership[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMemberships with error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMemberships = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMemberships(request), expectedError); + const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMembershipsStream without error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), + ]; + client.descriptors.page.listMemberships.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMembershipsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkehub.v1alpha2.Membership[] = []; + stream.on('data', (response: protos.google.cloud.gkehub.v1alpha2.Membership) => { + 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.listMemberships.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMemberships, request)); + assert( + (client.descriptors.page.listMemberships.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listMembershipsStream with error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMemberships.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMembershipsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkehub.v1alpha2.Membership[] = []; + stream.on('data', (response: protos.google.cloud.gkehub.v1alpha2.Membership) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMemberships.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMemberships, request)); + assert( + (client.descriptors.page.listMemberships.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMemberships without error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), + ]; + client.descriptors.page.listMemberships.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkehub.v1alpha2.IMembership[] = []; + const iterable = client.listMembershipsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMemberships with error', async () => { + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1alpha2.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMemberships.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMembershipsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkehub.v1alpha2.IMembership[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('membership', () => { + const fakePath = "/rendered/path/membership"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + membership: "membershipValue", + }; + const client = new gkehubModule.v1alpha2.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.membershipPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.membershipPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('membershipPath', () => { + const result = client.membershipPath("projectValue", "locationValue", "membershipValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.membershipPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromMembershipName', () => { + const result = client.matchProjectFromMembershipName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromMembershipName', () => { + const result = client.matchLocationFromMembershipName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMembershipFromMembershipName', () => { + const result = client.matchMembershipFromMembershipName(fakePath); + assert.strictEqual(result, "membershipValue"); + assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new gkehubModule.v1alpha2.GkeHubClient({ + 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)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/tsconfig.json b/owl-bot-staging/google-cloud-gkehub/v1alpha2/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/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-gkehub/v1alpha2/webpack.config.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/webpack.config.js new file mode 100644 index 00000000000..71afa3a607d --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1alpha2/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: 'GkeHub', + filename: './gke-hub.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-gkehub/v1beta/.eslintignore b/owl-bot-staging/google-cloud-gkehub/v1beta/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/.eslintrc.json b/owl-bot-staging/google-cloud-gkehub/v1beta/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/.gitignore b/owl-bot-staging/google-cloud-gkehub/v1beta/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/.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-gkehub/v1beta/.jsdoc.js b/owl-bot-staging/google-cloud-gkehub/v1beta/.jsdoc.js new file mode 100644 index 00000000000..b83282dcebb --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/.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/gke-hub', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/.mocharc.js b/owl-bot-staging/google-cloud-gkehub/v1beta/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/.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-gkehub/v1beta/.prettierrc.js b/owl-bot-staging/google-cloud-gkehub/v1beta/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/.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-gkehub/v1beta/README.md b/owl-bot-staging/google-cloud-gkehub/v1beta/README.md new file mode 100644 index 00000000000..f922950c787 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/README.md @@ -0,0 +1 @@ +Gkehub: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/package.json b/owl-bot-staging/google-cloud-gkehub/v1beta/package.json new file mode 100644 index 00000000000..25f7a0fc625 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/gke-hub", + "version": "0.1.0", + "description": "Gkehub client for Node.js", + "repository": "googleapis/nodejs-gkehub", + "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 gkehub", + "gkehub", + "gke hub" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/configmanagement/configmanagement.proto b/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/configmanagement/configmanagement.proto new file mode 100644 index 00000000000..77211d349db --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/configmanagement/configmanagement.proto @@ -0,0 +1,409 @@ +// 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.gkehub.configmanagement.v1beta; + +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeHub.ConfigManagement.V1Beta"; +option go_package = "cloud.google.com/go/gkehub/configmanagement/apiv1beta/configmanagementpb;configmanagementpb"; +option java_multiple_files = true; +option java_outer_classname = "ConfigManagementProto"; +option java_package = "com.google.cloud.gkehub.configmanagement.v1beta"; +option php_namespace = "Google\\Cloud\\GkeHub\\ConfigManagement\\V1beta"; +option ruby_package = "Google::Cloud::GkeHub::ConfigManagement::V1beta"; + +// Enum representing the state of an ACM's deployment on a cluster +enum DeploymentState { + // Deployment's state cannot be determined + DEPLOYMENT_STATE_UNSPECIFIED = 0; + + // Deployment is not installed + NOT_INSTALLED = 1; + + // Deployment is installed + INSTALLED = 2; + + // Deployment was attempted to be installed, but has errors + ERROR = 3; +} + +// **Anthos Config Management**: State for a single cluster. +message MembershipState { + // The user-defined name for the cluster used by ClusterSelectors to group + // clusters together. This should match Membership's membership_name, + // unless the user installed ACM on the cluster manually prior to enabling + // the ACM hub feature. + // Unique within a Anthos Config Management installation. + string cluster_name = 1; + + // Membership configuration in the cluster. This represents the actual state + // in the cluster, while the MembershipSpec in the FeatureSpec represents + // the intended state + MembershipSpec membership_spec = 2; + + // Current install status of ACM's Operator + OperatorState operator_state = 3; + + // Current sync status + ConfigSyncState config_sync_state = 4; + + // PolicyController status + PolicyControllerState policy_controller_state = 5; + + // Binauthz status + BinauthzState binauthz_state = 6; + + // Hierarchy Controller status + HierarchyControllerState hierarchy_controller_state = 7; +} + +// **Anthos Config Management**: Configuration for a single cluster. +// Intended to parallel the ConfigManagement CR. +message MembershipSpec { + // Config Sync configuration for the cluster. + ConfigSync config_sync = 1; + + // Policy Controller configuration for the cluster. + PolicyController policy_controller = 2; + + // Binauthz conifguration for the cluster. + BinauthzConfig binauthz = 3; + + // Hierarchy Controller configuration for the cluster. + HierarchyControllerConfig hierarchy_controller = 4; + + // Version of ACM installed. + string version = 10; +} + +// Configuration for Config Sync +message ConfigSync { + // Git repo configuration for the cluster. + GitConfig git = 7; + + // Specifies whether the Config Sync Repo is + // in “hierarchical” or “unstructured” mode. + string source_format = 8; +} + +// Git repo configuration for a single cluster. +message GitConfig { + // The URL of the Git repository to use as the source of truth. + string sync_repo = 1; + + // The branch of the repository to sync from. Default: master. + string sync_branch = 2; + + // The path within the Git repository that represents the top level of the + // repo to sync. Default: the root directory of the repository. + string policy_dir = 3; + + // Period in seconds between consecutive syncs. Default: 15. + int64 sync_wait_secs = 4; + + // Git revision (tag or hash) to check out. Default HEAD. + string sync_rev = 5; + + // Type of secret configured for access to the Git repo. + string secret_type = 6; + + // URL for the HTTPS proxy to be used when communicating with the Git repo. + string https_proxy = 7; + + // The GCP Service Account Email used for auth when secret_type is + // gcpServiceAccount. + string gcp_service_account_email = 8; +} + +// Configuration for Policy Controller +message PolicyController { + // Enables the installation of Policy Controller. + // If false, the rest of PolicyController fields take no + // effect. + bool enabled = 1; + + // Installs the default template library along with Policy Controller. + optional bool template_library_installed = 2; + + // Sets the interval for Policy Controller Audit Scans (in seconds). + // When set to 0, this disables audit functionality altogether. + optional int64 audit_interval_seconds = 3; + + // The set of namespaces that are excluded from Policy Controller checks. + // Namespaces do not need to currently exist on the cluster. + repeated string exemptable_namespaces = 4; + + // Enables the ability to use Constraint Templates that reference to objects + // other than the object currently being evaluated. + bool referential_rules_enabled = 5; + + // Logs all denies and dry run failures. + bool log_denies_enabled = 6; +} + +// Configuration for Binauthz +message BinauthzConfig { + // Whether binauthz is enabled in this cluster. + bool enabled = 1; +} + +// Configuration for Hierarchy Controller +message HierarchyControllerConfig { + // Whether Hierarchy Controller is enabled in this cluster. + bool enabled = 1; + + // Whether pod tree labels are enabled in this cluster. + bool enable_pod_tree_labels = 2; + + // Whether hierarchical resource quota is enabled in this cluster. + bool enable_hierarchical_resource_quota = 3; +} + +// Deployment state for Hierarchy Controller +message HierarchyControllerDeploymentState { + // The deployment state for open source HNC (e.g. v0.7.0-hc.0) + DeploymentState hnc = 1; + + // The deployment state for Hierarchy Controller extension (e.g. v0.7.0-hc.1) + DeploymentState extension = 2; +} + +// Version for Hierarchy Controller +message HierarchyControllerVersion { + // Version for open source HNC + string hnc = 1; + + // Version for Hierarchy Controller extension + string extension = 2; +} + +// State for Hierarchy Controller +message HierarchyControllerState { + // The version for Hierarchy Controller + HierarchyControllerVersion version = 1; + + // The deployment state for Hierarchy Controller + HierarchyControllerDeploymentState state = 2; +} + +// State information for an ACM's Operator +message OperatorState { + // The semenatic version number of the operator + string version = 1; + + // The state of the Operator's deployment + DeploymentState deployment_state = 2; + + // Install errors. + repeated InstallError errors = 3; +} + +// Errors pertaining to the installation of ACM +message InstallError { + // A string representing the user facing error message + string error_message = 1; +} + +// State information for ConfigSync +message ConfigSyncState { + // The version of ConfigSync deployed + ConfigSyncVersion version = 1; + + // Information about the deployment of ConfigSync, including the version + // of the various Pods deployed + ConfigSyncDeploymentState deployment_state = 2; + + // The state of ConfigSync's process to sync configs to a cluster + SyncState sync_state = 3; +} + +// Specific versioning information pertaining to ConfigSync's Pods +message ConfigSyncVersion { + // Version of the deployed importer pod + string importer = 1; + + // Version of the deployed syncer pod + string syncer = 2; + + // Version of the deployed git-sync pod + string git_sync = 3; + + // Version of the deployed monitor pod + string monitor = 4; + + // Version of the deployed reconciler-manager pod + string reconciler_manager = 5; + + // Version of the deployed reconciler container in root-reconciler pod + string root_reconciler = 6; +} + +// The state of ConfigSync's deployment on a cluster +message ConfigSyncDeploymentState { + // Deployment state of the importer pod + DeploymentState importer = 1; + + // Deployment state of the syncer pod + DeploymentState syncer = 2; + + // Deployment state of the git-sync pod + DeploymentState git_sync = 3; + + // Deployment state of the monitor pod + DeploymentState monitor = 4; + + // Deployment state of reconciler-manager pod + DeploymentState reconciler_manager = 5; + + // Deployment state of root-reconciler + DeploymentState root_reconciler = 6; +} + +// State indicating an ACM's progress syncing configurations to a cluster +message SyncState { + // An enum representing an ACM's status syncing configs to a cluster + enum SyncCode { + // ACM cannot determine a sync code + SYNC_CODE_UNSPECIFIED = 0; + + // ACM successfully synced the git Repo with the cluster + SYNCED = 1; + + // ACM is in the progress of syncing a new change + PENDING = 2; + + // Indicates an error configuring ACM, and user action is required + ERROR = 3; + + // ACM has been installed (operator manifest deployed), + // but not configured. + NOT_CONFIGURED = 4; + + // ACM has not been installed (no operator pod found) + NOT_INSTALLED = 5; + + // Error authorizing with the cluster + UNAUTHORIZED = 6; + + // Cluster could not be reached + UNREACHABLE = 7; + } + + // Token indicating the state of the repo. + string source_token = 1; + + // Token indicating the state of the importer. + string import_token = 2; + + // Token indicating the state of the syncer. + string sync_token = 3; + + // Deprecated: use last_sync_time instead. + // Timestamp of when ACM last successfully synced the repo + // The time format is specified in https://golang.org/pkg/time/#Time.String + string last_sync = 4 [deprecated = true]; + + // Timestamp type of when ACM last successfully synced the repo + google.protobuf.Timestamp last_sync_time = 7; + + // Sync status code + SyncCode code = 5; + + // A list of errors resulting from problematic configs. + // This list will be truncated after 100 errors, although it is + // unlikely for that many errors to simultaneously exist. + repeated SyncError errors = 6; +} + +// An ACM created error representing a problem syncing configurations +message SyncError { + // An ACM defined error code + string code = 1; + + // A description of the error + string error_message = 2; + + // A list of config(s) associated with the error, if any + repeated ErrorResource error_resources = 3; +} + +// Model for a config file in the git repo with an associated Sync error +message ErrorResource { + // Path in the git repo of the erroneous config + string source_path = 1; + + // Metadata name of the resource that is causing an error + string resource_name = 2; + + // Namespace of the resource that is causing an error + string resource_namespace = 3; + + // Group/version/kind of the resource that is causing an error + GroupVersionKind resource_gvk = 4; +} + +// A Kubernetes object's GVK +message GroupVersionKind { + // Kubernetes Group + string group = 1; + + // Kubernetes Version + string version = 2; + + // Kubernetes Kind + string kind = 3; +} + +// State for PolicyControllerState. +message PolicyControllerState { + // The version of Gatekeeper Policy Controller deployed. + PolicyControllerVersion version = 1; + + // The state about the policy controller installation. + GatekeeperDeploymentState deployment_state = 2; +} + +// The build version of Gatekeeper Policy Controller is using. +message PolicyControllerVersion { + // The gatekeeper image tag that is composed of ACM version, git tag, build + // number. + string version = 1; +} + +// State for Binauthz +message BinauthzState { + // The state of the binauthz webhook. + DeploymentState webhook = 1; + + // The version of binauthz that is installed. + BinauthzVersion version = 2; +} + +// The version of binauthz. +message BinauthzVersion { + // The version of the binauthz webhook. + string webhook_version = 1; +} + +// State of Policy Controller installation. +message GatekeeperDeploymentState { + // Status of gatekeeper-controller-manager pod. + DeploymentState gatekeeper_controller_manager_state = 1; + + // Status of gatekeeper-audit deployment. + DeploymentState gatekeeper_audit = 2; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/feature.proto b/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/feature.proto new file mode 100644 index 00000000000..3655644e6e5 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/feature.proto @@ -0,0 +1,202 @@ +// 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.gkehub.v1beta; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/gkehub/v1beta/configmanagement/configmanagement.proto"; +import "google/cloud/gkehub/v1beta/metering/metering.proto"; +import "google/cloud/gkehub/v1beta/multiclusteringress/multiclusteringress.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeHub.V1Beta"; +option go_package = "cloud.google.com/go/gkehub/apiv1beta/gkehubpb;gkehubpb"; +option java_multiple_files = true; +option java_outer_classname = "FeatureProto"; +option java_package = "com.google.cloud.gkehub.v1beta"; +option php_namespace = "Google\\Cloud\\GkeHub\\V1beta"; +option ruby_package = "Google::Cloud::GkeHub::V1beta"; + +// Feature represents the settings and status of any Hub Feature. +message Feature { + option (google.api.resource) = { + type: "gkehub.googleapis.com/Feature" + pattern: "projects/{project}/locations/{location}/features/{feature}" + }; + + // Output only. The full, unique name of this Feature resource in the format + // `projects/*/locations/*/features/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // GCP labels for this Feature. + map labels = 2; + + // Output only. State of the Feature resource itself. + FeatureResourceState resource_state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Hub-wide Feature configuration. If this Feature does not support any + // Hub-wide configuration, this field may be unused. + CommonFeatureSpec spec = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Membership-specific configuration for this Feature. If this Feature does + // not support any per-Membership configuration, this field may be unused. + // + // The keys indicate which Membership the configuration is for, in the form: + // + // projects/{p}/locations/{l}/memberships/{m} + // + // Where {p} is the project, {l} is a valid location and {m} is a valid + // Membership in this project at that location. {p} WILL match the Feature's + // project. + // + // {p} will always be returned as the project number, but the project ID is + // also accepted during input. If the same Membership is specified in the map + // twice (using the project ID form, and the project number form), exactly + // ONE of the entries will be saved, with no guarantees as to which. For this + // reason, it is recommended the same format be used for all entries when + // mutating a Feature. + map membership_specs = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The Hub-wide Feature state. + CommonFeatureState state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Membership-specific Feature status. If this Feature does + // report any per-Membership status, this field may be unused. + // + // The keys indicate which Membership the state is for, in the form: + // + // projects/{p}/locations/{l}/memberships/{m} + // + // Where {p} is the project number, {l} is a valid location and {m} is a valid + // Membership in this project at that location. {p} MUST match the Feature's + // project number. + map membership_states = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the Feature resource was created. + google.protobuf.Timestamp create_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the Feature resource was last updated. + google.protobuf.Timestamp update_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the Feature resource was deleted. + google.protobuf.Timestamp delete_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// FeatureResourceState describes the state of a Feature *resource* in the +// GkeHub API. See `FeatureState` for the "running state" of the Feature in the +// Hub and across Memberships. +message FeatureResourceState { + // State describes the lifecycle status of a Feature. + enum State { + // State is unknown or not set. + STATE_UNSPECIFIED = 0; + + // The Feature is being enabled, and the Feature resource is being created. + // Once complete, the corresponding Feature will be enabled in this Hub. + ENABLING = 1; + + // The Feature is enabled in this Hub, and the Feature resource is fully + // available. + ACTIVE = 2; + + // The Feature is being disabled in this Hub, and the Feature resource + // is being deleted. + DISABLING = 3; + + // The Feature resource is being updated. + UPDATING = 4; + + // The Feature resource is being updated by the Hub Service. + SERVICE_UPDATING = 5; + } + + // The current state of the Feature resource in the Hub API. + State state = 1; +} + +// FeatureState describes the high-level state of a Feature. It may be used to +// describe a Feature's state at the environ-level, or per-membershop, depending +// on the context. +message FeatureState { + // Code represents a machine-readable, high-level status of the Feature. + enum Code { + // Unknown or not set. + CODE_UNSPECIFIED = 0; + + // The Feature is operating normally. + OK = 1; + + // The Feature has encountered an issue, and is operating in a degraded + // state. The Feature may need intervention to return to normal operation. + // See the description and any associated Feature-specific details for more + // information. + WARNING = 2; + + // The Feature is not operating or is in a severely degraded state. + // The Feature may need intervention to return to normal operation. + // See the description and any associated Feature-specific details for more + // information. + ERROR = 3; + } + + // The high-level, machine-readable status of this Feature. + Code code = 1; + + // A human-readable description of the current status. + string description = 2; + + // The time this status and any related Feature-specific details were updated. + google.protobuf.Timestamp update_time = 3; +} + +// CommonFeatureSpec contains Hub-wide configuration information +message CommonFeatureSpec { + oneof feature_spec { + // Multicluster Ingress-specific spec. + google.cloud.gkehub.multiclusteringress.v1beta.FeatureSpec multiclusteringress = 102; + } +} + +// CommonFeatureState contains Hub-wide Feature status information. +message CommonFeatureState { + // Output only. The "running state" of the Feature in this Hub. + FeatureState state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// MembershipFeatureSpec contains configuration information for a single +// Membership. +message MembershipFeatureSpec { + oneof feature_spec { + // Config Management-specific spec. + google.cloud.gkehub.configmanagement.v1beta.MembershipSpec configmanagement = 106; + } +} + +// MembershipFeatureState contains Feature status information for a single +// Membership. +message MembershipFeatureState { + oneof feature_state { + // Metering-specific spec. + google.cloud.gkehub.metering.v1beta.MembershipState metering = 104; + + // Config Management-specific state. + google.cloud.gkehub.configmanagement.v1beta.MembershipState configmanagement = 106; + } + + // The high-level state of this Feature for a single membership. + FeatureState state = 1; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/metering/metering.proto b/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/metering/metering.proto new file mode 100644 index 00000000000..3436915d554 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/metering/metering.proto @@ -0,0 +1,38 @@ +// 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.gkehub.metering.v1beta; + +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeHub.Metering.V1Beta"; +option go_package = "cloud.google.com/go/gkehub/metering/apiv1beta/meteringpb;meteringpb"; +option java_multiple_files = true; +option java_outer_classname = "MeteringProto"; +option java_package = "com.google.cloud.gkehub.metering.v1beta"; +option php_namespace = "Google\\Cloud\\GkeHub\\Metering\\V1beta"; +option ruby_package = "Google::Cloud::GkeHub::Metering::V1beta"; + +// **Metering**: Per-Membership Feature State. +message MembershipState { + // The time stamp of the most recent measurement of the number of vCPUs + // in the cluster. + google.protobuf.Timestamp last_measurement_time = 1; + + // The vCPUs capacity in the cluster according to the most recent + // measurement (1/1000 precision). + float precise_last_measured_cluster_vcpu_capacity = 3; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/multiclusteringress/multiclusteringress.proto b/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/multiclusteringress/multiclusteringress.proto new file mode 100644 index 00000000000..90c483b3bf6 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/multiclusteringress/multiclusteringress.proto @@ -0,0 +1,49 @@ +// 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.gkehub.multiclusteringress.v1beta; + + +option csharp_namespace = "Google.Cloud.GkeHub.MultiClusterIngress.V1Beta"; +option go_package = "cloud.google.com/go/gkehub/multiclusteringress/apiv1beta/multiclusteringresspb;multiclusteringresspb"; +option java_multiple_files = true; +option java_outer_classname = "MultiClusterIngressProto"; +option java_package = "com.google.cloud.gkehub.multiclusteringress.v1beta"; +option php_namespace = "Google\\Cloud\\GkeHub\\MultiClusterIngress\\V1beta"; +option ruby_package = "Google::Cloud::GkeHub::MultiClusterIngress::V1beta"; + +// Billing identifies which billing structure the customer is using. +enum Billing { + // Unknown + BILLING_UNSPECIFIED = 0; + + // User pays a fee per-endpoint. + PAY_AS_YOU_GO = 1; + + // User is paying for Anthos as a whole. + ANTHOS_LICENSE = 2; +} + +// **Multi-cluster Ingress**: The configuration for the MultiClusterIngress +// feature. +message FeatureSpec { + // Fully-qualified Membership name which hosts the MultiClusterIngress CRD. + // Example: `projects/foo-proj/locations/global/memberships/bar` + string config_membership = 1; + + // Customer's billing structure + Billing billing = 2; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/service.proto b/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/service.proto new file mode 100644 index 00000000000..27640473a6e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/service.proto @@ -0,0 +1,280 @@ +// 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.gkehub.v1beta; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/gkehub/v1beta/feature.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeHub.V1Beta"; +option go_package = "cloud.google.com/go/gkehub/apiv1beta/gkehubpb;gkehubpb"; +option java_multiple_files = true; +option java_outer_classname = "ServiceProto"; +option java_package = "com.google.cloud.gkehub.v1beta"; +option php_namespace = "Google\\Cloud\\GkeHub\\V1beta"; +option ruby_package = "Google::Cloud::GkeHub::V1beta"; + +// The GKE Hub service handles the registration of many Kubernetes clusters to +// Google Cloud, and the management of multi-cluster features over those +// clusters. +// +// The GKE Hub service operates on the following resources: +// +// * [Membership][google.cloud.gkehub.v1beta.Membership] +// * [Feature][google.cloud.gkehub.v1beta.Feature] +// +// GKE Hub is currently only available in the global region. +// +// **Membership management may be non-trivial:** it is recommended to use one +// of the Google-provided client libraries or tools where possible when working +// with Membership resources. +service GkeHub { + option (google.api.default_host) = "gkehub.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists Features in a given project and location. + rpc ListFeatures(ListFeaturesRequest) returns (ListFeaturesResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*}/features" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single Feature. + rpc GetFeature(GetFeatureRequest) returns (Feature) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/features/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Adds a new Feature. + rpc CreateFeature(CreateFeatureRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*/locations/*}/features" + body: "resource" + }; + option (google.api.method_signature) = "parent,resource,feature_id"; + option (google.longrunning.operation_info) = { + response_type: "Feature" + metadata_type: "OperationMetadata" + }; + } + + // Removes a Feature. + rpc DeleteFeature(DeleteFeatureRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta/{name=projects/*/locations/*/features/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Updates an existing Feature. + rpc UpdateFeature(UpdateFeatureRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta/{name=projects/*/locations/*/features/*}" + body: "resource" + }; + option (google.api.method_signature) = "name,resource,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Feature" + metadata_type: "OperationMetadata" + }; + } +} + +// Request message for `GkeHub.ListFeatures` method. +message ListFeaturesRequest { + // The parent (project and location) where the Features will be listed. + // Specified in the format `projects/*/locations/*`. + string parent = 1; + + // When requesting a 'page' of resources, `page_size` specifies number of + // resources to return. If unspecified or set to 0, all resources will + // be returned. + int32 page_size = 2; + + // Token returned by previous call to `ListFeatures` which + // specifies the position in the list from where to continue listing the + // resources. + string page_token = 3; + + // Lists Features that match the filter expression, following the syntax + // outlined in https://google.aip.dev/160. + // + // Examples: + // + // - Feature with the name "servicemesh" in project "foo-proj": + // + // name = "projects/foo-proj/locations/global/features/servicemesh" + // + // - Features that have a label called `foo`: + // + // labels.foo:* + // + // - Features that have a label called `foo` whose value is `bar`: + // + // labels.foo = bar + string filter = 4; + + // One or more fields to compare and use to sort the output. + // See https://google.aip.dev/132#ordering. + string order_by = 5; +} + +// Response message for the `GkeHub.ListFeatures` method. +message ListFeaturesResponse { + // The list of matching Features + repeated Feature resources = 1; + + // A token to request the next page of resources from the + // `ListFeatures` method. The value of an empty string means + // that there are no more resources to return. + string next_page_token = 2; +} + +// Request message for `GkeHub.GetFeature` method. +message GetFeatureRequest { + // The Feature resource name in the format + // `projects/*/locations/*/features/*` + string name = 1; +} + +// Request message for the `GkeHub.CreateFeature` method. +message CreateFeatureRequest { + // The parent (project and location) where the Feature will be created. + // Specified in the format `projects/*/locations/*`. + string parent = 1; + + // The ID of the feature to create. + string feature_id = 2; + + // The Feature resource to create. + Feature resource = 3; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for `GkeHub.DeleteFeature` method. +message DeleteFeatureRequest { + // The Feature resource name in the format + // `projects/*/locations/*/features/*`. + string name = 1; + + // If set to true, the delete will ignore any outstanding resources for + // this Feature (that is, `FeatureState.has_resources` is set to true). These + // resources will NOT be cleaned up or modified in any way. + bool force = 2; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for `GkeHub.UpdateFeature` method. +message UpdateFeatureRequest { + // The Feature resource name in the format + // `projects/*/locations/*/features/*`. + string name = 1; + + // Mask of fields to update. + google.protobuf.FieldMask update_mask = 2; + + // Only fields specified in update_mask are updated. + // If you specify a field in the update_mask but don't specify its value here + // that field will be deleted. + // If you are updating a map field, set the value of a key to null or empty + // string to delete the key from the map. It's not possible to update a key's + // value to the empty string. + // If you specify the update_mask to be a special path "*", fully replaces all + // user-modifiable fields to match `resource`. + Feature resource = 3; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_detail = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.create_feature.js b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.create_feature.js new file mode 100644 index 00000000000..8bbe450b265 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.create_feature.js @@ -0,0 +1,84 @@ +// 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() { + // [START gkehub_v1beta_generated_GkeHub_CreateFeature_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The parent (project and location) where the Feature will be created. + * Specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * The ID of the feature to create. + */ + // const featureId = 'abc123' + /** + * The Feature resource to create. + */ + // const resource = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1beta; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callCreateFeature() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await gkehubClient.createFeature(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFeature(); + // [END gkehub_v1beta_generated_GkeHub_CreateFeature_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-gkehub/v1beta/samples/generated/v1beta/gke_hub.delete_feature.js b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.delete_feature.js new file mode 100644 index 00000000000..b5a0d245a2f --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.delete_feature.js @@ -0,0 +1,82 @@ +// 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() { + // [START gkehub_v1beta_generated_GkeHub_DeleteFeature_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The Feature resource name in the format + * `projects/* /locations/* /features/*`. + */ + // const name = 'abc123' + /** + * If set to true, the delete will ignore any outstanding resources for + * this Feature (that is, `FeatureState.has_resources` is set to true). These + * resources will NOT be cleaned up or modified in any way. + */ + // const force = true + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1beta; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callDeleteFeature() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await gkehubClient.deleteFeature(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFeature(); + // [END gkehub_v1beta_generated_GkeHub_DeleteFeature_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-gkehub/v1beta/samples/generated/v1beta/gke_hub.get_feature.js b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.get_feature.js new file mode 100644 index 00000000000..f41b7363518 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.get_feature.js @@ -0,0 +1,61 @@ +// 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() { + // [START gkehub_v1beta_generated_GkeHub_GetFeature_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The Feature resource name in the format + * `projects/* /locations/* /features/*` + */ + // const name = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1beta; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callGetFeature() { + // Construct request + const request = { + }; + + // Run request + const response = await gkehubClient.getFeature(request); + console.log(response); + } + + callGetFeature(); + // [END gkehub_v1beta_generated_GkeHub_GetFeature_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-gkehub/v1beta/samples/generated/v1beta/gke_hub.list_features.js b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.list_features.js new file mode 100644 index 00000000000..73d266f5ab3 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.list_features.js @@ -0,0 +1,92 @@ +// 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() { + // [START gkehub_v1beta_generated_GkeHub_ListFeatures_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The parent (project and location) where the Features will be listed. + * Specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * When requesting a 'page' of resources, `page_size` specifies number of + * resources to return. If unspecified or set to 0, all resources will + * be returned. + */ + // const pageSize = 1234 + /** + * Token returned by previous call to `ListFeatures` which + * specifies the position in the list from where to continue listing the + * resources. + */ + // const pageToken = 'abc123' + /** + * Lists Features that match the filter expression, following the syntax + * outlined in https://google.aip.dev/160. + * Examples: + * - Feature with the name "servicemesh" in project "foo-proj": + * name = "projects/foo-proj/locations/global/features/servicemesh" + * - Features that have a label called `foo`: + * labels.foo:* + * - Features that have a label called `foo` whose value is `bar`: + * labels.foo = bar + */ + // const filter = 'abc123' + /** + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1beta; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callListFeatures() { + // Construct request + const request = { + }; + + // Run request + const iterable = await gkehubClient.listFeaturesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFeatures(); + // [END gkehub_v1beta_generated_GkeHub_ListFeatures_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-gkehub/v1beta/samples/generated/v1beta/gke_hub.update_feature.js b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.update_feature.js new file mode 100644 index 00000000000..a80e7184b23 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.update_feature.js @@ -0,0 +1,91 @@ +// 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() { + // [START gkehub_v1beta_generated_GkeHub_UpdateFeature_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The Feature resource name in the format + * `projects/* /locations/* /features/*`. + */ + // const name = 'abc123' + /** + * Mask of fields to update. + */ + // const updateMask = {} + /** + * Only fields specified in update_mask are updated. + * If you specify a field in the update_mask but don't specify its value here + * that field will be deleted. + * If you are updating a map field, set the value of a key to null or empty + * string to delete the key from the map. It's not possible to update a key's + * value to the empty string. + * If you specify the update_mask to be a special path "*", fully replaces all + * user-modifiable fields to match `resource`. + */ + // const resource = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Gkehub library + const {GkeHubClient} = require('@google-cloud/gke-hub').v1beta; + + // Instantiates a client + const gkehubClient = new GkeHubClient(); + + async function callUpdateFeature() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await gkehubClient.updateFeature(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFeature(); + // [END gkehub_v1beta_generated_GkeHub_UpdateFeature_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-gkehub/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.gkehub.v1beta.json b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.gkehub.v1beta.json new file mode 100644 index 00000000000..68cb273223a --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.gkehub.v1beta.json @@ -0,0 +1,263 @@ +{ + "clientLibrary": { + "name": "nodejs-gkehub", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.gkehub.v1beta", + "version": "v1beta" + } + ] + }, + "snippets": [ + { + "regionTag": "gkehub_v1beta_generated_GkeHub_ListFeatures_async", + "title": "GkeHub listFeatures Sample", + "origin": "API_DEFINITION", + "description": " Lists Features in a given project and location.", + "canonical": true, + "file": "gke_hub.list_features.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFeatures", + "fullName": "google.cloud.gkehub.v1beta.GkeHub.ListFeatures", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkehub.v1beta.ListFeaturesResponse", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1beta.GkeHubClient" + }, + "method": { + "shortName": "ListFeatures", + "fullName": "google.cloud.gkehub.v1beta.GkeHub.ListFeatures", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1beta.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1beta_generated_GkeHub_GetFeature_async", + "title": "GkeHub getFeature Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single Feature.", + "canonical": true, + "file": "gke_hub.get_feature.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFeature", + "fullName": "google.cloud.gkehub.v1beta.GkeHub.GetFeature", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkehub.v1beta.Feature", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1beta.GkeHubClient" + }, + "method": { + "shortName": "GetFeature", + "fullName": "google.cloud.gkehub.v1beta.GkeHub.GetFeature", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1beta.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1beta_generated_GkeHub_CreateFeature_async", + "title": "GkeHub createFeature Sample", + "origin": "API_DEFINITION", + "description": " Adds a new Feature.", + "canonical": true, + "file": "gke_hub.create_feature.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFeature", + "fullName": "google.cloud.gkehub.v1beta.GkeHub.CreateFeature", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "feature_id", + "type": "TYPE_STRING" + }, + { + "name": "resource", + "type": ".google.cloud.gkehub.v1beta.Feature" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1beta.GkeHubClient" + }, + "method": { + "shortName": "CreateFeature", + "fullName": "google.cloud.gkehub.v1beta.GkeHub.CreateFeature", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1beta.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1beta_generated_GkeHub_DeleteFeature_async", + "title": "GkeHub deleteFeature Sample", + "origin": "API_DEFINITION", + "description": " Removes a Feature.", + "canonical": true, + "file": "gke_hub.delete_feature.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFeature", + "fullName": "google.cloud.gkehub.v1beta.GkeHub.DeleteFeature", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1beta.GkeHubClient" + }, + "method": { + "shortName": "DeleteFeature", + "fullName": "google.cloud.gkehub.v1beta.GkeHub.DeleteFeature", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1beta.GkeHub" + } + } + } + }, + { + "regionTag": "gkehub_v1beta_generated_GkeHub_UpdateFeature_async", + "title": "GkeHub updateFeature Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing Feature.", + "canonical": true, + "file": "gke_hub.update_feature.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFeature", + "fullName": "google.cloud.gkehub.v1beta.GkeHub.UpdateFeature", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "resource", + "type": ".google.cloud.gkehub.v1beta.Feature" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubClient", + "fullName": "google.cloud.gkehub.v1beta.GkeHubClient" + }, + "method": { + "shortName": "UpdateFeature", + "fullName": "google.cloud.gkehub.v1beta.GkeHub.UpdateFeature", + "service": { + "shortName": "GkeHub", + "fullName": "google.cloud.gkehub.v1beta.GkeHub" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1beta/src/index.ts new file mode 100644 index 00000000000..2c04b31096b --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/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 v1beta from './v1beta'; +const GkeHubClient = v1beta.GkeHubClient; +type GkeHubClient = v1beta.GkeHubClient; +export {v1beta, GkeHubClient}; +export default {v1beta, GkeHubClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gapic_metadata.json new file mode 100644 index 00000000000..adc7122180e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gapic_metadata.json @@ -0,0 +1,77 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.gkehub.v1beta", + "libraryPackage": "@google-cloud/gke-hub", + "services": { + "GkeHub": { + "clients": { + "grpc": { + "libraryClient": "GkeHubClient", + "rpcs": { + "GetFeature": { + "methods": [ + "getFeature" + ] + }, + "CreateFeature": { + "methods": [ + "createFeature" + ] + }, + "DeleteFeature": { + "methods": [ + "deleteFeature" + ] + }, + "UpdateFeature": { + "methods": [ + "updateFeature" + ] + }, + "ListFeatures": { + "methods": [ + "listFeatures", + "listFeaturesStream", + "listFeaturesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "GkeHubClient", + "rpcs": { + "GetFeature": { + "methods": [ + "getFeature" + ] + }, + "CreateFeature": { + "methods": [ + "createFeature" + ] + }, + "DeleteFeature": { + "methods": [ + "deleteFeature" + ] + }, + "UpdateFeature": { + "methods": [ + "updateFeature" + ] + }, + "ListFeatures": { + "methods": [ + "listFeatures", + "listFeaturesStream", + "listFeaturesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_client.ts b/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_client.ts new file mode 100644 index 00000000000..19c308e7c2d --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_client.ts @@ -0,0 +1,1084 @@ +// 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, GrpcClientOptions, LROperation, 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/v1beta/gke_hub_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './gke_hub_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The GKE Hub service handles the registration of many Kubernetes clusters to + * Google Cloud, and the management of multi-cluster features over those + * clusters. + * + * The GKE Hub service operates on the following resources: + * + * * {@link protos.google.cloud.gkehub.v1beta.Membership|Membership} + * * {@link protos.google.cloud.gkehub.v1beta.Feature|Feature} + * + * GKE Hub is currently only available in the global region. + * + * **Membership management may be non-trivial:** it is recommended to use one + * of the Google-provided client libraries or tools where possible when working + * with Membership resources. + * @class + * @memberof v1beta + */ +export class GkeHubClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + gkeHubStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of GkeHubClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 GkeHubClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof GkeHubClient; + 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 { + 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 = { + featurePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/features/{feature}' + ), + }; + + // 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 = { + listFeatures: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta/{resource=projects/*/locations/*/memberships/*}:getIamPolicy',additional_bindings: [{get: '/v1beta/{resource=projects/*/locations/*/features/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta/{resource=projects/*/locations/*/memberships/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/features/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta/{resource=projects/*/locations/*/memberships/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/features/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createFeatureResponse = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1beta.Feature') as gax.protobuf.Type; + const createFeatureMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1beta.OperationMetadata') as gax.protobuf.Type; + const deleteFeatureResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteFeatureMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1beta.OperationMetadata') as gax.protobuf.Type; + const updateFeatureResponse = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1beta.Feature') as gax.protobuf.Type; + const updateFeatureMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1beta.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createFeature: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFeatureResponse.decode.bind(createFeatureResponse), + createFeatureMetadata.decode.bind(createFeatureMetadata)), + deleteFeature: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFeatureResponse.decode.bind(deleteFeatureResponse), + deleteFeatureMetadata.decode.bind(deleteFeatureMetadata)), + updateFeature: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFeatureResponse.decode.bind(updateFeatureResponse), + updateFeatureMetadata.decode.bind(updateFeatureMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.gkehub.v1beta.GkeHub', 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.gkeHubStub) { + return this.gkeHubStub; + } + + // Put together the "service stub" for + // google.cloud.gkehub.v1beta.GkeHub. + this.gkeHubStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.gkehub.v1beta.GkeHub') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.gkehub.v1beta.GkeHub, + 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 gkeHubStubMethods = + ['listFeatures', 'getFeature', 'createFeature', 'deleteFeature', 'updateFeature']; + for (const methodName of gkeHubStubMethods) { + const callPromise = this.gkeHubStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.gkeHubStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'gkehub.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 'gkehub.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 -- + // ------------------- +/** + * Gets details of a single Feature. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The Feature resource name in the format + * `projects/* /locations/* /features/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1beta.Feature|Feature}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/gke_hub.get_feature.js + * region_tag:gkehub_v1beta_generated_GkeHub_GetFeature_async + */ + getFeature( + request?: protos.google.cloud.gkehub.v1beta.IGetFeatureRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1beta.IFeature, + protos.google.cloud.gkehub.v1beta.IGetFeatureRequest|undefined, {}|undefined + ]>; + getFeature( + request: protos.google.cloud.gkehub.v1beta.IGetFeatureRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkehub.v1beta.IFeature, + protos.google.cloud.gkehub.v1beta.IGetFeatureRequest|null|undefined, + {}|null|undefined>): void; + getFeature( + request: protos.google.cloud.gkehub.v1beta.IGetFeatureRequest, + callback: Callback< + protos.google.cloud.gkehub.v1beta.IFeature, + protos.google.cloud.gkehub.v1beta.IGetFeatureRequest|null|undefined, + {}|null|undefined>): void; + getFeature( + request?: protos.google.cloud.gkehub.v1beta.IGetFeatureRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkehub.v1beta.IFeature, + protos.google.cloud.gkehub.v1beta.IGetFeatureRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkehub.v1beta.IFeature, + protos.google.cloud.gkehub.v1beta.IGetFeatureRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkehub.v1beta.IFeature, + protos.google.cloud.gkehub.v1beta.IGetFeatureRequest|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.getFeature(request, options, callback); + } + +/** + * Adds a new Feature. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent (project and location) where the Feature will be created. + * Specified in the format `projects/* /locations/*`. + * @param {string} request.featureId + * The ID of the feature to create. + * @param {google.cloud.gkehub.v1beta.Feature} request.resource + * The Feature resource to create. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/gke_hub.create_feature.js + * region_tag:gkehub_v1beta_generated_GkeHub_CreateFeature_async + */ + createFeature( + request?: protos.google.cloud.gkehub.v1beta.ICreateFeatureRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createFeature( + request: protos.google.cloud.gkehub.v1beta.ICreateFeatureRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFeature( + request: protos.google.cloud.gkehub.v1beta.ICreateFeatureRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFeature( + request?: protos.google.cloud.gkehub.v1beta.ICreateFeatureRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFeature(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createFeature()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/gke_hub.create_feature.js + * region_tag:gkehub_v1beta_generated_GkeHub_CreateFeature_async + */ + async checkCreateFeatureProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFeature, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Removes a Feature. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The Feature resource name in the format + * `projects/* /locations/* /features/*`. + * @param {boolean} request.force + * If set to true, the delete will ignore any outstanding resources for + * this Feature (that is, `FeatureState.has_resources` is set to true). These + * resources will NOT be cleaned up or modified in any way. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/gke_hub.delete_feature.js + * region_tag:gkehub_v1beta_generated_GkeHub_DeleteFeature_async + */ + deleteFeature( + request?: protos.google.cloud.gkehub.v1beta.IDeleteFeatureRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteFeature( + request: protos.google.cloud.gkehub.v1beta.IDeleteFeatureRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFeature( + request: protos.google.cloud.gkehub.v1beta.IDeleteFeatureRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFeature( + request?: protos.google.cloud.gkehub.v1beta.IDeleteFeatureRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteFeature(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteFeature()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/gke_hub.delete_feature.js + * region_tag:gkehub_v1beta_generated_GkeHub_DeleteFeature_async + */ + async checkDeleteFeatureProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFeature, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an existing Feature. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The Feature resource name in the format + * `projects/* /locations/* /features/*`. + * @param {google.protobuf.FieldMask} request.updateMask + * Mask of fields to update. + * @param {google.cloud.gkehub.v1beta.Feature} request.resource + * Only fields specified in update_mask are updated. + * If you specify a field in the update_mask but don't specify its value here + * that field will be deleted. + * If you are updating a map field, set the value of a key to null or empty + * string to delete the key from the map. It's not possible to update a key's + * value to the empty string. + * If you specify the update_mask to be a special path "*", fully replaces all + * user-modifiable fields to match `resource`. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/gke_hub.update_feature.js + * region_tag:gkehub_v1beta_generated_GkeHub_UpdateFeature_async + */ + updateFeature( + request?: protos.google.cloud.gkehub.v1beta.IUpdateFeatureRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateFeature( + request: protos.google.cloud.gkehub.v1beta.IUpdateFeatureRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFeature( + request: protos.google.cloud.gkehub.v1beta.IUpdateFeatureRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFeature( + request?: protos.google.cloud.gkehub.v1beta.IUpdateFeatureRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFeature(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateFeature()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/gke_hub.update_feature.js + * region_tag:gkehub_v1beta_generated_GkeHub_UpdateFeature_async + */ + async checkUpdateFeatureProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFeature, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists Features in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent (project and location) where the Features will be listed. + * Specified in the format `projects/* /locations/*`. + * @param {number} request.pageSize + * When requesting a 'page' of resources, `page_size` specifies number of + * resources to return. If unspecified or set to 0, all resources will + * be returned. + * @param {string} request.pageToken + * Token returned by previous call to `ListFeatures` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} request.filter + * Lists Features that match the filter expression, following the syntax + * outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Feature with the name "servicemesh" in project "foo-proj": + * + * name = "projects/foo-proj/locations/global/features/servicemesh" + * + * - Features that have a label called `foo`: + * + * labels.foo:* + * + * - Features that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * @param {string} request.orderBy + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1beta.Feature|Feature}. + * 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 `listFeaturesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFeatures( + request?: protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1beta.IFeature[], + protos.google.cloud.gkehub.v1beta.IListFeaturesRequest|null, + protos.google.cloud.gkehub.v1beta.IListFeaturesResponse + ]>; + listFeatures( + request: protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, + protos.google.cloud.gkehub.v1beta.IListFeaturesResponse|null|undefined, + protos.google.cloud.gkehub.v1beta.IFeature>): void; + listFeatures( + request: protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, + callback: PaginationCallback< + protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, + protos.google.cloud.gkehub.v1beta.IListFeaturesResponse|null|undefined, + protos.google.cloud.gkehub.v1beta.IFeature>): void; + listFeatures( + request?: protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, + protos.google.cloud.gkehub.v1beta.IListFeaturesResponse|null|undefined, + protos.google.cloud.gkehub.v1beta.IFeature>, + callback?: PaginationCallback< + protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, + protos.google.cloud.gkehub.v1beta.IListFeaturesResponse|null|undefined, + protos.google.cloud.gkehub.v1beta.IFeature>): + Promise<[ + protos.google.cloud.gkehub.v1beta.IFeature[], + protos.google.cloud.gkehub.v1beta.IListFeaturesRequest|null, + protos.google.cloud.gkehub.v1beta.IListFeaturesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listFeatures(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 + * The parent (project and location) where the Features will be listed. + * Specified in the format `projects/* /locations/*`. + * @param {number} request.pageSize + * When requesting a 'page' of resources, `page_size` specifies number of + * resources to return. If unspecified or set to 0, all resources will + * be returned. + * @param {string} request.pageToken + * Token returned by previous call to `ListFeatures` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} request.filter + * Lists Features that match the filter expression, following the syntax + * outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Feature with the name "servicemesh" in project "foo-proj": + * + * name = "projects/foo-proj/locations/global/features/servicemesh" + * + * - Features that have a label called `foo`: + * + * labels.foo:* + * + * - Features that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * @param {string} request.orderBy + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 protos.google.cloud.gkehub.v1beta.Feature|Feature} 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 `listFeaturesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFeaturesStream( + request?: protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, + 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['listFeatures']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFeatures.createStream( + this.innerApiCalls.listFeatures as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFeatures`, 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 + * The parent (project and location) where the Features will be listed. + * Specified in the format `projects/* /locations/*`. + * @param {number} request.pageSize + * When requesting a 'page' of resources, `page_size` specifies number of + * resources to return. If unspecified or set to 0, all resources will + * be returned. + * @param {string} request.pageToken + * Token returned by previous call to `ListFeatures` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} request.filter + * Lists Features that match the filter expression, following the syntax + * outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Feature with the name "servicemesh" in project "foo-proj": + * + * name = "projects/foo-proj/locations/global/features/servicemesh" + * + * - Features that have a label called `foo`: + * + * labels.foo:* + * + * - Features that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * @param {string} request.orderBy + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkehub.v1beta.Feature|Feature}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/gke_hub.list_features.js + * region_tag:gkehub_v1beta_generated_GkeHub_ListFeatures_async + */ + listFeaturesAsync( + request?: protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, + 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['listFeatures']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFeatures.asyncIterate( + this.innerApiCalls['listFeatures'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified feature resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} feature + * @returns {string} Resource name string. + */ + featurePath(project:string,location:string,feature:string) { + return this.pathTemplates.featurePathTemplate.render({ + project: project, + location: location, + feature: feature, + }); + } + + /** + * Parse the project from Feature resource. + * + * @param {string} featureName + * A fully-qualified path representing Feature resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFeatureName(featureName: string) { + return this.pathTemplates.featurePathTemplate.match(featureName).project; + } + + /** + * Parse the location from Feature resource. + * + * @param {string} featureName + * A fully-qualified path representing Feature resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFeatureName(featureName: string) { + return this.pathTemplates.featurePathTemplate.match(featureName).location; + } + + /** + * Parse the feature from Feature resource. + * + * @param {string} featureName + * A fully-qualified path representing Feature resource. + * @returns {string} A string representing the feature. + */ + matchFeatureFromFeatureName(featureName: string) { + return this.pathTemplates.featurePathTemplate.match(featureName).feature; + } + + /** + * 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.gkeHubStub && !this._terminated) { + return this.gkeHubStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_client_config.json b/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_client_config.json new file mode 100644 index 00000000000..f7fe709c550 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_client_config.json @@ -0,0 +1,63 @@ +{ + "interfaces": { + "google.cloud.gkehub.v1beta.GkeHub": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListFeatures": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetFeature": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateFeature": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteFeature": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdateFeature": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_proto_list.json b/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_proto_list.json new file mode 100644 index 00000000000..9c152a8109c --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_proto_list.json @@ -0,0 +1,7 @@ +[ + "../../protos/google/cloud/gkehub/v1beta/configmanagement/configmanagement.proto", + "../../protos/google/cloud/gkehub/v1beta/feature.proto", + "../../protos/google/cloud/gkehub/v1beta/metering/metering.proto", + "../../protos/google/cloud/gkehub/v1beta/multiclusteringress/multiclusteringress.proto", + "../../protos/google/cloud/gkehub/v1beta/service.proto" +] diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/index.ts b/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/index.ts new file mode 100644 index 00000000000..aaf819215ae --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/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 {GkeHubClient} from './gke_hub_client'; diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gkehub/v1beta/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..723143457a0 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/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 gkehub = require('@google-cloud/gke-hub'); + +function main() { + const gkeHubClient = new gkehub.GkeHubClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1beta/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..832fe8321c7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/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 {GkeHubClient} from '@google-cloud/gke-hub'; + +// check that the client class type name can be used +function doStuffWithGkeHubClient(client: GkeHubClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const gkeHubClient = new GkeHubClient(); + doStuffWithGkeHubClient(gkeHubClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/system-test/install.ts b/owl-bot-staging/google-cloud-gkehub/v1beta/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/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-gkehub/v1beta/test/gapic_gke_hub_v1beta.ts b/owl-bot-staging/google-cloud-gkehub/v1beta/test/gapic_gke_hub_v1beta.ts new file mode 100644 index 00000000000..534dec765ed --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/test/gapic_gke_hub_v1beta.ts @@ -0,0 +1,1077 @@ +// 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 gkehubModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta.GkeHubClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = gkehubModule.v1beta.GkeHubClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = gkehubModule.v1beta.GkeHubClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = gkehubModule.v1beta.GkeHubClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new gkehubModule.v1beta.GkeHubClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.gkeHubStub, undefined); + await client.initialize(); + assert(client.gkeHubStub); + }); + + it('has close method for the initialized client', done => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.gkeHubStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.gkeHubStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new gkehubModule.v1beta.GkeHubClient({ + 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 gkehubModule.v1beta.GkeHubClient({ + 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('getFeature', () => { + it('invokes getFeature without error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.GetFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.GetFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.Feature() + ); + client.innerApiCalls.getFeature = stubSimpleCall(expectedResponse); + const [response] = await client.getFeature(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFeature without error using callback', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.GetFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.GetFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.Feature() + ); + client.innerApiCalls.getFeature = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFeature( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1beta.IFeature|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFeature with error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.GetFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.GetFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFeature = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFeature(request), expectedError); + const actualRequest = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFeature with closed client', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.GetFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.GetFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFeature(request), expectedError); + }); + }); + + describe('createFeature', () => { + it('invokes createFeature without error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.CreateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.CreateFeatureRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFeature = stubLongRunningCall(expectedResponse); + const [operation] = await client.createFeature(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFeature without error using callback', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.CreateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.CreateFeatureRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFeature = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFeature( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFeature with call error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.CreateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.CreateFeatureRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFeature = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createFeature(request), expectedError); + const actualRequest = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFeature with LRO error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.CreateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.CreateFeatureRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFeature = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createFeature(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateFeatureProgress without error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateFeatureProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFeatureProgress with error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateFeatureProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteFeature', () => { + it('invokes deleteFeature without error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.DeleteFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.DeleteFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFeature = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFeature(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFeature without error using callback', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.DeleteFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.DeleteFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFeature = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFeature( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFeature with call error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.DeleteFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.DeleteFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFeature = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteFeature(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFeature with LRO error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.DeleteFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.DeleteFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFeature = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteFeature(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteFeatureProgress without error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteFeatureProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFeatureProgress with error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteFeatureProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateFeature', () => { + it('invokes updateFeature without error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.UpdateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.UpdateFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFeature = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFeature(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFeature without error using callback', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.UpdateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.UpdateFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFeature = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFeature( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFeature with call error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.UpdateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.UpdateFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFeature = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateFeature(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFeature with LRO error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.UpdateFeatureRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.UpdateFeatureRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFeature = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateFeature(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateFeatureProgress without error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateFeatureProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFeatureProgress with error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateFeatureProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listFeatures', () => { + it('invokes listFeatures without error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), + ]; + client.innerApiCalls.listFeatures = stubSimpleCall(expectedResponse); + const [response] = await client.listFeatures(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFeatures without error using callback', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), + ]; + client.innerApiCalls.listFeatures = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFeatures( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1beta.IFeature[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFeatures with error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFeatures = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFeatures(request), expectedError); + const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFeaturesStream without error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), + ]; + client.descriptors.page.listFeatures.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFeaturesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkehub.v1beta.Feature[] = []; + stream.on('data', (response: protos.google.cloud.gkehub.v1beta.Feature) => { + 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.listFeatures.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFeatures, request)); + assert( + (client.descriptors.page.listFeatures.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFeaturesStream with error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFeatures.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFeaturesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkehub.v1beta.Feature[] = []; + stream.on('data', (response: protos.google.cloud.gkehub.v1beta.Feature) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFeatures.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFeatures, request)); + assert( + (client.descriptors.page.listFeatures.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFeatures without error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), + generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), + ]; + client.descriptors.page.listFeatures.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkehub.v1beta.IFeature[] = []; + const iterable = client.listFeaturesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFeatures.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFeatures.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFeatures with error', async () => { + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta.ListFeaturesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta.ListFeaturesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFeatures.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFeaturesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkehub.v1beta.IFeature[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFeatures.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFeatures.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('feature', () => { + const fakePath = "/rendered/path/feature"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + feature: "featureValue", + }; + const client = new gkehubModule.v1beta.GkeHubClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.featurePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.featurePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('featurePath', () => { + const result = client.featurePath("projectValue", "locationValue", "featureValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.featurePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFeatureName', () => { + const result = client.matchProjectFromFeatureName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.featurePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFeatureName', () => { + const result = client.matchLocationFromFeatureName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.featurePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFeatureFromFeatureName', () => { + const result = client.matchFeatureFromFeatureName(fakePath); + assert.strictEqual(result, "featureValue"); + assert((client.pathTemplates.featurePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/tsconfig.json b/owl-bot-staging/google-cloud-gkehub/v1beta/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/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-gkehub/v1beta/webpack.config.js b/owl-bot-staging/google-cloud-gkehub/v1beta/webpack.config.js new file mode 100644 index 00000000000..71afa3a607d --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta/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: 'GkeHub', + filename: './gke-hub.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-gkehub/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-gkehub/v1beta1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-gkehub/v1beta1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/.gitignore b/owl-bot-staging/google-cloud-gkehub/v1beta1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/.jsdoc.js new file mode 100644 index 00000000000..b83282dcebb --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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/gke-hub', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1beta1/README.md b/owl-bot-staging/google-cloud-gkehub/v1beta1/README.md new file mode 100644 index 00000000000..f922950c787 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/README.md @@ -0,0 +1 @@ +Gkehub: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/package.json b/owl-bot-staging/google-cloud-gkehub/v1beta1/package.json new file mode 100644 index 00000000000..a943aca7ef1 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/gke-hub", + "version": "0.1.0", + "description": "Gkehub client for Node.js", + "repository": "googleapis/nodejs-gkehub", + "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 gkehub", + "gkehub", + "gke hub membership service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/protos/google/cloud/gkehub/v1beta1/membership.proto b/owl-bot-staging/google-cloud-gkehub/v1beta1/protos/google/cloud/gkehub/v1beta1/membership.proto new file mode 100644 index 00000000000..020ae85c3b8 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/protos/google/cloud/gkehub/v1beta1/membership.proto @@ -0,0 +1,957 @@ +// 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 +// +// 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.gkehub.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.GkeHub.V1Beta1"; +option go_package = "cloud.google.com/go/gkehub/apiv1beta1/gkehubpb;gkehubpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.gkehub.v1beta1"; +option php_namespace = "Google\\Cloud\\GkeHub\\V1beta1"; +option ruby_package = "Google::Cloud::GkeHub::V1beta1"; + +// The GKE Hub MembershipService handles the registration of many Kubernetes +// clusters to Google Cloud, represented with the +// [Membership][google.cloud.gkehub.v1beta1.Membership] resource. +// +// GKE Hub is currently available in the global region and all regions in +// https://cloud.google.com/compute/docs/regions-zones. +// +// **Membership management may be non-trivial:** it is recommended to use one +// of the Google-provided client libraries or tools where possible when working +// with Membership resources. +service GkeHubMembershipService { + option (google.api.default_host) = "gkehub.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists Memberships in a given project and location. + rpc ListMemberships(ListMembershipsRequest) + returns (ListMembershipsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/locations/*}/memberships" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a Membership. + rpc GetMembership(GetMembershipRequest) returns (Membership) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*/memberships/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new Membership. + // + // **This is currently only supported for GKE clusters on Google Cloud**. + // To register other clusters, follow the instructions at + // https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster. + rpc CreateMembership(CreateMembershipRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/*}/memberships" + body: "resource" + }; + option (google.api.method_signature) = "parent,resource,membership_id"; + option (google.longrunning.operation_info) = { + response_type: "Membership" + metadata_type: "OperationMetadata" + }; + } + + // Removes a Membership. + // + // **This is currently only supported for GKE clusters on Google Cloud**. + // To unregister other clusters, follow the instructions at + // https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. + rpc DeleteMembership(DeleteMembershipRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta1/{name=projects/*/locations/*/memberships/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Updates an existing Membership. + rpc UpdateMembership(UpdateMembershipRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta1/{name=projects/*/locations/*/memberships/*}" + body: "resource" + }; + option (google.api.method_signature) = "name,resource,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Membership" + metadata_type: "OperationMetadata" + }; + } + + // Generates the manifest for deployment of the GKE connect agent. + // + // **This method is used internally by Google-provided libraries.** + // Most clients should not need to call this method directly. + rpc GenerateConnectManifest(GenerateConnectManifestRequest) + returns (GenerateConnectManifestResponse) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*/memberships/*}:generateConnectManifest" + }; + } + + // ValidateExclusivity validates the state of exclusivity in the cluster. + // The validation does not depend on an existing Hub membership resource. + rpc ValidateExclusivity(ValidateExclusivityRequest) + returns (ValidateExclusivityResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/locations/*}/memberships:validateExclusivity" + }; + } + + // GenerateExclusivityManifest generates the manifests to update the + // exclusivity artifacts in the cluster if needed. + // + // Exclusivity artifacts include the Membership custom resource definition + // (CRD) and the singleton Membership custom resource (CR). Combined with + // ValidateExclusivity, exclusivity artifacts guarantee that a Kubernetes + // cluster is only registered to a single GKE Hub. + // + // The Membership CRD is versioned, and may require conversion when the GKE + // Hub API server begins serving a newer version of the CRD and + // corresponding CR. The response will be the converted CRD and CR if there + // are any differences between the versions. + rpc GenerateExclusivityManifest(GenerateExclusivityManifestRequest) + returns (GenerateExclusivityManifestResponse) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*/memberships/*}:generateExclusivityManifest" + }; + } +} + +// Membership contains information about a member cluster. +message Membership { + option (google.api.resource) = { + type: "gkehub.googleapis.com/Membership" + pattern: "projects/{project}/locations/{location}/memberships/{membership}" + }; + + // Specifies the infrastructure type of a Membership. Infrastructure type is + // used by Hub to control infrastructure-specific behavior, including pricing. + // + // Each GKE distribution (on-GCP, on-Prem, on-X,...) will set this field + // automatically, but Attached Clusters customers should specify a type + // during registration. + enum InfrastructureType { + // No type was specified. Some Hub functionality may require a type be + // specified, and will not support Memberships with this value. + INFRASTRUCTURE_TYPE_UNSPECIFIED = 0; + + // Private infrastructure that is owned or operated by customer. This + // includes GKE distributions such as GKE-OnPrem and GKE-OnBareMetal. + ON_PREM = 1; + + // Public cloud infrastructure. + MULTI_CLOUD = 2; + } + + // Output only. The full, unique name of this Membership resource in the + // format `projects/*/locations/*/memberships/{membership_id}`, set during + // creation. + // + // `membership_id` must be a valid RFC 1123 compliant DNS label: + // + // 1. At most 63 characters in length + // 2. It must consist of lower case alphanumeric characters or `-` + // 3. It must start and end with an alphanumeric character + // + // Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, + // with a maximum length of 63 characters. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. GCP labels for this membership. + map labels = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Description of this membership, limited to 63 characters. + // Must match the regex: `[a-zA-Z0-9][a-zA-Z0-9_\-\.\ ]*` + string description = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Type of resource represented by this Membership + oneof type { + // Optional. Endpoint information to reach this member. + MembershipEndpoint endpoint = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // Output only. State of the Membership resource. + MembershipState state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. How to identify workloads from this Membership. + // See the documentation on Workload Identity for more details: + // https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity + Authority authority = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. When the Membership was created. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the Membership was last updated. + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the Membership was deleted. + google.protobuf.Timestamp delete_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. An externally-generated and managed ID for this Membership. This + // ID may be modified after creation, but this is not recommended. For GKE + // clusters, external_id is managed by the Hub API and updates will be + // ignored. + // + // The ID must match the regex: `[a-zA-Z0-9][a-zA-Z0-9_\-\.]*` + // + // If this Membership represents a Kubernetes cluster, this value should be + // set to the UID of the `kube-system` namespace object. + string external_id = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. For clusters using Connect, the timestamp of the most recent + // connection established with Google Cloud. This time is updated every + // several minutes, not continuously. For clusters that do not use GKE + // Connect, or that have never connected successfully, this field will be + // unset. + google.protobuf.Timestamp last_connection_time = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Google-generated UUID for this resource. This is unique across + // all Membership resources. If a Membership resource is deleted and another + // resource with the same name is created, it gets a different unique_id. + string unique_id = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The infrastructure type this Membership is running on. + InfrastructureType infrastructure_type = 13 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The monitoring config information for this membership. + MonitoringConfig monitoring_config = 14 + [(google.api.field_behavior) = OPTIONAL]; +} + +// MembershipEndpoint contains information needed to contact a Kubernetes API, +// endpoint and any additional Kubernetes metadata. +message MembershipEndpoint { + // Cluster information of the registered cluster. + oneof type { + // Optional. Specific information for a GKE-on-GCP cluster. + GkeCluster gke_cluster = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specific information for a GKE On-Prem cluster. An onprem + // user-cluster who has no resourceLink is not allowed to use this field, it + // should have a nil "type" instead. + OnPremCluster on_prem_cluster = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specific information for a GKE Multi-Cloud cluster. + MultiCloudCluster multi_cloud_cluster = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specific information for a Google Edge cluster. + EdgeCluster edge_cluster = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specific information for a GDC Edge Appliance cluster. + ApplianceCluster appliance_cluster = 10 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Output only. Useful Kubernetes-specific metadata. + KubernetesMetadata kubernetes_metadata = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The in-cluster Kubernetes Resources that should be applied for a + // correctly registered cluster, in the steady state. These resources: + // + // * Ensure that the cluster is exclusively registered to one and only one + // Hub Membership. + // * Propagate Workload Pool Information available in the Membership + // Authority field. + // * Ensure proper initial configuration of default Hub Features. + KubernetesResource kubernetes_resource = 6 + [(google.api.field_behavior) = OPTIONAL]; +} + +// KubernetesResource contains the YAML manifests and configuration for +// Membership Kubernetes resources in the cluster. After CreateMembership or +// UpdateMembership, these resources should be re-applied in the cluster. +message KubernetesResource { + // Input only. The YAML representation of the Membership CR. This field is + // ignored for GKE clusters where Hub can read the CR directly. + // + // Callers should provide the CR that is currently present in the cluster + // during CreateMembership or UpdateMembership, or leave this field empty if + // none exists. The CR manifest is used to validate the cluster has not been + // registered with another Membership. + string membership_cr_manifest = 1 [(google.api.field_behavior) = INPUT_ONLY]; + + // Output only. Additional Kubernetes resources that need to be applied to the + // cluster after Membership creation, and after every update. + // + // This field is only populated in the Membership returned from a successful + // long-running operation from CreateMembership or UpdateMembership. It is not + // populated during normal GetMembership or ListMemberships requests. To get + // the resource manifest after the initial registration, the caller should + // make a UpdateMembership call with an empty field mask. + repeated ResourceManifest membership_resources = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Kubernetes resources for installing the GKE Connect agent + // + // This field is only populated in the Membership returned from a successful + // long-running operation from CreateMembership or UpdateMembership. It is not + // populated during normal GetMembership or ListMemberships requests. To get + // the resource manifest after the initial registration, the caller should + // make a UpdateMembership call with an empty field mask. + repeated ResourceManifest connect_resources = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Options for Kubernetes resource generation. + ResourceOptions resource_options = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// ResourceOptions represent options for Kubernetes resource generation. +message ResourceOptions { + // Optional. The Connect agent version to use for connect_resources. Defaults + // to the latest GKE Connect version. The version must be a currently + // supported version, obsolete versions will be rejected. + string connect_version = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Use `apiextensions/v1beta1` instead of `apiextensions/v1` for + // CustomResourceDefinition resources. + // This option should be set for clusters with Kubernetes apiserver versions + // <1.16. + bool v1beta1_crd = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Major version of the Kubernetes cluster. This is only used to + // determine which version to use for the CustomResourceDefinition resources, + // `apiextensions/v1beta1` or`apiextensions/v1`. + string k8s_version = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// ResourceManifest represents a single Kubernetes resource to be applied to +// the cluster. +message ResourceManifest { + // YAML manifest of the resource. + string manifest = 1; + + // Whether the resource provided in the manifest is `cluster_scoped`. + // If unset, the manifest is assumed to be namespace scoped. + // + // This field is used for REST mapping when applying the resource in a + // cluster. + bool cluster_scoped = 2; +} + +// GkeCluster contains information specific to GKE clusters. +message GkeCluster { + // Immutable. Self-link of the GCP resource for the GKE cluster. For example: + // + // //container.googleapis.com/projects/my-project/locations/us-west1-a/clusters/my-cluster + // + // Zonal clusters are also supported. + string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. If cluster_missing is set then it denotes that the GKE cluster + // no longer exists in the GKE Control Plane. + bool cluster_missing = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// OnPremCluster contains information specific to GKE On-Prem clusters. +message OnPremCluster { + // ClusterType describes on prem cluster's type. + enum ClusterType { + // The ClusterType is not set. + CLUSTERTYPE_UNSPECIFIED = 0; + + // The ClusterType is bootstrap cluster. + BOOTSTRAP = 1; + + // The ClusterType is baremetal hybrid cluster. + HYBRID = 2; + + // The ClusterType is baremetal standalone cluster. + STANDALONE = 3; + + // The ClusterType is user cluster. + USER = 4; + } + + // Immutable. Self-link of the GCP resource for the GKE On-Prem cluster. For + // example: + // + // //gkeonprem.googleapis.com/projects/my-project/locations/us-west1-a/vmwareClusters/my-cluster + // //gkeonprem.googleapis.com/projects/my-project/locations/us-west1-a/bareMetalClusters/my-cluster + string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. If cluster_missing is set then it denotes that + // API(gkeonprem.googleapis.com) resource for this GKE On-Prem cluster no + // longer exists. + bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. Whether the cluster is an admin cluster. + bool admin_cluster = 3 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. The on prem cluster's type. + ClusterType cluster_type = 4 [(google.api.field_behavior) = IMMUTABLE]; +} + +// MultiCloudCluster contains information specific to GKE Multi-Cloud clusters. +message MultiCloudCluster { + // Immutable. Self-link of the GCP resource for the GKE Multi-Cloud cluster. + // For example: + // + // //gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/awsClusters/my-cluster + // //gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/azureClusters/my-cluster + // //gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/attachedClusters/my-cluster + string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. If cluster_missing is set then it denotes that + // API(gkemulticloud.googleapis.com) resource for this GKE Multi-Cloud cluster + // no longer exists. + bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// EdgeCluster contains information specific to Google Edge Clusters. +message EdgeCluster { + // Immutable. Self-link of the GCP resource for the Edge Cluster. For + // example: + // + // //edgecontainer.googleapis.com/projects/my-project/locations/us-west1-a/clusters/my-cluster + string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; +} + +// ApplianceCluster contains information specific to GDC Edge Appliance +// Clusters. +message ApplianceCluster { + // Immutable. Self-link of the GCP resource for the Appliance Cluster. For + // example: + // + // //transferappliance.googleapis.com/projects/my-project/locations/us-west1-a/appliances/my-appliance + string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; +} + +// KubernetesMetadata provides informational metadata for Memberships +// representing Kubernetes clusters. +message KubernetesMetadata { + // Output only. Kubernetes API server version string as reported by + // '/version'. + string kubernetes_api_server_version = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Node providerID as reported by the first node in the list of + // nodes on the Kubernetes endpoint. On Kubernetes platforms that support + // zero-node clusters (like GKE-on-GCP), the node_count will be zero and the + // node_provider_id will be empty. + string node_provider_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Node count as reported by Kubernetes nodes resources. + int32 node_count = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. vCPU count as reported by Kubernetes nodes resources. + int32 vcpu_count = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The total memory capacity as reported by the sum of all + // Kubernetes nodes resources, defined in MB. + int32 memory_mb = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which these details were last updated. This + // update_time is different from the Membership-level update_time since + // EndpointDetails are updated internally for API consumers. + google.protobuf.Timestamp update_time = 100 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Authority encodes how Google will recognize identities from this Membership. +// See the workload identity documentation for more details: +// https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity +message Authority { + // Optional. A JSON Web Token (JWT) issuer URI. `issuer` must start with + // `https://` and be a valid URL with length <2000 characters. + // + // If set, then Google will allow valid OIDC tokens from this issuer to + // authenticate within the workload_identity_pool. OIDC discovery will be + // performed on this URI to validate tokens from the issuer. + // + // Clearing `issuer` disables Workload Identity. `issuer` cannot be directly + // modified; it must be cleared (and Workload Identity disabled) before using + // a new issuer (and re-enabling Workload Identity). + string issuer = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The name of the workload identity pool in which `issuer` will + // be recognized. + // + // There is a single Workload Identity Pool per Hub that is shared + // between all Memberships that belong to that Hub. For a Hub hosted in + // {PROJECT_ID}, the workload pool format is `{PROJECT_ID}.hub.id.goog`, + // although this is subject to change in newer versions of this API. + string workload_identity_pool = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. An identity provider that reflects the `issuer` in the + // workload identity pool. + string identity_provider = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. OIDC verification keys for this Membership in JWKS format (RFC + // 7517). + // + // When this field is set, OIDC discovery will NOT be performed on `issuer`, + // and instead OIDC tokens will be validated using this field. + bytes oidc_jwks = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// This field informs Fleet-based applications/services/UIs with the necessary +// information for where each underlying Cluster reports its metrics. +message MonitoringConfig { + // Immutable. Project used to report Metrics + string project_id = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. Location used to report Metrics + string location = 2 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. Cluster name used to report metrics. + // For Anthos on VMWare/Baremetal, it would be in format + // `memberClusters/cluster_name`; And for Anthos on MultiCloud, it would be in + // format + // `{azureClusters, awsClusters}/cluster_name`. + string cluster = 3 [(google.api.field_behavior) = IMMUTABLE]; + + // Kubernetes system metrics, if available, are written to this prefix. + // This defaults to kubernetes.io for GKE, and kubernetes.io/anthos for Anthos + // eventually. Noted: Anthos MultiCloud will have kubernetes.io prefix today + // but will migration to be under kubernetes.io/anthos + string kubernetes_metrics_prefix = 4; + + // Immutable. Cluster hash, this is a unique string generated by google code, + // which does not contain any PII, which we can use to reference the cluster. + // This is expected to be created by the monitoring stack and persisted into + // the Cluster object as well as to GKE-Hub. + string cluster_hash = 5 [(google.api.field_behavior) = IMMUTABLE]; +} + +// State of the Membership resource. +message MembershipState { + // Code describes the state of a Membership resource. + enum Code { + // The code is not set. + CODE_UNSPECIFIED = 0; + + // The cluster is being registered. + CREATING = 1; + + // The cluster is registered. + READY = 2; + + // The cluster is being unregistered. + DELETING = 3; + + // The Membership is being updated. + UPDATING = 4; + + // The Membership is being updated by the Hub Service. + SERVICE_UPDATING = 5; + } + + // Output only. The current state of the Membership resource. + Code code = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // This field is never set by the Hub Service. + string description = 2 [deprecated = true]; + + // This field is never set by the Hub Service. + google.protobuf.Timestamp update_time = 3 [deprecated = true]; +} + +// Request message for `GkeHubMembershipService.ListMemberships` method. +message ListMembershipsRequest { + // Required. The parent (project and location) where the Memberships will be + // listed. Specified in the format `projects/*/locations/*`. + // `projects/*/locations/-` list memberships in all the regions. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkehub.googleapis.com/Membership" + } + ]; + + // Optional. When requesting a 'page' of resources, `page_size` specifies + // number of resources to return. If unspecified or set to 0, all resources + // will be returned. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Token returned by previous call to `ListMemberships` which + // specifies the position in the list from where to continue listing the + // resources. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Lists Memberships that match the filter expression, following the + // syntax outlined in https://google.aip.dev/160. + // + // Examples: + // + // - Name is `bar` in project `foo-proj` and location `global`: + // + // name = "projects/foo-proj/locations/global/membership/bar" + // + // - Memberships that have a label called `foo`: + // + // labels.foo:* + // + // - Memberships that have a label called `foo` whose value is `bar`: + // + // labels.foo = bar + // + // - Memberships in the CREATING state: + // + // state = CREATING + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. One or more fields to compare and use to sort the output. + // See https://google.aip.dev/132#ordering. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for the `GkeHubMembershipService.ListMemberships` method. +message ListMembershipsResponse { + // The list of matching Memberships. + repeated Membership resources = 1; + + // A token to request the next page of resources from the + // `ListMemberships` method. The value of an empty string means that + // there are no more resources to return. + string next_page_token = 2; + + // List of locations that could not be reached while fetching this list. + repeated string unreachable = 3; +} + +// Request message for `GkeHubMembershipService.GetMembership` method. +message GetMembershipRequest { + // Required. The Membership resource name in the format + // `projects/*/locations/*/memberships/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkehub.googleapis.com/Membership" + } + ]; +} + +// Request message for the `GkeHubMembershipService.CreateMembership` method. +message CreateMembershipRequest { + // Required. The parent (project and location) where the Memberships will be + // created. Specified in the format `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkehub.googleapis.com/Membership" + } + ]; + + // Required. Client chosen ID for the membership. `membership_id` must be a + // valid RFC 1123 compliant DNS label: + // + // 1. At most 63 characters in length + // 2. It must consist of lower case alphanumeric characters or `-` + // 3. It must start and end with an alphanumeric character + // + // Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, + // with a maximum length of 63 characters. + string membership_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The membership to create. + Membership resource = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for `GkeHubMembershipService.DeleteMembership` method. +message DeleteMembershipRequest { + // Required. The Membership resource name in the format + // `projects/*/locations/*/memberships/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkehub.googleapis.com/Membership" + } + ]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set to true, any subresource from this Membership will also be + // deleted. Otherwise, the request will only work if the Membership has no + // subresource. + bool force = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for `GkeHubMembershipService.UpdateMembership` method. +message UpdateMembershipRequest { + // Required. The membership resource name in the format: + // `projects/[project_id]/locations/global/memberships/[membership_id]` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkehub.googleapis.com/Membership" + } + ]; + + // Required. Mask of fields to update. At least one field path must be + // specified in this mask. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Only fields specified in update_mask are updated. + // If you specify a field in the update_mask but don't specify its value here + // that field will be deleted. + // If you are updating a map field, set the value of a key to null or empty + // string to delete the key from the map. It's not possible to update a key's + // value to the empty string. + // If you specify the update_mask to be a special path "*", fully replaces all + // user-modifiable fields to match `resource`. + Membership resource = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for `GkeHubMembershipService.GenerateConnectManifest` +// method. +message GenerateConnectManifestRequest { + // Required. The Membership resource name the Agent will associate with, in + // the format `projects/*/locations/*/memberships/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkehub.googleapis.com/Membership" + } + ]; + + // Optional. The connect agent to generate manifest for. + ConnectAgent connect_agent = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Connect agent version to use. Defaults to the most current + // version. + string version = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, generate the resources for upgrade only. Some resources + // generated only for installation (e.g. secrets) will be excluded. + bool is_upgrade = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The registry to fetch the connect agent image from. Defaults to + // gcr.io/gkeconnect. + string registry = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The image pull secret content for the registry, if not public. + bytes image_pull_secret_content = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// GenerateConnectManifestResponse contains manifest information for +// installing/upgrading a Connect agent. +message GenerateConnectManifestResponse { + // The ordered list of Kubernetes resources that need to be applied to the + // cluster for GKE Connect agent installation/upgrade. + repeated ConnectAgentResource manifest = 1; +} + +// ConnectAgentResource represents a Kubernetes resource manifest for Connect +// Agent deployment. +message ConnectAgentResource { + // Kubernetes type of the resource. + TypeMeta type = 1; + + // YAML manifest of the resource. + string manifest = 2; +} + +// TypeMeta is the type information needed for content unmarshalling of +// Kubernetes resources in the manifest. +message TypeMeta { + // Kind of the resource (e.g. Deployment). + string kind = 1; + + // APIVersion of the resource (e.g. v1). + string api_version = 2; +} + +// The information required from end users to use GKE Connect. +message ConnectAgent { + // Do not set. + string name = 1 [deprecated = true]; + + // Optional. URI of a proxy if connectivity from the agent to + // gkeconnect.googleapis.com requires the use of a proxy. Format must be in + // the form `http(s)://{proxy_address}`, depending on the HTTP/HTTPS protocol + // supported by the proxy. This will direct the connect agent's outbound + // traffic through a HTTP(S) proxy. + bytes proxy = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Namespace for GKE Connect agent resources. Defaults to + // `gke-connect`. + // + // The Connect Agent is authorized automatically when run in the default + // namespace. Otherwise, explicit authorization must be granted with an + // additional IAM binding. + string namespace = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request to validate the existing state of the membership CR in the +// cluster. +message ValidateExclusivityRequest { + // Required. The parent (project and location) where the Memberships will be + // created. Specified in the format `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkehub.googleapis.com/Membership" + } + ]; + + // Optional. The YAML of the membership CR in the cluster. Empty if the + // membership CR does not exist. + string cr_manifest = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The intended membership name under the `parent`. This method only + // does validation in anticipation of a CreateMembership call with the same + // name. + string intended_membership = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The response of exclusivity artifacts validation result status. +message ValidateExclusivityResponse { + // The validation result. + // + // * `OK` means that exclusivity is validated, assuming the manifest produced + // by GenerateExclusivityManifest is successfully applied. + // * `ALREADY_EXISTS` means that the Membership CRD is already owned by + // another Hub. See `status.message` for more information. + google.rpc.Status status = 1; +} + +// The request to generate the manifests for exclusivity artifacts. +message GenerateExclusivityManifestRequest { + // Required. The Membership resource name in the format + // `projects/*/locations/*/memberships/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkehub.googleapis.com/Membership" + } + ]; + + // Optional. The YAML manifest of the membership CRD retrieved by + // `kubectl get customresourcedefinitions membership`. + // Leave empty if the resource does not exist. + string crd_manifest = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The YAML manifest of the membership CR retrieved by + // `kubectl get memberships membership`. + // Leave empty if the resource does not exist. + string cr_manifest = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response of the exclusivity artifacts manifests for the client to apply. +message GenerateExclusivityManifestResponse { + // The YAML manifest of the membership CRD to apply if a newer version of the + // CRD is available. Empty if no update needs to be applied. + string crd_manifest = 1; + + // The YAML manifest of the membership CR to apply if a new version of the + // CR is available. Empty if no update needs to be applied. + string cr_manifest = 2; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_detail = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a + // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + // `Code.CANCELLED`. + bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.create_membership.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.create_membership.js new file mode 100644 index 00000000000..eb27b631c61 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.create_membership.js @@ -0,0 +1,93 @@ +// 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, membershipId, resource) { + // [START gkehub_v1beta1_generated_GkeHubMembershipService_CreateMembership_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 parent (project and location) where the Memberships will be + * created. Specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Required. Client chosen ID for the membership. `membership_id` must be a + * valid RFC 1123 compliant DNS label: + * 1. At most 63 characters in length + * 2. It must consist of lower case alphanumeric characters or `-` + * 3. It must start and end with an alphanumeric character + * Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, + * with a maximum length of 63 characters. + */ + // const membershipId = 'abc123' + /** + * Required. The membership to create. + */ + // const resource = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Gkehub library + const {GkeHubMembershipServiceClient} = require('@google-cloud/gke-hub').v1beta1; + + // Instantiates a client + const gkehubClient = new GkeHubMembershipServiceClient(); + + async function callCreateMembership() { + // Construct request + const request = { + parent, + membershipId, + resource, + }; + + // Run request + const [operation] = await gkehubClient.createMembership(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateMembership(); + // [END gkehub_v1beta1_generated_GkeHubMembershipService_CreateMembership_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-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.delete_membership.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.delete_membership.js new file mode 100644 index 00000000000..b2130d83ad8 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.delete_membership.js @@ -0,0 +1,83 @@ +// 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 gkehub_v1beta1_generated_GkeHubMembershipService_DeleteMembership_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 Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + */ + // const name = 'abc123' + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + /** + * Optional. If set to true, any subresource from this Membership will also be + * deleted. Otherwise, the request will only work if the Membership has no + * subresource. + */ + // const force = true + + // Imports the Gkehub library + const {GkeHubMembershipServiceClient} = require('@google-cloud/gke-hub').v1beta1; + + // Instantiates a client + const gkehubClient = new GkeHubMembershipServiceClient(); + + async function callDeleteMembership() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gkehubClient.deleteMembership(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteMembership(); + // [END gkehub_v1beta1_generated_GkeHubMembershipService_DeleteMembership_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-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.generate_connect_manifest.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.generate_connect_manifest.js new file mode 100644 index 00000000000..1619ca2c71e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.generate_connect_manifest.js @@ -0,0 +1,85 @@ +// 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 gkehub_v1beta1_generated_GkeHubMembershipService_GenerateConnectManifest_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 Membership resource name the Agent will associate with, in + * the format `projects/* /locations/* /memberships/*`. + */ + // const name = 'abc123' + /** + * Optional. The connect agent to generate manifest for. + */ + // const connectAgent = {} + /** + * Optional. The Connect agent version to use. Defaults to the most current + * version. + */ + // const version = 'abc123' + /** + * Optional. If true, generate the resources for upgrade only. Some resources + * generated only for installation (e.g. secrets) will be excluded. + */ + // const isUpgrade = true + /** + * Optional. The registry to fetch the connect agent image from. Defaults to + * gcr.io/gkeconnect. + */ + // const registry = 'abc123' + /** + * Optional. The image pull secret content for the registry, if not public. + */ + // const imagePullSecretContent = Buffer.from('string') + + // Imports the Gkehub library + const {GkeHubMembershipServiceClient} = require('@google-cloud/gke-hub').v1beta1; + + // Instantiates a client + const gkehubClient = new GkeHubMembershipServiceClient(); + + async function callGenerateConnectManifest() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkehubClient.generateConnectManifest(request); + console.log(response); + } + + callGenerateConnectManifest(); + // [END gkehub_v1beta1_generated_GkeHubMembershipService_GenerateConnectManifest_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-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.generate_exclusivity_manifest.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.generate_exclusivity_manifest.js new file mode 100644 index 00000000000..2c59eb90cf7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.generate_exclusivity_manifest.js @@ -0,0 +1,74 @@ +// 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 gkehub_v1beta1_generated_GkeHubMembershipService_GenerateExclusivityManifest_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 Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + */ + // const name = 'abc123' + /** + * Optional. The YAML manifest of the membership CRD retrieved by + * `kubectl get customresourcedefinitions membership`. + * Leave empty if the resource does not exist. + */ + // const crdManifest = 'abc123' + /** + * Optional. The YAML manifest of the membership CR retrieved by + * `kubectl get memberships membership`. + * Leave empty if the resource does not exist. + */ + // const crManifest = 'abc123' + + // Imports the Gkehub library + const {GkeHubMembershipServiceClient} = require('@google-cloud/gke-hub').v1beta1; + + // Instantiates a client + const gkehubClient = new GkeHubMembershipServiceClient(); + + async function callGenerateExclusivityManifest() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkehubClient.generateExclusivityManifest(request); + console.log(response); + } + + callGenerateExclusivityManifest(); + // [END gkehub_v1beta1_generated_GkeHubMembershipService_GenerateExclusivityManifest_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-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.get_membership.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.get_membership.js new file mode 100644 index 00000000000..47b4a34e274 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.get_membership.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 gkehub_v1beta1_generated_GkeHubMembershipService_GetMembership_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 Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + */ + // const name = 'abc123' + + // Imports the Gkehub library + const {GkeHubMembershipServiceClient} = require('@google-cloud/gke-hub').v1beta1; + + // Instantiates a client + const gkehubClient = new GkeHubMembershipServiceClient(); + + async function callGetMembership() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkehubClient.getMembership(request); + console.log(response); + } + + callGetMembership(); + // [END gkehub_v1beta1_generated_GkeHubMembershipService_GetMembership_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-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.list_memberships.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.list_memberships.js new file mode 100644 index 00000000000..12583756216 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.list_memberships.js @@ -0,0 +1,96 @@ +// 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 gkehub_v1beta1_generated_GkeHubMembershipService_ListMemberships_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 parent (project and location) where the Memberships will be + * listed. Specified in the format `projects/* /locations/*`. + * `projects/* /locations/-` list memberships in all the regions. + */ + // const parent = 'abc123' + /** + * Optional. When requesting a 'page' of resources, `page_size` specifies + * number of resources to return. If unspecified or set to 0, all resources + * will be returned. + */ + // const pageSize = 1234 + /** + * Optional. Token returned by previous call to `ListMemberships` which + * specifies the position in the list from where to continue listing the + * resources. + */ + // const pageToken = 'abc123' + /** + * Optional. Lists Memberships that match the filter expression, following the + * syntax outlined in https://google.aip.dev/160. + * Examples: + * - Name is `bar` in project `foo-proj` and location `global`: + * name = "projects/foo-proj/locations/global/membership/bar" + * - Memberships that have a label called `foo`: + * labels.foo:* + * - Memberships that have a label called `foo` whose value is `bar`: + * labels.foo = bar + * - Memberships in the CREATING state: + * state = CREATING + */ + // const filter = 'abc123' + /** + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Gkehub library + const {GkeHubMembershipServiceClient} = require('@google-cloud/gke-hub').v1beta1; + + // Instantiates a client + const gkehubClient = new GkeHubMembershipServiceClient(); + + async function callListMemberships() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gkehubClient.listMembershipsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMemberships(); + // [END gkehub_v1beta1_generated_GkeHubMembershipService_ListMemberships_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-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.update_membership.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.update_membership.js new file mode 100644 index 00000000000..31bdd476985 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.update_membership.js @@ -0,0 +1,95 @@ +// 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, updateMask, resource) { + // [START gkehub_v1beta1_generated_GkeHubMembershipService_UpdateMembership_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 membership resource name in the format: + * `projects/[project_id]/locations/global/memberships/[membership_id]` + */ + // const name = 'abc123' + /** + * Required. Mask of fields to update. At least one field path must be + * specified in this mask. + */ + // const updateMask = {} + /** + * Required. Only fields specified in update_mask are updated. + * If you specify a field in the update_mask but don't specify its value here + * that field will be deleted. + * If you are updating a map field, set the value of a key to null or empty + * string to delete the key from the map. It's not possible to update a key's + * value to the empty string. + * If you specify the update_mask to be a special path "*", fully replaces all + * user-modifiable fields to match `resource`. + */ + // const resource = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Gkehub library + const {GkeHubMembershipServiceClient} = require('@google-cloud/gke-hub').v1beta1; + + // Instantiates a client + const gkehubClient = new GkeHubMembershipServiceClient(); + + async function callUpdateMembership() { + // Construct request + const request = { + name, + updateMask, + resource, + }; + + // Run request + const [operation] = await gkehubClient.updateMembership(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateMembership(); + // [END gkehub_v1beta1_generated_GkeHubMembershipService_UpdateMembership_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-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.validate_exclusivity.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.validate_exclusivity.js new file mode 100644 index 00000000000..9246cbeddb0 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.validate_exclusivity.js @@ -0,0 +1,74 @@ +// 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, intendedMembership) { + // [START gkehub_v1beta1_generated_GkeHubMembershipService_ValidateExclusivity_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 parent (project and location) where the Memberships will be + * created. Specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Optional. The YAML of the membership CR in the cluster. Empty if the + * membership CR does not exist. + */ + // const crManifest = 'abc123' + /** + * Required. The intended membership name under the `parent`. This method only + * does validation in anticipation of a CreateMembership call with the same + * name. + */ + // const intendedMembership = 'abc123' + + // Imports the Gkehub library + const {GkeHubMembershipServiceClient} = require('@google-cloud/gke-hub').v1beta1; + + // Instantiates a client + const gkehubClient = new GkeHubMembershipServiceClient(); + + async function callValidateExclusivity() { + // Construct request + const request = { + parent, + intendedMembership, + }; + + // Run request + const response = await gkehubClient.validateExclusivity(request); + console.log(response); + } + + callValidateExclusivity(); + // [END gkehub_v1beta1_generated_GkeHubMembershipService_ValidateExclusivity_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-gkehub/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.gkehub.v1beta1.json b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.gkehub.v1beta1.json new file mode 100644 index 00000000000..4efbecc60f8 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.gkehub.v1beta1.json @@ -0,0 +1,419 @@ +{ + "clientLibrary": { + "name": "nodejs-gkehub", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.gkehub.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "gkehub_v1beta1_generated_GkeHubMembershipService_ListMemberships_async", + "title": "GkeHubMembershipService listMemberships Sample", + "origin": "API_DEFINITION", + "description": " Lists Memberships in a given project and location.", + "canonical": true, + "file": "gke_hub_membership_service.list_memberships.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 88, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMemberships", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.ListMemberships", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkehub.v1beta1.ListMembershipsResponse", + "client": { + "shortName": "GkeHubMembershipServiceClient", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClient" + }, + "method": { + "shortName": "ListMemberships", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.ListMemberships", + "service": { + "shortName": "GkeHubMembershipService", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService" + } + } + } + }, + { + "regionTag": "gkehub_v1beta1_generated_GkeHubMembershipService_GetMembership_async", + "title": "GkeHubMembershipService getMembership Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a Membership.", + "canonical": true, + "file": "gke_hub_membership_service.get_membership.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetMembership", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.GetMembership", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkehub.v1beta1.Membership", + "client": { + "shortName": "GkeHubMembershipServiceClient", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClient" + }, + "method": { + "shortName": "GetMembership", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.GetMembership", + "service": { + "shortName": "GkeHubMembershipService", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService" + } + } + } + }, + { + "regionTag": "gkehub_v1beta1_generated_GkeHubMembershipService_CreateMembership_async", + "title": "GkeHubMembershipService createMembership Sample", + "origin": "API_DEFINITION", + "description": " Creates a new Membership. **This is currently only supported for GKE clusters on Google Cloud**. To register other clusters, follow the instructions at https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster.", + "canonical": true, + "file": "gke_hub_membership_service.create_membership.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateMembership", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.CreateMembership", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "membership_id", + "type": "TYPE_STRING" + }, + { + "name": "resource", + "type": ".google.cloud.gkehub.v1beta1.Membership" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubMembershipServiceClient", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClient" + }, + "method": { + "shortName": "CreateMembership", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.CreateMembership", + "service": { + "shortName": "GkeHubMembershipService", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService" + } + } + } + }, + { + "regionTag": "gkehub_v1beta1_generated_GkeHubMembershipService_DeleteMembership_async", + "title": "GkeHubMembershipService deleteMembership Sample", + "origin": "API_DEFINITION", + "description": " Removes a Membership. **This is currently only supported for GKE clusters on Google Cloud**. To unregister other clusters, follow the instructions at https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster.", + "canonical": true, + "file": "gke_hub_membership_service.delete_membership.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteMembership", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.DeleteMembership", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubMembershipServiceClient", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClient" + }, + "method": { + "shortName": "DeleteMembership", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.DeleteMembership", + "service": { + "shortName": "GkeHubMembershipService", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService" + } + } + } + }, + { + "regionTag": "gkehub_v1beta1_generated_GkeHubMembershipService_UpdateMembership_async", + "title": "GkeHubMembershipService updateMembership Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing Membership.", + "canonical": true, + "file": "gke_hub_membership_service.update_membership.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateMembership", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.UpdateMembership", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "resource", + "type": ".google.cloud.gkehub.v1beta1.Membership" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GkeHubMembershipServiceClient", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClient" + }, + "method": { + "shortName": "UpdateMembership", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.UpdateMembership", + "service": { + "shortName": "GkeHubMembershipService", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService" + } + } + } + }, + { + "regionTag": "gkehub_v1beta1_generated_GkeHubMembershipService_GenerateConnectManifest_async", + "title": "GkeHubMembershipService generateConnectManifest Sample", + "origin": "API_DEFINITION", + "description": " Generates the manifest for deployment of the GKE connect agent. **This method is used internally by Google-provided libraries.** Most clients should not need to call this method directly.", + "canonical": true, + "file": "gke_hub_membership_service.generate_connect_manifest.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateConnectManifest", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.GenerateConnectManifest", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "connect_agent", + "type": ".google.cloud.gkehub.v1beta1.ConnectAgent" + }, + { + "name": "version", + "type": "TYPE_STRING" + }, + { + "name": "is_upgrade", + "type": "TYPE_BOOL" + }, + { + "name": "registry", + "type": "TYPE_STRING" + }, + { + "name": "image_pull_secret_content", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.gkehub.v1beta1.GenerateConnectManifestResponse", + "client": { + "shortName": "GkeHubMembershipServiceClient", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClient" + }, + "method": { + "shortName": "GenerateConnectManifest", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.GenerateConnectManifest", + "service": { + "shortName": "GkeHubMembershipService", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService" + } + } + } + }, + { + "regionTag": "gkehub_v1beta1_generated_GkeHubMembershipService_ValidateExclusivity_async", + "title": "GkeHubMembershipService validateExclusivity Sample", + "origin": "API_DEFINITION", + "description": " ValidateExclusivity validates the state of exclusivity in the cluster. The validation does not depend on an existing Hub membership resource.", + "canonical": true, + "file": "gke_hub_membership_service.validate_exclusivity.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ValidateExclusivity", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.ValidateExclusivity", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "cr_manifest", + "type": "TYPE_STRING" + }, + { + "name": "intended_membership", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkehub.v1beta1.ValidateExclusivityResponse", + "client": { + "shortName": "GkeHubMembershipServiceClient", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClient" + }, + "method": { + "shortName": "ValidateExclusivity", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.ValidateExclusivity", + "service": { + "shortName": "GkeHubMembershipService", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService" + } + } + } + }, + { + "regionTag": "gkehub_v1beta1_generated_GkeHubMembershipService_GenerateExclusivityManifest_async", + "title": "GkeHubMembershipService generateExclusivityManifest Sample", + "origin": "API_DEFINITION", + "description": " GenerateExclusivityManifest generates the manifests to update the exclusivity artifacts in the cluster if needed. Exclusivity artifacts include the Membership custom resource definition (CRD) and the singleton Membership custom resource (CR). Combined with ValidateExclusivity, exclusivity artifacts guarantee that a Kubernetes cluster is only registered to a single GKE Hub. The Membership CRD is versioned, and may require conversion when the GKE Hub API server begins serving a newer version of the CRD and corresponding CR. The response will be the converted CRD and CR if there are any differences between the versions.", + "canonical": true, + "file": "gke_hub_membership_service.generate_exclusivity_manifest.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateExclusivityManifest", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.GenerateExclusivityManifest", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "crd_manifest", + "type": "TYPE_STRING" + }, + { + "name": "cr_manifest", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkehub.v1beta1.GenerateExclusivityManifestResponse", + "client": { + "shortName": "GkeHubMembershipServiceClient", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClient" + }, + "method": { + "shortName": "GenerateExclusivityManifest", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.GenerateExclusivityManifest", + "service": { + "shortName": "GkeHubMembershipService", + "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1beta1/src/index.ts new file mode 100644 index 00000000000..f9d7fdb83fd --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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 GkeHubMembershipServiceClient = v1beta1.GkeHubMembershipServiceClient; +type GkeHubMembershipServiceClient = v1beta1.GkeHubMembershipServiceClient; +export {v1beta1, GkeHubMembershipServiceClient}; +export default {v1beta1, GkeHubMembershipServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gapic_metadata.json new file mode 100644 index 00000000000..71bee1bd2c8 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gapic_metadata.json @@ -0,0 +1,107 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.gkehub.v1beta1", + "libraryPackage": "@google-cloud/gke-hub", + "services": { + "GkeHubMembershipService": { + "clients": { + "grpc": { + "libraryClient": "GkeHubMembershipServiceClient", + "rpcs": { + "GetMembership": { + "methods": [ + "getMembership" + ] + }, + "GenerateConnectManifest": { + "methods": [ + "generateConnectManifest" + ] + }, + "ValidateExclusivity": { + "methods": [ + "validateExclusivity" + ] + }, + "GenerateExclusivityManifest": { + "methods": [ + "generateExclusivityManifest" + ] + }, + "CreateMembership": { + "methods": [ + "createMembership" + ] + }, + "DeleteMembership": { + "methods": [ + "deleteMembership" + ] + }, + "UpdateMembership": { + "methods": [ + "updateMembership" + ] + }, + "ListMemberships": { + "methods": [ + "listMemberships", + "listMembershipsStream", + "listMembershipsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "GkeHubMembershipServiceClient", + "rpcs": { + "GetMembership": { + "methods": [ + "getMembership" + ] + }, + "GenerateConnectManifest": { + "methods": [ + "generateConnectManifest" + ] + }, + "ValidateExclusivity": { + "methods": [ + "validateExclusivity" + ] + }, + "GenerateExclusivityManifest": { + "methods": [ + "generateExclusivityManifest" + ] + }, + "CreateMembership": { + "methods": [ + "createMembership" + ] + }, + "DeleteMembership": { + "methods": [ + "deleteMembership" + ] + }, + "UpdateMembership": { + "methods": [ + "updateMembership" + ] + }, + "ListMemberships": { + "methods": [ + "listMemberships", + "listMembershipsStream", + "listMembershipsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_client.ts b/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_client.ts new file mode 100644 index 00000000000..c46466f8f21 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_client.ts @@ -0,0 +1,1832 @@ +// 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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta1/gke_hub_membership_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './gke_hub_membership_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The GKE Hub MembershipService handles the registration of many Kubernetes + * clusters to Google Cloud, represented with the + * {@link protos.google.cloud.gkehub.v1beta1.Membership|Membership} resource. + * + * GKE Hub is currently available in the global region and all regions in + * https://cloud.google.com/compute/docs/regions-zones. + * + * **Membership management may be non-trivial:** it is recommended to use one + * of the Google-provided client libraries or tools where possible when working + * with Membership resources. + * @class + * @memberof v1beta1 + */ +export class GkeHubMembershipServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + gkeHubMembershipServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of GkeHubMembershipServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 GkeHubMembershipServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof GkeHubMembershipServiceClient; + 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; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + 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 = { + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + membershipPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/memberships/{membership}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // 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 = { + listMemberships: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta1/{resource=projects/*/locations/*/memberships/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta1/{resource=projects/*/locations/*/memberships/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta1/{resource=projects/*/locations/*/memberships/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createMembershipResponse = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1beta1.Membership') as gax.protobuf.Type; + const createMembershipMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1beta1.OperationMetadata') as gax.protobuf.Type; + const deleteMembershipResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteMembershipMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1beta1.OperationMetadata') as gax.protobuf.Type; + const updateMembershipResponse = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1beta1.Membership') as gax.protobuf.Type; + const updateMembershipMetadata = protoFilesRoot.lookup( + '.google.cloud.gkehub.v1beta1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createMembership: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createMembershipResponse.decode.bind(createMembershipResponse), + createMembershipMetadata.decode.bind(createMembershipMetadata)), + deleteMembership: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteMembershipResponse.decode.bind(deleteMembershipResponse), + deleteMembershipMetadata.decode.bind(deleteMembershipMetadata)), + updateMembership: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateMembershipResponse.decode.bind(updateMembershipResponse), + updateMembershipMetadata.decode.bind(updateMembershipMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.gkehub.v1beta1.GkeHubMembershipService', 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.gkeHubMembershipServiceStub) { + return this.gkeHubMembershipServiceStub; + } + + // Put together the "service stub" for + // google.cloud.gkehub.v1beta1.GkeHubMembershipService. + this.gkeHubMembershipServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.gkehub.v1beta1.GkeHubMembershipService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.gkehub.v1beta1.GkeHubMembershipService, + 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 gkeHubMembershipServiceStubMethods = + ['listMemberships', 'getMembership', 'createMembership', 'deleteMembership', 'updateMembership', 'generateConnectManifest', 'validateExclusivity', 'generateExclusivityManifest']; + for (const methodName of gkeHubMembershipServiceStubMethods) { + const callPromise = this.gkeHubMembershipServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.gkeHubMembershipServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'gkehub.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 'gkehub.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 -- + // ------------------- +/** + * Gets the details of a Membership. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1beta1.Membership|Membership}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/gke_hub_membership_service.get_membership.js + * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_GetMembership_async + */ + getMembership( + request?: protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1beta1.IMembership, + protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest|undefined, {}|undefined + ]>; + getMembership( + request: protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkehub.v1beta1.IMembership, + protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest|null|undefined, + {}|null|undefined>): void; + getMembership( + request: protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest, + callback: Callback< + protos.google.cloud.gkehub.v1beta1.IMembership, + protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest|null|undefined, + {}|null|undefined>): void; + getMembership( + request?: protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkehub.v1beta1.IMembership, + protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkehub.v1beta1.IMembership, + protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkehub.v1beta1.IMembership, + protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest|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.getMembership(request, options, callback); + } +/** + * Generates the manifest for deployment of the GKE connect agent. + * + * **This method is used internally by Google-provided libraries.** + * Most clients should not need to call this method directly. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Membership resource name the Agent will associate with, in + * the format `projects/* /locations/* /memberships/*`. + * @param {google.cloud.gkehub.v1beta1.ConnectAgent} [request.connectAgent] + * Optional. The connect agent to generate manifest for. + * @param {string} [request.version] + * Optional. The Connect agent version to use. Defaults to the most current + * version. + * @param {boolean} [request.isUpgrade] + * Optional. If true, generate the resources for upgrade only. Some resources + * generated only for installation (e.g. secrets) will be excluded. + * @param {string} [request.registry] + * Optional. The registry to fetch the connect agent image from. Defaults to + * gcr.io/gkeconnect. + * @param {Buffer} [request.imagePullSecretContent] + * Optional. The image pull secret content for the registry, if not public. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1beta1.GenerateConnectManifestResponse|GenerateConnectManifestResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/gke_hub_membership_service.generate_connect_manifest.js + * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_GenerateConnectManifest_async + */ + generateConnectManifest( + request?: protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest|undefined, {}|undefined + ]>; + generateConnectManifest( + request: protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest|null|undefined, + {}|null|undefined>): void; + generateConnectManifest( + request: protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest, + callback: Callback< + protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest|null|undefined, + {}|null|undefined>): void; + generateConnectManifest( + request?: protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestResponse, + protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest|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.generateConnectManifest(request, options, callback); + } +/** + * ValidateExclusivity validates the state of exclusivity in the cluster. + * The validation does not depend on an existing Hub membership resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) where the Memberships will be + * created. Specified in the format `projects/* /locations/*`. + * @param {string} [request.crManifest] + * Optional. The YAML of the membership CR in the cluster. Empty if the + * membership CR does not exist. + * @param {string} request.intendedMembership + * Required. The intended membership name under the `parent`. This method only + * does validation in anticipation of a CreateMembership call with the same + * name. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.gkehub.v1beta1.ValidateExclusivityResponse|ValidateExclusivityResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/gke_hub_membership_service.validate_exclusivity.js + * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_ValidateExclusivity_async + */ + validateExclusivity( + request?: protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1beta1.IValidateExclusivityResponse, + protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest|undefined, {}|undefined + ]>; + validateExclusivity( + request: protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkehub.v1beta1.IValidateExclusivityResponse, + protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest|null|undefined, + {}|null|undefined>): void; + validateExclusivity( + request: protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest, + callback: Callback< + protos.google.cloud.gkehub.v1beta1.IValidateExclusivityResponse, + protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest|null|undefined, + {}|null|undefined>): void; + validateExclusivity( + request?: protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkehub.v1beta1.IValidateExclusivityResponse, + protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkehub.v1beta1.IValidateExclusivityResponse, + protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkehub.v1beta1.IValidateExclusivityResponse, + protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest|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.validateExclusivity(request, options, callback); + } +/** + * GenerateExclusivityManifest generates the manifests to update the + * exclusivity artifacts in the cluster if needed. + * + * Exclusivity artifacts include the Membership custom resource definition + * (CRD) and the singleton Membership custom resource (CR). Combined with + * ValidateExclusivity, exclusivity artifacts guarantee that a Kubernetes + * cluster is only registered to a single GKE Hub. + * + * The Membership CRD is versioned, and may require conversion when the GKE + * Hub API server begins serving a newer version of the CRD and + * corresponding CR. The response will be the converted CRD and CR if there + * are any differences between the versions. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + * @param {string} [request.crdManifest] + * Optional. The YAML manifest of the membership CRD retrieved by + * `kubectl get customresourcedefinitions membership`. + * Leave empty if the resource does not exist. + * @param {string} [request.crManifest] + * Optional. The YAML manifest of the membership CR retrieved by + * `kubectl get memberships membership`. + * Leave empty if the resource does not exist. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestResponse|GenerateExclusivityManifestResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/gke_hub_membership_service.generate_exclusivity_manifest.js + * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_GenerateExclusivityManifest_async + */ + generateExclusivityManifest( + request?: protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestResponse, + protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest|undefined, {}|undefined + ]>; + generateExclusivityManifest( + request: protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestResponse, + protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest|null|undefined, + {}|null|undefined>): void; + generateExclusivityManifest( + request: protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest, + callback: Callback< + protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestResponse, + protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest|null|undefined, + {}|null|undefined>): void; + generateExclusivityManifest( + request?: protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestResponse, + protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestResponse, + protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestResponse, + protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest|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.generateExclusivityManifest(request, options, callback); + } + +/** + * Creates a new Membership. + * + * **This is currently only supported for GKE clusters on Google Cloud**. + * To register other clusters, follow the instructions at + * https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) where the Memberships will be + * created. Specified in the format `projects/* /locations/*`. + * @param {string} request.membershipId + * Required. Client chosen ID for the membership. `membership_id` must be a + * valid RFC 1123 compliant DNS label: + * + * 1. At most 63 characters in length + * 2. It must consist of lower case alphanumeric characters or `-` + * 3. It must start and end with an alphanumeric character + * + * Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, + * with a maximum length of 63 characters. + * @param {google.cloud.gkehub.v1beta1.Membership} request.resource + * Required. The membership to create. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/gke_hub_membership_service.create_membership.js + * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_CreateMembership_async + */ + createMembership( + request?: protos.google.cloud.gkehub.v1beta1.ICreateMembershipRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createMembership( + request: protos.google.cloud.gkehub.v1beta1.ICreateMembershipRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMembership( + request: protos.google.cloud.gkehub.v1beta1.ICreateMembershipRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMembership( + request?: protos.google.cloud.gkehub.v1beta1.ICreateMembershipRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createMembership(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createMembership()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/gke_hub_membership_service.create_membership.js + * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_CreateMembership_async + */ + async checkCreateMembershipProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMembership, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Removes a Membership. + * + * **This is currently only supported for GKE clusters on Google Cloud**. + * To unregister other clusters, follow the instructions at + * https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Membership resource name in the format + * `projects/* /locations/* /memberships/*`. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.force] + * Optional. If set to true, any subresource from this Membership will also be + * deleted. Otherwise, the request will only work if the Membership has no + * subresource. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/gke_hub_membership_service.delete_membership.js + * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_DeleteMembership_async + */ + deleteMembership( + request?: protos.google.cloud.gkehub.v1beta1.IDeleteMembershipRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteMembership( + request: protos.google.cloud.gkehub.v1beta1.IDeleteMembershipRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteMembership( + request: protos.google.cloud.gkehub.v1beta1.IDeleteMembershipRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteMembership( + request?: protos.google.cloud.gkehub.v1beta1.IDeleteMembershipRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteMembership(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteMembership()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/gke_hub_membership_service.delete_membership.js + * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_DeleteMembership_async + */ + async checkDeleteMembershipProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteMembership, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an existing Membership. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The membership resource name in the format: + * `projects/[project_id]/locations/global/memberships/[membership_id]` + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. At least one field path must be + * specified in this mask. + * @param {google.cloud.gkehub.v1beta1.Membership} request.resource + * Required. Only fields specified in update_mask are updated. + * If you specify a field in the update_mask but don't specify its value here + * that field will be deleted. + * If you are updating a map field, set the value of a key to null or empty + * string to delete the key from the map. It's not possible to update a key's + * value to the empty string. + * If you specify the update_mask to be a special path "*", fully replaces all + * user-modifiable fields to match `resource`. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/gke_hub_membership_service.update_membership.js + * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_UpdateMembership_async + */ + updateMembership( + request?: protos.google.cloud.gkehub.v1beta1.IUpdateMembershipRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateMembership( + request: protos.google.cloud.gkehub.v1beta1.IUpdateMembershipRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMembership( + request: protos.google.cloud.gkehub.v1beta1.IUpdateMembershipRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMembership( + request?: protos.google.cloud.gkehub.v1beta1.IUpdateMembershipRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateMembership(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateMembership()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/gke_hub_membership_service.update_membership.js + * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_UpdateMembership_async + */ + async checkUpdateMembershipProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMembership, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists Memberships in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) where the Memberships will be + * listed. Specified in the format `projects/* /locations/*`. + * `projects/* /locations/-` list memberships in all the regions. + * @param {number} [request.pageSize] + * Optional. When requesting a 'page' of resources, `page_size` specifies + * number of resources to return. If unspecified or set to 0, all resources + * will be returned. + * @param {string} [request.pageToken] + * Optional. Token returned by previous call to `ListMemberships` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} [request.filter] + * Optional. Lists Memberships that match the filter expression, following the + * syntax outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Name is `bar` in project `foo-proj` and location `global`: + * + * name = "projects/foo-proj/locations/global/membership/bar" + * + * - Memberships that have a label called `foo`: + * + * labels.foo:* + * + * - Memberships that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * + * - Memberships in the CREATING state: + * + * state = CREATING + * @param {string} [request.orderBy] + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1beta1.Membership|Membership}. + * 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 `listMembershipsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMemberships( + request?: protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkehub.v1beta1.IMembership[], + protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest|null, + protos.google.cloud.gkehub.v1beta1.IListMembershipsResponse + ]>; + listMemberships( + request: protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, + protos.google.cloud.gkehub.v1beta1.IListMembershipsResponse|null|undefined, + protos.google.cloud.gkehub.v1beta1.IMembership>): void; + listMemberships( + request: protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, + callback: PaginationCallback< + protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, + protos.google.cloud.gkehub.v1beta1.IListMembershipsResponse|null|undefined, + protos.google.cloud.gkehub.v1beta1.IMembership>): void; + listMemberships( + request?: protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, + protos.google.cloud.gkehub.v1beta1.IListMembershipsResponse|null|undefined, + protos.google.cloud.gkehub.v1beta1.IMembership>, + callback?: PaginationCallback< + protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, + protos.google.cloud.gkehub.v1beta1.IListMembershipsResponse|null|undefined, + protos.google.cloud.gkehub.v1beta1.IMembership>): + Promise<[ + protos.google.cloud.gkehub.v1beta1.IMembership[], + protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest|null, + protos.google.cloud.gkehub.v1beta1.IListMembershipsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listMemberships(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) where the Memberships will be + * listed. Specified in the format `projects/* /locations/*`. + * `projects/* /locations/-` list memberships in all the regions. + * @param {number} [request.pageSize] + * Optional. When requesting a 'page' of resources, `page_size` specifies + * number of resources to return. If unspecified or set to 0, all resources + * will be returned. + * @param {string} [request.pageToken] + * Optional. Token returned by previous call to `ListMemberships` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} [request.filter] + * Optional. Lists Memberships that match the filter expression, following the + * syntax outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Name is `bar` in project `foo-proj` and location `global`: + * + * name = "projects/foo-proj/locations/global/membership/bar" + * + * - Memberships that have a label called `foo`: + * + * labels.foo:* + * + * - Memberships that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * + * - Memberships in the CREATING state: + * + * state = CREATING + * @param {string} [request.orderBy] + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 protos.google.cloud.gkehub.v1beta1.Membership|Membership} 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 `listMembershipsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMembershipsStream( + request?: protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, + 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['listMemberships']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMemberships.createStream( + this.innerApiCalls.listMemberships as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMemberships`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) where the Memberships will be + * listed. Specified in the format `projects/* /locations/*`. + * `projects/* /locations/-` list memberships in all the regions. + * @param {number} [request.pageSize] + * Optional. When requesting a 'page' of resources, `page_size` specifies + * number of resources to return. If unspecified or set to 0, all resources + * will be returned. + * @param {string} [request.pageToken] + * Optional. Token returned by previous call to `ListMemberships` which + * specifies the position in the list from where to continue listing the + * resources. + * @param {string} [request.filter] + * Optional. Lists Memberships that match the filter expression, following the + * syntax outlined in https://google.aip.dev/160. + * + * Examples: + * + * - Name is `bar` in project `foo-proj` and location `global`: + * + * name = "projects/foo-proj/locations/global/membership/bar" + * + * - Memberships that have a label called `foo`: + * + * labels.foo:* + * + * - Memberships that have a label called `foo` whose value is `bar`: + * + * labels.foo = bar + * + * - Memberships in the CREATING state: + * + * state = CREATING + * @param {string} [request.orderBy] + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkehub.v1beta1.Membership|Membership}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/gke_hub_membership_service.list_memberships.js + * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_ListMemberships_async + */ + listMembershipsAsync( + request?: protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, + 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['listMemberships']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMemberships.asyncIterate( + this.innerApiCalls['listMemberships'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified membership resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} membership + * @returns {string} Resource name string. + */ + membershipPath(project:string,location:string,membership:string) { + return this.pathTemplates.membershipPathTemplate.render({ + project: project, + location: location, + membership: membership, + }); + } + + /** + * Parse the project from Membership resource. + * + * @param {string} membershipName + * A fully-qualified path representing Membership resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMembershipName(membershipName: string) { + return this.pathTemplates.membershipPathTemplate.match(membershipName).project; + } + + /** + * Parse the location from Membership resource. + * + * @param {string} membershipName + * A fully-qualified path representing Membership resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMembershipName(membershipName: string) { + return this.pathTemplates.membershipPathTemplate.match(membershipName).location; + } + + /** + * Parse the membership from Membership resource. + * + * @param {string} membershipName + * A fully-qualified path representing Membership resource. + * @returns {string} A string representing the membership. + */ + matchMembershipFromMembershipName(membershipName: string) { + return this.pathTemplates.membershipPathTemplate.match(membershipName).membership; + } + + /** + * 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; + } + + /** + * 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.gkeHubMembershipServiceStub && !this._terminated) { + return this.gkeHubMembershipServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_client_config.json b/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_client_config.json new file mode 100644 index 00000000000..2e4ba5b9b3b --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_client_config.json @@ -0,0 +1,78 @@ +{ + "interfaces": { + "google.cloud.gkehub.v1beta1.GkeHubMembershipService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListMemberships": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetMembership": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateMembership": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteMembership": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdateMembership": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GenerateConnectManifest": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ValidateExclusivity": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GenerateExclusivityManifest": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_proto_list.json b/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_proto_list.json new file mode 100644 index 00000000000..7b0d06d80b9 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/gkehub/v1beta1/membership.proto" +] diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/index.ts new file mode 100644 index 00000000000..d874e36f1dc --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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 {GkeHubMembershipServiceClient} from './gke_hub_membership_service_client'; diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..633c527623d --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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 gkehub = require('@google-cloud/gke-hub'); + +function main() { + const gkeHubMembershipServiceClient = new gkehub.GkeHubMembershipServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..35038790ed4 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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 {GkeHubMembershipServiceClient} from '@google-cloud/gke-hub'; + +// check that the client class type name can be used +function doStuffWithGkeHubMembershipServiceClient(client: GkeHubMembershipServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const gkeHubMembershipServiceClient = new GkeHubMembershipServiceClient(); + doStuffWithGkeHubMembershipServiceClient(gkeHubMembershipServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1beta1/test/gapic_gke_hub_membership_service_v1beta1.ts b/owl-bot-staging/google-cloud-gkehub/v1beta1/test/gapic_gke_hub_membership_service_v1beta1.ts new file mode 100644 index 00000000000..ba8cc5166f2 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/v1beta1/test/gapic_gke_hub_membership_service_v1beta1.ts @@ -0,0 +1,2166 @@ +// 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 gkehubmembershipserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta1.GkeHubMembershipServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.gkeHubMembershipServiceStub, undefined); + await client.initialize(); + assert(client.gkeHubMembershipServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.gkeHubMembershipServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.gkeHubMembershipServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + 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 gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + 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('getMembership', () => { + it('invokes getMembership without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.GetMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GetMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.Membership() + ); + client.innerApiCalls.getMembership = stubSimpleCall(expectedResponse); + const [response] = await client.getMembership(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMembership without error using callback', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.GetMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GetMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.Membership() + ); + client.innerApiCalls.getMembership = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMembership( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1beta1.IMembership|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMembership with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.GetMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GetMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMembership = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getMembership(request), expectedError); + const actualRequest = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMembership with closed client', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.GetMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GetMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getMembership(request), expectedError); + }); + }); + + describe('generateConnectManifest', () => { + it('invokes generateConnectManifest without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.GenerateConnectManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GenerateConnectManifestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.GenerateConnectManifestResponse() + ); + client.innerApiCalls.generateConnectManifest = stubSimpleCall(expectedResponse); + const [response] = await client.generateConnectManifest(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateConnectManifest without error using callback', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.GenerateConnectManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GenerateConnectManifestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.GenerateConnectManifestResponse() + ); + client.innerApiCalls.generateConnectManifest = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateConnectManifest( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateConnectManifest with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.GenerateConnectManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GenerateConnectManifestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateConnectManifest = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateConnectManifest(request), expectedError); + const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateConnectManifest with closed client', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.GenerateConnectManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GenerateConnectManifestRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateConnectManifest(request), expectedError); + }); + }); + + describe('validateExclusivity', () => { + it('invokes validateExclusivity without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.ValidateExclusivityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ValidateExclusivityRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.ValidateExclusivityResponse() + ); + client.innerApiCalls.validateExclusivity = stubSimpleCall(expectedResponse); + const [response] = await client.validateExclusivity(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.validateExclusivity as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.validateExclusivity as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes validateExclusivity without error using callback', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.ValidateExclusivityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ValidateExclusivityRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.ValidateExclusivityResponse() + ); + client.innerApiCalls.validateExclusivity = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.validateExclusivity( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1beta1.IValidateExclusivityResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.validateExclusivity as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.validateExclusivity as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes validateExclusivity with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.ValidateExclusivityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ValidateExclusivityRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.validateExclusivity = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.validateExclusivity(request), expectedError); + const actualRequest = (client.innerApiCalls.validateExclusivity as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.validateExclusivity as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes validateExclusivity with closed client', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.ValidateExclusivityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ValidateExclusivityRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.validateExclusivity(request), expectedError); + }); + }); + + describe('generateExclusivityManifest', () => { + it('invokes generateExclusivityManifest without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestResponse() + ); + client.innerApiCalls.generateExclusivityManifest = stubSimpleCall(expectedResponse); + const [response] = await client.generateExclusivityManifest(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateExclusivityManifest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateExclusivityManifest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateExclusivityManifest without error using callback', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestResponse() + ); + client.innerApiCalls.generateExclusivityManifest = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateExclusivityManifest( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateExclusivityManifest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateExclusivityManifest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateExclusivityManifest with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateExclusivityManifest = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateExclusivityManifest(request), expectedError); + const actualRequest = (client.innerApiCalls.generateExclusivityManifest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateExclusivityManifest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateExclusivityManifest with closed client', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateExclusivityManifest(request), expectedError); + }); + }); + + describe('createMembership', () => { + it('invokes createMembership without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.CreateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.CreateMembershipRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMembership = stubLongRunningCall(expectedResponse); + const [operation] = await client.createMembership(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMembership without error using callback', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.CreateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.CreateMembershipRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMembership = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMembership( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMembership with call error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.CreateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.CreateMembershipRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMembership = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createMembership(request), expectedError); + const actualRequest = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMembership with LRO error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.CreateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.CreateMembershipRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMembership = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createMembership(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateMembershipProgress without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateMembershipProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateMembershipProgress with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateMembershipProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteMembership', () => { + it('invokes deleteMembership without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.DeleteMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.DeleteMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteMembership = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteMembership(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteMembership without error using callback', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.DeleteMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.DeleteMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteMembership = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteMembership( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteMembership with call error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.DeleteMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.DeleteMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMembership = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteMembership(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteMembership with LRO error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.DeleteMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.DeleteMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMembership = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteMembership(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteMembershipProgress without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteMembershipProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteMembershipProgress with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteMembershipProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateMembership', () => { + it('invokes updateMembership without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.UpdateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.UpdateMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMembership = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateMembership(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMembership without error using callback', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.UpdateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.UpdateMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMembership = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMembership( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMembership with call error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.UpdateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.UpdateMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMembership = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateMembership(request), expectedError); + const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMembership with LRO error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.UpdateMembershipRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.UpdateMembershipRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMembership = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateMembership(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateMembershipProgress without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateMembershipProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateMembershipProgress with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateMembershipProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listMemberships', () => { + it('invokes listMemberships without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), + ]; + client.innerApiCalls.listMemberships = stubSimpleCall(expectedResponse); + const [response] = await client.listMemberships(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMemberships without error using callback', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), + ]; + client.innerApiCalls.listMemberships = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMemberships( + request, + (err?: Error|null, result?: protos.google.cloud.gkehub.v1beta1.IMembership[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMemberships with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMemberships = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMemberships(request), expectedError); + const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMembershipsStream without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), + ]; + client.descriptors.page.listMemberships.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMembershipsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkehub.v1beta1.Membership[] = []; + stream.on('data', (response: protos.google.cloud.gkehub.v1beta1.Membership) => { + 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.listMemberships.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMemberships, request)); + assert( + (client.descriptors.page.listMemberships.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listMembershipsStream with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMemberships.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMembershipsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkehub.v1beta1.Membership[] = []; + stream.on('data', (response: protos.google.cloud.gkehub.v1beta1.Membership) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMemberships.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMemberships, request)); + assert( + (client.descriptors.page.listMemberships.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMemberships without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), + generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), + ]; + client.descriptors.page.listMemberships.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkehub.v1beta1.IMembership[] = []; + const iterable = client.listMembershipsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMemberships with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkehub.v1beta1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMemberships.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMembershipsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkehub.v1beta1.IMembership[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('membership', () => { + const fakePath = "/rendered/path/membership"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + membership: "membershipValue", + }; + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.membershipPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.membershipPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('membershipPath', () => { + const result = client.membershipPath("projectValue", "locationValue", "membershipValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.membershipPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromMembershipName', () => { + const result = client.matchProjectFromMembershipName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromMembershipName', () => { + const result = client.matchLocationFromMembershipName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMembershipFromMembershipName', () => { + const result = client.matchMembershipFromMembershipName(fakePath); + assert.strictEqual(result, "membershipValue"); + assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ + 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)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-gkehub/v1beta1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/webpack.config.js new file mode 100644 index 00000000000..24ccc7dadcc --- /dev/null +++ b/owl-bot-staging/google-cloud-gkehub/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: 'GkeHubMembershipService', + filename: './gke-hub-membership-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-gkemulticloud/v1/.eslintignore b/owl-bot-staging/google-cloud-gkemulticloud/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/.eslintrc.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/.gitignore b/owl-bot-staging/google-cloud-gkemulticloud/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/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-gkemulticloud/v1/.jsdoc.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/.jsdoc.js new file mode 100644 index 00000000000..01cb6ab3fa1 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/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/gkemulticloud', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/.mocharc.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/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-gkemulticloud/v1/.prettierrc.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/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-gkemulticloud/v1/README.md b/owl-bot-staging/google-cloud-gkemulticloud/v1/README.md new file mode 100644 index 00000000000..2e8a88145db --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/README.md @@ -0,0 +1 @@ +Gkemulticloud: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/package.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/package.json new file mode 100644 index 00000000000..132b8effb6a --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/package.json @@ -0,0 +1,60 @@ +{ + "name": "@google-cloud/gkemulticloud", + "version": "0.1.0", + "description": "Gkemulticloud client for Node.js", + "repository": "googleapis/nodejs-gkemulticloud", + "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 gkemulticloud", + "gkemulticloud", + "attached clusters", + "aws clusters", + "azure clusters" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/attached_resources.proto b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/attached_resources.proto new file mode 100644 index 00000000000..adca2ee9027 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/attached_resources.proto @@ -0,0 +1,230 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.gkemulticloud.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/gkemulticloud/v1/common_resources.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeMultiCloud.V1"; +option go_package = "cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb;gkemulticloudpb"; +option java_multiple_files = true; +option java_outer_classname = "AttachedResourcesProto"; +option java_package = "com.google.cloud.gkemulticloud.v1"; +option php_namespace = "Google\\Cloud\\GkeMultiCloud\\V1"; +option ruby_package = "Google::Cloud::GkeMultiCloud::V1"; + +// An Anthos cluster running on customer own infrastructure. +message AttachedCluster { + option (google.api.resource) = { + type: "gkemulticloud.googleapis.com/AttachedCluster" + pattern: "projects/{project}/locations/{location}/attachedClusters/{attached_cluster}" + }; + + // The lifecycle state of the cluster. + enum State { + // Not set. + STATE_UNSPECIFIED = 0; + + // The PROVISIONING state indicates the cluster is being registered. + PROVISIONING = 1; + + // The RUNNING state indicates the cluster has been register and is fully + // usable. + RUNNING = 2; + + // The RECONCILING state indicates that some work is actively being done on + // the cluster, such as upgrading software components. + RECONCILING = 3; + + // The STOPPING state indicates the cluster is being de-registered. + STOPPING = 4; + + // The ERROR state indicates the cluster is in a broken unrecoverable + // state. + ERROR = 5; + + // The DEGRADED state indicates the cluster requires user action to + // restore full functionality. + DEGRADED = 6; + } + + // The name of this resource. + // + // Cluster names are formatted as + // `projects//locations//attachedClusters/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud Platform resource names. + string name = 1; + + // Optional. A human readable description of this cluster. + // Cannot be longer than 255 UTF-8 encoded bytes. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. OpenID Connect (OIDC) configuration for the cluster. + AttachedOidcConfig oidc_config = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + // + // You can list all supported versions on a given Google Cloud region by + // calling + // [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + string platform_version = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Kubernetes distribution of the underlying attached cluster. + // + // Supported values: ["eks", "aks"]. + string distribution = 16 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The region where this cluster runs. + // + // For EKS clusters, this is a AWS region. For AKS clusters, + // this is an Azure region. + string cluster_region = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Fleet configuration. + Fleet fleet = 5 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The current state of the cluster. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A globally unique identifier for the cluster. + string uid = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. If set, there are currently changes in flight to the cluster. + bool reconciling = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this cluster was registered. + google.protobuf.Timestamp create_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this cluster was last updated. + google.protobuf.Timestamp update_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Allows clients to perform consistent read-modify-writes + // through optimistic concurrency control. + // + // Can be sent on update and delete requests to ensure the + // client has an up-to-date value before proceeding. + string etag = 11; + + // Output only. The Kubernetes version of the cluster. + string kubernetes_version = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Annotations on the cluster. + // + // This field has the same restrictions as Kubernetes annotations. + // The total size of all keys and values combined is limited to 256k. + // Key can have 2 segments: prefix (optional) and name (required), + // separated by a slash (/). + // Prefix must be a DNS subdomain. + // Name must be 63 characters or less, begin and end with alphanumerics, + // with dashes (-), underscores (_), dots (.), and alphanumerics between. + map annotations = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Workload Identity settings. + WorkloadIdentityConfig workload_identity_config = 14 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Logging configuration for this cluster. + LoggingConfig logging_config = 15 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. A set of errors found in the cluster. + repeated AttachedClusterError errors = 20 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Configuration related to the cluster RBAC settings. + AttachedClustersAuthorization authorization = 21 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Monitoring configuration for this cluster. + MonitoringConfig monitoring_config = 23 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Configuration related to the cluster RBAC settings. +message AttachedClustersAuthorization { + // Required. Users that can perform operations as a cluster admin. A managed + // ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole + // to the users. Up to ten admin users can be provided. + // + // For more info on RBAC, see + // https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles + repeated AttachedClusterUser admin_users = 1 + [(google.api.field_behavior) = REQUIRED]; +} + +// Identities of a user-type subject for Attached clusters. +message AttachedClusterUser { + // Required. The name of the user, e.g. `my-gcp-id@gmail.com`. + string username = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// OIDC discovery information of the target cluster. +// +// Kubernetes Service Account (KSA) tokens are JWT tokens signed by the cluster +// API server. This fields indicates how Google Cloud Platform services +// validate KSA tokens in order to allow system workloads (such as GKE Connect +// and telemetry agents) to authenticate back to Google Cloud Platform. +// +// Both clusters with public and private issuer URLs are supported. +// Clusters with public issuers only need to specify the `issuer_url` field +// while clusters with private issuers need to provide both +// `issuer_url` and `oidc_jwks`. +message AttachedOidcConfig { + // A JSON Web Token (JWT) issuer URI. `issuer` must start with `https://`. + string issuer_url = 1; + + // Optional. OIDC verification keys in JWKS format (RFC 7517). + // It contains a list of OIDC verification keys that can be used to verify + // OIDC JWTs. + // + // This field is required for cluster that doesn't have a publicly available + // discovery endpoint. When provided, it will be directly used + // to verify the OIDC JWT asserted by the IDP. + bytes jwks = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// AttachedServerConfig provides information about supported +// Kubernetes versions +message AttachedServerConfig { + option (google.api.resource) = { + type: "gkemulticloud.googleapis.com/AttachedServerConfig" + pattern: "projects/{project}/locations/{location}/attachedServerConfig" + }; + + // The resource name of the config. + string name = 1; + + // List of valid platform versions. + repeated AttachedPlatformVersionInfo valid_versions = 2; +} + +// Information about a supported Attached Clusters platform version. +message AttachedPlatformVersionInfo { + // Platform version name. + string version = 1; +} + +// AttachedClusterError describes errors found on attached clusters. +message AttachedClusterError { + // Human-friendly description of the error. + string message = 1; +} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/attached_service.proto b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/attached_service.proto new file mode 100644 index 00000000000..175be6d4e44 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/attached_service.proto @@ -0,0 +1,432 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.gkemulticloud.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/gkemulticloud/v1/attached_resources.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.GkeMultiCloud.V1"; +option go_package = "cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb;gkemulticloudpb"; +option java_multiple_files = true; +option java_outer_classname = "AttachedServiceProto"; +option java_package = "com.google.cloud.gkemulticloud.v1"; +option php_namespace = "Google\\Cloud\\GkeMultiCloud\\V1"; +option ruby_package = "Google::Cloud::GkeMultiCloud::V1"; + +// The AttachedClusters API provides a single centrally managed service +// to register and manage Anthos attached clusters that run on customer's owned +// infrastructure. +service AttachedClusters { + option (google.api.default_host) = "gkemulticloud.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a new + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + // on a given Google Cloud Platform project and region. + // + // If successful, the response contains a newly created + // [Operation][google.longrunning.Operation] resource that can be + // described to track the status of the operation. + rpc CreateAttachedCluster(CreateAttachedClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/attachedClusters" + body: "attached_cluster" + }; + option (google.api.method_signature) = + "parent,attached_cluster,attached_cluster_id"; + option (google.longrunning.operation_info) = { + response_type: "AttachedCluster" + metadata_type: "OperationMetadata" + }; + } + + // Updates an + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]. + rpc UpdateAttachedCluster(UpdateAttachedClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{attached_cluster.name=projects/*/locations/*/attachedClusters/*}" + body: "attached_cluster" + }; + option (google.api.method_signature) = "attached_cluster,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "AttachedCluster" + metadata_type: "OperationMetadata" + }; + } + + // Imports creates a new + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + // by importing an existing Fleet Membership resource. + // + // Attached Clusters created before the introduction of the Anthos Multi-Cloud + // API can be imported through this method. + // + // If successful, the response contains a newly created + // [Operation][google.longrunning.Operation] resource that can be + // described to track the status of the operation. + rpc ImportAttachedCluster(ImportAttachedClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/attachedClusters:import" + body: "*" + }; + option (google.api.method_signature) = "parent,fleet_membership"; + option (google.longrunning.operation_info) = { + response_type: "AttachedCluster" + metadata_type: "OperationMetadata" + }; + } + + // Describes a specific + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource. + rpc GetAttachedCluster(GetAttachedClusterRequest) returns (AttachedCluster) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/attachedClusters/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] + // resources on a given Google Cloud project and region. + rpc ListAttachedClusters(ListAttachedClustersRequest) + returns (ListAttachedClustersResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/attachedClusters" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a specific + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource. + // + // If successful, the response contains a newly created + // [Operation][google.longrunning.Operation] resource that can be + // described to track the status of the operation. + rpc DeleteAttachedCluster(DeleteAttachedClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/attachedClusters/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Returns information, such as supported Kubernetes versions, on a given + // Google Cloud location. + rpc GetAttachedServerConfig(GetAttachedServerConfigRequest) + returns (AttachedServerConfig) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/attachedServerConfig}" + }; + option (google.api.method_signature) = "name"; + } + + // Generates the install manifest to be installed on the target cluster. + rpc GenerateAttachedClusterInstallManifest( + GenerateAttachedClusterInstallManifestRequest) + returns (GenerateAttachedClusterInstallManifestResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}:generateAttachedClusterInstallManifest" + }; + option (google.api.method_signature) = "parent,attached_cluster_id"; + } +} + +// Request message for `AttachedClusters.GenerateAttachedClusterInstallManifest` +// method. +message GenerateAttachedClusterInstallManifestRequest { + // Required. The parent location where this + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + // will be created. + // + // Location names are formatted as `projects//locations/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkemulticloud.googleapis.com/AttachedCluster" + } + ]; + + // Required. A client provided ID of the resource. Must be unique within the + // parent resource. + // + // The provided ID will be part of the + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + // name formatted as + // `projects//locations//attachedClusters/`. + // + // Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + // + // When generating an install manifest for importing an existing Membership + // resource, the attached_cluster_id field must be the Membership id. + // + // Membership names are formatted as + // `projects//locations//memberships/`. + string attached_cluster_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + // + // You can list all supported versions on a given Google Cloud region by + // calling + // [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + string platform_version = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for +// `AttachedClusters.GenerateAttachedClusterInstallManifest` method. +message GenerateAttachedClusterInstallManifestResponse { + // A set of Kubernetes resources (in YAML format) to be applied + // to the cluster to be attached. + string manifest = 1; +} + +// Request message for `AttachedClusters.CreateAttachedCluster` method. +message CreateAttachedClusterRequest { + // Required. The parent location where this + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + // will be created. + // + // Location names are formatted as `projects//locations/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkemulticloud.googleapis.com/AttachedCluster" + } + ]; + + // Required. The specification of the + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to create. + AttachedCluster attached_cluster = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A client provided ID the resource. Must be unique within the + // parent resource. + // + // The provided ID will be part of the + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + // name formatted as + // `projects//locations//attachedClusters/`. + // + // Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + string attached_cluster_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // If set, only validate the request, but do not actually create the cluster. + bool validate_only = 4; +} + +// Request message for `AttachedClusters.ImportAttachedCluster` method. +message ImportAttachedClusterRequest { + // Required. The parent location where this + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + // will be created. + // + // Location names are formatted as `projects//locations/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkemulticloud.googleapis.com/AttachedCluster" + } + ]; + + // If set, only validate the request, but do not actually import the cluster. + bool validate_only = 2; + + // Required. The name of the fleet membership resource to import. + string fleet_membership = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + // + // You can list all supported versions on a given Google Cloud region by + // calling + // [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. + string platform_version = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Kubernetes distribution of the underlying attached cluster. + // + // Supported values: ["eks", "aks"]. + string distribution = 5 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `AttachedClusters.UpdateAttachedCluster` method. +message UpdateAttachedClusterRequest { + // Required. The + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + // to update. + AttachedCluster attached_cluster = 1 [(google.api.field_behavior) = REQUIRED]; + + // If set, only validate the request, but do not actually update the cluster. + bool validate_only = 2; + + // Required. Mask of fields to update. At least one path must be supplied in + // this field. The elements of the repeated paths field can only include these + // fields from + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]: + // + // * `description`. + // * `annotations`. + // * `platform_version`. + // * `authorization.admin_users`. + // * `logging_config.component_config.enable_components`. + // * `monitoring_config.managed_prometheus_config.enabled`. + google.protobuf.FieldMask update_mask = 3 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `AttachedClusters.GetAttachedCluster` method. +message GetAttachedClusterRequest { + // Required. The name of the + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + // to describe. + // + // `AttachedCluster` names are formatted as + // `projects//locations//attachedClusters/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud Platform resource names. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkemulticloud.googleapis.com/AttachedCluster" + } + ]; +} + +// Request message for `AttachedClusters.ListAttachedClusters` method. +message ListAttachedClustersRequest { + // Required. The parent location which owns this collection of + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resources. + // + // Location names are formatted as `projects//locations/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud Platform resource names. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkemulticloud.googleapis.com/AttachedCluster" + } + ]; + + // The maximum number of items to return. + // + // If not specified, a default value of 50 will be used by the service. + // Regardless of the pageSize value, the response can include a partial list + // and a caller should only rely on response's + // [nextPageToken][google.cloud.gkemulticloud.v1.ListAttachedClustersResponse.next_page_token] + // to determine if there are more instances left to be queried. + int32 page_size = 2; + + // The `nextPageToken` value returned from a previous + // [attachedClusters.list][google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters] + // request, if any. + string page_token = 3; +} + +// Response message for `AttachedClusters.ListAttachedClusters` method. +message ListAttachedClustersResponse { + // A list of [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] + // resources in the specified Google Cloud Platform project and region region. + repeated AttachedCluster attached_clusters = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; +} + +// Request message for `AttachedClusters.DeleteAttachedCluster` method. +message DeleteAttachedClusterRequest { + // Required. The resource name the + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to delete. + // + // `AttachedCluster` names are formatted as + // `projects//locations//attachedClusters/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud Platform resource names. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkemulticloud.googleapis.com/AttachedCluster" + } + ]; + + // If set, only validate the request, but do not actually delete the resource. + bool validate_only = 2; + + // If set to true, and the + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + // is not found, the request will succeed but no action will be taken on the + // server and a completed [Operation][google.longrunning.Operation] will be + // returned. + // + // Useful for idempotent deletion. + bool allow_missing = 3; + + // If set to true, the deletion of + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource + // will succeed even if errors occur during deleting in cluster resources. + // Using this parameter may result in orphaned resources in the cluster. + bool ignore_errors = 5; + + // The current etag of the + // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]. + // + // Allows clients to perform deletions through optimistic concurrency control. + // + // If the provided etag does not match the current etag of the cluster, + // the request will fail and an ABORTED error will be returned. + string etag = 4; +} + +// GetAttachedServerConfigRequest gets the server config for attached +// clusters. +message GetAttachedServerConfigRequest { + // Required. The name of the + // [AttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedServerConfig] + // resource to describe. + // + // `AttachedServerConfig` names are formatted as + // `projects//locations//attachedServerConfig`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkemulticloud.googleapis.com/AttachedServerConfig" + } + ]; +} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/aws_resources.proto b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/aws_resources.proto new file mode 100644 index 00000000000..8989cd8643d --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/aws_resources.proto @@ -0,0 +1,627 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.gkemulticloud.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/gkemulticloud/v1/common_resources.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeMultiCloud.V1"; +option go_package = "cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb;gkemulticloudpb"; +option java_multiple_files = true; +option java_outer_classname = "AwsResourcesProto"; +option java_package = "com.google.cloud.gkemulticloud.v1"; +option php_namespace = "Google\\Cloud\\GkeMultiCloud\\V1"; +option ruby_package = "Google::Cloud::GkeMultiCloud::V1"; + +// An Anthos cluster running on AWS. +message AwsCluster { + option (google.api.resource) = { + type: "gkemulticloud.googleapis.com/AwsCluster" + pattern: "projects/{project}/locations/{location}/awsClusters/{aws_cluster}" + }; + + // The lifecycle state of the cluster. + enum State { + // Not set. + STATE_UNSPECIFIED = 0; + + // The PROVISIONING state indicates the cluster is being created. + PROVISIONING = 1; + + // The RUNNING state indicates the cluster has been created and is fully + // usable. + RUNNING = 2; + + // The RECONCILING state indicates that some work is actively being done on + // the cluster, such as upgrading the control plane replicas. + RECONCILING = 3; + + // The STOPPING state indicates the cluster is being deleted. + STOPPING = 4; + + // The ERROR state indicates the cluster is in a broken unrecoverable + // state. + ERROR = 5; + + // The DEGRADED state indicates the cluster requires user action to + // restore full functionality. + DEGRADED = 6; + } + + // The name of this resource. + // + // Cluster names are formatted as + // `projects//locations//awsClusters/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud Platform resource names. + string name = 1; + + // Optional. A human readable description of this cluster. + // Cannot be longer than 255 UTF-8 encoded bytes. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Cluster-wide networking configuration. + AwsClusterNetworking networking = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The AWS region where the cluster runs. + // + // Each Google Cloud region supports a subset of nearby AWS regions. + // You can call + // [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig] + // to list all supported AWS regions within a given Google Cloud region. + string aws_region = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. Configuration related to the cluster control plane. + AwsControlPlane control_plane = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. Configuration related to the cluster RBAC settings. + AwsAuthorization authorization = 15 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The current state of the cluster. + State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The endpoint of the cluster's API server. + string endpoint = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A globally unique identifier for the cluster. + string uid = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. If set, there are currently changes in flight to the cluster. + bool reconciling = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this cluster was created. + google.protobuf.Timestamp create_time = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this cluster was last updated. + google.protobuf.Timestamp update_time = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Allows clients to perform consistent read-modify-writes + // through optimistic concurrency control. + // + // Can be sent on update and delete requests to ensure the + // client has an up-to-date value before proceeding. + string etag = 13; + + // Optional. Annotations on the cluster. + // + // This field has the same restrictions as Kubernetes annotations. + // The total size of all keys and values combined is limited to 256k. + // Key can have 2 segments: prefix (optional) and name (required), + // separated by a slash (/). + // Prefix must be a DNS subdomain. + // Name must be 63 characters or less, begin and end with alphanumerics, + // with dashes (-), underscores (_), dots (.), and alphanumerics between. + map annotations = 14 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Workload Identity settings. + WorkloadIdentityConfig workload_identity_config = 16 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. PEM encoded x509 certificate of the cluster root of trust. + string cluster_ca_certificate = 17 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Fleet configuration. + Fleet fleet = 18 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Logging configuration for this cluster. + LoggingConfig logging_config = 19 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. A set of errors found in the cluster. + repeated AwsClusterError errors = 20 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Monitoring configuration for this cluster. + MonitoringConfig monitoring_config = 21 + [(google.api.field_behavior) = OPTIONAL]; +} + +// ControlPlane defines common parameters between control plane nodes. +message AwsControlPlane { + // Required. The Kubernetes version to run on control plane replicas + // (e.g. `1.19.10-gke.1000`). + // + // You can list all supported versions on a given Google Cloud region by + // calling + // [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig]. + string version = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The AWS instance type. + // + // When unspecified, it uses a default based on the cluster's version. + string instance_type = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. SSH configuration for how to access the underlying control plane + // machines. + AwsSshConfig ssh_config = 14 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The list of subnets where control plane replicas will run. + // A replica will be provisioned on each subnet and up to three values + // can be provided. + // Each subnet must be in a different AWS Availability Zone (AZ). + repeated string subnet_ids = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The IDs of additional security groups to add to control plane + // replicas. The Anthos Multi-Cloud API will automatically create and manage + // security groups with the minimum rules needed for a functioning cluster. + repeated string security_group_ids = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Required. The name or ARN of the AWS IAM instance profile to assign to each + // control plane replica. + string iam_instance_profile = 7 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Configuration related to the root volume provisioned for each + // control plane replica. + // + // Volumes will be provisioned in the availability zone associated + // with the corresponding subnet. + // + // When unspecified, it defaults to 32 GiB with the GP2 volume type. + AwsVolumeTemplate root_volume = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Configuration related to the main volume provisioned for each + // control plane replica. + // The main volume is in charge of storing all of the cluster's etcd state. + // + // Volumes will be provisioned in the availability zone associated + // with the corresponding subnet. + // + // When unspecified, it defaults to 8 GiB with the GP2 volume type. + AwsVolumeTemplate main_volume = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The ARN of the AWS KMS key used to encrypt cluster secrets. + AwsDatabaseEncryption database_encryption = 10 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. A set of AWS resource tags to propagate to all underlying managed + // AWS resources. + // + // Specify at most 50 pairs containing alphanumerics, spaces, and symbols + // (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to + // 255 Unicode characters. + map tags = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Authentication configuration for management of AWS resources. + AwsServicesAuthentication aws_services_authentication = 12 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. Proxy configuration for outbound HTTP(S) traffic. + AwsProxyConfig proxy_config = 16 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Config encryption for user data. + AwsConfigEncryption config_encryption = 17 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. The placement to use on control plane instances. + // When unspecified, the VPC's default tenancy will be used. + AwsInstancePlacement instance_placement = 18 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Authentication configuration for the management of AWS resources. +message AwsServicesAuthentication { + // Required. The Amazon Resource Name (ARN) of the role that the Anthos + // Multi-Cloud API will assume when managing AWS resources on your account. + string role_arn = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An identifier for the assumed role session. + // + // When unspecified, it defaults to `multicloud-service-agent`. + string role_session_name = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Configuration related to the cluster RBAC settings. +message AwsAuthorization { + // Required. Users that can perform operations as a cluster admin. A managed + // ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole + // to the users. Up to ten admin users can be provided. + // + // For more info on RBAC, see + // https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles + repeated AwsClusterUser admin_users = 1 + [(google.api.field_behavior) = REQUIRED]; +} + +// Identities of a user-type subject for AWS clusters. +message AwsClusterUser { + // Required. The name of the user, e.g. `my-gcp-id@gmail.com`. + string username = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Configuration related to application-layer secrets encryption. +message AwsDatabaseEncryption { + // Required. The ARN of the AWS KMS key used to encrypt cluster secrets. + string kms_key_arn = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Configuration template for AWS EBS volumes. +message AwsVolumeTemplate { + // Types of supported EBS volumes. We currently only support GP2 or GP3 + // volumes. + // See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html + // for more information. + enum VolumeType { + // Not set. + VOLUME_TYPE_UNSPECIFIED = 0; + + // GP2 (General Purpose SSD volume type). + GP2 = 1; + + // GP3 (General Purpose SSD volume type). + GP3 = 2; + } + + // Optional. The size of the volume, in GiBs. + // + // When unspecified, a default value is provided. See the specific reference + // in the parent resource. + int32 size_gib = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Type of the EBS volume. + // + // When unspecified, it defaults to GP2 volume. + VolumeType volume_type = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The number of I/O operations per second (IOPS) to provision for + // GP3 volume. + int32 iops = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Amazon Resource Name (ARN) of the Customer Managed Key (CMK) + // used to encrypt AWS EBS volumes. + // + // If not specified, the default Amazon managed key associated to + // the AWS region where this cluster runs will be used. + string kms_key_arn = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// ClusterNetworking defines cluster-wide networking configuration. +// +// Anthos clusters on AWS run on a single VPC. This includes control +// plane replicas and node pool nodes. +message AwsClusterNetworking { + // Required. The VPC associated with the cluster. All component clusters + // (i.e. control plane and node pools) run on a single VPC. + // + // This field cannot be changed after creation. + string vpc_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. All pods in the cluster are assigned an IPv4 address from these + // ranges. Only a single range is supported. This field cannot be changed + // after creation. + repeated string pod_address_cidr_blocks = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Required. All services in the cluster are assigned an IPv4 address from + // these ranges. Only a single range is supported. This field cannot be + // changed after creation. + repeated string service_address_cidr_blocks = 3 + [(google.api.field_behavior) = REQUIRED]; +} + +// An Anthos node pool running on AWS. +message AwsNodePool { + option (google.api.resource) = { + type: "gkemulticloud.googleapis.com/AwsNodePool" + pattern: "projects/{project}/locations/{location}/awsClusters/{aws_cluster}/awsNodePools/{aws_node_pool}" + }; + + // The lifecycle state of the node pool. + enum State { + // Not set. + STATE_UNSPECIFIED = 0; + + // The PROVISIONING state indicates the node pool is being created. + PROVISIONING = 1; + + // The RUNNING state indicates the node pool has been created + // and is fully usable. + RUNNING = 2; + + // The RECONCILING state indicates that the node pool is being reconciled. + RECONCILING = 3; + + // The STOPPING state indicates the node pool is being deleted. + STOPPING = 4; + + // The ERROR state indicates the node pool is in a broken unrecoverable + // state. + ERROR = 5; + + // The DEGRADED state indicates the node pool requires user action to + // restore full functionality. + DEGRADED = 6; + } + + // The name of this resource. + // + // Node pool names are formatted as + // `projects//locations//awsClusters//awsNodePools/`. + // + // For more details on Google Cloud resource names, + // see [Resource Names](https://cloud.google.com/apis/design/resource_names) + string name = 1; + + // Required. The Kubernetes version to run on this node pool (e.g. + // `1.19.10-gke.1000`). + // + // You can list all supported versions on a given Google Cloud region by + // calling + // [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig]. + string version = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The configuration of the node pool. + AwsNodeConfig config = 28 [(google.api.field_behavior) = REQUIRED]; + + // Required. Autoscaler configuration for this node pool. + AwsNodePoolAutoscaling autoscaling = 25 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The subnet where the node pool node run. + string subnet_id = 6 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The lifecycle state of the node pool. + State state = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A globally unique identifier for the node pool. + string uid = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. If set, there are currently changes in flight to the node + // pool. + bool reconciling = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this node pool was created. + google.protobuf.Timestamp create_time = 19 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this node pool was last updated. + google.protobuf.Timestamp update_time = 20 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Allows clients to perform consistent read-modify-writes + // through optimistic concurrency control. + // + // Can be sent on update and delete requests to ensure the + // client has an up-to-date value before proceeding. + string etag = 21; + + // Optional. Annotations on the node pool. + // + // This field has the same restrictions as Kubernetes annotations. + // The total size of all keys and values combined is limited to 256k. + // Key can have 2 segments: prefix (optional) and name (required), + // separated by a slash (/). + // Prefix must be a DNS subdomain. + // Name must be 63 characters or less, begin and end with alphanumerics, + // with dashes (-), underscores (_), dots (.), and alphanumerics between. + map annotations = 22 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The constraint on the maximum number of pods that can be run + // simultaneously on a node in the node pool. + MaxPodsConstraint max_pods_constraint = 27 + [(google.api.field_behavior) = REQUIRED]; + + // Output only. A set of errors found in the node pool. + repeated AwsNodePoolError errors = 29 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Parameters that describe the nodes in a cluster. +message AwsNodeConfig { + // Optional. The AWS instance type. + // + // When unspecified, it uses a default based on the node pool's version. + string instance_type = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Template for the root volume provisioned for node pool nodes. + // Volumes will be provisioned in the availability zone assigned + // to the node pool subnet. + // + // When unspecified, it defaults to 32 GiB with the GP2 volume type. + AwsVolumeTemplate root_volume = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The initial taints assigned to nodes of this node pool. + repeated NodeTaint taints = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The initial labels assigned to nodes of this node pool. An object + // containing a list of "key": value pairs. Example: { "name": "wrench", + // "mass": "1.3kg", "count": "3" }. + map labels = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Key/value metadata to assign to each underlying AWS resource. + // Specify at most 50 pairs containing alphanumerics, spaces, and symbols + // (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to + // 255 Unicode characters. + map tags = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The name or ARN of the AWS IAM role assigned to nodes in the + // pool. + string iam_instance_profile = 6 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The OS image type to use on node pool instances. + // Can have a value of `ubuntu`, or `windows` if the cluster enables + // the Windows node pool preview feature. + // + // When unspecified, it defaults to `ubuntu`. + string image_type = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The SSH configuration. + AwsSshConfig ssh_config = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The IDs of additional security groups to add to nodes in this + // pool. The manager will automatically create security groups with minimum + // rules needed for a functioning cluster. + repeated string security_group_ids = 10 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Proxy configuration for outbound HTTP(S) traffic. + AwsProxyConfig proxy_config = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Config encryption for user data. + AwsConfigEncryption config_encryption = 13 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. Placement related info for this node. + // When unspecified, the VPC's default tenancy will be used. + AwsInstancePlacement instance_placement = 14 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Configuration related to CloudWatch metrics collection on the + // Auto Scaling group of the node pool. + // + // When unspecified, metrics collection is disabled. + AwsAutoscalingGroupMetricsCollection autoscaling_metrics_collection = 15 + [(google.api.field_behavior) = OPTIONAL]; +} + +// AwsNodePoolAutoscaling contains information required by cluster autoscaler +// to adjust the size of the node pool to the current cluster usage. +message AwsNodePoolAutoscaling { + // Required. Minimum number of nodes in the node pool. Must be greater than or + // equal to 1 and less than or equal to max_node_count. + int32 min_node_count = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Maximum number of nodes in the node pool. Must be greater than or + // equal to min_node_count and less than or equal to 50. + int32 max_node_count = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// AwsServerConfig is the configuration of GKE cluster on AWS. +message AwsServerConfig { + option (google.api.resource) = { + type: "gkemulticloud.googleapis.com/AwsServerConfig" + pattern: "projects/{project}/locations/{location}/awsServerConfig" + }; + + // The resource name of the config. + string name = 1; + + // List of valid Kubernetes versions. + repeated AwsK8sVersionInfo valid_versions = 2; + + // The list of supported AWS regions. + repeated string supported_aws_regions = 3; +} + +// Kubernetes version information of GKE cluster on AWS. +message AwsK8sVersionInfo { + // Kubernetes version name. + string version = 1; +} + +// SSH configuration for AWS resources. +message AwsSshConfig { + // Required. The name of the EC2 key pair used to login into cluster machines. + string ec2_key_pair = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Details of a proxy config stored in AWS Secret Manager. +message AwsProxyConfig { + // The ARN of the AWS Secret Manager secret that contains the HTTP(S) proxy + // configuration. + // + // The secret must be a JSON encoded proxy configuration + // as described in + // https://cloud.google.com/anthos/clusters/docs/multi-cloud/aws/how-to/use-a-proxy#create_a_proxy_configuration_file + string secret_arn = 1; + + // The version string of the AWS Secret Manager secret that contains the + // HTTP(S) proxy configuration. + string secret_version = 2; +} + +// Config encryption for user data. +message AwsConfigEncryption { + // Required. The ARN of the AWS KMS key used to encrypt user data. + string kms_key_arn = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Details of placement information for an instance. +// Limitations for using the `host` tenancy: +// +// * T3 instances that use the unlimited CPU credit option don't support host +// tenancy. +message AwsInstancePlacement { + // Tenancy defines how EC2 instances are distributed across physical hardware. + enum Tenancy { + // Not set. + TENANCY_UNSPECIFIED = 0; + + // Use default VPC tenancy. + DEFAULT = 1; + + // Run a dedicated instance. + DEDICATED = 2; + + // Launch this instance to a dedicated host. + HOST = 3; + } + + // Required. The tenancy for instance. + Tenancy tenancy = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Configuration related to CloudWatch metrics collection in an AWS +// Auto Scaling group. +message AwsAutoscalingGroupMetricsCollection { + // Required. The frequency at which EC2 Auto Scaling sends aggregated data to + // AWS CloudWatch. The only valid value is "1Minute". + string granularity = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The metrics to enable. For a list of valid metrics, see + // https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_EnableMetricsCollection.html. + // If you specify Granularity and don't specify any metrics, all metrics are + // enabled. + repeated string metrics = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// AwsClusterError describes errors found on AWS clusters. +message AwsClusterError { + // Human-friendly description of the error. + string message = 1; +} + +// AwsNodePoolError describes errors found on AWS node pools. +message AwsNodePoolError { + // Human-friendly description of the error. + string message = 1; +} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/aws_service.proto b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/aws_service.proto new file mode 100644 index 00000000000..874f4df58e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/aws_service.proto @@ -0,0 +1,605 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.gkemulticloud.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/gkemulticloud/v1/aws_resources.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeMultiCloud.V1"; +option go_package = "cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb;gkemulticloudpb"; +option java_multiple_files = true; +option java_outer_classname = "AwsServiceProto"; +option java_package = "com.google.cloud.gkemulticloud.v1"; +option php_namespace = "Google\\Cloud\\GkeMultiCloud\\V1"; +option ruby_package = "Google::Cloud::GkeMultiCloud::V1"; + +// The AwsClusters API provides a single centrally managed service +// to create and manage Anthos clusters that run on AWS infrastructure. +service AwsClusters { + option (google.api.default_host) = "gkemulticloud.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a new [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + // resource on a given Google Cloud Platform project and region. + // + // If successful, the response contains a newly created + // [Operation][google.longrunning.Operation] resource that can be + // described to track the status of the operation. + rpc CreateAwsCluster(CreateAwsClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/awsClusters" + body: "aws_cluster" + }; + option (google.api.method_signature) = "parent,aws_cluster,aws_cluster_id"; + option (google.longrunning.operation_info) = { + response_type: "AwsCluster" + metadata_type: "OperationMetadata" + }; + } + + // Updates an [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + rpc UpdateAwsCluster(UpdateAwsClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{aws_cluster.name=projects/*/locations/*/awsClusters/*}" + body: "aws_cluster" + }; + option (google.api.method_signature) = "aws_cluster,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "AwsCluster" + metadata_type: "OperationMetadata" + }; + } + + // Describes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + // resource. + rpc GetAwsCluster(GetAwsClusterRequest) returns (AwsCluster) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/awsClusters/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources + // on a given Google Cloud project and region. + rpc ListAwsClusters(ListAwsClustersRequest) + returns (ListAwsClustersResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/awsClusters" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + // resource. + // + // Fails if the cluster has one or more associated + // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. + // + // If successful, the response contains a newly created + // [Operation][google.longrunning.Operation] resource that can be + // described to track the status of the operation. + rpc DeleteAwsCluster(DeleteAwsClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/awsClusters/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Generates a short-lived access token to authenticate to a given + // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource. + rpc GenerateAwsAccessToken(GenerateAwsAccessTokenRequest) + returns (GenerateAwsAccessTokenResponse) { + option (google.api.http) = { + get: "/v1/{aws_cluster=projects/*/locations/*/awsClusters/*}:generateAwsAccessToken" + }; + } + + // Creates a new [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool], + // attached to a given [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + // + // If successful, the response contains a newly created + // [Operation][google.longrunning.Operation] resource that can be + // described to track the status of the operation. + rpc CreateAwsNodePool(CreateAwsNodePoolRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/awsClusters/*}/awsNodePools" + body: "aws_node_pool" + }; + option (google.api.method_signature) = + "parent,aws_node_pool,aws_node_pool_id"; + option (google.longrunning.operation_info) = { + response_type: "AwsNodePool" + metadata_type: "OperationMetadata" + }; + } + + // Updates an [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]. + rpc UpdateAwsNodePool(UpdateAwsNodePoolRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{aws_node_pool.name=projects/*/locations/*/awsClusters/*/awsNodePools/*}" + body: "aws_node_pool" + }; + option (google.api.method_signature) = "aws_node_pool,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "AwsNodePool" + metadata_type: "OperationMetadata" + }; + } + + // Describes a specific + // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource. + rpc GetAwsNodePool(GetAwsNodePoolRequest) returns (AwsNodePool) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/awsClusters/*/awsNodePools/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + // resources on a given + // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + rpc ListAwsNodePools(ListAwsNodePoolsRequest) + returns (ListAwsNodePoolsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/awsClusters/*}/awsNodePools" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a specific [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + // resource. + // + // If successful, the response contains a newly created + // [Operation][google.longrunning.Operation] resource that can be + // described to track the status of the operation. + rpc DeleteAwsNodePool(DeleteAwsNodePoolRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/awsClusters/*/awsNodePools/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Returns information, such as supported AWS regions and Kubernetes + // versions, on a given Google Cloud location. + rpc GetAwsServerConfig(GetAwsServerConfigRequest) returns (AwsServerConfig) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/awsServerConfig}" + }; + option (google.api.method_signature) = "name"; + } +} + +// Request message for `AwsClusters.CreateAwsCluster` method. +message CreateAwsClusterRequest { + // Required. The parent location where this + // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource will be + // created. + // + // Location names are formatted as `projects//locations/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkemulticloud.googleapis.com/AwsCluster" + } + ]; + + // Required. The specification of the + // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to create. + AwsCluster aws_cluster = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A client provided ID the resource. Must be unique within the + // parent resource. + // + // The provided ID will be part of the + // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource name + // formatted as + // `projects//locations//awsClusters/`. + // + // Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + string aws_cluster_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // If set, only validate the request, but do not actually create the cluster. + bool validate_only = 4; +} + +// Request message for `AwsClusters.UpdateAwsCluster` method. +message UpdateAwsClusterRequest { + // Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + // resource to update. + AwsCluster aws_cluster = 1 [(google.api.field_behavior) = REQUIRED]; + + // If set, only validate the request, but do not actually update the cluster. + bool validate_only = 2; + + // Required. Mask of fields to update. At least one path must be supplied in + // this field. The elements of the repeated paths field can only include these + // fields from [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]: + // + // * `description`. + // * `annotations`. + // * `control_plane.version`. + // * `authorization.admin_users`. + // * `control_plane.aws_services_authentication.role_arn`. + // * `control_plane.aws_services_authentication.role_session_name`. + // * `control_plane.config_encryption.kms_key_arn`. + // * `control_plane.instance_type`. + // * `control_plane.security_group_ids`. + // * `control_plane.proxy_config`. + // * `control_plane.proxy_config.secret_arn`. + // * `control_plane.proxy_config.secret_version`. + // * `control_plane.root_volume.size_gib`. + // * `control_plane.root_volume.volume_type`. + // * `control_plane.root_volume.iops`. + // * `control_plane.root_volume.kms_key_arn`. + // * `control_plane.ssh_config`. + // * `control_plane.ssh_config.ec2_key_pair`. + // * `control_plane.instance_placement.tenancy`. + // * `control_plane.iam_instance_profile`. + // * `logging_config.component_config.enable_components`. + // * `control_plane.tags`. + // * `monitoring_config.managed_prometheus_config.enabled`. + google.protobuf.FieldMask update_mask = 4 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `AwsClusters.GetAwsCluster` method. +message GetAwsClusterRequest { + // Required. The name of the + // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to + // describe. + // + // `AwsCluster` names are formatted as + // `projects//locations//awsClusters/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud Platform resource names. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkemulticloud.googleapis.com/AwsCluster" + } + ]; +} + +// Request message for `AwsClusters.ListAwsClusters` method. +message ListAwsClustersRequest { + // Required. The parent location which owns this collection of + // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources. + // + // Location names are formatted as `projects//locations/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud Platform resource names. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkemulticloud.googleapis.com/AwsCluster" + } + ]; + + // The maximum number of items to return. + // + // If not specified, a default value of 50 will be used by the service. + // Regardless of the pageSize value, the response can include a partial list + // and a caller should only rely on response's + // [nextPageToken][google.cloud.gkemulticloud.v1.ListAwsClustersResponse.next_page_token] + // to determine if there are more instances left to be queried. + int32 page_size = 2; + + // The `nextPageToken` value returned from a previous + // [awsClusters.list][google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters] + // request, if any. + string page_token = 3; +} + +// Response message for `AwsClusters.ListAwsClusters` method. +message ListAwsClustersResponse { + // A list of [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources + // in the specified Google Cloud Platform project and region region. + repeated AwsCluster aws_clusters = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; +} + +// Request message for `AwsClusters.DeleteAwsCluster` method. +message DeleteAwsClusterRequest { + // Required. The resource name the + // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to delete. + // + // `AwsCluster` names are formatted as + // `projects//locations//awsClusters/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud Platform resource names. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkemulticloud.googleapis.com/AwsCluster" + } + ]; + + // If set, only validate the request, but do not actually delete the resource. + bool validate_only = 2; + + // If set to true, and the + // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource is not + // found, the request will succeed but no action will be taken on the server + // and a completed [Operation][google.longrunning.Operation] will be returned. + // + // Useful for idempotent deletion. + bool allow_missing = 3; + + // The current etag of the + // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. + // + // Allows clients to perform deletions through optimistic concurrency control. + // + // If the provided etag does not match the current etag of the cluster, + // the request will fail and an ABORTED error will be returned. + string etag = 4; +} + +// Response message for `AwsClusters.CreateAwsNodePool` method. +message CreateAwsNodePoolRequest { + // Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] + // resource where this node pool will be created. + // + // `AwsCluster` names are formatted as + // `projects//locations//awsClusters/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkemulticloud.googleapis.com/AwsNodePool" + } + ]; + + // Required. The specification of the + // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to create. + AwsNodePool aws_node_pool = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A client provided ID the resource. Must be unique within the + // parent resource. + // + // The provided ID will be part of the + // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource name + // formatted as + // `projects//locations//awsClusters//awsNodePools/`. + // + // Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + string aws_node_pool_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // If set, only validate the request, but do not actually create the node + // pool. + bool validate_only = 4; +} + +// Request message for `AwsClusters.UpdateAwsNodePool` method. +message UpdateAwsNodePoolRequest { + // Required. The [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + // resource to update. + AwsNodePool aws_node_pool = 1 [(google.api.field_behavior) = REQUIRED]; + + // If set, only validate the request, but don't actually update the node pool. + bool validate_only = 2; + + // Required. Mask of fields to update. At least one path must be supplied in + // this field. The elements of the repeated paths field can only include these + // fields from [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]: + // + // * `annotations`. + // * `version`. + // * `autoscaling.min_node_count`. + // * `autoscaling.max_node_count`. + // * `config.config_encryption.kms_key_arn`. + // * `config.security_group_ids`. + // * `config.root_volume.iops`. + // * `config.root_volume.kms_key_arn`. + // * `config.root_volume.volume_type`. + // * `config.root_volume.size_gib`. + // * `config.proxy_config`. + // * `config.proxy_config.secret_arn`. + // * `config.proxy_config.secret_version`. + // * `config.ssh_config`. + // * `config.ssh_config.ec2_key_pair`. + // * `config.instance_placement.tenancy`. + // * `config.iam_instance_profile`. + // * `config.labels`. + // * `config.tags`. + // * `config.autoscaling_metrics_collection`. + // * `config.autoscaling_metrics_collection.granularity`. + // * `config.autoscaling_metrics_collection.metrics`. + google.protobuf.FieldMask update_mask = 3 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `AwsClusters.GetAwsNodePool` method. +message GetAwsNodePoolRequest { + // Required. The name of the + // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource to + // describe. + // + // `AwsNodePool` names are formatted as + // `projects//locations//awsClusters//awsNodePools/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkemulticloud.googleapis.com/AwsNodePool" + } + ]; +} + +// Request message for `AwsClusters.ListAwsNodePools` method. +message ListAwsNodePoolsRequest { + // Required. The parent `AwsCluster` which owns this collection of + // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. + // + // `AwsCluster` names are formatted as + // `projects//locations//awsClusters/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkemulticloud.googleapis.com/AwsNodePool" + } + ]; + + // The maximum number of items to return. + // + // If not specified, a default value of 50 will be used by the service. + // Regardless of the pageSize value, the response can include a partial list + // and a caller should only rely on response's + // [nextPageToken][google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse.next_page_token] + // to determine if there are more instances left to be queried. + int32 page_size = 2; + + // The `nextPageToken` value returned from a previous + // [awsNodePools.list][google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools] + // request, if any. + string page_token = 3; +} + +// Response message for `AwsClusters.ListAwsNodePools` method. +message ListAwsNodePoolsResponse { + // A list of [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] + // resources in the specified `AwsCluster`. + repeated AwsNodePool aws_node_pools = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; +} + +// Request message for `AwsClusters.DeleteAwsNodePool` method. +message DeleteAwsNodePoolRequest { + // Required. The resource name the + // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to delete. + // + // `AwsNodePool` names are formatted as + // `projects//locations//awsClusters//awsNodePools/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkemulticloud.googleapis.com/AwsNodePool" + } + ]; + + // If set, only validate the request, but do not actually delete the node + // pool. + bool validate_only = 2; + + // If set to true, and the + // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource is not + // found, the request will succeed but no action will be taken on the server + // and a completed [Operation][google.longrunning.Operation] will be returned. + // + // Useful for idempotent deletion. + bool allow_missing = 3; + + // The current ETag of the + // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]. + // + // Allows clients to perform deletions through optimistic concurrency control. + // + // If the provided ETag does not match the current etag of the node pool, + // the request will fail and an ABORTED error will be returned. + string etag = 4; +} + +// GetAwsServerConfigRequest gets the server config of GKE cluster on AWS. +message GetAwsServerConfigRequest { + // Required. The name of the + // [AwsServerConfig][google.cloud.gkemulticloud.v1.AwsServerConfig] resource + // to describe. + // + // `AwsServerConfig` names are formatted as + // `projects//locations//awsServerConfig`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkemulticloud.googleapis.com/AwsServerConfig" + } + ]; +} + +// Request message for `AwsClusters.GenerateAwsAccessToken` method. +message GenerateAwsAccessTokenRequest { + // Required. The name of the + // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to + // authenticate to. + // + // `AwsCluster` names are formatted as + // `projects//locations//awsClusters/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string aws_cluster = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkemulticloud.googleapis.com/AwsCluster" + } + ]; +} + +// Response message for `AwsClusters.GenerateAwsAccessToken` method. +message GenerateAwsAccessTokenResponse { + // Output only. Access token to authenticate to k8s api-server. + string access_token = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp at which the token will expire. + google.protobuf.Timestamp expiration_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/azure_resources.proto b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/azure_resources.proto new file mode 100644 index 00000000000..d7b6fc19e2d --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/azure_resources.proto @@ -0,0 +1,708 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.gkemulticloud.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/gkemulticloud/v1/common_resources.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeMultiCloud.V1"; +option go_package = "cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb;gkemulticloudpb"; +option java_multiple_files = true; +option java_outer_classname = "AzureResourcesProto"; +option java_package = "com.google.cloud.gkemulticloud.v1"; +option php_namespace = "Google\\Cloud\\GkeMultiCloud\\V1"; +option ruby_package = "Google::Cloud::GkeMultiCloud::V1"; + +// An Anthos cluster running on Azure. +message AzureCluster { + option (google.api.resource) = { + type: "gkemulticloud.googleapis.com/AzureCluster" + pattern: "projects/{project}/locations/{location}/azureClusters/{azure_cluster}" + }; + + // The lifecycle state of the cluster. + enum State { + // Not set. + STATE_UNSPECIFIED = 0; + + // The PROVISIONING state indicates the cluster is being created. + PROVISIONING = 1; + + // The RUNNING state indicates the cluster has been created and is fully + // usable. + RUNNING = 2; + + // The RECONCILING state indicates that some work is actively being done on + // the cluster, such as upgrading the control plane replicas. + RECONCILING = 3; + + // The STOPPING state indicates the cluster is being deleted. + STOPPING = 4; + + // The ERROR state indicates the cluster is in a broken unrecoverable + // state. + ERROR = 5; + + // The DEGRADED state indicates the cluster requires user action to + // restore full functionality. + DEGRADED = 6; + } + + // The name of this resource. + // + // Cluster names are formatted as + // `projects//locations//azureClusters/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud Platform resource names. + string name = 1; + + // Optional. A human readable description of this cluster. + // Cannot be longer than 255 UTF-8 encoded bytes. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The Azure region where the cluster runs. + // + // Each Google Cloud region supports a subset of nearby Azure regions. + // You can call + // [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig] + // to list all supported Azure regions within a given Google Cloud region. + string azure_region = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ARM ID of the resource group where the cluster resources are + // deployed. For example: + // `/subscriptions//resourceGroups/` + string resource_group_id = 17 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Name of the + // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] that contains + // authentication configuration for how the Anthos Multi-Cloud API connects to + // Azure APIs. + // + // The `AzureClient` resource must reside on the same Google Cloud Platform + // project and region as the `AzureCluster`. + // + // `AzureClient` names are formatted as + // `projects//locations//azureClients/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string azure_client = 16 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Cluster-wide networking configuration. + AzureClusterNetworking networking = 4 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Configuration related to the cluster control plane. + AzureControlPlane control_plane = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. Configuration related to the cluster RBAC settings. + AzureAuthorization authorization = 6 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Authentication configuration for management of Azure resources. + AzureServicesAuthentication azure_services_authentication = 22 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The current state of the cluster. + State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The endpoint of the cluster's API server. + string endpoint = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A globally unique identifier for the cluster. + string uid = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. If set, there are currently changes in flight to the cluster. + bool reconciling = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this cluster was created. + google.protobuf.Timestamp create_time = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this cluster was last updated. + google.protobuf.Timestamp update_time = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Allows clients to perform consistent read-modify-writes + // through optimistic concurrency control. + // + // Can be sent on update and delete requests to ensure the + // client has an up-to-date value before proceeding. + string etag = 13; + + // Optional. Annotations on the cluster. + // + // This field has the same restrictions as Kubernetes annotations. + // The total size of all keys and values combined is limited to 256k. + // Keys can have 2 segments: prefix (optional) and name (required), + // separated by a slash (/). + // Prefix must be a DNS subdomain. + // Name must be 63 characters or less, begin and end with alphanumerics, + // with dashes (-), underscores (_), dots (.), and alphanumerics between. + map annotations = 14 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Workload Identity settings. + WorkloadIdentityConfig workload_identity_config = 18 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. PEM encoded x509 certificate of the cluster root of trust. + string cluster_ca_certificate = 19 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Fleet configuration. + Fleet fleet = 20 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Managed Azure resources for this cluster. + AzureClusterResources managed_resources = 21 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Logging configuration for this cluster. + LoggingConfig logging_config = 23 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. A set of errors found in the cluster. + repeated AzureClusterError errors = 24 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Monitoring configuration for this cluster. + MonitoringConfig monitoring_config = 25 + [(google.api.field_behavior) = OPTIONAL]; +} + +// ClusterNetworking contains cluster-wide networking configuration. +message AzureClusterNetworking { + // Required. The Azure Resource Manager (ARM) ID of the VNet associated with + // your cluster. + // + // All components in the cluster (i.e. control plane and node pools) run on a + // single VNet. + // + // Example: + // `/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks/` + // + // This field cannot be changed after creation. + string virtual_network_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The IP address range of the pods in this cluster, in CIDR + // notation (e.g. `10.96.0.0/14`). + // + // All pods in the cluster get assigned a unique IPv4 address from these + // ranges. Only a single range is supported. + // + // This field cannot be changed after creation. + repeated string pod_address_cidr_blocks = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The IP address range for services in this cluster, in CIDR + // notation (e.g. `10.96.0.0/14`). + // + // All services in the cluster get assigned a unique IPv4 address from these + // ranges. Only a single range is supported. + // + // This field cannot be changed after creating a cluster. + repeated string service_address_cidr_blocks = 3 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. The ARM ID of the subnet where Kubernetes private service type + // load balancers are deployed. When unspecified, it defaults to + // AzureControlPlane.subnet_id. + // + // Example: + // "/subscriptions/d00494d6-6f3c-4280-bbb2-899e163d1d30/resourceGroups/anthos_cluster_gkeust4/providers/Microsoft.Network/virtualNetworks/gke-vnet-gkeust4/subnets/subnetid456" + string service_load_balancer_subnet_id = 5 + [(google.api.field_behavior) = OPTIONAL]; +} + +// AzureControlPlane represents the control plane configurations. +message AzureControlPlane { + // Required. The Kubernetes version to run on control plane replicas + // (e.g. `1.19.10-gke.1000`). + // + // You can list all supported versions on a given Google Cloud region by + // calling + // [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig]. + string version = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The ARM ID of the default subnet for the control plane. The + // control plane VMs are deployed in this subnet, unless + // `AzureControlPlane.replica_placements` is specified. This subnet will also + // be used as default for `AzureControlPlane.endpoint_subnet_id` if + // `AzureControlPlane.endpoint_subnet_id` is not specified. Similarly it will + // be used as default for + // `AzureClusterNetworking.service_load_balancer_subnet_id`. + // + // Example: + // `/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/default`. + string subnet_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Azure VM size name. Example: `Standard_DS2_v2`. + // + // For available VM sizes, see + // https://docs.microsoft.com/en-us/azure/virtual-machines/vm-naming-conventions. + // + // When unspecified, it defaults to `Standard_DS2_v2`. + string vm_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Required. SSH configuration for how to access the underlying control plane + // machines. + AzureSshConfig ssh_config = 11 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Configuration related to the root volume provisioned for each + // control plane replica. + // + // When unspecified, it defaults to 32-GiB Azure Disk. + AzureDiskTemplate root_volume = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Configuration related to the main volume provisioned for each + // control plane replica. + // The main volume is in charge of storing all of the cluster's etcd state. + // + // When unspecified, it defaults to a 8-GiB Azure Disk. + AzureDiskTemplate main_volume = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Configuration related to application-layer secrets encryption. + AzureDatabaseEncryption database_encryption = 10 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Proxy configuration for outbound HTTP(S) traffic. + AzureProxyConfig proxy_config = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Configuration related to vm config encryption. + AzureConfigEncryption config_encryption = 14 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A set of tags to apply to all underlying control plane Azure + // resources. + map tags = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Configuration for where to place the control plane replicas. + // + // Up to three replica placement instances can be specified. If + // replica_placements is set, the replica placement instances will be applied + // to the three control plane replicas as evenly as possible. + repeated ReplicaPlacement replica_placements = 13 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The ARM ID of the subnet where the control plane load balancer is + // deployed. When unspecified, it defaults to AzureControlPlane.subnet_id. + // + // Example: + // "/subscriptions/d00494d6-6f3c-4280-bbb2-899e163d1d30/resourceGroups/anthos_cluster_gkeust4/providers/Microsoft.Network/virtualNetworks/gke-vnet-gkeust4/subnets/subnetid123" + string endpoint_subnet_id = 15 [(google.api.field_behavior) = OPTIONAL]; +} + +// Configuration for the placement of a control plane replica. +message ReplicaPlacement { + // Required. For a given replica, the ARM ID of the subnet where the control + // plane VM is deployed. Make sure it's a subnet under the virtual network in + // the cluster configuration. + string subnet_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. For a given replica, the Azure availability zone where to + // provision the control plane VM and the ETCD disk. + string azure_availability_zone = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Details of a proxy config stored in Azure Key Vault. +message AzureProxyConfig { + // The ARM ID the of the resource group containing proxy keyvault. + // + // Resource group ids are formatted as + // `/subscriptions//resourceGroups/`. + string resource_group_id = 1; + + // The URL the of the proxy setting secret with its version. + // + // The secret must be a JSON encoded proxy configuration + // as described in + // https://cloud.google.com/anthos/clusters/docs/multi-cloud/azure/how-to/use-a-proxy#create_a_proxy_configuration_file + // + // Secret ids are formatted as + // `https://.vault.azure.net/secrets//`. + string secret_id = 2; +} + +// Configuration related to application-layer secrets encryption. +// +// Anthos clusters on Azure encrypts your Kubernetes data at rest +// in etcd using Azure Key Vault. +message AzureDatabaseEncryption { + // Required. The ARM ID of the Azure Key Vault key to encrypt / decrypt data. + // + // For example: + // `/subscriptions//resourceGroups//providers/Microsoft.KeyVault/vaults//keys/` + // Encryption will always take the latest version of the key and hence + // specific version is not supported. + string key_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Configuration related to config data encryption. +// +// Azure VM bootstrap secret is envelope encrypted with the provided key vault +// key. +message AzureConfigEncryption { + // Required. The ARM ID of the Azure Key Vault key to encrypt / decrypt config + // data. + // + // For example: + // `/subscriptions//resourceGroups//providers/Microsoft.KeyVault/vaults//keys/` + string key_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. RSA key of the Azure Key Vault public key to use for encrypting + // the data. + // + // This key must be formatted as a PEM-encoded SubjectPublicKeyInfo (RFC 5280) + // in ASN.1 DER form. The string must be comprised of a single PEM block of + // type "PUBLIC KEY". + string public_key = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Configuration for Azure Disks. +message AzureDiskTemplate { + // Optional. The size of the disk, in GiBs. + // + // When unspecified, a default value is provided. See the specific reference + // in the parent resource. + int32 size_gib = 1 [(google.api.field_behavior) = OPTIONAL]; +} + +// `AzureClient` resources hold client authentication information needed by the +// Anthos Multi-Cloud API to manage Azure resources on your Azure subscription. +// +// When an [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] is +// created, an `AzureClient` resource needs to be provided and all operations on +// Azure resources associated to that cluster will authenticate to Azure +// services using the given client. +// +// `AzureClient` resources are immutable and cannot be modified upon creation. +// +// Each `AzureClient` resource is bound to a single Azure Active Directory +// Application and tenant. +message AzureClient { + option (google.api.resource) = { + type: "gkemulticloud.googleapis.com/AzureClient" + pattern: "projects/{project}/locations/{location}/azureClients/{azure_client}" + }; + + // The name of this resource. + // + // `AzureClient` resource names are formatted as + // `projects//locations//azureClients/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string name = 1; + + // Required. The Azure Active Directory Tenant ID. + string tenant_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Azure Active Directory Application ID. + string application_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Output only. If set, there are currently pending changes to the client. + bool reconciling = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Annotations on the resource. + // + // This field has the same restrictions as Kubernetes annotations. + // The total size of all keys and values combined is limited to 256k. + // Keys can have 2 segments: prefix (optional) and name (required), + // separated by a slash (/). + // Prefix must be a DNS subdomain. + // Name must be 63 characters or less, begin and end with alphanumerics, + // with dashes (-), underscores (_), dots (.), and alphanumerics between. + map annotations = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The PEM encoded x509 certificate. + string pem_certificate = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A globally unique identifier for the client. + string uid = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this resource was created. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this client was last updated. + google.protobuf.Timestamp update_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Configuration related to the cluster RBAC settings. +message AzureAuthorization { + // Required. Users that can perform operations as a cluster admin. A managed + // ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole + // to the users. Up to ten admin users can be provided. + // + // For more info on RBAC, see + // https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles + repeated AzureClusterUser admin_users = 1 + [(google.api.field_behavior) = REQUIRED]; +} + +// Authentication configuration for the management of Azure resources. +message AzureServicesAuthentication { + // Required. The Azure Active Directory Tenant ID. + string tenant_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Azure Active Directory Application ID. + string application_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Identities of a user-type subject for Azure clusters. +message AzureClusterUser { + // Required. The name of the user, e.g. `my-gcp-id@gmail.com`. + string username = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// An Anthos node pool running on Azure. +message AzureNodePool { + option (google.api.resource) = { + type: "gkemulticloud.googleapis.com/AzureNodePool" + pattern: "projects/{project}/locations/{location}/azureClusters/{azure_cluster}/azureNodePools/{azure_node_pool}" + }; + + // The lifecycle state of the node pool. + enum State { + // Not set. + STATE_UNSPECIFIED = 0; + + // The PROVISIONING state indicates the node pool is being created. + PROVISIONING = 1; + + // The RUNNING state indicates the node pool has been created and is fully + // usable. + RUNNING = 2; + + // The RECONCILING state indicates that the node pool is being reconciled. + RECONCILING = 3; + + // The STOPPING state indicates the node pool is being deleted. + STOPPING = 4; + + // The ERROR state indicates the node pool is in a broken unrecoverable + // state. + ERROR = 5; + + // The DEGRADED state indicates the node pool requires user action to + // restore full functionality. + DEGRADED = 6; + } + + // The name of this resource. + // + // Node pool names are formatted as + // `projects//locations//azureClusters//azureNodePools/`. + // + // For more details on Google Cloud resource names, + // see [Resource Names](https://cloud.google.com/apis/design/resource_names) + string name = 1; + + // Required. The Kubernetes version (e.g. `1.19.10-gke.1000`) running on this + // node pool. + string version = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The node configuration of the node pool. + AzureNodeConfig config = 22 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ARM ID of the subnet where the node pool VMs run. Make sure + // it's a subnet under the virtual network in the cluster configuration. + string subnet_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Autoscaler configuration for this node pool. + AzureNodePoolAutoscaling autoscaling = 4 + [(google.api.field_behavior) = REQUIRED]; + + // Output only. The current state of the node pool. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A globally unique identifier for the node pool. + string uid = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. If set, there are currently pending changes to the node + // pool. + bool reconciling = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this node pool was created. + google.protobuf.Timestamp create_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this node pool was last updated. + google.protobuf.Timestamp update_time = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Allows clients to perform consistent read-modify-writes + // through optimistic concurrency control. + // + // Can be sent on update and delete requests to ensure the + // client has an up-to-date value before proceeding. + string etag = 12; + + // Optional. Annotations on the node pool. + // + // This field has the same restrictions as Kubernetes annotations. + // The total size of all keys and values combined is limited to 256k. + // Keys can have 2 segments: prefix (optional) and name (required), + // separated by a slash (/). + // Prefix must be a DNS subdomain. + // Name must be 63 characters or less, begin and end with alphanumerics, + // with dashes (-), underscores (_), dots (.), and alphanumerics between. + map annotations = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The constraint on the maximum number of pods that can be run + // simultaneously on a node in the node pool. + MaxPodsConstraint max_pods_constraint = 21 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. The Azure availability zone of the nodes in this nodepool. + // + // When unspecified, it defaults to `1`. + string azure_availability_zone = 23 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. A set of errors found in the node pool. + repeated AzureNodePoolError errors = 29 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Parameters that describe the configuration of all node machines +// on a given node pool. +message AzureNodeConfig { + // Optional. The Azure VM size name. Example: `Standard_DS2_v2`. + // + // See [Supported VM + // sizes](/anthos/clusters/docs/azure/reference/supported-vms) for options. + // + // When unspecified, it defaults to `Standard_DS2_v2`. + string vm_size = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Configuration related to the root volume provisioned for each + // node pool machine. + // + // When unspecified, it defaults to a 32-GiB Azure Disk. + AzureDiskTemplate root_volume = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A set of tags to apply to all underlying Azure resources for this + // node pool. This currently only includes Virtual Machine Scale Sets. + // + // Specify at most 50 pairs containing alphanumerics, spaces, and symbols + // (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to + // 255 Unicode characters. + map tags = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The OS image type to use on node pool instances. + // Can have a value of `ubuntu`, or `windows` if the cluster enables + // the Windows node pool preview feature. + // + // When unspecified, it defaults to `ubuntu`. + string image_type = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Required. SSH configuration for how to access the node pool machines. + AzureSshConfig ssh_config = 7 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Proxy configuration for outbound HTTP(S) traffic. + AzureProxyConfig proxy_config = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Configuration related to vm config encryption. + AzureConfigEncryption config_encryption = 12 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The initial taints assigned to nodes of this node pool. + repeated NodeTaint taints = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The initial labels assigned to nodes of this node pool. An object + // containing a list of "key": value pairs. Example: { "name": "wrench", + // "mass": "1.3kg", "count": "3" }. + map labels = 11 [(google.api.field_behavior) = OPTIONAL]; +} + +// Configuration related to Kubernetes cluster autoscaler. +// +// The Kubernetes cluster autoscaler will automatically adjust the +// size of the node pool based on the cluster load. +message AzureNodePoolAutoscaling { + // Required. Minimum number of nodes in the node pool. Must be greater than or + // equal to 1 and less than or equal to max_node_count. + int32 min_node_count = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Maximum number of nodes in the node pool. Must be greater than or + // equal to min_node_count and less than or equal to 50. + int32 max_node_count = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// AzureServerConfig contains information about a Google Cloud location, such as +// supported Azure regions and Kubernetes versions. +message AzureServerConfig { + option (google.api.resource) = { + type: "gkemulticloud.googleapis.com/AzureServerConfig" + pattern: "projects/{project}/locations/{location}/azureServerConfig" + }; + + // The `AzureServerConfig` resource name. + // + // `AzureServerConfig` names are formatted as + // `projects//locations//azureServerConfig`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud Platform resource names. + string name = 1; + + // List of valid Kubernetes versions. + repeated AzureK8sVersionInfo valid_versions = 2; + + // The list of supported Azure regions. + repeated string supported_azure_regions = 3; +} + +// Information about a supported Kubernetes version. +message AzureK8sVersionInfo { + // A supported Kubernetes version (for example, `1.19.10-gke.1000`) + string version = 1; +} + +// SSH configuration for Azure resources. +message AzureSshConfig { + // Required. The SSH public key data for VMs managed by Anthos. This accepts + // the authorized_keys file format used in OpenSSH according to the sshd(8) + // manual page. + string authorized_key = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Managed Azure resources for the cluster. +// +// The values could change and be empty, depending on the state of the cluster. +message AzureClusterResources { + // Output only. The ARM ID of the cluster network security group. + string network_security_group_id = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The ARM ID of the control plane application security group. + string control_plane_application_security_group_id = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// AzureClusterError describes errors found on Azure clusters. +message AzureClusterError { + // Human-friendly description of the error. + string message = 1; +} + +// AzureNodePoolError describes errors found on Azure node pools. +message AzureNodePoolError { + // Human-friendly description of the error. + string message = 1; +} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/azure_service.proto b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/azure_service.proto new file mode 100644 index 00000000000..d39e9dd63b5 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/azure_service.proto @@ -0,0 +1,776 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.gkemulticloud.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/gkemulticloud/v1/azure_resources.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeMultiCloud.V1"; +option go_package = "cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb;gkemulticloudpb"; +option java_multiple_files = true; +option java_outer_classname = "AzureServiceProto"; +option java_package = "com.google.cloud.gkemulticloud.v1"; +option php_namespace = "Google\\Cloud\\GkeMultiCloud\\V1"; +option ruby_package = "Google::Cloud::GkeMultiCloud::V1"; + +// The AzureClusters API provides a single centrally managed service +// to create and manage Anthos clusters that run on Azure infrastructure. +service AzureClusters { + option (google.api.default_host) = "gkemulticloud.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a new [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] + // resource on a given Google Cloud project and region. + // + // `AzureClient` resources hold client authentication + // information needed by the Anthos Multicloud API to manage Azure resources + // on your Azure subscription on your behalf. + // + // If successful, the response contains a newly created + // [Operation][google.longrunning.Operation] resource that can be + // described to track the status of the operation. + rpc CreateAzureClient(CreateAzureClientRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/azureClients" + body: "azure_client" + }; + option (google.api.method_signature) = + "parent,azure_client,azure_client_id"; + option (google.longrunning.operation_info) = { + response_type: "AzureClient" + metadata_type: "OperationMetadata" + }; + } + + // Describes a specific + // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource. + rpc GetAzureClient(GetAzureClientRequest) returns (AzureClient) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/azureClients/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] + // resources on a given Google Cloud project and region. + rpc ListAzureClients(ListAzureClientsRequest) + returns (ListAzureClientsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/azureClients" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a specific [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] + // resource. + // + // If the client is used by one or more clusters, deletion will + // fail and a `FAILED_PRECONDITION` error will be returned. + // + // If successful, the response contains a newly created + // [Operation][google.longrunning.Operation] resource that can be + // described to track the status of the operation. + rpc DeleteAzureClient(DeleteAzureClientRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/azureClients/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Creates a new [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + // resource on a given Google Cloud Platform project and region. + // + // If successful, the response contains a newly created + // [Operation][google.longrunning.Operation] resource that can be + // described to track the status of the operation. + rpc CreateAzureCluster(CreateAzureClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/azureClusters" + body: "azure_cluster" + }; + option (google.api.method_signature) = + "parent,azure_cluster,azure_cluster_id"; + option (google.longrunning.operation_info) = { + response_type: "AzureCluster" + metadata_type: "OperationMetadata" + }; + } + + // Updates an [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + rpc UpdateAzureCluster(UpdateAzureClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{azure_cluster.name=projects/*/locations/*/azureClusters/*}" + body: "azure_cluster" + }; + option (google.api.method_signature) = "azure_cluster,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "AzureCluster" + metadata_type: "OperationMetadata" + }; + } + + // Describes a specific + // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. + rpc GetAzureCluster(GetAzureClusterRequest) returns (AzureCluster) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/azureClusters/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + // resources on a given Google Cloud project and region. + rpc ListAzureClusters(ListAzureClustersRequest) + returns (ListAzureClustersResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/azureClusters" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a specific + // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. + // + // Fails if the cluster has one or more associated + // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. + // + // If successful, the response contains a newly created + // [Operation][google.longrunning.Operation] resource that can be + // described to track the status of the operation. + rpc DeleteAzureCluster(DeleteAzureClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/azureClusters/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Generates a short-lived access token to authenticate to a given + // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. + rpc GenerateAzureAccessToken(GenerateAzureAccessTokenRequest) + returns (GenerateAzureAccessTokenResponse) { + option (google.api.http) = { + get: "/v1/{azure_cluster=projects/*/locations/*/azureClusters/*}:generateAzureAccessToken" + }; + } + + // Creates a new [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool], + // attached to a given + // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + // + // If successful, the response contains a newly created + // [Operation][google.longrunning.Operation] resource that can be + // described to track the status of the operation. + rpc CreateAzureNodePool(CreateAzureNodePoolRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/azureClusters/*}/azureNodePools" + body: "azure_node_pool" + }; + option (google.api.method_signature) = + "parent,azure_node_pool,azure_node_pool_id"; + option (google.longrunning.operation_info) = { + response_type: "AzureNodePool" + metadata_type: "OperationMetadata" + }; + } + + // Updates an [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]. + rpc UpdateAzureNodePool(UpdateAzureNodePoolRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{azure_node_pool.name=projects/*/locations/*/azureClusters/*/azureNodePools/*}" + body: "azure_node_pool" + }; + option (google.api.method_signature) = "azure_node_pool,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "AzureNodePool" + metadata_type: "OperationMetadata" + }; + } + + // Describes a specific + // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource. + rpc GetAzureNodePool(GetAzureNodePoolRequest) returns (AzureNodePool) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/azureClusters/*/azureNodePools/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] + // resources on a given + // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + rpc ListAzureNodePools(ListAzureNodePoolsRequest) + returns (ListAzureNodePoolsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/azureClusters/*}/azureNodePools" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a specific + // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource. + // + // If successful, the response contains a newly created + // [Operation][google.longrunning.Operation] resource that can be + // described to track the status of the operation. + rpc DeleteAzureNodePool(DeleteAzureNodePoolRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/azureClusters/*/azureNodePools/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Returns information, such as supported Azure regions and Kubernetes + // versions, on a given Google Cloud location. + rpc GetAzureServerConfig(GetAzureServerConfigRequest) + returns (AzureServerConfig) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/azureServerConfig}" + }; + option (google.api.method_signature) = "name"; + } +} + +// Request message for `AzureClusters.CreateAzureCluster` method. +message CreateAzureClusterRequest { + // Required. The parent location where this + // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource will be + // created. + // + // Location names are formatted as `projects//locations/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkemulticloud.googleapis.com/AzureCluster" + } + ]; + + // Required. The specification of the + // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to create. + AzureCluster azure_cluster = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A client provided ID the resource. Must be unique within the + // parent resource. + // + // The provided ID will be part of the + // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource name + // formatted as + // `projects//locations//azureClusters/`. + // + // Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + string azure_cluster_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // If set, only validate the request, but do not actually create the cluster. + bool validate_only = 4; +} + +// Request message for `AzureClusters.UpdateAzureCluster` method. +message UpdateAzureClusterRequest { + // Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + // resource to update. + AzureCluster azure_cluster = 1 [(google.api.field_behavior) = REQUIRED]; + + // If set, only validate the request, but do not actually update the cluster. + bool validate_only = 2; + + // Required. Mask of fields to update. At least one path must be supplied in + // this field. The elements of the repeated paths field can only include these + // fields from [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]: + // + // * `description`. + // * `azureClient`. + // * `control_plane.version`. + // * `control_plane.vm_size`. + // * `annotations`. + // * `authorization.admin_users`. + // * `control_plane.root_volume.size_gib`. + // * `azure_services_authentication`. + // * `azure_services_authentication.tenant_id`. + // * `azure_services_authentication.application_id`. + // * `control_plane.proxy_config`. + // * `control_plane.proxy_config.resource_group_id`. + // * `control_plane.proxy_config.secret_id`. + // * `control_plane.ssh_config.authorized_key`. + // * `logging_config.component_config.enable_components` + // * `monitoring_config.managed_prometheus_config.enabled`. + google.protobuf.FieldMask update_mask = 4 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `AzureClusters.GetAzureCluster` method. +message GetAzureClusterRequest { + // Required. The name of the + // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to + // describe. + // + // `AzureCluster` names are formatted as + // `projects//locations//azureClusters/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud Platform resource names. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkemulticloud.googleapis.com/AzureCluster" + } + ]; +} + +// Request message for `AzureClusters.ListAzureClusters` method. +message ListAzureClustersRequest { + // Required. The parent location which owns this collection of + // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resources. + // + // Location names are formatted as `projects//locations/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud Platform resource names. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkemulticloud.googleapis.com/AzureCluster" + } + ]; + + // The maximum number of items to return. + // + // If not specified, a default value of 50 will be used by the service. + // Regardless of the pageSize value, the response can include a partial list + // and a caller should only rely on response's + // [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureClustersResponse.next_page_token] + // to determine if there are more instances left to be queried. + int32 page_size = 2; + + // The `nextPageToken` value returned from a previous + // [azureClusters.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters] + // request, if any. + string page_token = 3; +} + +// Response message for `AzureClusters.ListAzureClusters` method. +message ListAzureClustersResponse { + // A list of [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + // resources in the specified Google Cloud Platform project and region region. + repeated AzureCluster azure_clusters = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; +} + +// Request message for `Clusters.DeleteAzureCluster` method. +message DeleteAzureClusterRequest { + // Required. The resource name the + // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to delete. + // + // `AzureCluster` names are formatted as + // `projects//locations//azureClusters/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud Platform resource names. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkemulticloud.googleapis.com/AzureCluster" + } + ]; + + // If set to true, and the + // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource is not + // found, the request will succeed but no action will be taken on the server + // and a completed [Operation][google.longrunning.Operation] will be returned. + // + // Useful for idempotent deletion. + bool allow_missing = 2; + + // If set, only validate the request, but do not actually delete the resource. + bool validate_only = 3; + + // The current etag of the + // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. + // + // Allows clients to perform deletions through optimistic concurrency control. + // + // If the provided etag does not match the current etag of the cluster, + // the request will fail and an ABORTED error will be returned. + string etag = 4; +} + +// Response message for `AzureClusters.CreateAzureNodePool` method. +message CreateAzureNodePoolRequest { + // Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] + // resource where this node pool will be created. + // + // Location names are formatted as `projects//locations/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkemulticloud.googleapis.com/AzureNodePool" + } + ]; + + // Required. The specification of the + // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to create. + AzureNodePool azure_node_pool = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A client provided ID the resource. Must be unique within the + // parent resource. + // + // The provided ID will be part of the + // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource name + // formatted as + // `projects//locations//azureClusters//azureNodePools/`. + // + // Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + string azure_node_pool_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // If set, only validate the request, but do not actually create the node + // pool. + bool validate_only = 4; +} + +// Request message for `AzureClusters.UpdateAzureNodePool` method. +message UpdateAzureNodePoolRequest { + // Required. The [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] + // resource to update. + AzureNodePool azure_node_pool = 1 [(google.api.field_behavior) = REQUIRED]; + + // If set, only validate the request, but don't actually update the node pool. + bool validate_only = 2; + + // Required. Mask of fields to update. At least one path must be supplied in + // this field. The elements of the repeated paths field can only include these + // fields from [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]: + // + // *. `annotations`. + // * `version`. + // * `autoscaling.min_node_count`. + // * `autoscaling.max_node_count`. + // * `config.ssh_config.authorized_key`. + google.protobuf.FieldMask update_mask = 3 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `AzureClusters.GetAzureNodePool` method. +message GetAzureNodePoolRequest { + // Required. The name of the + // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource to + // describe. + // + // `AzureNodePool` names are formatted as + // `projects//locations//azureClusters//azureNodePools/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkemulticloud.googleapis.com/AzureNodePool" + } + ]; +} + +// Request message for `AzureClusters.ListAzureNodePools` method. +message ListAzureNodePoolsRequest { + // Required. The parent `AzureCluster` which owns this collection of + // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. + // + // `AzureCluster` names are formatted as + // `projects//locations//azureClusters/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkemulticloud.googleapis.com/AzureNodePool" + } + ]; + + // The maximum number of items to return. + // + // If not specified, a default value of 50 will be used by the service. + // Regardless of the pageSize value, the response can include a partial list + // and a caller should only rely on response's + // [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse.next_page_token] + // to determine if there are more instances left to be queried. + int32 page_size = 2; + + // The `nextPageToken` value returned from a previous + // [azureNodePools.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools] + // request, if any. + string page_token = 3; +} + +// Response message for `AzureClusters.ListAzureNodePools` method. +message ListAzureNodePoolsResponse { + // A list of [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] + // resources in the specified `AzureCluster`. + repeated AzureNodePool azure_node_pools = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; +} + +// Delete message for `AzureClusters.DeleteAzureNodePool` method. +message DeleteAzureNodePoolRequest { + // Required. The resource name the + // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to delete. + // + // `AzureNodePool` names are formatted as + // `projects//locations//azureClusters//azureNodePools/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkemulticloud.googleapis.com/AzureNodePool" + } + ]; + + // If set, only validate the request, but do not actually delete the node + // pool. + bool validate_only = 2; + + // If set to true, and the + // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource is + // not found, the request will succeed but no action will be taken on the + // server and a completed [Operation][google.longrunning.Operation] will be + // returned. + // + // Useful for idempotent deletion. + bool allow_missing = 3; + + // The current ETag of the + // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]. + // + // Allows clients to perform deletions through optimistic concurrency control. + // + // If the provided ETag does not match the current etag of the node pool, + // the request will fail and an ABORTED error will be returned. + string etag = 4; +} + +// GetAzureServerConfigRequest gets the server config of GKE cluster on Azure. +message GetAzureServerConfigRequest { + // Required. The name of the + // [AzureServerConfig][google.cloud.gkemulticloud.v1.AzureServerConfig] + // resource to describe. + // + // `AzureServerConfig` names are formatted as + // `projects//locations//azureServerConfig`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkemulticloud.googleapis.com/AzureServerConfig" + } + ]; +} + +// Request message for `AzureClusters.CreateAzureClient` method. +message CreateAzureClientRequest { + // Required. The parent location where this + // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource will be + // created. + // + // Location names are formatted as `projects//locations/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkemulticloud.googleapis.com/AzureClient" + } + ]; + + // Required. The specification of the + // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to create. + AzureClient azure_client = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A client provided ID the resource. Must be unique within the + // parent resource. + // + // The provided ID will be part of the + // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource name + // formatted as + // `projects//locations//azureClients/`. + // + // Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + string azure_client_id = 4 [(google.api.field_behavior) = REQUIRED]; + + // If set, only validate the request, but do not actually create the client. + bool validate_only = 3; +} + +// Request message for `AzureClusters.GetAzureClient` method. +message GetAzureClientRequest { + // Required. The name of the + // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource to + // describe. + // + // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are + // formatted as + // `projects//locations//azureClients/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkemulticloud.googleapis.com/AzureClient" + } + ]; +} + +// Request message for `AzureClusters.ListAzureClients` method. +message ListAzureClientsRequest { + // Required. The parent location which owns this collection of + // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resources. + // + // Location names are formatted as `projects//locations/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud Platform resource names. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "gkemulticloud.googleapis.com/AzureClient" + } + ]; + + // The maximum number of items to return. + // + // If not specified, a default value of 50 will be used by the service. + // Regardless of the pageSize value, the response can include a partial list + // and a caller should only rely on response's + // [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureClientsResponse.next_page_token] + // to determine if there are more instances left to be queried. + int32 page_size = 2; + + // The `nextPageToken` value returned from a previous + // [azureClients.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients] + // request, if any. + string page_token = 3; +} + +// Response message for `AzureClusters.ListAzureClients` method. +message ListAzureClientsResponse { + // A list of [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] + // resources in the specified Google Cloud project and region region. + repeated AzureClient azure_clients = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; +} + +// Request message for `AzureClusters.DeleteAzureClient` method. +message DeleteAzureClientRequest { + // Required. The resource name the + // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to delete. + // + // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are + // formatted as + // `projects//locations//azureClients/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkemulticloud.googleapis.com/AzureClient" + } + ]; + + // If set to true, and the + // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource is not + // found, the request will succeed but no action will be taken on the server + // and a completed [Operation][google.longrunning.Operation] will be returned. + // + // Useful for idempotent deletion. + bool allow_missing = 2; + + // If set, only validate the request, but do not actually delete the resource. + bool validate_only = 3; +} + +// Request message for `AzureClusters.GenerateAzureAccessToken` method. +message GenerateAzureAccessTokenRequest { + // Required. The name of the + // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to + // authenticate to. + // + // `AzureCluster` names are formatted as + // `projects//locations//AzureClusters/`. + // + // See [Resource Names](https://cloud.google.com/apis/design/resource_names) + // for more details on Google Cloud resource names. + string azure_cluster = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gkemulticloud.googleapis.com/AzureCluster" + } + ]; +} + +// Response message for `AzureClusters.GenerateAzureAccessToken` method. +message GenerateAzureAccessTokenResponse { + // Output only. Access token to authenticate to k8s api-server. + string access_token = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp at which the token will expire. + google.protobuf.Timestamp expiration_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/common_resources.proto b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/common_resources.proto new file mode 100644 index 00000000000..a39cb813e21 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/common_resources.proto @@ -0,0 +1,174 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.gkemulticloud.v1; + +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.GkeMultiCloud.V1"; +option go_package = "cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb;gkemulticloudpb"; +option java_multiple_files = true; +option java_outer_classname = "CommonResourcesProto"; +option java_package = "com.google.cloud.gkemulticloud.v1"; +option php_namespace = "Google\\Cloud\\GkeMultiCloud\\V1"; +option ruby_package = "Google::Cloud::GkeMultiCloud::V1"; + +// Workload Identity settings. +message WorkloadIdentityConfig { + // The OIDC issuer URL for this cluster. + string issuer_uri = 1; + + // The Workload Identity Pool associated to the cluster. + string workload_pool = 2; + + // The ID of the OIDC Identity Provider (IdP) associated to the Workload + // Identity Pool. + string identity_provider = 3; +} + +// Constraints applied to pods. +message MaxPodsConstraint { + // Required. The maximum number of pods to schedule on a single node. + int64 max_pods_per_node = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Metadata about a long-running operation. +message OperationMetadata { + // Output only. The time at which this operation was created. + google.protobuf.Timestamp create_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this operation was completed. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The name of the resource associated to this operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_detail = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of any error that occurred during the + // operation. + string error_detail = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The verb associated with the API method which triggered this + // operation. Possible values are "create", "delete", "update" and "import". + string verb = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether it has been requested cancellation + // for the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a + // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + // `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The taint content for the node taint. +message NodeTaint { + // The taint effect. + enum Effect { + // Not set. + EFFECT_UNSPECIFIED = 0; + + // Do not allow new pods to schedule onto the node unless they tolerate the + // taint, but allow all pods submitted to Kubelet without going through the + // scheduler to start, and allow all already-running pods to continue + // running. Enforced by the scheduler. + NO_SCHEDULE = 1; + + // Like TaintEffectNoSchedule, but the scheduler tries not to schedule + // new pods onto the node, rather than prohibiting new pods from scheduling + // onto the node entirely. Enforced by the scheduler. + PREFER_NO_SCHEDULE = 2; + + // Evict any already-running pods that do not tolerate the taint. + // Currently enforced by NodeController. + NO_EXECUTE = 3; + } + + // Required. Key for the taint. + string key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Value for the taint. + string value = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The taint effect. + Effect effect = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Fleet related configuration. +// +// Fleets are a Google Cloud concept for logically organizing clusters, +// letting you use and manage multi-cluster capabilities and apply +// consistent policies across your systems. +// +// See [Anthos +// Fleets](https://cloud.google.com/anthos/multicluster-management/fleets) for +// more details on Anthos multi-cluster capabilities using Fleets. +message Fleet { + // Required. The name of the Fleet host project where this cluster will be + // registered. + // + // Project names are formatted as + // `projects/`. + string project = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The name of the managed Hub Membership resource associated to + // this cluster. + // + // Membership names are formatted as + // `projects//locations/global/membership/`. + string membership = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Parameters that describe the Logging configuration in a cluster. +message LoggingConfig { + // The configuration of the logging components; + LoggingComponentConfig component_config = 1; +} + +// Parameters that describe the Logging component configuration in a cluster. +message LoggingComponentConfig { + // The components of the logging configuration; + enum Component { + // No component is specified + COMPONENT_UNSPECIFIED = 0; + + // This indicates that system logging components is enabled. + SYSTEM_COMPONENTS = 1; + + // This indicates that user workload logging component is enabled. + WORKLOADS = 2; + } + + // The components to be enabled. + repeated Component enable_components = 1; +} + +// Parameters that describe the Monitoring configuration in a cluster. +message MonitoringConfig { + // Enable Google Cloud Managed Service for Prometheus in the cluster. + ManagedPrometheusConfig managed_prometheus_config = 2; +} + +// ManagedPrometheusConfig defines the configuration for +// Google Cloud Managed Service for Prometheus. +message ManagedPrometheusConfig { + // Enable Managed Collection. + bool enabled = 1; +} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.create_attached_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.create_attached_cluster.js new file mode 100644 index 00000000000..09243b47191 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.create_attached_cluster.js @@ -0,0 +1,88 @@ +// 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, attachedCluster, attachedClusterId) { + // [START gkemulticloud_v1_generated_AttachedClusters_CreateAttachedCluster_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 parent location where this + * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource + * will be created. + * Location names are formatted as `projects//locations/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const parent = 'abc123' + /** + * Required. The specification of the + * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster to create. + */ + // const attachedCluster = {} + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource + * name formatted as + * `projects//locations//attachedClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + */ + // const attachedClusterId = 'abc123' + /** + * If set, only validate the request, but do not actually create the cluster. + */ + // const validateOnly = true + + // Imports the Gkemulticloud library + const {AttachedClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AttachedClustersClient(); + + async function callCreateAttachedCluster() { + // Construct request + const request = { + parent, + attachedCluster, + attachedClusterId, + }; + + // Run request + const [operation] = await gkemulticloudClient.createAttachedCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateAttachedCluster(); + // [END gkemulticloud_v1_generated_AttachedClusters_CreateAttachedCluster_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-gkemulticloud/v1/samples/generated/v1/attached_clusters.delete_attached_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.delete_attached_cluster.js new file mode 100644 index 00000000000..8fdb0ae29fe --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.delete_attached_cluster.js @@ -0,0 +1,95 @@ +// 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 gkemulticloud_v1_generated_AttachedClusters_DeleteAttachedCluster_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 the + * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster to delete. + * `AttachedCluster` names are formatted as + * `projects//locations//attachedClusters/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + */ + // const name = 'abc123' + /** + * If set, only validate the request, but do not actually delete the resource. + */ + // const validateOnly = true + /** + * If set to true, and the + * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource + * is not found, the request will succeed but no action will be taken on the + * server and a completed Operation google.longrunning.Operation will be + * returned. + * Useful for idempotent deletion. + */ + // const allowMissing = true + /** + * If set to true, the deletion of + * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource + * will succeed even if errors occur during deleting in cluster resources. + * Using this parameter may result in orphaned resources in the cluster. + */ + // const ignoreErrors = true + /** + * The current etag of the + * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + */ + // const etag = 'abc123' + + // Imports the Gkemulticloud library + const {AttachedClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AttachedClustersClient(); + + async function callDeleteAttachedCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gkemulticloudClient.deleteAttachedCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteAttachedCluster(); + // [END gkemulticloud_v1_generated_AttachedClusters_DeleteAttachedCluster_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-gkemulticloud/v1/samples/generated/v1/attached_clusters.generate_attached_cluster_install_manifest.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.generate_attached_cluster_install_manifest.js new file mode 100644 index 00000000000..cc1f1e59083 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.generate_attached_cluster_install_manifest.js @@ -0,0 +1,89 @@ +// 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, attachedClusterId, platformVersion) { + // [START gkemulticloud_v1_generated_AttachedClusters_GenerateAttachedClusterInstallManifest_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 parent location where this + * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource + * will be created. + * Location names are formatted as `projects//locations/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const parent = 'abc123' + /** + * Required. A client provided ID of the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource + * name formatted as + * `projects//locations//attachedClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + * When generating an install manifest for importing an existing Membership + * resource, the attached_cluster_id field must be the Membership id. + * Membership names are formatted as + * `projects//locations//memberships/`. + */ + // const attachedClusterId = 'abc123' + /** + * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * GetAttachedServerConfig google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig. + */ + // const platformVersion = 'abc123' + + // Imports the Gkemulticloud library + const {AttachedClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AttachedClustersClient(); + + async function callGenerateAttachedClusterInstallManifest() { + // Construct request + const request = { + parent, + attachedClusterId, + platformVersion, + }; + + // Run request + const response = await gkemulticloudClient.generateAttachedClusterInstallManifest(request); + console.log(response); + } + + callGenerateAttachedClusterInstallManifest(); + // [END gkemulticloud_v1_generated_AttachedClusters_GenerateAttachedClusterInstallManifest_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-gkemulticloud/v1/samples/generated/v1/attached_clusters.get_attached_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.get_attached_cluster.js new file mode 100644 index 00000000000..5e265334d16 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.get_attached_cluster.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(name) { + // [START gkemulticloud_v1_generated_AttachedClusters_GetAttachedCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the + * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource + * to describe. + * `AttachedCluster` names are formatted as + * `projects//locations//attachedClusters/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + */ + // const name = 'abc123' + + // Imports the Gkemulticloud library + const {AttachedClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AttachedClustersClient(); + + async function callGetAttachedCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkemulticloudClient.getAttachedCluster(request); + console.log(response); + } + + callGetAttachedCluster(); + // [END gkemulticloud_v1_generated_AttachedClusters_GetAttachedCluster_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-gkemulticloud/v1/samples/generated/v1/attached_clusters.get_attached_server_config.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.get_attached_server_config.js new file mode 100644 index 00000000000..5c26aee502d --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.get_attached_server_config.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(name) { + // [START gkemulticloud_v1_generated_AttachedClusters_GetAttachedServerConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the + * AttachedServerConfig google.cloud.gkemulticloud.v1.AttachedServerConfig + * resource to describe. + * `AttachedServerConfig` names are formatted as + * `projects//locations//attachedServerConfig`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const name = 'abc123' + + // Imports the Gkemulticloud library + const {AttachedClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AttachedClustersClient(); + + async function callGetAttachedServerConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkemulticloudClient.getAttachedServerConfig(request); + console.log(response); + } + + callGetAttachedServerConfig(); + // [END gkemulticloud_v1_generated_AttachedClusters_GetAttachedServerConfig_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-gkemulticloud/v1/samples/generated/v1/attached_clusters.import_attached_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.import_attached_cluster.js new file mode 100644 index 00000000000..72750afcabb --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.import_attached_cluster.js @@ -0,0 +1,90 @@ +// 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, fleetMembership, platformVersion, distribution) { + // [START gkemulticloud_v1_generated_AttachedClusters_ImportAttachedCluster_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 parent location where this + * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource + * will be created. + * Location names are formatted as `projects//locations/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const parent = 'abc123' + /** + * If set, only validate the request, but do not actually import the cluster. + */ + // const validateOnly = true + /** + * Required. The name of the fleet membership resource to import. + */ + // const fleetMembership = 'abc123' + /** + * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * You can list all supported versions on a given Google Cloud region by + * calling + * GetAttachedServerConfig google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig. + */ + // const platformVersion = 'abc123' + /** + * Required. The Kubernetes distribution of the underlying attached cluster. + * Supported values: "eks", "aks". + */ + // const distribution = 'abc123' + + // Imports the Gkemulticloud library + const {AttachedClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AttachedClustersClient(); + + async function callImportAttachedCluster() { + // Construct request + const request = { + parent, + fleetMembership, + platformVersion, + distribution, + }; + + // Run request + const [operation] = await gkemulticloudClient.importAttachedCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callImportAttachedCluster(); + // [END gkemulticloud_v1_generated_AttachedClusters_ImportAttachedCluster_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-gkemulticloud/v1/samples/generated/v1/attached_clusters.list_attached_clusters.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.list_attached_clusters.js new file mode 100644 index 00000000000..86d76f8626c --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.list_attached_clusters.js @@ -0,0 +1,82 @@ +// 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 gkemulticloud_v1_generated_AttachedClusters_ListAttachedClusters_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 parent location which owns this collection of + * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resources. + * Location names are formatted as `projects//locations/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * nextPageToken google.cloud.gkemulticloud.v1.ListAttachedClustersResponse.next_page_token + * to determine if there are more instances left to be queried. + */ + // const pageSize = 1234 + /** + * The `nextPageToken` value returned from a previous + * attachedClusters.list google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters + * request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Gkemulticloud library + const {AttachedClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AttachedClustersClient(); + + async function callListAttachedClusters() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gkemulticloudClient.listAttachedClustersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAttachedClusters(); + // [END gkemulticloud_v1_generated_AttachedClusters_ListAttachedClusters_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-gkemulticloud/v1/samples/generated/v1/attached_clusters.update_attached_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.update_attached_cluster.js new file mode 100644 index 00000000000..95fea7087d0 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.update_attached_cluster.js @@ -0,0 +1,82 @@ +// 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(attachedCluster, updateMask) { + // [START gkemulticloud_v1_generated_AttachedClusters_UpdateAttachedCluster_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 + * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource + * to update. + */ + // const attachedCluster = {} + /** + * If set, only validate the request, but do not actually update the cluster. + */ + // const validateOnly = true + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from + * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster: + * * `description`. + * * `annotations`. + * * `platform_version`. + * * `authorization.admin_users`. + * * `logging_config.component_config.enable_components`. + * * `monitoring_config.managed_prometheus_config.enabled`. + */ + // const updateMask = {} + + // Imports the Gkemulticloud library + const {AttachedClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AttachedClustersClient(); + + async function callUpdateAttachedCluster() { + // Construct request + const request = { + attachedCluster, + updateMask, + }; + + // Run request + const [operation] = await gkemulticloudClient.updateAttachedCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateAttachedCluster(); + // [END gkemulticloud_v1_generated_AttachedClusters_UpdateAttachedCluster_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.create_aws_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.create_aws_cluster.js new file mode 100644 index 00000000000..bebf61185d5 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.create_aws_cluster.js @@ -0,0 +1,88 @@ +// 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, awsCluster, awsClusterId) { + // [START gkemulticloud_v1_generated_AwsClusters_CreateAwsCluster_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 parent location where this + * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster resource will be + * created. + * Location names are formatted as `projects//locations/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const parent = 'abc123' + /** + * Required. The specification of the + * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster to create. + */ + // const awsCluster = {} + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster resource name + * formatted as + * `projects//locations//awsClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + */ + // const awsClusterId = 'abc123' + /** + * If set, only validate the request, but do not actually create the cluster. + */ + // const validateOnly = true + + // Imports the Gkemulticloud library + const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AwsClustersClient(); + + async function callCreateAwsCluster() { + // Construct request + const request = { + parent, + awsCluster, + awsClusterId, + }; + + // Run request + const [operation] = await gkemulticloudClient.createAwsCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateAwsCluster(); + // [END gkemulticloud_v1_generated_AwsClusters_CreateAwsCluster_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.create_aws_node_pool.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.create_aws_node_pool.js new file mode 100644 index 00000000000..60915a0e8fd --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.create_aws_node_pool.js @@ -0,0 +1,89 @@ +// 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, awsNodePool, awsNodePoolId) { + // [START gkemulticloud_v1_generated_AwsClusters_CreateAwsNodePool_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 AwsCluster google.cloud.gkemulticloud.v1.AwsCluster + * resource where this node pool will be created. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const parent = 'abc123' + /** + * Required. The specification of the + * AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool to create. + */ + // const awsNodePool = {} + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool resource name + * formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + */ + // const awsNodePoolId = 'abc123' + /** + * If set, only validate the request, but do not actually create the node + * pool. + */ + // const validateOnly = true + + // Imports the Gkemulticloud library + const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AwsClustersClient(); + + async function callCreateAwsNodePool() { + // Construct request + const request = { + parent, + awsNodePool, + awsNodePoolId, + }; + + // Run request + const [operation] = await gkemulticloudClient.createAwsNodePool(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateAwsNodePool(); + // [END gkemulticloud_v1_generated_AwsClusters_CreateAwsNodePool_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.delete_aws_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.delete_aws_cluster.js new file mode 100644 index 00000000000..9059ef97090 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.delete_aws_cluster.js @@ -0,0 +1,87 @@ +// 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 gkemulticloud_v1_generated_AwsClusters_DeleteAwsCluster_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 the + * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster to delete. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + */ + // const name = 'abc123' + /** + * If set, only validate the request, but do not actually delete the resource. + */ + // const validateOnly = true + /** + * If set to true, and the + * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed Operation google.longrunning.Operation will be returned. + * Useful for idempotent deletion. + */ + // const allowMissing = true + /** + * The current etag of the + * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + */ + // const etag = 'abc123' + + // Imports the Gkemulticloud library + const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AwsClustersClient(); + + async function callDeleteAwsCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gkemulticloudClient.deleteAwsCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteAwsCluster(); + // [END gkemulticloud_v1_generated_AwsClusters_DeleteAwsCluster_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.delete_aws_node_pool.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.delete_aws_node_pool.js new file mode 100644 index 00000000000..c0e11f27e76 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.delete_aws_node_pool.js @@ -0,0 +1,88 @@ +// 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 gkemulticloud_v1_generated_AwsClusters_DeleteAwsNodePool_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 the + * AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool to delete. + * `AwsNodePool` names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const name = 'abc123' + /** + * If set, only validate the request, but do not actually delete the node + * pool. + */ + // const validateOnly = true + /** + * If set to true, and the + * AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed Operation google.longrunning.Operation will be returned. + * Useful for idempotent deletion. + */ + // const allowMissing = true + /** + * The current ETag of the + * AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided ETag does not match the current etag of the node pool, + * the request will fail and an ABORTED error will be returned. + */ + // const etag = 'abc123' + + // Imports the Gkemulticloud library + const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AwsClustersClient(); + + async function callDeleteAwsNodePool() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gkemulticloudClient.deleteAwsNodePool(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteAwsNodePool(); + // [END gkemulticloud_v1_generated_AwsClusters_DeleteAwsNodePool_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.generate_aws_access_token.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.generate_aws_access_token.js new file mode 100644 index 00000000000..253bbe923f7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.generate_aws_access_token.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(awsCluster) { + // [START gkemulticloud_v1_generated_AwsClusters_GenerateAwsAccessToken_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the + * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster resource to + * authenticate to. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const awsCluster = 'abc123' + + // Imports the Gkemulticloud library + const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AwsClustersClient(); + + async function callGenerateAwsAccessToken() { + // Construct request + const request = { + awsCluster, + }; + + // Run request + const response = await gkemulticloudClient.generateAwsAccessToken(request); + console.log(response); + } + + callGenerateAwsAccessToken(); + // [END gkemulticloud_v1_generated_AwsClusters_GenerateAwsAccessToken_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_cluster.js new file mode 100644 index 00000000000..a8bb79ab935 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_cluster.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(name) { + // [START gkemulticloud_v1_generated_AwsClusters_GetAwsCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the + * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster resource to + * describe. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + */ + // const name = 'abc123' + + // Imports the Gkemulticloud library + const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AwsClustersClient(); + + async function callGetAwsCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkemulticloudClient.getAwsCluster(request); + console.log(response); + } + + callGetAwsCluster(); + // [END gkemulticloud_v1_generated_AwsClusters_GetAwsCluster_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_node_pool.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_node_pool.js new file mode 100644 index 00000000000..5ed5aabf0d7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_node_pool.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(name) { + // [START gkemulticloud_v1_generated_AwsClusters_GetAwsNodePool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the + * AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool resource to + * describe. + * `AwsNodePool` names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const name = 'abc123' + + // Imports the Gkemulticloud library + const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AwsClustersClient(); + + async function callGetAwsNodePool() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkemulticloudClient.getAwsNodePool(request); + console.log(response); + } + + callGetAwsNodePool(); + // [END gkemulticloud_v1_generated_AwsClusters_GetAwsNodePool_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_server_config.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_server_config.js new file mode 100644 index 00000000000..46187c7ab8f --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_server_config.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(name) { + // [START gkemulticloud_v1_generated_AwsClusters_GetAwsServerConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the + * AwsServerConfig google.cloud.gkemulticloud.v1.AwsServerConfig resource + * to describe. + * `AwsServerConfig` names are formatted as + * `projects//locations//awsServerConfig`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const name = 'abc123' + + // Imports the Gkemulticloud library + const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AwsClustersClient(); + + async function callGetAwsServerConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkemulticloudClient.getAwsServerConfig(request); + console.log(response); + } + + callGetAwsServerConfig(); + // [END gkemulticloud_v1_generated_AwsClusters_GetAwsServerConfig_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.list_aws_clusters.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.list_aws_clusters.js new file mode 100644 index 00000000000..af8dedecf15 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.list_aws_clusters.js @@ -0,0 +1,82 @@ +// 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 gkemulticloud_v1_generated_AwsClusters_ListAwsClusters_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 parent location which owns this collection of + * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster resources. + * Location names are formatted as `projects//locations/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * nextPageToken google.cloud.gkemulticloud.v1.ListAwsClustersResponse.next_page_token + * to determine if there are more instances left to be queried. + */ + // const pageSize = 1234 + /** + * The `nextPageToken` value returned from a previous + * awsClusters.list google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters + * request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Gkemulticloud library + const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AwsClustersClient(); + + async function callListAwsClusters() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gkemulticloudClient.listAwsClustersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAwsClusters(); + // [END gkemulticloud_v1_generated_AwsClusters_ListAwsClusters_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.list_aws_node_pools.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.list_aws_node_pools.js new file mode 100644 index 00000000000..d4077ddfd7f --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.list_aws_node_pools.js @@ -0,0 +1,83 @@ +// 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 gkemulticloud_v1_generated_AwsClusters_ListAwsNodePools_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 parent `AwsCluster` which owns this collection of + * AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool resources. + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * nextPageToken google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse.next_page_token + * to determine if there are more instances left to be queried. + */ + // const pageSize = 1234 + /** + * The `nextPageToken` value returned from a previous + * awsNodePools.list google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools + * request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Gkemulticloud library + const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AwsClustersClient(); + + async function callListAwsNodePools() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gkemulticloudClient.listAwsNodePoolsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAwsNodePools(); + // [END gkemulticloud_v1_generated_AwsClusters_ListAwsNodePools_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.update_aws_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.update_aws_cluster.js new file mode 100644 index 00000000000..02bf2990fb2 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.update_aws_cluster.js @@ -0,0 +1,97 @@ +// 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(awsCluster, updateMask) { + // [START gkemulticloud_v1_generated_AwsClusters_UpdateAwsCluster_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 AwsCluster google.cloud.gkemulticloud.v1.AwsCluster + * resource to update. + */ + // const awsCluster = {} + /** + * If set, only validate the request, but do not actually update the cluster. + */ + // const validateOnly = true + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from AwsCluster google.cloud.gkemulticloud.v1.AwsCluster: + * * `description`. + * * `annotations`. + * * `control_plane.version`. + * * `authorization.admin_users`. + * * `control_plane.aws_services_authentication.role_arn`. + * * `control_plane.aws_services_authentication.role_session_name`. + * * `control_plane.config_encryption.kms_key_arn`. + * * `control_plane.instance_type`. + * * `control_plane.security_group_ids`. + * * `control_plane.proxy_config`. + * * `control_plane.proxy_config.secret_arn`. + * * `control_plane.proxy_config.secret_version`. + * * `control_plane.root_volume.size_gib`. + * * `control_plane.root_volume.volume_type`. + * * `control_plane.root_volume.iops`. + * * `control_plane.root_volume.kms_key_arn`. + * * `control_plane.ssh_config`. + * * `control_plane.ssh_config.ec2_key_pair`. + * * `control_plane.instance_placement.tenancy`. + * * `control_plane.iam_instance_profile`. + * * `logging_config.component_config.enable_components`. + * * `control_plane.tags`. + * * `monitoring_config.managed_prometheus_config.enabled`. + */ + // const updateMask = {} + + // Imports the Gkemulticloud library + const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AwsClustersClient(); + + async function callUpdateAwsCluster() { + // Construct request + const request = { + awsCluster, + updateMask, + }; + + // Run request + const [operation] = await gkemulticloudClient.updateAwsCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateAwsCluster(); + // [END gkemulticloud_v1_generated_AwsClusters_UpdateAwsCluster_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.update_aws_node_pool.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.update_aws_node_pool.js new file mode 100644 index 00000000000..f5022f1c180 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.update_aws_node_pool.js @@ -0,0 +1,96 @@ +// 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(awsNodePool, updateMask) { + // [START gkemulticloud_v1_generated_AwsClusters_UpdateAwsNodePool_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 AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool + * resource to update. + */ + // const awsNodePool = {} + /** + * If set, only validate the request, but don't actually update the node pool. + */ + // const validateOnly = true + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool: + * * `annotations`. + * * `version`. + * * `autoscaling.min_node_count`. + * * `autoscaling.max_node_count`. + * * `config.config_encryption.kms_key_arn`. + * * `config.security_group_ids`. + * * `config.root_volume.iops`. + * * `config.root_volume.kms_key_arn`. + * * `config.root_volume.volume_type`. + * * `config.root_volume.size_gib`. + * * `config.proxy_config`. + * * `config.proxy_config.secret_arn`. + * * `config.proxy_config.secret_version`. + * * `config.ssh_config`. + * * `config.ssh_config.ec2_key_pair`. + * * `config.instance_placement.tenancy`. + * * `config.iam_instance_profile`. + * * `config.labels`. + * * `config.tags`. + * * `config.autoscaling_metrics_collection`. + * * `config.autoscaling_metrics_collection.granularity`. + * * `config.autoscaling_metrics_collection.metrics`. + */ + // const updateMask = {} + + // Imports the Gkemulticloud library + const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AwsClustersClient(); + + async function callUpdateAwsNodePool() { + // Construct request + const request = { + awsNodePool, + updateMask, + }; + + // Run request + const [operation] = await gkemulticloudClient.updateAwsNodePool(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateAwsNodePool(); + // [END gkemulticloud_v1_generated_AwsClusters_UpdateAwsNodePool_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_client.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_client.js new file mode 100644 index 00000000000..5a380a742fd --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_client.js @@ -0,0 +1,88 @@ +// 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, azureClient, azureClientId) { + // [START gkemulticloud_v1_generated_AzureClusters_CreateAzureClient_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 parent location where this + * AzureClient google.cloud.gkemulticloud.v1.AzureClient resource will be + * created. + * Location names are formatted as `projects//locations/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const parent = 'abc123' + /** + * Required. The specification of the + * AzureClient google.cloud.gkemulticloud.v1.AzureClient to create. + */ + // const azureClient = {} + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * AzureClient google.cloud.gkemulticloud.v1.AzureClient resource name + * formatted as + * `projects//locations//azureClients/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + */ + // const azureClientId = 'abc123' + /** + * If set, only validate the request, but do not actually create the client. + */ + // const validateOnly = true + + // Imports the Gkemulticloud library + const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AzureClustersClient(); + + async function callCreateAzureClient() { + // Construct request + const request = { + parent, + azureClient, + azureClientId, + }; + + // Run request + const [operation] = await gkemulticloudClient.createAzureClient(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateAzureClient(); + // [END gkemulticloud_v1_generated_AzureClusters_CreateAzureClient_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_cluster.js new file mode 100644 index 00000000000..9e580122fd6 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_cluster.js @@ -0,0 +1,88 @@ +// 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, azureCluster, azureClusterId) { + // [START gkemulticloud_v1_generated_AzureClusters_CreateAzureCluster_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 parent location where this + * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster resource will be + * created. + * Location names are formatted as `projects//locations/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const parent = 'abc123' + /** + * Required. The specification of the + * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster to create. + */ + // const azureCluster = {} + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster resource name + * formatted as + * `projects//locations//azureClusters/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + */ + // const azureClusterId = 'abc123' + /** + * If set, only validate the request, but do not actually create the cluster. + */ + // const validateOnly = true + + // Imports the Gkemulticloud library + const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AzureClustersClient(); + + async function callCreateAzureCluster() { + // Construct request + const request = { + parent, + azureCluster, + azureClusterId, + }; + + // Run request + const [operation] = await gkemulticloudClient.createAzureCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateAzureCluster(); + // [END gkemulticloud_v1_generated_AzureClusters_CreateAzureCluster_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_node_pool.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_node_pool.js new file mode 100644 index 00000000000..a9884c7d5cb --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_node_pool.js @@ -0,0 +1,88 @@ +// 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, azureNodePool, azureNodePoolId) { + // [START gkemulticloud_v1_generated_AzureClusters_CreateAzureNodePool_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 AzureCluster google.cloud.gkemulticloud.v1.AzureCluster + * resource where this node pool will be created. + * Location names are formatted as `projects//locations/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const parent = 'abc123' + /** + * Required. The specification of the + * AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool to create. + */ + // const azureNodePool = {} + /** + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * The provided ID will be part of the + * AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool resource name + * formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. + */ + // const azureNodePoolId = 'abc123' + /** + * If set, only validate the request, but do not actually create the node + * pool. + */ + // const validateOnly = true + + // Imports the Gkemulticloud library + const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AzureClustersClient(); + + async function callCreateAzureNodePool() { + // Construct request + const request = { + parent, + azureNodePool, + azureNodePoolId, + }; + + // Run request + const [operation] = await gkemulticloudClient.createAzureNodePool(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateAzureNodePool(); + // [END gkemulticloud_v1_generated_AzureClusters_CreateAzureNodePool_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_client.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_client.js new file mode 100644 index 00000000000..45f7cc1653a --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_client.js @@ -0,0 +1,80 @@ +// 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 gkemulticloud_v1_generated_AzureClusters_DeleteAzureClient_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 the + * AzureClient google.cloud.gkemulticloud.v1.AzureClient to delete. + * AzureClient google.cloud.gkemulticloud.v1.AzureClient names are + * formatted as + * `projects//locations//azureClients/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const name = 'abc123' + /** + * If set to true, and the + * AzureClient google.cloud.gkemulticloud.v1.AzureClient resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed Operation google.longrunning.Operation will be returned. + * Useful for idempotent deletion. + */ + // const allowMissing = true + /** + * If set, only validate the request, but do not actually delete the resource. + */ + // const validateOnly = true + + // Imports the Gkemulticloud library + const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AzureClustersClient(); + + async function callDeleteAzureClient() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gkemulticloudClient.deleteAzureClient(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteAzureClient(); + // [END gkemulticloud_v1_generated_AzureClusters_DeleteAzureClient_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_cluster.js new file mode 100644 index 00000000000..b2dbf072f6f --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_cluster.js @@ -0,0 +1,87 @@ +// 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 gkemulticloud_v1_generated_AzureClusters_DeleteAzureCluster_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 the + * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster to delete. + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + */ + // const name = 'abc123' + /** + * If set to true, and the + * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed Operation google.longrunning.Operation will be returned. + * Useful for idempotent deletion. + */ + // const allowMissing = true + /** + * If set, only validate the request, but do not actually delete the resource. + */ + // const validateOnly = true + /** + * The current etag of the + * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + */ + // const etag = 'abc123' + + // Imports the Gkemulticloud library + const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AzureClustersClient(); + + async function callDeleteAzureCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gkemulticloudClient.deleteAzureCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteAzureCluster(); + // [END gkemulticloud_v1_generated_AzureClusters_DeleteAzureCluster_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_node_pool.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_node_pool.js new file mode 100644 index 00000000000..dcc3b121b25 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_node_pool.js @@ -0,0 +1,89 @@ +// 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 gkemulticloud_v1_generated_AzureClusters_DeleteAzureNodePool_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 the + * AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool to delete. + * `AzureNodePool` names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const name = 'abc123' + /** + * If set, only validate the request, but do not actually delete the node + * pool. + */ + // const validateOnly = true + /** + * If set to true, and the + * AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool resource is + * not found, the request will succeed but no action will be taken on the + * server and a completed Operation google.longrunning.Operation will be + * returned. + * Useful for idempotent deletion. + */ + // const allowMissing = true + /** + * The current ETag of the + * AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool. + * Allows clients to perform deletions through optimistic concurrency control. + * If the provided ETag does not match the current etag of the node pool, + * the request will fail and an ABORTED error will be returned. + */ + // const etag = 'abc123' + + // Imports the Gkemulticloud library + const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AzureClustersClient(); + + async function callDeleteAzureNodePool() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gkemulticloudClient.deleteAzureNodePool(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteAzureNodePool(); + // [END gkemulticloud_v1_generated_AzureClusters_DeleteAzureNodePool_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.generate_azure_access_token.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.generate_azure_access_token.js new file mode 100644 index 00000000000..0a27cfcbd3d --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.generate_azure_access_token.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(azureCluster) { + // [START gkemulticloud_v1_generated_AzureClusters_GenerateAzureAccessToken_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the + * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster resource to + * authenticate to. + * `AzureCluster` names are formatted as + * `projects//locations//AzureClusters/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const azureCluster = 'abc123' + + // Imports the Gkemulticloud library + const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AzureClustersClient(); + + async function callGenerateAzureAccessToken() { + // Construct request + const request = { + azureCluster, + }; + + // Run request + const response = await gkemulticloudClient.generateAzureAccessToken(request); + console.log(response); + } + + callGenerateAzureAccessToken(); + // [END gkemulticloud_v1_generated_AzureClusters_GenerateAzureAccessToken_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_client.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_client.js new file mode 100644 index 00000000000..10ee35f4cbf --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_client.js @@ -0,0 +1,68 @@ +// 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 gkemulticloud_v1_generated_AzureClusters_GetAzureClient_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the + * AzureClient google.cloud.gkemulticloud.v1.AzureClient resource to + * describe. + * AzureClient google.cloud.gkemulticloud.v1.AzureClient names are + * formatted as + * `projects//locations//azureClients/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const name = 'abc123' + + // Imports the Gkemulticloud library + const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AzureClustersClient(); + + async function callGetAzureClient() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkemulticloudClient.getAzureClient(request); + console.log(response); + } + + callGetAzureClient(); + // [END gkemulticloud_v1_generated_AzureClusters_GetAzureClient_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_cluster.js new file mode 100644 index 00000000000..f575dfb7fef --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_cluster.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(name) { + // [START gkemulticloud_v1_generated_AzureClusters_GetAzureCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the + * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster resource to + * describe. + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + */ + // const name = 'abc123' + + // Imports the Gkemulticloud library + const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AzureClustersClient(); + + async function callGetAzureCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkemulticloudClient.getAzureCluster(request); + console.log(response); + } + + callGetAzureCluster(); + // [END gkemulticloud_v1_generated_AzureClusters_GetAzureCluster_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_node_pool.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_node_pool.js new file mode 100644 index 00000000000..8472d29a058 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_node_pool.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(name) { + // [START gkemulticloud_v1_generated_AzureClusters_GetAzureNodePool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the + * AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool resource to + * describe. + * `AzureNodePool` names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const name = 'abc123' + + // Imports the Gkemulticloud library + const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AzureClustersClient(); + + async function callGetAzureNodePool() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkemulticloudClient.getAzureNodePool(request); + console.log(response); + } + + callGetAzureNodePool(); + // [END gkemulticloud_v1_generated_AzureClusters_GetAzureNodePool_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_server_config.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_server_config.js new file mode 100644 index 00000000000..946ca8fcee8 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_server_config.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(name) { + // [START gkemulticloud_v1_generated_AzureClusters_GetAzureServerConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the + * AzureServerConfig google.cloud.gkemulticloud.v1.AzureServerConfig + * resource to describe. + * `AzureServerConfig` names are formatted as + * `projects//locations//azureServerConfig`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const name = 'abc123' + + // Imports the Gkemulticloud library + const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AzureClustersClient(); + + async function callGetAzureServerConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gkemulticloudClient.getAzureServerConfig(request); + console.log(response); + } + + callGetAzureServerConfig(); + // [END gkemulticloud_v1_generated_AzureClusters_GetAzureServerConfig_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_clients.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_clients.js new file mode 100644 index 00000000000..15ce045ff7e --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_clients.js @@ -0,0 +1,82 @@ +// 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 gkemulticloud_v1_generated_AzureClusters_ListAzureClients_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 parent location which owns this collection of + * AzureClient google.cloud.gkemulticloud.v1.AzureClient resources. + * Location names are formatted as `projects//locations/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * nextPageToken google.cloud.gkemulticloud.v1.ListAzureClientsResponse.next_page_token + * to determine if there are more instances left to be queried. + */ + // const pageSize = 1234 + /** + * The `nextPageToken` value returned from a previous + * azureClients.list google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients + * request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Gkemulticloud library + const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AzureClustersClient(); + + async function callListAzureClients() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gkemulticloudClient.listAzureClientsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAzureClients(); + // [END gkemulticloud_v1_generated_AzureClusters_ListAzureClients_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_clusters.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_clusters.js new file mode 100644 index 00000000000..61ee406c1ee --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_clusters.js @@ -0,0 +1,82 @@ +// 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 gkemulticloud_v1_generated_AzureClusters_ListAzureClusters_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 parent location which owns this collection of + * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster resources. + * Location names are formatted as `projects//locations/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * nextPageToken google.cloud.gkemulticloud.v1.ListAzureClustersResponse.next_page_token + * to determine if there are more instances left to be queried. + */ + // const pageSize = 1234 + /** + * The `nextPageToken` value returned from a previous + * azureClusters.list google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters + * request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Gkemulticloud library + const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AzureClustersClient(); + + async function callListAzureClusters() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gkemulticloudClient.listAzureClustersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAzureClusters(); + // [END gkemulticloud_v1_generated_AzureClusters_ListAzureClusters_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_node_pools.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_node_pools.js new file mode 100644 index 00000000000..8300eef3848 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_node_pools.js @@ -0,0 +1,83 @@ +// 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 gkemulticloud_v1_generated_AzureClusters_ListAzureNodePools_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 parent `AzureCluster` which owns this collection of + * AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool resources. + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * See Resource Names (https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * nextPageToken google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse.next_page_token + * to determine if there are more instances left to be queried. + */ + // const pageSize = 1234 + /** + * The `nextPageToken` value returned from a previous + * azureNodePools.list google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools + * request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Gkemulticloud library + const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AzureClustersClient(); + + async function callListAzureNodePools() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gkemulticloudClient.listAzureNodePoolsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAzureNodePools(); + // [END gkemulticloud_v1_generated_AzureClusters_ListAzureNodePools_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.update_azure_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.update_azure_cluster.js new file mode 100644 index 00000000000..f506e9ee86b --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.update_azure_cluster.js @@ -0,0 +1,90 @@ +// 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(azureCluster, updateMask) { + // [START gkemulticloud_v1_generated_AzureClusters_UpdateAzureCluster_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 AzureCluster google.cloud.gkemulticloud.v1.AzureCluster + * resource to update. + */ + // const azureCluster = {} + /** + * If set, only validate the request, but do not actually update the cluster. + */ + // const validateOnly = true + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from AzureCluster google.cloud.gkemulticloud.v1.AzureCluster: + * * `description`. + * * `azureClient`. + * * `control_plane.version`. + * * `control_plane.vm_size`. + * * `annotations`. + * * `authorization.admin_users`. + * * `control_plane.root_volume.size_gib`. + * * `azure_services_authentication`. + * * `azure_services_authentication.tenant_id`. + * * `azure_services_authentication.application_id`. + * * `control_plane.proxy_config`. + * * `control_plane.proxy_config.resource_group_id`. + * * `control_plane.proxy_config.secret_id`. + * * `control_plane.ssh_config.authorized_key`. + * * `logging_config.component_config.enable_components` + * * `monitoring_config.managed_prometheus_config.enabled`. + */ + // const updateMask = {} + + // Imports the Gkemulticloud library + const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AzureClustersClient(); + + async function callUpdateAzureCluster() { + // Construct request + const request = { + azureCluster, + updateMask, + }; + + // Run request + const [operation] = await gkemulticloudClient.updateAzureCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateAzureCluster(); + // [END gkemulticloud_v1_generated_AzureClusters_UpdateAzureCluster_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.update_azure_node_pool.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.update_azure_node_pool.js new file mode 100644 index 00000000000..9e28c7e11eb --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.update_azure_node_pool.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(azureNodePool, updateMask) { + // [START gkemulticloud_v1_generated_AzureClusters_UpdateAzureNodePool_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 AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool + * resource to update. + */ + // const azureNodePool = {} + /** + * If set, only validate the request, but don't actually update the node pool. + */ + // const validateOnly = true + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool: + * *. `annotations`. + * * `version`. + * * `autoscaling.min_node_count`. + * * `autoscaling.max_node_count`. + * * `config.ssh_config.authorized_key`. + */ + // const updateMask = {} + + // Imports the Gkemulticloud library + const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; + + // Instantiates a client + const gkemulticloudClient = new AzureClustersClient(); + + async function callUpdateAzureNodePool() { + // Construct request + const request = { + azureNodePool, + updateMask, + }; + + // Run request + const [operation] = await gkemulticloudClient.updateAzureNodePool(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateAzureNodePool(); + // [END gkemulticloud_v1_generated_AzureClusters_UpdateAzureNodePool_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-gkemulticloud/v1/samples/generated/v1/snippet_metadata_google.cloud.gkemulticloud.v1.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/snippet_metadata_google.cloud.gkemulticloud.v1.json new file mode 100644 index 00000000000..d49a78ae902 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/snippet_metadata_google.cloud.gkemulticloud.v1.json @@ -0,0 +1,1711 @@ +{ + "clientLibrary": { + "name": "nodejs-gkemulticloud", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.gkemulticloud.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "gkemulticloud_v1_generated_AttachedClusters_CreateAttachedCluster_async", + "title": "AttachedClusters createAttachedCluster Sample", + "origin": "API_DEFINITION", + "description": " Creates a new [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource on a given Google Cloud Platform project and region. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", + "canonical": true, + "file": "attached_clusters.create_attached_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateAttachedCluster", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.CreateAttachedCluster", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "attached_cluster", + "type": ".google.cloud.gkemulticloud.v1.AttachedCluster" + }, + { + "name": "attached_cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AttachedClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClustersClient" + }, + "method": { + "shortName": "CreateAttachedCluster", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.CreateAttachedCluster", + "service": { + "shortName": "AttachedClusters", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AttachedClusters_UpdateAttachedCluster_async", + "title": "AttachedClusters updateAttachedCluster Sample", + "origin": "API_DEFINITION", + "description": " Updates an [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster].", + "canonical": true, + "file": "attached_clusters.update_attached_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAttachedCluster", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.UpdateAttachedCluster", + "async": true, + "parameters": [ + { + "name": "attached_cluster", + "type": ".google.cloud.gkemulticloud.v1.AttachedCluster" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AttachedClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClustersClient" + }, + "method": { + "shortName": "UpdateAttachedCluster", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.UpdateAttachedCluster", + "service": { + "shortName": "AttachedClusters", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AttachedClusters_ImportAttachedCluster_async", + "title": "AttachedClusters importAttachedCluster Sample", + "origin": "API_DEFINITION", + "description": " Imports creates a new [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource by importing an existing Fleet Membership resource. Attached Clusters created before the introduction of the Anthos Multi-Cloud API can be imported through this method. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", + "canonical": true, + "file": "attached_clusters.import_attached_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportAttachedCluster", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.ImportAttachedCluster", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "fleet_membership", + "type": "TYPE_STRING" + }, + { + "name": "platform_version", + "type": "TYPE_STRING" + }, + { + "name": "distribution", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AttachedClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClustersClient" + }, + "method": { + "shortName": "ImportAttachedCluster", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.ImportAttachedCluster", + "service": { + "shortName": "AttachedClusters", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AttachedClusters_GetAttachedCluster_async", + "title": "AttachedClusters getAttachedCluster Sample", + "origin": "API_DEFINITION", + "description": " Describes a specific [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource.", + "canonical": true, + "file": "attached_clusters.get_attached_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAttachedCluster", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.AttachedCluster", + "client": { + "shortName": "AttachedClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClustersClient" + }, + "method": { + "shortName": "GetAttachedCluster", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedCluster", + "service": { + "shortName": "AttachedClusters", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AttachedClusters_ListAttachedClusters_async", + "title": "AttachedClusters listAttachedClusters Sample", + "origin": "API_DEFINITION", + "description": " Lists all [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resources on a given Google Cloud project and region.", + "canonical": true, + "file": "attached_clusters.list_attached_clusters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAttachedClusters", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.ListAttachedClustersResponse", + "client": { + "shortName": "AttachedClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClustersClient" + }, + "method": { + "shortName": "ListAttachedClusters", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters", + "service": { + "shortName": "AttachedClusters", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AttachedClusters_DeleteAttachedCluster_async", + "title": "AttachedClusters deleteAttachedCluster Sample", + "origin": "API_DEFINITION", + "description": " Deletes a specific [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", + "canonical": true, + "file": "attached_clusters.delete_attached_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAttachedCluster", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.DeleteAttachedCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + }, + { + "name": "ignore_errors", + "type": "TYPE_BOOL" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AttachedClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClustersClient" + }, + "method": { + "shortName": "DeleteAttachedCluster", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.DeleteAttachedCluster", + "service": { + "shortName": "AttachedClusters", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AttachedClusters_GetAttachedServerConfig_async", + "title": "AttachedClusters getAttachedServerConfig Sample", + "origin": "API_DEFINITION", + "description": " Returns information, such as supported Kubernetes versions, on a given Google Cloud location.", + "canonical": true, + "file": "attached_clusters.get_attached_server_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAttachedServerConfig", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.AttachedServerConfig", + "client": { + "shortName": "AttachedClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClustersClient" + }, + "method": { + "shortName": "GetAttachedServerConfig", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig", + "service": { + "shortName": "AttachedClusters", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AttachedClusters_GenerateAttachedClusterInstallManifest_async", + "title": "AttachedClusters generateAttachedClusterInstallManifest Sample", + "origin": "API_DEFINITION", + "description": " Generates the install manifest to be installed on the target cluster.", + "canonical": true, + "file": "attached_clusters.generate_attached_cluster_install_manifest.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 81, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateAttachedClusterInstallManifest", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.GenerateAttachedClusterInstallManifest", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "attached_cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "platform_version", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestResponse", + "client": { + "shortName": "AttachedClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClustersClient" + }, + "method": { + "shortName": "GenerateAttachedClusterInstallManifest", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.GenerateAttachedClusterInstallManifest", + "service": { + "shortName": "AttachedClusters", + "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AwsClusters_CreateAwsCluster_async", + "title": "AttachedClusters createAwsCluster Sample", + "origin": "API_DEFINITION", + "description": " Creates a new [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource on a given Google Cloud Platform project and region. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", + "canonical": true, + "file": "aws_clusters.create_aws_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateAwsCluster", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.CreateAwsCluster", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "aws_cluster", + "type": ".google.cloud.gkemulticloud.v1.AwsCluster" + }, + { + "name": "aws_cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AwsClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" + }, + "method": { + "shortName": "CreateAwsCluster", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.CreateAwsCluster", + "service": { + "shortName": "AwsClusters", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AwsClusters_UpdateAwsCluster_async", + "title": "AttachedClusters updateAwsCluster Sample", + "origin": "API_DEFINITION", + "description": " Updates an [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster].", + "canonical": true, + "file": "aws_clusters.update_aws_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 89, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAwsCluster", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.UpdateAwsCluster", + "async": true, + "parameters": [ + { + "name": "aws_cluster", + "type": ".google.cloud.gkemulticloud.v1.AwsCluster" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AwsClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" + }, + "method": { + "shortName": "UpdateAwsCluster", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.UpdateAwsCluster", + "service": { + "shortName": "AwsClusters", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AwsClusters_GetAwsCluster_async", + "title": "AttachedClusters getAwsCluster Sample", + "origin": "API_DEFINITION", + "description": " Describes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource.", + "canonical": true, + "file": "aws_clusters.get_aws_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAwsCluster", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.GetAwsCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.AwsCluster", + "client": { + "shortName": "AwsClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" + }, + "method": { + "shortName": "GetAwsCluster", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.GetAwsCluster", + "service": { + "shortName": "AwsClusters", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AwsClusters_ListAwsClusters_async", + "title": "AttachedClusters listAwsClusters Sample", + "origin": "API_DEFINITION", + "description": " Lists all [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources on a given Google Cloud project and region.", + "canonical": true, + "file": "aws_clusters.list_aws_clusters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAwsClusters", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.ListAwsClustersResponse", + "client": { + "shortName": "AwsClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" + }, + "method": { + "shortName": "ListAwsClusters", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters", + "service": { + "shortName": "AwsClusters", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AwsClusters_DeleteAwsCluster_async", + "title": "AttachedClusters deleteAwsCluster Sample", + "origin": "API_DEFINITION", + "description": " Deletes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource. Fails if the cluster has one or more associated [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", + "canonical": true, + "file": "aws_clusters.delete_aws_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAwsCluster", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.DeleteAwsCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AwsClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" + }, + "method": { + "shortName": "DeleteAwsCluster", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.DeleteAwsCluster", + "service": { + "shortName": "AwsClusters", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AwsClusters_GenerateAwsAccessToken_async", + "title": "AttachedClusters generateAwsAccessToken Sample", + "origin": "API_DEFINITION", + "description": " Generates a short-lived access token to authenticate to a given [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource.", + "canonical": true, + "file": "aws_clusters.generate_aws_access_token.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateAwsAccessToken", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.GenerateAwsAccessToken", + "async": true, + "parameters": [ + { + "name": "aws_cluster", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenResponse", + "client": { + "shortName": "AwsClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" + }, + "method": { + "shortName": "GenerateAwsAccessToken", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.GenerateAwsAccessToken", + "service": { + "shortName": "AwsClusters", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AwsClusters_CreateAwsNodePool_async", + "title": "AttachedClusters createAwsNodePool Sample", + "origin": "API_DEFINITION", + "description": " Creates a new [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool], attached to a given [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", + "canonical": true, + "file": "aws_clusters.create_aws_node_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 81, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateAwsNodePool", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.CreateAwsNodePool", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "aws_node_pool", + "type": ".google.cloud.gkemulticloud.v1.AwsNodePool" + }, + { + "name": "aws_node_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AwsClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" + }, + "method": { + "shortName": "CreateAwsNodePool", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.CreateAwsNodePool", + "service": { + "shortName": "AwsClusters", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AwsClusters_UpdateAwsNodePool_async", + "title": "AttachedClusters updateAwsNodePool Sample", + "origin": "API_DEFINITION", + "description": " Updates an [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool].", + "canonical": true, + "file": "aws_clusters.update_aws_node_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 88, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAwsNodePool", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.UpdateAwsNodePool", + "async": true, + "parameters": [ + { + "name": "aws_node_pool", + "type": ".google.cloud.gkemulticloud.v1.AwsNodePool" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AwsClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" + }, + "method": { + "shortName": "UpdateAwsNodePool", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.UpdateAwsNodePool", + "service": { + "shortName": "AwsClusters", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AwsClusters_GetAwsNodePool_async", + "title": "AttachedClusters getAwsNodePool Sample", + "origin": "API_DEFINITION", + "description": " Describes a specific [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource.", + "canonical": true, + "file": "aws_clusters.get_aws_node_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAwsNodePool", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.GetAwsNodePool", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.AwsNodePool", + "client": { + "shortName": "AwsClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" + }, + "method": { + "shortName": "GetAwsNodePool", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.GetAwsNodePool", + "service": { + "shortName": "AwsClusters", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AwsClusters_ListAwsNodePools_async", + "title": "AttachedClusters listAwsNodePools Sample", + "origin": "API_DEFINITION", + "description": " Lists all [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources on a given [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster].", + "canonical": true, + "file": "aws_clusters.list_aws_node_pools.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAwsNodePools", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse", + "client": { + "shortName": "AwsClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" + }, + "method": { + "shortName": "ListAwsNodePools", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools", + "service": { + "shortName": "AwsClusters", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AwsClusters_DeleteAwsNodePool_async", + "title": "AttachedClusters deleteAwsNodePool Sample", + "origin": "API_DEFINITION", + "description": " Deletes a specific [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", + "canonical": true, + "file": "aws_clusters.delete_aws_node_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAwsNodePool", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.DeleteAwsNodePool", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AwsClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" + }, + "method": { + "shortName": "DeleteAwsNodePool", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.DeleteAwsNodePool", + "service": { + "shortName": "AwsClusters", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AwsClusters_GetAwsServerConfig_async", + "title": "AttachedClusters getAwsServerConfig Sample", + "origin": "API_DEFINITION", + "description": " Returns information, such as supported AWS regions and Kubernetes versions, on a given Google Cloud location.", + "canonical": true, + "file": "aws_clusters.get_aws_server_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAwsServerConfig", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.AwsServerConfig", + "client": { + "shortName": "AwsClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" + }, + "method": { + "shortName": "GetAwsServerConfig", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig", + "service": { + "shortName": "AwsClusters", + "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AzureClusters_CreateAzureClient_async", + "title": "AttachedClusters createAzureClient Sample", + "origin": "API_DEFINITION", + "description": " Creates a new [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource on a given Google Cloud project and region. `AzureClient` resources hold client authentication information needed by the Anthos Multicloud API to manage Azure resources on your Azure subscription on your behalf. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", + "canonical": true, + "file": "azure_clusters.create_azure_client.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateAzureClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.CreateAzureClient", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "azure_client", + "type": ".google.cloud.gkemulticloud.v1.AzureClient" + }, + { + "name": "azure_client_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AzureClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" + }, + "method": { + "shortName": "CreateAzureClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.CreateAzureClient", + "service": { + "shortName": "AzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AzureClusters_GetAzureClient_async", + "title": "AttachedClusters getAzureClient Sample", + "origin": "API_DEFINITION", + "description": " Describes a specific [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource.", + "canonical": true, + "file": "azure_clusters.get_azure_client.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAzureClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GetAzureClient", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.AzureClient", + "client": { + "shortName": "AzureClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" + }, + "method": { + "shortName": "GetAzureClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GetAzureClient", + "service": { + "shortName": "AzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AzureClusters_ListAzureClients_async", + "title": "AttachedClusters listAzureClients Sample", + "origin": "API_DEFINITION", + "description": " Lists all [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resources on a given Google Cloud project and region.", + "canonical": true, + "file": "azure_clusters.list_azure_clients.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAzureClients", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.ListAzureClientsResponse", + "client": { + "shortName": "AzureClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" + }, + "method": { + "shortName": "ListAzureClients", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients", + "service": { + "shortName": "AzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AzureClusters_DeleteAzureClient_async", + "title": "AttachedClusters deleteAzureClient Sample", + "origin": "API_DEFINITION", + "description": " Deletes a specific [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource. If the client is used by one or more clusters, deletion will fail and a `FAILED_PRECONDITION` error will be returned. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", + "canonical": true, + "file": "azure_clusters.delete_azure_client.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAzureClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.DeleteAzureClient", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AzureClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" + }, + "method": { + "shortName": "DeleteAzureClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.DeleteAzureClient", + "service": { + "shortName": "AzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AzureClusters_CreateAzureCluster_async", + "title": "AttachedClusters createAzureCluster Sample", + "origin": "API_DEFINITION", + "description": " Creates a new [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource on a given Google Cloud Platform project and region. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", + "canonical": true, + "file": "azure_clusters.create_azure_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateAzureCluster", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.CreateAzureCluster", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "azure_cluster", + "type": ".google.cloud.gkemulticloud.v1.AzureCluster" + }, + { + "name": "azure_cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AzureClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" + }, + "method": { + "shortName": "CreateAzureCluster", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.CreateAzureCluster", + "service": { + "shortName": "AzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AzureClusters_UpdateAzureCluster_async", + "title": "AttachedClusters updateAzureCluster Sample", + "origin": "API_DEFINITION", + "description": " Updates an [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster].", + "canonical": true, + "file": "azure_clusters.update_azure_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAzureCluster", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.UpdateAzureCluster", + "async": true, + "parameters": [ + { + "name": "azure_cluster", + "type": ".google.cloud.gkemulticloud.v1.AzureCluster" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AzureClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" + }, + "method": { + "shortName": "UpdateAzureCluster", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.UpdateAzureCluster", + "service": { + "shortName": "AzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AzureClusters_GetAzureCluster_async", + "title": "AttachedClusters getAzureCluster Sample", + "origin": "API_DEFINITION", + "description": " Describes a specific [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource.", + "canonical": true, + "file": "azure_clusters.get_azure_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAzureCluster", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GetAzureCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.AzureCluster", + "client": { + "shortName": "AzureClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" + }, + "method": { + "shortName": "GetAzureCluster", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GetAzureCluster", + "service": { + "shortName": "AzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AzureClusters_ListAzureClusters_async", + "title": "AttachedClusters listAzureClusters Sample", + "origin": "API_DEFINITION", + "description": " Lists all [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resources on a given Google Cloud project and region.", + "canonical": true, + "file": "azure_clusters.list_azure_clusters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.ListAzureClustersResponse", + "client": { + "shortName": "AzureClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" + }, + "method": { + "shortName": "ListAzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters", + "service": { + "shortName": "AzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AzureClusters_DeleteAzureCluster_async", + "title": "AttachedClusters deleteAzureCluster Sample", + "origin": "API_DEFINITION", + "description": " Deletes a specific [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. Fails if the cluster has one or more associated [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", + "canonical": true, + "file": "azure_clusters.delete_azure_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAzureCluster", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.DeleteAzureCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AzureClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" + }, + "method": { + "shortName": "DeleteAzureCluster", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.DeleteAzureCluster", + "service": { + "shortName": "AzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AzureClusters_GenerateAzureAccessToken_async", + "title": "AttachedClusters generateAzureAccessToken Sample", + "origin": "API_DEFINITION", + "description": " Generates a short-lived access token to authenticate to a given [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource.", + "canonical": true, + "file": "azure_clusters.generate_azure_access_token.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateAzureAccessToken", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GenerateAzureAccessToken", + "async": true, + "parameters": [ + { + "name": "azure_cluster", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenResponse", + "client": { + "shortName": "AzureClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" + }, + "method": { + "shortName": "GenerateAzureAccessToken", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GenerateAzureAccessToken", + "service": { + "shortName": "AzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AzureClusters_CreateAzureNodePool_async", + "title": "AttachedClusters createAzureNodePool Sample", + "origin": "API_DEFINITION", + "description": " Creates a new [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool], attached to a given [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", + "canonical": true, + "file": "azure_clusters.create_azure_node_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateAzureNodePool", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.CreateAzureNodePool", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "azure_node_pool", + "type": ".google.cloud.gkemulticloud.v1.AzureNodePool" + }, + { + "name": "azure_node_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AzureClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" + }, + "method": { + "shortName": "CreateAzureNodePool", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.CreateAzureNodePool", + "service": { + "shortName": "AzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AzureClusters_UpdateAzureNodePool_async", + "title": "AttachedClusters updateAzureNodePool Sample", + "origin": "API_DEFINITION", + "description": " Updates an [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool].", + "canonical": true, + "file": "azure_clusters.update_azure_node_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAzureNodePool", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.UpdateAzureNodePool", + "async": true, + "parameters": [ + { + "name": "azure_node_pool", + "type": ".google.cloud.gkemulticloud.v1.AzureNodePool" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AzureClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" + }, + "method": { + "shortName": "UpdateAzureNodePool", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.UpdateAzureNodePool", + "service": { + "shortName": "AzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AzureClusters_GetAzureNodePool_async", + "title": "AttachedClusters getAzureNodePool Sample", + "origin": "API_DEFINITION", + "description": " Describes a specific [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource.", + "canonical": true, + "file": "azure_clusters.get_azure_node_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAzureNodePool", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GetAzureNodePool", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.AzureNodePool", + "client": { + "shortName": "AzureClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" + }, + "method": { + "shortName": "GetAzureNodePool", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GetAzureNodePool", + "service": { + "shortName": "AzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AzureClusters_ListAzureNodePools_async", + "title": "AttachedClusters listAzureNodePools Sample", + "origin": "API_DEFINITION", + "description": " Lists all [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources on a given [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster].", + "canonical": true, + "file": "azure_clusters.list_azure_node_pools.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAzureNodePools", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse", + "client": { + "shortName": "AzureClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" + }, + "method": { + "shortName": "ListAzureNodePools", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools", + "service": { + "shortName": "AzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AzureClusters_DeleteAzureNodePool_async", + "title": "AttachedClusters deleteAzureNodePool Sample", + "origin": "API_DEFINITION", + "description": " Deletes a specific [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", + "canonical": true, + "file": "azure_clusters.delete_azure_node_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 81, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAzureNodePool", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.DeleteAzureNodePool", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AzureClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" + }, + "method": { + "shortName": "DeleteAzureNodePool", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.DeleteAzureNodePool", + "service": { + "shortName": "AzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" + } + } + } + }, + { + "regionTag": "gkemulticloud_v1_generated_AzureClusters_GetAzureServerConfig_async", + "title": "AttachedClusters getAzureServerConfig Sample", + "origin": "API_DEFINITION", + "description": " Returns information, such as supported Azure regions and Kubernetes versions, on a given Google Cloud location.", + "canonical": true, + "file": "azure_clusters.get_azure_server_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAzureServerConfig", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gkemulticloud.v1.AzureServerConfig", + "client": { + "shortName": "AzureClustersClient", + "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" + }, + "method": { + "shortName": "GetAzureServerConfig", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig", + "service": { + "shortName": "AzureClusters", + "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/index.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/index.ts new file mode 100644 index 00000000000..157c1d271d5 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/index.ts @@ -0,0 +1,29 @@ +// 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 AttachedClustersClient = v1.AttachedClustersClient; +type AttachedClustersClient = v1.AttachedClustersClient; +const AwsClustersClient = v1.AwsClustersClient; +type AwsClustersClient = v1.AwsClustersClient; +const AzureClustersClient = v1.AzureClustersClient; +type AzureClustersClient = v1.AzureClustersClient; +export {v1, AttachedClustersClient, AwsClustersClient, AzureClustersClient}; +export default {v1, AttachedClustersClient, AwsClustersClient, AzureClustersClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_client.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_client.ts new file mode 100644 index 00000000000..e09c5bf05b3 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_client.ts @@ -0,0 +1,2007 @@ +// 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, GrpcClientOptions, LROperation, 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/attached_clusters_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './attached_clusters_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The AttachedClusters API provides a single centrally managed service + * to register and manage Anthos attached clusters that run on customer's owned + * infrastructure. + * @class + * @memberof v1 + */ +export class AttachedClustersClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + attachedClustersStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AttachedClustersClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 AttachedClustersClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof AttachedClustersClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // 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 { + 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 = { + attachedClusterPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/attachedClusters/{attached_cluster}' + ), + attachedServerConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/attachedServerConfig' + ), + awsClusterPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/awsClusters/{aws_cluster}' + ), + awsNodePoolPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/awsClusters/{aws_cluster}/awsNodePools/{aws_node_pool}' + ), + awsServerConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/awsServerConfig' + ), + azureClientPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/azureClients/{azure_client}' + ), + azureClusterPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/azureClusters/{azure_cluster}' + ), + azureNodePoolPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/azureClusters/{azure_cluster}/azureNodePools/{azure_node_pool}' + ), + azureServerConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/azureServerConfig' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // 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 = { + listAttachedClusters: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'attachedClusters') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createAttachedClusterResponse = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.AttachedCluster') as gax.protobuf.Type; + const createAttachedClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + const updateAttachedClusterResponse = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.AttachedCluster') as gax.protobuf.Type; + const updateAttachedClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + const importAttachedClusterResponse = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.AttachedCluster') as gax.protobuf.Type; + const importAttachedClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + const deleteAttachedClusterResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteAttachedClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createAttachedCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createAttachedClusterResponse.decode.bind(createAttachedClusterResponse), + createAttachedClusterMetadata.decode.bind(createAttachedClusterMetadata)), + updateAttachedCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateAttachedClusterResponse.decode.bind(updateAttachedClusterResponse), + updateAttachedClusterMetadata.decode.bind(updateAttachedClusterMetadata)), + importAttachedCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importAttachedClusterResponse.decode.bind(importAttachedClusterResponse), + importAttachedClusterMetadata.decode.bind(importAttachedClusterMetadata)), + deleteAttachedCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteAttachedClusterResponse.decode.bind(deleteAttachedClusterResponse), + deleteAttachedClusterMetadata.decode.bind(deleteAttachedClusterMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.gkemulticloud.v1.AttachedClusters', 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.attachedClustersStub) { + return this.attachedClustersStub; + } + + // Put together the "service stub" for + // google.cloud.gkemulticloud.v1.AttachedClusters. + this.attachedClustersStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.gkemulticloud.v1.AttachedClusters') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.gkemulticloud.v1.AttachedClusters, + 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 attachedClustersStubMethods = + ['createAttachedCluster', 'updateAttachedCluster', 'importAttachedCluster', 'getAttachedCluster', 'listAttachedClusters', 'deleteAttachedCluster', 'getAttachedServerConfig', 'generateAttachedClusterInstallManifest']; + for (const methodName of attachedClustersStubMethods) { + const callPromise = this.attachedClustersStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.attachedClustersStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'gkemulticloud.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 'gkemulticloud.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 -- + // ------------------- +/** + * Describes a specific + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource + * to describe. + * + * `AttachedCluster` names are formatted as + * `projects//locations//attachedClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/attached_clusters.get_attached_cluster.js + * region_tag:gkemulticloud_v1_generated_AttachedClusters_GetAttachedCluster_async + */ + getAttachedCluster( + request?: protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAttachedCluster, + protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest|undefined, {}|undefined + ]>; + getAttachedCluster( + request: protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAttachedCluster, + protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest|null|undefined, + {}|null|undefined>): void; + getAttachedCluster( + request: protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAttachedCluster, + protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest|null|undefined, + {}|null|undefined>): void; + getAttachedCluster( + request?: protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkemulticloud.v1.IAttachedCluster, + protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkemulticloud.v1.IAttachedCluster, + protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAttachedCluster, + protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest|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.getAttachedCluster(request, options, callback); + } +/** + * Returns information, such as supported Kubernetes versions, on a given + * Google Cloud location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the + * {@link protos.google.cloud.gkemulticloud.v1.AttachedServerConfig|AttachedServerConfig} + * resource to describe. + * + * `AttachedServerConfig` names are formatted as + * `projects//locations//attachedServerConfig`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AttachedServerConfig|AttachedServerConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/attached_clusters.get_attached_server_config.js + * region_tag:gkemulticloud_v1_generated_AttachedClusters_GetAttachedServerConfig_async + */ + getAttachedServerConfig( + request?: protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAttachedServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest|undefined, {}|undefined + ]>; + getAttachedServerConfig( + request: protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAttachedServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest|null|undefined, + {}|null|undefined>): void; + getAttachedServerConfig( + request: protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAttachedServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest|null|undefined, + {}|null|undefined>): void; + getAttachedServerConfig( + request?: protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkemulticloud.v1.IAttachedServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkemulticloud.v1.IAttachedServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAttachedServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest|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.getAttachedServerConfig(request, options, callback); + } +/** + * Generates the install manifest to be installed on the target cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location where this + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource + * will be created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {string} request.attachedClusterId + * Required. A client provided ID of the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource + * name formatted as + * `projects//locations//attachedClusters/`. + * + * Valid characters are `/{@link protos.0-9|a-z}-/`. Cannot be longer than 63 characters. + * + * When generating an install manifest for importing an existing Membership + * resource, the attached_cluster_id field must be the Membership id. + * + * Membership names are formatted as + * `projects//locations//memberships/`. + * @param {string} request.platformVersion + * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * + * You can list all supported versions on a given Google Cloud region by + * calling + * {@link protos.google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig|GetAttachedServerConfig}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestResponse|GenerateAttachedClusterInstallManifestResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/attached_clusters.generate_attached_cluster_install_manifest.js + * region_tag:gkemulticloud_v1_generated_AttachedClusters_GenerateAttachedClusterInstallManifest_async + */ + generateAttachedClusterInstallManifest( + request?: protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest|undefined, {}|undefined + ]>; + generateAttachedClusterInstallManifest( + request: protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest|null|undefined, + {}|null|undefined>): void; + generateAttachedClusterInstallManifest( + request: protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest|null|undefined, + {}|null|undefined>): void; + generateAttachedClusterInstallManifest( + request?: protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest|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.generateAttachedClusterInstallManifest(request, options, callback); + } + +/** + * Creates a new + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource + * on a given Google Cloud Platform project and region. + * + * If successful, the response contains a newly created + * {@link protos.google.longrunning.Operation|Operation} resource that can be + * described to track the status of the operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location where this + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource + * will be created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {google.cloud.gkemulticloud.v1.AttachedCluster} request.attachedCluster + * Required. The specification of the + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} to create. + * @param {string} request.attachedClusterId + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource + * name formatted as + * `projects//locations//attachedClusters/`. + * + * Valid characters are `/{@link protos.0-9|a-z}-/`. Cannot be longer than 63 characters. + * @param {boolean} request.validateOnly + * If set, only validate the request, but do not actually create the cluster. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/attached_clusters.create_attached_cluster.js + * region_tag:gkemulticloud_v1_generated_AttachedClusters_CreateAttachedCluster_async + */ + createAttachedCluster( + request?: protos.google.cloud.gkemulticloud.v1.ICreateAttachedClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createAttachedCluster( + request: protos.google.cloud.gkemulticloud.v1.ICreateAttachedClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAttachedCluster( + request: protos.google.cloud.gkemulticloud.v1.ICreateAttachedClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAttachedCluster( + request?: protos.google.cloud.gkemulticloud.v1.ICreateAttachedClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createAttachedCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createAttachedCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/attached_clusters.create_attached_cluster.js + * region_tag:gkemulticloud_v1_generated_AttachedClusters_CreateAttachedCluster_async + */ + async checkCreateAttachedClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAttachedCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.gkemulticloud.v1.AttachedCluster} request.attachedCluster + * Required. The + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource + * to update. + * @param {boolean} request.validateOnly + * If set, only validate the request, but do not actually update the cluster. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster}: + * + * * `description`. + * * `annotations`. + * * `platform_version`. + * * `authorization.admin_users`. + * * `logging_config.component_config.enable_components`. + * * `monitoring_config.managed_prometheus_config.enabled`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/attached_clusters.update_attached_cluster.js + * region_tag:gkemulticloud_v1_generated_AttachedClusters_UpdateAttachedCluster_async + */ + updateAttachedCluster( + request?: protos.google.cloud.gkemulticloud.v1.IUpdateAttachedClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateAttachedCluster( + request: protos.google.cloud.gkemulticloud.v1.IUpdateAttachedClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateAttachedCluster( + request: protos.google.cloud.gkemulticloud.v1.IUpdateAttachedClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateAttachedCluster( + request?: protos.google.cloud.gkemulticloud.v1.IUpdateAttachedClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'attached_cluster.name': request.attachedCluster!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateAttachedCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateAttachedCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/attached_clusters.update_attached_cluster.js + * region_tag:gkemulticloud_v1_generated_AttachedClusters_UpdateAttachedCluster_async + */ + async checkUpdateAttachedClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateAttachedCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Imports creates a new + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource + * by importing an existing Fleet Membership resource. + * + * Attached Clusters created before the introduction of the Anthos Multi-Cloud + * API can be imported through this method. + * + * If successful, the response contains a newly created + * {@link protos.google.longrunning.Operation|Operation} resource that can be + * described to track the status of the operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location where this + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource + * will be created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {boolean} request.validateOnly + * If set, only validate the request, but do not actually import the cluster. + * @param {string} request.fleetMembership + * Required. The name of the fleet membership resource to import. + * @param {string} request.platformVersion + * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). + * + * You can list all supported versions on a given Google Cloud region by + * calling + * {@link protos.google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig|GetAttachedServerConfig}. + * @param {string} request.distribution + * Required. The Kubernetes distribution of the underlying attached cluster. + * + * Supported values: ["eks", "aks"]. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/attached_clusters.import_attached_cluster.js + * region_tag:gkemulticloud_v1_generated_AttachedClusters_ImportAttachedCluster_async + */ + importAttachedCluster( + request?: protos.google.cloud.gkemulticloud.v1.IImportAttachedClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + importAttachedCluster( + request: protos.google.cloud.gkemulticloud.v1.IImportAttachedClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + importAttachedCluster( + request: protos.google.cloud.gkemulticloud.v1.IImportAttachedClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + importAttachedCluster( + request?: protos.google.cloud.gkemulticloud.v1.IImportAttachedClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.importAttachedCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `importAttachedCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/attached_clusters.import_attached_cluster.js + * region_tag:gkemulticloud_v1_generated_AttachedClusters_ImportAttachedCluster_async + */ + async checkImportAttachedClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importAttachedCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a specific + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource. + * + * If successful, the response contains a newly created + * {@link protos.google.longrunning.Operation|Operation} resource that can be + * described to track the status of the operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name the + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} to delete. + * + * `AttachedCluster` names are formatted as + * `projects//locations//attachedClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {boolean} request.validateOnly + * If set, only validate the request, but do not actually delete the resource. + * @param {boolean} request.allowMissing + * If set to true, and the + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource + * is not found, the request will succeed but no action will be taken on the + * server and a completed {@link protos.google.longrunning.Operation|Operation} will be + * returned. + * + * Useful for idempotent deletion. + * @param {boolean} request.ignoreErrors + * If set to true, the deletion of + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource + * will succeed even if errors occur during deleting in cluster resources. + * Using this parameter may result in orphaned resources in the cluster. + * @param {string} request.etag + * The current etag of the + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster}. + * + * Allows clients to perform deletions through optimistic concurrency control. + * + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/attached_clusters.delete_attached_cluster.js + * region_tag:gkemulticloud_v1_generated_AttachedClusters_DeleteAttachedCluster_async + */ + deleteAttachedCluster( + request?: protos.google.cloud.gkemulticloud.v1.IDeleteAttachedClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteAttachedCluster( + request: protos.google.cloud.gkemulticloud.v1.IDeleteAttachedClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteAttachedCluster( + request: protos.google.cloud.gkemulticloud.v1.IDeleteAttachedClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteAttachedCluster( + request?: protos.google.cloud.gkemulticloud.v1.IDeleteAttachedClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteAttachedCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteAttachedCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/attached_clusters.delete_attached_cluster.js + * region_tag:gkemulticloud_v1_generated_AttachedClusters_DeleteAttachedCluster_async + */ + async checkDeleteAttachedClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAttachedCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists all {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} + * resources on a given Google Cloud project and region. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAttachedClustersResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters|attachedClusters.list} + * request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster}. + * 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 `listAttachedClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAttachedClusters( + request?: protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAttachedCluster[], + protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest|null, + protos.google.cloud.gkemulticloud.v1.IListAttachedClustersResponse + ]>; + listAttachedClusters( + request: protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, + protos.google.cloud.gkemulticloud.v1.IListAttachedClustersResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAttachedCluster>): void; + listAttachedClusters( + request: protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, + callback: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, + protos.google.cloud.gkemulticloud.v1.IListAttachedClustersResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAttachedCluster>): void; + listAttachedClusters( + request?: protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, + protos.google.cloud.gkemulticloud.v1.IListAttachedClustersResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAttachedCluster>, + callback?: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, + protos.google.cloud.gkemulticloud.v1.IListAttachedClustersResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAttachedCluster>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAttachedCluster[], + protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest|null, + protos.google.cloud.gkemulticloud.v1.IListAttachedClustersResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listAttachedClusters(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAttachedClustersResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters|attachedClusters.list} + * request, if any. + * @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 protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} 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 `listAttachedClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAttachedClustersStream( + request?: protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, + 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['listAttachedClusters']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAttachedClusters.createStream( + this.innerApiCalls.listAttachedClusters as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAttachedClusters`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAttachedClustersResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters|attachedClusters.list} + * request, if any. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/attached_clusters.list_attached_clusters.js + * region_tag:gkemulticloud_v1_generated_AttachedClusters_ListAttachedClusters_async + */ + listAttachedClustersAsync( + request?: protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, + 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['listAttachedClusters']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAttachedClusters.asyncIterate( + this.innerApiCalls['listAttachedClusters'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified attachedCluster resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} attached_cluster + * @returns {string} Resource name string. + */ + attachedClusterPath(project:string,location:string,attachedCluster:string) { + return this.pathTemplates.attachedClusterPathTemplate.render({ + project: project, + location: location, + attached_cluster: attachedCluster, + }); + } + + /** + * Parse the project from AttachedCluster resource. + * + * @param {string} attachedClusterName + * A fully-qualified path representing AttachedCluster resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttachedClusterName(attachedClusterName: string) { + return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).project; + } + + /** + * Parse the location from AttachedCluster resource. + * + * @param {string} attachedClusterName + * A fully-qualified path representing AttachedCluster resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttachedClusterName(attachedClusterName: string) { + return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).location; + } + + /** + * Parse the attached_cluster from AttachedCluster resource. + * + * @param {string} attachedClusterName + * A fully-qualified path representing AttachedCluster resource. + * @returns {string} A string representing the attached_cluster. + */ + matchAttachedClusterFromAttachedClusterName(attachedClusterName: string) { + return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).attached_cluster; + } + + /** + * Return a fully-qualified attachedServerConfig resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + attachedServerConfigPath(project:string,location:string) { + return this.pathTemplates.attachedServerConfigPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from AttachedServerConfig resource. + * + * @param {string} attachedServerConfigName + * A fully-qualified path representing AttachedServerConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttachedServerConfigName(attachedServerConfigName: string) { + return this.pathTemplates.attachedServerConfigPathTemplate.match(attachedServerConfigName).project; + } + + /** + * Parse the location from AttachedServerConfig resource. + * + * @param {string} attachedServerConfigName + * A fully-qualified path representing AttachedServerConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttachedServerConfigName(attachedServerConfigName: string) { + return this.pathTemplates.attachedServerConfigPathTemplate.match(attachedServerConfigName).location; + } + + /** + * Return a fully-qualified awsCluster resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} aws_cluster + * @returns {string} Resource name string. + */ + awsClusterPath(project:string,location:string,awsCluster:string) { + return this.pathTemplates.awsClusterPathTemplate.render({ + project: project, + location: location, + aws_cluster: awsCluster, + }); + } + + /** + * Parse the project from AwsCluster resource. + * + * @param {string} awsClusterName + * A fully-qualified path representing AwsCluster resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAwsClusterName(awsClusterName: string) { + return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).project; + } + + /** + * Parse the location from AwsCluster resource. + * + * @param {string} awsClusterName + * A fully-qualified path representing AwsCluster resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAwsClusterName(awsClusterName: string) { + return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).location; + } + + /** + * Parse the aws_cluster from AwsCluster resource. + * + * @param {string} awsClusterName + * A fully-qualified path representing AwsCluster resource. + * @returns {string} A string representing the aws_cluster. + */ + matchAwsClusterFromAwsClusterName(awsClusterName: string) { + return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).aws_cluster; + } + + /** + * Return a fully-qualified awsNodePool resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} aws_cluster + * @param {string} aws_node_pool + * @returns {string} Resource name string. + */ + awsNodePoolPath(project:string,location:string,awsCluster:string,awsNodePool:string) { + return this.pathTemplates.awsNodePoolPathTemplate.render({ + project: project, + location: location, + aws_cluster: awsCluster, + aws_node_pool: awsNodePool, + }); + } + + /** + * Parse the project from AwsNodePool resource. + * + * @param {string} awsNodePoolName + * A fully-qualified path representing AwsNodePool resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAwsNodePoolName(awsNodePoolName: string) { + return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).project; + } + + /** + * Parse the location from AwsNodePool resource. + * + * @param {string} awsNodePoolName + * A fully-qualified path representing AwsNodePool resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAwsNodePoolName(awsNodePoolName: string) { + return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).location; + } + + /** + * Parse the aws_cluster from AwsNodePool resource. + * + * @param {string} awsNodePoolName + * A fully-qualified path representing AwsNodePool resource. + * @returns {string} A string representing the aws_cluster. + */ + matchAwsClusterFromAwsNodePoolName(awsNodePoolName: string) { + return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).aws_cluster; + } + + /** + * Parse the aws_node_pool from AwsNodePool resource. + * + * @param {string} awsNodePoolName + * A fully-qualified path representing AwsNodePool resource. + * @returns {string} A string representing the aws_node_pool. + */ + matchAwsNodePoolFromAwsNodePoolName(awsNodePoolName: string) { + return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).aws_node_pool; + } + + /** + * Return a fully-qualified awsServerConfig resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + awsServerConfigPath(project:string,location:string) { + return this.pathTemplates.awsServerConfigPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from AwsServerConfig resource. + * + * @param {string} awsServerConfigName + * A fully-qualified path representing AwsServerConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAwsServerConfigName(awsServerConfigName: string) { + return this.pathTemplates.awsServerConfigPathTemplate.match(awsServerConfigName).project; + } + + /** + * Parse the location from AwsServerConfig resource. + * + * @param {string} awsServerConfigName + * A fully-qualified path representing AwsServerConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAwsServerConfigName(awsServerConfigName: string) { + return this.pathTemplates.awsServerConfigPathTemplate.match(awsServerConfigName).location; + } + + /** + * Return a fully-qualified azureClient resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} azure_client + * @returns {string} Resource name string. + */ + azureClientPath(project:string,location:string,azureClient:string) { + return this.pathTemplates.azureClientPathTemplate.render({ + project: project, + location: location, + azure_client: azureClient, + }); + } + + /** + * Parse the project from AzureClient resource. + * + * @param {string} azureClientName + * A fully-qualified path representing AzureClient resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAzureClientName(azureClientName: string) { + return this.pathTemplates.azureClientPathTemplate.match(azureClientName).project; + } + + /** + * Parse the location from AzureClient resource. + * + * @param {string} azureClientName + * A fully-qualified path representing AzureClient resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAzureClientName(azureClientName: string) { + return this.pathTemplates.azureClientPathTemplate.match(azureClientName).location; + } + + /** + * Parse the azure_client from AzureClient resource. + * + * @param {string} azureClientName + * A fully-qualified path representing AzureClient resource. + * @returns {string} A string representing the azure_client. + */ + matchAzureClientFromAzureClientName(azureClientName: string) { + return this.pathTemplates.azureClientPathTemplate.match(azureClientName).azure_client; + } + + /** + * Return a fully-qualified azureCluster resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} azure_cluster + * @returns {string} Resource name string. + */ + azureClusterPath(project:string,location:string,azureCluster:string) { + return this.pathTemplates.azureClusterPathTemplate.render({ + project: project, + location: location, + azure_cluster: azureCluster, + }); + } + + /** + * Parse the project from AzureCluster resource. + * + * @param {string} azureClusterName + * A fully-qualified path representing AzureCluster resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAzureClusterName(azureClusterName: string) { + return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).project; + } + + /** + * Parse the location from AzureCluster resource. + * + * @param {string} azureClusterName + * A fully-qualified path representing AzureCluster resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAzureClusterName(azureClusterName: string) { + return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).location; + } + + /** + * Parse the azure_cluster from AzureCluster resource. + * + * @param {string} azureClusterName + * A fully-qualified path representing AzureCluster resource. + * @returns {string} A string representing the azure_cluster. + */ + matchAzureClusterFromAzureClusterName(azureClusterName: string) { + return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).azure_cluster; + } + + /** + * Return a fully-qualified azureNodePool resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} azure_cluster + * @param {string} azure_node_pool + * @returns {string} Resource name string. + */ + azureNodePoolPath(project:string,location:string,azureCluster:string,azureNodePool:string) { + return this.pathTemplates.azureNodePoolPathTemplate.render({ + project: project, + location: location, + azure_cluster: azureCluster, + azure_node_pool: azureNodePool, + }); + } + + /** + * Parse the project from AzureNodePool resource. + * + * @param {string} azureNodePoolName + * A fully-qualified path representing AzureNodePool resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAzureNodePoolName(azureNodePoolName: string) { + return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).project; + } + + /** + * Parse the location from AzureNodePool resource. + * + * @param {string} azureNodePoolName + * A fully-qualified path representing AzureNodePool resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAzureNodePoolName(azureNodePoolName: string) { + return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).location; + } + + /** + * Parse the azure_cluster from AzureNodePool resource. + * + * @param {string} azureNodePoolName + * A fully-qualified path representing AzureNodePool resource. + * @returns {string} A string representing the azure_cluster. + */ + matchAzureClusterFromAzureNodePoolName(azureNodePoolName: string) { + return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).azure_cluster; + } + + /** + * Parse the azure_node_pool from AzureNodePool resource. + * + * @param {string} azureNodePoolName + * A fully-qualified path representing AzureNodePool resource. + * @returns {string} A string representing the azure_node_pool. + */ + matchAzureNodePoolFromAzureNodePoolName(azureNodePoolName: string) { + return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).azure_node_pool; + } + + /** + * Return a fully-qualified azureServerConfig resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + azureServerConfigPath(project:string,location:string) { + return this.pathTemplates.azureServerConfigPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from AzureServerConfig resource. + * + * @param {string} azureServerConfigName + * A fully-qualified path representing AzureServerConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAzureServerConfigName(azureServerConfigName: string) { + return this.pathTemplates.azureServerConfigPathTemplate.match(azureServerConfigName).project; + } + + /** + * Parse the location from AzureServerConfig resource. + * + * @param {string} azureServerConfigName + * A fully-qualified path representing AzureServerConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAzureServerConfigName(azureServerConfigName: string) { + return this.pathTemplates.azureServerConfigPathTemplate.match(azureServerConfigName).location; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified 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; + } + + /** + * 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.attachedClustersStub && !this._terminated) { + return this.attachedClustersStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_client_config.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_client_config.json new file mode 100644 index 00000000000..476c8e0d695 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_client_config.json @@ -0,0 +1,78 @@ +{ + "interfaces": { + "google.cloud.gkemulticloud.v1.AttachedClusters": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateAttachedCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateAttachedCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ImportAttachedCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAttachedCluster": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListAttachedClusters": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteAttachedCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAttachedServerConfig": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GenerateAttachedClusterInstallManifest": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_proto_list.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_proto_list.json new file mode 100644 index 00000000000..288ec0e3d51 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/cloud/gkemulticloud/v1/attached_resources.proto", + "../../protos/google/cloud/gkemulticloud/v1/attached_service.proto", + "../../protos/google/cloud/gkemulticloud/v1/aws_resources.proto", + "../../protos/google/cloud/gkemulticloud/v1/aws_service.proto", + "../../protos/google/cloud/gkemulticloud/v1/azure_resources.proto", + "../../protos/google/cloud/gkemulticloud/v1/azure_service.proto", + "../../protos/google/cloud/gkemulticloud/v1/common_resources.proto" +] diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_client.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_client.ts new file mode 100644 index 00000000000..b768baab906 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_client.ts @@ -0,0 +1,2546 @@ +// 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, GrpcClientOptions, LROperation, 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/aws_clusters_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './aws_clusters_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The AwsClusters API provides a single centrally managed service + * to create and manage Anthos clusters that run on AWS infrastructure. + * @class + * @memberof v1 + */ +export class AwsClustersClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + awsClustersStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AwsClustersClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 AwsClustersClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof AwsClustersClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // 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 { + 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 = { + attachedClusterPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/attachedClusters/{attached_cluster}' + ), + attachedServerConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/attachedServerConfig' + ), + awsClusterPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/awsClusters/{aws_cluster}' + ), + awsNodePoolPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/awsClusters/{aws_cluster}/awsNodePools/{aws_node_pool}' + ), + awsServerConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/awsServerConfig' + ), + azureClientPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/azureClients/{azure_client}' + ), + azureClusterPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/azureClusters/{azure_cluster}' + ), + azureNodePoolPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/azureClusters/{azure_cluster}/azureNodePools/{azure_node_pool}' + ), + azureServerConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/azureServerConfig' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // 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 = { + listAwsClusters: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'awsClusters'), + listAwsNodePools: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'awsNodePools') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createAwsClusterResponse = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.AwsCluster') as gax.protobuf.Type; + const createAwsClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + const updateAwsClusterResponse = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.AwsCluster') as gax.protobuf.Type; + const updateAwsClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + const deleteAwsClusterResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteAwsClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + const createAwsNodePoolResponse = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.AwsNodePool') as gax.protobuf.Type; + const createAwsNodePoolMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + const updateAwsNodePoolResponse = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.AwsNodePool') as gax.protobuf.Type; + const updateAwsNodePoolMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + const deleteAwsNodePoolResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteAwsNodePoolMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createAwsCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createAwsClusterResponse.decode.bind(createAwsClusterResponse), + createAwsClusterMetadata.decode.bind(createAwsClusterMetadata)), + updateAwsCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateAwsClusterResponse.decode.bind(updateAwsClusterResponse), + updateAwsClusterMetadata.decode.bind(updateAwsClusterMetadata)), + deleteAwsCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteAwsClusterResponse.decode.bind(deleteAwsClusterResponse), + deleteAwsClusterMetadata.decode.bind(deleteAwsClusterMetadata)), + createAwsNodePool: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createAwsNodePoolResponse.decode.bind(createAwsNodePoolResponse), + createAwsNodePoolMetadata.decode.bind(createAwsNodePoolMetadata)), + updateAwsNodePool: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateAwsNodePoolResponse.decode.bind(updateAwsNodePoolResponse), + updateAwsNodePoolMetadata.decode.bind(updateAwsNodePoolMetadata)), + deleteAwsNodePool: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteAwsNodePoolResponse.decode.bind(deleteAwsNodePoolResponse), + deleteAwsNodePoolMetadata.decode.bind(deleteAwsNodePoolMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.gkemulticloud.v1.AwsClusters', 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.awsClustersStub) { + return this.awsClustersStub; + } + + // Put together the "service stub" for + // google.cloud.gkemulticloud.v1.AwsClusters. + this.awsClustersStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.gkemulticloud.v1.AwsClusters') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.gkemulticloud.v1.AwsClusters, + 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 awsClustersStubMethods = + ['createAwsCluster', 'updateAwsCluster', 'getAwsCluster', 'listAwsClusters', 'deleteAwsCluster', 'generateAwsAccessToken', 'createAwsNodePool', 'updateAwsNodePool', 'getAwsNodePool', 'listAwsNodePools', 'deleteAwsNodePool', 'getAwsServerConfig']; + for (const methodName of awsClustersStubMethods) { + const callPromise = this.awsClustersStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.awsClustersStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'gkemulticloud.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 'gkemulticloud.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 -- + // ------------------- +/** + * Describes a specific {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} + * resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the + * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resource to + * describe. + * + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.get_aws_cluster.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_GetAwsCluster_async + */ + getAwsCluster( + request?: protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAwsCluster, + protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest|undefined, {}|undefined + ]>; + getAwsCluster( + request: protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAwsCluster, + protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest|null|undefined, + {}|null|undefined>): void; + getAwsCluster( + request: protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAwsCluster, + protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest|null|undefined, + {}|null|undefined>): void; + getAwsCluster( + request?: protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkemulticloud.v1.IAwsCluster, + protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkemulticloud.v1.IAwsCluster, + protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAwsCluster, + protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest|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.getAwsCluster(request, options, callback); + } +/** + * Generates a short-lived access token to authenticate to a given + * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.awsCluster + * Required. The name of the + * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resource to + * authenticate to. + * + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenResponse|GenerateAwsAccessTokenResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.generate_aws_access_token.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_GenerateAwsAccessToken_async + */ + generateAwsAccessToken( + request?: protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest|undefined, {}|undefined + ]>; + generateAwsAccessToken( + request: protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest|null|undefined, + {}|null|undefined>): void; + generateAwsAccessToken( + request: protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest|null|undefined, + {}|null|undefined>): void; + generateAwsAccessToken( + request?: protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest|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({ + 'aws_cluster': request.awsCluster ?? '', + }); + this.initialize(); + return this.innerApiCalls.generateAwsAccessToken(request, options, callback); + } +/** + * Describes a specific + * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the + * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} resource to + * describe. + * + * `AwsNodePool` names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.get_aws_node_pool.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_GetAwsNodePool_async + */ + getAwsNodePool( + request?: protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAwsNodePool, + protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest|undefined, {}|undefined + ]>; + getAwsNodePool( + request: protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAwsNodePool, + protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest|null|undefined, + {}|null|undefined>): void; + getAwsNodePool( + request: protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAwsNodePool, + protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest|null|undefined, + {}|null|undefined>): void; + getAwsNodePool( + request?: protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkemulticloud.v1.IAwsNodePool, + protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkemulticloud.v1.IAwsNodePool, + protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAwsNodePool, + protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest|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.getAwsNodePool(request, options, callback); + } +/** + * Returns information, such as supported AWS regions and Kubernetes + * versions, on a given Google Cloud location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the + * {@link protos.google.cloud.gkemulticloud.v1.AwsServerConfig|AwsServerConfig} resource + * to describe. + * + * `AwsServerConfig` names are formatted as + * `projects//locations//awsServerConfig`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AwsServerConfig|AwsServerConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.get_aws_server_config.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_GetAwsServerConfig_async + */ + getAwsServerConfig( + request?: protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAwsServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest|undefined, {}|undefined + ]>; + getAwsServerConfig( + request: protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAwsServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest|null|undefined, + {}|null|undefined>): void; + getAwsServerConfig( + request: protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAwsServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest|null|undefined, + {}|null|undefined>): void; + getAwsServerConfig( + request?: protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkemulticloud.v1.IAwsServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkemulticloud.v1.IAwsServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAwsServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest|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.getAwsServerConfig(request, options, callback); + } + +/** + * Creates a new {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} + * resource on a given Google Cloud Platform project and region. + * + * If successful, the response contains a newly created + * {@link protos.google.longrunning.Operation|Operation} resource that can be + * described to track the status of the operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location where this + * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resource will be + * created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {google.cloud.gkemulticloud.v1.AwsCluster} request.awsCluster + * Required. The specification of the + * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} to create. + * @param {string} request.awsClusterId + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resource name + * formatted as + * `projects//locations//awsClusters/`. + * + * Valid characters are `/{@link protos.0-9|a-z}-/`. Cannot be longer than 63 characters. + * @param {boolean} request.validateOnly + * If set, only validate the request, but do not actually create the cluster. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.create_aws_cluster.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_CreateAwsCluster_async + */ + createAwsCluster( + request?: protos.google.cloud.gkemulticloud.v1.ICreateAwsClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createAwsCluster( + request: protos.google.cloud.gkemulticloud.v1.ICreateAwsClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAwsCluster( + request: protos.google.cloud.gkemulticloud.v1.ICreateAwsClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAwsCluster( + request?: protos.google.cloud.gkemulticloud.v1.ICreateAwsClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createAwsCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createAwsCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.create_aws_cluster.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_CreateAwsCluster_async + */ + async checkCreateAwsClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAwsCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.gkemulticloud.v1.AwsCluster} request.awsCluster + * Required. The {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} + * resource to update. + * @param {boolean} request.validateOnly + * If set, only validate the request, but do not actually update the cluster. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster}: + * + * * `description`. + * * `annotations`. + * * `control_plane.version`. + * * `authorization.admin_users`. + * * `control_plane.aws_services_authentication.role_arn`. + * * `control_plane.aws_services_authentication.role_session_name`. + * * `control_plane.config_encryption.kms_key_arn`. + * * `control_plane.instance_type`. + * * `control_plane.security_group_ids`. + * * `control_plane.proxy_config`. + * * `control_plane.proxy_config.secret_arn`. + * * `control_plane.proxy_config.secret_version`. + * * `control_plane.root_volume.size_gib`. + * * `control_plane.root_volume.volume_type`. + * * `control_plane.root_volume.iops`. + * * `control_plane.root_volume.kms_key_arn`. + * * `control_plane.ssh_config`. + * * `control_plane.ssh_config.ec2_key_pair`. + * * `control_plane.instance_placement.tenancy`. + * * `control_plane.iam_instance_profile`. + * * `logging_config.component_config.enable_components`. + * * `control_plane.tags`. + * * `monitoring_config.managed_prometheus_config.enabled`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.update_aws_cluster.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_UpdateAwsCluster_async + */ + updateAwsCluster( + request?: protos.google.cloud.gkemulticloud.v1.IUpdateAwsClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateAwsCluster( + request: protos.google.cloud.gkemulticloud.v1.IUpdateAwsClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateAwsCluster( + request: protos.google.cloud.gkemulticloud.v1.IUpdateAwsClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateAwsCluster( + request?: protos.google.cloud.gkemulticloud.v1.IUpdateAwsClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'aws_cluster.name': request.awsCluster!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateAwsCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateAwsCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.update_aws_cluster.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_UpdateAwsCluster_async + */ + async checkUpdateAwsClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateAwsCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a specific {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} + * resource. + * + * Fails if the cluster has one or more associated + * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} resources. + * + * If successful, the response contains a newly created + * {@link protos.google.longrunning.Operation|Operation} resource that can be + * described to track the status of the operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name the + * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} to delete. + * + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {boolean} request.validateOnly + * If set, only validate the request, but do not actually delete the resource. + * @param {boolean} request.allowMissing + * If set to true, and the + * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed {@link protos.google.longrunning.Operation|Operation} will be returned. + * + * Useful for idempotent deletion. + * @param {string} request.etag + * The current etag of the + * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster}. + * + * Allows clients to perform deletions through optimistic concurrency control. + * + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.delete_aws_cluster.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_DeleteAwsCluster_async + */ + deleteAwsCluster( + request?: protos.google.cloud.gkemulticloud.v1.IDeleteAwsClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteAwsCluster( + request: protos.google.cloud.gkemulticloud.v1.IDeleteAwsClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteAwsCluster( + request: protos.google.cloud.gkemulticloud.v1.IDeleteAwsClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteAwsCluster( + request?: protos.google.cloud.gkemulticloud.v1.IDeleteAwsClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteAwsCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteAwsCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.delete_aws_cluster.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_DeleteAwsCluster_async + */ + async checkDeleteAwsClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAwsCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool}, + * attached to a given {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster}. + * + * If successful, the response contains a newly created + * {@link protos.google.longrunning.Operation|Operation} resource that can be + * described to track the status of the operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} + * resource where this node pool will be created. + * + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {google.cloud.gkemulticloud.v1.AwsNodePool} request.awsNodePool + * Required. The specification of the + * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} to create. + * @param {string} request.awsNodePoolId + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} resource name + * formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * + * Valid characters are `/{@link protos.0-9|a-z}-/`. Cannot be longer than 63 characters. + * @param {boolean} request.validateOnly + * If set, only validate the request, but do not actually create the node + * pool. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.create_aws_node_pool.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_CreateAwsNodePool_async + */ + createAwsNodePool( + request?: protos.google.cloud.gkemulticloud.v1.ICreateAwsNodePoolRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createAwsNodePool( + request: protos.google.cloud.gkemulticloud.v1.ICreateAwsNodePoolRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAwsNodePool( + request: protos.google.cloud.gkemulticloud.v1.ICreateAwsNodePoolRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAwsNodePool( + request?: protos.google.cloud.gkemulticloud.v1.ICreateAwsNodePoolRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createAwsNodePool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createAwsNodePool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.create_aws_node_pool.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_CreateAwsNodePool_async + */ + async checkCreateAwsNodePoolProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAwsNodePool, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.gkemulticloud.v1.AwsNodePool} request.awsNodePool + * Required. The {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} + * resource to update. + * @param {boolean} request.validateOnly + * If set, only validate the request, but don't actually update the node pool. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool}: + * + * * `annotations`. + * * `version`. + * * `autoscaling.min_node_count`. + * * `autoscaling.max_node_count`. + * * `config.config_encryption.kms_key_arn`. + * * `config.security_group_ids`. + * * `config.root_volume.iops`. + * * `config.root_volume.kms_key_arn`. + * * `config.root_volume.volume_type`. + * * `config.root_volume.size_gib`. + * * `config.proxy_config`. + * * `config.proxy_config.secret_arn`. + * * `config.proxy_config.secret_version`. + * * `config.ssh_config`. + * * `config.ssh_config.ec2_key_pair`. + * * `config.instance_placement.tenancy`. + * * `config.iam_instance_profile`. + * * `config.labels`. + * * `config.tags`. + * * `config.autoscaling_metrics_collection`. + * * `config.autoscaling_metrics_collection.granularity`. + * * `config.autoscaling_metrics_collection.metrics`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.update_aws_node_pool.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_UpdateAwsNodePool_async + */ + updateAwsNodePool( + request?: protos.google.cloud.gkemulticloud.v1.IUpdateAwsNodePoolRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateAwsNodePool( + request: protos.google.cloud.gkemulticloud.v1.IUpdateAwsNodePoolRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateAwsNodePool( + request: protos.google.cloud.gkemulticloud.v1.IUpdateAwsNodePoolRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateAwsNodePool( + request?: protos.google.cloud.gkemulticloud.v1.IUpdateAwsNodePoolRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'aws_node_pool.name': request.awsNodePool!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateAwsNodePool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateAwsNodePool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.update_aws_node_pool.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_UpdateAwsNodePool_async + */ + async checkUpdateAwsNodePoolProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateAwsNodePool, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a specific {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} + * resource. + * + * If successful, the response contains a newly created + * {@link protos.google.longrunning.Operation|Operation} resource that can be + * described to track the status of the operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name the + * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} to delete. + * + * `AwsNodePool` names are formatted as + * `projects//locations//awsClusters//awsNodePools/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {boolean} request.validateOnly + * If set, only validate the request, but do not actually delete the node + * pool. + * @param {boolean} request.allowMissing + * If set to true, and the + * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed {@link protos.google.longrunning.Operation|Operation} will be returned. + * + * Useful for idempotent deletion. + * @param {string} request.etag + * The current ETag of the + * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool}. + * + * Allows clients to perform deletions through optimistic concurrency control. + * + * If the provided ETag does not match the current etag of the node pool, + * the request will fail and an ABORTED error will be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.delete_aws_node_pool.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_DeleteAwsNodePool_async + */ + deleteAwsNodePool( + request?: protos.google.cloud.gkemulticloud.v1.IDeleteAwsNodePoolRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteAwsNodePool( + request: protos.google.cloud.gkemulticloud.v1.IDeleteAwsNodePoolRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteAwsNodePool( + request: protos.google.cloud.gkemulticloud.v1.IDeleteAwsNodePoolRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteAwsNodePool( + request?: protos.google.cloud.gkemulticloud.v1.IDeleteAwsNodePoolRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteAwsNodePool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteAwsNodePool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.delete_aws_node_pool.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_DeleteAwsNodePool_async + */ + async checkDeleteAwsNodePoolProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAwsNodePool, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists all {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resources + * on a given Google Cloud project and region. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAwsClustersResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters|awsClusters.list} + * request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster}. + * 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 `listAwsClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAwsClusters( + request?: protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAwsCluster[], + protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest|null, + protos.google.cloud.gkemulticloud.v1.IListAwsClustersResponse + ]>; + listAwsClusters( + request: protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, + protos.google.cloud.gkemulticloud.v1.IListAwsClustersResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAwsCluster>): void; + listAwsClusters( + request: protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, + callback: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, + protos.google.cloud.gkemulticloud.v1.IListAwsClustersResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAwsCluster>): void; + listAwsClusters( + request?: protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, + protos.google.cloud.gkemulticloud.v1.IListAwsClustersResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAwsCluster>, + callback?: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, + protos.google.cloud.gkemulticloud.v1.IListAwsClustersResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAwsCluster>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAwsCluster[], + protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest|null, + protos.google.cloud.gkemulticloud.v1.IListAwsClustersResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listAwsClusters(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAwsClustersResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters|awsClusters.list} + * request, if any. + * @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 protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} 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 `listAwsClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAwsClustersStream( + request?: protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, + 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['listAwsClusters']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAwsClusters.createStream( + this.innerApiCalls.listAwsClusters as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAwsClusters`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAwsClustersResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters|awsClusters.list} + * request, if any. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.list_aws_clusters.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_ListAwsClusters_async + */ + listAwsClustersAsync( + request?: protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, + 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['listAwsClusters']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAwsClusters.asyncIterate( + this.innerApiCalls['listAwsClusters'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} + * resources on a given + * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent `AwsCluster` which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} resources. + * + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools|awsNodePools.list} + * request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool}. + * 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 `listAwsNodePoolsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAwsNodePools( + request?: protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAwsNodePool[], + protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest|null, + protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsResponse + ]>; + listAwsNodePools( + request: protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, + protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAwsNodePool>): void; + listAwsNodePools( + request: protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, + callback: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, + protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAwsNodePool>): void; + listAwsNodePools( + request?: protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, + protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAwsNodePool>, + callback?: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, + protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAwsNodePool>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAwsNodePool[], + protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest|null, + protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listAwsNodePools(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent `AwsCluster` which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} resources. + * + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools|awsNodePools.list} + * request, if any. + * @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 protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} 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 `listAwsNodePoolsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAwsNodePoolsStream( + request?: protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, + 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['listAwsNodePools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAwsNodePools.createStream( + this.innerApiCalls.listAwsNodePools as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAwsNodePools`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent `AwsCluster` which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} resources. + * + * `AwsCluster` names are formatted as + * `projects//locations//awsClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools|awsNodePools.list} + * request, if any. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/aws_clusters.list_aws_node_pools.js + * region_tag:gkemulticloud_v1_generated_AwsClusters_ListAwsNodePools_async + */ + listAwsNodePoolsAsync( + request?: protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, + 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['listAwsNodePools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAwsNodePools.asyncIterate( + this.innerApiCalls['listAwsNodePools'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified attachedCluster resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} attached_cluster + * @returns {string} Resource name string. + */ + attachedClusterPath(project:string,location:string,attachedCluster:string) { + return this.pathTemplates.attachedClusterPathTemplate.render({ + project: project, + location: location, + attached_cluster: attachedCluster, + }); + } + + /** + * Parse the project from AttachedCluster resource. + * + * @param {string} attachedClusterName + * A fully-qualified path representing AttachedCluster resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttachedClusterName(attachedClusterName: string) { + return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).project; + } + + /** + * Parse the location from AttachedCluster resource. + * + * @param {string} attachedClusterName + * A fully-qualified path representing AttachedCluster resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttachedClusterName(attachedClusterName: string) { + return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).location; + } + + /** + * Parse the attached_cluster from AttachedCluster resource. + * + * @param {string} attachedClusterName + * A fully-qualified path representing AttachedCluster resource. + * @returns {string} A string representing the attached_cluster. + */ + matchAttachedClusterFromAttachedClusterName(attachedClusterName: string) { + return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).attached_cluster; + } + + /** + * Return a fully-qualified attachedServerConfig resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + attachedServerConfigPath(project:string,location:string) { + return this.pathTemplates.attachedServerConfigPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from AttachedServerConfig resource. + * + * @param {string} attachedServerConfigName + * A fully-qualified path representing AttachedServerConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttachedServerConfigName(attachedServerConfigName: string) { + return this.pathTemplates.attachedServerConfigPathTemplate.match(attachedServerConfigName).project; + } + + /** + * Parse the location from AttachedServerConfig resource. + * + * @param {string} attachedServerConfigName + * A fully-qualified path representing AttachedServerConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttachedServerConfigName(attachedServerConfigName: string) { + return this.pathTemplates.attachedServerConfigPathTemplate.match(attachedServerConfigName).location; + } + + /** + * Return a fully-qualified awsCluster resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} aws_cluster + * @returns {string} Resource name string. + */ + awsClusterPath(project:string,location:string,awsCluster:string) { + return this.pathTemplates.awsClusterPathTemplate.render({ + project: project, + location: location, + aws_cluster: awsCluster, + }); + } + + /** + * Parse the project from AwsCluster resource. + * + * @param {string} awsClusterName + * A fully-qualified path representing AwsCluster resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAwsClusterName(awsClusterName: string) { + return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).project; + } + + /** + * Parse the location from AwsCluster resource. + * + * @param {string} awsClusterName + * A fully-qualified path representing AwsCluster resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAwsClusterName(awsClusterName: string) { + return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).location; + } + + /** + * Parse the aws_cluster from AwsCluster resource. + * + * @param {string} awsClusterName + * A fully-qualified path representing AwsCluster resource. + * @returns {string} A string representing the aws_cluster. + */ + matchAwsClusterFromAwsClusterName(awsClusterName: string) { + return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).aws_cluster; + } + + /** + * Return a fully-qualified awsNodePool resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} aws_cluster + * @param {string} aws_node_pool + * @returns {string} Resource name string. + */ + awsNodePoolPath(project:string,location:string,awsCluster:string,awsNodePool:string) { + return this.pathTemplates.awsNodePoolPathTemplate.render({ + project: project, + location: location, + aws_cluster: awsCluster, + aws_node_pool: awsNodePool, + }); + } + + /** + * Parse the project from AwsNodePool resource. + * + * @param {string} awsNodePoolName + * A fully-qualified path representing AwsNodePool resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAwsNodePoolName(awsNodePoolName: string) { + return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).project; + } + + /** + * Parse the location from AwsNodePool resource. + * + * @param {string} awsNodePoolName + * A fully-qualified path representing AwsNodePool resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAwsNodePoolName(awsNodePoolName: string) { + return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).location; + } + + /** + * Parse the aws_cluster from AwsNodePool resource. + * + * @param {string} awsNodePoolName + * A fully-qualified path representing AwsNodePool resource. + * @returns {string} A string representing the aws_cluster. + */ + matchAwsClusterFromAwsNodePoolName(awsNodePoolName: string) { + return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).aws_cluster; + } + + /** + * Parse the aws_node_pool from AwsNodePool resource. + * + * @param {string} awsNodePoolName + * A fully-qualified path representing AwsNodePool resource. + * @returns {string} A string representing the aws_node_pool. + */ + matchAwsNodePoolFromAwsNodePoolName(awsNodePoolName: string) { + return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).aws_node_pool; + } + + /** + * Return a fully-qualified awsServerConfig resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + awsServerConfigPath(project:string,location:string) { + return this.pathTemplates.awsServerConfigPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from AwsServerConfig resource. + * + * @param {string} awsServerConfigName + * A fully-qualified path representing AwsServerConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAwsServerConfigName(awsServerConfigName: string) { + return this.pathTemplates.awsServerConfigPathTemplate.match(awsServerConfigName).project; + } + + /** + * Parse the location from AwsServerConfig resource. + * + * @param {string} awsServerConfigName + * A fully-qualified path representing AwsServerConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAwsServerConfigName(awsServerConfigName: string) { + return this.pathTemplates.awsServerConfigPathTemplate.match(awsServerConfigName).location; + } + + /** + * Return a fully-qualified azureClient resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} azure_client + * @returns {string} Resource name string. + */ + azureClientPath(project:string,location:string,azureClient:string) { + return this.pathTemplates.azureClientPathTemplate.render({ + project: project, + location: location, + azure_client: azureClient, + }); + } + + /** + * Parse the project from AzureClient resource. + * + * @param {string} azureClientName + * A fully-qualified path representing AzureClient resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAzureClientName(azureClientName: string) { + return this.pathTemplates.azureClientPathTemplate.match(azureClientName).project; + } + + /** + * Parse the location from AzureClient resource. + * + * @param {string} azureClientName + * A fully-qualified path representing AzureClient resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAzureClientName(azureClientName: string) { + return this.pathTemplates.azureClientPathTemplate.match(azureClientName).location; + } + + /** + * Parse the azure_client from AzureClient resource. + * + * @param {string} azureClientName + * A fully-qualified path representing AzureClient resource. + * @returns {string} A string representing the azure_client. + */ + matchAzureClientFromAzureClientName(azureClientName: string) { + return this.pathTemplates.azureClientPathTemplate.match(azureClientName).azure_client; + } + + /** + * Return a fully-qualified azureCluster resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} azure_cluster + * @returns {string} Resource name string. + */ + azureClusterPath(project:string,location:string,azureCluster:string) { + return this.pathTemplates.azureClusterPathTemplate.render({ + project: project, + location: location, + azure_cluster: azureCluster, + }); + } + + /** + * Parse the project from AzureCluster resource. + * + * @param {string} azureClusterName + * A fully-qualified path representing AzureCluster resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAzureClusterName(azureClusterName: string) { + return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).project; + } + + /** + * Parse the location from AzureCluster resource. + * + * @param {string} azureClusterName + * A fully-qualified path representing AzureCluster resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAzureClusterName(azureClusterName: string) { + return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).location; + } + + /** + * Parse the azure_cluster from AzureCluster resource. + * + * @param {string} azureClusterName + * A fully-qualified path representing AzureCluster resource. + * @returns {string} A string representing the azure_cluster. + */ + matchAzureClusterFromAzureClusterName(azureClusterName: string) { + return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).azure_cluster; + } + + /** + * Return a fully-qualified azureNodePool resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} azure_cluster + * @param {string} azure_node_pool + * @returns {string} Resource name string. + */ + azureNodePoolPath(project:string,location:string,azureCluster:string,azureNodePool:string) { + return this.pathTemplates.azureNodePoolPathTemplate.render({ + project: project, + location: location, + azure_cluster: azureCluster, + azure_node_pool: azureNodePool, + }); + } + + /** + * Parse the project from AzureNodePool resource. + * + * @param {string} azureNodePoolName + * A fully-qualified path representing AzureNodePool resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAzureNodePoolName(azureNodePoolName: string) { + return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).project; + } + + /** + * Parse the location from AzureNodePool resource. + * + * @param {string} azureNodePoolName + * A fully-qualified path representing AzureNodePool resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAzureNodePoolName(azureNodePoolName: string) { + return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).location; + } + + /** + * Parse the azure_cluster from AzureNodePool resource. + * + * @param {string} azureNodePoolName + * A fully-qualified path representing AzureNodePool resource. + * @returns {string} A string representing the azure_cluster. + */ + matchAzureClusterFromAzureNodePoolName(azureNodePoolName: string) { + return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).azure_cluster; + } + + /** + * Parse the azure_node_pool from AzureNodePool resource. + * + * @param {string} azureNodePoolName + * A fully-qualified path representing AzureNodePool resource. + * @returns {string} A string representing the azure_node_pool. + */ + matchAzureNodePoolFromAzureNodePoolName(azureNodePoolName: string) { + return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).azure_node_pool; + } + + /** + * Return a fully-qualified azureServerConfig resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + azureServerConfigPath(project:string,location:string) { + return this.pathTemplates.azureServerConfigPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from AzureServerConfig resource. + * + * @param {string} azureServerConfigName + * A fully-qualified path representing AzureServerConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAzureServerConfigName(azureServerConfigName: string) { + return this.pathTemplates.azureServerConfigPathTemplate.match(azureServerConfigName).project; + } + + /** + * Parse the location from AzureServerConfig resource. + * + * @param {string} azureServerConfigName + * A fully-qualified path representing AzureServerConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAzureServerConfigName(azureServerConfigName: string) { + return this.pathTemplates.azureServerConfigPathTemplate.match(azureServerConfigName).location; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified 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; + } + + /** + * 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.awsClustersStub && !this._terminated) { + return this.awsClustersStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_client_config.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_client_config.json new file mode 100644 index 00000000000..714cb1ace74 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_client_config.json @@ -0,0 +1,98 @@ +{ + "interfaces": { + "google.cloud.gkemulticloud.v1.AwsClusters": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateAwsCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateAwsCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAwsCluster": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListAwsClusters": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteAwsCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateAwsAccessToken": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateAwsNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateAwsNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAwsNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListAwsNodePools": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteAwsNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAwsServerConfig": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_proto_list.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_proto_list.json new file mode 100644 index 00000000000..288ec0e3d51 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/cloud/gkemulticloud/v1/attached_resources.proto", + "../../protos/google/cloud/gkemulticloud/v1/attached_service.proto", + "../../protos/google/cloud/gkemulticloud/v1/aws_resources.proto", + "../../protos/google/cloud/gkemulticloud/v1/aws_service.proto", + "../../protos/google/cloud/gkemulticloud/v1/azure_resources.proto", + "../../protos/google/cloud/gkemulticloud/v1/azure_service.proto", + "../../protos/google/cloud/gkemulticloud/v1/common_resources.proto" +] diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_client.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_client.ts new file mode 100644 index 00000000000..9491005ed10 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_client.ts @@ -0,0 +1,3068 @@ +// 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, GrpcClientOptions, LROperation, 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/azure_clusters_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './azure_clusters_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The AzureClusters API provides a single centrally managed service + * to create and manage Anthos clusters that run on Azure infrastructure. + * @class + * @memberof v1 + */ +export class AzureClustersClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + azureClustersStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AzureClustersClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 AzureClustersClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof AzureClustersClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // 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 { + 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 = { + attachedClusterPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/attachedClusters/{attached_cluster}' + ), + attachedServerConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/attachedServerConfig' + ), + awsClusterPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/awsClusters/{aws_cluster}' + ), + awsNodePoolPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/awsClusters/{aws_cluster}/awsNodePools/{aws_node_pool}' + ), + awsServerConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/awsServerConfig' + ), + azureClientPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/azureClients/{azure_client}' + ), + azureClusterPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/azureClusters/{azure_cluster}' + ), + azureNodePoolPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/azureClusters/{azure_cluster}/azureNodePools/{azure_node_pool}' + ), + azureServerConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/azureServerConfig' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // 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 = { + listAzureClients: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'azureClients'), + listAzureClusters: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'azureClusters'), + listAzureNodePools: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'azureNodePools') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createAzureClientResponse = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.AzureClient') as gax.protobuf.Type; + const createAzureClientMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + const deleteAzureClientResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteAzureClientMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + const createAzureClusterResponse = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.AzureCluster') as gax.protobuf.Type; + const createAzureClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + const updateAzureClusterResponse = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.AzureCluster') as gax.protobuf.Type; + const updateAzureClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + const deleteAzureClusterResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteAzureClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + const createAzureNodePoolResponse = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.AzureNodePool') as gax.protobuf.Type; + const createAzureNodePoolMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + const updateAzureNodePoolResponse = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.AzureNodePool') as gax.protobuf.Type; + const updateAzureNodePoolMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + const deleteAzureNodePoolResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteAzureNodePoolMetadata = protoFilesRoot.lookup( + '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createAzureClient: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createAzureClientResponse.decode.bind(createAzureClientResponse), + createAzureClientMetadata.decode.bind(createAzureClientMetadata)), + deleteAzureClient: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteAzureClientResponse.decode.bind(deleteAzureClientResponse), + deleteAzureClientMetadata.decode.bind(deleteAzureClientMetadata)), + createAzureCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createAzureClusterResponse.decode.bind(createAzureClusterResponse), + createAzureClusterMetadata.decode.bind(createAzureClusterMetadata)), + updateAzureCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateAzureClusterResponse.decode.bind(updateAzureClusterResponse), + updateAzureClusterMetadata.decode.bind(updateAzureClusterMetadata)), + deleteAzureCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteAzureClusterResponse.decode.bind(deleteAzureClusterResponse), + deleteAzureClusterMetadata.decode.bind(deleteAzureClusterMetadata)), + createAzureNodePool: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createAzureNodePoolResponse.decode.bind(createAzureNodePoolResponse), + createAzureNodePoolMetadata.decode.bind(createAzureNodePoolMetadata)), + updateAzureNodePool: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateAzureNodePoolResponse.decode.bind(updateAzureNodePoolResponse), + updateAzureNodePoolMetadata.decode.bind(updateAzureNodePoolMetadata)), + deleteAzureNodePool: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteAzureNodePoolResponse.decode.bind(deleteAzureNodePoolResponse), + deleteAzureNodePoolMetadata.decode.bind(deleteAzureNodePoolMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.gkemulticloud.v1.AzureClusters', 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.azureClustersStub) { + return this.azureClustersStub; + } + + // Put together the "service stub" for + // google.cloud.gkemulticloud.v1.AzureClusters. + this.azureClustersStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.gkemulticloud.v1.AzureClusters') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.gkemulticloud.v1.AzureClusters, + 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 azureClustersStubMethods = + ['createAzureClient', 'getAzureClient', 'listAzureClients', 'deleteAzureClient', 'createAzureCluster', 'updateAzureCluster', 'getAzureCluster', 'listAzureClusters', 'deleteAzureCluster', 'generateAzureAccessToken', 'createAzureNodePool', 'updateAzureNodePool', 'getAzureNodePool', 'listAzureNodePools', 'deleteAzureNodePool', 'getAzureServerConfig']; + for (const methodName of azureClustersStubMethods) { + const callPromise = this.azureClustersStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.azureClustersStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'gkemulticloud.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 'gkemulticloud.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 -- + // ------------------- +/** + * Describes a specific + * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the + * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} resource to + * describe. + * + * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} names are + * formatted as + * `projects//locations//azureClients/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.get_azure_client.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_GetAzureClient_async + */ + getAzureClient( + request?: protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAzureClient, + protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest|undefined, {}|undefined + ]>; + getAzureClient( + request: protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAzureClient, + protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest|null|undefined, + {}|null|undefined>): void; + getAzureClient( + request: protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAzureClient, + protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest|null|undefined, + {}|null|undefined>): void; + getAzureClient( + request?: protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkemulticloud.v1.IAzureClient, + protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkemulticloud.v1.IAzureClient, + protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAzureClient, + protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest|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.getAzureClient(request, options, callback); + } +/** + * Describes a specific + * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the + * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resource to + * describe. + * + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.get_azure_cluster.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_GetAzureCluster_async + */ + getAzureCluster( + request?: protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAzureCluster, + protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest|undefined, {}|undefined + ]>; + getAzureCluster( + request: protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAzureCluster, + protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest|null|undefined, + {}|null|undefined>): void; + getAzureCluster( + request: protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAzureCluster, + protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest|null|undefined, + {}|null|undefined>): void; + getAzureCluster( + request?: protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkemulticloud.v1.IAzureCluster, + protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkemulticloud.v1.IAzureCluster, + protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAzureCluster, + protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest|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.getAzureCluster(request, options, callback); + } +/** + * Generates a short-lived access token to authenticate to a given + * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.azureCluster + * Required. The name of the + * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resource to + * authenticate to. + * + * `AzureCluster` names are formatted as + * `projects//locations//AzureClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenResponse|GenerateAzureAccessTokenResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.generate_azure_access_token.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_GenerateAzureAccessToken_async + */ + generateAzureAccessToken( + request?: protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest|undefined, {}|undefined + ]>; + generateAzureAccessToken( + request: protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest|null|undefined, + {}|null|undefined>): void; + generateAzureAccessToken( + request: protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest|null|undefined, + {}|null|undefined>): void; + generateAzureAccessToken( + request?: protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenResponse, + protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest|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({ + 'azure_cluster': request.azureCluster ?? '', + }); + this.initialize(); + return this.innerApiCalls.generateAzureAccessToken(request, options, callback); + } +/** + * Describes a specific + * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the + * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resource to + * describe. + * + * `AzureNodePool` names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.get_azure_node_pool.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_GetAzureNodePool_async + */ + getAzureNodePool( + request?: protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAzureNodePool, + protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest|undefined, {}|undefined + ]>; + getAzureNodePool( + request: protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAzureNodePool, + protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest|null|undefined, + {}|null|undefined>): void; + getAzureNodePool( + request: protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAzureNodePool, + protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest|null|undefined, + {}|null|undefined>): void; + getAzureNodePool( + request?: protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkemulticloud.v1.IAzureNodePool, + protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkemulticloud.v1.IAzureNodePool, + protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAzureNodePool, + protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest|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.getAzureNodePool(request, options, callback); + } +/** + * Returns information, such as supported Azure regions and Kubernetes + * versions, on a given Google Cloud location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the + * {@link protos.google.cloud.gkemulticloud.v1.AzureServerConfig|AzureServerConfig} + * resource to describe. + * + * `AzureServerConfig` names are formatted as + * `projects//locations//azureServerConfig`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AzureServerConfig|AzureServerConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.get_azure_server_config.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_GetAzureServerConfig_async + */ + getAzureServerConfig( + request?: protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAzureServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest|undefined, {}|undefined + ]>; + getAzureServerConfig( + request: protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAzureServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest|null|undefined, + {}|null|undefined>): void; + getAzureServerConfig( + request: protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest, + callback: Callback< + protos.google.cloud.gkemulticloud.v1.IAzureServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest|null|undefined, + {}|null|undefined>): void; + getAzureServerConfig( + request?: protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gkemulticloud.v1.IAzureServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gkemulticloud.v1.IAzureServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAzureServerConfig, + protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest|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.getAzureServerConfig(request, options, callback); + } + +/** + * Creates a new {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} + * resource on a given Google Cloud project and region. + * + * `AzureClient` resources hold client authentication + * information needed by the Anthos Multicloud API to manage Azure resources + * on your Azure subscription on your behalf. + * + * If successful, the response contains a newly created + * {@link protos.google.longrunning.Operation|Operation} resource that can be + * described to track the status of the operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location where this + * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} resource will be + * created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {google.cloud.gkemulticloud.v1.AzureClient} request.azureClient + * Required. The specification of the + * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} to create. + * @param {string} request.azureClientId + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} resource name + * formatted as + * `projects//locations//azureClients/`. + * + * Valid characters are `/{@link protos.0-9|a-z}-/`. Cannot be longer than 63 characters. + * @param {boolean} request.validateOnly + * If set, only validate the request, but do not actually create the client. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.create_azure_client.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_CreateAzureClient_async + */ + createAzureClient( + request?: protos.google.cloud.gkemulticloud.v1.ICreateAzureClientRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createAzureClient( + request: protos.google.cloud.gkemulticloud.v1.ICreateAzureClientRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAzureClient( + request: protos.google.cloud.gkemulticloud.v1.ICreateAzureClientRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAzureClient( + request?: protos.google.cloud.gkemulticloud.v1.ICreateAzureClientRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createAzureClient(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createAzureClient()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.create_azure_client.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_CreateAzureClient_async + */ + async checkCreateAzureClientProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAzureClient, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a specific {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} + * resource. + * + * If the client is used by one or more clusters, deletion will + * fail and a `FAILED_PRECONDITION` error will be returned. + * + * If successful, the response contains a newly created + * {@link protos.google.longrunning.Operation|Operation} resource that can be + * described to track the status of the operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name the + * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} to delete. + * + * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} names are + * formatted as + * `projects//locations//azureClients/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {boolean} request.allowMissing + * If set to true, and the + * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed {@link protos.google.longrunning.Operation|Operation} will be returned. + * + * Useful for idempotent deletion. + * @param {boolean} request.validateOnly + * If set, only validate the request, but do not actually delete the 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.delete_azure_client.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_DeleteAzureClient_async + */ + deleteAzureClient( + request?: protos.google.cloud.gkemulticloud.v1.IDeleteAzureClientRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteAzureClient( + request: protos.google.cloud.gkemulticloud.v1.IDeleteAzureClientRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteAzureClient( + request: protos.google.cloud.gkemulticloud.v1.IDeleteAzureClientRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteAzureClient( + request?: protos.google.cloud.gkemulticloud.v1.IDeleteAzureClientRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteAzureClient(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteAzureClient()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.delete_azure_client.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_DeleteAzureClient_async + */ + async checkDeleteAzureClientProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAzureClient, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} + * resource on a given Google Cloud Platform project and region. + * + * If successful, the response contains a newly created + * {@link protos.google.longrunning.Operation|Operation} resource that can be + * described to track the status of the operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location where this + * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resource will be + * created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {google.cloud.gkemulticloud.v1.AzureCluster} request.azureCluster + * Required. The specification of the + * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} to create. + * @param {string} request.azureClusterId + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resource name + * formatted as + * `projects//locations//azureClusters/`. + * + * Valid characters are `/{@link protos.0-9|a-z}-/`. Cannot be longer than 63 characters. + * @param {boolean} request.validateOnly + * If set, only validate the request, but do not actually create the cluster. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.create_azure_cluster.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_CreateAzureCluster_async + */ + createAzureCluster( + request?: protos.google.cloud.gkemulticloud.v1.ICreateAzureClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createAzureCluster( + request: protos.google.cloud.gkemulticloud.v1.ICreateAzureClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAzureCluster( + request: protos.google.cloud.gkemulticloud.v1.ICreateAzureClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAzureCluster( + request?: protos.google.cloud.gkemulticloud.v1.ICreateAzureClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createAzureCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createAzureCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.create_azure_cluster.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_CreateAzureCluster_async + */ + async checkCreateAzureClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAzureCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.gkemulticloud.v1.AzureCluster} request.azureCluster + * Required. The {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} + * resource to update. + * @param {boolean} request.validateOnly + * If set, only validate the request, but do not actually update the cluster. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster}: + * + * * `description`. + * * `azureClient`. + * * `control_plane.version`. + * * `control_plane.vm_size`. + * * `annotations`. + * * `authorization.admin_users`. + * * `control_plane.root_volume.size_gib`. + * * `azure_services_authentication`. + * * `azure_services_authentication.tenant_id`. + * * `azure_services_authentication.application_id`. + * * `control_plane.proxy_config`. + * * `control_plane.proxy_config.resource_group_id`. + * * `control_plane.proxy_config.secret_id`. + * * `control_plane.ssh_config.authorized_key`. + * * `logging_config.component_config.enable_components` + * * `monitoring_config.managed_prometheus_config.enabled`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.update_azure_cluster.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_UpdateAzureCluster_async + */ + updateAzureCluster( + request?: protos.google.cloud.gkemulticloud.v1.IUpdateAzureClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateAzureCluster( + request: protos.google.cloud.gkemulticloud.v1.IUpdateAzureClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateAzureCluster( + request: protos.google.cloud.gkemulticloud.v1.IUpdateAzureClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateAzureCluster( + request?: protos.google.cloud.gkemulticloud.v1.IUpdateAzureClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'azure_cluster.name': request.azureCluster!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateAzureCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateAzureCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.update_azure_cluster.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_UpdateAzureCluster_async + */ + async checkUpdateAzureClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateAzureCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a specific + * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resource. + * + * Fails if the cluster has one or more associated + * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resources. + * + * If successful, the response contains a newly created + * {@link protos.google.longrunning.Operation|Operation} resource that can be + * described to track the status of the operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name the + * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} to delete. + * + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {boolean} request.allowMissing + * If set to true, and the + * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resource is not + * found, the request will succeed but no action will be taken on the server + * and a completed {@link protos.google.longrunning.Operation|Operation} will be returned. + * + * Useful for idempotent deletion. + * @param {boolean} request.validateOnly + * If set, only validate the request, but do not actually delete the resource. + * @param {string} request.etag + * The current etag of the + * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster}. + * + * Allows clients to perform deletions through optimistic concurrency control. + * + * If the provided etag does not match the current etag of the cluster, + * the request will fail and an ABORTED error will be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.delete_azure_cluster.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_DeleteAzureCluster_async + */ + deleteAzureCluster( + request?: protos.google.cloud.gkemulticloud.v1.IDeleteAzureClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteAzureCluster( + request: protos.google.cloud.gkemulticloud.v1.IDeleteAzureClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteAzureCluster( + request: protos.google.cloud.gkemulticloud.v1.IDeleteAzureClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteAzureCluster( + request?: protos.google.cloud.gkemulticloud.v1.IDeleteAzureClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteAzureCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteAzureCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.delete_azure_cluster.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_DeleteAzureCluster_async + */ + async checkDeleteAzureClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAzureCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool}, + * attached to a given + * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster}. + * + * If successful, the response contains a newly created + * {@link protos.google.longrunning.Operation|Operation} resource that can be + * described to track the status of the operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} + * resource where this node pool will be created. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {google.cloud.gkemulticloud.v1.AzureNodePool} request.azureNodePool + * Required. The specification of the + * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} to create. + * @param {string} request.azureNodePoolId + * Required. A client provided ID the resource. Must be unique within the + * parent resource. + * + * The provided ID will be part of the + * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resource name + * formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * + * Valid characters are `/{@link protos.0-9|a-z}-/`. Cannot be longer than 63 characters. + * @param {boolean} request.validateOnly + * If set, only validate the request, but do not actually create the node + * pool. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.create_azure_node_pool.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_CreateAzureNodePool_async + */ + createAzureNodePool( + request?: protos.google.cloud.gkemulticloud.v1.ICreateAzureNodePoolRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createAzureNodePool( + request: protos.google.cloud.gkemulticloud.v1.ICreateAzureNodePoolRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAzureNodePool( + request: protos.google.cloud.gkemulticloud.v1.ICreateAzureNodePoolRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAzureNodePool( + request?: protos.google.cloud.gkemulticloud.v1.ICreateAzureNodePoolRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createAzureNodePool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createAzureNodePool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.create_azure_node_pool.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_CreateAzureNodePool_async + */ + async checkCreateAzureNodePoolProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAzureNodePool, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.gkemulticloud.v1.AzureNodePool} request.azureNodePool + * Required. The {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} + * resource to update. + * @param {boolean} request.validateOnly + * If set, only validate the request, but don't actually update the node pool. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field can only include these + * fields from {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool}: + * + * *. `annotations`. + * * `version`. + * * `autoscaling.min_node_count`. + * * `autoscaling.max_node_count`. + * * `config.ssh_config.authorized_key`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.update_azure_node_pool.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_UpdateAzureNodePool_async + */ + updateAzureNodePool( + request?: protos.google.cloud.gkemulticloud.v1.IUpdateAzureNodePoolRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateAzureNodePool( + request: protos.google.cloud.gkemulticloud.v1.IUpdateAzureNodePoolRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateAzureNodePool( + request: protos.google.cloud.gkemulticloud.v1.IUpdateAzureNodePoolRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateAzureNodePool( + request?: protos.google.cloud.gkemulticloud.v1.IUpdateAzureNodePoolRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'azure_node_pool.name': request.azureNodePool!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateAzureNodePool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateAzureNodePool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.update_azure_node_pool.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_UpdateAzureNodePool_async + */ + async checkUpdateAzureNodePoolProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateAzureNodePool, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a specific + * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resource. + * + * If successful, the response contains a newly created + * {@link protos.google.longrunning.Operation|Operation} resource that can be + * described to track the status of the operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name the + * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} to delete. + * + * `AzureNodePool` names are formatted as + * `projects//locations//azureClusters//azureNodePools/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {boolean} request.validateOnly + * If set, only validate the request, but do not actually delete the node + * pool. + * @param {boolean} request.allowMissing + * If set to true, and the + * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resource is + * not found, the request will succeed but no action will be taken on the + * server and a completed {@link protos.google.longrunning.Operation|Operation} will be + * returned. + * + * Useful for idempotent deletion. + * @param {string} request.etag + * The current ETag of the + * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool}. + * + * Allows clients to perform deletions through optimistic concurrency control. + * + * If the provided ETag does not match the current etag of the node pool, + * the request will fail and an ABORTED error will be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.delete_azure_node_pool.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_DeleteAzureNodePool_async + */ + deleteAzureNodePool( + request?: protos.google.cloud.gkemulticloud.v1.IDeleteAzureNodePoolRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteAzureNodePool( + request: protos.google.cloud.gkemulticloud.v1.IDeleteAzureNodePoolRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteAzureNodePool( + request: protos.google.cloud.gkemulticloud.v1.IDeleteAzureNodePoolRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteAzureNodePool( + request?: protos.google.cloud.gkemulticloud.v1.IDeleteAzureNodePoolRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteAzureNodePool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteAzureNodePool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.delete_azure_node_pool.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_DeleteAzureNodePool_async + */ + async checkDeleteAzureNodePoolProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAzureNodePool, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists all {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} + * resources on a given Google Cloud project and region. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAzureClientsResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients|azureClients.list} + * request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient}. + * 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 `listAzureClientsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAzureClients( + request?: protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAzureClient[], + protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest|null, + protos.google.cloud.gkemulticloud.v1.IListAzureClientsResponse + ]>; + listAzureClients( + request: protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, + protos.google.cloud.gkemulticloud.v1.IListAzureClientsResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAzureClient>): void; + listAzureClients( + request: protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, + callback: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, + protos.google.cloud.gkemulticloud.v1.IListAzureClientsResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAzureClient>): void; + listAzureClients( + request?: protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, + protos.google.cloud.gkemulticloud.v1.IListAzureClientsResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAzureClient>, + callback?: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, + protos.google.cloud.gkemulticloud.v1.IListAzureClientsResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAzureClient>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAzureClient[], + protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest|null, + protos.google.cloud.gkemulticloud.v1.IListAzureClientsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listAzureClients(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAzureClientsResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients|azureClients.list} + * request, if any. + * @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 protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} 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 `listAzureClientsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAzureClientsStream( + request?: protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, + 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['listAzureClients']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAzureClients.createStream( + this.innerApiCalls.listAzureClients as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAzureClients`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAzureClientsResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients|azureClients.list} + * request, if any. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.list_azure_clients.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_ListAzureClients_async + */ + listAzureClientsAsync( + request?: protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, + 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['listAzureClients']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAzureClients.asyncIterate( + this.innerApiCalls['listAzureClients'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} + * resources on a given Google Cloud project and region. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAzureClustersResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters|azureClusters.list} + * request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster}. + * 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 `listAzureClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAzureClusters( + request?: protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAzureCluster[], + protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest|null, + protos.google.cloud.gkemulticloud.v1.IListAzureClustersResponse + ]>; + listAzureClusters( + request: protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, + protos.google.cloud.gkemulticloud.v1.IListAzureClustersResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAzureCluster>): void; + listAzureClusters( + request: protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, + callback: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, + protos.google.cloud.gkemulticloud.v1.IListAzureClustersResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAzureCluster>): void; + listAzureClusters( + request?: protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, + protos.google.cloud.gkemulticloud.v1.IListAzureClustersResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAzureCluster>, + callback?: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, + protos.google.cloud.gkemulticloud.v1.IListAzureClustersResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAzureCluster>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAzureCluster[], + protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest|null, + protos.google.cloud.gkemulticloud.v1.IListAzureClustersResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listAzureClusters(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAzureClustersResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters|azureClusters.list} + * request, if any. + * @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 protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} 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 `listAzureClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAzureClustersStream( + request?: protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, + 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['listAzureClusters']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAzureClusters.createStream( + this.innerApiCalls.listAzureClusters as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAzureClusters`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resources. + * + * Location names are formatted as `projects//locations/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud Platform resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAzureClustersResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters|azureClusters.list} + * request, if any. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.list_azure_clusters.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_ListAzureClusters_async + */ + listAzureClustersAsync( + request?: protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, + 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['listAzureClusters']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAzureClusters.asyncIterate( + this.innerApiCalls['listAzureClusters'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} + * resources on a given + * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent `AzureCluster` which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resources. + * + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools|azureNodePools.list} + * request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool}. + * 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 `listAzureNodePoolsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAzureNodePools( + request?: protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAzureNodePool[], + protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest|null, + protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsResponse + ]>; + listAzureNodePools( + request: protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, + protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAzureNodePool>): void; + listAzureNodePools( + request: protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, + callback: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, + protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAzureNodePool>): void; + listAzureNodePools( + request?: protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, + protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAzureNodePool>, + callback?: PaginationCallback< + protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, + protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsResponse|null|undefined, + protos.google.cloud.gkemulticloud.v1.IAzureNodePool>): + Promise<[ + protos.google.cloud.gkemulticloud.v1.IAzureNodePool[], + protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest|null, + protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listAzureNodePools(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent `AzureCluster` which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resources. + * + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools|azureNodePools.list} + * request, if any. + * @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 protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} 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 `listAzureNodePoolsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAzureNodePoolsStream( + request?: protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, + 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['listAzureNodePools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAzureNodePools.createStream( + this.innerApiCalls.listAzureNodePools as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAzureNodePools`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent `AzureCluster` which owns this collection of + * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resources. + * + * `AzureCluster` names are formatted as + * `projects//locations//azureClusters/`. + * + * See [Resource Names](https://cloud.google.com/apis/design/resource_names) + * for more details on Google Cloud resource names. + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 50 will be used by the service. + * Regardless of the pageSize value, the response can include a partial list + * and a caller should only rely on response's + * {@link protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse.next_page_token|nextPageToken} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `nextPageToken` value returned from a previous + * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools|azureNodePools.list} + * request, if any. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/azure_clusters.list_azure_node_pools.js + * region_tag:gkemulticloud_v1_generated_AzureClusters_ListAzureNodePools_async + */ + listAzureNodePoolsAsync( + request?: protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, + 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['listAzureNodePools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAzureNodePools.asyncIterate( + this.innerApiCalls['listAzureNodePools'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified attachedCluster resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} attached_cluster + * @returns {string} Resource name string. + */ + attachedClusterPath(project:string,location:string,attachedCluster:string) { + return this.pathTemplates.attachedClusterPathTemplate.render({ + project: project, + location: location, + attached_cluster: attachedCluster, + }); + } + + /** + * Parse the project from AttachedCluster resource. + * + * @param {string} attachedClusterName + * A fully-qualified path representing AttachedCluster resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttachedClusterName(attachedClusterName: string) { + return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).project; + } + + /** + * Parse the location from AttachedCluster resource. + * + * @param {string} attachedClusterName + * A fully-qualified path representing AttachedCluster resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttachedClusterName(attachedClusterName: string) { + return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).location; + } + + /** + * Parse the attached_cluster from AttachedCluster resource. + * + * @param {string} attachedClusterName + * A fully-qualified path representing AttachedCluster resource. + * @returns {string} A string representing the attached_cluster. + */ + matchAttachedClusterFromAttachedClusterName(attachedClusterName: string) { + return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).attached_cluster; + } + + /** + * Return a fully-qualified attachedServerConfig resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + attachedServerConfigPath(project:string,location:string) { + return this.pathTemplates.attachedServerConfigPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from AttachedServerConfig resource. + * + * @param {string} attachedServerConfigName + * A fully-qualified path representing AttachedServerConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttachedServerConfigName(attachedServerConfigName: string) { + return this.pathTemplates.attachedServerConfigPathTemplate.match(attachedServerConfigName).project; + } + + /** + * Parse the location from AttachedServerConfig resource. + * + * @param {string} attachedServerConfigName + * A fully-qualified path representing AttachedServerConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttachedServerConfigName(attachedServerConfigName: string) { + return this.pathTemplates.attachedServerConfigPathTemplate.match(attachedServerConfigName).location; + } + + /** + * Return a fully-qualified awsCluster resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} aws_cluster + * @returns {string} Resource name string. + */ + awsClusterPath(project:string,location:string,awsCluster:string) { + return this.pathTemplates.awsClusterPathTemplate.render({ + project: project, + location: location, + aws_cluster: awsCluster, + }); + } + + /** + * Parse the project from AwsCluster resource. + * + * @param {string} awsClusterName + * A fully-qualified path representing AwsCluster resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAwsClusterName(awsClusterName: string) { + return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).project; + } + + /** + * Parse the location from AwsCluster resource. + * + * @param {string} awsClusterName + * A fully-qualified path representing AwsCluster resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAwsClusterName(awsClusterName: string) { + return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).location; + } + + /** + * Parse the aws_cluster from AwsCluster resource. + * + * @param {string} awsClusterName + * A fully-qualified path representing AwsCluster resource. + * @returns {string} A string representing the aws_cluster. + */ + matchAwsClusterFromAwsClusterName(awsClusterName: string) { + return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).aws_cluster; + } + + /** + * Return a fully-qualified awsNodePool resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} aws_cluster + * @param {string} aws_node_pool + * @returns {string} Resource name string. + */ + awsNodePoolPath(project:string,location:string,awsCluster:string,awsNodePool:string) { + return this.pathTemplates.awsNodePoolPathTemplate.render({ + project: project, + location: location, + aws_cluster: awsCluster, + aws_node_pool: awsNodePool, + }); + } + + /** + * Parse the project from AwsNodePool resource. + * + * @param {string} awsNodePoolName + * A fully-qualified path representing AwsNodePool resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAwsNodePoolName(awsNodePoolName: string) { + return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).project; + } + + /** + * Parse the location from AwsNodePool resource. + * + * @param {string} awsNodePoolName + * A fully-qualified path representing AwsNodePool resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAwsNodePoolName(awsNodePoolName: string) { + return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).location; + } + + /** + * Parse the aws_cluster from AwsNodePool resource. + * + * @param {string} awsNodePoolName + * A fully-qualified path representing AwsNodePool resource. + * @returns {string} A string representing the aws_cluster. + */ + matchAwsClusterFromAwsNodePoolName(awsNodePoolName: string) { + return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).aws_cluster; + } + + /** + * Parse the aws_node_pool from AwsNodePool resource. + * + * @param {string} awsNodePoolName + * A fully-qualified path representing AwsNodePool resource. + * @returns {string} A string representing the aws_node_pool. + */ + matchAwsNodePoolFromAwsNodePoolName(awsNodePoolName: string) { + return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).aws_node_pool; + } + + /** + * Return a fully-qualified awsServerConfig resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + awsServerConfigPath(project:string,location:string) { + return this.pathTemplates.awsServerConfigPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from AwsServerConfig resource. + * + * @param {string} awsServerConfigName + * A fully-qualified path representing AwsServerConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAwsServerConfigName(awsServerConfigName: string) { + return this.pathTemplates.awsServerConfigPathTemplate.match(awsServerConfigName).project; + } + + /** + * Parse the location from AwsServerConfig resource. + * + * @param {string} awsServerConfigName + * A fully-qualified path representing AwsServerConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAwsServerConfigName(awsServerConfigName: string) { + return this.pathTemplates.awsServerConfigPathTemplate.match(awsServerConfigName).location; + } + + /** + * Return a fully-qualified azureClient resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} azure_client + * @returns {string} Resource name string. + */ + azureClientPath(project:string,location:string,azureClient:string) { + return this.pathTemplates.azureClientPathTemplate.render({ + project: project, + location: location, + azure_client: azureClient, + }); + } + + /** + * Parse the project from AzureClient resource. + * + * @param {string} azureClientName + * A fully-qualified path representing AzureClient resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAzureClientName(azureClientName: string) { + return this.pathTemplates.azureClientPathTemplate.match(azureClientName).project; + } + + /** + * Parse the location from AzureClient resource. + * + * @param {string} azureClientName + * A fully-qualified path representing AzureClient resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAzureClientName(azureClientName: string) { + return this.pathTemplates.azureClientPathTemplate.match(azureClientName).location; + } + + /** + * Parse the azure_client from AzureClient resource. + * + * @param {string} azureClientName + * A fully-qualified path representing AzureClient resource. + * @returns {string} A string representing the azure_client. + */ + matchAzureClientFromAzureClientName(azureClientName: string) { + return this.pathTemplates.azureClientPathTemplate.match(azureClientName).azure_client; + } + + /** + * Return a fully-qualified azureCluster resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} azure_cluster + * @returns {string} Resource name string. + */ + azureClusterPath(project:string,location:string,azureCluster:string) { + return this.pathTemplates.azureClusterPathTemplate.render({ + project: project, + location: location, + azure_cluster: azureCluster, + }); + } + + /** + * Parse the project from AzureCluster resource. + * + * @param {string} azureClusterName + * A fully-qualified path representing AzureCluster resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAzureClusterName(azureClusterName: string) { + return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).project; + } + + /** + * Parse the location from AzureCluster resource. + * + * @param {string} azureClusterName + * A fully-qualified path representing AzureCluster resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAzureClusterName(azureClusterName: string) { + return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).location; + } + + /** + * Parse the azure_cluster from AzureCluster resource. + * + * @param {string} azureClusterName + * A fully-qualified path representing AzureCluster resource. + * @returns {string} A string representing the azure_cluster. + */ + matchAzureClusterFromAzureClusterName(azureClusterName: string) { + return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).azure_cluster; + } + + /** + * Return a fully-qualified azureNodePool resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} azure_cluster + * @param {string} azure_node_pool + * @returns {string} Resource name string. + */ + azureNodePoolPath(project:string,location:string,azureCluster:string,azureNodePool:string) { + return this.pathTemplates.azureNodePoolPathTemplate.render({ + project: project, + location: location, + azure_cluster: azureCluster, + azure_node_pool: azureNodePool, + }); + } + + /** + * Parse the project from AzureNodePool resource. + * + * @param {string} azureNodePoolName + * A fully-qualified path representing AzureNodePool resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAzureNodePoolName(azureNodePoolName: string) { + return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).project; + } + + /** + * Parse the location from AzureNodePool resource. + * + * @param {string} azureNodePoolName + * A fully-qualified path representing AzureNodePool resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAzureNodePoolName(azureNodePoolName: string) { + return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).location; + } + + /** + * Parse the azure_cluster from AzureNodePool resource. + * + * @param {string} azureNodePoolName + * A fully-qualified path representing AzureNodePool resource. + * @returns {string} A string representing the azure_cluster. + */ + matchAzureClusterFromAzureNodePoolName(azureNodePoolName: string) { + return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).azure_cluster; + } + + /** + * Parse the azure_node_pool from AzureNodePool resource. + * + * @param {string} azureNodePoolName + * A fully-qualified path representing AzureNodePool resource. + * @returns {string} A string representing the azure_node_pool. + */ + matchAzureNodePoolFromAzureNodePoolName(azureNodePoolName: string) { + return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).azure_node_pool; + } + + /** + * Return a fully-qualified azureServerConfig resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + azureServerConfigPath(project:string,location:string) { + return this.pathTemplates.azureServerConfigPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from AzureServerConfig resource. + * + * @param {string} azureServerConfigName + * A fully-qualified path representing AzureServerConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAzureServerConfigName(azureServerConfigName: string) { + return this.pathTemplates.azureServerConfigPathTemplate.match(azureServerConfigName).project; + } + + /** + * Parse the location from AzureServerConfig resource. + * + * @param {string} azureServerConfigName + * A fully-qualified path representing AzureServerConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAzureServerConfigName(azureServerConfigName: string) { + return this.pathTemplates.azureServerConfigPathTemplate.match(azureServerConfigName).location; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified 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; + } + + /** + * 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.azureClustersStub && !this._terminated) { + return this.azureClustersStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_client_config.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_client_config.json new file mode 100644 index 00000000000..7467958f0d9 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_client_config.json @@ -0,0 +1,118 @@ +{ + "interfaces": { + "google.cloud.gkemulticloud.v1.AzureClusters": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateAzureClient": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAzureClient": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListAzureClients": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteAzureClient": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateAzureCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateAzureCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAzureCluster": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListAzureClusters": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteAzureCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateAzureAccessToken": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateAzureNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateAzureNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAzureNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListAzureNodePools": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteAzureNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAzureServerConfig": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_proto_list.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_proto_list.json new file mode 100644 index 00000000000..288ec0e3d51 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/cloud/gkemulticloud/v1/attached_resources.proto", + "../../protos/google/cloud/gkemulticloud/v1/attached_service.proto", + "../../protos/google/cloud/gkemulticloud/v1/aws_resources.proto", + "../../protos/google/cloud/gkemulticloud/v1/aws_service.proto", + "../../protos/google/cloud/gkemulticloud/v1/azure_resources.proto", + "../../protos/google/cloud/gkemulticloud/v1/azure_service.proto", + "../../protos/google/cloud/gkemulticloud/v1/common_resources.proto" +] diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..11d19e83fb6 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/gapic_metadata.json @@ -0,0 +1,435 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.gkemulticloud.v1", + "libraryPackage": "@google-cloud/gkemulticloud", + "services": { + "AttachedClusters": { + "clients": { + "grpc": { + "libraryClient": "AttachedClustersClient", + "rpcs": { + "GetAttachedCluster": { + "methods": [ + "getAttachedCluster" + ] + }, + "GetAttachedServerConfig": { + "methods": [ + "getAttachedServerConfig" + ] + }, + "GenerateAttachedClusterInstallManifest": { + "methods": [ + "generateAttachedClusterInstallManifest" + ] + }, + "CreateAttachedCluster": { + "methods": [ + "createAttachedCluster" + ] + }, + "UpdateAttachedCluster": { + "methods": [ + "updateAttachedCluster" + ] + }, + "ImportAttachedCluster": { + "methods": [ + "importAttachedCluster" + ] + }, + "DeleteAttachedCluster": { + "methods": [ + "deleteAttachedCluster" + ] + }, + "ListAttachedClusters": { + "methods": [ + "listAttachedClusters", + "listAttachedClustersStream", + "listAttachedClustersAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AttachedClustersClient", + "rpcs": { + "GetAttachedCluster": { + "methods": [ + "getAttachedCluster" + ] + }, + "GetAttachedServerConfig": { + "methods": [ + "getAttachedServerConfig" + ] + }, + "GenerateAttachedClusterInstallManifest": { + "methods": [ + "generateAttachedClusterInstallManifest" + ] + }, + "CreateAttachedCluster": { + "methods": [ + "createAttachedCluster" + ] + }, + "UpdateAttachedCluster": { + "methods": [ + "updateAttachedCluster" + ] + }, + "ImportAttachedCluster": { + "methods": [ + "importAttachedCluster" + ] + }, + "DeleteAttachedCluster": { + "methods": [ + "deleteAttachedCluster" + ] + }, + "ListAttachedClusters": { + "methods": [ + "listAttachedClusters", + "listAttachedClustersStream", + "listAttachedClustersAsync" + ] + } + } + } + } + }, + "AwsClusters": { + "clients": { + "grpc": { + "libraryClient": "AwsClustersClient", + "rpcs": { + "GetAwsCluster": { + "methods": [ + "getAwsCluster" + ] + }, + "GenerateAwsAccessToken": { + "methods": [ + "generateAwsAccessToken" + ] + }, + "GetAwsNodePool": { + "methods": [ + "getAwsNodePool" + ] + }, + "GetAwsServerConfig": { + "methods": [ + "getAwsServerConfig" + ] + }, + "CreateAwsCluster": { + "methods": [ + "createAwsCluster" + ] + }, + "UpdateAwsCluster": { + "methods": [ + "updateAwsCluster" + ] + }, + "DeleteAwsCluster": { + "methods": [ + "deleteAwsCluster" + ] + }, + "CreateAwsNodePool": { + "methods": [ + "createAwsNodePool" + ] + }, + "UpdateAwsNodePool": { + "methods": [ + "updateAwsNodePool" + ] + }, + "DeleteAwsNodePool": { + "methods": [ + "deleteAwsNodePool" + ] + }, + "ListAwsClusters": { + "methods": [ + "listAwsClusters", + "listAwsClustersStream", + "listAwsClustersAsync" + ] + }, + "ListAwsNodePools": { + "methods": [ + "listAwsNodePools", + "listAwsNodePoolsStream", + "listAwsNodePoolsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AwsClustersClient", + "rpcs": { + "GetAwsCluster": { + "methods": [ + "getAwsCluster" + ] + }, + "GenerateAwsAccessToken": { + "methods": [ + "generateAwsAccessToken" + ] + }, + "GetAwsNodePool": { + "methods": [ + "getAwsNodePool" + ] + }, + "GetAwsServerConfig": { + "methods": [ + "getAwsServerConfig" + ] + }, + "CreateAwsCluster": { + "methods": [ + "createAwsCluster" + ] + }, + "UpdateAwsCluster": { + "methods": [ + "updateAwsCluster" + ] + }, + "DeleteAwsCluster": { + "methods": [ + "deleteAwsCluster" + ] + }, + "CreateAwsNodePool": { + "methods": [ + "createAwsNodePool" + ] + }, + "UpdateAwsNodePool": { + "methods": [ + "updateAwsNodePool" + ] + }, + "DeleteAwsNodePool": { + "methods": [ + "deleteAwsNodePool" + ] + }, + "ListAwsClusters": { + "methods": [ + "listAwsClusters", + "listAwsClustersStream", + "listAwsClustersAsync" + ] + }, + "ListAwsNodePools": { + "methods": [ + "listAwsNodePools", + "listAwsNodePoolsStream", + "listAwsNodePoolsAsync" + ] + } + } + } + } + }, + "AzureClusters": { + "clients": { + "grpc": { + "libraryClient": "AzureClustersClient", + "rpcs": { + "GetAzureClient": { + "methods": [ + "getAzureClient" + ] + }, + "GetAzureCluster": { + "methods": [ + "getAzureCluster" + ] + }, + "GenerateAzureAccessToken": { + "methods": [ + "generateAzureAccessToken" + ] + }, + "GetAzureNodePool": { + "methods": [ + "getAzureNodePool" + ] + }, + "GetAzureServerConfig": { + "methods": [ + "getAzureServerConfig" + ] + }, + "CreateAzureClient": { + "methods": [ + "createAzureClient" + ] + }, + "DeleteAzureClient": { + "methods": [ + "deleteAzureClient" + ] + }, + "CreateAzureCluster": { + "methods": [ + "createAzureCluster" + ] + }, + "UpdateAzureCluster": { + "methods": [ + "updateAzureCluster" + ] + }, + "DeleteAzureCluster": { + "methods": [ + "deleteAzureCluster" + ] + }, + "CreateAzureNodePool": { + "methods": [ + "createAzureNodePool" + ] + }, + "UpdateAzureNodePool": { + "methods": [ + "updateAzureNodePool" + ] + }, + "DeleteAzureNodePool": { + "methods": [ + "deleteAzureNodePool" + ] + }, + "ListAzureClients": { + "methods": [ + "listAzureClients", + "listAzureClientsStream", + "listAzureClientsAsync" + ] + }, + "ListAzureClusters": { + "methods": [ + "listAzureClusters", + "listAzureClustersStream", + "listAzureClustersAsync" + ] + }, + "ListAzureNodePools": { + "methods": [ + "listAzureNodePools", + "listAzureNodePoolsStream", + "listAzureNodePoolsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AzureClustersClient", + "rpcs": { + "GetAzureClient": { + "methods": [ + "getAzureClient" + ] + }, + "GetAzureCluster": { + "methods": [ + "getAzureCluster" + ] + }, + "GenerateAzureAccessToken": { + "methods": [ + "generateAzureAccessToken" + ] + }, + "GetAzureNodePool": { + "methods": [ + "getAzureNodePool" + ] + }, + "GetAzureServerConfig": { + "methods": [ + "getAzureServerConfig" + ] + }, + "CreateAzureClient": { + "methods": [ + "createAzureClient" + ] + }, + "DeleteAzureClient": { + "methods": [ + "deleteAzureClient" + ] + }, + "CreateAzureCluster": { + "methods": [ + "createAzureCluster" + ] + }, + "UpdateAzureCluster": { + "methods": [ + "updateAzureCluster" + ] + }, + "DeleteAzureCluster": { + "methods": [ + "deleteAzureCluster" + ] + }, + "CreateAzureNodePool": { + "methods": [ + "createAzureNodePool" + ] + }, + "UpdateAzureNodePool": { + "methods": [ + "updateAzureNodePool" + ] + }, + "DeleteAzureNodePool": { + "methods": [ + "deleteAzureNodePool" + ] + }, + "ListAzureClients": { + "methods": [ + "listAzureClients", + "listAzureClientsStream", + "listAzureClientsAsync" + ] + }, + "ListAzureClusters": { + "methods": [ + "listAzureClusters", + "listAzureClustersStream", + "listAzureClustersAsync" + ] + }, + "ListAzureNodePools": { + "methods": [ + "listAzureNodePools", + "listAzureNodePoolsStream", + "listAzureNodePoolsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/index.ts new file mode 100644 index 00000000000..7d68ee2a9e2 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/index.ts @@ -0,0 +1,21 @@ +// 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 {AttachedClustersClient} from './attached_clusters_client'; +export {AwsClustersClient} from './aws_clusters_client'; +export {AzureClustersClient} from './azure_clusters_client'; diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..479f9ed9f9a --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,29 @@ +// 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 gkemulticloud = require('@google-cloud/gkemulticloud'); + +function main() { + const attachedClustersClient = new gkemulticloud.AttachedClustersClient(); + const awsClustersClient = new gkemulticloud.AwsClustersClient(); + const azureClustersClient = new gkemulticloud.AzureClustersClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..ff4612bf063 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,44 @@ +// 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 {AttachedClustersClient, AwsClustersClient, AzureClustersClient} from '@google-cloud/gkemulticloud'; + +// check that the client class type name can be used +function doStuffWithAttachedClustersClient(client: AttachedClustersClient) { + client.close(); +} +function doStuffWithAwsClustersClient(client: AwsClustersClient) { + client.close(); +} +function doStuffWithAzureClustersClient(client: AzureClustersClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const attachedClustersClient = new AttachedClustersClient(); + doStuffWithAttachedClustersClient(attachedClustersClient); + // check that the client instance can be created + const awsClustersClient = new AwsClustersClient(); + doStuffWithAwsClustersClient(awsClustersClient); + // check that the client instance can be created + const azureClustersClient = new AzureClustersClient(); + doStuffWithAzureClustersClient(azureClustersClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/install.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/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-gkemulticloud/v1/test/gapic_attached_clusters_v1.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_attached_clusters_v1.ts new file mode 100644 index 00000000000..5b47c9d22e9 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_attached_clusters_v1.ts @@ -0,0 +1,2134 @@ +// 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 attachedclustersModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.AttachedClustersClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = attachedclustersModule.v1.AttachedClustersClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = attachedclustersModule.v1.AttachedClustersClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = attachedclustersModule.v1.AttachedClustersClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new attachedclustersModule.v1.AttachedClustersClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.attachedClustersStub, undefined); + await client.initialize(); + assert(client.attachedClustersStub); + }); + + it('has close method for the initialized client', done => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.attachedClustersStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.attachedClustersStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new attachedclustersModule.v1.AttachedClustersClient({ + 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 attachedclustersModule.v1.AttachedClustersClient({ + 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('getAttachedCluster', () => { + it('invokes getAttachedCluster without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAttachedClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAttachedClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AttachedCluster() + ); + client.innerApiCalls.getAttachedCluster = stubSimpleCall(expectedResponse); + const [response] = await client.getAttachedCluster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAttachedCluster without error using callback', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAttachedClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAttachedClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AttachedCluster() + ); + client.innerApiCalls.getAttachedCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAttachedCluster( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAttachedCluster|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAttachedCluster with error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAttachedClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAttachedClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAttachedCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAttachedCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.getAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAttachedCluster with closed client', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAttachedClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAttachedClusterRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAttachedCluster(request), expectedError); + }); + }); + + describe('getAttachedServerConfig', () => { + it('invokes getAttachedServerConfig without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AttachedServerConfig() + ); + client.innerApiCalls.getAttachedServerConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getAttachedServerConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAttachedServerConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAttachedServerConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAttachedServerConfig without error using callback', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AttachedServerConfig() + ); + client.innerApiCalls.getAttachedServerConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAttachedServerConfig( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAttachedServerConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAttachedServerConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAttachedServerConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAttachedServerConfig with error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAttachedServerConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAttachedServerConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.getAttachedServerConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAttachedServerConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAttachedServerConfig with closed client', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAttachedServerConfig(request), expectedError); + }); + }); + + describe('generateAttachedClusterInstallManifest', () => { + it('invokes generateAttachedClusterInstallManifest without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestResponse() + ); + client.innerApiCalls.generateAttachedClusterInstallManifest = stubSimpleCall(expectedResponse); + const [response] = await client.generateAttachedClusterInstallManifest(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateAttachedClusterInstallManifest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAttachedClusterInstallManifest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAttachedClusterInstallManifest without error using callback', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestResponse() + ); + client.innerApiCalls.generateAttachedClusterInstallManifest = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateAttachedClusterInstallManifest( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateAttachedClusterInstallManifest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAttachedClusterInstallManifest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAttachedClusterInstallManifest with error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateAttachedClusterInstallManifest = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateAttachedClusterInstallManifest(request), expectedError); + const actualRequest = (client.innerApiCalls.generateAttachedClusterInstallManifest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAttachedClusterInstallManifest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAttachedClusterInstallManifest with closed client', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateAttachedClusterInstallManifest(request), expectedError); + }); + }); + + describe('createAttachedCluster', () => { + it('invokes createAttachedCluster without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createAttachedCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.createAttachedCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAttachedCluster without error using callback', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createAttachedCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAttachedCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAttachedCluster with call error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAttachedCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createAttachedCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.createAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAttachedCluster with LRO error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAttachedCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createAttachedCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateAttachedClusterProgress without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateAttachedClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateAttachedClusterProgress with error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateAttachedClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateAttachedCluster', () => { + it('invokes updateAttachedCluster without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest() + ); + request.attachedCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest', ['attachedCluster', 'name']); + request.attachedCluster.name = defaultValue1; + const expectedHeaderRequestParams = `attached_cluster.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateAttachedCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateAttachedCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAttachedCluster without error using callback', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest() + ); + request.attachedCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest', ['attachedCluster', 'name']); + request.attachedCluster.name = defaultValue1; + const expectedHeaderRequestParams = `attached_cluster.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateAttachedCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAttachedCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAttachedCluster with call error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest() + ); + request.attachedCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest', ['attachedCluster', 'name']); + request.attachedCluster.name = defaultValue1; + const expectedHeaderRequestParams = `attached_cluster.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAttachedCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateAttachedCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.updateAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAttachedCluster with LRO error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest() + ); + request.attachedCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest', ['attachedCluster', 'name']); + request.attachedCluster.name = defaultValue1; + const expectedHeaderRequestParams = `attached_cluster.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAttachedCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateAttachedCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateAttachedClusterProgress without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateAttachedClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateAttachedClusterProgress with error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateAttachedClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('importAttachedCluster', () => { + it('invokes importAttachedCluster without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importAttachedCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.importAttachedCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.importAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importAttachedCluster without error using callback', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importAttachedCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importAttachedCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.importAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importAttachedCluster with call error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importAttachedCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.importAttachedCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.importAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importAttachedCluster with LRO error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importAttachedCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.importAttachedCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.importAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkImportAttachedClusterProgress without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportAttachedClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportAttachedClusterProgress with error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkImportAttachedClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteAttachedCluster', () => { + it('invokes deleteAttachedCluster without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteAttachedCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteAttachedCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAttachedCluster without error using callback', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteAttachedCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAttachedCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAttachedCluster with call error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAttachedCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteAttachedCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAttachedCluster with LRO error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAttachedCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteAttachedCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteAttachedCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAttachedCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteAttachedClusterProgress without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteAttachedClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteAttachedClusterProgress with error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteAttachedClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listAttachedClusters', () => { + it('invokes listAttachedClusters without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), + ]; + client.innerApiCalls.listAttachedClusters = stubSimpleCall(expectedResponse); + const [response] = await client.listAttachedClusters(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAttachedClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAttachedClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAttachedClusters without error using callback', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), + ]; + client.innerApiCalls.listAttachedClusters = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAttachedClusters( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAttachedCluster[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAttachedClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAttachedClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAttachedClusters with error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAttachedClusters = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAttachedClusters(request), expectedError); + const actualRequest = (client.innerApiCalls.listAttachedClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAttachedClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAttachedClustersStream without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), + ]; + client.descriptors.page.listAttachedClusters.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAttachedClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkemulticloud.v1.AttachedCluster[] = []; + stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AttachedCluster) => { + 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.listAttachedClusters.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAttachedClusters, request)); + assert( + (client.descriptors.page.listAttachedClusters.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAttachedClustersStream with error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAttachedClusters.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAttachedClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkemulticloud.v1.AttachedCluster[] = []; + stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AttachedCluster) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAttachedClusters.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAttachedClusters, request)); + assert( + (client.descriptors.page.listAttachedClusters.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAttachedClusters without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), + ]; + client.descriptors.page.listAttachedClusters.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkemulticloud.v1.IAttachedCluster[] = []; + const iterable = client.listAttachedClustersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAttachedClusters.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAttachedClusters.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAttachedClusters with error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAttachedClusters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAttachedClustersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkemulticloud.v1.IAttachedCluster[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAttachedClusters.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAttachedClusters.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('attachedCluster', () => { + const fakePath = "/rendered/path/attachedCluster"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + attached_cluster: "attachedClusterValue", + }; + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attachedClusterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.attachedClusterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('attachedClusterPath', () => { + const result = client.attachedClusterPath("projectValue", "locationValue", "attachedClusterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.attachedClusterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAttachedClusterName', () => { + const result = client.matchProjectFromAttachedClusterName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAttachedClusterName', () => { + const result = client.matchLocationFromAttachedClusterName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAttachedClusterFromAttachedClusterName', () => { + const result = client.matchAttachedClusterFromAttachedClusterName(fakePath); + assert.strictEqual(result, "attachedClusterValue"); + assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('attachedServerConfig', () => { + const fakePath = "/rendered/path/attachedServerConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attachedServerConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.attachedServerConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('attachedServerConfigPath', () => { + const result = client.attachedServerConfigPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.attachedServerConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAttachedServerConfigName', () => { + const result = client.matchProjectFromAttachedServerConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.attachedServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAttachedServerConfigName', () => { + const result = client.matchLocationFromAttachedServerConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.attachedServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('awsCluster', () => { + const fakePath = "/rendered/path/awsCluster"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + aws_cluster: "awsClusterValue", + }; + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.awsClusterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.awsClusterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('awsClusterPath', () => { + const result = client.awsClusterPath("projectValue", "locationValue", "awsClusterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.awsClusterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAwsClusterName', () => { + const result = client.matchProjectFromAwsClusterName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAwsClusterName', () => { + const result = client.matchLocationFromAwsClusterName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAwsClusterFromAwsClusterName', () => { + const result = client.matchAwsClusterFromAwsClusterName(fakePath); + assert.strictEqual(result, "awsClusterValue"); + assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('awsNodePool', () => { + const fakePath = "/rendered/path/awsNodePool"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + aws_cluster: "awsClusterValue", + aws_node_pool: "awsNodePoolValue", + }; + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.awsNodePoolPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.awsNodePoolPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('awsNodePoolPath', () => { + const result = client.awsNodePoolPath("projectValue", "locationValue", "awsClusterValue", "awsNodePoolValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.awsNodePoolPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAwsNodePoolName', () => { + const result = client.matchProjectFromAwsNodePoolName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAwsNodePoolName', () => { + const result = client.matchLocationFromAwsNodePoolName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAwsClusterFromAwsNodePoolName', () => { + const result = client.matchAwsClusterFromAwsNodePoolName(fakePath); + assert.strictEqual(result, "awsClusterValue"); + assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAwsNodePoolFromAwsNodePoolName', () => { + const result = client.matchAwsNodePoolFromAwsNodePoolName(fakePath); + assert.strictEqual(result, "awsNodePoolValue"); + assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('awsServerConfig', () => { + const fakePath = "/rendered/path/awsServerConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.awsServerConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.awsServerConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('awsServerConfigPath', () => { + const result = client.awsServerConfigPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.awsServerConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAwsServerConfigName', () => { + const result = client.matchProjectFromAwsServerConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.awsServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAwsServerConfigName', () => { + const result = client.matchLocationFromAwsServerConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.awsServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('azureClient', () => { + const fakePath = "/rendered/path/azureClient"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + azure_client: "azureClientValue", + }; + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.azureClientPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.azureClientPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('azureClientPath', () => { + const result = client.azureClientPath("projectValue", "locationValue", "azureClientValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.azureClientPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAzureClientName', () => { + const result = client.matchProjectFromAzureClientName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAzureClientName', () => { + const result = client.matchLocationFromAzureClientName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAzureClientFromAzureClientName', () => { + const result = client.matchAzureClientFromAzureClientName(fakePath); + assert.strictEqual(result, "azureClientValue"); + assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('azureCluster', () => { + const fakePath = "/rendered/path/azureCluster"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + azure_cluster: "azureClusterValue", + }; + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.azureClusterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.azureClusterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('azureClusterPath', () => { + const result = client.azureClusterPath("projectValue", "locationValue", "azureClusterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.azureClusterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAzureClusterName', () => { + const result = client.matchProjectFromAzureClusterName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAzureClusterName', () => { + const result = client.matchLocationFromAzureClusterName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAzureClusterFromAzureClusterName', () => { + const result = client.matchAzureClusterFromAzureClusterName(fakePath); + assert.strictEqual(result, "azureClusterValue"); + assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('azureNodePool', () => { + const fakePath = "/rendered/path/azureNodePool"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + azure_cluster: "azureClusterValue", + azure_node_pool: "azureNodePoolValue", + }; + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.azureNodePoolPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.azureNodePoolPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('azureNodePoolPath', () => { + const result = client.azureNodePoolPath("projectValue", "locationValue", "azureClusterValue", "azureNodePoolValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.azureNodePoolPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAzureNodePoolName', () => { + const result = client.matchProjectFromAzureNodePoolName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAzureNodePoolName', () => { + const result = client.matchLocationFromAzureNodePoolName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAzureClusterFromAzureNodePoolName', () => { + const result = client.matchAzureClusterFromAzureNodePoolName(fakePath); + assert.strictEqual(result, "azureClusterValue"); + assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAzureNodePoolFromAzureNodePoolName', () => { + const result = client.matchAzureNodePoolFromAzureNodePoolName(fakePath); + assert.strictEqual(result, "azureNodePoolValue"); + assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('azureServerConfig', () => { + const fakePath = "/rendered/path/azureServerConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.azureServerConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.azureServerConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('azureServerConfigPath', () => { + const result = client.azureServerConfigPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.azureServerConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAzureServerConfigName', () => { + const result = client.matchProjectFromAzureServerConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.azureServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAzureServerConfigName', () => { + const result = client.matchLocationFromAzureServerConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.azureServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new attachedclustersModule.v1.AttachedClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new attachedclustersModule.v1.AttachedClustersClient({ + 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)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_aws_clusters_v1.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_aws_clusters_v1.ts new file mode 100644 index 00000000000..eb384142cbf --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_aws_clusters_v1.ts @@ -0,0 +1,2799 @@ +// 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 awsclustersModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.AwsClustersClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = awsclustersModule.v1.AwsClustersClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = awsclustersModule.v1.AwsClustersClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = awsclustersModule.v1.AwsClustersClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new awsclustersModule.v1.AwsClustersClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.awsClustersStub, undefined); + await client.initialize(); + assert(client.awsClustersStub); + }); + + it('has close method for the initialized client', done => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.awsClustersStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.awsClustersStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new awsclustersModule.v1.AwsClustersClient({ + 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 awsclustersModule.v1.AwsClustersClient({ + 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('getAwsCluster', () => { + it('invokes getAwsCluster without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAwsClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AwsCluster() + ); + client.innerApiCalls.getAwsCluster = stubSimpleCall(expectedResponse); + const [response] = await client.getAwsCluster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAwsCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAwsCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAwsCluster without error using callback', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAwsClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AwsCluster() + ); + client.innerApiCalls.getAwsCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAwsCluster( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAwsCluster|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAwsCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAwsCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAwsCluster with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAwsClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAwsCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAwsCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.getAwsCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAwsCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAwsCluster with closed client', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAwsClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsClusterRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAwsCluster(request), expectedError); + }); + }); + + describe('generateAwsAccessToken', () => { + it('invokes generateAwsAccessToken without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest', ['awsCluster']); + request.awsCluster = defaultValue1; + const expectedHeaderRequestParams = `aws_cluster=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenResponse() + ); + client.innerApiCalls.generateAwsAccessToken = stubSimpleCall(expectedResponse); + const [response] = await client.generateAwsAccessToken(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateAwsAccessToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAwsAccessToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAwsAccessToken without error using callback', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest', ['awsCluster']); + request.awsCluster = defaultValue1; + const expectedHeaderRequestParams = `aws_cluster=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenResponse() + ); + client.innerApiCalls.generateAwsAccessToken = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateAwsAccessToken( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateAwsAccessToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAwsAccessToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAwsAccessToken with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest', ['awsCluster']); + request.awsCluster = defaultValue1; + const expectedHeaderRequestParams = `aws_cluster=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateAwsAccessToken = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateAwsAccessToken(request), expectedError); + const actualRequest = (client.innerApiCalls.generateAwsAccessToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAwsAccessToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAwsAccessToken with closed client', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest', ['awsCluster']); + request.awsCluster = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateAwsAccessToken(request), expectedError); + }); + }); + + describe('getAwsNodePool', () => { + it('invokes getAwsNodePool without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AwsNodePool() + ); + client.innerApiCalls.getAwsNodePool = stubSimpleCall(expectedResponse); + const [response] = await client.getAwsNodePool(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAwsNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAwsNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAwsNodePool without error using callback', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AwsNodePool() + ); + client.innerApiCalls.getAwsNodePool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAwsNodePool( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAwsNodePool|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAwsNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAwsNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAwsNodePool with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAwsNodePool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAwsNodePool(request), expectedError); + const actualRequest = (client.innerApiCalls.getAwsNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAwsNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAwsNodePool with closed client', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAwsNodePool(request), expectedError); + }); + }); + + describe('getAwsServerConfig', () => { + it('invokes getAwsServerConfig without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AwsServerConfig() + ); + client.innerApiCalls.getAwsServerConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getAwsServerConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAwsServerConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAwsServerConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAwsServerConfig without error using callback', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AwsServerConfig() + ); + client.innerApiCalls.getAwsServerConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAwsServerConfig( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAwsServerConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAwsServerConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAwsServerConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAwsServerConfig with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAwsServerConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAwsServerConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.getAwsServerConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAwsServerConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAwsServerConfig with closed client', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAwsServerConfig(request), expectedError); + }); + }); + + describe('createAwsCluster', () => { + it('invokes createAwsCluster without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createAwsCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.createAwsCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAwsCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAwsCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAwsCluster without error using callback', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createAwsCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAwsCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAwsCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAwsCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAwsCluster with call error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAwsCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createAwsCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.createAwsCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAwsCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAwsCluster with LRO error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAwsCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createAwsCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createAwsCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAwsCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateAwsClusterProgress without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateAwsClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateAwsClusterProgress with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateAwsClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateAwsCluster', () => { + it('invokes updateAwsCluster without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest() + ); + request.awsCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest', ['awsCluster', 'name']); + request.awsCluster.name = defaultValue1; + const expectedHeaderRequestParams = `aws_cluster.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateAwsCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateAwsCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAwsCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAwsCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAwsCluster without error using callback', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest() + ); + request.awsCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest', ['awsCluster', 'name']); + request.awsCluster.name = defaultValue1; + const expectedHeaderRequestParams = `aws_cluster.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateAwsCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAwsCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAwsCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAwsCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAwsCluster with call error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest() + ); + request.awsCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest', ['awsCluster', 'name']); + request.awsCluster.name = defaultValue1; + const expectedHeaderRequestParams = `aws_cluster.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAwsCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateAwsCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.updateAwsCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAwsCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAwsCluster with LRO error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest() + ); + request.awsCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest', ['awsCluster', 'name']); + request.awsCluster.name = defaultValue1; + const expectedHeaderRequestParams = `aws_cluster.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAwsCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateAwsCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateAwsCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAwsCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateAwsClusterProgress without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateAwsClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateAwsClusterProgress with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateAwsClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteAwsCluster', () => { + it('invokes deleteAwsCluster without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteAwsCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteAwsCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAwsCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAwsCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAwsCluster without error using callback', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteAwsCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAwsCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAwsCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAwsCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAwsCluster with call error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAwsCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteAwsCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteAwsCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAwsCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAwsCluster with LRO error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAwsCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteAwsCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteAwsCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAwsCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteAwsClusterProgress without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteAwsClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteAwsClusterProgress with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteAwsClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createAwsNodePool', () => { + it('invokes createAwsNodePool without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createAwsNodePool = stubLongRunningCall(expectedResponse); + const [operation] = await client.createAwsNodePool(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAwsNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAwsNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAwsNodePool without error using callback', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createAwsNodePool = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAwsNodePool( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAwsNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAwsNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAwsNodePool with call error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAwsNodePool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createAwsNodePool(request), expectedError); + const actualRequest = (client.innerApiCalls.createAwsNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAwsNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAwsNodePool with LRO error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAwsNodePool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createAwsNodePool(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createAwsNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAwsNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateAwsNodePoolProgress without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateAwsNodePoolProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateAwsNodePoolProgress with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateAwsNodePoolProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateAwsNodePool', () => { + it('invokes updateAwsNodePool without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest() + ); + request.awsNodePool ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest', ['awsNodePool', 'name']); + request.awsNodePool.name = defaultValue1; + const expectedHeaderRequestParams = `aws_node_pool.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateAwsNodePool = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateAwsNodePool(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAwsNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAwsNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAwsNodePool without error using callback', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest() + ); + request.awsNodePool ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest', ['awsNodePool', 'name']); + request.awsNodePool.name = defaultValue1; + const expectedHeaderRequestParams = `aws_node_pool.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateAwsNodePool = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAwsNodePool( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAwsNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAwsNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAwsNodePool with call error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest() + ); + request.awsNodePool ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest', ['awsNodePool', 'name']); + request.awsNodePool.name = defaultValue1; + const expectedHeaderRequestParams = `aws_node_pool.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAwsNodePool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateAwsNodePool(request), expectedError); + const actualRequest = (client.innerApiCalls.updateAwsNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAwsNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAwsNodePool with LRO error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest() + ); + request.awsNodePool ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest', ['awsNodePool', 'name']); + request.awsNodePool.name = defaultValue1; + const expectedHeaderRequestParams = `aws_node_pool.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAwsNodePool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateAwsNodePool(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateAwsNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAwsNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateAwsNodePoolProgress without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateAwsNodePoolProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateAwsNodePoolProgress with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateAwsNodePoolProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteAwsNodePool', () => { + it('invokes deleteAwsNodePool without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteAwsNodePool = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteAwsNodePool(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAwsNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAwsNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAwsNodePool without error using callback', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteAwsNodePool = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAwsNodePool( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAwsNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAwsNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAwsNodePool with call error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAwsNodePool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteAwsNodePool(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteAwsNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAwsNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAwsNodePool with LRO error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAwsNodePool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteAwsNodePool(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteAwsNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAwsNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteAwsNodePoolProgress without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteAwsNodePoolProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteAwsNodePoolProgress with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteAwsNodePoolProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listAwsClusters', () => { + it('invokes listAwsClusters without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAwsClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), + ]; + client.innerApiCalls.listAwsClusters = stubSimpleCall(expectedResponse); + const [response] = await client.listAwsClusters(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAwsClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAwsClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAwsClusters without error using callback', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAwsClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), + ]; + client.innerApiCalls.listAwsClusters = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAwsClusters( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAwsCluster[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAwsClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAwsClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAwsClusters with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAwsClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAwsClusters = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAwsClusters(request), expectedError); + const actualRequest = (client.innerApiCalls.listAwsClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAwsClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAwsClustersStream without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAwsClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), + ]; + client.descriptors.page.listAwsClusters.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAwsClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkemulticloud.v1.AwsCluster[] = []; + stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AwsCluster) => { + 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.listAwsClusters.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAwsClusters, request)); + assert( + (client.descriptors.page.listAwsClusters.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAwsClustersStream with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAwsClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAwsClusters.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAwsClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkemulticloud.v1.AwsCluster[] = []; + stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AwsCluster) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAwsClusters.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAwsClusters, request)); + assert( + (client.descriptors.page.listAwsClusters.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAwsClusters without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAwsClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), + ]; + client.descriptors.page.listAwsClusters.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkemulticloud.v1.IAwsCluster[] = []; + const iterable = client.listAwsClustersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAwsClusters.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAwsClusters.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAwsClusters with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAwsClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAwsClusters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAwsClustersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkemulticloud.v1.IAwsCluster[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAwsClusters.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAwsClusters.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listAwsNodePools', () => { + it('invokes listAwsNodePools without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), + ]; + client.innerApiCalls.listAwsNodePools = stubSimpleCall(expectedResponse); + const [response] = await client.listAwsNodePools(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAwsNodePools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAwsNodePools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAwsNodePools without error using callback', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), + ]; + client.innerApiCalls.listAwsNodePools = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAwsNodePools( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAwsNodePool[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAwsNodePools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAwsNodePools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAwsNodePools with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAwsNodePools = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAwsNodePools(request), expectedError); + const actualRequest = (client.innerApiCalls.listAwsNodePools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAwsNodePools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAwsNodePoolsStream without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), + ]; + client.descriptors.page.listAwsNodePools.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAwsNodePoolsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkemulticloud.v1.AwsNodePool[] = []; + stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AwsNodePool) => { + 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.listAwsNodePools.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAwsNodePools, request)); + assert( + (client.descriptors.page.listAwsNodePools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAwsNodePoolsStream with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAwsNodePools.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAwsNodePoolsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkemulticloud.v1.AwsNodePool[] = []; + stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AwsNodePool) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAwsNodePools.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAwsNodePools, request)); + assert( + (client.descriptors.page.listAwsNodePools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAwsNodePools without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), + ]; + client.descriptors.page.listAwsNodePools.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkemulticloud.v1.IAwsNodePool[] = []; + const iterable = client.listAwsNodePoolsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAwsNodePools.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAwsNodePools.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAwsNodePools with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAwsNodePools.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAwsNodePoolsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkemulticloud.v1.IAwsNodePool[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAwsNodePools.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAwsNodePools.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('attachedCluster', () => { + const fakePath = "/rendered/path/attachedCluster"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + attached_cluster: "attachedClusterValue", + }; + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attachedClusterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.attachedClusterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('attachedClusterPath', () => { + const result = client.attachedClusterPath("projectValue", "locationValue", "attachedClusterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.attachedClusterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAttachedClusterName', () => { + const result = client.matchProjectFromAttachedClusterName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAttachedClusterName', () => { + const result = client.matchLocationFromAttachedClusterName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAttachedClusterFromAttachedClusterName', () => { + const result = client.matchAttachedClusterFromAttachedClusterName(fakePath); + assert.strictEqual(result, "attachedClusterValue"); + assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('attachedServerConfig', () => { + const fakePath = "/rendered/path/attachedServerConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attachedServerConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.attachedServerConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('attachedServerConfigPath', () => { + const result = client.attachedServerConfigPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.attachedServerConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAttachedServerConfigName', () => { + const result = client.matchProjectFromAttachedServerConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.attachedServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAttachedServerConfigName', () => { + const result = client.matchLocationFromAttachedServerConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.attachedServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('awsCluster', () => { + const fakePath = "/rendered/path/awsCluster"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + aws_cluster: "awsClusterValue", + }; + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.awsClusterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.awsClusterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('awsClusterPath', () => { + const result = client.awsClusterPath("projectValue", "locationValue", "awsClusterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.awsClusterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAwsClusterName', () => { + const result = client.matchProjectFromAwsClusterName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAwsClusterName', () => { + const result = client.matchLocationFromAwsClusterName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAwsClusterFromAwsClusterName', () => { + const result = client.matchAwsClusterFromAwsClusterName(fakePath); + assert.strictEqual(result, "awsClusterValue"); + assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('awsNodePool', () => { + const fakePath = "/rendered/path/awsNodePool"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + aws_cluster: "awsClusterValue", + aws_node_pool: "awsNodePoolValue", + }; + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.awsNodePoolPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.awsNodePoolPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('awsNodePoolPath', () => { + const result = client.awsNodePoolPath("projectValue", "locationValue", "awsClusterValue", "awsNodePoolValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.awsNodePoolPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAwsNodePoolName', () => { + const result = client.matchProjectFromAwsNodePoolName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAwsNodePoolName', () => { + const result = client.matchLocationFromAwsNodePoolName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAwsClusterFromAwsNodePoolName', () => { + const result = client.matchAwsClusterFromAwsNodePoolName(fakePath); + assert.strictEqual(result, "awsClusterValue"); + assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAwsNodePoolFromAwsNodePoolName', () => { + const result = client.matchAwsNodePoolFromAwsNodePoolName(fakePath); + assert.strictEqual(result, "awsNodePoolValue"); + assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('awsServerConfig', () => { + const fakePath = "/rendered/path/awsServerConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.awsServerConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.awsServerConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('awsServerConfigPath', () => { + const result = client.awsServerConfigPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.awsServerConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAwsServerConfigName', () => { + const result = client.matchProjectFromAwsServerConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.awsServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAwsServerConfigName', () => { + const result = client.matchLocationFromAwsServerConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.awsServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('azureClient', () => { + const fakePath = "/rendered/path/azureClient"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + azure_client: "azureClientValue", + }; + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.azureClientPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.azureClientPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('azureClientPath', () => { + const result = client.azureClientPath("projectValue", "locationValue", "azureClientValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.azureClientPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAzureClientName', () => { + const result = client.matchProjectFromAzureClientName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAzureClientName', () => { + const result = client.matchLocationFromAzureClientName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAzureClientFromAzureClientName', () => { + const result = client.matchAzureClientFromAzureClientName(fakePath); + assert.strictEqual(result, "azureClientValue"); + assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('azureCluster', () => { + const fakePath = "/rendered/path/azureCluster"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + azure_cluster: "azureClusterValue", + }; + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.azureClusterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.azureClusterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('azureClusterPath', () => { + const result = client.azureClusterPath("projectValue", "locationValue", "azureClusterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.azureClusterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAzureClusterName', () => { + const result = client.matchProjectFromAzureClusterName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAzureClusterName', () => { + const result = client.matchLocationFromAzureClusterName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAzureClusterFromAzureClusterName', () => { + const result = client.matchAzureClusterFromAzureClusterName(fakePath); + assert.strictEqual(result, "azureClusterValue"); + assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('azureNodePool', () => { + const fakePath = "/rendered/path/azureNodePool"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + azure_cluster: "azureClusterValue", + azure_node_pool: "azureNodePoolValue", + }; + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.azureNodePoolPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.azureNodePoolPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('azureNodePoolPath', () => { + const result = client.azureNodePoolPath("projectValue", "locationValue", "azureClusterValue", "azureNodePoolValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.azureNodePoolPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAzureNodePoolName', () => { + const result = client.matchProjectFromAzureNodePoolName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAzureNodePoolName', () => { + const result = client.matchLocationFromAzureNodePoolName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAzureClusterFromAzureNodePoolName', () => { + const result = client.matchAzureClusterFromAzureNodePoolName(fakePath); + assert.strictEqual(result, "azureClusterValue"); + assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAzureNodePoolFromAzureNodePoolName', () => { + const result = client.matchAzureNodePoolFromAzureNodePoolName(fakePath); + assert.strictEqual(result, "azureNodePoolValue"); + assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('azureServerConfig', () => { + const fakePath = "/rendered/path/azureServerConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.azureServerConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.azureServerConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('azureServerConfigPath', () => { + const result = client.azureServerConfigPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.azureServerConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAzureServerConfigName', () => { + const result = client.matchProjectFromAzureServerConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.azureServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAzureServerConfigName', () => { + const result = client.matchLocationFromAzureServerConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.azureServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new awsclustersModule.v1.AwsClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new awsclustersModule.v1.AwsClustersClient({ + 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)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_azure_clusters_v1.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_azure_clusters_v1.ts new file mode 100644 index 00000000000..463151c94a0 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_azure_clusters_v1.ts @@ -0,0 +1,3460 @@ +// 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 azureclustersModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.AzureClustersClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = azureclustersModule.v1.AzureClustersClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = azureclustersModule.v1.AzureClustersClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = azureclustersModule.v1.AzureClustersClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new azureclustersModule.v1.AzureClustersClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.azureClustersStub, undefined); + await client.initialize(); + assert(client.azureClustersStub); + }); + + it('has close method for the initialized client', done => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.azureClustersStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.azureClustersStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new azureclustersModule.v1.AzureClustersClient({ + 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 azureclustersModule.v1.AzureClustersClient({ + 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('getAzureClient', () => { + it('invokes getAzureClient without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAzureClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureClientRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AzureClient() + ); + client.innerApiCalls.getAzureClient = stubSimpleCall(expectedResponse); + const [response] = await client.getAzureClient(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAzureClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAzureClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAzureClient without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAzureClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureClientRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AzureClient() + ); + client.innerApiCalls.getAzureClient = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAzureClient( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAzureClient|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAzureClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAzureClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAzureClient with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAzureClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureClientRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAzureClient = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAzureClient(request), expectedError); + const actualRequest = (client.innerApiCalls.getAzureClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAzureClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAzureClient with closed client', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAzureClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureClientRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAzureClient(request), expectedError); + }); + }); + + describe('getAzureCluster', () => { + it('invokes getAzureCluster without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAzureClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AzureCluster() + ); + client.innerApiCalls.getAzureCluster = stubSimpleCall(expectedResponse); + const [response] = await client.getAzureCluster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAzureCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAzureCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAzureCluster without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAzureClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AzureCluster() + ); + client.innerApiCalls.getAzureCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAzureCluster( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAzureCluster|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAzureCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAzureCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAzureCluster with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAzureClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAzureCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAzureCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.getAzureCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAzureCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAzureCluster with closed client', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAzureClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureClusterRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAzureCluster(request), expectedError); + }); + }); + + describe('generateAzureAccessToken', () => { + it('invokes generateAzureAccessToken without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest', ['azureCluster']); + request.azureCluster = defaultValue1; + const expectedHeaderRequestParams = `azure_cluster=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenResponse() + ); + client.innerApiCalls.generateAzureAccessToken = stubSimpleCall(expectedResponse); + const [response] = await client.generateAzureAccessToken(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateAzureAccessToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAzureAccessToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAzureAccessToken without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest', ['azureCluster']); + request.azureCluster = defaultValue1; + const expectedHeaderRequestParams = `azure_cluster=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenResponse() + ); + client.innerApiCalls.generateAzureAccessToken = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateAzureAccessToken( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateAzureAccessToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAzureAccessToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAzureAccessToken with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest', ['azureCluster']); + request.azureCluster = defaultValue1; + const expectedHeaderRequestParams = `azure_cluster=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateAzureAccessToken = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateAzureAccessToken(request), expectedError); + const actualRequest = (client.innerApiCalls.generateAzureAccessToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAzureAccessToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAzureAccessToken with closed client', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest', ['azureCluster']); + request.azureCluster = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateAzureAccessToken(request), expectedError); + }); + }); + + describe('getAzureNodePool', () => { + it('invokes getAzureNodePool without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AzureNodePool() + ); + client.innerApiCalls.getAzureNodePool = stubSimpleCall(expectedResponse); + const [response] = await client.getAzureNodePool(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAzureNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAzureNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAzureNodePool without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AzureNodePool() + ); + client.innerApiCalls.getAzureNodePool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAzureNodePool( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAzureNodePool|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAzureNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAzureNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAzureNodePool with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAzureNodePool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAzureNodePool(request), expectedError); + const actualRequest = (client.innerApiCalls.getAzureNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAzureNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAzureNodePool with closed client', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAzureNodePool(request), expectedError); + }); + }); + + describe('getAzureServerConfig', () => { + it('invokes getAzureServerConfig without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AzureServerConfig() + ); + client.innerApiCalls.getAzureServerConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getAzureServerConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAzureServerConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAzureServerConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAzureServerConfig without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.AzureServerConfig() + ); + client.innerApiCalls.getAzureServerConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAzureServerConfig( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAzureServerConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAzureServerConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAzureServerConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAzureServerConfig with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAzureServerConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAzureServerConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.getAzureServerConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAzureServerConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAzureServerConfig with closed client', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAzureServerConfig(request), expectedError); + }); + }); + + describe('createAzureClient', () => { + it('invokes createAzureClient without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAzureClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureClientRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createAzureClient = stubLongRunningCall(expectedResponse); + const [operation] = await client.createAzureClient(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAzureClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAzureClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAzureClient without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAzureClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureClientRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createAzureClient = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAzureClient( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAzureClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAzureClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAzureClient with call error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAzureClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureClientRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAzureClient = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createAzureClient(request), expectedError); + const actualRequest = (client.innerApiCalls.createAzureClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAzureClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAzureClient with LRO error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAzureClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureClientRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAzureClient = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createAzureClient(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createAzureClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAzureClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateAzureClientProgress without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateAzureClientProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateAzureClientProgress with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateAzureClientProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteAzureClient', () => { + it('invokes deleteAzureClient without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteAzureClient = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteAzureClient(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAzureClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAzureClient without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteAzureClient = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAzureClient( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAzureClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAzureClient with call error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAzureClient = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteAzureClient(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteAzureClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAzureClient with LRO error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAzureClient = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteAzureClient(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteAzureClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteAzureClientProgress without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteAzureClientProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteAzureClientProgress with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteAzureClientProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createAzureCluster', () => { + it('invokes createAzureCluster without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createAzureCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.createAzureCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAzureCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAzureCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAzureCluster without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createAzureCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAzureCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAzureCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAzureCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAzureCluster with call error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAzureCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createAzureCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.createAzureCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAzureCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAzureCluster with LRO error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAzureCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createAzureCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createAzureCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAzureCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateAzureClusterProgress without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateAzureClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateAzureClusterProgress with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateAzureClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateAzureCluster', () => { + it('invokes updateAzureCluster without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest() + ); + request.azureCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest', ['azureCluster', 'name']); + request.azureCluster.name = defaultValue1; + const expectedHeaderRequestParams = `azure_cluster.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateAzureCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateAzureCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAzureCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAzureCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAzureCluster without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest() + ); + request.azureCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest', ['azureCluster', 'name']); + request.azureCluster.name = defaultValue1; + const expectedHeaderRequestParams = `azure_cluster.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateAzureCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAzureCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAzureCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAzureCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAzureCluster with call error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest() + ); + request.azureCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest', ['azureCluster', 'name']); + request.azureCluster.name = defaultValue1; + const expectedHeaderRequestParams = `azure_cluster.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAzureCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateAzureCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.updateAzureCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAzureCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAzureCluster with LRO error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest() + ); + request.azureCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest', ['azureCluster', 'name']); + request.azureCluster.name = defaultValue1; + const expectedHeaderRequestParams = `azure_cluster.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAzureCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateAzureCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateAzureCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAzureCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateAzureClusterProgress without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateAzureClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateAzureClusterProgress with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateAzureClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteAzureCluster', () => { + it('invokes deleteAzureCluster without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteAzureCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteAzureCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAzureCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAzureCluster without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteAzureCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAzureCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAzureCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAzureCluster with call error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAzureCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteAzureCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteAzureCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAzureCluster with LRO error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAzureCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteAzureCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteAzureCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteAzureClusterProgress without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteAzureClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteAzureClusterProgress with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteAzureClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createAzureNodePool', () => { + it('invokes createAzureNodePool without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createAzureNodePool = stubLongRunningCall(expectedResponse); + const [operation] = await client.createAzureNodePool(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAzureNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAzureNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAzureNodePool without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createAzureNodePool = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAzureNodePool( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAzureNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAzureNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAzureNodePool with call error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAzureNodePool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createAzureNodePool(request), expectedError); + const actualRequest = (client.innerApiCalls.createAzureNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAzureNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAzureNodePool with LRO error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAzureNodePool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createAzureNodePool(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createAzureNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAzureNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateAzureNodePoolProgress without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateAzureNodePoolProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateAzureNodePoolProgress with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateAzureNodePoolProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateAzureNodePool', () => { + it('invokes updateAzureNodePool without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest() + ); + request.azureNodePool ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest', ['azureNodePool', 'name']); + request.azureNodePool.name = defaultValue1; + const expectedHeaderRequestParams = `azure_node_pool.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateAzureNodePool = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateAzureNodePool(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAzureNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAzureNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAzureNodePool without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest() + ); + request.azureNodePool ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest', ['azureNodePool', 'name']); + request.azureNodePool.name = defaultValue1; + const expectedHeaderRequestParams = `azure_node_pool.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateAzureNodePool = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAzureNodePool( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAzureNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAzureNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAzureNodePool with call error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest() + ); + request.azureNodePool ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest', ['azureNodePool', 'name']); + request.azureNodePool.name = defaultValue1; + const expectedHeaderRequestParams = `azure_node_pool.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAzureNodePool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateAzureNodePool(request), expectedError); + const actualRequest = (client.innerApiCalls.updateAzureNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAzureNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAzureNodePool with LRO error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest() + ); + request.azureNodePool ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest', ['azureNodePool', 'name']); + request.azureNodePool.name = defaultValue1; + const expectedHeaderRequestParams = `azure_node_pool.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAzureNodePool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateAzureNodePool(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateAzureNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAzureNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateAzureNodePoolProgress without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateAzureNodePoolProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateAzureNodePoolProgress with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateAzureNodePoolProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteAzureNodePool', () => { + it('invokes deleteAzureNodePool without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteAzureNodePool = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteAzureNodePool(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAzureNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAzureNodePool without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteAzureNodePool = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAzureNodePool( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAzureNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAzureNodePool with call error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAzureNodePool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteAzureNodePool(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteAzureNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAzureNodePool with LRO error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAzureNodePool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteAzureNodePool(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteAzureNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteAzureNodePoolProgress without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteAzureNodePoolProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteAzureNodePoolProgress with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteAzureNodePoolProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listAzureClients', () => { + it('invokes listAzureClients without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureClientsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClientsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), + ]; + client.innerApiCalls.listAzureClients = stubSimpleCall(expectedResponse); + const [response] = await client.listAzureClients(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAzureClients as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAzureClients as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAzureClients without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureClientsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClientsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), + ]; + client.innerApiCalls.listAzureClients = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAzureClients( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAzureClient[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAzureClients as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAzureClients as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAzureClients with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureClientsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClientsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAzureClients = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAzureClients(request), expectedError); + const actualRequest = (client.innerApiCalls.listAzureClients as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAzureClients as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAzureClientsStream without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureClientsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClientsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), + ]; + client.descriptors.page.listAzureClients.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAzureClientsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkemulticloud.v1.AzureClient[] = []; + stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AzureClient) => { + 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.listAzureClients.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAzureClients, request)); + assert( + (client.descriptors.page.listAzureClients.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAzureClientsStream with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureClientsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClientsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAzureClients.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAzureClientsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkemulticloud.v1.AzureClient[] = []; + stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AzureClient) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAzureClients.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAzureClients, request)); + assert( + (client.descriptors.page.listAzureClients.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAzureClients without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureClientsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClientsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), + ]; + client.descriptors.page.listAzureClients.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkemulticloud.v1.IAzureClient[] = []; + const iterable = client.listAzureClientsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAzureClients.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAzureClients.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAzureClients with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureClientsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClientsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAzureClients.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAzureClientsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkemulticloud.v1.IAzureClient[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAzureClients.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAzureClients.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listAzureClusters', () => { + it('invokes listAzureClusters without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), + ]; + client.innerApiCalls.listAzureClusters = stubSimpleCall(expectedResponse); + const [response] = await client.listAzureClusters(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAzureClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAzureClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAzureClusters without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), + ]; + client.innerApiCalls.listAzureClusters = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAzureClusters( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAzureCluster[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAzureClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAzureClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAzureClusters with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAzureClusters = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAzureClusters(request), expectedError); + const actualRequest = (client.innerApiCalls.listAzureClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAzureClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAzureClustersStream without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), + ]; + client.descriptors.page.listAzureClusters.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAzureClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkemulticloud.v1.AzureCluster[] = []; + stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AzureCluster) => { + 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.listAzureClusters.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAzureClusters, request)); + assert( + (client.descriptors.page.listAzureClusters.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAzureClustersStream with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAzureClusters.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAzureClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkemulticloud.v1.AzureCluster[] = []; + stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AzureCluster) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAzureClusters.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAzureClusters, request)); + assert( + (client.descriptors.page.listAzureClusters.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAzureClusters without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), + ]; + client.descriptors.page.listAzureClusters.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkemulticloud.v1.IAzureCluster[] = []; + const iterable = client.listAzureClustersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAzureClusters.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAzureClusters.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAzureClusters with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAzureClusters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAzureClustersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkemulticloud.v1.IAzureCluster[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAzureClusters.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAzureClusters.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listAzureNodePools', () => { + it('invokes listAzureNodePools without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), + ]; + client.innerApiCalls.listAzureNodePools = stubSimpleCall(expectedResponse); + const [response] = await client.listAzureNodePools(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAzureNodePools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAzureNodePools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAzureNodePools without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), + ]; + client.innerApiCalls.listAzureNodePools = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAzureNodePools( + request, + (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAzureNodePool[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAzureNodePools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAzureNodePools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAzureNodePools with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAzureNodePools = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAzureNodePools(request), expectedError); + const actualRequest = (client.innerApiCalls.listAzureNodePools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAzureNodePools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAzureNodePoolsStream without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), + ]; + client.descriptors.page.listAzureNodePools.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAzureNodePoolsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkemulticloud.v1.AzureNodePool[] = []; + stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AzureNodePool) => { + 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.listAzureNodePools.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAzureNodePools, request)); + assert( + (client.descriptors.page.listAzureNodePools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAzureNodePoolsStream with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAzureNodePools.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAzureNodePoolsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gkemulticloud.v1.AzureNodePool[] = []; + stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AzureNodePool) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAzureNodePools.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAzureNodePools, request)); + assert( + (client.descriptors.page.listAzureNodePools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAzureNodePools without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), + generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), + ]; + client.descriptors.page.listAzureNodePools.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gkemulticloud.v1.IAzureNodePool[] = []; + const iterable = client.listAzureNodePoolsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAzureNodePools.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAzureNodePools.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAzureNodePools with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAzureNodePools.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAzureNodePoolsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gkemulticloud.v1.IAzureNodePool[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAzureNodePools.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAzureNodePools.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('attachedCluster', () => { + const fakePath = "/rendered/path/attachedCluster"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + attached_cluster: "attachedClusterValue", + }; + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attachedClusterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.attachedClusterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('attachedClusterPath', () => { + const result = client.attachedClusterPath("projectValue", "locationValue", "attachedClusterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.attachedClusterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAttachedClusterName', () => { + const result = client.matchProjectFromAttachedClusterName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAttachedClusterName', () => { + const result = client.matchLocationFromAttachedClusterName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAttachedClusterFromAttachedClusterName', () => { + const result = client.matchAttachedClusterFromAttachedClusterName(fakePath); + assert.strictEqual(result, "attachedClusterValue"); + assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('attachedServerConfig', () => { + const fakePath = "/rendered/path/attachedServerConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attachedServerConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.attachedServerConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('attachedServerConfigPath', () => { + const result = client.attachedServerConfigPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.attachedServerConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAttachedServerConfigName', () => { + const result = client.matchProjectFromAttachedServerConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.attachedServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAttachedServerConfigName', () => { + const result = client.matchLocationFromAttachedServerConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.attachedServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('awsCluster', () => { + const fakePath = "/rendered/path/awsCluster"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + aws_cluster: "awsClusterValue", + }; + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.awsClusterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.awsClusterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('awsClusterPath', () => { + const result = client.awsClusterPath("projectValue", "locationValue", "awsClusterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.awsClusterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAwsClusterName', () => { + const result = client.matchProjectFromAwsClusterName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAwsClusterName', () => { + const result = client.matchLocationFromAwsClusterName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAwsClusterFromAwsClusterName', () => { + const result = client.matchAwsClusterFromAwsClusterName(fakePath); + assert.strictEqual(result, "awsClusterValue"); + assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('awsNodePool', () => { + const fakePath = "/rendered/path/awsNodePool"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + aws_cluster: "awsClusterValue", + aws_node_pool: "awsNodePoolValue", + }; + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.awsNodePoolPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.awsNodePoolPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('awsNodePoolPath', () => { + const result = client.awsNodePoolPath("projectValue", "locationValue", "awsClusterValue", "awsNodePoolValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.awsNodePoolPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAwsNodePoolName', () => { + const result = client.matchProjectFromAwsNodePoolName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAwsNodePoolName', () => { + const result = client.matchLocationFromAwsNodePoolName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAwsClusterFromAwsNodePoolName', () => { + const result = client.matchAwsClusterFromAwsNodePoolName(fakePath); + assert.strictEqual(result, "awsClusterValue"); + assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAwsNodePoolFromAwsNodePoolName', () => { + const result = client.matchAwsNodePoolFromAwsNodePoolName(fakePath); + assert.strictEqual(result, "awsNodePoolValue"); + assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('awsServerConfig', () => { + const fakePath = "/rendered/path/awsServerConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.awsServerConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.awsServerConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('awsServerConfigPath', () => { + const result = client.awsServerConfigPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.awsServerConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAwsServerConfigName', () => { + const result = client.matchProjectFromAwsServerConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.awsServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAwsServerConfigName', () => { + const result = client.matchLocationFromAwsServerConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.awsServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('azureClient', () => { + const fakePath = "/rendered/path/azureClient"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + azure_client: "azureClientValue", + }; + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.azureClientPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.azureClientPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('azureClientPath', () => { + const result = client.azureClientPath("projectValue", "locationValue", "azureClientValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.azureClientPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAzureClientName', () => { + const result = client.matchProjectFromAzureClientName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAzureClientName', () => { + const result = client.matchLocationFromAzureClientName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAzureClientFromAzureClientName', () => { + const result = client.matchAzureClientFromAzureClientName(fakePath); + assert.strictEqual(result, "azureClientValue"); + assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('azureCluster', () => { + const fakePath = "/rendered/path/azureCluster"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + azure_cluster: "azureClusterValue", + }; + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.azureClusterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.azureClusterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('azureClusterPath', () => { + const result = client.azureClusterPath("projectValue", "locationValue", "azureClusterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.azureClusterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAzureClusterName', () => { + const result = client.matchProjectFromAzureClusterName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAzureClusterName', () => { + const result = client.matchLocationFromAzureClusterName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAzureClusterFromAzureClusterName', () => { + const result = client.matchAzureClusterFromAzureClusterName(fakePath); + assert.strictEqual(result, "azureClusterValue"); + assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('azureNodePool', () => { + const fakePath = "/rendered/path/azureNodePool"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + azure_cluster: "azureClusterValue", + azure_node_pool: "azureNodePoolValue", + }; + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.azureNodePoolPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.azureNodePoolPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('azureNodePoolPath', () => { + const result = client.azureNodePoolPath("projectValue", "locationValue", "azureClusterValue", "azureNodePoolValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.azureNodePoolPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAzureNodePoolName', () => { + const result = client.matchProjectFromAzureNodePoolName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAzureNodePoolName', () => { + const result = client.matchLocationFromAzureNodePoolName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAzureClusterFromAzureNodePoolName', () => { + const result = client.matchAzureClusterFromAzureNodePoolName(fakePath); + assert.strictEqual(result, "azureClusterValue"); + assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAzureNodePoolFromAzureNodePoolName', () => { + const result = client.matchAzureNodePoolFromAzureNodePoolName(fakePath); + assert.strictEqual(result, "azureNodePoolValue"); + assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('azureServerConfig', () => { + const fakePath = "/rendered/path/azureServerConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.azureServerConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.azureServerConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('azureServerConfigPath', () => { + const result = client.azureServerConfigPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.azureServerConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAzureServerConfigName', () => { + const result = client.matchProjectFromAzureServerConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.azureServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAzureServerConfigName', () => { + const result = client.matchLocationFromAzureServerConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.azureServerConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new azureclustersModule.v1.AzureClustersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new azureclustersModule.v1.AzureClustersClient({ + 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)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/tsconfig.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/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-gkemulticloud/v1/webpack.config.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/webpack.config.js new file mode 100644 index 00000000000..01b1c9f6e02 --- /dev/null +++ b/owl-bot-staging/google-cloud-gkemulticloud/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: 'AttachedClusters', + filename: './attached-clusters.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-gsuiteaddons/v1/.eslintignore b/owl-bot-staging/google-cloud-gsuiteaddons/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/.eslintrc.json b/owl-bot-staging/google-cloud-gsuiteaddons/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/.gitignore b/owl-bot-staging/google-cloud-gsuiteaddons/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/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-gsuiteaddons/v1/.jsdoc.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/.jsdoc.js new file mode 100644 index 00000000000..0ba8d0588e9 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/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/gsuiteaddons', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/.mocharc.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/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-gsuiteaddons/v1/.prettierrc.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/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-gsuiteaddons/v1/README.md b/owl-bot-staging/google-cloud-gsuiteaddons/v1/README.md new file mode 100644 index 00000000000..ce9c84e8053 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/README.md @@ -0,0 +1 @@ +Gsuiteaddons: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/package.json b/owl-bot-staging/google-cloud-gsuiteaddons/v1/package.json new file mode 100644 index 00000000000..d96967268b9 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/gsuiteaddons", + "version": "0.1.0", + "description": "Gsuiteaddons client for Node.js", + "repository": "googleapis/nodejs-gsuiteaddons", + "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 gsuiteaddons", + "gsuiteaddons", + "g suite add ons" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/addon_widget_set.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/addon_widget_set.proto new file mode 100644 index 00000000000..477ff90f7d4 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/addon_widget_set.proto @@ -0,0 +1,58 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.apps.script.type; + +option csharp_namespace = "Google.Apps.Script.Type"; +option go_package = "google.golang.org/genproto/googleapis/apps/script/type"; +option java_multiple_files = true; +option java_outer_classname = "AddOnWidgetSetProto"; +option java_package = "com.google.apps.script.type"; +option php_namespace = "Google\\Apps\\Script\\Type"; +option ruby_package = "Google::Apps::Script::Type"; + +// The widget subset used by an add-on. +message AddOnWidgetSet { + // The Widget type. DEFAULT is the basic widget set. + enum WidgetType { + // The default widget set. + WIDGET_TYPE_UNSPECIFIED = 0; + + // The date picker. + DATE_PICKER = 1; + + // Styled buttons include filled buttons and disabled buttons. + STYLED_BUTTONS = 2; + + // Persistent forms allow persisting form values during actions. + PERSISTENT_FORMS = 3; + + // Fixed footer in card. + FIXED_FOOTER = 4; + + // Update the subject and recipients of a draft. + UPDATE_SUBJECT_AND_RECIPIENTS = 5; + + // The grid widget. + GRID_WIDGET = 6; + + // A Gmail add-on action that applies to the addon compose UI. + ADDON_COMPOSE_UI_ACTION = 7; + } + + // The list of widgets used in an add-on. + repeated WidgetType used_widgets = 1; +} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/calendar/calendar_addon_manifest.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/calendar/calendar_addon_manifest.proto new file mode 100644 index 00000000000..3d21cd28ca6 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/calendar/calendar_addon_manifest.proto @@ -0,0 +1,107 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.apps.script.type.calendar; + +import "google/api/field_behavior.proto"; +import "google/apps/script/type/extension_point.proto"; + +option csharp_namespace = "Google.Apps.Script.Type.Calendar"; +option go_package = "google.golang.org/genproto/googleapis/apps/script/type/calendar"; +option java_multiple_files = true; +option java_outer_classname = "CalendarAddOnManifestProto"; +option java_package = "com.google.apps.script.type.calendar"; +option php_namespace = "Google\\Apps\\Script\\Type\\Calendar"; +option ruby_package = "Google::Apps::Script::Type::Calendar"; + +// Manifest section specific to Calendar Add-ons. + +// Calendar add-on manifest. +message CalendarAddOnManifest { + // An enum defining the level of data access event triggers require. + enum EventAccess { + // Default value when nothing is set for EventAccess. + UNSPECIFIED = 0; + + // METADATA gives event triggers the permission to access the metadata of + // events such as event id and calendar id. + METADATA = 1; + + // READ gives event triggers access to all provided event fields including + // the metadata, attendees, and conference data. + READ = 3; + + // WRITE gives event triggers access to the metadata of events and the + // ability to perform all actions, including adding attendees and setting + // conference data. + WRITE = 4; + + // READ_WRITE gives event triggers access to all provided event fields + // including the metadata, attendees, and conference data and the ability to + // perform all actions. + READ_WRITE = 5; + } + + // Defines an endpoint that will be executed contexts that don't + // match a declared contextual trigger. Any cards generated by this function + // will always be available to the user, but may be eclipsed by contextual + // content when this add-on declares more targeted triggers. + // + // If present, this overrides the configuration from + // `addOns.common.homepageTrigger`. + google.apps.script.type.HomepageExtensionPoint homepage_trigger = 6; + + // Defines conference solutions provided by this add-on. + repeated ConferenceSolution conference_solution = 3; + + // An endpoint to execute that creates a URL to the add-on's settings page. + string create_settings_url_function = 5; + + // An endpoint to trigger when an event is opened (viewed/edited). + CalendarExtensionPoint event_open_trigger = 10; + + // An endpoint to trigger when the open event is updated. + CalendarExtensionPoint event_update_trigger = 11; + + // Define the level of data access when an event addon is triggered. + EventAccess current_event_access = 12; +} + +// Defines conference related values. +message ConferenceSolution { + // Required. The endpoint to call when ConferenceData should be created. + string on_create_function = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. IDs should be unique across ConferenceSolutions within one + // add-on, but this is not strictly enforced. It is up to the add-on developer + // to assign them uniquely, otherwise the wrong ConferenceSolution may be + // used when the add-on is triggered. While the developer may change the + // display name of an add-on, the ID should not be changed. + string id = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. The display name of the ConferenceSolution. + string name = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. The URL for the logo image of the ConferenceSolution. + string logo_url = 6 [(google.api.field_behavior) = REQUIRED]; +} + +// Common format for declaring a calendar add-on's triggers. +message CalendarExtensionPoint { + // Required. The endpoint to execute when this extension point is + // activated. + string run_function = 1 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/docs/docs_addon_manifest.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/docs/docs_addon_manifest.proto new file mode 100644 index 00000000000..395523be5ee --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/docs/docs_addon_manifest.proto @@ -0,0 +1,47 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.apps.script.type.docs; + +import "google/api/field_behavior.proto"; +import "google/apps/script/type/extension_point.proto"; + +option csharp_namespace = "Google.Apps.Script.Type.Docs"; +option go_package = "google.golang.org/genproto/googleapis/apps/script/type/docs"; +option java_multiple_files = true; +option java_outer_classname = "DocsAddOnManifestProto"; +option java_package = "com.google.apps.script.type.docs"; +option php_namespace = "Google\\Apps\\Script\\Type\\Docs"; +option ruby_package = "Google::Apps::Script::Type::Docs"; + +// Manifest section specific to Docs Add-ons. + +// Docs add-on manifest. +message DocsAddOnManifest { + // If present, this overrides the configuration from + // `addOns.common.homepageTrigger`. + google.apps.script.type.HomepageExtensionPoint homepage_trigger = 1; + + // Endpoint to execute when file scope authorization is granted + // for this document/user pair. + DocsExtensionPoint on_file_scope_granted_trigger = 2; +} + +// Common format for declaring a Docs add-on's triggers. +message DocsExtensionPoint { + // Required. The endpoint to execute when this extension point is activated. + string run_function = 1 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/drive/drive_addon_manifest.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/drive/drive_addon_manifest.proto new file mode 100644 index 00000000000..55da161cfd6 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/drive/drive_addon_manifest.proto @@ -0,0 +1,48 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.apps.script.type.drive; + +import "google/apps/script/type/extension_point.proto"; + +option csharp_namespace = "Google.Apps.Script.Type.Drive"; +option go_package = "google.golang.org/genproto/googleapis/apps/script/type/drive"; +option java_multiple_files = true; +option java_outer_classname = "DriveAddOnManifestProto"; +option java_package = "com.google.apps.script.type.drive"; +option php_namespace = "Google\\Apps\\Script\\Type\\Drive"; +option ruby_package = "Google::Apps::Script::Type::Drive"; + +// Manifest section specific to Drive Add-ons. + +// Drive add-on manifest. +message DriveAddOnManifest { + // If present, this overrides the configuration from + // `addOns.common.homepageTrigger`. + google.apps.script.type.HomepageExtensionPoint homepage_trigger = 1; + + // Corresponds to behvior that should execute when items are selected + // in relevant Drive view (e.g. the My Drive Doclist). + DriveExtensionPoint on_items_selected_trigger = 2; +} + +// A generic extension point with common features, e.g. something that simply +// needs a corresponding run function to work. +message DriveExtensionPoint { + // Required. The endpoint to execute when this extension point is + // activated. + string run_function = 1; +} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/extension_point.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/extension_point.proto new file mode 100644 index 00000000000..f387c86423c --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/extension_point.proto @@ -0,0 +1,77 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.apps.script.type; + +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Apps.Script.Type"; +option go_package = "google.golang.org/genproto/googleapis/apps/script/type"; +option java_multiple_files = true; +option java_package = "com.google.apps.script.type"; +option php_namespace = "Google\\Apps\\Script\\Type"; +option ruby_package = "Google::Apps::Script::Type"; + +// Common Manifest protos for G Suite extension-point configuration. + +// Common format for declaring a menu item, or button, that appears within a +// host app. +message MenuItemExtensionPoint { + // Required. The endpoint to execute when this extension point is + // activated. + string run_function = 1; + + // Required. User-visible text describing the action taken by activating this + // extension point. For example, "Insert invoice". + string label = 2; + + // The URL for the logo image shown in the add-on toolbar. + // + // If not set, defaults to the add-on's primary logo URL. + string logo_url = 3; +} + +// Common format for declaring an add-on's home-page view. +message HomepageExtensionPoint { + // Required. The endpoint to execute when this extension point is + // activated. + string run_function = 1; + + // Optional. If set to `false`, disable the home-page view in this context. + // + // Defaults to `true` if unset. + // + // If an add-ons custom home-page view is disabled, an autogenerated overview + // card will be provided for users instead. + google.protobuf.BoolValue enabled = 2; +} + +// Format for declaring a universal action menu item extension point. +message UniversalActionExtensionPoint { + // Required. User-visible text describing the action taken by activating this + // extension point, for example, "Add a new contact". + string label = 1; + + // Required. The action type supported on a universal action menu item. It + // could be either a link to open or an endpoint to execute. + oneof action_type { + // URL to be opened by the UniversalAction. + string open_link = 2; + + // Endpoint to be run by the UniversalAction. + string run_function = 3; + } +} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/gmail/gmail_addon_manifest.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/gmail/gmail_addon_manifest.proto new file mode 100644 index 00000000000..eda200782c8 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/gmail/gmail_addon_manifest.proto @@ -0,0 +1,127 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.apps.script.type.gmail; + +import "google/apps/script/type/addon_widget_set.proto"; +import "google/apps/script/type/extension_point.proto"; + +option csharp_namespace = "Google.Apps.Script.Type.Gmail"; +option go_package = "google.golang.org/genproto/googleapis/apps/script/type/gmail"; +option java_multiple_files = true; +option java_outer_classname = "GmailAddOnManifestProto"; +option java_package = "com.google.apps.script.type.gmail"; +option php_namespace = "Google\\Apps\\Script\\Type\\Gmail"; +option ruby_package = "Google::Apps::Script::Type::Gmail"; + +// Properties customizing the appearance and execution of a Gmail add-on. +message GmailAddOnManifest { + // Defines an endpoint that will be executed in contexts that don't + // match a declared contextual trigger. Any cards generated by this function + // will always be available to the user, but may be eclipsed by contextual + // content when this add-on declares more targeted triggers. + // + // If present, this overrides the configuration from + // `addOns.common.homepageTrigger`. + google.apps.script.type.HomepageExtensionPoint homepage_trigger = 14; + + // Defines the set of conditions that trigger the add-on. + repeated ContextualTrigger contextual_triggers = 3; + + // Defines set of [universal + // actions](/gmail/add-ons/how-tos/universal-actions) for the add-on. The user + // triggers universal actions from the add-on toolbar menu. + repeated UniversalAction universal_actions = 4; + + // Defines the compose time trigger for a compose time add-on. This is the + // trigger that causes an add-on to take action when the user is composing an + // email. + // All compose time addons are required to have the + // gmail.addons.current.action.compose scope even though it might not edit the + // draft. + ComposeTrigger compose_trigger = 12; + + // The name of an endpoint that verifies that the add-on has + // all the required third-party authorizations, by probing the third-party + // APIs. If the probe fails, the function should throw an exception to + // initiate the authorization flow. This function is called before each + // invocation of the add-on, in order to ensure a smooth user experience. + string authorization_check_function = 7; +} + +// An action that is always available in the add-on toolbar menu regardless of +// message context. +message UniversalAction { + // Required. User-visible text describing the action, for example, "Add a new + // contact." + string text = 1; + + // The type of the action determines the behavior of Gmail when the user + // invokes the action. + oneof action_type { + // A link that is opened by Gmail when the user triggers the action. + string open_link = 2; + + // An endpoint that is called when the user triggers the + // action. See the [universal actions + // guide](/gmail/add-ons/how-tos/universal-actions) for details. + string run_function = 3; + } +} + +// A trigger that activates when user is composing an email. +message ComposeTrigger { + // An enum defining the level of data access this compose trigger requires. + enum DraftAccess { + // Default value when nothing is set for DraftAccess. + UNSPECIFIED = 0; + + // NONE means compose trigger won't be able to access any data of the draft + // when a compose addon is triggered. + NONE = 1; + + // METADATA gives compose trigger the permission to access the metadata of + // the draft when a compose addon is triggered. This includes the audience + // list (To/cc list) of a draft message. + METADATA = 2; + } + + // Defines the set of actions for compose time add-on. These are actions + // that user can trigger on a compose time addon. + repeated google.apps.script.type.MenuItemExtensionPoint actions = 5; + + // Define the level of data access when a compose time addon is triggered. + DraftAccess draft_access = 4; +} + +// Defines a trigger that fires when the open email meets a specific criteria. +// When the trigger fires, it executes a specific endpoint, usually +// in order to create new cards and update the UI. +message ContextualTrigger { + // The type of trigger determines the conditions Gmail uses to show the + // add-on. + oneof trigger { + // UnconditionalTriggers are executed when any mail message is opened. + UnconditionalTrigger unconditional = 1; + } + + // Required. The name of the endpoint to call when a message matches the + // trigger. + string on_trigger_function = 4; +} + +// A trigger that fires when any email message is opened. +message UnconditionalTrigger {} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/script_manifest.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/script_manifest.proto new file mode 100644 index 00000000000..572d5da98ce --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/script_manifest.proto @@ -0,0 +1,105 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.apps.script.type; + +import "google/apps/script/type/addon_widget_set.proto"; +import "google/apps/script/type/extension_point.proto"; +import "google/protobuf/struct.proto"; + +option csharp_namespace = "Google.Apps.Script.Type"; +option go_package = "google.golang.org/genproto/googleapis/apps/script/type"; +option java_multiple_files = true; +option java_package = "com.google.apps.script.type"; +option php_namespace = "Google\\Apps\\Script\\Type"; +option ruby_package = "Google::Apps::Script::Type"; + +// Add-on configuration that is shared across all add-on host applications. +message CommonAddOnManifest { + // Required. The display name of the add-on. + string name = 1; + + // Required. The URL for the logo image shown in the add-on toolbar. + string logo_url = 2; + + // Common layout properties for the add-on cards. + LayoutProperties layout_properties = 3; + + // The widgets used in the add-on. If this field is not specified, + // it indicates that default set is used. + AddOnWidgetSet add_on_widget_set = 4; + + // Whether to pass locale information from host app. + bool use_locale_from_app = 5; + + // Defines an endpoint that will be executed in any context, in + // any host. Any cards generated by this function will always be available to + // the user, but may be eclipsed by contextual content when this add-on + // declares more targeted triggers. + HomepageExtensionPoint homepage_trigger = 6; + + // Defines a list of extension points in the universal action menu which + // serves as a setting menu for the add-on. The extension point can be + // link URL to open or an endpoint to execute as a form + // submission. + repeated UniversalActionExtensionPoint universal_actions = 7; + + // An OpenLink action + // can only use a URL with an HTTPS, MAILTO or TEL scheme. For HTTPS links, + // the URL must also + // [match](/gmail/add-ons/concepts/manifests#whitelisting_urls) one of the + // prefixes specified in this whitelist. If the prefix omits the scheme, HTTPS + // is assumed. Notice that HTTP links are automatically rewritten to HTTPS + // links. + google.protobuf.ListValue open_link_url_prefixes = 8; +} + +// Card layout properties shared across all add-on host applications. +message LayoutProperties { + // The primary color of the add-on. It sets the color of toolbar. If no + // primary color is set explicitly, the default value provided by the + // framework is used. + string primary_color = 1; + + // The secondary color of the add-on. It sets the color of buttons. + // If primary color is set but no secondary color is set, the + // secondary color is the same as the primary color. If neither primary + // color nor secondary color is set, the default value provided by the + // framework is used. + string secondary_color = 2; +} + +// Options for sending requests to add-on HTTP endpoints +message HttpOptions { + // Configuration for the token sent in the HTTP Authorization header + HttpAuthorizationHeader authorization_header = 1; +} + +// Authorization header sent in add-on HTTP requests +enum HttpAuthorizationHeader { + // Default value, equivalent to `SYSTEM_ID_TOKEN` + HTTP_AUTHORIZATION_HEADER_UNSPECIFIED = 0; + + // Send an ID token for the project-specific Google Workspace Add-ons system + // service account (default) + SYSTEM_ID_TOKEN = 1; + + // Send an ID token for the end user + USER_ID_TOKEN = 2; + + // Do not send an Authentication header + NONE = 3; +} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/sheets/sheets_addon_manifest.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/sheets/sheets_addon_manifest.proto new file mode 100644 index 00000000000..c34bca71fcc --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/sheets/sheets_addon_manifest.proto @@ -0,0 +1,47 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.apps.script.type.sheets; + +import "google/api/field_behavior.proto"; +import "google/apps/script/type/extension_point.proto"; + +option csharp_namespace = "Google.Apps.Script.Type.Sheets"; +option go_package = "google.golang.org/genproto/googleapis/apps/script/type/sheets"; +option java_multiple_files = true; +option java_outer_classname = "SheetsAddOnManifestProto"; +option java_package = "com.google.apps.script.type.sheets"; +option php_namespace = "Google\\Apps\\Script\\Type\\Sheets"; +option ruby_package = "Google::Apps::Script::Type::Sheets"; + +// Manifest section specific to Sheets Add-ons. + +// Sheets add-on manifest. +message SheetsAddOnManifest { + // If present, this overrides the configuration from + // `addOns.common.homepageTrigger`. + google.apps.script.type.HomepageExtensionPoint homepage_trigger = 3; + + // Endpoint to execute when file scope authorization is granted + // for this document/user pair. + SheetsExtensionPoint on_file_scope_granted_trigger = 5; +} + +// Common format for declaring a Sheets add-on's triggers. +message SheetsExtensionPoint { + // Required. The endpoint to execute when this extension point is activated. + string run_function = 1 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/slides/slides_addon_manifest.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/slides/slides_addon_manifest.proto new file mode 100644 index 00000000000..6a51bb2f46b --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/slides/slides_addon_manifest.proto @@ -0,0 +1,47 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.apps.script.type.slides; + +import "google/api/field_behavior.proto"; +import "google/apps/script/type/extension_point.proto"; + +option csharp_namespace = "Google.Apps.Script.Type.Slides"; +option go_package = "google.golang.org/genproto/googleapis/apps/script/type/slides"; +option java_multiple_files = true; +option java_outer_classname = "SlidesAddOnManifestProto"; +option java_package = "com.google.apps.script.type.slides"; +option php_namespace = "Google\\Apps\\Script\\Type\\Slides"; +option ruby_package = "Google::Apps::Script::Type::Slides"; + +// Manifest section specific to Slides Add-ons. + +// Slides add-on manifest. +message SlidesAddOnManifest { + // If present, this overrides the configuration from + // `addOns.common.homepageTrigger`. + google.apps.script.type.HomepageExtensionPoint homepage_trigger = 1; + + // Endpoint to execute when file scope authorization is granted + // for this document/user pair. + SlidesExtensionPoint on_file_scope_granted_trigger = 2; +} + +// Common format for declaring a Slides add-on's triggers. +message SlidesExtensionPoint { + // Required. The endpoint to execute when this extension point is activated. + string run_function = 1 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/cloud/gsuiteaddons/v1/gsuiteaddons.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/cloud/gsuiteaddons/v1/gsuiteaddons.proto new file mode 100644 index 00000000000..8d557ca5f8a --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/cloud/gsuiteaddons/v1/gsuiteaddons.proto @@ -0,0 +1,389 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.gsuiteaddons.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/apps/script/type/calendar/calendar_addon_manifest.proto"; +import "google/apps/script/type/docs/docs_addon_manifest.proto"; +import "google/apps/script/type/drive/drive_addon_manifest.proto"; +import "google/apps/script/type/gmail/gmail_addon_manifest.proto"; +import "google/apps/script/type/script_manifest.proto"; +import "google/apps/script/type/sheets/sheets_addon_manifest.proto"; +import "google/apps/script/type/slides/slides_addon_manifest.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.GSuiteAddOns.V1"; +option go_package = "cloud.google.com/go/gsuiteaddons/apiv1/gsuiteaddonspb;gsuiteaddonspb"; +option java_multiple_files = true; +option java_outer_classname = "GSuiteAddOnsProto"; +option java_package = "com.google.cloud.gsuiteaddons.v1"; +option php_namespace = "Google\\Cloud\\GSuiteAddOns\\V1"; +option ruby_package = "Google::Cloud::GSuiteAddOns::V1"; + +// A service for managing Google Workspace Add-ons deployments. +// +// A Google Workspace Add-on is a third-party embedded component that can be +// installed in Google Workspace Applications like Gmail, Calendar, Drive, and +// the Google Docs, Sheets, and Slides editors. Google Workspace Add-ons can +// display UI cards, receive contextual information from the host application, +// and perform actions in the host application (See: +// https://developers.google.com/gsuite/add-ons/overview for more information). +// +// A Google Workspace Add-on deployment resource specifies metadata about the +// add-on, including a specification of the entry points in the host application +// that trigger add-on executions (see: +// https://developers.google.com/gsuite/add-ons/concepts/gsuite-manifests). +// Add-on deployments defined via the Google Workspace Add-ons API define their +// entrypoints using HTTPS URLs (See: +// https://developers.google.com/gsuite/add-ons/guides/alternate-runtimes), +// +// A Google Workspace Add-on deployment can be installed in developer mode, +// which allows an add-on developer to test the experience an end-user would see +// when installing and running the add-on in their G Suite applications. When +// running in developer mode, more detailed error messages are exposed in the +// add-on UI to aid in debugging. +// +// A Google Workspace Add-on deployment can be published to Google Workspace +// Marketplace, which allows other Google Workspace users to discover and +// install the add-on. See: +// https://developers.google.com/gsuite/add-ons/how-tos/publish-add-on-overview +// for details. +service GSuiteAddOns { + option (google.api.default_host) = "gsuiteaddons.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Gets the authorization information for deployments in a given project. + rpc GetAuthorization(GetAuthorizationRequest) returns (Authorization) { + option (google.api.http) = { + get: "/v1/{name=projects/*/authorization}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a deployment with the specified name and configuration. + rpc CreateDeployment(CreateDeploymentRequest) returns (Deployment) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/deployments" + body: "deployment" + }; + option (google.api.method_signature) = "parent,deployment,deployment_id"; + } + + // Creates or replaces a deployment with the specified name. + rpc ReplaceDeployment(ReplaceDeploymentRequest) returns (Deployment) { + option (google.api.http) = { + put: "/v1/{deployment.name=projects/*/deployments/*}" + body: "deployment" + }; + option (google.api.method_signature) = "deployment"; + } + + // Gets the deployment with the specified name. + rpc GetDeployment(GetDeploymentRequest) returns (Deployment) { + option (google.api.http) = { + get: "/v1/{name=projects/*/deployments/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all deployments in a particular project. + rpc ListDeployments(ListDeploymentsRequest) + returns (ListDeploymentsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/deployments" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes the deployment with the given name. + rpc DeleteDeployment(DeleteDeploymentRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/deployments/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Installs a deployment in developer mode. + // See: + // https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons. + rpc InstallDeployment(InstallDeploymentRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{name=projects/*/deployments/*}:install" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Uninstalls a developer mode deployment. + // See: + // https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons. + rpc UninstallDeployment(UninstallDeploymentRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{name=projects/*/deployments/*}:uninstall" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Fetches the install status of a developer mode deployment. + rpc GetInstallStatus(GetInstallStatusRequest) returns (InstallStatus) { + option (google.api.http) = { + get: "/v1/{name=projects/*/deployments/*/installStatus}" + }; + option (google.api.method_signature) = "name"; + } +} + +// Request message to get Google Workspace Add-ons authorization information. +message GetAuthorizationRequest { + // Required. Name of the project for which to get the Google Workspace Add-ons + // authorization information. + // + // Example: `projects/my_project/authorization`. + string name = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gsuiteaddons.googleapis.com/Authorization" + } + ]; +} + +// The authorization information used when invoking deployment endpoints. +message Authorization { + option (google.api.resource) = { + type: "gsuiteaddons.googleapis.com/Authorization" + pattern: "projects/{project}/authorization" + }; + + // The canonical full name of this resource. + // Example: `projects/123/authorization` + string name = 1; + + // The email address of the service account used to authenticate requests to + // add-on callback endpoints. + string service_account_email = 2; + + // The OAuth client ID used to obtain OAuth access tokens for a user on the + // add-on's behalf. + string oauth_client_id = 3; +} + +// Request message to create a deployment. +message CreateDeploymentRequest { + // Required. Name of the project in which to create the deployment. + // + // Example: `projects/my_project`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The id to use for this deployment. The full name of the created + // resource will be `projects//deployments/`. + string deployment_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The deployment to create (deployment.name cannot be set). + Deployment deployment = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message to create or replace a deployment. +message ReplaceDeploymentRequest { + // Required. The deployment to create or replace. + Deployment deployment = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message to get a deployment. +message GetDeploymentRequest { + // Required. The full resource name of the deployment to get. + // + // Example: `projects/my_project/deployments/my_deployment`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gsuiteaddons.googleapis.com/Deployment" + } + ]; +} + +// Request message to list deployments for a project. +message ListDeploymentsRequest { + // Required. Name of the project in which to create the deployment. + // + // Example: `projects/my_project`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // The maximum number of deployments to return. The service may return fewer + // than this value. + // If unspecified, at most 1000 deployments 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 `ListDeployments` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListDeployments` must + // match the call that provided the page token. + string page_token = 3; +} + +// Response message to list deployments. +message ListDeploymentsResponse { + // The list of deployments for the given project. + repeated Deployment deployments = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message to delete a deployment. +message DeleteDeploymentRequest { + // Required. The full resource name of the deployment to delete. + // + // Example: `projects/my_project/deployments/my_deployment`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gsuiteaddons.googleapis.com/Deployment" + } + ]; + + // The etag of the deployment to delete. + // If this is provided, it must match the server's etag. + string etag = 2; +} + +// Request message to install a developer mode deployment. +message InstallDeploymentRequest { + // Required. The full resource name of the deployment to install. + // + // Example: `projects/my_project/deployments/my_deployment`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gsuiteaddons.googleapis.com/Deployment" + } + ]; +} + +// Request message to uninstall a developer mode deployment. +message UninstallDeploymentRequest { + // Required. The full resource name of the deployment to install. + // + // Example: `projects/my_project/deployments/my_deployment`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gsuiteaddons.googleapis.com/Deployment" + } + ]; +} + +// Request message to get the install status of a developer mode deployment. +message GetInstallStatusRequest { + // Required. The full resource name of the deployment. + // + // Example: `projects/my_project/deployments/my_deployment/installStatus`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "gsuiteaddons.googleapis.com/InstallStatus" + } + ]; +} + +// Developer mode install status of a deployment +message InstallStatus { + option (google.api.resource) = { + type: "gsuiteaddons.googleapis.com/InstallStatus" + pattern: "projects/{project}/deployments/{deployment}/installStatus" + }; + + // The canonical full resource name of the deployment install status. + // + // Example: `projects/123/deployments/my_deployment/installStatus`. + string name = 1; + + // True if the deployment is installed for the user + google.protobuf.BoolValue installed = 2; +} + +// A Google Workspace Add-on deployment +message Deployment { + option (google.api.resource) = { + type: "gsuiteaddons.googleapis.com/Deployment" + pattern: "projects/{project}/deployments/{deployment}" + }; + + // The deployment resource name. + // Example: projects/123/deployments/my_deployment. + string name = 1; + + // The list of Google OAuth scopes for which to request consent from the end + // user before executing an add-on endpoint. + repeated string oauth_scopes = 2; + + // The Google Workspace Add-on configuration. + AddOns add_ons = 3; + + // This value is computed by the server based on the version of the + // deployment in storage, and may be sent on update and delete requests to + // ensure the client has an up-to-date value before proceeding. + string etag = 5; +} + +// A Google Workspace Add-on configuration. +message AddOns { + // Configuration that is common across all Google Workspace Add-ons. + google.apps.script.type.CommonAddOnManifest common = 1; + + // Gmail add-on configuration. + google.apps.script.type.gmail.GmailAddOnManifest gmail = 2; + + // Drive add-on configuration. + google.apps.script.type.drive.DriveAddOnManifest drive = 5; + + // Calendar add-on configuration. + google.apps.script.type.calendar.CalendarAddOnManifest calendar = 6; + + // Docs add-on configuration. + google.apps.script.type.docs.DocsAddOnManifest docs = 7; + + // Sheets add-on configuration. + google.apps.script.type.sheets.SheetsAddOnManifest sheets = 8; + + // Slides add-on configuration. + google.apps.script.type.slides.SlidesAddOnManifest slides = 10; + + // Options for sending requests to add-on HTTP endpoints + google.apps.script.type.HttpOptions http_options = 15; +} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.create_deployment.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.create_deployment.js new file mode 100644 index 00000000000..fa9eecd7eb5 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.create_deployment.js @@ -0,0 +1,73 @@ +// 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, deploymentId, deployment) { + // [START gsuiteaddons_v1_generated_GSuiteAddOns_CreateDeployment_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 project in which to create the deployment. + * Example: `projects/my_project`. + */ + // const parent = 'abc123' + /** + * Required. The id to use for this deployment. The full name of the created + * resource will be `projects//deployments/`. + */ + // const deploymentId = 'abc123' + /** + * Required. The deployment to create (deployment.name cannot be set). + */ + // const deployment = {} + + // Imports the Gsuiteaddons library + const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; + + // Instantiates a client + const gsuiteaddonsClient = new GSuiteAddOnsClient(); + + async function callCreateDeployment() { + // Construct request + const request = { + parent, + deploymentId, + deployment, + }; + + // Run request + const response = await gsuiteaddonsClient.createDeployment(request); + console.log(response); + } + + callCreateDeployment(); + // [END gsuiteaddons_v1_generated_GSuiteAddOns_CreateDeployment_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-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.delete_deployment.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.delete_deployment.js new file mode 100644 index 00000000000..126a4ffccf7 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.delete_deployment.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(name) { + // [START gsuiteaddons_v1_generated_GSuiteAddOns_DeleteDeployment_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 full resource name of the deployment to delete. + * Example: `projects/my_project/deployments/my_deployment`. + */ + // const name = 'abc123' + /** + * The etag of the deployment to delete. + * If this is provided, it must match the server's etag. + */ + // const etag = 'abc123' + + // Imports the Gsuiteaddons library + const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; + + // Instantiates a client + const gsuiteaddonsClient = new GSuiteAddOnsClient(); + + async function callDeleteDeployment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gsuiteaddonsClient.deleteDeployment(request); + console.log(response); + } + + callDeleteDeployment(); + // [END gsuiteaddons_v1_generated_GSuiteAddOns_DeleteDeployment_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-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_authorization.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_authorization.js new file mode 100644 index 00000000000..36b8296534e --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_authorization.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 gsuiteaddons_v1_generated_GSuiteAddOns_GetAuthorization_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 project for which to get the Google Workspace Add-ons + * authorization information. + * Example: `projects/my_project/authorization`. + */ + // const name = 'abc123' + + // Imports the Gsuiteaddons library + const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; + + // Instantiates a client + const gsuiteaddonsClient = new GSuiteAddOnsClient(); + + async function callGetAuthorization() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gsuiteaddonsClient.getAuthorization(request); + console.log(response); + } + + callGetAuthorization(); + // [END gsuiteaddons_v1_generated_GSuiteAddOns_GetAuthorization_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-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_deployment.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_deployment.js new file mode 100644 index 00000000000..f50131ff357 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_deployment.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 gsuiteaddons_v1_generated_GSuiteAddOns_GetDeployment_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 full resource name of the deployment to get. + * Example: `projects/my_project/deployments/my_deployment`. + */ + // const name = 'abc123' + + // Imports the Gsuiteaddons library + const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; + + // Instantiates a client + const gsuiteaddonsClient = new GSuiteAddOnsClient(); + + async function callGetDeployment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gsuiteaddonsClient.getDeployment(request); + console.log(response); + } + + callGetDeployment(); + // [END gsuiteaddons_v1_generated_GSuiteAddOns_GetDeployment_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-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_install_status.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_install_status.js new file mode 100644 index 00000000000..bed246f9f5d --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_install_status.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 gsuiteaddons_v1_generated_GSuiteAddOns_GetInstallStatus_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 full resource name of the deployment. + * Example: `projects/my_project/deployments/my_deployment/installStatus`. + */ + // const name = 'abc123' + + // Imports the Gsuiteaddons library + const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; + + // Instantiates a client + const gsuiteaddonsClient = new GSuiteAddOnsClient(); + + async function callGetInstallStatus() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gsuiteaddonsClient.getInstallStatus(request); + console.log(response); + } + + callGetInstallStatus(); + // [END gsuiteaddons_v1_generated_GSuiteAddOns_GetInstallStatus_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-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.install_deployment.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.install_deployment.js new file mode 100644 index 00000000000..ecfb281157f --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.install_deployment.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 gsuiteaddons_v1_generated_GSuiteAddOns_InstallDeployment_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 full resource name of the deployment to install. + * Example: `projects/my_project/deployments/my_deployment`. + */ + // const name = 'abc123' + + // Imports the Gsuiteaddons library + const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; + + // Instantiates a client + const gsuiteaddonsClient = new GSuiteAddOnsClient(); + + async function callInstallDeployment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gsuiteaddonsClient.installDeployment(request); + console.log(response); + } + + callInstallDeployment(); + // [END gsuiteaddons_v1_generated_GSuiteAddOns_InstallDeployment_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-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.list_deployments.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.list_deployments.js new file mode 100644 index 00000000000..df7b8f978b4 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.list_deployments.js @@ -0,0 +1,78 @@ +// 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 gsuiteaddons_v1_generated_GSuiteAddOns_ListDeployments_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 project in which to create the deployment. + * Example: `projects/my_project`. + */ + // const parent = 'abc123' + /** + * The maximum number of deployments to return. The service may return fewer + * than this value. + * If unspecified, at most 1000 deployments 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 `ListDeployments` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListDeployments` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + + // Imports the Gsuiteaddons library + const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; + + // Instantiates a client + const gsuiteaddonsClient = new GSuiteAddOnsClient(); + + async function callListDeployments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gsuiteaddonsClient.listDeploymentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDeployments(); + // [END gsuiteaddons_v1_generated_GSuiteAddOns_ListDeployments_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-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.replace_deployment.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.replace_deployment.js new file mode 100644 index 00000000000..d697b80a7fa --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.replace_deployment.js @@ -0,0 +1,61 @@ +// 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(deployment) { + // [START gsuiteaddons_v1_generated_GSuiteAddOns_ReplaceDeployment_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 deployment to create or replace. + */ + // const deployment = {} + + // Imports the Gsuiteaddons library + const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; + + // Instantiates a client + const gsuiteaddonsClient = new GSuiteAddOnsClient(); + + async function callReplaceDeployment() { + // Construct request + const request = { + deployment, + }; + + // Run request + const response = await gsuiteaddonsClient.replaceDeployment(request); + console.log(response); + } + + callReplaceDeployment(); + // [END gsuiteaddons_v1_generated_GSuiteAddOns_ReplaceDeployment_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-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.uninstall_deployment.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.uninstall_deployment.js new file mode 100644 index 00000000000..e879887a9c3 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.uninstall_deployment.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 gsuiteaddons_v1_generated_GSuiteAddOns_UninstallDeployment_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 full resource name of the deployment to install. + * Example: `projects/my_project/deployments/my_deployment`. + */ + // const name = 'abc123' + + // Imports the Gsuiteaddons library + const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; + + // Instantiates a client + const gsuiteaddonsClient = new GSuiteAddOnsClient(); + + async function callUninstallDeployment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gsuiteaddonsClient.uninstallDeployment(request); + console.log(response); + } + + callUninstallDeployment(); + // [END gsuiteaddons_v1_generated_GSuiteAddOns_UninstallDeployment_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-gsuiteaddons/v1/samples/generated/v1/snippet_metadata_google.cloud.gsuiteaddons.v1.json b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/snippet_metadata_google.cloud.gsuiteaddons.v1.json new file mode 100644 index 00000000000..027ba5bc688 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/snippet_metadata_google.cloud.gsuiteaddons.v1.json @@ -0,0 +1,395 @@ +{ + "clientLibrary": { + "name": "nodejs-gsuiteaddons", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.gsuiteaddons.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_GetAuthorization_async", + "title": "GSuiteAddOns getAuthorization Sample", + "origin": "API_DEFINITION", + "description": " Gets the authorization information for deployments in a given project.", + "canonical": true, + "file": "g_suite_add_ons.get_authorization.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAuthorization", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.GetAuthorization", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gsuiteaddons.v1.Authorization", + "client": { + "shortName": "GSuiteAddOnsClient", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" + }, + "method": { + "shortName": "GetAuthorization", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.GetAuthorization", + "service": { + "shortName": "GSuiteAddOns", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" + } + } + } + }, + { + "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_CreateDeployment_async", + "title": "GSuiteAddOns createDeployment Sample", + "origin": "API_DEFINITION", + "description": " Creates a deployment with the specified name and configuration.", + "canonical": true, + "file": "g_suite_add_ons.create_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateDeployment", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.CreateDeployment", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "deployment_id", + "type": "TYPE_STRING" + }, + { + "name": "deployment", + "type": ".google.cloud.gsuiteaddons.v1.Deployment" + } + ], + "resultType": ".google.cloud.gsuiteaddons.v1.Deployment", + "client": { + "shortName": "GSuiteAddOnsClient", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" + }, + "method": { + "shortName": "CreateDeployment", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.CreateDeployment", + "service": { + "shortName": "GSuiteAddOns", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" + } + } + } + }, + { + "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_ReplaceDeployment_async", + "title": "GSuiteAddOns replaceDeployment Sample", + "origin": "API_DEFINITION", + "description": " Creates or replaces a deployment with the specified name.", + "canonical": true, + "file": "g_suite_add_ons.replace_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReplaceDeployment", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.ReplaceDeployment", + "async": true, + "parameters": [ + { + "name": "deployment", + "type": ".google.cloud.gsuiteaddons.v1.Deployment" + } + ], + "resultType": ".google.cloud.gsuiteaddons.v1.Deployment", + "client": { + "shortName": "GSuiteAddOnsClient", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" + }, + "method": { + "shortName": "ReplaceDeployment", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.ReplaceDeployment", + "service": { + "shortName": "GSuiteAddOns", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" + } + } + } + }, + { + "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_GetDeployment_async", + "title": "GSuiteAddOns getDeployment Sample", + "origin": "API_DEFINITION", + "description": " Gets the deployment with the specified name.", + "canonical": true, + "file": "g_suite_add_ons.get_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDeployment", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.GetDeployment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gsuiteaddons.v1.Deployment", + "client": { + "shortName": "GSuiteAddOnsClient", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" + }, + "method": { + "shortName": "GetDeployment", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.GetDeployment", + "service": { + "shortName": "GSuiteAddOns", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" + } + } + } + }, + { + "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_ListDeployments_async", + "title": "GSuiteAddOns listDeployments Sample", + "origin": "API_DEFINITION", + "description": " Lists all deployments in a particular project.", + "canonical": true, + "file": "g_suite_add_ons.list_deployments.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDeployments", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.ListDeployments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gsuiteaddons.v1.ListDeploymentsResponse", + "client": { + "shortName": "GSuiteAddOnsClient", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" + }, + "method": { + "shortName": "ListDeployments", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.ListDeployments", + "service": { + "shortName": "GSuiteAddOns", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" + } + } + } + }, + { + "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_DeleteDeployment_async", + "title": "GSuiteAddOns deleteDeployment Sample", + "origin": "API_DEFINITION", + "description": " Deletes the deployment with the given name.", + "canonical": true, + "file": "g_suite_add_ons.delete_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteDeployment", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.DeleteDeployment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "GSuiteAddOnsClient", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" + }, + "method": { + "shortName": "DeleteDeployment", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.DeleteDeployment", + "service": { + "shortName": "GSuiteAddOns", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" + } + } + } + }, + { + "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_InstallDeployment_async", + "title": "GSuiteAddOns installDeployment Sample", + "origin": "API_DEFINITION", + "description": " Installs a deployment in developer mode. See: https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons.", + "canonical": true, + "file": "g_suite_add_ons.install_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "InstallDeployment", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.InstallDeployment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "GSuiteAddOnsClient", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" + }, + "method": { + "shortName": "InstallDeployment", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.InstallDeployment", + "service": { + "shortName": "GSuiteAddOns", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" + } + } + } + }, + { + "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_UninstallDeployment_async", + "title": "GSuiteAddOns uninstallDeployment Sample", + "origin": "API_DEFINITION", + "description": " Uninstalls a developer mode deployment. See: https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons.", + "canonical": true, + "file": "g_suite_add_ons.uninstall_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UninstallDeployment", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.UninstallDeployment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "GSuiteAddOnsClient", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" + }, + "method": { + "shortName": "UninstallDeployment", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.UninstallDeployment", + "service": { + "shortName": "GSuiteAddOns", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" + } + } + } + }, + { + "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_GetInstallStatus_async", + "title": "GSuiteAddOns getInstallStatus Sample", + "origin": "API_DEFINITION", + "description": " Fetches the install status of a developer mode deployment.", + "canonical": true, + "file": "g_suite_add_ons.get_install_status.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetInstallStatus", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.GetInstallStatus", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gsuiteaddons.v1.InstallStatus", + "client": { + "shortName": "GSuiteAddOnsClient", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" + }, + "method": { + "shortName": "GetInstallStatus", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.GetInstallStatus", + "service": { + "shortName": "GSuiteAddOns", + "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/index.ts b/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/index.ts new file mode 100644 index 00000000000..9af1817a2fc --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/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 v1 from './v1'; +const GSuiteAddOnsClient = v1.GSuiteAddOnsClient; +type GSuiteAddOnsClient = v1.GSuiteAddOnsClient; +export {v1, GSuiteAddOnsClient}; +export default {v1, GSuiteAddOnsClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_client.ts b/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_client.ts new file mode 100644 index 00000000000..276cf72461e --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_client.ts @@ -0,0 +1,1266 @@ +// 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/g_suite_add_ons_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './g_suite_add_ons_client_config.json'; +const version = require('../../../package.json').version; + +/** + * A service for managing Google Workspace Add-ons deployments. + * + * A Google Workspace Add-on is a third-party embedded component that can be + * installed in Google Workspace Applications like Gmail, Calendar, Drive, and + * the Google Docs, Sheets, and Slides editors. Google Workspace Add-ons can + * display UI cards, receive contextual information from the host application, + * and perform actions in the host application (See: + * https://developers.google.com/gsuite/add-ons/overview for more information). + * + * A Google Workspace Add-on deployment resource specifies metadata about the + * add-on, including a specification of the entry points in the host application + * that trigger add-on executions (see: + * https://developers.google.com/gsuite/add-ons/concepts/gsuite-manifests). + * Add-on deployments defined via the Google Workspace Add-ons API define their + * entrypoints using HTTPS URLs (See: + * https://developers.google.com/gsuite/add-ons/guides/alternate-runtimes), + * + * A Google Workspace Add-on deployment can be installed in developer mode, + * which allows an add-on developer to test the experience an end-user would see + * when installing and running the add-on in their G Suite applications. When + * running in developer mode, more detailed error messages are exposed in the + * add-on UI to aid in debugging. + * + * A Google Workspace Add-on deployment can be published to Google Workspace + * Marketplace, which allows other Google Workspace users to discover and + * install the add-on. See: + * https://developers.google.com/gsuite/add-ons/how-tos/publish-add-on-overview + * for details. + * @class + * @memberof v1 + */ +export class GSuiteAddOnsClient { + 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}; + gSuiteAddOnsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of GSuiteAddOnsClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 GSuiteAddOnsClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof GSuiteAddOnsClient; + 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 { + 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 = { + authorizationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/authorization' + ), + deploymentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/deployments/{deployment}' + ), + installStatusPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/deployments/{deployment}/installStatus' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // 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 = { + listDeployments: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'deployments') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.gsuiteaddons.v1.GSuiteAddOns', 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.gSuiteAddOnsStub) { + return this.gSuiteAddOnsStub; + } + + // Put together the "service stub" for + // google.cloud.gsuiteaddons.v1.GSuiteAddOns. + this.gSuiteAddOnsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.gsuiteaddons.v1.GSuiteAddOns') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.gsuiteaddons.v1.GSuiteAddOns, + 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 gSuiteAddOnsStubMethods = + ['getAuthorization', 'createDeployment', 'replaceDeployment', 'getDeployment', 'listDeployments', 'deleteDeployment', 'installDeployment', 'uninstallDeployment', 'getInstallStatus']; + for (const methodName of gSuiteAddOnsStubMethods) { + const callPromise = this.gSuiteAddOnsStub.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.gSuiteAddOnsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'gsuiteaddons.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 'gsuiteaddons.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 -- + // ------------------- +/** + * Gets the authorization information for deployments in a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the project for which to get the Google Workspace Add-ons + * authorization information. + * + * Example: `projects/my_project/authorization`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gsuiteaddons.v1.Authorization|Authorization}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/g_suite_add_ons.get_authorization.js + * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_GetAuthorization_async + */ + getAuthorization( + request?: protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gsuiteaddons.v1.IAuthorization, + protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest|undefined, {}|undefined + ]>; + getAuthorization( + request: protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gsuiteaddons.v1.IAuthorization, + protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest|null|undefined, + {}|null|undefined>): void; + getAuthorization( + request: protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest, + callback: Callback< + protos.google.cloud.gsuiteaddons.v1.IAuthorization, + protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest|null|undefined, + {}|null|undefined>): void; + getAuthorization( + request?: protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gsuiteaddons.v1.IAuthorization, + protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gsuiteaddons.v1.IAuthorization, + protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gsuiteaddons.v1.IAuthorization, + protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest|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.getAuthorization(request, options, callback); + } +/** + * Creates a deployment with the specified name and configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the project in which to create the deployment. + * + * Example: `projects/my_project`. + * @param {string} request.deploymentId + * Required. The id to use for this deployment. The full name of the created + * resource will be `projects//deployments/`. + * @param {google.cloud.gsuiteaddons.v1.Deployment} request.deployment + * Required. The deployment to create (deployment.name cannot be set). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gsuiteaddons.v1.Deployment|Deployment}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/g_suite_add_ons.create_deployment.js + * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_CreateDeployment_async + */ + createDeployment( + request?: protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest|undefined, {}|undefined + ]>; + createDeployment( + request: protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest|null|undefined, + {}|null|undefined>): void; + createDeployment( + request: protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest, + callback: Callback< + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest|null|undefined, + {}|null|undefined>): void; + createDeployment( + request?: protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest|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.createDeployment(request, options, callback); + } +/** + * Creates or replaces a deployment with the specified name. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.gsuiteaddons.v1.Deployment} request.deployment + * Required. The deployment to create or replace. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gsuiteaddons.v1.Deployment|Deployment}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/g_suite_add_ons.replace_deployment.js + * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_ReplaceDeployment_async + */ + replaceDeployment( + request?: protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest|undefined, {}|undefined + ]>; + replaceDeployment( + request: protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest|null|undefined, + {}|null|undefined>): void; + replaceDeployment( + request: protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest, + callback: Callback< + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest|null|undefined, + {}|null|undefined>): void; + replaceDeployment( + request?: protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest|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({ + 'deployment.name': request.deployment!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.replaceDeployment(request, options, callback); + } +/** + * Gets the deployment with the specified name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the deployment to get. + * + * Example: `projects/my_project/deployments/my_deployment`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gsuiteaddons.v1.Deployment|Deployment}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/g_suite_add_ons.get_deployment.js + * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_GetDeployment_async + */ + getDeployment( + request?: protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest|undefined, {}|undefined + ]>; + getDeployment( + request: protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest|null|undefined, + {}|null|undefined>): void; + getDeployment( + request: protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest, + callback: Callback< + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest|null|undefined, + {}|null|undefined>): void; + getDeployment( + request?: protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gsuiteaddons.v1.IDeployment, + protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest|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.getDeployment(request, options, callback); + } +/** + * Deletes the deployment with the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the deployment to delete. + * + * Example: `projects/my_project/deployments/my_deployment`. + * @param {string} request.etag + * The etag of the deployment to delete. + * If this is provided, it must match the server's 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 protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/g_suite_add_ons.delete_deployment.js + * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_DeleteDeployment_async + */ + deleteDeployment( + request?: protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest|undefined, {}|undefined + ]>; + deleteDeployment( + request: protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest|null|undefined, + {}|null|undefined>): void; + deleteDeployment( + request: protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest|null|undefined, + {}|null|undefined>): void; + deleteDeployment( + request?: protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest|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.deleteDeployment(request, options, callback); + } +/** + * Installs a deployment in developer mode. + * See: + * https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the deployment to install. + * + * Example: `projects/my_project/deployments/my_deployment`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/g_suite_add_ons.install_deployment.js + * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_InstallDeployment_async + */ + installDeployment( + request?: protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest|undefined, {}|undefined + ]>; + installDeployment( + request: protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest|null|undefined, + {}|null|undefined>): void; + installDeployment( + request: protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest|null|undefined, + {}|null|undefined>): void; + installDeployment( + request?: protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest|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.installDeployment(request, options, callback); + } +/** + * Uninstalls a developer mode deployment. + * See: + * https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the deployment to install. + * + * Example: `projects/my_project/deployments/my_deployment`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/g_suite_add_ons.uninstall_deployment.js + * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_UninstallDeployment_async + */ + uninstallDeployment( + request?: protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest|undefined, {}|undefined + ]>; + uninstallDeployment( + request: protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest|null|undefined, + {}|null|undefined>): void; + uninstallDeployment( + request: protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest|null|undefined, + {}|null|undefined>): void; + uninstallDeployment( + request?: protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest|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.uninstallDeployment(request, options, callback); + } +/** + * Fetches the install status of a developer mode deployment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the deployment. + * + * Example: `projects/my_project/deployments/my_deployment/installStatus`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gsuiteaddons.v1.InstallStatus|InstallStatus}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/g_suite_add_ons.get_install_status.js + * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_GetInstallStatus_async + */ + getInstallStatus( + request?: protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gsuiteaddons.v1.IInstallStatus, + protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest|undefined, {}|undefined + ]>; + getInstallStatus( + request: protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.gsuiteaddons.v1.IInstallStatus, + protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest|null|undefined, + {}|null|undefined>): void; + getInstallStatus( + request: protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest, + callback: Callback< + protos.google.cloud.gsuiteaddons.v1.IInstallStatus, + protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest|null|undefined, + {}|null|undefined>): void; + getInstallStatus( + request?: protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.gsuiteaddons.v1.IInstallStatus, + protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.gsuiteaddons.v1.IInstallStatus, + protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.gsuiteaddons.v1.IInstallStatus, + protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest|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.getInstallStatus(request, options, callback); + } + + /** + * Lists all deployments in a particular project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the project in which to create the deployment. + * + * Example: `projects/my_project`. + * @param {number} request.pageSize + * The maximum number of deployments to return. The service may return fewer + * than this value. + * If unspecified, at most 1000 deployments 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 `ListDeployments` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListDeployments` 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 protos.google.cloud.gsuiteaddons.v1.Deployment|Deployment}. + * 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 `listDeploymentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDeployments( + request?: protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.gsuiteaddons.v1.IDeployment[], + protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest|null, + protos.google.cloud.gsuiteaddons.v1.IListDeploymentsResponse + ]>; + listDeployments( + request: protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, + protos.google.cloud.gsuiteaddons.v1.IListDeploymentsResponse|null|undefined, + protos.google.cloud.gsuiteaddons.v1.IDeployment>): void; + listDeployments( + request: protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, + callback: PaginationCallback< + protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, + protos.google.cloud.gsuiteaddons.v1.IListDeploymentsResponse|null|undefined, + protos.google.cloud.gsuiteaddons.v1.IDeployment>): void; + listDeployments( + request?: protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, + protos.google.cloud.gsuiteaddons.v1.IListDeploymentsResponse|null|undefined, + protos.google.cloud.gsuiteaddons.v1.IDeployment>, + callback?: PaginationCallback< + protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, + protos.google.cloud.gsuiteaddons.v1.IListDeploymentsResponse|null|undefined, + protos.google.cloud.gsuiteaddons.v1.IDeployment>): + Promise<[ + protos.google.cloud.gsuiteaddons.v1.IDeployment[], + protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest|null, + protos.google.cloud.gsuiteaddons.v1.IListDeploymentsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listDeployments(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. Name of the project in which to create the deployment. + * + * Example: `projects/my_project`. + * @param {number} request.pageSize + * The maximum number of deployments to return. The service may return fewer + * than this value. + * If unspecified, at most 1000 deployments 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 `ListDeployments` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListDeployments` 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 protos.google.cloud.gsuiteaddons.v1.Deployment|Deployment} 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 `listDeploymentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDeploymentsStream( + request?: protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, + 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['listDeployments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDeployments.createStream( + this.innerApiCalls.listDeployments as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listDeployments`, 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. Name of the project in which to create the deployment. + * + * Example: `projects/my_project`. + * @param {number} request.pageSize + * The maximum number of deployments to return. The service may return fewer + * than this value. + * If unspecified, at most 1000 deployments 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 `ListDeployments` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListDeployments` 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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.gsuiteaddons.v1.Deployment|Deployment}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/g_suite_add_ons.list_deployments.js + * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_ListDeployments_async + */ + listDeploymentsAsync( + request?: protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, + 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['listDeployments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDeployments.asyncIterate( + this.innerApiCalls['listDeployments'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified authorization resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + authorizationPath(project:string) { + return this.pathTemplates.authorizationPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Authorization resource. + * + * @param {string} authorizationName + * A fully-qualified path representing Authorization resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAuthorizationName(authorizationName: string) { + return this.pathTemplates.authorizationPathTemplate.match(authorizationName).project; + } + + /** + * Return a fully-qualified deployment resource name string. + * + * @param {string} project + * @param {string} deployment + * @returns {string} Resource name string. + */ + deploymentPath(project:string,deployment:string) { + return this.pathTemplates.deploymentPathTemplate.render({ + project: project, + deployment: deployment, + }); + } + + /** + * Parse the project from Deployment resource. + * + * @param {string} deploymentName + * A fully-qualified path representing Deployment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromDeploymentName(deploymentName: string) { + return this.pathTemplates.deploymentPathTemplate.match(deploymentName).project; + } + + /** + * Parse the deployment from Deployment resource. + * + * @param {string} deploymentName + * A fully-qualified path representing Deployment resource. + * @returns {string} A string representing the deployment. + */ + matchDeploymentFromDeploymentName(deploymentName: string) { + return this.pathTemplates.deploymentPathTemplate.match(deploymentName).deployment; + } + + /** + * Return a fully-qualified installStatus resource name string. + * + * @param {string} project + * @param {string} deployment + * @returns {string} Resource name string. + */ + installStatusPath(project:string,deployment:string) { + return this.pathTemplates.installStatusPathTemplate.render({ + project: project, + deployment: deployment, + }); + } + + /** + * Parse the project from InstallStatus resource. + * + * @param {string} installStatusName + * A fully-qualified path representing InstallStatus resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstallStatusName(installStatusName: string) { + return this.pathTemplates.installStatusPathTemplate.match(installStatusName).project; + } + + /** + * Parse the deployment from InstallStatus resource. + * + * @param {string} installStatusName + * A fully-qualified path representing InstallStatus resource. + * @returns {string} A string representing the deployment. + */ + matchDeploymentFromInstallStatusName(installStatusName: string) { + return this.pathTemplates.installStatusPathTemplate.match(installStatusName).deployment; + } + + /** + * 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; + } + + /** + * 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.gSuiteAddOnsStub && !this._terminated) { + return this.gSuiteAddOnsStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_client_config.json b/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_client_config.json new file mode 100644 index 00000000000..94cbce58751 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_client_config.json @@ -0,0 +1,84 @@ +{ + "interfaces": { + "google.cloud.gsuiteaddons.v1.GSuiteAddOns": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unknown_unavailable": [ + "UNKNOWN", + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "GetAuthorization": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateDeployment": { + "timeout_millis": 10000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ReplaceDeployment": { + "timeout_millis": 10000, + "retry_codes_name": "unknown_unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetDeployment": { + "timeout_millis": 10000, + "retry_codes_name": "unknown_unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListDeployments": { + "timeout_millis": 10000, + "retry_codes_name": "unknown_unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteDeployment": { + "timeout_millis": 10000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "InstallDeployment": { + "timeout_millis": 10000, + "retry_codes_name": "unknown_unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UninstallDeployment": { + "timeout_millis": 10000, + "retry_codes_name": "unknown_unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetInstallStatus": { + "timeout_millis": 10000, + "retry_codes_name": "unknown_unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_proto_list.json b/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_proto_list.json new file mode 100644 index 00000000000..754b641cc0b --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/apps/script/type/addon_widget_set.proto", + "../../protos/google/apps/script/type/calendar/calendar_addon_manifest.proto", + "../../protos/google/apps/script/type/docs/docs_addon_manifest.proto", + "../../protos/google/apps/script/type/drive/drive_addon_manifest.proto", + "../../protos/google/apps/script/type/extension_point.proto", + "../../protos/google/apps/script/type/gmail/gmail_addon_manifest.proto", + "../../protos/google/apps/script/type/script_manifest.proto", + "../../protos/google/apps/script/type/sheets/sheets_addon_manifest.proto", + "../../protos/google/apps/script/type/slides/slides_addon_manifest.proto", + "../../protos/google/cloud/gsuiteaddons/v1/gsuiteaddons.proto" +] diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..acc05a47b13 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/gapic_metadata.json @@ -0,0 +1,117 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.gsuiteaddons.v1", + "libraryPackage": "@google-cloud/gsuiteaddons", + "services": { + "GSuiteAddOns": { + "clients": { + "grpc": { + "libraryClient": "GSuiteAddOnsClient", + "rpcs": { + "GetAuthorization": { + "methods": [ + "getAuthorization" + ] + }, + "CreateDeployment": { + "methods": [ + "createDeployment" + ] + }, + "ReplaceDeployment": { + "methods": [ + "replaceDeployment" + ] + }, + "GetDeployment": { + "methods": [ + "getDeployment" + ] + }, + "DeleteDeployment": { + "methods": [ + "deleteDeployment" + ] + }, + "InstallDeployment": { + "methods": [ + "installDeployment" + ] + }, + "UninstallDeployment": { + "methods": [ + "uninstallDeployment" + ] + }, + "GetInstallStatus": { + "methods": [ + "getInstallStatus" + ] + }, + "ListDeployments": { + "methods": [ + "listDeployments", + "listDeploymentsStream", + "listDeploymentsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "GSuiteAddOnsClient", + "rpcs": { + "GetAuthorization": { + "methods": [ + "getAuthorization" + ] + }, + "CreateDeployment": { + "methods": [ + "createDeployment" + ] + }, + "ReplaceDeployment": { + "methods": [ + "replaceDeployment" + ] + }, + "GetDeployment": { + "methods": [ + "getDeployment" + ] + }, + "DeleteDeployment": { + "methods": [ + "deleteDeployment" + ] + }, + "InstallDeployment": { + "methods": [ + "installDeployment" + ] + }, + "UninstallDeployment": { + "methods": [ + "uninstallDeployment" + ] + }, + "GetInstallStatus": { + "methods": [ + "getInstallStatus" + ] + }, + "ListDeployments": { + "methods": [ + "listDeployments", + "listDeploymentsStream", + "listDeploymentsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/index.ts new file mode 100644 index 00000000000..36f1fdcb19a --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/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 {GSuiteAddOnsClient} from './g_suite_add_ons_client'; diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..96d5d6843a3 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/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 gsuiteaddons = require('@google-cloud/gsuiteaddons'); + +function main() { + const gSuiteAddOnsClient = new gsuiteaddons.GSuiteAddOnsClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..681a0d8e56d --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/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 {GSuiteAddOnsClient} from '@google-cloud/gsuiteaddons'; + +// check that the client class type name can be used +function doStuffWithGSuiteAddOnsClient(client: GSuiteAddOnsClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const gSuiteAddOnsClient = new GSuiteAddOnsClient(); + doStuffWithGSuiteAddOnsClient(gSuiteAddOnsClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/install.ts b/owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/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-gsuiteaddons/v1/test/gapic_g_suite_add_ons_v1.ts b/owl-bot-staging/google-cloud-gsuiteaddons/v1/test/gapic_g_suite_add_ons_v1.ts new file mode 100644 index 00000000000..0fce254e3fb --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/v1/test/gapic_g_suite_add_ons_v1.ts @@ -0,0 +1,1449 @@ +// 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 gsuiteaddonsModule 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.GSuiteAddOnsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = gsuiteaddonsModule.v1.GSuiteAddOnsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = gsuiteaddonsModule.v1.GSuiteAddOnsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = gsuiteaddonsModule.v1.GSuiteAddOnsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.gSuiteAddOnsStub, undefined); + await client.initialize(); + assert(client.gSuiteAddOnsStub); + }); + + it('has close method for the initialized client', done => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.gSuiteAddOnsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.gSuiteAddOnsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + 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 gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + 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('getAuthorization', () => { + it('invokes getAuthorization without error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.GetAuthorizationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetAuthorizationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.Authorization() + ); + client.innerApiCalls.getAuthorization = stubSimpleCall(expectedResponse); + const [response] = await client.getAuthorization(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAuthorization as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAuthorization as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAuthorization without error using callback', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.GetAuthorizationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetAuthorizationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.Authorization() + ); + client.innerApiCalls.getAuthorization = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAuthorization( + request, + (err?: Error|null, result?: protos.google.cloud.gsuiteaddons.v1.IAuthorization|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAuthorization as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAuthorization as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAuthorization with error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.GetAuthorizationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetAuthorizationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAuthorization = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAuthorization(request), expectedError); + const actualRequest = (client.innerApiCalls.getAuthorization as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAuthorization as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAuthorization with closed client', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.GetAuthorizationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetAuthorizationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAuthorization(request), expectedError); + }); + }); + + describe('createDeployment', () => { + it('invokes createDeployment without error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.CreateDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.CreateDeploymentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.Deployment() + ); + client.innerApiCalls.createDeployment = stubSimpleCall(expectedResponse); + const [response] = await client.createDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDeployment without error using callback', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.CreateDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.CreateDeploymentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.Deployment() + ); + client.innerApiCalls.createDeployment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDeployment( + request, + (err?: Error|null, result?: protos.google.cloud.gsuiteaddons.v1.IDeployment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDeployment with error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.CreateDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.CreateDeploymentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDeployment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createDeployment(request), expectedError); + const actualRequest = (client.innerApiCalls.createDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDeployment with closed client', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.CreateDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.CreateDeploymentRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createDeployment(request), expectedError); + }); + }); + + describe('replaceDeployment', () => { + it('invokes replaceDeployment without error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest() + ); + request.deployment ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest', ['deployment', 'name']); + request.deployment.name = defaultValue1; + const expectedHeaderRequestParams = `deployment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.Deployment() + ); + client.innerApiCalls.replaceDeployment = stubSimpleCall(expectedResponse); + const [response] = await client.replaceDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.replaceDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.replaceDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes replaceDeployment without error using callback', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest() + ); + request.deployment ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest', ['deployment', 'name']); + request.deployment.name = defaultValue1; + const expectedHeaderRequestParams = `deployment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.Deployment() + ); + client.innerApiCalls.replaceDeployment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.replaceDeployment( + request, + (err?: Error|null, result?: protos.google.cloud.gsuiteaddons.v1.IDeployment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.replaceDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.replaceDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes replaceDeployment with error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest() + ); + request.deployment ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest', ['deployment', 'name']); + request.deployment.name = defaultValue1; + const expectedHeaderRequestParams = `deployment.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.replaceDeployment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.replaceDeployment(request), expectedError); + const actualRequest = (client.innerApiCalls.replaceDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.replaceDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes replaceDeployment with closed client', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest() + ); + request.deployment ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest', ['deployment', 'name']); + request.deployment.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.replaceDeployment(request), expectedError); + }); + }); + + describe('getDeployment', () => { + it('invokes getDeployment without error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.GetDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.Deployment() + ); + client.innerApiCalls.getDeployment = stubSimpleCall(expectedResponse); + const [response] = await client.getDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDeployment without error using callback', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.GetDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.Deployment() + ); + client.innerApiCalls.getDeployment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDeployment( + request, + (err?: Error|null, result?: protos.google.cloud.gsuiteaddons.v1.IDeployment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDeployment with error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.GetDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDeployment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDeployment(request), expectedError); + const actualRequest = (client.innerApiCalls.getDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDeployment with closed client', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.GetDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDeployment(request), expectedError); + }); + }); + + describe('deleteDeployment', () => { + it('invokes deleteDeployment without error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDeployment = stubSimpleCall(expectedResponse); + const [response] = await client.deleteDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDeployment without error using callback', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDeployment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDeployment( + 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.deleteDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDeployment with error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDeployment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteDeployment(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDeployment with closed client', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteDeployment(request), expectedError); + }); + }); + + describe('installDeployment', () => { + it('invokes installDeployment without error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.InstallDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.InstallDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.installDeployment = stubSimpleCall(expectedResponse); + const [response] = await client.installDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.installDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.installDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes installDeployment without error using callback', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.InstallDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.InstallDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.installDeployment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.installDeployment( + 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.installDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.installDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes installDeployment with error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.InstallDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.InstallDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.installDeployment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.installDeployment(request), expectedError); + const actualRequest = (client.innerApiCalls.installDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.installDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes installDeployment with closed client', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.InstallDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.InstallDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.installDeployment(request), expectedError); + }); + }); + + describe('uninstallDeployment', () => { + it('invokes uninstallDeployment without error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.uninstallDeployment = stubSimpleCall(expectedResponse); + const [response] = await client.uninstallDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.uninstallDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.uninstallDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes uninstallDeployment without error using callback', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.uninstallDeployment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.uninstallDeployment( + 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.uninstallDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.uninstallDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes uninstallDeployment with error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.uninstallDeployment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.uninstallDeployment(request), expectedError); + const actualRequest = (client.innerApiCalls.uninstallDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.uninstallDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes uninstallDeployment with closed client', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.uninstallDeployment(request), expectedError); + }); + }); + + describe('getInstallStatus', () => { + it('invokes getInstallStatus without error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.GetInstallStatusRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetInstallStatusRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.InstallStatus() + ); + client.innerApiCalls.getInstallStatus = stubSimpleCall(expectedResponse); + const [response] = await client.getInstallStatus(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getInstallStatus as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInstallStatus as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInstallStatus without error using callback', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.GetInstallStatusRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetInstallStatusRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.InstallStatus() + ); + client.innerApiCalls.getInstallStatus = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInstallStatus( + request, + (err?: Error|null, result?: protos.google.cloud.gsuiteaddons.v1.IInstallStatus|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getInstallStatus as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInstallStatus as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInstallStatus with error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.GetInstallStatusRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetInstallStatusRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getInstallStatus = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getInstallStatus(request), expectedError); + const actualRequest = (client.innerApiCalls.getInstallStatus as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInstallStatus as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInstallStatus with closed client', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.GetInstallStatusRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetInstallStatusRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getInstallStatus(request), expectedError); + }); + }); + + describe('listDeployments', () => { + it('invokes listDeployments without error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), + generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), + generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), + ]; + client.innerApiCalls.listDeployments = stubSimpleCall(expectedResponse); + const [response] = await client.listDeployments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDeployments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDeployments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDeployments without error using callback', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), + generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), + generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), + ]; + client.innerApiCalls.listDeployments = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDeployments( + request, + (err?: Error|null, result?: protos.google.cloud.gsuiteaddons.v1.IDeployment[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDeployments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDeployments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDeployments with error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDeployments = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDeployments(request), expectedError); + const actualRequest = (client.innerApiCalls.listDeployments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDeployments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDeploymentsStream without error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), + generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), + generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), + ]; + client.descriptors.page.listDeployments.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listDeploymentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gsuiteaddons.v1.Deployment[] = []; + stream.on('data', (response: protos.google.cloud.gsuiteaddons.v1.Deployment) => { + 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.listDeployments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDeployments, request)); + assert( + (client.descriptors.page.listDeployments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listDeploymentsStream with error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDeployments.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listDeploymentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.gsuiteaddons.v1.Deployment[] = []; + stream.on('data', (response: protos.google.cloud.gsuiteaddons.v1.Deployment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listDeployments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDeployments, request)); + assert( + (client.descriptors.page.listDeployments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDeployments without error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), + generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), + generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), + ]; + client.descriptors.page.listDeployments.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.gsuiteaddons.v1.IDeployment[] = []; + const iterable = client.listDeploymentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDeployments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDeployments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDeployments with error', async () => { + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDeployments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDeploymentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.gsuiteaddons.v1.IDeployment[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDeployments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDeployments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('authorization', () => { + const fakePath = "/rendered/path/authorization"; + const expectedParameters = { + project: "projectValue", + }; + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.authorizationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.authorizationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('authorizationPath', () => { + const result = client.authorizationPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.authorizationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAuthorizationName', () => { + const result = client.matchProjectFromAuthorizationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.authorizationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('deployment', () => { + const fakePath = "/rendered/path/deployment"; + const expectedParameters = { + project: "projectValue", + deployment: "deploymentValue", + }; + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.deploymentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.deploymentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('deploymentPath', () => { + const result = client.deploymentPath("projectValue", "deploymentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.deploymentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromDeploymentName', () => { + const result = client.matchProjectFromDeploymentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.deploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDeploymentFromDeploymentName', () => { + const result = client.matchDeploymentFromDeploymentName(fakePath); + assert.strictEqual(result, "deploymentValue"); + assert((client.pathTemplates.deploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('installStatus', () => { + const fakePath = "/rendered/path/installStatus"; + const expectedParameters = { + project: "projectValue", + deployment: "deploymentValue", + }; + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.installStatusPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.installStatusPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('installStatusPath', () => { + const result = client.installStatusPath("projectValue", "deploymentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.installStatusPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstallStatusName', () => { + const result = client.matchProjectFromInstallStatusName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.installStatusPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDeploymentFromInstallStatusName', () => { + const result = client.matchDeploymentFromInstallStatusName(fakePath); + assert.strictEqual(result, "deploymentValue"); + assert((client.pathTemplates.installStatusPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ + 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)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/tsconfig.json b/owl-bot-staging/google-cloud-gsuiteaddons/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/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-gsuiteaddons/v1/webpack.config.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/webpack.config.js new file mode 100644 index 00000000000..b973152f807 --- /dev/null +++ b/owl-bot-staging/google-cloud-gsuiteaddons/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: 'GSuiteAddOns', + filename: './g-suite-add-ons.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/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/package.json b/owl-bot-staging/google-cloud-iap/v1/package.json new file mode 100644 index 00000000000..d623366fc39 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/package.json @@ -0,0 +1,59 @@ +{ + "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", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} 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..dd14ced3422 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/protos/google/cloud/iap/v1/service.proto @@ -0,0 +1,736 @@ +// 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 +// +// 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; + + 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 { + // An output credential is required. + 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. A maximum of + // 45 attributes can be selected. Expressions can select different attribute + // types from `attributes`: `attributes.saml_attributes`, + // `attributes.iap_attributes`. The following 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()`: Ignores the `x-goog-iap-attr-` prefix + // for the provided `` when propagating with the `HEADER` output + // credential, such as request headers. + // + // - append `.append()` OR + // `.append()`: Appends the provided `` or + // `` to 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..a2a0397c665 --- /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 = ['abc','def'] + + // 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..ab25f4ea6ea --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client.ts @@ -0,0 +1,1338 @@ +// 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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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: true}, 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 { + 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 protos.google.iam.v1.Policy|Policy}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.google.iam.v1.Policy|Policy}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.google.iam.v1.TestIamPermissionsResponse|TestIamPermissionsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.google.cloud.iap.v1.IapSettings|IapSettings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.google.cloud.iap.v1.IapSettings|IapSettings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.google.cloud.iap.v1.TunnelDestGroup|TunnelDestGroup}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.google.cloud.iap.v1.TunnelDestGroup|TunnelDestGroup}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.google.cloud.iap.v1.TunnelDestGroup|TunnelDestGroup}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * 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 protos.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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * 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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * 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..c4f456a6460 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client.ts @@ -0,0 +1,1160 @@ +// 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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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: true}, 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 { + 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 protos.google.cloud.iap.v1.ListBrandsResponse|ListBrandsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.google.cloud.iap.v1.Brand|Brand}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.google.cloud.iap.v1.Brand|Brand}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.google.cloud.iap.v1.IdentityAwareProxyClient|IdentityAwareProxyClient}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.google.cloud.iap.v1.IdentityAwareProxyClient|IdentityAwareProxyClient}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.google.cloud.iap.v1.IdentityAwareProxyClient|IdentityAwareProxyClient}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * 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 protos.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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * 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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * 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/package.json b/owl-bot-staging/google-cloud-iap/v1beta1/package.json new file mode 100644 index 00000000000..08796e790aa --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/package.json @@ -0,0 +1,58 @@ +{ + "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", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} 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..2254f97144e --- /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 = ['abc','def'] + + // 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..22063c6f014 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts @@ -0,0 +1,549 @@ +// 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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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: true}, 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 { + 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 protos.google.iam.v1.Policy|Policy}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.google.iam.v1.Policy|Policy}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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 protos.google.iam.v1.TestIamPermissionsResponse|TestIamPermissionsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * 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', +}; diff --git a/owl-bot-staging/google-cloud-ids/v1/.eslintignore b/owl-bot-staging/google-cloud-ids/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-ids/v1/.eslintrc.json b/owl-bot-staging/google-cloud-ids/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-ids/v1/.gitignore b/owl-bot-staging/google-cloud-ids/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/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-ids/v1/.jsdoc.js b/owl-bot-staging/google-cloud-ids/v1/.jsdoc.js new file mode 100644 index 00000000000..baabf743820 --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/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/ids', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-ids/v1/.mocharc.js b/owl-bot-staging/google-cloud-ids/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/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-ids/v1/.prettierrc.js b/owl-bot-staging/google-cloud-ids/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/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-ids/v1/README.md b/owl-bot-staging/google-cloud-ids/v1/README.md new file mode 100644 index 00000000000..d6b39ef50b6 --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/README.md @@ -0,0 +1 @@ +Ids: Nodejs Client diff --git a/owl-bot-staging/google-cloud-ids/v1/package.json b/owl-bot-staging/google-cloud-ids/v1/package.json new file mode 100644 index 00000000000..8dedb766e3a --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/ids", + "version": "0.1.0", + "description": "Ids client for Node.js", + "repository": "googleapis/nodejs-ids", + "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 ids", + "ids", + "i d s" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-ids/v1/protos/google/cloud/ids/v1/ids.proto b/owl-bot-staging/google-cloud-ids/v1/protos/google/cloud/ids/v1/ids.proto new file mode 100644 index 00000000000..bad61be32e0 --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/protos/google/cloud/ids/v1/ids.proto @@ -0,0 +1,296 @@ +// 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.ids.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/ids/apiv1/idspb;idspb"; +option java_multiple_files = true; +option java_outer_classname = "IdsProto"; +option java_package = "com.google.cloud.ids.v1"; +option ruby_package = "Google::Cloud::IDS::V1"; + +// The IDS Service +service IDS { + option (google.api.default_host) = "ids.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists Endpoints in a given project and location. + rpc ListEndpoints(ListEndpointsRequest) returns (ListEndpointsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/endpoints" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single Endpoint. + rpc GetEndpoint(GetEndpointRequest) returns (Endpoint) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/endpoints/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new Endpoint in a given project and location. + rpc CreateEndpoint(CreateEndpointRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/endpoints" + body: "endpoint" + }; + option (google.api.method_signature) = "parent,endpoint,endpoint_id"; + option (google.longrunning.operation_info) = { + response_type: "Endpoint" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a single Endpoint. + rpc DeleteEndpoint(DeleteEndpointRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/endpoints/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } +} + +// Endpoint describes a single IDS endpoint. It defines a forwarding rule to +// which packets can be sent for IDS inspection. +message Endpoint { + option (google.api.resource) = { + type: "ids.googleapis.com/Endpoint" + pattern: "projects/{project}/locations/{location}/endpoints/{endpoint}" + }; + + // Threat severity levels. + enum Severity { + // Not set. + SEVERITY_UNSPECIFIED = 0; + + // Informational alerts. + INFORMATIONAL = 1; + + // Low severity alerts. + LOW = 2; + + // Medium severity alerts. + MEDIUM = 3; + + // High severity alerts. + HIGH = 4; + + // Critical severity alerts. + CRITICAL = 5; + } + + // Endpoint state + enum State { + // Not set. + STATE_UNSPECIFIED = 0; + + // Being created. + CREATING = 1; + + // Active and ready for traffic. + READY = 2; + + // Being deleted. + DELETING = 3; + } + + // Output only. The name of the endpoint. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The create time timestamp. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The update time timestamp. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The labels of the endpoint. + map labels = 4; + + // Required. The fully qualified URL of the network to which the IDS Endpoint is + // attached. + string network = 5 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The fully qualified URL of the endpoint's ILB Forwarding Rule. + string endpoint_forwarding_rule = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The IP address of the IDS Endpoint's ILB. + string endpoint_ip = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-provided description of the endpoint + string description = 8; + + // Required. Lowest threat severity that this endpoint will alert on. + Severity severity = 9 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Current state of the endpoint. + State state = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Whether the endpoint should report traffic logs in addition to threat logs. + bool traffic_logs = 13; +} + +message ListEndpointsRequest { + // Required. The parent, which owns this collection of endpoints. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "ids.googleapis.com/Endpoint" + } + ]; + + // Optional. The maximum number of endpoints to return. The service may return fewer + // than this value. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous `ListEndpoints` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListEndpoints` must + // match the call that provided the page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter expression, following the syntax outlined in + // https://google.aip.dev/160. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. One or more fields to compare and use to sort the output. + // See https://google.aip.dev/132#ordering. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +message ListEndpointsResponse { + // The list of endpoints response. + repeated Endpoint endpoints = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +message GetEndpointRequest { + // Required. The name of the endpoint to retrieve. + // Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "ids.googleapis.com/Endpoint" + } + ]; +} + +message CreateEndpointRequest { + // Required. The endpoint's parent. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "ids.googleapis.com/Endpoint" + } + ]; + + // Required. The endpoint identifier. This will be part of the endpoint's + // resource name. + // This value must start with a lowercase letter followed by up to 62 + // lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + // Values that do not match this pattern will trigger an INVALID_ARGUMENT + // error. + string endpoint_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The endpoint to create. + Endpoint endpoint = 3 [(google.api.field_behavior) = REQUIRED]; + + // An optional request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4; +} + +message DeleteEndpointRequest { + // Required. The name of the endpoint to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "ids.googleapis.com/Endpoint" + } + ]; + + // An optional request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.create_endpoint.js b/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.create_endpoint.js new file mode 100644 index 00000000000..c4dd1ed5bcf --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.create_endpoint.js @@ -0,0 +1,91 @@ +// 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, endpointId, endpoint) { + // [START ids_v1_generated_IDS_CreateEndpoint_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 endpoint's parent. + */ + // const parent = 'abc123' + /** + * Required. The endpoint identifier. This will be part of the endpoint's + * resource name. + * This value must start with a lowercase letter followed by up to 62 + * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + * Values that do not match this pattern will trigger an INVALID_ARGUMENT + * error. + */ + // const endpointId = 'abc123' + /** + * Required. The endpoint to create. + */ + // const endpoint = {} + /** + * An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Ids library + const {IDSClient} = require('@google-cloud/ids').v1; + + // Instantiates a client + const idsClient = new IDSClient(); + + async function callCreateEndpoint() { + // Construct request + const request = { + parent, + endpointId, + endpoint, + }; + + // Run request + const [operation] = await idsClient.createEndpoint(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateEndpoint(); + // [END ids_v1_generated_IDS_CreateEndpoint_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-ids/v1/samples/generated/v1/i_d_s.delete_endpoint.js b/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.delete_endpoint.js new file mode 100644 index 00000000000..39e6c5fd000 --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.delete_endpoint.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(name) { + // [START ids_v1_generated_IDS_DeleteEndpoint_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the endpoint to delete. + */ + // const name = 'abc123' + /** + * An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Ids library + const {IDSClient} = require('@google-cloud/ids').v1; + + // Instantiates a client + const idsClient = new IDSClient(); + + async function callDeleteEndpoint() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await idsClient.deleteEndpoint(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteEndpoint(); + // [END ids_v1_generated_IDS_DeleteEndpoint_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-ids/v1/samples/generated/v1/i_d_s.get_endpoint.js b/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.get_endpoint.js new file mode 100644 index 00000000000..172d33a99a6 --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.get_endpoint.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 ids_v1_generated_IDS_GetEndpoint_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the endpoint to retrieve. + * Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` + */ + // const name = 'abc123' + + // Imports the Ids library + const {IDSClient} = require('@google-cloud/ids').v1; + + // Instantiates a client + const idsClient = new IDSClient(); + + async function callGetEndpoint() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await idsClient.getEndpoint(request); + console.log(response); + } + + callGetEndpoint(); + // [END ids_v1_generated_IDS_GetEndpoint_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-ids/v1/samples/generated/v1/i_d_s.list_endpoints.js b/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.list_endpoints.js new file mode 100644 index 00000000000..b4f663ba94d --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.list_endpoints.js @@ -0,0 +1,85 @@ +// 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 ids_v1_generated_IDS_ListEndpoints_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 parent, which owns this collection of endpoints. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of endpoints to return. The service may return fewer + * than this value. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous `ListEndpoints` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListEndpoints` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + */ + // const filter = 'abc123' + /** + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Ids library + const {IDSClient} = require('@google-cloud/ids').v1; + + // Instantiates a client + const idsClient = new IDSClient(); + + async function callListEndpoints() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await idsClient.listEndpointsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListEndpoints(); + // [END ids_v1_generated_IDS_ListEndpoints_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-ids/v1/samples/generated/v1/snippet_metadata_google.cloud.ids.v1.json b/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/snippet_metadata_google.cloud.ids.v1.json new file mode 100644 index 00000000000..d9ec4a34a9a --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/snippet_metadata_google.cloud.ids.v1.json @@ -0,0 +1,207 @@ +{ + "clientLibrary": { + "name": "nodejs-ids", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.ids.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "ids_v1_generated_IDS_ListEndpoints_async", + "title": "IDS listEndpoints Sample", + "origin": "API_DEFINITION", + "description": " Lists Endpoints in a given project and location.", + "canonical": true, + "file": "i_d_s.list_endpoints.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListEndpoints", + "fullName": "google.cloud.ids.v1.IDS.ListEndpoints", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.ids.v1.ListEndpointsResponse", + "client": { + "shortName": "IDSClient", + "fullName": "google.cloud.ids.v1.IDSClient" + }, + "method": { + "shortName": "ListEndpoints", + "fullName": "google.cloud.ids.v1.IDS.ListEndpoints", + "service": { + "shortName": "IDS", + "fullName": "google.cloud.ids.v1.IDS" + } + } + } + }, + { + "regionTag": "ids_v1_generated_IDS_GetEndpoint_async", + "title": "IDS getEndpoint Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single Endpoint.", + "canonical": true, + "file": "i_d_s.get_endpoint.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEndpoint", + "fullName": "google.cloud.ids.v1.IDS.GetEndpoint", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.ids.v1.Endpoint", + "client": { + "shortName": "IDSClient", + "fullName": "google.cloud.ids.v1.IDSClient" + }, + "method": { + "shortName": "GetEndpoint", + "fullName": "google.cloud.ids.v1.IDS.GetEndpoint", + "service": { + "shortName": "IDS", + "fullName": "google.cloud.ids.v1.IDS" + } + } + } + }, + { + "regionTag": "ids_v1_generated_IDS_CreateEndpoint_async", + "title": "IDS createEndpoint Sample", + "origin": "API_DEFINITION", + "description": " Creates a new Endpoint in a given project and location.", + "canonical": true, + "file": "i_d_s.create_endpoint.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateEndpoint", + "fullName": "google.cloud.ids.v1.IDS.CreateEndpoint", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "endpoint_id", + "type": "TYPE_STRING" + }, + { + "name": "endpoint", + "type": ".google.cloud.ids.v1.Endpoint" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "IDSClient", + "fullName": "google.cloud.ids.v1.IDSClient" + }, + "method": { + "shortName": "CreateEndpoint", + "fullName": "google.cloud.ids.v1.IDS.CreateEndpoint", + "service": { + "shortName": "IDS", + "fullName": "google.cloud.ids.v1.IDS" + } + } + } + }, + { + "regionTag": "ids_v1_generated_IDS_DeleteEndpoint_async", + "title": "IDS deleteEndpoint Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single Endpoint.", + "canonical": true, + "file": "i_d_s.delete_endpoint.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteEndpoint", + "fullName": "google.cloud.ids.v1.IDS.DeleteEndpoint", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "IDSClient", + "fullName": "google.cloud.ids.v1.IDSClient" + }, + "method": { + "shortName": "DeleteEndpoint", + "fullName": "google.cloud.ids.v1.IDS.DeleteEndpoint", + "service": { + "shortName": "IDS", + "fullName": "google.cloud.ids.v1.IDS" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-ids/v1/src/index.ts b/owl-bot-staging/google-cloud-ids/v1/src/index.ts new file mode 100644 index 00000000000..f7d9e1396da --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/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 v1 from './v1'; +const IDSClient = v1.IDSClient; +type IDSClient = v1.IDSClient; +export {v1, IDSClient}; +export default {v1, IDSClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-ids/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-ids/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..e41ca3d5ed9 --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/src/v1/gapic_metadata.json @@ -0,0 +1,67 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.ids.v1", + "libraryPackage": "@google-cloud/ids", + "services": { + "IDS": { + "clients": { + "grpc": { + "libraryClient": "IDSClient", + "rpcs": { + "GetEndpoint": { + "methods": [ + "getEndpoint" + ] + }, + "CreateEndpoint": { + "methods": [ + "createEndpoint" + ] + }, + "DeleteEndpoint": { + "methods": [ + "deleteEndpoint" + ] + }, + "ListEndpoints": { + "methods": [ + "listEndpoints", + "listEndpointsStream", + "listEndpointsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "IDSClient", + "rpcs": { + "GetEndpoint": { + "methods": [ + "getEndpoint" + ] + }, + "CreateEndpoint": { + "methods": [ + "createEndpoint" + ] + }, + "DeleteEndpoint": { + "methods": [ + "deleteEndpoint" + ] + }, + "ListEndpoints": { + "methods": [ + "listEndpoints", + "listEndpointsStream", + "listEndpointsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_client.ts b/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_client.ts new file mode 100644 index 00000000000..7ffa25c39fc --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_client.ts @@ -0,0 +1,967 @@ +// 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, GrpcClientOptions, LROperation, 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/i_d_s_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './i_d_s_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The IDS Service + * @class + * @memberof v1 + */ +export class IDSClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + iDSStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of IDSClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 IDSClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof IDSClient; + 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 { + 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 = { + endpointPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/endpoints/{endpoint}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // 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 = { + listEndpoints: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'endpoints') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/endpoints/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/endpoints/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/endpoints/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createEndpointResponse = protoFilesRoot.lookup( + '.google.cloud.ids.v1.Endpoint') as gax.protobuf.Type; + const createEndpointMetadata = protoFilesRoot.lookup( + '.google.cloud.ids.v1.OperationMetadata') as gax.protobuf.Type; + const deleteEndpointResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteEndpointMetadata = protoFilesRoot.lookup( + '.google.cloud.ids.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createEndpoint: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createEndpointResponse.decode.bind(createEndpointResponse), + createEndpointMetadata.decode.bind(createEndpointMetadata)), + deleteEndpoint: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteEndpointResponse.decode.bind(deleteEndpointResponse), + deleteEndpointMetadata.decode.bind(deleteEndpointMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.ids.v1.IDS', 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.iDSStub) { + return this.iDSStub; + } + + // Put together the "service stub" for + // google.cloud.ids.v1.IDS. + this.iDSStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.ids.v1.IDS') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.ids.v1.IDS, + 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 iDSStubMethods = + ['listEndpoints', 'getEndpoint', 'createEndpoint', 'deleteEndpoint']; + for (const methodName of iDSStubMethods) { + const callPromise = this.iDSStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.iDSStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'ids.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 'ids.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 -- + // ------------------- +/** + * Gets details of a single Endpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the endpoint to retrieve. + * Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.ids.v1.Endpoint|Endpoint}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/i_d_s.get_endpoint.js + * region_tag:ids_v1_generated_IDS_GetEndpoint_async + */ + getEndpoint( + request?: protos.google.cloud.ids.v1.IGetEndpointRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.ids.v1.IEndpoint, + protos.google.cloud.ids.v1.IGetEndpointRequest|undefined, {}|undefined + ]>; + getEndpoint( + request: protos.google.cloud.ids.v1.IGetEndpointRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.ids.v1.IEndpoint, + protos.google.cloud.ids.v1.IGetEndpointRequest|null|undefined, + {}|null|undefined>): void; + getEndpoint( + request: protos.google.cloud.ids.v1.IGetEndpointRequest, + callback: Callback< + protos.google.cloud.ids.v1.IEndpoint, + protos.google.cloud.ids.v1.IGetEndpointRequest|null|undefined, + {}|null|undefined>): void; + getEndpoint( + request?: protos.google.cloud.ids.v1.IGetEndpointRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.ids.v1.IEndpoint, + protos.google.cloud.ids.v1.IGetEndpointRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.ids.v1.IEndpoint, + protos.google.cloud.ids.v1.IGetEndpointRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.ids.v1.IEndpoint, + protos.google.cloud.ids.v1.IGetEndpointRequest|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.getEndpoint(request, options, callback); + } + +/** + * Creates a new Endpoint in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The endpoint's parent. + * @param {string} request.endpointId + * Required. The endpoint identifier. This will be part of the endpoint's + * resource name. + * This value must start with a lowercase letter followed by up to 62 + * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + * Values that do not match this pattern will trigger an INVALID_ARGUMENT + * error. + * @param {google.cloud.ids.v1.Endpoint} request.endpoint + * Required. The endpoint to create. + * @param {string} request.requestId + * An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/i_d_s.create_endpoint.js + * region_tag:ids_v1_generated_IDS_CreateEndpoint_async + */ + createEndpoint( + request?: protos.google.cloud.ids.v1.ICreateEndpointRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createEndpoint( + request: protos.google.cloud.ids.v1.ICreateEndpointRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createEndpoint( + request: protos.google.cloud.ids.v1.ICreateEndpointRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createEndpoint( + request?: protos.google.cloud.ids.v1.ICreateEndpointRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createEndpoint(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createEndpoint()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/i_d_s.create_endpoint.js + * region_tag:ids_v1_generated_IDS_CreateEndpoint_async + */ + async checkCreateEndpointProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createEndpoint, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single Endpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the endpoint to delete. + * @param {string} request.requestId + * An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/i_d_s.delete_endpoint.js + * region_tag:ids_v1_generated_IDS_DeleteEndpoint_async + */ + deleteEndpoint( + request?: protos.google.cloud.ids.v1.IDeleteEndpointRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteEndpoint( + request: protos.google.cloud.ids.v1.IDeleteEndpointRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteEndpoint( + request: protos.google.cloud.ids.v1.IDeleteEndpointRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteEndpoint( + request?: protos.google.cloud.ids.v1.IDeleteEndpointRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteEndpoint(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteEndpoint()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/i_d_s.delete_endpoint.js + * region_tag:ids_v1_generated_IDS_DeleteEndpoint_async + */ + async checkDeleteEndpointProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteEndpoint, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists Endpoints in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of endpoints. + * @param {number} [request.pageSize] + * Optional. The maximum number of endpoints to return. The service may return fewer + * than this value. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListEndpoints` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListEndpoints` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * @param {string} [request.orderBy] + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.ids.v1.Endpoint|Endpoint}. + * 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 `listEndpointsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listEndpoints( + request?: protos.google.cloud.ids.v1.IListEndpointsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.ids.v1.IEndpoint[], + protos.google.cloud.ids.v1.IListEndpointsRequest|null, + protos.google.cloud.ids.v1.IListEndpointsResponse + ]>; + listEndpoints( + request: protos.google.cloud.ids.v1.IListEndpointsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.ids.v1.IListEndpointsRequest, + protos.google.cloud.ids.v1.IListEndpointsResponse|null|undefined, + protos.google.cloud.ids.v1.IEndpoint>): void; + listEndpoints( + request: protos.google.cloud.ids.v1.IListEndpointsRequest, + callback: PaginationCallback< + protos.google.cloud.ids.v1.IListEndpointsRequest, + protos.google.cloud.ids.v1.IListEndpointsResponse|null|undefined, + protos.google.cloud.ids.v1.IEndpoint>): void; + listEndpoints( + request?: protos.google.cloud.ids.v1.IListEndpointsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.ids.v1.IListEndpointsRequest, + protos.google.cloud.ids.v1.IListEndpointsResponse|null|undefined, + protos.google.cloud.ids.v1.IEndpoint>, + callback?: PaginationCallback< + protos.google.cloud.ids.v1.IListEndpointsRequest, + protos.google.cloud.ids.v1.IListEndpointsResponse|null|undefined, + protos.google.cloud.ids.v1.IEndpoint>): + Promise<[ + protos.google.cloud.ids.v1.IEndpoint[], + protos.google.cloud.ids.v1.IListEndpointsRequest|null, + protos.google.cloud.ids.v1.IListEndpointsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listEndpoints(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of endpoints. + * @param {number} [request.pageSize] + * Optional. The maximum number of endpoints to return. The service may return fewer + * than this value. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListEndpoints` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListEndpoints` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * @param {string} [request.orderBy] + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 protos.google.cloud.ids.v1.Endpoint|Endpoint} 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 `listEndpointsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listEndpointsStream( + request?: protos.google.cloud.ids.v1.IListEndpointsRequest, + 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['listEndpoints']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEndpoints.createStream( + this.innerApiCalls.listEndpoints as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listEndpoints`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of endpoints. + * @param {number} [request.pageSize] + * Optional. The maximum number of endpoints to return. The service may return fewer + * than this value. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListEndpoints` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListEndpoints` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * @param {string} [request.orderBy] + * Optional. One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.ids.v1.Endpoint|Endpoint}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/i_d_s.list_endpoints.js + * region_tag:ids_v1_generated_IDS_ListEndpoints_async + */ + listEndpointsAsync( + request?: protos.google.cloud.ids.v1.IListEndpointsRequest, + 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['listEndpoints']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEndpoints.asyncIterate( + this.innerApiCalls['listEndpoints'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified endpoint resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} endpoint + * @returns {string} Resource name string. + */ + endpointPath(project:string,location:string,endpoint:string) { + return this.pathTemplates.endpointPathTemplate.render({ + project: project, + location: location, + endpoint: endpoint, + }); + } + + /** + * Parse the project from Endpoint resource. + * + * @param {string} endpointName + * A fully-qualified path representing Endpoint resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEndpointName(endpointName: string) { + return this.pathTemplates.endpointPathTemplate.match(endpointName).project; + } + + /** + * Parse the location from Endpoint resource. + * + * @param {string} endpointName + * A fully-qualified path representing Endpoint resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEndpointName(endpointName: string) { + return this.pathTemplates.endpointPathTemplate.match(endpointName).location; + } + + /** + * Parse the endpoint from Endpoint resource. + * + * @param {string} endpointName + * A fully-qualified path representing Endpoint resource. + * @returns {string} A string representing the endpoint. + */ + matchEndpointFromEndpointName(endpointName: string) { + return this.pathTemplates.endpointPathTemplate.match(endpointName).endpoint; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified 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; + } + + /** + * 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.iDSStub && !this._terminated) { + return this.iDSStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_client_config.json b/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_client_config.json new file mode 100644 index 00000000000..2e35dcd818b --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_client_config.json @@ -0,0 +1,58 @@ +{ + "interfaces": { + "google.cloud.ids.v1.IDS": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "9442ca297df43f7314712e1a19d003838e738a45": { + "initial_retry_delay_millis": 250, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 32000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListEndpoints": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" + }, + "GetEndpoint": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" + }, + "CreateEndpoint": { + "timeout_millis": 3600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteEndpoint": { + "timeout_millis": 3600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_proto_list.json b/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_proto_list.json new file mode 100644 index 00000000000..fcaebb7564e --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/ids/v1/ids.proto" +] diff --git a/owl-bot-staging/google-cloud-ids/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-ids/v1/src/v1/index.ts new file mode 100644 index 00000000000..4b4cfd637a6 --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/src/v1/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 {IDSClient} from './i_d_s_client'; diff --git a/owl-bot-staging/google-cloud-ids/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-ids/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..3df6eab4b7b --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/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 ids = require('@google-cloud/ids'); + +function main() { + const iDSClient = new ids.IDSClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-ids/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-ids/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..0b4b581b456 --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/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 {IDSClient} from '@google-cloud/ids'; + +// check that the client class type name can be used +function doStuffWithIDSClient(client: IDSClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const iDSClient = new IDSClient(); + doStuffWithIDSClient(iDSClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-ids/v1/system-test/install.ts b/owl-bot-staging/google-cloud-ids/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/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-ids/v1/test/gapic_i_d_s_v1.ts b/owl-bot-staging/google-cloud-ids/v1/test/gapic_i_d_s_v1.ts new file mode 100644 index 00000000000..32da81ddd45 --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/v1/test/gapic_i_d_s_v1.ts @@ -0,0 +1,991 @@ +// 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 idsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.IDSClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = idsModule.v1.IDSClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = idsModule.v1.IDSClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = idsModule.v1.IDSClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new idsModule.v1.IDSClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new idsModule.v1.IDSClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.iDSStub, undefined); + await client.initialize(); + assert(client.iDSStub); + }); + + it('has close method for the initialized client', done => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.iDSStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.iDSStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new idsModule.v1.IDSClient({ + 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 idsModule.v1.IDSClient({ + 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('getEndpoint', () => { + it('invokes getEndpoint without error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.GetEndpointRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.GetEndpointRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.ids.v1.Endpoint() + ); + client.innerApiCalls.getEndpoint = stubSimpleCall(expectedResponse); + const [response] = await client.getEndpoint(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getEndpoint as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEndpoint as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEndpoint without error using callback', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.GetEndpointRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.GetEndpointRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.ids.v1.Endpoint() + ); + client.innerApiCalls.getEndpoint = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEndpoint( + request, + (err?: Error|null, result?: protos.google.cloud.ids.v1.IEndpoint|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getEndpoint as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEndpoint as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEndpoint with error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.GetEndpointRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.GetEndpointRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEndpoint = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEndpoint(request), expectedError); + const actualRequest = (client.innerApiCalls.getEndpoint as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEndpoint as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEndpoint with closed client', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.GetEndpointRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.GetEndpointRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getEndpoint(request), expectedError); + }); + }); + + describe('createEndpoint', () => { + it('invokes createEndpoint without error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.CreateEndpointRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.CreateEndpointRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createEndpoint = stubLongRunningCall(expectedResponse); + const [operation] = await client.createEndpoint(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createEndpoint as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEndpoint as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEndpoint without error using callback', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.CreateEndpointRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.CreateEndpointRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createEndpoint = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createEndpoint( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createEndpoint as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEndpoint as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEndpoint with call error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.CreateEndpointRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.CreateEndpointRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEndpoint = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createEndpoint(request), expectedError); + const actualRequest = (client.innerApiCalls.createEndpoint as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEndpoint as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEndpoint with LRO error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.CreateEndpointRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.CreateEndpointRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEndpoint = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createEndpoint(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createEndpoint as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEndpoint as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateEndpointProgress without error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateEndpointProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateEndpointProgress with error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateEndpointProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteEndpoint', () => { + it('invokes deleteEndpoint without error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.DeleteEndpointRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.DeleteEndpointRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteEndpoint = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteEndpoint(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteEndpoint as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteEndpoint as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEndpoint without error using callback', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.DeleteEndpointRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.DeleteEndpointRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteEndpoint = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteEndpoint( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteEndpoint as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteEndpoint as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEndpoint with call error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.DeleteEndpointRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.DeleteEndpointRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEndpoint = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteEndpoint(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteEndpoint as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteEndpoint as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEndpoint with LRO error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.DeleteEndpointRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.DeleteEndpointRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEndpoint = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteEndpoint(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteEndpoint as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteEndpoint as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteEndpointProgress without error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteEndpointProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteEndpointProgress with error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteEndpointProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listEndpoints', () => { + it('invokes listEndpoints without error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.ListEndpointsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.ListEndpointsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), + generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), + generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), + ]; + client.innerApiCalls.listEndpoints = stubSimpleCall(expectedResponse); + const [response] = await client.listEndpoints(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listEndpoints as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEndpoints as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEndpoints without error using callback', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.ListEndpointsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.ListEndpointsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), + generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), + generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), + ]; + client.innerApiCalls.listEndpoints = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEndpoints( + request, + (err?: Error|null, result?: protos.google.cloud.ids.v1.IEndpoint[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listEndpoints as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEndpoints as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEndpoints with error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.ListEndpointsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.ListEndpointsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEndpoints = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listEndpoints(request), expectedError); + const actualRequest = (client.innerApiCalls.listEndpoints as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEndpoints as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEndpointsStream without error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.ListEndpointsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.ListEndpointsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), + generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), + generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), + ]; + client.descriptors.page.listEndpoints.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listEndpointsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.ids.v1.Endpoint[] = []; + stream.on('data', (response: protos.google.cloud.ids.v1.Endpoint) => { + 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.listEndpoints.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listEndpoints, request)); + assert( + (client.descriptors.page.listEndpoints.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listEndpointsStream with error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.ListEndpointsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.ListEndpointsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEndpoints.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listEndpointsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.ids.v1.Endpoint[] = []; + stream.on('data', (response: protos.google.cloud.ids.v1.Endpoint) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listEndpoints.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listEndpoints, request)); + assert( + (client.descriptors.page.listEndpoints.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listEndpoints without error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.ListEndpointsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.ListEndpointsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), + generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), + generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), + ]; + client.descriptors.page.listEndpoints.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.ids.v1.IEndpoint[] = []; + const iterable = client.listEndpointsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listEndpoints.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listEndpoints.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listEndpoints with error', async () => { + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.ids.v1.ListEndpointsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.ids.v1.ListEndpointsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEndpoints.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listEndpointsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.ids.v1.IEndpoint[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listEndpoints.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listEndpoints.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('endpoint', () => { + const fakePath = "/rendered/path/endpoint"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + endpoint: "endpointValue", + }; + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.endpointPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.endpointPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('endpointPath', () => { + const result = client.endpointPath("projectValue", "locationValue", "endpointValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.endpointPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromEndpointName', () => { + const result = client.matchProjectFromEndpointName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.endpointPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromEndpointName', () => { + const result = client.matchLocationFromEndpointName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.endpointPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEndpointFromEndpointName', () => { + const result = client.matchEndpointFromEndpointName(fakePath); + assert.strictEqual(result, "endpointValue"); + assert((client.pathTemplates.endpointPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new idsModule.v1.IDSClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new idsModule.v1.IDSClient({ + 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)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-ids/v1/tsconfig.json b/owl-bot-staging/google-cloud-ids/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/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-ids/v1/webpack.config.js b/owl-bot-staging/google-cloud-ids/v1/webpack.config.js new file mode 100644 index 00000000000..6a2bec3e34a --- /dev/null +++ b/owl-bot-staging/google-cloud-ids/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: 'IDS', + filename: './i-d-s.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-iot/v1/.eslintignore b/owl-bot-staging/google-cloud-iot/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-iot/v1/.eslintrc.json b/owl-bot-staging/google-cloud-iot/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-iot/v1/.gitignore b/owl-bot-staging/google-cloud-iot/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/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-iot/v1/.jsdoc.js b/owl-bot-staging/google-cloud-iot/v1/.jsdoc.js new file mode 100644 index 00000000000..bb9dd1668bd --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/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/iot', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-iot/v1/.mocharc.js b/owl-bot-staging/google-cloud-iot/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/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-iot/v1/.prettierrc.js b/owl-bot-staging/google-cloud-iot/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/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-iot/v1/README.md b/owl-bot-staging/google-cloud-iot/v1/README.md new file mode 100644 index 00000000000..e9217498f1c --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/README.md @@ -0,0 +1 @@ +Iot: Nodejs Client diff --git a/owl-bot-staging/google-cloud-iot/v1/package.json b/owl-bot-staging/google-cloud-iot/v1/package.json new file mode 100644 index 00000000000..cef6c6e1056 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/iot", + "version": "0.1.0", + "description": "Iot client for Node.js", + "repository": "googleapis/nodejs-iot", + "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 iot", + "iot", + "device manager" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-iot/v1/protos/google/cloud/iot/v1/device_manager.proto b/owl-bot-staging/google-cloud-iot/v1/protos/google/cloud/iot/v1/device_manager.proto new file mode 100644 index 00000000000..121bcdeefca --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/protos/google/cloud/iot/v1/device_manager.proto @@ -0,0 +1,651 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.iot.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/iot/v1/resources.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option go_package = "cloud.google.com/go/iot/apiv1/iotpb;iotpb"; +option java_multiple_files = true; +option java_outer_classname = "DeviceManagerProto"; +option java_package = "com.google.cloud.iot.v1"; + +// Internet of Things (IoT) service. Securely connect and manage IoT devices. +service DeviceManager { + option (google.api.default_host) = "cloudiot.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloudiot"; + + // Creates a device registry that contains devices. + rpc CreateDeviceRegistry(CreateDeviceRegistryRequest) returns (DeviceRegistry) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/registries" + body: "device_registry" + }; + option (google.api.method_signature) = "parent,device_registry"; + } + + // Gets a device registry configuration. + rpc GetDeviceRegistry(GetDeviceRegistryRequest) returns (DeviceRegistry) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/registries/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a device registry configuration. + rpc UpdateDeviceRegistry(UpdateDeviceRegistryRequest) returns (DeviceRegistry) { + option (google.api.http) = { + patch: "/v1/{device_registry.name=projects/*/locations/*/registries/*}" + body: "device_registry" + }; + option (google.api.method_signature) = "device_registry,update_mask"; + } + + // Deletes a device registry configuration. + rpc DeleteDeviceRegistry(DeleteDeviceRegistryRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/registries/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists device registries. + rpc ListDeviceRegistries(ListDeviceRegistriesRequest) returns (ListDeviceRegistriesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/registries" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a device in a device registry. + rpc CreateDevice(CreateDeviceRequest) returns (Device) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/registries/*}/devices" + body: "device" + }; + option (google.api.method_signature) = "parent,device"; + } + + // Gets details about a device. + rpc GetDevice(GetDeviceRequest) returns (Device) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/registries/*/devices/*}" + additional_bindings { + get: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates a device. + rpc UpdateDevice(UpdateDeviceRequest) returns (Device) { + option (google.api.http) = { + patch: "/v1/{device.name=projects/*/locations/*/registries/*/devices/*}" + body: "device" + additional_bindings { + patch: "/v1/{device.name=projects/*/locations/*/registries/*/groups/*/devices/*}" + body: "device" + } + }; + option (google.api.method_signature) = "device,update_mask"; + } + + // Deletes a device. + rpc DeleteDevice(DeleteDeviceRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/registries/*/devices/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List devices in a device registry. + rpc ListDevices(ListDevicesRequest) returns (ListDevicesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/registries/*}/devices" + additional_bindings { + get: "/v1/{parent=projects/*/locations/*/registries/*/groups/*}/devices" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Modifies the configuration for the device, which is eventually sent from + // the Cloud IoT Core servers. Returns the modified configuration version and + // its metadata. + rpc ModifyCloudToDeviceConfig(ModifyCloudToDeviceConfigRequest) returns (DeviceConfig) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/registries/*/devices/*}:modifyCloudToDeviceConfig" + body: "*" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}:modifyCloudToDeviceConfig" + body: "*" + } + }; + option (google.api.method_signature) = "name,binary_data"; + } + + // Lists the last few versions of the device configuration in descending + // order (i.e.: newest first). + rpc ListDeviceConfigVersions(ListDeviceConfigVersionsRequest) returns (ListDeviceConfigVersionsResponse) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/registries/*/devices/*}/configVersions" + additional_bindings { + get: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}/configVersions" + } + }; + option (google.api.method_signature) = "name"; + } + + // Lists the last few versions of the device state in descending order (i.e.: + // newest first). + rpc ListDeviceStates(ListDeviceStatesRequest) returns (ListDeviceStatesResponse) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/registries/*/devices/*}/states" + additional_bindings { + get: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}/states" + } + }; + option (google.api.method_signature) = "name"; + } + + // Sets the access control policy on the specified resource. Replaces any + // existing policy. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/locations/*/registries/*}:setIamPolicy" + body: "*" + additional_bindings { + post: "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:setIamPolicy" + body: "*" + } + }; + option (google.api.method_signature) = "resource,policy"; + } + + // Gets the access control policy for a resource. + // Returns an empty policy if the resource exists and does not have a policy + // set. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/locations/*/registries/*}:getIamPolicy" + body: "*" + additional_bindings { + post: "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:getIamPolicy" + body: "*" + } + }; + option (google.api.method_signature) = "resource"; + } + + // Returns permissions that a caller has on the specified resource. + // If the resource does not exist, this will return an empty set of + // permissions, not a NOT_FOUND error. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/locations/*/registries/*}:testIamPermissions" + body: "*" + additional_bindings { + post: "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:testIamPermissions" + body: "*" + } + }; + option (google.api.method_signature) = "resource,permissions"; + } + + // Sends a command to the specified device. In order for a device to be able + // to receive commands, it must: + // 1) be connected to Cloud IoT Core using the MQTT protocol, and + // 2) be subscribed to the group of MQTT topics specified by + // /devices/{device-id}/commands/#. This subscription will receive commands + // at the top-level topic /devices/{device-id}/commands as well as commands + // for subfolders, like /devices/{device-id}/commands/subfolder. + // Note that subscribing to specific subfolders is not supported. + // If the command could not be delivered to the device, this method will + // return an error; in particular, if the device is not subscribed, this + // method will return FAILED_PRECONDITION. Otherwise, this method will + // return OK. If the subscription is QoS 1, at least once delivery will be + // guaranteed; for QoS 0, no acknowledgment will be expected from the device. + rpc SendCommandToDevice(SendCommandToDeviceRequest) returns (SendCommandToDeviceResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/registries/*/devices/*}:sendCommandToDevice" + body: "*" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}:sendCommandToDevice" + body: "*" + } + }; + option (google.api.method_signature) = "name,binary_data"; + option (google.api.method_signature) = "name,binary_data,subfolder"; + } + + // Associates the device with the gateway. + rpc BindDeviceToGateway(BindDeviceToGatewayRequest) returns (BindDeviceToGatewayResponse) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/registries/*}:bindDeviceToGateway" + body: "*" + additional_bindings { + post: "/v1/{parent=projects/*/locations/*/registries/*/groups/*}:bindDeviceToGateway" + body: "*" + } + }; + option (google.api.method_signature) = "parent,gateway_id,device_id"; + } + + // Deletes the association between the device and the gateway. + rpc UnbindDeviceFromGateway(UnbindDeviceFromGatewayRequest) returns (UnbindDeviceFromGatewayResponse) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/registries/*}:unbindDeviceFromGateway" + body: "*" + additional_bindings { + post: "/v1/{parent=projects/*/locations/*/registries/*/groups/*}:unbindDeviceFromGateway" + body: "*" + } + }; + option (google.api.method_signature) = "parent,gateway_id,device_id"; + } +} + +// Request for `CreateDeviceRegistry`. +message CreateDeviceRegistryRequest { + // Required. The project and cloud region where this device registry must be created. + // For example, `projects/example-project/locations/us-central1`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The device registry. The field `name` must be empty. The server will + // generate that field from the device registry `id` provided and the + // `parent` field. + DeviceRegistry device_registry = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for `GetDeviceRegistry`. +message GetDeviceRegistryRequest { + // Required. The name of the device registry. For example, + // `projects/example-project/locations/us-central1/registries/my-registry`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudiot.googleapis.com/Registry" + } + ]; +} + +// Request for `DeleteDeviceRegistry`. +message DeleteDeviceRegistryRequest { + // Required. The name of the device registry. For example, + // `projects/example-project/locations/us-central1/registries/my-registry`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudiot.googleapis.com/Registry" + } + ]; +} + +// Request for `UpdateDeviceRegistry`. +message UpdateDeviceRegistryRequest { + // Required. The new values for the device registry. The `id` field must be empty, and + // the `name` field must indicate the path of the resource. For example, + // `projects/example-project/locations/us-central1/registries/my-registry`. + DeviceRegistry device_registry = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Only updates the `device_registry` fields indicated by this mask. + // The field mask must not be empty, and it must not contain fields that + // are immutable or only set by the server. + // Mutable top-level fields: `event_notification_config`, `http_config`, + // `mqtt_config`, and `state_notification_config`. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for `ListDeviceRegistries`. +message ListDeviceRegistriesRequest { + // Required. The project and cloud region path. For example, + // `projects/example-project/locations/us-central1`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of registries to return in the response. If this value + // is zero, the service will select a default size. A call may return fewer + // objects than requested. A non-empty `next_page_token` in the response + // indicates that more data is available. + int32 page_size = 2; + + // The value returned by the last `ListDeviceRegistriesResponse`; indicates + // that this is a continuation of a prior `ListDeviceRegistries` call and + // the system should return the next page of data. + string page_token = 3; +} + +// Response for `ListDeviceRegistries`. +message ListDeviceRegistriesResponse { + // The registries that matched the query. + repeated DeviceRegistry device_registries = 1; + + // If not empty, indicates that there may be more registries that match the + // request; this value should be passed in a new + // `ListDeviceRegistriesRequest`. + string next_page_token = 2; +} + +// Request for `CreateDevice`. +message CreateDeviceRequest { + // Required. The name of the device registry where this device should be created. + // For example, + // `projects/example-project/locations/us-central1/registries/my-registry`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudiot.googleapis.com/Registry" + } + ]; + + // Required. The device registration details. The field `name` must be empty. The server + // generates `name` from the device registry `id` and the + // `parent` field. + Device device = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for `GetDevice`. +message GetDeviceRequest { + // Required. The name of the device. For example, + // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudiot.googleapis.com/Device" + } + ]; + + // The fields of the `Device` resource to be returned in the response. If the + // field mask is unset or empty, all fields are returned. Fields have to be + // provided in snake_case format, for example: `last_heartbeat_time`. + google.protobuf.FieldMask field_mask = 2; +} + +// Request for `UpdateDevice`. +message UpdateDeviceRequest { + // Required. The new values for the device. The `id` and `num_id` fields must + // be empty, and the field `name` must specify the name path. For example, + // `projects/p0/locations/us-central1/registries/registry0/devices/device0`or + // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + Device device = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Only updates the `device` fields indicated by this mask. + // The field mask must not be empty, and it must not contain fields that + // are immutable or only set by the server. + // Mutable top-level fields: `credentials`, `blocked`, and `metadata` + google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for `DeleteDevice`. +message DeleteDeviceRequest { + // Required. The name of the device. For example, + // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudiot.googleapis.com/Device" + } + ]; +} + +// Request for `ListDevices`. +message ListDevicesRequest { + // Required. The device registry path. Required. For example, + // `projects/my-project/locations/us-central1/registries/my-registry`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudiot.googleapis.com/Registry" + } + ]; + + // A list of device numeric IDs. If empty, this field is ignored. Maximum + // IDs: 10,000. + repeated uint64 device_num_ids = 2; + + // A list of device string IDs. For example, `['device0', 'device12']`. + // If empty, this field is ignored. Maximum IDs: 10,000 + repeated string device_ids = 3; + + // The fields of the `Device` resource to be returned in the response. The + // fields `id` and `num_id` are always returned, along with any + // other fields specified in snake_case format, for example: + // `last_heartbeat_time`. + google.protobuf.FieldMask field_mask = 4; + + // Options related to gateways. + GatewayListOptions gateway_list_options = 6; + + // The maximum number of devices to return in the response. If this value + // is zero, the service will select a default size. A call may return fewer + // objects than requested. A non-empty `next_page_token` in the response + // indicates that more data is available. + int32 page_size = 100; + + // The value returned by the last `ListDevicesResponse`; indicates + // that this is a continuation of a prior `ListDevices` call and + // the system should return the next page of data. + string page_token = 101; +} + +// Options for limiting the list based on gateway type and associations. +message GatewayListOptions { + // If not set, all devices and gateways are returned. If set, the list is + // filtered based on gateway type and associations. + oneof filter { + // If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY` + // is specified, only non-gateway devices are returned. If + // `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned. + GatewayType gateway_type = 1; + + // If set, only devices associated with the specified gateway are returned. + // The gateway ID can be numeric (`num_id`) or the user-defined string + // (`id`). For example, if `123` is specified, only devices bound to the + // gateway with `num_id` 123 are returned. + string associations_gateway_id = 2; + + // If set, returns only the gateways with which the specified device is + // associated. The device ID can be numeric (`num_id`) or the user-defined + // string (`id`). For example, if `456` is specified, returns only the + // gateways to which the device with `num_id` 456 is bound. + string associations_device_id = 3; + } +} + +// Response for `ListDevices`. +message ListDevicesResponse { + // The devices that match the request. + repeated Device devices = 1; + + // If not empty, indicates that there may be more devices that match the + // request; this value should be passed in a new `ListDevicesRequest`. + string next_page_token = 2; +} + +// Request for `ModifyCloudToDeviceConfig`. +message ModifyCloudToDeviceConfigRequest { + // Required. The name of the device. For example, + // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudiot.googleapis.com/Device" + } + ]; + + // The version number to update. If this value is zero, it will not check the + // version number of the server and will always update the current version; + // otherwise, this update will fail if the version number found on the server + // does not match this version number. This is used to support multiple + // simultaneous updates without losing data. + int64 version_to_update = 2; + + // Required. The configuration data for the device. + bytes binary_data = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for `ListDeviceConfigVersions`. +message ListDeviceConfigVersionsRequest { + // Required. The name of the device. For example, + // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudiot.googleapis.com/Device" + } + ]; + + // The number of versions to list. Versions are listed in decreasing order of + // the version number. The maximum number of versions retained is 10. If this + // value is zero, it will return all the versions available. + int32 num_versions = 2; +} + +// Response for `ListDeviceConfigVersions`. +message ListDeviceConfigVersionsResponse { + // The device configuration for the last few versions. Versions are listed + // in decreasing order, starting from the most recent one. + repeated DeviceConfig device_configs = 1; +} + +// Request for `ListDeviceStates`. +message ListDeviceStatesRequest { + // Required. The name of the device. For example, + // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudiot.googleapis.com/Device" + } + ]; + + // The number of states to list. States are listed in descending order of + // update time. The maximum number of states retained is 10. If this + // value is zero, it will return all the states available. + int32 num_states = 2; +} + +// Response for `ListDeviceStates`. +message ListDeviceStatesResponse { + // The last few device states. States are listed in descending order of server + // update time, starting from the most recent one. + repeated DeviceState device_states = 1; +} + +// Request for `SendCommandToDevice`. +message SendCommandToDeviceRequest { + // Required. The name of the device. For example, + // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudiot.googleapis.com/Device" + } + ]; + + // Required. The command data to send to the device. + bytes binary_data = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional subfolder for the command. If empty, the command will be delivered + // to the /devices/{device-id}/commands topic, otherwise it will be delivered + // to the /devices/{device-id}/commands/{subfolder} topic. Multi-level + // subfolders are allowed. This field must not have more than 256 characters, + // and must not contain any MQTT wildcards ("+" or "#") or null characters. + string subfolder = 3; +} + +// Response for `SendCommandToDevice`. +message SendCommandToDeviceResponse { + +} + +// Request for `BindDeviceToGateway`. +message BindDeviceToGatewayRequest { + // Required. The name of the registry. For example, + // `projects/example-project/locations/us-central1/registries/my-registry`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudiot.googleapis.com/Registry" + } + ]; + + // Required. The value of `gateway_id` can be either the device numeric ID or the + // user-defined device identifier. + string gateway_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The device to associate with the specified gateway. The value of + // `device_id` can be either the device numeric ID or the user-defined device + // identifier. + string device_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Response for `BindDeviceToGateway`. +message BindDeviceToGatewayResponse { + +} + +// Request for `UnbindDeviceFromGateway`. +message UnbindDeviceFromGatewayRequest { + // Required. The name of the registry. For example, + // `projects/example-project/locations/us-central1/registries/my-registry`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudiot.googleapis.com/Registry" + } + ]; + + // Required. The value of `gateway_id` can be either the device numeric ID or the + // user-defined device identifier. + string gateway_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The device to disassociate from the specified gateway. The value of + // `device_id` can be either the device numeric ID or the user-defined device + // identifier. + string device_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Response for `UnbindDeviceFromGateway`. +message UnbindDeviceFromGatewayResponse { + +} diff --git a/owl-bot-staging/google-cloud-iot/v1/protos/google/cloud/iot/v1/resources.proto b/owl-bot-staging/google-cloud-iot/v1/protos/google/cloud/iot/v1/resources.proto new file mode 100644 index 00000000000..d08d268b024 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/protos/google/cloud/iot/v1/resources.proto @@ -0,0 +1,483 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.iot.v1; + +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option go_package = "cloud.google.com/go/iot/apiv1/iotpb;iotpb"; +option java_multiple_files = true; +option java_outer_classname = "ResourcesProto"; +option java_package = "com.google.cloud.iot.v1"; + +// The device resource. +message Device { + option (google.api.resource) = { + type: "cloudiot.googleapis.com/Device" + pattern: "projects/{project}/locations/{location}/registries/{registry}/devices/{device}" + }; + + // The user-defined device identifier. The device ID must be unique + // within a device registry. + string id = 1; + + // The resource path name. For example, + // `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or + // `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`. + // When `name` is populated as a response from the service, it always ends + // in the device numeric ID. + string name = 2; + + // [Output only] A server-defined unique numeric ID for the device. This is a + // more compact way to identify devices, and it is globally unique. + uint64 num_id = 3; + + // The credentials used to authenticate this device. To allow credential + // rotation without interruption, multiple device credentials can be bound to + // this device. No more than 3 credentials can be bound to a single device at + // a time. When new credentials are added to a device, they are verified + // against the registry credentials. For details, see the description of the + // `DeviceRegistry.credentials` field. + repeated DeviceCredential credentials = 12; + + // [Output only] The last time an MQTT `PINGREQ` was received. This field + // applies only to devices connecting through MQTT. MQTT clients usually only + // send `PINGREQ` messages if the connection is idle, and no other messages + // have been sent. Timestamps are periodically collected and written to + // storage; they may be stale by a few minutes. + google.protobuf.Timestamp last_heartbeat_time = 7; + + // [Output only] The last time a telemetry event was received. Timestamps are + // periodically collected and written to storage; they may be stale by a few + // minutes. + google.protobuf.Timestamp last_event_time = 8; + + // [Output only] The last time a state event was received. Timestamps are + // periodically collected and written to storage; they may be stale by a few + // minutes. + google.protobuf.Timestamp last_state_time = 20; + + // [Output only] The last time a cloud-to-device config version acknowledgment + // was received from the device. This field is only for configurations + // sent through MQTT. + google.protobuf.Timestamp last_config_ack_time = 14; + + // [Output only] The last time a cloud-to-device config version was sent to + // the device. + google.protobuf.Timestamp last_config_send_time = 18; + + // If a device is blocked, connections or requests from this device will fail. + // Can be used to temporarily prevent the device from connecting if, for + // example, the sensor is generating bad data and needs maintenance. + bool blocked = 19; + + // [Output only] The time the most recent error occurred, such as a failure to + // publish to Cloud Pub/Sub. This field is the timestamp of + // 'last_error_status'. + google.protobuf.Timestamp last_error_time = 10; + + // [Output only] The error message of the most recent error, such as a failure + // to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this + // field. If no errors have occurred, this field has an empty message + // and the status code 0 == OK. Otherwise, this field is expected to have a + // status code other than OK. + google.rpc.Status last_error_status = 11; + + // The most recent device configuration, which is eventually sent from + // Cloud IoT Core to the device. If not present on creation, the + // configuration will be initialized with an empty payload and version value + // of `1`. To update this field after creation, use the + // `DeviceManager.ModifyCloudToDeviceConfig` method. + DeviceConfig config = 13; + + // [Output only] The state most recently received from the device. If no state + // has been reported, this field is not present. + DeviceState state = 16; + + // **Beta Feature** + // + // The logging verbosity for device activity. If unspecified, + // DeviceRegistry.log_level will be used. + LogLevel log_level = 21; + + // The metadata key-value pairs assigned to the device. This metadata is not + // interpreted or indexed by Cloud IoT Core. It can be used to add contextual + // information for the device. + // + // Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and + // be less than 128 bytes in length. + // + // Values are free-form strings. Each value must be less than or equal to 32 + // KB in size. + // + // The total size of all keys and values must be less than 256 KB, and the + // maximum number of key-value pairs is 500. + map metadata = 17; + + // Gateway-related configuration and state. + GatewayConfig gateway_config = 24; +} + +// Gateway-related configuration and state. +message GatewayConfig { + // Indicates whether the device is a gateway. + GatewayType gateway_type = 1; + + // Indicates how to authorize and/or authenticate devices to access the + // gateway. + GatewayAuthMethod gateway_auth_method = 2; + + // [Output only] The ID of the gateway the device accessed most recently. + string last_accessed_gateway_id = 3; + + // [Output only] The most recent time at which the device accessed the gateway + // specified in `last_accessed_gateway`. + google.protobuf.Timestamp last_accessed_gateway_time = 4; +} + +// A container for a group of devices. +message DeviceRegistry { + option (google.api.resource) = { + type: "cloudiot.googleapis.com/Registry" + pattern: "projects/{project}/locations/{location}/registries/{registry}" + }; + + // The identifier of this device registry. For example, `myRegistry`. + string id = 1; + + // The resource path name. For example, + // `projects/example-project/locations/us-central1/registries/my-registry`. + string name = 2; + + // The configuration for notification of telemetry events received from the + // device. All telemetry events that were successfully published by the + // device and acknowledged by Cloud IoT Core are guaranteed to be + // delivered to Cloud Pub/Sub. If multiple configurations match a message, + // only the first matching configuration is used. If you try to publish a + // device telemetry event using MQTT without specifying a Cloud Pub/Sub topic + // for the device's registry, the connection closes automatically. If you try + // to do so using an HTTP connection, an error is returned. Up to 10 + // configurations may be provided. + repeated EventNotificationConfig event_notification_configs = 10; + + // The configuration for notification of new states received from the device. + // State updates are guaranteed to be stored in the state history, but + // notifications to Cloud Pub/Sub are not guaranteed. For example, if + // permissions are misconfigured or the specified topic doesn't exist, no + // notification will be published but the state will still be stored in Cloud + // IoT Core. + StateNotificationConfig state_notification_config = 7; + + // The MQTT configuration for this device registry. + MqttConfig mqtt_config = 4; + + // The DeviceService (HTTP) configuration for this device registry. + HttpConfig http_config = 9; + + // **Beta Feature** + // + // The default logging verbosity for activity from devices in this registry. + // The verbosity level can be overridden by Device.log_level. + LogLevel log_level = 11; + + // The credentials used to verify the device credentials. No more than 10 + // credentials can be bound to a single registry at a time. The verification + // process occurs at the time of device creation or update. If this field is + // empty, no verification is performed. Otherwise, the credentials of a newly + // created device or added credentials of an updated device should be signed + // with one of these registry credentials. + // + // Note, however, that existing devices will never be affected by + // modifications to this list of credentials: after a device has been + // successfully created in a registry, it should be able to connect even if + // its registry credentials are revoked, deleted, or modified. + repeated RegistryCredential credentials = 8; +} + +// The configuration of MQTT for a device registry. +message MqttConfig { + // If enabled, allows connections using the MQTT protocol. Otherwise, MQTT + // connections to this registry will fail. + MqttState mqtt_enabled_state = 1; +} + +// Indicates whether an MQTT connection is enabled or disabled. See the field +// description for details. +enum MqttState { + // No MQTT state specified. If not specified, MQTT will be enabled by default. + MQTT_STATE_UNSPECIFIED = 0; + + // Enables a MQTT connection. + MQTT_ENABLED = 1; + + // Disables a MQTT connection. + MQTT_DISABLED = 2; +} + +// The configuration of the HTTP bridge for a device registry. +message HttpConfig { + // If enabled, allows devices to use DeviceService via the HTTP protocol. + // Otherwise, any requests to DeviceService will fail for this registry. + HttpState http_enabled_state = 1; +} + +// Indicates whether DeviceService (HTTP) is enabled or disabled for the +// registry. See the field description for details. +enum HttpState { + // No HTTP state specified. If not specified, DeviceService will be + // enabled by default. + HTTP_STATE_UNSPECIFIED = 0; + + // Enables DeviceService (HTTP) service for the registry. + HTTP_ENABLED = 1; + + // Disables DeviceService (HTTP) service for the registry. + HTTP_DISABLED = 2; +} + +// **Beta Feature** +// +// The logging verbosity for device activity. Specifies which events should be +// written to logs. For example, if the LogLevel is ERROR, only events that +// terminate in errors will be logged. LogLevel is inclusive; enabling INFO +// logging will also enable ERROR logging. +enum LogLevel { + // No logging specified. If not specified, logging will be disabled. + LOG_LEVEL_UNSPECIFIED = 0; + + // Disables logging. + NONE = 10; + + // Error events will be logged. + ERROR = 20; + + // Informational events will be logged, such as connections and + // disconnections. + INFO = 30; + + // All events will be logged. + DEBUG = 40; +} + +// Gateway type. +enum GatewayType { + // If unspecified, the device is considered a non-gateway device. + GATEWAY_TYPE_UNSPECIFIED = 0; + + // The device is a gateway. + GATEWAY = 1; + + // The device is not a gateway. + NON_GATEWAY = 2; +} + +// The gateway authorization/authentication method. This setting determines how +// Cloud IoT Core authorizes/authenticate devices to access the gateway. +enum GatewayAuthMethod { + // No authentication/authorization method specified. No devices are allowed to + // access the gateway. + GATEWAY_AUTH_METHOD_UNSPECIFIED = 0; + + // The device is authenticated through the gateway association only. Device + // credentials are ignored even if provided. + ASSOCIATION_ONLY = 1; + + // The device is authenticated through its own credentials. Gateway + // association is not checked. + DEVICE_AUTH_TOKEN_ONLY = 2; + + // The device is authenticated through both device credentials and gateway + // association. The device must be bound to the gateway and must provide its + // own credentials. + ASSOCIATION_AND_DEVICE_AUTH_TOKEN = 3; +} + +// The configuration for forwarding telemetry events. +message EventNotificationConfig { + // If the subfolder name matches this string exactly, this configuration will + // be used. The string must not include the leading '/' character. If empty, + // all strings are matched. This field is used only for telemetry events; + // subfolders are not supported for state changes. + string subfolder_matches = 2; + + // A Cloud Pub/Sub topic name. For example, + // `projects/myProject/topics/deviceEvents`. + string pubsub_topic_name = 1; +} + +// The configuration for notification of new states received from the device. +message StateNotificationConfig { + // A Cloud Pub/Sub topic name. For example, + // `projects/myProject/topics/deviceEvents`. + string pubsub_topic_name = 1; +} + +// A server-stored registry credential used to validate device credentials. +message RegistryCredential { + // The credential data. Reserved for expansion in the future. + oneof credential { + // A public key certificate used to verify the device credentials. + PublicKeyCertificate public_key_certificate = 1; + } +} + +// Details of an X.509 certificate. For informational purposes only. +message X509CertificateDetails { + // The entity that signed the certificate. + string issuer = 1; + + // The entity the certificate and public key belong to. + string subject = 2; + + // The time the certificate becomes valid. + google.protobuf.Timestamp start_time = 3; + + // The time the certificate becomes invalid. + google.protobuf.Timestamp expiry_time = 4; + + // The algorithm used to sign the certificate. + string signature_algorithm = 5; + + // The type of public key in the certificate. + string public_key_type = 6; +} + +// A public key certificate format and data. +message PublicKeyCertificate { + // The certificate format. + PublicKeyCertificateFormat format = 1; + + // The certificate data. + string certificate = 2; + + // [Output only] The certificate details. Used only for X.509 certificates. + X509CertificateDetails x509_details = 3; +} + +// The supported formats for the public key. +enum PublicKeyCertificateFormat { + // The format has not been specified. This is an invalid default value and + // must not be used. + UNSPECIFIED_PUBLIC_KEY_CERTIFICATE_FORMAT = 0; + + // An X.509v3 certificate ([RFC5280](https://www.ietf.org/rfc/rfc5280.txt)), + // encoded in base64, and wrapped by `-----BEGIN CERTIFICATE-----` and + // `-----END CERTIFICATE-----`. + X509_CERTIFICATE_PEM = 1; +} + +// A server-stored device credential used for authentication. +message DeviceCredential { + // The credential data. Reserved for expansion in the future. + oneof credential { + // A public key used to verify the signature of JSON Web Tokens (JWTs). + // When adding a new device credential, either via device creation or via + // modifications, this public key credential may be required to be signed by + // one of the registry level certificates. More specifically, if the + // registry contains at least one certificate, any new device credential + // must be signed by one of the registry certificates. As a result, + // when the registry contains certificates, only X.509 certificates are + // accepted as device credentials. However, if the registry does + // not contain a certificate, self-signed certificates and public keys will + // be accepted. New device credentials must be different from every + // registry-level certificate. + PublicKeyCredential public_key = 2; + } + + // [Optional] The time at which this credential becomes invalid. This + // credential will be ignored for new client authentication requests after + // this timestamp; however, it will not be automatically deleted. + google.protobuf.Timestamp expiration_time = 6; +} + +// A public key format and data. +message PublicKeyCredential { + // The format of the key. + PublicKeyFormat format = 1; + + // The key data. + string key = 2; +} + +// The supported formats for the public key. +enum PublicKeyFormat { + // The format has not been specified. This is an invalid default value and + // must not be used. + UNSPECIFIED_PUBLIC_KEY_FORMAT = 0; + + // An RSA public key encoded in base64, and wrapped by + // `-----BEGIN PUBLIC KEY-----` and `-----END PUBLIC KEY-----`. This can be + // used to verify `RS256` signatures in JWT tokens ([RFC7518]( + // https://www.ietf.org/rfc/rfc7518.txt)). + RSA_PEM = 3; + + // As RSA_PEM, but wrapped in an X.509v3 certificate ([RFC5280]( + // https://www.ietf.org/rfc/rfc5280.txt)), encoded in base64, and wrapped by + // `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`. + RSA_X509_PEM = 1; + + // Public key for the ECDSA algorithm using P-256 and SHA-256, encoded in + // base64, and wrapped by `-----BEGIN PUBLIC KEY-----` and `-----END + // PUBLIC KEY-----`. This can be used to verify JWT tokens with the `ES256` + // algorithm ([RFC7518](https://www.ietf.org/rfc/rfc7518.txt)). This curve is + // defined in [OpenSSL](https://www.openssl.org/) as the `prime256v1` curve. + ES256_PEM = 2; + + // As ES256_PEM, but wrapped in an X.509v3 certificate ([RFC5280]( + // https://www.ietf.org/rfc/rfc5280.txt)), encoded in base64, and wrapped by + // `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`. + ES256_X509_PEM = 4; +} + +// The device configuration. Eventually delivered to devices. +message DeviceConfig { + // [Output only] The version of this update. The version number is assigned by + // the server, and is always greater than 0 after device creation. The + // version must be 0 on the `CreateDevice` request if a `config` is + // specified; the response of `CreateDevice` will always have a value of 1. + int64 version = 1; + + // [Output only] The time at which this configuration version was updated in + // Cloud IoT Core. This timestamp is set by the server. + google.protobuf.Timestamp cloud_update_time = 2; + + // [Output only] The time at which Cloud IoT Core received the + // acknowledgment from the device, indicating that the device has received + // this configuration version. If this field is not present, the device has + // not yet acknowledged that it received this version. Note that when + // the config was sent to the device, many config versions may have been + // available in Cloud IoT Core while the device was disconnected, and on + // connection, only the latest version is sent to the device. Some + // versions may never be sent to the device, and therefore are never + // acknowledged. This timestamp is set by Cloud IoT Core. + google.protobuf.Timestamp device_ack_time = 3; + + // The device configuration data. + bytes binary_data = 4; +} + +// The device state, as reported by the device. +message DeviceState { + // [Output only] The time at which this state version was updated in Cloud + // IoT Core. + google.protobuf.Timestamp update_time = 1; + + // The device state data. + bytes binary_data = 2; +} diff --git a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.bind_device_to_gateway.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.bind_device_to_gateway.js new file mode 100644 index 00000000000..f13595f0b2d --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.bind_device_to_gateway.js @@ -0,0 +1,75 @@ +// 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, gatewayId, deviceId) { + // [START cloudiot_v1_generated_DeviceManager_BindDeviceToGateway_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the registry. For example, + * `projects/example-project/locations/us-central1/registries/my-registry`. + */ + // const parent = 'abc123' + /** + * Required. The value of `gateway_id` can be either the device numeric ID or the + * user-defined device identifier. + */ + // const gatewayId = 'abc123' + /** + * Required. The device to associate with the specified gateway. The value of + * `device_id` can be either the device numeric ID or the user-defined device + * identifier. + */ + // const deviceId = 'abc123' + + // Imports the Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callBindDeviceToGateway() { + // Construct request + const request = { + parent, + gatewayId, + deviceId, + }; + + // Run request + const response = await iotClient.bindDeviceToGateway(request); + console.log(response); + } + + callBindDeviceToGateway(); + // [END cloudiot_v1_generated_DeviceManager_BindDeviceToGateway_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-iot/v1/samples/generated/v1/device_manager.create_device.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.create_device.js new file mode 100644 index 00000000000..741d645c885 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.create_device.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(parent, device) { + // [START cloudiot_v1_generated_DeviceManager_CreateDevice_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the device registry where this device should be created. + * For example, + * `projects/example-project/locations/us-central1/registries/my-registry`. + */ + // const parent = 'abc123' + /** + * Required. The device registration details. The field `name` must be empty. The server + * generates `name` from the device registry `id` and the + * `parent` field. + */ + // const device = {} + + // Imports the Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callCreateDevice() { + // Construct request + const request = { + parent, + device, + }; + + // Run request + const response = await iotClient.createDevice(request); + console.log(response); + } + + callCreateDevice(); + // [END cloudiot_v1_generated_DeviceManager_CreateDevice_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-iot/v1/samples/generated/v1/device_manager.create_device_registry.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.create_device_registry.js new file mode 100644 index 00000000000..d4091ed537c --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.create_device_registry.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, deviceRegistry) { + // [START cloudiot_v1_generated_DeviceManager_CreateDeviceRegistry_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 project and cloud region where this device registry must be created. + * For example, `projects/example-project/locations/us-central1`. + */ + // const parent = 'abc123' + /** + * Required. The device registry. The field `name` must be empty. The server will + * generate that field from the device registry `id` provided and the + * `parent` field. + */ + // const deviceRegistry = {} + + // Imports the Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callCreateDeviceRegistry() { + // Construct request + const request = { + parent, + deviceRegistry, + }; + + // Run request + const response = await iotClient.createDeviceRegistry(request); + console.log(response); + } + + callCreateDeviceRegistry(); + // [END cloudiot_v1_generated_DeviceManager_CreateDeviceRegistry_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-iot/v1/samples/generated/v1/device_manager.delete_device.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.delete_device.js new file mode 100644 index 00000000000..9310f9a315a --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.delete_device.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 cloudiot_v1_generated_DeviceManager_DeleteDevice_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the device. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + */ + // const name = 'abc123' + + // Imports the Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callDeleteDevice() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await iotClient.deleteDevice(request); + console.log(response); + } + + callDeleteDevice(); + // [END cloudiot_v1_generated_DeviceManager_DeleteDevice_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-iot/v1/samples/generated/v1/device_manager.delete_device_registry.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.delete_device_registry.js new file mode 100644 index 00000000000..0715e141059 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.delete_device_registry.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 cloudiot_v1_generated_DeviceManager_DeleteDeviceRegistry_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the device registry. For example, + * `projects/example-project/locations/us-central1/registries/my-registry`. + */ + // const name = 'abc123' + + // Imports the Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callDeleteDeviceRegistry() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await iotClient.deleteDeviceRegistry(request); + console.log(response); + } + + callDeleteDeviceRegistry(); + // [END cloudiot_v1_generated_DeviceManager_DeleteDeviceRegistry_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-iot/v1/samples/generated/v1/device_manager.get_device.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.get_device.js new file mode 100644 index 00000000000..1902c278b19 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.get_device.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(name) { + // [START cloudiot_v1_generated_DeviceManager_GetDevice_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the device. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + */ + // const name = 'abc123' + /** + * The fields of the `Device` resource to be returned in the response. If the + * field mask is unset or empty, all fields are returned. Fields have to be + * provided in snake_case format, for example: `last_heartbeat_time`. + */ + // const fieldMask = {} + + // Imports the Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callGetDevice() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await iotClient.getDevice(request); + console.log(response); + } + + callGetDevice(); + // [END cloudiot_v1_generated_DeviceManager_GetDevice_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-iot/v1/samples/generated/v1/device_manager.get_device_registry.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.get_device_registry.js new file mode 100644 index 00000000000..3c52776fa45 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.get_device_registry.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 cloudiot_v1_generated_DeviceManager_GetDeviceRegistry_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the device registry. For example, + * `projects/example-project/locations/us-central1/registries/my-registry`. + */ + // const name = 'abc123' + + // Imports the Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callGetDeviceRegistry() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await iotClient.getDeviceRegistry(request); + console.log(response); + } + + callGetDeviceRegistry(); + // [END cloudiot_v1_generated_DeviceManager_GetDeviceRegistry_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-iot/v1/samples/generated/v1/device_manager.get_iam_policy.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.get_iam_policy.js new file mode 100644 index 00000000000..0c6e74dc00c --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.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 cloudiot_v1_generated_DeviceManager_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 Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await iotClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END cloudiot_v1_generated_DeviceManager_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-iot/v1/samples/generated/v1/device_manager.list_device_config_versions.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_config_versions.js new file mode 100644 index 00000000000..b05df977974 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_config_versions.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(name) { + // [START cloudiot_v1_generated_DeviceManager_ListDeviceConfigVersions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the device. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + */ + // const name = 'abc123' + /** + * The number of versions to list. Versions are listed in decreasing order of + * the version number. The maximum number of versions retained is 10. If this + * value is zero, it will return all the versions available. + */ + // const numVersions = 1234 + + // Imports the Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callListDeviceConfigVersions() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await iotClient.listDeviceConfigVersions(request); + console.log(response); + } + + callListDeviceConfigVersions(); + // [END cloudiot_v1_generated_DeviceManager_ListDeviceConfigVersions_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-iot/v1/samples/generated/v1/device_manager.list_device_registries.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_registries.js new file mode 100644 index 00000000000..8113099817d --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_registries.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(parent) { + // [START cloudiot_v1_generated_DeviceManager_ListDeviceRegistries_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 project and cloud region path. For example, + * `projects/example-project/locations/us-central1`. + */ + // const parent = 'abc123' + /** + * The maximum number of registries to return in the response. If this value + * is zero, the service will select a default size. A call may return fewer + * objects than requested. A non-empty `next_page_token` in the response + * indicates that more data is available. + */ + // const pageSize = 1234 + /** + * The value returned by the last `ListDeviceRegistriesResponse`; indicates + * that this is a continuation of a prior `ListDeviceRegistries` call and + * the system should return the next page of data. + */ + // const pageToken = 'abc123' + + // Imports the Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callListDeviceRegistries() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await iotClient.listDeviceRegistriesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDeviceRegistries(); + // [END cloudiot_v1_generated_DeviceManager_ListDeviceRegistries_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-iot/v1/samples/generated/v1/device_manager.list_device_states.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_states.js new file mode 100644 index 00000000000..b6a045202a9 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_states.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(name) { + // [START cloudiot_v1_generated_DeviceManager_ListDeviceStates_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the device. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + */ + // const name = 'abc123' + /** + * The number of states to list. States are listed in descending order of + * update time. The maximum number of states retained is 10. If this + * value is zero, it will return all the states available. + */ + // const numStates = 1234 + + // Imports the Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callListDeviceStates() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await iotClient.listDeviceStates(request); + console.log(response); + } + + callListDeviceStates(); + // [END cloudiot_v1_generated_DeviceManager_ListDeviceStates_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-iot/v1/samples/generated/v1/device_manager.list_devices.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_devices.js new file mode 100644 index 00000000000..828440610a0 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_devices.js @@ -0,0 +1,98 @@ +// 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 cloudiot_v1_generated_DeviceManager_ListDevices_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 device registry path. Required. For example, + * `projects/my-project/locations/us-central1/registries/my-registry`. + */ + // const parent = 'abc123' + /** + * A list of device numeric IDs. If empty, this field is ignored. Maximum + * IDs: 10,000. + */ + // const deviceNumIds = [1,2,3,4] + /** + * A list of device string IDs. For example, `['device0', 'device12']`. + * If empty, this field is ignored. Maximum IDs: 10,000 + */ + // const deviceIds = ['abc','def'] + /** + * The fields of the `Device` resource to be returned in the response. The + * fields `id` and `num_id` are always returned, along with any + * other fields specified in snake_case format, for example: + * `last_heartbeat_time`. + */ + // const fieldMask = {} + /** + * Options related to gateways. + */ + // const gatewayListOptions = {} + /** + * The maximum number of devices to return in the response. If this value + * is zero, the service will select a default size. A call may return fewer + * objects than requested. A non-empty `next_page_token` in the response + * indicates that more data is available. + */ + // const pageSize = 1234 + /** + * The value returned by the last `ListDevicesResponse`; indicates + * that this is a continuation of a prior `ListDevices` call and + * the system should return the next page of data. + */ + // const pageToken = 'abc123' + + // Imports the Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callListDevices() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await iotClient.listDevicesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDevices(); + // [END cloudiot_v1_generated_DeviceManager_ListDevices_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-iot/v1/samples/generated/v1/device_manager.modify_cloud_to_device_config.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.modify_cloud_to_device_config.js new file mode 100644 index 00000000000..7d3c56ef10e --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.modify_cloud_to_device_config.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(name, binaryData) { + // [START cloudiot_v1_generated_DeviceManager_ModifyCloudToDeviceConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the device. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + */ + // const name = 'abc123' + /** + * The version number to update. If this value is zero, it will not check the + * version number of the server and will always update the current version; + * otherwise, this update will fail if the version number found on the server + * does not match this version number. This is used to support multiple + * simultaneous updates without losing data. + */ + // const versionToUpdate = 1234 + /** + * Required. The configuration data for the device. + */ + // const binaryData = Buffer.from('string') + + // Imports the Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callModifyCloudToDeviceConfig() { + // Construct request + const request = { + name, + binaryData, + }; + + // Run request + const response = await iotClient.modifyCloudToDeviceConfig(request); + console.log(response); + } + + callModifyCloudToDeviceConfig(); + // [END cloudiot_v1_generated_DeviceManager_ModifyCloudToDeviceConfig_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-iot/v1/samples/generated/v1/device_manager.send_command_to_device.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.send_command_to_device.js new file mode 100644 index 00000000000..17ff1fb910f --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.send_command_to_device.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(name, binaryData) { + // [START cloudiot_v1_generated_DeviceManager_SendCommandToDevice_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the device. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + */ + // const name = 'abc123' + /** + * Required. The command data to send to the device. + */ + // const binaryData = Buffer.from('string') + /** + * Optional subfolder for the command. If empty, the command will be delivered + * to the /devices/{device-id}/commands topic, otherwise it will be delivered + * to the /devices/{device-id}/commands/{subfolder} topic. Multi-level + * subfolders are allowed. This field must not have more than 256 characters, + * and must not contain any MQTT wildcards ("+" or "#") or null characters. + */ + // const subfolder = 'abc123' + + // Imports the Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callSendCommandToDevice() { + // Construct request + const request = { + name, + binaryData, + }; + + // Run request + const response = await iotClient.sendCommandToDevice(request); + console.log(response); + } + + callSendCommandToDevice(); + // [END cloudiot_v1_generated_DeviceManager_SendCommandToDevice_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-iot/v1/samples/generated/v1/device_manager.set_iam_policy.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.set_iam_policy.js new file mode 100644 index 00000000000..90929109ff5 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.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 cloudiot_v1_generated_DeviceManager_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 Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await iotClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END cloudiot_v1_generated_DeviceManager_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-iot/v1/samples/generated/v1/device_manager.test_iam_permissions.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.test_iam_permissions.js new file mode 100644 index 00000000000..172366bab63 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.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 cloudiot_v1_generated_DeviceManager_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 = ['abc','def'] + + // Imports the Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await iotClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END cloudiot_v1_generated_DeviceManager_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-iot/v1/samples/generated/v1/device_manager.unbind_device_from_gateway.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.unbind_device_from_gateway.js new file mode 100644 index 00000000000..63fbe572f83 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.unbind_device_from_gateway.js @@ -0,0 +1,75 @@ +// 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, gatewayId, deviceId) { + // [START cloudiot_v1_generated_DeviceManager_UnbindDeviceFromGateway_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the registry. For example, + * `projects/example-project/locations/us-central1/registries/my-registry`. + */ + // const parent = 'abc123' + /** + * Required. The value of `gateway_id` can be either the device numeric ID or the + * user-defined device identifier. + */ + // const gatewayId = 'abc123' + /** + * Required. The device to disassociate from the specified gateway. The value of + * `device_id` can be either the device numeric ID or the user-defined device + * identifier. + */ + // const deviceId = 'abc123' + + // Imports the Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callUnbindDeviceFromGateway() { + // Construct request + const request = { + parent, + gatewayId, + deviceId, + }; + + // Run request + const response = await iotClient.unbindDeviceFromGateway(request); + console.log(response); + } + + callUnbindDeviceFromGateway(); + // [END cloudiot_v1_generated_DeviceManager_UnbindDeviceFromGateway_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-iot/v1/samples/generated/v1/device_manager.update_device.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.update_device.js new file mode 100644 index 00000000000..d3eba4d0888 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.update_device.js @@ -0,0 +1,72 @@ +// 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(device, updateMask) { + // [START cloudiot_v1_generated_DeviceManager_UpdateDevice_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 device. The `id` and `num_id` fields must + * be empty, and the field `name` must specify the name path. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + */ + // const device = {} + /** + * Required. Only updates the `device` fields indicated by this mask. + * The field mask must not be empty, and it must not contain fields that + * are immutable or only set by the server. + * Mutable top-level fields: `credentials`, `blocked`, and `metadata` + */ + // const updateMask = {} + + // Imports the Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callUpdateDevice() { + // Construct request + const request = { + device, + updateMask, + }; + + // Run request + const response = await iotClient.updateDevice(request); + console.log(response); + } + + callUpdateDevice(); + // [END cloudiot_v1_generated_DeviceManager_UpdateDevice_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-iot/v1/samples/generated/v1/device_manager.update_device_registry.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.update_device_registry.js new file mode 100644 index 00000000000..b21e9bff56a --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.update_device_registry.js @@ -0,0 +1,72 @@ +// 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(deviceRegistry, updateMask) { + // [START cloudiot_v1_generated_DeviceManager_UpdateDeviceRegistry_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 device registry. The `id` field must be empty, and + * the `name` field must indicate the path of the resource. For example, + * `projects/example-project/locations/us-central1/registries/my-registry`. + */ + // const deviceRegistry = {} + /** + * Required. Only updates the `device_registry` fields indicated by this mask. + * The field mask must not be empty, and it must not contain fields that + * are immutable or only set by the server. + * Mutable top-level fields: `event_notification_config`, `http_config`, + * `mqtt_config`, and `state_notification_config`. + */ + // const updateMask = {} + + // Imports the Iot library + const {DeviceManagerClient} = require('@google-cloud/iot').v1; + + // Instantiates a client + const iotClient = new DeviceManagerClient(); + + async function callUpdateDeviceRegistry() { + // Construct request + const request = { + deviceRegistry, + updateMask, + }; + + // Run request + const response = await iotClient.updateDeviceRegistry(request); + console.log(response); + } + + callUpdateDeviceRegistry(); + // [END cloudiot_v1_generated_DeviceManager_UpdateDeviceRegistry_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-iot/v1/samples/generated/v1/snippet_metadata_google.cloud.iot.v1.json b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/snippet_metadata_google.cloud.iot.v1.json new file mode 100644 index 00000000000..30986a77500 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/snippet_metadata_google.cloud.iot.v1.json @@ -0,0 +1,883 @@ +{ + "clientLibrary": { + "name": "nodejs-iot", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.iot.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudiot_v1_generated_DeviceManager_CreateDeviceRegistry_async", + "title": "iot createDeviceRegistry Sample", + "origin": "API_DEFINITION", + "description": " Creates a device registry that contains devices.", + "canonical": true, + "file": "device_manager.create_device_registry.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateDeviceRegistry", + "fullName": "google.cloud.iot.v1.DeviceManager.CreateDeviceRegistry", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "device_registry", + "type": ".google.cloud.iot.v1.DeviceRegistry" + } + ], + "resultType": ".google.cloud.iot.v1.DeviceRegistry", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "CreateDeviceRegistry", + "fullName": "google.cloud.iot.v1.DeviceManager.CreateDeviceRegistry", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_GetDeviceRegistry_async", + "title": "iot getDeviceRegistry Sample", + "origin": "API_DEFINITION", + "description": " Gets a device registry configuration.", + "canonical": true, + "file": "device_manager.get_device_registry.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDeviceRegistry", + "fullName": "google.cloud.iot.v1.DeviceManager.GetDeviceRegistry", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.iot.v1.DeviceRegistry", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "GetDeviceRegistry", + "fullName": "google.cloud.iot.v1.DeviceManager.GetDeviceRegistry", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_UpdateDeviceRegistry_async", + "title": "iot updateDeviceRegistry Sample", + "origin": "API_DEFINITION", + "description": " Updates a device registry configuration.", + "canonical": true, + "file": "device_manager.update_device_registry.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateDeviceRegistry", + "fullName": "google.cloud.iot.v1.DeviceManager.UpdateDeviceRegistry", + "async": true, + "parameters": [ + { + "name": "device_registry", + "type": ".google.cloud.iot.v1.DeviceRegistry" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.iot.v1.DeviceRegistry", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "UpdateDeviceRegistry", + "fullName": "google.cloud.iot.v1.DeviceManager.UpdateDeviceRegistry", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_DeleteDeviceRegistry_async", + "title": "iot deleteDeviceRegistry Sample", + "origin": "API_DEFINITION", + "description": " Deletes a device registry configuration.", + "canonical": true, + "file": "device_manager.delete_device_registry.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteDeviceRegistry", + "fullName": "google.cloud.iot.v1.DeviceManager.DeleteDeviceRegistry", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "DeleteDeviceRegistry", + "fullName": "google.cloud.iot.v1.DeviceManager.DeleteDeviceRegistry", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_ListDeviceRegistries_async", + "title": "iot listDeviceRegistries Sample", + "origin": "API_DEFINITION", + "description": " Lists device registries.", + "canonical": true, + "file": "device_manager.list_device_registries.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDeviceRegistries", + "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceRegistries", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.iot.v1.ListDeviceRegistriesResponse", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "ListDeviceRegistries", + "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceRegistries", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_CreateDevice_async", + "title": "iot createDevice Sample", + "origin": "API_DEFINITION", + "description": " Creates a device in a device registry.", + "canonical": true, + "file": "device_manager.create_device.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateDevice", + "fullName": "google.cloud.iot.v1.DeviceManager.CreateDevice", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "device", + "type": ".google.cloud.iot.v1.Device" + } + ], + "resultType": ".google.cloud.iot.v1.Device", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "CreateDevice", + "fullName": "google.cloud.iot.v1.DeviceManager.CreateDevice", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_GetDevice_async", + "title": "iot getDevice Sample", + "origin": "API_DEFINITION", + "description": " Gets details about a device.", + "canonical": true, + "file": "device_manager.get_device.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDevice", + "fullName": "google.cloud.iot.v1.DeviceManager.GetDevice", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.iot.v1.Device", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "GetDevice", + "fullName": "google.cloud.iot.v1.DeviceManager.GetDevice", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_UpdateDevice_async", + "title": "iot updateDevice Sample", + "origin": "API_DEFINITION", + "description": " Updates a device.", + "canonical": true, + "file": "device_manager.update_device.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateDevice", + "fullName": "google.cloud.iot.v1.DeviceManager.UpdateDevice", + "async": true, + "parameters": [ + { + "name": "device", + "type": ".google.cloud.iot.v1.Device" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.iot.v1.Device", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "UpdateDevice", + "fullName": "google.cloud.iot.v1.DeviceManager.UpdateDevice", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_DeleteDevice_async", + "title": "iot deleteDevice Sample", + "origin": "API_DEFINITION", + "description": " Deletes a device.", + "canonical": true, + "file": "device_manager.delete_device.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteDevice", + "fullName": "google.cloud.iot.v1.DeviceManager.DeleteDevice", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "DeleteDevice", + "fullName": "google.cloud.iot.v1.DeviceManager.DeleteDevice", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_ListDevices_async", + "title": "iot listDevices Sample", + "origin": "API_DEFINITION", + "description": " List devices in a device registry.", + "canonical": true, + "file": "device_manager.list_devices.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 90, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDevices", + "fullName": "google.cloud.iot.v1.DeviceManager.ListDevices", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "device_num_ids", + "type": "TYPE_UINT64[]" + }, + { + "name": "device_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "gateway_list_options", + "type": ".google.cloud.iot.v1.GatewayListOptions" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.iot.v1.ListDevicesResponse", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "ListDevices", + "fullName": "google.cloud.iot.v1.DeviceManager.ListDevices", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_ModifyCloudToDeviceConfig_async", + "title": "iot modifyCloudToDeviceConfig Sample", + "origin": "API_DEFINITION", + "description": " Modifies the configuration for the device, which is eventually sent from the Cloud IoT Core servers. Returns the modified configuration version and its metadata.", + "canonical": true, + "file": "device_manager.modify_cloud_to_device_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ModifyCloudToDeviceConfig", + "fullName": "google.cloud.iot.v1.DeviceManager.ModifyCloudToDeviceConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "version_to_update", + "type": "TYPE_INT64" + }, + { + "name": "binary_data", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.iot.v1.DeviceConfig", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "ModifyCloudToDeviceConfig", + "fullName": "google.cloud.iot.v1.DeviceManager.ModifyCloudToDeviceConfig", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_ListDeviceConfigVersions_async", + "title": "iot listDeviceConfigVersions Sample", + "origin": "API_DEFINITION", + "description": " Lists the last few versions of the device configuration in descending order (i.e.: newest first).", + "canonical": true, + "file": "device_manager.list_device_config_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDeviceConfigVersions", + "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceConfigVersions", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "num_versions", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.iot.v1.ListDeviceConfigVersionsResponse", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "ListDeviceConfigVersions", + "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceConfigVersions", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_ListDeviceStates_async", + "title": "iot listDeviceStates Sample", + "origin": "API_DEFINITION", + "description": " Lists the last few versions of the device state in descending order (i.e.: newest first).", + "canonical": true, + "file": "device_manager.list_device_states.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDeviceStates", + "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceStates", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "num_states", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.iot.v1.ListDeviceStatesResponse", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "ListDeviceStates", + "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceStates", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_SetIamPolicy_async", + "title": "iot setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the access control policy on the specified resource. Replaces any existing policy.", + "canonical": true, + "file": "device_manager.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.iot.v1.DeviceManager.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": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.iot.v1.DeviceManager.SetIamPolicy", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_GetIamPolicy_async", + "title": "iot getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.", + "canonical": true, + "file": "device_manager.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.iot.v1.DeviceManager.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.iot.v1.DeviceManager.GetIamPolicy", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_TestIamPermissions_async", + "title": "iot testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.", + "canonical": true, + "file": "device_manager.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.iot.v1.DeviceManager.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.iot.v1.DeviceManager.TestIamPermissions", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_SendCommandToDevice_async", + "title": "iot sendCommandToDevice Sample", + "origin": "API_DEFINITION", + "description": " Sends a command to the specified device. In order for a device to be able to receive commands, it must: 1) be connected to Cloud IoT Core using the MQTT protocol, and 2) be subscribed to the group of MQTT topics specified by /devices/{device-id}/commands/#. This subscription will receive commands at the top-level topic /devices/{device-id}/commands as well as commands for subfolders, like /devices/{device-id}/commands/subfolder. Note that subscribing to specific subfolders is not supported. If the command could not be delivered to the device, this method will return an error; in particular, if the device is not subscribed, this method will return FAILED_PRECONDITION. Otherwise, this method will return OK. If the subscription is QoS 1, at least once delivery will be guaranteed; for QoS 0, no acknowledgment will be expected from the device.", + "canonical": true, + "file": "device_manager.send_command_to_device.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SendCommandToDevice", + "fullName": "google.cloud.iot.v1.DeviceManager.SendCommandToDevice", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "binary_data", + "type": "TYPE_BYTES" + }, + { + "name": "subfolder", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.iot.v1.SendCommandToDeviceResponse", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "SendCommandToDevice", + "fullName": "google.cloud.iot.v1.DeviceManager.SendCommandToDevice", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_BindDeviceToGateway_async", + "title": "iot bindDeviceToGateway Sample", + "origin": "API_DEFINITION", + "description": " Associates the device with the gateway.", + "canonical": true, + "file": "device_manager.bind_device_to_gateway.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BindDeviceToGateway", + "fullName": "google.cloud.iot.v1.DeviceManager.BindDeviceToGateway", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "gateway_id", + "type": "TYPE_STRING" + }, + { + "name": "device_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.iot.v1.BindDeviceToGatewayResponse", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "BindDeviceToGateway", + "fullName": "google.cloud.iot.v1.DeviceManager.BindDeviceToGateway", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + }, + { + "regionTag": "cloudiot_v1_generated_DeviceManager_UnbindDeviceFromGateway_async", + "title": "iot unbindDeviceFromGateway Sample", + "origin": "API_DEFINITION", + "description": " Deletes the association between the device and the gateway.", + "canonical": true, + "file": "device_manager.unbind_device_from_gateway.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UnbindDeviceFromGateway", + "fullName": "google.cloud.iot.v1.DeviceManager.UnbindDeviceFromGateway", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "gateway_id", + "type": "TYPE_STRING" + }, + { + "name": "device_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.iot.v1.UnbindDeviceFromGatewayResponse", + "client": { + "shortName": "DeviceManagerClient", + "fullName": "google.cloud.iot.v1.DeviceManagerClient" + }, + "method": { + "shortName": "UnbindDeviceFromGateway", + "fullName": "google.cloud.iot.v1.DeviceManager.UnbindDeviceFromGateway", + "service": { + "shortName": "DeviceManager", + "fullName": "google.cloud.iot.v1.DeviceManager" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-iot/v1/src/index.ts b/owl-bot-staging/google-cloud-iot/v1/src/index.ts new file mode 100644 index 00000000000..2990876398f --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/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 v1 from './v1'; +const DeviceManagerClient = v1.DeviceManagerClient; +type DeviceManagerClient = v1.DeviceManagerClient; +export {v1, DeviceManagerClient}; +export default {v1, DeviceManagerClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_client.ts b/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_client.ts new file mode 100644 index 00000000000..1fe4c8729e6 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_client.ts @@ -0,0 +1,2217 @@ +// 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/device_manager_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './device_manager_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Internet of Things (IoT) service. Securely connect and manage IoT devices. + * @class + * @memberof v1 + */ +export class DeviceManagerClient { + 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}; + deviceManagerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DeviceManagerClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 DeviceManagerClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof DeviceManagerClient; + 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 { + 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 = { + devicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/registries/{registry}/devices/{device}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + registryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/registries/{registry}' + ), + }; + + // 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 = { + listDeviceRegistries: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'deviceRegistries'), + listDevices: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'devices') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.iot.v1.DeviceManager', 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.deviceManagerStub) { + return this.deviceManagerStub; + } + + // Put together the "service stub" for + // google.cloud.iot.v1.DeviceManager. + this.deviceManagerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.iot.v1.DeviceManager') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.iot.v1.DeviceManager, + 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 deviceManagerStubMethods = + ['createDeviceRegistry', 'getDeviceRegistry', 'updateDeviceRegistry', 'deleteDeviceRegistry', 'listDeviceRegistries', 'createDevice', 'getDevice', 'updateDevice', 'deleteDevice', 'listDevices', 'modifyCloudToDeviceConfig', 'listDeviceConfigVersions', 'listDeviceStates', 'setIamPolicy', 'getIamPolicy', 'testIamPermissions', 'sendCommandToDevice', 'bindDeviceToGateway', 'unbindDeviceFromGateway']; + for (const methodName of deviceManagerStubMethods) { + const callPromise = this.deviceManagerStub.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.deviceManagerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudiot.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 'cloudiot.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloudiot' + ]; + } + + 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 -- + // ------------------- +/** + * Creates a device registry that contains devices. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and cloud region where this device registry must be created. + * For example, `projects/example-project/locations/us-central1`. + * @param {google.cloud.iot.v1.DeviceRegistry} request.deviceRegistry + * Required. The device registry. The field `name` must be empty. The server will + * generate that field from the device registry `id` provided and the + * `parent` field. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.DeviceRegistry|DeviceRegistry}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.create_device_registry.js + * region_tag:cloudiot_v1_generated_DeviceManager_CreateDeviceRegistry_async + */ + createDeviceRegistry( + request?: protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest|undefined, {}|undefined + ]>; + createDeviceRegistry( + request: protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest|null|undefined, + {}|null|undefined>): void; + createDeviceRegistry( + request: protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest, + callback: Callback< + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest|null|undefined, + {}|null|undefined>): void; + createDeviceRegistry( + request?: protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest|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.createDeviceRegistry(request, options, callback); + } +/** + * Gets a device registry configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the device registry. For example, + * `projects/example-project/locations/us-central1/registries/my-registry`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.DeviceRegistry|DeviceRegistry}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.get_device_registry.js + * region_tag:cloudiot_v1_generated_DeviceManager_GetDeviceRegistry_async + */ + getDeviceRegistry( + request?: protos.google.cloud.iot.v1.IGetDeviceRegistryRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.IGetDeviceRegistryRequest|undefined, {}|undefined + ]>; + getDeviceRegistry( + request: protos.google.cloud.iot.v1.IGetDeviceRegistryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.IGetDeviceRegistryRequest|null|undefined, + {}|null|undefined>): void; + getDeviceRegistry( + request: protos.google.cloud.iot.v1.IGetDeviceRegistryRequest, + callback: Callback< + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.IGetDeviceRegistryRequest|null|undefined, + {}|null|undefined>): void; + getDeviceRegistry( + request?: protos.google.cloud.iot.v1.IGetDeviceRegistryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.IGetDeviceRegistryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.IGetDeviceRegistryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.IGetDeviceRegistryRequest|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.getDeviceRegistry(request, options, callback); + } +/** + * Updates a device registry configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.iot.v1.DeviceRegistry} request.deviceRegistry + * Required. The new values for the device registry. The `id` field must be empty, and + * the `name` field must indicate the path of the resource. For example, + * `projects/example-project/locations/us-central1/registries/my-registry`. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Only updates the `device_registry` fields indicated by this mask. + * The field mask must not be empty, and it must not contain fields that + * are immutable or only set by the server. + * Mutable top-level fields: `event_notification_config`, `http_config`, + * `mqtt_config`, and `state_notification_config`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.DeviceRegistry|DeviceRegistry}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.update_device_registry.js + * region_tag:cloudiot_v1_generated_DeviceManager_UpdateDeviceRegistry_async + */ + updateDeviceRegistry( + request?: protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest|undefined, {}|undefined + ]>; + updateDeviceRegistry( + request: protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest|null|undefined, + {}|null|undefined>): void; + updateDeviceRegistry( + request: protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest, + callback: Callback< + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest|null|undefined, + {}|null|undefined>): void; + updateDeviceRegistry( + request?: protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iot.v1.IDeviceRegistry, + protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest|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({ + 'device_registry.name': request.deviceRegistry!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateDeviceRegistry(request, options, callback); + } +/** + * Deletes a device registry configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the device registry. For example, + * `projects/example-project/locations/us-central1/registries/my-registry`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.delete_device_registry.js + * region_tag:cloudiot_v1_generated_DeviceManager_DeleteDeviceRegistry_async + */ + deleteDeviceRegistry( + request?: protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest|undefined, {}|undefined + ]>; + deleteDeviceRegistry( + request: protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest|null|undefined, + {}|null|undefined>): void; + deleteDeviceRegistry( + request: protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest|null|undefined, + {}|null|undefined>): void; + deleteDeviceRegistry( + request?: protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest|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.deleteDeviceRegistry(request, options, callback); + } +/** + * Creates a device in a device registry. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the device registry where this device should be created. + * For example, + * `projects/example-project/locations/us-central1/registries/my-registry`. + * @param {google.cloud.iot.v1.Device} request.device + * Required. The device registration details. The field `name` must be empty. The server + * generates `name` from the device registry `id` and the + * `parent` field. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.Device|Device}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.create_device.js + * region_tag:cloudiot_v1_generated_DeviceManager_CreateDevice_async + */ + createDevice( + request?: protos.google.cloud.iot.v1.ICreateDeviceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.ICreateDeviceRequest|undefined, {}|undefined + ]>; + createDevice( + request: protos.google.cloud.iot.v1.ICreateDeviceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.ICreateDeviceRequest|null|undefined, + {}|null|undefined>): void; + createDevice( + request: protos.google.cloud.iot.v1.ICreateDeviceRequest, + callback: Callback< + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.ICreateDeviceRequest|null|undefined, + {}|null|undefined>): void; + createDevice( + request?: protos.google.cloud.iot.v1.ICreateDeviceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.ICreateDeviceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.ICreateDeviceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.ICreateDeviceRequest|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.createDevice(request, options, callback); + } +/** + * Gets details about a device. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the device. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + * @param {google.protobuf.FieldMask} request.fieldMask + * The fields of the `Device` resource to be returned in the response. If the + * field mask is unset or empty, all fields are returned. Fields have to be + * provided in snake_case format, for example: `last_heartbeat_time`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.Device|Device}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.get_device.js + * region_tag:cloudiot_v1_generated_DeviceManager_GetDevice_async + */ + getDevice( + request?: protos.google.cloud.iot.v1.IGetDeviceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.IGetDeviceRequest|undefined, {}|undefined + ]>; + getDevice( + request: protos.google.cloud.iot.v1.IGetDeviceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.IGetDeviceRequest|null|undefined, + {}|null|undefined>): void; + getDevice( + request: protos.google.cloud.iot.v1.IGetDeviceRequest, + callback: Callback< + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.IGetDeviceRequest|null|undefined, + {}|null|undefined>): void; + getDevice( + request?: protos.google.cloud.iot.v1.IGetDeviceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.IGetDeviceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.IGetDeviceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.IGetDeviceRequest|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.getDevice(request, options, callback); + } +/** + * Updates a device. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.iot.v1.Device} request.device + * Required. The new values for the device. The `id` and `num_id` fields must + * be empty, and the field `name` must specify the name path. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Only updates the `device` fields indicated by this mask. + * The field mask must not be empty, and it must not contain fields that + * are immutable or only set by the server. + * Mutable top-level fields: `credentials`, `blocked`, and `metadata` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.Device|Device}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.update_device.js + * region_tag:cloudiot_v1_generated_DeviceManager_UpdateDevice_async + */ + updateDevice( + request?: protos.google.cloud.iot.v1.IUpdateDeviceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.IUpdateDeviceRequest|undefined, {}|undefined + ]>; + updateDevice( + request: protos.google.cloud.iot.v1.IUpdateDeviceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.IUpdateDeviceRequest|null|undefined, + {}|null|undefined>): void; + updateDevice( + request: protos.google.cloud.iot.v1.IUpdateDeviceRequest, + callback: Callback< + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.IUpdateDeviceRequest|null|undefined, + {}|null|undefined>): void; + updateDevice( + request?: protos.google.cloud.iot.v1.IUpdateDeviceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.IUpdateDeviceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.IUpdateDeviceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iot.v1.IDevice, + protos.google.cloud.iot.v1.IUpdateDeviceRequest|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({ + 'device.name': request.device!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateDevice(request, options, callback); + } +/** + * Deletes a device. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the device. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_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 protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.delete_device.js + * region_tag:cloudiot_v1_generated_DeviceManager_DeleteDevice_async + */ + deleteDevice( + request?: protos.google.cloud.iot.v1.IDeleteDeviceRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.iot.v1.IDeleteDeviceRequest|undefined, {}|undefined + ]>; + deleteDevice( + request: protos.google.cloud.iot.v1.IDeleteDeviceRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.iot.v1.IDeleteDeviceRequest|null|undefined, + {}|null|undefined>): void; + deleteDevice( + request: protos.google.cloud.iot.v1.IDeleteDeviceRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.iot.v1.IDeleteDeviceRequest|null|undefined, + {}|null|undefined>): void; + deleteDevice( + request?: protos.google.cloud.iot.v1.IDeleteDeviceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.iot.v1.IDeleteDeviceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.iot.v1.IDeleteDeviceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.iot.v1.IDeleteDeviceRequest|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.deleteDevice(request, options, callback); + } +/** + * Modifies the configuration for the device, which is eventually sent from + * the Cloud IoT Core servers. Returns the modified configuration version and + * its metadata. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the device. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + * @param {number} request.versionToUpdate + * The version number to update. If this value is zero, it will not check the + * version number of the server and will always update the current version; + * otherwise, this update will fail if the version number found on the server + * does not match this version number. This is used to support multiple + * simultaneous updates without losing data. + * @param {Buffer} request.binaryData + * Required. The configuration data for the device. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.DeviceConfig|DeviceConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.modify_cloud_to_device_config.js + * region_tag:cloudiot_v1_generated_DeviceManager_ModifyCloudToDeviceConfig_async + */ + modifyCloudToDeviceConfig( + request?: protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iot.v1.IDeviceConfig, + protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest|undefined, {}|undefined + ]>; + modifyCloudToDeviceConfig( + request: protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iot.v1.IDeviceConfig, + protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest|null|undefined, + {}|null|undefined>): void; + modifyCloudToDeviceConfig( + request: protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest, + callback: Callback< + protos.google.cloud.iot.v1.IDeviceConfig, + protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest|null|undefined, + {}|null|undefined>): void; + modifyCloudToDeviceConfig( + request?: protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iot.v1.IDeviceConfig, + protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iot.v1.IDeviceConfig, + protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iot.v1.IDeviceConfig, + protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest|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.modifyCloudToDeviceConfig(request, options, callback); + } +/** + * Lists the last few versions of the device configuration in descending + * order (i.e.: newest first). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the device. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + * @param {number} request.numVersions + * The number of versions to list. Versions are listed in decreasing order of + * the version number. The maximum number of versions retained is 10. If this + * value is zero, it will return all the versions available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.ListDeviceConfigVersionsResponse|ListDeviceConfigVersionsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.list_device_config_versions.js + * region_tag:cloudiot_v1_generated_DeviceManager_ListDeviceConfigVersions_async + */ + listDeviceConfigVersions( + request?: protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iot.v1.IListDeviceConfigVersionsResponse, + protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest|undefined, {}|undefined + ]>; + listDeviceConfigVersions( + request: protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iot.v1.IListDeviceConfigVersionsResponse, + protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest|null|undefined, + {}|null|undefined>): void; + listDeviceConfigVersions( + request: protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest, + callback: Callback< + protos.google.cloud.iot.v1.IListDeviceConfigVersionsResponse, + protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest|null|undefined, + {}|null|undefined>): void; + listDeviceConfigVersions( + request?: protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iot.v1.IListDeviceConfigVersionsResponse, + protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iot.v1.IListDeviceConfigVersionsResponse, + protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iot.v1.IListDeviceConfigVersionsResponse, + protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest|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.listDeviceConfigVersions(request, options, callback); + } +/** + * Lists the last few versions of the device state in descending order (i.e.: + * newest first). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the device. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + * @param {number} request.numStates + * The number of states to list. States are listed in descending order of + * update time. The maximum number of states retained is 10. If this + * value is zero, it will return all the states available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.ListDeviceStatesResponse|ListDeviceStatesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.list_device_states.js + * region_tag:cloudiot_v1_generated_DeviceManager_ListDeviceStates_async + */ + listDeviceStates( + request?: protos.google.cloud.iot.v1.IListDeviceStatesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iot.v1.IListDeviceStatesResponse, + protos.google.cloud.iot.v1.IListDeviceStatesRequest|undefined, {}|undefined + ]>; + listDeviceStates( + request: protos.google.cloud.iot.v1.IListDeviceStatesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iot.v1.IListDeviceStatesResponse, + protos.google.cloud.iot.v1.IListDeviceStatesRequest|null|undefined, + {}|null|undefined>): void; + listDeviceStates( + request: protos.google.cloud.iot.v1.IListDeviceStatesRequest, + callback: Callback< + protos.google.cloud.iot.v1.IListDeviceStatesResponse, + protos.google.cloud.iot.v1.IListDeviceStatesRequest|null|undefined, + {}|null|undefined>): void; + listDeviceStates( + request?: protos.google.cloud.iot.v1.IListDeviceStatesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iot.v1.IListDeviceStatesResponse, + protos.google.cloud.iot.v1.IListDeviceStatesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iot.v1.IListDeviceStatesResponse, + protos.google.cloud.iot.v1.IListDeviceStatesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iot.v1.IListDeviceStatesResponse, + protos.google.cloud.iot.v1.IListDeviceStatesRequest|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.listDeviceStates(request, options, callback); + } +/** + * Sets the access control policy on the specified resource. Replaces any + * existing policy. + * + * @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 protos.google.iam.v1.Policy|Policy}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.set_iam_policy.js + * region_tag:cloudiot_v1_generated_DeviceManager_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 a resource. + * Returns an empty policy if the resource exists and does not have a policy + * set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {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 protos.google.iam.v1.Policy|Policy}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.get_iam_policy.js + * region_tag:cloudiot_v1_generated_DeviceManager_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 specified resource. + * If the resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * @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 protos.google.iam.v1.TestIamPermissionsResponse|TestIamPermissionsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.test_iam_permissions.js + * region_tag:cloudiot_v1_generated_DeviceManager_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); + } +/** + * Sends a command to the specified device. In order for a device to be able + * to receive commands, it must: + * 1) be connected to Cloud IoT Core using the MQTT protocol, and + * 2) be subscribed to the group of MQTT topics specified by + * /devices/{device-id}/commands/#. This subscription will receive commands + * at the top-level topic /devices/{device-id}/commands as well as commands + * for subfolders, like /devices/{device-id}/commands/subfolder. + * Note that subscribing to specific subfolders is not supported. + * If the command could not be delivered to the device, this method will + * return an error; in particular, if the device is not subscribed, this + * method will return FAILED_PRECONDITION. Otherwise, this method will + * return OK. If the subscription is QoS 1, at least once delivery will be + * guaranteed; for QoS 0, no acknowledgment will be expected from the device. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the device. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + * @param {Buffer} request.binaryData + * Required. The command data to send to the device. + * @param {string} request.subfolder + * Optional subfolder for the command. If empty, the command will be delivered + * to the /devices/{device-id}/commands topic, otherwise it will be delivered + * to the /devices/{device-id}/commands/{subfolder} topic. Multi-level + * subfolders are allowed. This field must not have more than 256 characters, + * and must not contain any MQTT wildcards ("+" or "#") or null characters. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.SendCommandToDeviceResponse|SendCommandToDeviceResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.send_command_to_device.js + * region_tag:cloudiot_v1_generated_DeviceManager_SendCommandToDevice_async + */ + sendCommandToDevice( + request?: protos.google.cloud.iot.v1.ISendCommandToDeviceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iot.v1.ISendCommandToDeviceResponse, + protos.google.cloud.iot.v1.ISendCommandToDeviceRequest|undefined, {}|undefined + ]>; + sendCommandToDevice( + request: protos.google.cloud.iot.v1.ISendCommandToDeviceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iot.v1.ISendCommandToDeviceResponse, + protos.google.cloud.iot.v1.ISendCommandToDeviceRequest|null|undefined, + {}|null|undefined>): void; + sendCommandToDevice( + request: protos.google.cloud.iot.v1.ISendCommandToDeviceRequest, + callback: Callback< + protos.google.cloud.iot.v1.ISendCommandToDeviceResponse, + protos.google.cloud.iot.v1.ISendCommandToDeviceRequest|null|undefined, + {}|null|undefined>): void; + sendCommandToDevice( + request?: protos.google.cloud.iot.v1.ISendCommandToDeviceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iot.v1.ISendCommandToDeviceResponse, + protos.google.cloud.iot.v1.ISendCommandToDeviceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iot.v1.ISendCommandToDeviceResponse, + protos.google.cloud.iot.v1.ISendCommandToDeviceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iot.v1.ISendCommandToDeviceResponse, + protos.google.cloud.iot.v1.ISendCommandToDeviceRequest|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.sendCommandToDevice(request, options, callback); + } +/** + * Associates the device with the gateway. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the registry. For example, + * `projects/example-project/locations/us-central1/registries/my-registry`. + * @param {string} request.gatewayId + * Required. The value of `gateway_id` can be either the device numeric ID or the + * user-defined device identifier. + * @param {string} request.deviceId + * Required. The device to associate with the specified gateway. The value of + * `device_id` can be either the device numeric ID or the user-defined device + * identifier. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.BindDeviceToGatewayResponse|BindDeviceToGatewayResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.bind_device_to_gateway.js + * region_tag:cloudiot_v1_generated_DeviceManager_BindDeviceToGateway_async + */ + bindDeviceToGateway( + request?: protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iot.v1.IBindDeviceToGatewayResponse, + protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest|undefined, {}|undefined + ]>; + bindDeviceToGateway( + request: protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iot.v1.IBindDeviceToGatewayResponse, + protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest|null|undefined, + {}|null|undefined>): void; + bindDeviceToGateway( + request: protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest, + callback: Callback< + protos.google.cloud.iot.v1.IBindDeviceToGatewayResponse, + protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest|null|undefined, + {}|null|undefined>): void; + bindDeviceToGateway( + request?: protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iot.v1.IBindDeviceToGatewayResponse, + protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iot.v1.IBindDeviceToGatewayResponse, + protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iot.v1.IBindDeviceToGatewayResponse, + protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest|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.bindDeviceToGateway(request, options, callback); + } +/** + * Deletes the association between the device and the gateway. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the registry. For example, + * `projects/example-project/locations/us-central1/registries/my-registry`. + * @param {string} request.gatewayId + * Required. The value of `gateway_id` can be either the device numeric ID or the + * user-defined device identifier. + * @param {string} request.deviceId + * Required. The device to disassociate from the specified gateway. The value of + * `device_id` can be either the device numeric ID or the user-defined device + * identifier. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse|UnbindDeviceFromGatewayResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.unbind_device_from_gateway.js + * region_tag:cloudiot_v1_generated_DeviceManager_UnbindDeviceFromGateway_async + */ + unbindDeviceFromGateway( + request?: protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayResponse, + protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest|undefined, {}|undefined + ]>; + unbindDeviceFromGateway( + request: protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayResponse, + protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest|null|undefined, + {}|null|undefined>): void; + unbindDeviceFromGateway( + request: protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest, + callback: Callback< + protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayResponse, + protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest|null|undefined, + {}|null|undefined>): void; + unbindDeviceFromGateway( + request?: protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayResponse, + protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayResponse, + protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayResponse, + protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest|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.unbindDeviceFromGateway(request, options, callback); + } + + /** + * Lists device registries. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and cloud region path. For example, + * `projects/example-project/locations/us-central1`. + * @param {number} request.pageSize + * The maximum number of registries to return in the response. If this value + * is zero, the service will select a default size. A call may return fewer + * objects than requested. A non-empty `next_page_token` in the response + * indicates that more data is available. + * @param {string} request.pageToken + * The value returned by the last `ListDeviceRegistriesResponse`; indicates + * that this is a continuation of a prior `ListDeviceRegistries` call and + * the system should return the next page of data. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.DeviceRegistry|DeviceRegistry}. + * 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 `listDeviceRegistriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDeviceRegistries( + request?: protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iot.v1.IDeviceRegistry[], + protos.google.cloud.iot.v1.IListDeviceRegistriesRequest|null, + protos.google.cloud.iot.v1.IListDeviceRegistriesResponse + ]>; + listDeviceRegistries( + request: protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, + protos.google.cloud.iot.v1.IListDeviceRegistriesResponse|null|undefined, + protos.google.cloud.iot.v1.IDeviceRegistry>): void; + listDeviceRegistries( + request: protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, + callback: PaginationCallback< + protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, + protos.google.cloud.iot.v1.IListDeviceRegistriesResponse|null|undefined, + protos.google.cloud.iot.v1.IDeviceRegistry>): void; + listDeviceRegistries( + request?: protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, + protos.google.cloud.iot.v1.IListDeviceRegistriesResponse|null|undefined, + protos.google.cloud.iot.v1.IDeviceRegistry>, + callback?: PaginationCallback< + protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, + protos.google.cloud.iot.v1.IListDeviceRegistriesResponse|null|undefined, + protos.google.cloud.iot.v1.IDeviceRegistry>): + Promise<[ + protos.google.cloud.iot.v1.IDeviceRegistry[], + protos.google.cloud.iot.v1.IListDeviceRegistriesRequest|null, + protos.google.cloud.iot.v1.IListDeviceRegistriesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listDeviceRegistries(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and cloud region path. For example, + * `projects/example-project/locations/us-central1`. + * @param {number} request.pageSize + * The maximum number of registries to return in the response. If this value + * is zero, the service will select a default size. A call may return fewer + * objects than requested. A non-empty `next_page_token` in the response + * indicates that more data is available. + * @param {string} request.pageToken + * The value returned by the last `ListDeviceRegistriesResponse`; indicates + * that this is a continuation of a prior `ListDeviceRegistries` call and + * the system should return the next page of data. + * @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 protos.google.cloud.iot.v1.DeviceRegistry|DeviceRegistry} 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 `listDeviceRegistriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDeviceRegistriesStream( + request?: protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, + 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['listDeviceRegistries']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDeviceRegistries.createStream( + this.innerApiCalls.listDeviceRegistries as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listDeviceRegistries`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and cloud region path. For example, + * `projects/example-project/locations/us-central1`. + * @param {number} request.pageSize + * The maximum number of registries to return in the response. If this value + * is zero, the service will select a default size. A call may return fewer + * objects than requested. A non-empty `next_page_token` in the response + * indicates that more data is available. + * @param {string} request.pageToken + * The value returned by the last `ListDeviceRegistriesResponse`; indicates + * that this is a continuation of a prior `ListDeviceRegistries` call and + * the system should return the next page of data. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.iot.v1.DeviceRegistry|DeviceRegistry}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.list_device_registries.js + * region_tag:cloudiot_v1_generated_DeviceManager_ListDeviceRegistries_async + */ + listDeviceRegistriesAsync( + request?: protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, + 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['listDeviceRegistries']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDeviceRegistries.asyncIterate( + this.innerApiCalls['listDeviceRegistries'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * List devices in a device registry. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The device registry path. Required. For example, + * `projects/my-project/locations/us-central1/registries/my-registry`. + * @param {number[]} request.deviceNumIds + * A list of device numeric IDs. If empty, this field is ignored. Maximum + * IDs: 10,000. + * @param {string[]} request.deviceIds + * A list of device string IDs. For example, `['device0', 'device12']`. + * If empty, this field is ignored. Maximum IDs: 10,000 + * @param {google.protobuf.FieldMask} request.fieldMask + * The fields of the `Device` resource to be returned in the response. The + * fields `id` and `num_id` are always returned, along with any + * other fields specified in snake_case format, for example: + * `last_heartbeat_time`. + * @param {google.cloud.iot.v1.GatewayListOptions} request.gatewayListOptions + * Options related to gateways. + * @param {number} request.pageSize + * The maximum number of devices to return in the response. If this value + * is zero, the service will select a default size. A call may return fewer + * objects than requested. A non-empty `next_page_token` in the response + * indicates that more data is available. + * @param {string} request.pageToken + * The value returned by the last `ListDevicesResponse`; indicates + * that this is a continuation of a prior `ListDevices` call and + * the system should return the next page of data. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.Device|Device}. + * 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 `listDevicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDevices( + request?: protos.google.cloud.iot.v1.IListDevicesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iot.v1.IDevice[], + protos.google.cloud.iot.v1.IListDevicesRequest|null, + protos.google.cloud.iot.v1.IListDevicesResponse + ]>; + listDevices( + request: protos.google.cloud.iot.v1.IListDevicesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.iot.v1.IListDevicesRequest, + protos.google.cloud.iot.v1.IListDevicesResponse|null|undefined, + protos.google.cloud.iot.v1.IDevice>): void; + listDevices( + request: protos.google.cloud.iot.v1.IListDevicesRequest, + callback: PaginationCallback< + protos.google.cloud.iot.v1.IListDevicesRequest, + protos.google.cloud.iot.v1.IListDevicesResponse|null|undefined, + protos.google.cloud.iot.v1.IDevice>): void; + listDevices( + request?: protos.google.cloud.iot.v1.IListDevicesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.iot.v1.IListDevicesRequest, + protos.google.cloud.iot.v1.IListDevicesResponse|null|undefined, + protos.google.cloud.iot.v1.IDevice>, + callback?: PaginationCallback< + protos.google.cloud.iot.v1.IListDevicesRequest, + protos.google.cloud.iot.v1.IListDevicesResponse|null|undefined, + protos.google.cloud.iot.v1.IDevice>): + Promise<[ + protos.google.cloud.iot.v1.IDevice[], + protos.google.cloud.iot.v1.IListDevicesRequest|null, + protos.google.cloud.iot.v1.IListDevicesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listDevices(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The device registry path. Required. For example, + * `projects/my-project/locations/us-central1/registries/my-registry`. + * @param {number[]} request.deviceNumIds + * A list of device numeric IDs. If empty, this field is ignored. Maximum + * IDs: 10,000. + * @param {string[]} request.deviceIds + * A list of device string IDs. For example, `['device0', 'device12']`. + * If empty, this field is ignored. Maximum IDs: 10,000 + * @param {google.protobuf.FieldMask} request.fieldMask + * The fields of the `Device` resource to be returned in the response. The + * fields `id` and `num_id` are always returned, along with any + * other fields specified in snake_case format, for example: + * `last_heartbeat_time`. + * @param {google.cloud.iot.v1.GatewayListOptions} request.gatewayListOptions + * Options related to gateways. + * @param {number} request.pageSize + * The maximum number of devices to return in the response. If this value + * is zero, the service will select a default size. A call may return fewer + * objects than requested. A non-empty `next_page_token` in the response + * indicates that more data is available. + * @param {string} request.pageToken + * The value returned by the last `ListDevicesResponse`; indicates + * that this is a continuation of a prior `ListDevices` call and + * the system should return the next page of data. + * @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 protos.google.cloud.iot.v1.Device|Device} 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 `listDevicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDevicesStream( + request?: protos.google.cloud.iot.v1.IListDevicesRequest, + 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['listDevices']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDevices.createStream( + this.innerApiCalls.listDevices as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listDevices`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The device registry path. Required. For example, + * `projects/my-project/locations/us-central1/registries/my-registry`. + * @param {number[]} request.deviceNumIds + * A list of device numeric IDs. If empty, this field is ignored. Maximum + * IDs: 10,000. + * @param {string[]} request.deviceIds + * A list of device string IDs. For example, `['device0', 'device12']`. + * If empty, this field is ignored. Maximum IDs: 10,000 + * @param {google.protobuf.FieldMask} request.fieldMask + * The fields of the `Device` resource to be returned in the response. The + * fields `id` and `num_id` are always returned, along with any + * other fields specified in snake_case format, for example: + * `last_heartbeat_time`. + * @param {google.cloud.iot.v1.GatewayListOptions} request.gatewayListOptions + * Options related to gateways. + * @param {number} request.pageSize + * The maximum number of devices to return in the response. If this value + * is zero, the service will select a default size. A call may return fewer + * objects than requested. A non-empty `next_page_token` in the response + * indicates that more data is available. + * @param {string} request.pageToken + * The value returned by the last `ListDevicesResponse`; indicates + * that this is a continuation of a prior `ListDevices` call and + * the system should return the next page of data. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.iot.v1.Device|Device}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/device_manager.list_devices.js + * region_tag:cloudiot_v1_generated_DeviceManager_ListDevices_async + */ + listDevicesAsync( + request?: protos.google.cloud.iot.v1.IListDevicesRequest, + 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['listDevices']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDevices.asyncIterate( + this.innerApiCalls['listDevices'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified device resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} registry + * @param {string} device + * @returns {string} Resource name string. + */ + devicePath(project:string,location:string,registry:string,device:string) { + return this.pathTemplates.devicePathTemplate.render({ + project: project, + location: location, + registry: registry, + device: device, + }); + } + + /** + * Parse the project from Device resource. + * + * @param {string} deviceName + * A fully-qualified path representing Device resource. + * @returns {string} A string representing the project. + */ + matchProjectFromDeviceName(deviceName: string) { + return this.pathTemplates.devicePathTemplate.match(deviceName).project; + } + + /** + * Parse the location from Device resource. + * + * @param {string} deviceName + * A fully-qualified path representing Device resource. + * @returns {string} A string representing the location. + */ + matchLocationFromDeviceName(deviceName: string) { + return this.pathTemplates.devicePathTemplate.match(deviceName).location; + } + + /** + * Parse the registry from Device resource. + * + * @param {string} deviceName + * A fully-qualified path representing Device resource. + * @returns {string} A string representing the registry. + */ + matchRegistryFromDeviceName(deviceName: string) { + return this.pathTemplates.devicePathTemplate.match(deviceName).registry; + } + + /** + * Parse the device from Device resource. + * + * @param {string} deviceName + * A fully-qualified path representing Device resource. + * @returns {string} A string representing the device. + */ + matchDeviceFromDeviceName(deviceName: string) { + return this.pathTemplates.devicePathTemplate.match(deviceName).device; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified registry resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} registry + * @returns {string} Resource name string. + */ + registryPath(project:string,location:string,registry:string) { + return this.pathTemplates.registryPathTemplate.render({ + project: project, + location: location, + registry: registry, + }); + } + + /** + * Parse the project from Registry resource. + * + * @param {string} registryName + * A fully-qualified path representing Registry resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRegistryName(registryName: string) { + return this.pathTemplates.registryPathTemplate.match(registryName).project; + } + + /** + * Parse the location from Registry resource. + * + * @param {string} registryName + * A fully-qualified path representing Registry resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRegistryName(registryName: string) { + return this.pathTemplates.registryPathTemplate.match(registryName).location; + } + + /** + * Parse the registry from Registry resource. + * + * @param {string} registryName + * A fully-qualified path representing Registry resource. + * @returns {string} A string representing the registry. + */ + matchRegistryFromRegistryName(registryName: string) { + return this.pathTemplates.registryPathTemplate.match(registryName).registry; + } + + /** + * 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.deviceManagerStub && !this._terminated) { + return this.deviceManagerStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_client_config.json b/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_client_config.json new file mode 100644 index 00000000000..5ded0fd1cb3 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_client_config.json @@ -0,0 +1,135 @@ +{ + "interfaces": { + "google.cloud.iot.v1.DeviceManager": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "deadline_exceeded_resource_exhausted_unavailable": [ + "DEADLINE_EXCEEDED", + "RESOURCE_EXHAUSTED", + "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 + }, + "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c": { + "initial_retry_delay_millis": 1000, + "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": { + "CreateDeviceRegistry": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetDeviceRegistry": { + "timeout_millis": 120000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateDeviceRegistry": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteDeviceRegistry": { + "timeout_millis": 120000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListDeviceRegistries": { + "timeout_millis": 120000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateDevice": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetDevice": { + "timeout_millis": 120000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateDevice": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteDevice": { + "timeout_millis": 120000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListDevices": { + "timeout_millis": 120000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ModifyCloudToDeviceConfig": { + "timeout_millis": 120000, + "retry_codes_name": "deadline_exceeded_resource_exhausted_unavailable", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + }, + "ListDeviceConfigVersions": { + "timeout_millis": 120000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListDeviceStates": { + "timeout_millis": 120000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "SetIamPolicy": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SendCommandToDevice": { + "timeout_millis": 120000, + "retry_codes_name": "deadline_exceeded_resource_exhausted_unavailable", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + }, + "BindDeviceToGateway": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UnbindDeviceFromGateway": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_proto_list.json b/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_proto_list.json new file mode 100644 index 00000000000..95cf55973ec --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/iot/v1/device_manager.proto", + "../../protos/google/cloud/iot/v1/resources.proto" +] diff --git a/owl-bot-staging/google-cloud-iot/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-iot/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..28ab3c5db9b --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/src/v1/gapic_metadata.json @@ -0,0 +1,221 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.iot.v1", + "libraryPackage": "@google-cloud/iot", + "services": { + "DeviceManager": { + "clients": { + "grpc": { + "libraryClient": "DeviceManagerClient", + "rpcs": { + "CreateDeviceRegistry": { + "methods": [ + "createDeviceRegistry" + ] + }, + "GetDeviceRegistry": { + "methods": [ + "getDeviceRegistry" + ] + }, + "UpdateDeviceRegistry": { + "methods": [ + "updateDeviceRegistry" + ] + }, + "DeleteDeviceRegistry": { + "methods": [ + "deleteDeviceRegistry" + ] + }, + "CreateDevice": { + "methods": [ + "createDevice" + ] + }, + "GetDevice": { + "methods": [ + "getDevice" + ] + }, + "UpdateDevice": { + "methods": [ + "updateDevice" + ] + }, + "DeleteDevice": { + "methods": [ + "deleteDevice" + ] + }, + "ModifyCloudToDeviceConfig": { + "methods": [ + "modifyCloudToDeviceConfig" + ] + }, + "ListDeviceConfigVersions": { + "methods": [ + "listDeviceConfigVersions" + ] + }, + "ListDeviceStates": { + "methods": [ + "listDeviceStates" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "SendCommandToDevice": { + "methods": [ + "sendCommandToDevice" + ] + }, + "BindDeviceToGateway": { + "methods": [ + "bindDeviceToGateway" + ] + }, + "UnbindDeviceFromGateway": { + "methods": [ + "unbindDeviceFromGateway" + ] + }, + "ListDeviceRegistries": { + "methods": [ + "listDeviceRegistries", + "listDeviceRegistriesStream", + "listDeviceRegistriesAsync" + ] + }, + "ListDevices": { + "methods": [ + "listDevices", + "listDevicesStream", + "listDevicesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DeviceManagerClient", + "rpcs": { + "CreateDeviceRegistry": { + "methods": [ + "createDeviceRegistry" + ] + }, + "GetDeviceRegistry": { + "methods": [ + "getDeviceRegistry" + ] + }, + "UpdateDeviceRegistry": { + "methods": [ + "updateDeviceRegistry" + ] + }, + "DeleteDeviceRegistry": { + "methods": [ + "deleteDeviceRegistry" + ] + }, + "CreateDevice": { + "methods": [ + "createDevice" + ] + }, + "GetDevice": { + "methods": [ + "getDevice" + ] + }, + "UpdateDevice": { + "methods": [ + "updateDevice" + ] + }, + "DeleteDevice": { + "methods": [ + "deleteDevice" + ] + }, + "ModifyCloudToDeviceConfig": { + "methods": [ + "modifyCloudToDeviceConfig" + ] + }, + "ListDeviceConfigVersions": { + "methods": [ + "listDeviceConfigVersions" + ] + }, + "ListDeviceStates": { + "methods": [ + "listDeviceStates" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "SendCommandToDevice": { + "methods": [ + "sendCommandToDevice" + ] + }, + "BindDeviceToGateway": { + "methods": [ + "bindDeviceToGateway" + ] + }, + "UnbindDeviceFromGateway": { + "methods": [ + "unbindDeviceFromGateway" + ] + }, + "ListDeviceRegistries": { + "methods": [ + "listDeviceRegistries", + "listDeviceRegistriesStream", + "listDeviceRegistriesAsync" + ] + }, + "ListDevices": { + "methods": [ + "listDevices", + "listDevicesStream", + "listDevicesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-iot/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-iot/v1/src/v1/index.ts new file mode 100644 index 00000000000..3a9c53a4c21 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/src/v1/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 {DeviceManagerClient} from './device_manager_client'; diff --git a/owl-bot-staging/google-cloud-iot/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-iot/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..5f9fa318176 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/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 iot = require('@google-cloud/iot'); + +function main() { + const deviceManagerClient = new iot.DeviceManagerClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-iot/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-iot/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..a5837baba06 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/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 {DeviceManagerClient} from '@google-cloud/iot'; + +// check that the client class type name can be used +function doStuffWithDeviceManagerClient(client: DeviceManagerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const deviceManagerClient = new DeviceManagerClient(); + doStuffWithDeviceManagerClient(deviceManagerClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-iot/v1/system-test/install.ts b/owl-bot-staging/google-cloud-iot/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/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-iot/v1/test/gapic_device_manager_v1.ts b/owl-bot-staging/google-cloud-iot/v1/test/gapic_device_manager_v1.ts new file mode 100644 index 00000000000..9aefcb760ce --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/v1/test/gapic_device_manager_v1.ts @@ -0,0 +1,2672 @@ +// 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 devicemanagerModule 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.DeviceManagerClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = devicemanagerModule.v1.DeviceManagerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = devicemanagerModule.v1.DeviceManagerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = devicemanagerModule.v1.DeviceManagerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new devicemanagerModule.v1.DeviceManagerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.deviceManagerStub, undefined); + await client.initialize(); + assert(client.deviceManagerStub); + }); + + it('has close method for the initialized client', done => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.deviceManagerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.deviceManagerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new devicemanagerModule.v1.DeviceManagerClient({ + 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 devicemanagerModule.v1.DeviceManagerClient({ + 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('createDeviceRegistry', () => { + it('invokes createDeviceRegistry without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.CreateDeviceRegistryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.CreateDeviceRegistryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.DeviceRegistry() + ); + client.innerApiCalls.createDeviceRegistry = stubSimpleCall(expectedResponse); + const [response] = await client.createDeviceRegistry(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createDeviceRegistry as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDeviceRegistry as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDeviceRegistry without error using callback', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.CreateDeviceRegistryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.CreateDeviceRegistryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.DeviceRegistry() + ); + client.innerApiCalls.createDeviceRegistry = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDeviceRegistry( + request, + (err?: Error|null, result?: protos.google.cloud.iot.v1.IDeviceRegistry|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createDeviceRegistry as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDeviceRegistry as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDeviceRegistry with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.CreateDeviceRegistryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.CreateDeviceRegistryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDeviceRegistry = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createDeviceRegistry(request), expectedError); + const actualRequest = (client.innerApiCalls.createDeviceRegistry as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDeviceRegistry as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDeviceRegistry with closed client', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.CreateDeviceRegistryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.CreateDeviceRegistryRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createDeviceRegistry(request), expectedError); + }); + }); + + describe('getDeviceRegistry', () => { + it('invokes getDeviceRegistry without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.GetDeviceRegistryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.GetDeviceRegistryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.DeviceRegistry() + ); + client.innerApiCalls.getDeviceRegistry = stubSimpleCall(expectedResponse); + const [response] = await client.getDeviceRegistry(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDeviceRegistry as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDeviceRegistry as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDeviceRegistry without error using callback', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.GetDeviceRegistryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.GetDeviceRegistryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.DeviceRegistry() + ); + client.innerApiCalls.getDeviceRegistry = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDeviceRegistry( + request, + (err?: Error|null, result?: protos.google.cloud.iot.v1.IDeviceRegistry|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDeviceRegistry as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDeviceRegistry as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDeviceRegistry with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.GetDeviceRegistryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.GetDeviceRegistryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDeviceRegistry = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDeviceRegistry(request), expectedError); + const actualRequest = (client.innerApiCalls.getDeviceRegistry as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDeviceRegistry as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDeviceRegistry with closed client', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.GetDeviceRegistryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.GetDeviceRegistryRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDeviceRegistry(request), expectedError); + }); + }); + + describe('updateDeviceRegistry', () => { + it('invokes updateDeviceRegistry without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.UpdateDeviceRegistryRequest() + ); + request.deviceRegistry ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.UpdateDeviceRegistryRequest', ['deviceRegistry', 'name']); + request.deviceRegistry.name = defaultValue1; + const expectedHeaderRequestParams = `device_registry.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.DeviceRegistry() + ); + client.innerApiCalls.updateDeviceRegistry = stubSimpleCall(expectedResponse); + const [response] = await client.updateDeviceRegistry(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateDeviceRegistry as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDeviceRegistry as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDeviceRegistry without error using callback', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.UpdateDeviceRegistryRequest() + ); + request.deviceRegistry ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.UpdateDeviceRegistryRequest', ['deviceRegistry', 'name']); + request.deviceRegistry.name = defaultValue1; + const expectedHeaderRequestParams = `device_registry.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.DeviceRegistry() + ); + client.innerApiCalls.updateDeviceRegistry = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDeviceRegistry( + request, + (err?: Error|null, result?: protos.google.cloud.iot.v1.IDeviceRegistry|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateDeviceRegistry as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDeviceRegistry as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDeviceRegistry with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.UpdateDeviceRegistryRequest() + ); + request.deviceRegistry ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.UpdateDeviceRegistryRequest', ['deviceRegistry', 'name']); + request.deviceRegistry.name = defaultValue1; + const expectedHeaderRequestParams = `device_registry.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDeviceRegistry = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateDeviceRegistry(request), expectedError); + const actualRequest = (client.innerApiCalls.updateDeviceRegistry as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDeviceRegistry as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDeviceRegistry with closed client', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.UpdateDeviceRegistryRequest() + ); + request.deviceRegistry ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.UpdateDeviceRegistryRequest', ['deviceRegistry', 'name']); + request.deviceRegistry.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateDeviceRegistry(request), expectedError); + }); + }); + + describe('deleteDeviceRegistry', () => { + it('invokes deleteDeviceRegistry without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.DeleteDeviceRegistryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.DeleteDeviceRegistryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDeviceRegistry = stubSimpleCall(expectedResponse); + const [response] = await client.deleteDeviceRegistry(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteDeviceRegistry as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDeviceRegistry as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDeviceRegistry without error using callback', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.DeleteDeviceRegistryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.DeleteDeviceRegistryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDeviceRegistry = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDeviceRegistry( + 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.deleteDeviceRegistry as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDeviceRegistry as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDeviceRegistry with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.DeleteDeviceRegistryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.DeleteDeviceRegistryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDeviceRegistry = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteDeviceRegistry(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteDeviceRegistry as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDeviceRegistry as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDeviceRegistry with closed client', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.DeleteDeviceRegistryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.DeleteDeviceRegistryRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteDeviceRegistry(request), expectedError); + }); + }); + + describe('createDevice', () => { + it('invokes createDevice without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.CreateDeviceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.CreateDeviceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.Device() + ); + client.innerApiCalls.createDevice = stubSimpleCall(expectedResponse); + const [response] = await client.createDevice(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createDevice as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDevice as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDevice without error using callback', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.CreateDeviceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.CreateDeviceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.Device() + ); + client.innerApiCalls.createDevice = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDevice( + request, + (err?: Error|null, result?: protos.google.cloud.iot.v1.IDevice|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createDevice as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDevice as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDevice with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.CreateDeviceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.CreateDeviceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDevice = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createDevice(request), expectedError); + const actualRequest = (client.innerApiCalls.createDevice as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDevice as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDevice with closed client', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.CreateDeviceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.CreateDeviceRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createDevice(request), expectedError); + }); + }); + + describe('getDevice', () => { + it('invokes getDevice without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.GetDeviceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.GetDeviceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.Device() + ); + client.innerApiCalls.getDevice = stubSimpleCall(expectedResponse); + const [response] = await client.getDevice(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDevice as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDevice as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDevice without error using callback', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.GetDeviceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.GetDeviceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.Device() + ); + client.innerApiCalls.getDevice = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDevice( + request, + (err?: Error|null, result?: protos.google.cloud.iot.v1.IDevice|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDevice as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDevice as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDevice with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.GetDeviceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.GetDeviceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDevice = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDevice(request), expectedError); + const actualRequest = (client.innerApiCalls.getDevice as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDevice as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDevice with closed client', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.GetDeviceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.GetDeviceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDevice(request), expectedError); + }); + }); + + describe('updateDevice', () => { + it('invokes updateDevice without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.UpdateDeviceRequest() + ); + request.device ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.UpdateDeviceRequest', ['device', 'name']); + request.device.name = defaultValue1; + const expectedHeaderRequestParams = `device.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.Device() + ); + client.innerApiCalls.updateDevice = stubSimpleCall(expectedResponse); + const [response] = await client.updateDevice(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateDevice as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDevice as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDevice without error using callback', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.UpdateDeviceRequest() + ); + request.device ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.UpdateDeviceRequest', ['device', 'name']); + request.device.name = defaultValue1; + const expectedHeaderRequestParams = `device.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.Device() + ); + client.innerApiCalls.updateDevice = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDevice( + request, + (err?: Error|null, result?: protos.google.cloud.iot.v1.IDevice|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateDevice as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDevice as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDevice with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.UpdateDeviceRequest() + ); + request.device ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.UpdateDeviceRequest', ['device', 'name']); + request.device.name = defaultValue1; + const expectedHeaderRequestParams = `device.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDevice = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateDevice(request), expectedError); + const actualRequest = (client.innerApiCalls.updateDevice as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDevice as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDevice with closed client', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.UpdateDeviceRequest() + ); + request.device ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.UpdateDeviceRequest', ['device', 'name']); + request.device.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateDevice(request), expectedError); + }); + }); + + describe('deleteDevice', () => { + it('invokes deleteDevice without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.DeleteDeviceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.DeleteDeviceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDevice = stubSimpleCall(expectedResponse); + const [response] = await client.deleteDevice(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteDevice as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDevice as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDevice without error using callback', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.DeleteDeviceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.DeleteDeviceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDevice = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDevice( + 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.deleteDevice as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDevice as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDevice with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.DeleteDeviceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.DeleteDeviceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDevice = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteDevice(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteDevice as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDevice as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDevice with closed client', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.DeleteDeviceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.DeleteDeviceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteDevice(request), expectedError); + }); + }); + + describe('modifyCloudToDeviceConfig', () => { + it('invokes modifyCloudToDeviceConfig without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.DeviceConfig() + ); + client.innerApiCalls.modifyCloudToDeviceConfig = stubSimpleCall(expectedResponse); + const [response] = await client.modifyCloudToDeviceConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.modifyCloudToDeviceConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.modifyCloudToDeviceConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes modifyCloudToDeviceConfig without error using callback', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.DeviceConfig() + ); + client.innerApiCalls.modifyCloudToDeviceConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.modifyCloudToDeviceConfig( + request, + (err?: Error|null, result?: protos.google.cloud.iot.v1.IDeviceConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.modifyCloudToDeviceConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.modifyCloudToDeviceConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes modifyCloudToDeviceConfig with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.modifyCloudToDeviceConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.modifyCloudToDeviceConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.modifyCloudToDeviceConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.modifyCloudToDeviceConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes modifyCloudToDeviceConfig with closed client', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.modifyCloudToDeviceConfig(request), expectedError); + }); + }); + + describe('listDeviceConfigVersions', () => { + it('invokes listDeviceConfigVersions without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceConfigVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceConfigVersionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceConfigVersionsResponse() + ); + client.innerApiCalls.listDeviceConfigVersions = stubSimpleCall(expectedResponse); + const [response] = await client.listDeviceConfigVersions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDeviceConfigVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDeviceConfigVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDeviceConfigVersions without error using callback', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceConfigVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceConfigVersionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceConfigVersionsResponse() + ); + client.innerApiCalls.listDeviceConfigVersions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDeviceConfigVersions( + request, + (err?: Error|null, result?: protos.google.cloud.iot.v1.IListDeviceConfigVersionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDeviceConfigVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDeviceConfigVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDeviceConfigVersions with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceConfigVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceConfigVersionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDeviceConfigVersions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDeviceConfigVersions(request), expectedError); + const actualRequest = (client.innerApiCalls.listDeviceConfigVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDeviceConfigVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDeviceConfigVersions with closed client', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceConfigVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceConfigVersionsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listDeviceConfigVersions(request), expectedError); + }); + }); + + describe('listDeviceStates', () => { + it('invokes listDeviceStates without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceStatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceStatesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceStatesResponse() + ); + client.innerApiCalls.listDeviceStates = stubSimpleCall(expectedResponse); + const [response] = await client.listDeviceStates(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDeviceStates as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDeviceStates as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDeviceStates without error using callback', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceStatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceStatesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceStatesResponse() + ); + client.innerApiCalls.listDeviceStates = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDeviceStates( + request, + (err?: Error|null, result?: protos.google.cloud.iot.v1.IListDeviceStatesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDeviceStates as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDeviceStates as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDeviceStates with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceStatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceStatesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDeviceStates = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDeviceStates(request), expectedError); + const actualRequest = (client.innerApiCalls.listDeviceStates as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDeviceStates as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDeviceStates with closed client', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceStatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceStatesRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listDeviceStates(request), expectedError); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + 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 devicemanagerModule.v1.DeviceManagerClient({ + 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 devicemanagerModule.v1.DeviceManagerClient({ + 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 devicemanagerModule.v1.DeviceManagerClient({ + 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 devicemanagerModule.v1.DeviceManagerClient({ + 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 devicemanagerModule.v1.DeviceManagerClient({ + 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 devicemanagerModule.v1.DeviceManagerClient({ + 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 devicemanagerModule.v1.DeviceManagerClient({ + 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 devicemanagerModule.v1.DeviceManagerClient({ + 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 devicemanagerModule.v1.DeviceManagerClient({ + 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 devicemanagerModule.v1.DeviceManagerClient({ + 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 devicemanagerModule.v1.DeviceManagerClient({ + 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('sendCommandToDevice', () => { + it('invokes sendCommandToDevice without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.SendCommandToDeviceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.SendCommandToDeviceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.SendCommandToDeviceResponse() + ); + client.innerApiCalls.sendCommandToDevice = stubSimpleCall(expectedResponse); + const [response] = await client.sendCommandToDevice(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.sendCommandToDevice as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.sendCommandToDevice as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes sendCommandToDevice without error using callback', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.SendCommandToDeviceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.SendCommandToDeviceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.SendCommandToDeviceResponse() + ); + client.innerApiCalls.sendCommandToDevice = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.sendCommandToDevice( + request, + (err?: Error|null, result?: protos.google.cloud.iot.v1.ISendCommandToDeviceResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.sendCommandToDevice as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.sendCommandToDevice as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes sendCommandToDevice with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.SendCommandToDeviceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.SendCommandToDeviceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.sendCommandToDevice = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.sendCommandToDevice(request), expectedError); + const actualRequest = (client.innerApiCalls.sendCommandToDevice as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.sendCommandToDevice as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes sendCommandToDevice with closed client', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.SendCommandToDeviceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.SendCommandToDeviceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.sendCommandToDevice(request), expectedError); + }); + }); + + describe('bindDeviceToGateway', () => { + it('invokes bindDeviceToGateway without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.BindDeviceToGatewayRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.BindDeviceToGatewayRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.BindDeviceToGatewayResponse() + ); + client.innerApiCalls.bindDeviceToGateway = stubSimpleCall(expectedResponse); + const [response] = await client.bindDeviceToGateway(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.bindDeviceToGateway as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.bindDeviceToGateway as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes bindDeviceToGateway without error using callback', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.BindDeviceToGatewayRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.BindDeviceToGatewayRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.BindDeviceToGatewayResponse() + ); + client.innerApiCalls.bindDeviceToGateway = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.bindDeviceToGateway( + request, + (err?: Error|null, result?: protos.google.cloud.iot.v1.IBindDeviceToGatewayResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.bindDeviceToGateway as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.bindDeviceToGateway as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes bindDeviceToGateway with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.BindDeviceToGatewayRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.BindDeviceToGatewayRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.bindDeviceToGateway = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.bindDeviceToGateway(request), expectedError); + const actualRequest = (client.innerApiCalls.bindDeviceToGateway as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.bindDeviceToGateway as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes bindDeviceToGateway with closed client', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.BindDeviceToGatewayRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.BindDeviceToGatewayRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.bindDeviceToGateway(request), expectedError); + }); + }); + + describe('unbindDeviceFromGateway', () => { + it('invokes unbindDeviceFromGateway without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse() + ); + client.innerApiCalls.unbindDeviceFromGateway = stubSimpleCall(expectedResponse); + const [response] = await client.unbindDeviceFromGateway(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.unbindDeviceFromGateway as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.unbindDeviceFromGateway as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes unbindDeviceFromGateway without error using callback', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse() + ); + client.innerApiCalls.unbindDeviceFromGateway = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.unbindDeviceFromGateway( + request, + (err?: Error|null, result?: protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.unbindDeviceFromGateway as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.unbindDeviceFromGateway as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes unbindDeviceFromGateway with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.unbindDeviceFromGateway = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.unbindDeviceFromGateway(request), expectedError); + const actualRequest = (client.innerApiCalls.unbindDeviceFromGateway as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.unbindDeviceFromGateway as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes unbindDeviceFromGateway with closed client', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.unbindDeviceFromGateway(request), expectedError); + }); + }); + + describe('listDeviceRegistries', () => { + it('invokes listDeviceRegistries without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceRegistriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceRegistriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), + generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), + generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), + ]; + client.innerApiCalls.listDeviceRegistries = stubSimpleCall(expectedResponse); + const [response] = await client.listDeviceRegistries(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDeviceRegistries as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDeviceRegistries as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDeviceRegistries without error using callback', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceRegistriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceRegistriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), + generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), + generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), + ]; + client.innerApiCalls.listDeviceRegistries = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDeviceRegistries( + request, + (err?: Error|null, result?: protos.google.cloud.iot.v1.IDeviceRegistry[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDeviceRegistries as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDeviceRegistries as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDeviceRegistries with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceRegistriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceRegistriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDeviceRegistries = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDeviceRegistries(request), expectedError); + const actualRequest = (client.innerApiCalls.listDeviceRegistries as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDeviceRegistries as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDeviceRegistriesStream without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceRegistriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceRegistriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), + generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), + generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), + ]; + client.descriptors.page.listDeviceRegistries.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listDeviceRegistriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.iot.v1.DeviceRegistry[] = []; + stream.on('data', (response: protos.google.cloud.iot.v1.DeviceRegistry) => { + 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.listDeviceRegistries.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDeviceRegistries, request)); + assert( + (client.descriptors.page.listDeviceRegistries.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listDeviceRegistriesStream with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceRegistriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceRegistriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDeviceRegistries.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listDeviceRegistriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.iot.v1.DeviceRegistry[] = []; + stream.on('data', (response: protos.google.cloud.iot.v1.DeviceRegistry) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listDeviceRegistries.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDeviceRegistries, request)); + assert( + (client.descriptors.page.listDeviceRegistries.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDeviceRegistries without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceRegistriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceRegistriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), + generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), + generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), + ]; + client.descriptors.page.listDeviceRegistries.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.iot.v1.IDeviceRegistry[] = []; + const iterable = client.listDeviceRegistriesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDeviceRegistries.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDeviceRegistries.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDeviceRegistries with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDeviceRegistriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceRegistriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDeviceRegistries.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDeviceRegistriesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.iot.v1.IDeviceRegistry[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDeviceRegistries.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDeviceRegistries.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listDevices', () => { + it('invokes listDevices without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDevicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDevicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.iot.v1.Device()), + generateSampleMessage(new protos.google.cloud.iot.v1.Device()), + generateSampleMessage(new protos.google.cloud.iot.v1.Device()), + ]; + client.innerApiCalls.listDevices = stubSimpleCall(expectedResponse); + const [response] = await client.listDevices(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDevices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDevices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDevices without error using callback', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDevicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDevicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.iot.v1.Device()), + generateSampleMessage(new protos.google.cloud.iot.v1.Device()), + generateSampleMessage(new protos.google.cloud.iot.v1.Device()), + ]; + client.innerApiCalls.listDevices = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDevices( + request, + (err?: Error|null, result?: protos.google.cloud.iot.v1.IDevice[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDevices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDevices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDevices with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDevicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDevicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDevices = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDevices(request), expectedError); + const actualRequest = (client.innerApiCalls.listDevices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDevices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDevicesStream without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDevicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDevicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.iot.v1.Device()), + generateSampleMessage(new protos.google.cloud.iot.v1.Device()), + generateSampleMessage(new protos.google.cloud.iot.v1.Device()), + ]; + client.descriptors.page.listDevices.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listDevicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.iot.v1.Device[] = []; + stream.on('data', (response: protos.google.cloud.iot.v1.Device) => { + 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.listDevices.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDevices, request)); + assert( + (client.descriptors.page.listDevices.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listDevicesStream with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDevicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDevicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDevices.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listDevicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.iot.v1.Device[] = []; + stream.on('data', (response: protos.google.cloud.iot.v1.Device) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listDevices.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDevices, request)); + assert( + (client.descriptors.page.listDevices.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDevices without error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDevicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDevicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.iot.v1.Device()), + generateSampleMessage(new protos.google.cloud.iot.v1.Device()), + generateSampleMessage(new protos.google.cloud.iot.v1.Device()), + ]; + client.descriptors.page.listDevices.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.iot.v1.IDevice[] = []; + const iterable = client.listDevicesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDevices.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDevices.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDevices with error', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iot.v1.ListDevicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iot.v1.ListDevicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDevices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDevicesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.iot.v1.IDevice[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDevices.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDevices.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('device', () => { + const fakePath = "/rendered/path/device"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + registry: "registryValue", + device: "deviceValue", + }; + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.devicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.devicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('devicePath', () => { + const result = client.devicePath("projectValue", "locationValue", "registryValue", "deviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.devicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromDeviceName', () => { + const result = client.matchProjectFromDeviceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.devicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromDeviceName', () => { + const result = client.matchLocationFromDeviceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.devicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegistryFromDeviceName', () => { + const result = client.matchRegistryFromDeviceName(fakePath); + assert.strictEqual(result, "registryValue"); + assert((client.pathTemplates.devicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDeviceFromDeviceName', () => { + const result = client.matchDeviceFromDeviceName(fakePath); + assert.strictEqual(result, "deviceValue"); + assert((client.pathTemplates.devicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('registry', () => { + const fakePath = "/rendered/path/registry"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + registry: "registryValue", + }; + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.registryPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.registryPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('registryPath', () => { + const result = client.registryPath("projectValue", "locationValue", "registryValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.registryPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromRegistryName', () => { + const result = client.matchProjectFromRegistryName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.registryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromRegistryName', () => { + const result = client.matchLocationFromRegistryName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.registryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegistryFromRegistryName', () => { + const result = client.matchRegistryFromRegistryName(fakePath); + assert.strictEqual(result, "registryValue"); + assert((client.pathTemplates.registryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-iot/v1/tsconfig.json b/owl-bot-staging/google-cloud-iot/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/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-iot/v1/webpack.config.js b/owl-bot-staging/google-cloud-iot/v1/webpack.config.js new file mode 100644 index 00000000000..7f6d8159f34 --- /dev/null +++ b/owl-bot-staging/google-cloud-iot/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: 'iot', + filename: './iot.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-kms-inventory/v1/.eslintignore b/owl-bot-staging/google-cloud-kms-inventory/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/.eslintrc.json b/owl-bot-staging/google-cloud-kms-inventory/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/.gitignore b/owl-bot-staging/google-cloud-kms-inventory/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/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-kms-inventory/v1/.jsdoc.js b/owl-bot-staging/google-cloud-kms-inventory/v1/.jsdoc.js new file mode 100644 index 00000000000..7167b7e596e --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/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/kms-inventory', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/.mocharc.js b/owl-bot-staging/google-cloud-kms-inventory/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/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-kms-inventory/v1/.prettierrc.js b/owl-bot-staging/google-cloud-kms-inventory/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/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-kms-inventory/v1/README.md b/owl-bot-staging/google-cloud-kms-inventory/v1/README.md new file mode 100644 index 00000000000..e25299a6861 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/README.md @@ -0,0 +1 @@ +Inventory: Nodejs Client diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/package.json b/owl-bot-staging/google-cloud-kms-inventory/v1/package.json new file mode 100644 index 00000000000..bb515340cc8 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/package.json @@ -0,0 +1,59 @@ +{ + "name": "@google-cloud/kms-inventory", + "version": "0.1.0", + "description": "Inventory client for Node.js", + "repository": "googleapis/nodejs-inventory", + "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 inventory", + "inventory", + "key dashboard service", + "key tracking service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/protos/google/cloud/kms/inventory/v1/key_dashboard_service.proto b/owl-bot-staging/google-cloud-kms-inventory/v1/protos/google/cloud/kms/inventory/v1/key_dashboard_service.proto new file mode 100644 index 00000000000..fe6353e44cd --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/protos/google/cloud/kms/inventory/v1/key_dashboard_service.proto @@ -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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.kms.inventory.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/kms/v1/resources.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Kms.Inventory.V1"; +option go_package = "cloud.google.com/go/kms/inventory/apiv1/inventorypb;inventorypb"; +option java_multiple_files = true; +option java_outer_classname = "KeyDashboardServiceProto"; +option java_package = "com.google.cloud.kms.inventory.v1"; +option php_namespace = "Google\\Cloud\\Kms\\Inventory\\V1"; + +// Provides a cross-region view of all Cloud KMS keys in a given Cloud project. +service KeyDashboardService { + option (google.api.default_host) = "kmsinventory.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Returns cryptographic keys managed by Cloud KMS in a given Cloud project. + // Note that this data is sourced from snapshots, meaning it may not + // completely reflect the actual state of key metadata at call time. + rpc ListCryptoKeys(ListCryptoKeysRequest) returns (ListCryptoKeysResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/cryptoKeys" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Request message for +// [KeyDashboardService.ListCryptoKeys][google.cloud.kms.inventory.v1.KeyDashboardService.ListCryptoKeys]. +message ListCryptoKeysRequest { + // Required. The Google Cloud project for which to retrieve key metadata, in + // the format `projects/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Optional. The maximum number of keys to return. The service may return + // fewer than this value. If unspecified, at most 1000 keys will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Pass this into a subsequent request in order to receive the next + // page of results. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [KeyDashboardService.ListCryptoKeys][google.cloud.kms.inventory.v1.KeyDashboardService.ListCryptoKeys]. +message ListCryptoKeysResponse { + // The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + repeated google.cloud.kms.v1.CryptoKey crypto_keys = 1; + + // The page token returned from the previous response if the next page is + // desired. + string next_page_token = 2; +} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/protos/google/cloud/kms/inventory/v1/key_tracking_service.proto b/owl-bot-staging/google-cloud-kms-inventory/v1/protos/google/cloud/kms/inventory/v1/key_tracking_service.proto new file mode 100644 index 00000000000..fa324fd7815 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/protos/google/cloud/kms/inventory/v1/key_tracking_service.proto @@ -0,0 +1,228 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.kms.inventory.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Kms.Inventory.V1"; +option go_package = "cloud.google.com/go/kms/inventory/apiv1/inventorypb;inventorypb"; +option java_multiple_files = true; +option java_outer_classname = "KeyTrackingServiceProto"; +option java_package = "com.google.cloud.kms.inventory.v1"; +option php_namespace = "Google\\Cloud\\Kms\\Inventory\\V1"; + +// Returns information about the resources in an org that are protected by a +// given Cloud KMS key via CMEK. +service KeyTrackingService { + option (google.api.default_host) = "kmsinventory.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Returns aggregate information about the resources protected by the given + // Cloud KMS [CryptoKey][google.cloud.kms.v1.CryptoKey]. Only resources within + // the same Cloud organization as the key will be returned. The project that + // holds the key must be part of an organization in order for this call to + // succeed. + rpc GetProtectedResourcesSummary(GetProtectedResourcesSummaryRequest) + returns (ProtectedResourcesSummary) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/**}/protectedResourcesSummary" + }; + option (google.api.method_signature) = "name"; + } + + // Returns metadata about the resources protected by the given Cloud KMS + // [CryptoKey][google.cloud.kms.v1.CryptoKey] in the given Cloud organization. + rpc SearchProtectedResources(SearchProtectedResourcesRequest) + returns (SearchProtectedResourcesResponse) { + option (google.api.http) = { + get: "/v1/{scope=organizations/*}/protectedResources:search" + }; + option (google.api.method_signature) = "scope, crypto_key"; + } +} + +// Request message for +// [KeyTrackingService.GetProtectedResourcesSummary][google.cloud.kms.inventory.v1.KeyTrackingService.GetProtectedResourcesSummary]. +message GetProtectedResourcesSummaryRequest { + // Required. The resource name of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey]. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "kmsinventory.googleapis.com/ProtectedResourcesSummary" + } + ]; +} + +// Aggregate information about the resources protected by a Cloud KMS key in the +// same Cloud organization as the key. +message ProtectedResourcesSummary { + option (google.api.resource) = { + type: "kmsinventory.googleapis.com/ProtectedResourcesSummary" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/protectedResourcesSummary" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/protectedResourcesSummary" + }; + + // The full name of the ProtectedResourcesSummary resource. + // Example: + // projects/test-project/locations/us/keyRings/test-keyring/cryptoKeys/test-key/protectedResourcesSummary + string name = 5; + + // The total number of protected resources in the same Cloud organization as + // the key. + int64 resource_count = 1; + + // The number of distinct Cloud projects in the same Cloud organization as the + // key that have resources protected by the key. + int32 project_count = 2; + + // The number of resources protected by the key grouped by resource type. + map resource_types = 3; + + // The number of resources protected by the key grouped by Cloud product. + map cloud_products = 6; + + // The number of resources protected by the key grouped by region. + map locations = 4; +} + +// Request message for +// [KeyTrackingService.SearchProtectedResources][google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources]. +message SearchProtectedResourcesRequest { + // Required. Resource name of the organization. + // Example: organizations/123 + string scope = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // Required. The resource name of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey]. + string crypto_key = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "*" } + ]; + + // The maximum number of resources to return. The service may return fewer + // than this value. + // If unspecified, at most 500 resources will be returned. + // The maximum value is 500; values above 500 will be coerced to 500. + int32 page_size = 3; + + // A page token, received from a previous + // [KeyTrackingService.SearchProtectedResources][google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources] + // call. Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // [KeyTrackingService.SearchProtectedResources][google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources] + // must match the call that provided the page token. + string page_token = 4; + + // Optional. A list of resource types that this request searches for. If + // empty, it will search all the [trackable resource + // types](https://cloud.google.com/kms/docs/view-key-usage#tracked-resource-types). + // + // Regular expressions are also supported. For example: + // + // * `compute.googleapis.com.*` snapshots resources whose type starts + // with `compute.googleapis.com`. + // * `.*Image` snapshots resources whose type ends with `Image`. + // * `.*Image.*` snapshots resources whose type contains `Image`. + // + // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + // regular expression syntax. If the regular expression does not match any + // supported resource type, an INVALID_ARGUMENT error will be returned. + repeated string resource_types = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [KeyTrackingService.SearchProtectedResources][google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources]. +message SearchProtectedResourcesResponse { + // Protected resources for this page. + repeated ProtectedResource protected_resources = 1; + + // A token that can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Metadata about a resource protected by a Cloud KMS key. +message ProtectedResource { + option (google.api.resource) = { + type: "cloudasset.googleapis.com/Asset" + pattern: "*" + }; + + // The full resource name of the resource. + // Example: + // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + string name = 1; + + // Format: `projects/{PROJECT_NUMBER}`. + string project = 2; + + // The ID of the project that owns the resource. + string project_id = 9; + + // The Cloud product that owns the resource. + // Example: `compute` + string cloud_product = 8; + + // Example: `compute.googleapis.com/Disk` + string resource_type = 3; + + // Location can be `global`, regional like `us-east1`, or zonal like + // `us-west1-b`. + string location = 4; + + // A key-value pair of the resource's labels (v1) to their values. + map labels = 5; + + // The name of the Cloud KMS + // [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions?hl=en) + // used to protect this resource via CMEK. This field is empty if the + // Google Cloud product owning the resource does not provide key version data + // to Asset Inventory. If there are multiple key versions protecting the + // resource, then this is same value as the first element of + // crypto_key_versions. + string crypto_key_version = 6 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + }]; + + // The names of the Cloud KMS + // [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions?hl=en) + // used to protect this resource via CMEK. This field is empty if the + // Google Cloud product owning the resource does not provide key versions data + // to Asset Inventory. The first element of this field is stored in + // crypto_key_version. + repeated string crypto_key_versions = 10 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + }]; + + // Output only. The time at which this resource was created. The granularity + // is in seconds. Timestamp.nanos will always be 0. + google.protobuf.Timestamp create_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_dashboard_service.list_crypto_keys.js b/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_dashboard_service.list_crypto_keys.js new file mode 100644 index 00000000000..cb7e3900a54 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_dashboard_service.list_crypto_keys.js @@ -0,0 +1,75 @@ +// 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 kmsinventory_v1_generated_KeyDashboardService_ListCryptoKeys_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Google Cloud project for which to retrieve key metadata, in + * the format `projects/*` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of keys to return. The service may return + * fewer than this value. If unspecified, at most 1000 keys will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * Optional. Pass this into a subsequent request in order to receive the next + * page of results. + */ + // const pageToken = 'abc123' + + // Imports the Inventory library + const {KeyDashboardServiceClient} = require('@google-cloud/kms-inventory').v1; + + // Instantiates a client + const inventoryClient = new KeyDashboardServiceClient(); + + async function callListCryptoKeys() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await inventoryClient.listCryptoKeysAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCryptoKeys(); + // [END kmsinventory_v1_generated_KeyDashboardService_ListCryptoKeys_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-kms-inventory/v1/samples/generated/v1/key_tracking_service.get_protected_resources_summary.js b/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_tracking_service.get_protected_resources_summary.js new file mode 100644 index 00000000000..c0ad1d0f3bd --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_tracking_service.get_protected_resources_summary.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 kmsinventory_v1_generated_KeyTrackingService_GetProtectedResourcesSummary_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKey google.cloud.kms.v1.CryptoKey. + */ + // const name = 'abc123' + + // Imports the Inventory library + const {KeyTrackingServiceClient} = require('@google-cloud/kms-inventory').v1; + + // Instantiates a client + const inventoryClient = new KeyTrackingServiceClient(); + + async function callGetProtectedResourcesSummary() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await inventoryClient.getProtectedResourcesSummary(request); + console.log(response); + } + + callGetProtectedResourcesSummary(); + // [END kmsinventory_v1_generated_KeyTrackingService_GetProtectedResourcesSummary_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-kms-inventory/v1/samples/generated/v1/key_tracking_service.search_protected_resources.js b/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_tracking_service.search_protected_resources.js new file mode 100644 index 00000000000..4744dc757c3 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_tracking_service.search_protected_resources.js @@ -0,0 +1,100 @@ +// 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(scope, cryptoKey) { + // [START kmsinventory_v1_generated_KeyTrackingService_SearchProtectedResources_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. Resource name of the organization. + * Example: organizations/123 + */ + // const scope = 'abc123' + /** + * Required. The resource name of the + * CryptoKey google.cloud.kms.v1.CryptoKey. + */ + // const cryptoKey = 'abc123' + /** + * The maximum number of resources to return. The service may return fewer + * than this value. + * If unspecified, at most 500 resources will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous + * KeyTrackingService.SearchProtectedResources google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * KeyTrackingService.SearchProtectedResources google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. A list of resource types that this request searches for. If + * empty, it will search all the trackable resource + * types (https://cloud.google.com/kms/docs/view-key-usage#tracked-resource-types). + * Regular expressions are also supported. For example: + * * `compute.googleapis.com.*` snapshots resources whose type starts + * with `compute.googleapis.com`. + * * `.*Image` snapshots resources whose type ends with `Image`. + * * `.*Image.*` snapshots resources whose type contains `Image`. + * See RE2 (https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported resource type, an INVALID_ARGUMENT error will be returned. + */ + // const resourceTypes = ['abc','def'] + + // Imports the Inventory library + const {KeyTrackingServiceClient} = require('@google-cloud/kms-inventory').v1; + + // Instantiates a client + const inventoryClient = new KeyTrackingServiceClient(); + + async function callSearchProtectedResources() { + // Construct request + const request = { + scope, + cryptoKey, + }; + + // Run request + const iterable = await inventoryClient.searchProtectedResourcesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callSearchProtectedResources(); + // [END kmsinventory_v1_generated_KeyTrackingService_SearchProtectedResources_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-kms-inventory/v1/samples/generated/v1/snippet_metadata_google.cloud.kms.inventory.v1.json b/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/snippet_metadata_google.cloud.kms.inventory.v1.json new file mode 100644 index 00000000000..9dd2b499dd2 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/snippet_metadata_google.cloud.kms.inventory.v1.json @@ -0,0 +1,159 @@ +{ + "clientLibrary": { + "name": "nodejs-inventory", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.kms.inventory.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "kmsinventory_v1_generated_KeyDashboardService_ListCryptoKeys_async", + "title": "KeyDashboardService listCryptoKeys Sample", + "origin": "API_DEFINITION", + "description": " Returns cryptographic keys managed by Cloud KMS in a given Cloud project. Note that this data is sourced from snapshots, meaning it may not completely reflect the actual state of key metadata at call time.", + "canonical": true, + "file": "key_dashboard_service.list_crypto_keys.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCryptoKeys", + "fullName": "google.cloud.kms.inventory.v1.KeyDashboardService.ListCryptoKeys", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.inventory.v1.ListCryptoKeysResponse", + "client": { + "shortName": "KeyDashboardServiceClient", + "fullName": "google.cloud.kms.inventory.v1.KeyDashboardServiceClient" + }, + "method": { + "shortName": "ListCryptoKeys", + "fullName": "google.cloud.kms.inventory.v1.KeyDashboardService.ListCryptoKeys", + "service": { + "shortName": "KeyDashboardService", + "fullName": "google.cloud.kms.inventory.v1.KeyDashboardService" + } + } + } + }, + { + "regionTag": "kmsinventory_v1_generated_KeyTrackingService_GetProtectedResourcesSummary_async", + "title": "KeyDashboardService getProtectedResourcesSummary Sample", + "origin": "API_DEFINITION", + "description": " Returns aggregate information about the resources protected by the given Cloud KMS [CryptoKey][google.cloud.kms.v1.CryptoKey]. Only resources within the same Cloud organization as the key will be returned. The project that holds the key must be part of an organization in order for this call to succeed.", + "canonical": true, + "file": "key_tracking_service.get_protected_resources_summary.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProtectedResourcesSummary", + "fullName": "google.cloud.kms.inventory.v1.KeyTrackingService.GetProtectedResourcesSummary", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.inventory.v1.ProtectedResourcesSummary", + "client": { + "shortName": "KeyTrackingServiceClient", + "fullName": "google.cloud.kms.inventory.v1.KeyTrackingServiceClient" + }, + "method": { + "shortName": "GetProtectedResourcesSummary", + "fullName": "google.cloud.kms.inventory.v1.KeyTrackingService.GetProtectedResourcesSummary", + "service": { + "shortName": "KeyTrackingService", + "fullName": "google.cloud.kms.inventory.v1.KeyTrackingService" + } + } + } + }, + { + "regionTag": "kmsinventory_v1_generated_KeyTrackingService_SearchProtectedResources_async", + "title": "KeyDashboardService searchProtectedResources Sample", + "origin": "API_DEFINITION", + "description": " Returns metadata about the resources protected by the given Cloud KMS [CryptoKey][google.cloud.kms.v1.CryptoKey] in the given Cloud organization.", + "canonical": true, + "file": "key_tracking_service.search_protected_resources.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 92, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchProtectedResources", + "fullName": "google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources", + "async": true, + "parameters": [ + { + "name": "scope", + "type": "TYPE_STRING" + }, + { + "name": "crypto_key", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "resource_types", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.cloud.kms.inventory.v1.SearchProtectedResourcesResponse", + "client": { + "shortName": "KeyTrackingServiceClient", + "fullName": "google.cloud.kms.inventory.v1.KeyTrackingServiceClient" + }, + "method": { + "shortName": "SearchProtectedResources", + "fullName": "google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources", + "service": { + "shortName": "KeyTrackingService", + "fullName": "google.cloud.kms.inventory.v1.KeyTrackingService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/index.ts b/owl-bot-staging/google-cloud-kms-inventory/v1/src/index.ts new file mode 100644 index 00000000000..17a2b3aaaa7 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/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 KeyDashboardServiceClient = v1.KeyDashboardServiceClient; +type KeyDashboardServiceClient = v1.KeyDashboardServiceClient; +const KeyTrackingServiceClient = v1.KeyTrackingServiceClient; +type KeyTrackingServiceClient = v1.KeyTrackingServiceClient; +export {v1, KeyDashboardServiceClient, KeyTrackingServiceClient}; +export default {v1, KeyDashboardServiceClient, KeyTrackingServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..27e965465e6 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/gapic_metadata.json @@ -0,0 +1,75 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.kms.inventory.v1", + "libraryPackage": "@google-cloud/kms-inventory", + "services": { + "KeyDashboardService": { + "clients": { + "grpc": { + "libraryClient": "KeyDashboardServiceClient", + "rpcs": { + "ListCryptoKeys": { + "methods": [ + "listCryptoKeys", + "listCryptoKeysStream", + "listCryptoKeysAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "KeyDashboardServiceClient", + "rpcs": { + "ListCryptoKeys": { + "methods": [ + "listCryptoKeys", + "listCryptoKeysStream", + "listCryptoKeysAsync" + ] + } + } + } + } + }, + "KeyTrackingService": { + "clients": { + "grpc": { + "libraryClient": "KeyTrackingServiceClient", + "rpcs": { + "GetProtectedResourcesSummary": { + "methods": [ + "getProtectedResourcesSummary" + ] + }, + "SearchProtectedResources": { + "methods": [ + "searchProtectedResources", + "searchProtectedResourcesStream", + "searchProtectedResourcesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "KeyTrackingServiceClient", + "rpcs": { + "GetProtectedResourcesSummary": { + "methods": [ + "getProtectedResourcesSummary" + ] + }, + "SearchProtectedResources": { + "methods": [ + "searchProtectedResources", + "searchProtectedResourcesStream", + "searchProtectedResourcesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/index.ts new file mode 100644 index 00000000000..3f97e3eb8e7 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/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 {KeyDashboardServiceClient} from './key_dashboard_service_client'; +export {KeyTrackingServiceClient} from './key_tracking_service_client'; diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_client.ts b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_client.ts new file mode 100644 index 00000000000..51f93d8a73b --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_client.ts @@ -0,0 +1,1016 @@ +// 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/key_dashboard_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './key_dashboard_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Provides a cross-region view of all Cloud KMS keys in a given Cloud project. + * @class + * @memberof v1 + */ +export class KeyDashboardServiceClient { + 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}; + keyDashboardServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of KeyDashboardServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 KeyDashboardServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof KeyDashboardServiceClient; + 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 { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' + ), + cryptoKeyVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}' + ), + importJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}' + ), + keyRingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/protectedResourcesSummary' + ), + projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/protectedResourcesSummary' + ), + publicKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/publicKey' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listCryptoKeys: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'cryptoKeys') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.kms.inventory.v1.KeyDashboardService', 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.keyDashboardServiceStub) { + return this.keyDashboardServiceStub; + } + + // Put together the "service stub" for + // google.cloud.kms.inventory.v1.KeyDashboardService. + this.keyDashboardServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.kms.inventory.v1.KeyDashboardService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.kms.inventory.v1.KeyDashboardService, + 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 keyDashboardServiceStubMethods = + ['listCryptoKeys']; + for (const methodName of keyDashboardServiceStubMethods) { + const callPromise = this.keyDashboardServiceStub.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.keyDashboardServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'kmsinventory.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 'kmsinventory.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 -- + // ------------------- + + /** + * Returns cryptographic keys managed by Cloud KMS in a given Cloud project. + * Note that this data is sourced from snapshots, meaning it may not + * completely reflect the actual state of key metadata at call time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The Google Cloud project for which to retrieve key metadata, in + * the format `projects/*` + * @param {number} [request.pageSize] + * Optional. The maximum number of keys to return. The service may return + * fewer than this value. If unspecified, at most 1000 keys will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} [request.pageToken] + * Optional. Pass this into a subsequent request in order to receive the next + * page of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCryptoKeysAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCryptoKeys( + request?: protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKey[], + protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest|null, + protos.google.cloud.kms.inventory.v1.IListCryptoKeysResponse + ]>; + listCryptoKeys( + request: protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, + protos.google.cloud.kms.inventory.v1.IListCryptoKeysResponse|null|undefined, + protos.google.cloud.kms.v1.ICryptoKey>): void; + listCryptoKeys( + request: protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, + callback: PaginationCallback< + protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, + protos.google.cloud.kms.inventory.v1.IListCryptoKeysResponse|null|undefined, + protos.google.cloud.kms.v1.ICryptoKey>): void; + listCryptoKeys( + request?: protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, + protos.google.cloud.kms.inventory.v1.IListCryptoKeysResponse|null|undefined, + protos.google.cloud.kms.v1.ICryptoKey>, + callback?: PaginationCallback< + protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, + protos.google.cloud.kms.inventory.v1.IListCryptoKeysResponse|null|undefined, + protos.google.cloud.kms.v1.ICryptoKey>): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKey[], + protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest|null, + protos.google.cloud.kms.inventory.v1.IListCryptoKeysResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listCryptoKeys(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The Google Cloud project for which to retrieve key metadata, in + * the format `projects/*` + * @param {number} [request.pageSize] + * Optional. The maximum number of keys to return. The service may return + * fewer than this value. If unspecified, at most 1000 keys will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} [request.pageToken] + * Optional. Pass this into a subsequent request in order to receive the next + * page of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCryptoKeysAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCryptoKeysStream( + request?: protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listCryptoKeys']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCryptoKeys.createStream( + this.innerApiCalls.listCryptoKeys as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCryptoKeys`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The Google Cloud project for which to retrieve key metadata, in + * the format `projects/*` + * @param {number} [request.pageSize] + * Optional. The maximum number of keys to return. The service may return + * fewer than this value. If unspecified, at most 1000 keys will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} [request.pageToken] + * Optional. Pass this into a subsequent request in order to receive the next + * page of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_dashboard_service.list_crypto_keys.js + * region_tag:kmsinventory_v1_generated_KeyDashboardService_ListCryptoKeys_async + */ + listCryptoKeysAsync( + request?: protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listCryptoKeys']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCryptoKeys.asyncIterate( + this.innerApiCalls['listCryptoKeys'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified cryptoKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @returns {string} Resource name string. + */ + cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { + return this.pathTemplates.cryptoKeyPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + }); + } + + /** + * Parse the project from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; + } + + /** + * Parse the location from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; + } + + /** + * Parse the key_ring from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; + } + + /** + * Parse the crypto_key from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; + } + + /** + * Return a fully-qualified cryptoKeyVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @param {string} crypto_key_version + * @returns {string} Resource name string. + */ + cryptoKeyVersionPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + crypto_key_version: cryptoKeyVersion, + }); + } + + /** + * Parse the project from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).project; + } + + /** + * Parse the location from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).location; + } + + /** + * Parse the key_ring from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).key_ring; + } + + /** + * Parse the crypto_key from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).crypto_key; + } + + /** + * Parse the crypto_key_version from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the crypto_key_version. + */ + matchCryptoKeyVersionFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).crypto_key_version; + } + + /** + * Return a fully-qualified importJob resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} import_job + * @returns {string} Resource name string. + */ + importJobPath(project:string,location:string,keyRing:string,importJob:string) { + return this.pathTemplates.importJobPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + import_job: importJob, + }); + } + + /** + * Parse the project from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the project. + */ + matchProjectFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).project; + } + + /** + * Parse the location from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the location. + */ + matchLocationFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).location; + } + + /** + * Parse the key_ring from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).key_ring; + } + + /** + * Parse the import_job from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the import_job. + */ + matchImportJobFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).import_job; + } + + /** + * Return a fully-qualified keyRing resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @returns {string} Resource name string. + */ + keyRingPath(project:string,location:string,keyRing:string) { + return this.pathTemplates.keyRingPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + }); + } + + /** + * Parse the project from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the project. + */ + matchProjectFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).project; + } + + /** + * Parse the location from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the location. + */ + matchLocationFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).location; + } + + /** + * Parse the key_ring from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).key_ring; + } + + /** + * Return a fully-qualified 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 projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @param {string} crypto_key_version + * @returns {string} Resource name string. + */ + projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + crypto_key_version: cryptoKeyVersion, + }); + } + + /** + * Parse the project from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).project; + } + + /** + * Parse the location from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).location; + } + + /** + * Parse the key_ring from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).key_ring; + } + + /** + * Parse the crypto_key from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).crypto_key; + } + + /** + * Parse the crypto_key_version from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. + * @returns {string} A string representing the crypto_key_version. + */ + matchCryptoKeyVersionFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).crypto_key_version; + } + + /** + * Return a fully-qualified projectLocationKeyRingCryptoKeyProtectedResourcesSummary resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @returns {string} Resource name string. + */ + projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPath(project:string,location:string,keyRing:string,cryptoKey:string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + }); + } + + /** + * Parse the project from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName).project; + } + + /** + * Parse the location from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName).location; + } + + /** + * Parse the key_ring from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName).key_ring; + } + + /** + * Parse the crypto_key from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName).crypto_key; + } + + /** + * Return a fully-qualified publicKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @param {string} crypto_key_version + * @returns {string} Resource name string. + */ + publicKeyPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { + return this.pathTemplates.publicKeyPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + crypto_key_version: cryptoKeyVersion, + }); + } + + /** + * Parse the project from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).project; + } + + /** + * Parse the location from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).location; + } + + /** + * Parse the key_ring from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).key_ring; + } + + /** + * Parse the crypto_key from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).crypto_key; + } + + /** + * Parse the crypto_key_version from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the crypto_key_version. + */ + matchCryptoKeyVersionFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).crypto_key_version; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.keyDashboardServiceStub && !this._terminated) { + return this.keyDashboardServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_client_config.json b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_client_config.json new file mode 100644 index 00000000000..2b60e8b9192 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.kms.inventory.v1.KeyDashboardService": { + "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": { + "ListCryptoKeys": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_proto_list.json b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_proto_list.json new file mode 100644 index 00000000000..c3534b31a62 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/kms/inventory/v1/key_dashboard_service.proto", + "../../protos/google/cloud/kms/inventory/v1/key_tracking_service.proto", + "../../protos/google/cloud/kms/v1/resources.proto" +] diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_client.ts b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_client.ts new file mode 100644 index 00000000000..22fa732c327 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_client.ts @@ -0,0 +1,1163 @@ +// 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/key_tracking_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './key_tracking_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Returns information about the resources in an org that are protected by a + * given Cloud KMS key via CMEK. + * @class + * @memberof v1 + */ +export class KeyTrackingServiceClient { + 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}; + keyTrackingServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of KeyTrackingServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 KeyTrackingServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof KeyTrackingServiceClient; + 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 { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' + ), + cryptoKeyVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}' + ), + importJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}' + ), + keyRingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}' + ), + organizationPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}' + ), + projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/protectedResourcesSummary' + ), + projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/protectedResourcesSummary' + ), + publicKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/publicKey' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + searchProtectedResources: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'protectedResources') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.kms.inventory.v1.KeyTrackingService', 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.keyTrackingServiceStub) { + return this.keyTrackingServiceStub; + } + + // Put together the "service stub" for + // google.cloud.kms.inventory.v1.KeyTrackingService. + this.keyTrackingServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.kms.inventory.v1.KeyTrackingService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.kms.inventory.v1.KeyTrackingService, + 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 keyTrackingServiceStubMethods = + ['getProtectedResourcesSummary', 'searchProtectedResources']; + for (const methodName of keyTrackingServiceStubMethods) { + const callPromise = this.keyTrackingServiceStub.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.keyTrackingServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'kmsinventory.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 'kmsinventory.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 -- + // ------------------- +/** + * Returns aggregate information about the resources protected by the given + * Cloud KMS {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. Only resources within + * the same Cloud organization as the key will be returned. The project that + * holds the key must be part of an organization in order for this call to + * succeed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.inventory.v1.ProtectedResourcesSummary|ProtectedResourcesSummary}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_tracking_service.get_protected_resources_summary.js + * region_tag:kmsinventory_v1_generated_KeyTrackingService_GetProtectedResourcesSummary_async + */ + getProtectedResourcesSummary( + request?: protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary, + protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest|undefined, {}|undefined + ]>; + getProtectedResourcesSummary( + request: protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary, + protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest|null|undefined, + {}|null|undefined>): void; + getProtectedResourcesSummary( + request: protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest, + callback: Callback< + protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary, + protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest|null|undefined, + {}|null|undefined>): void; + getProtectedResourcesSummary( + request?: protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary, + protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary, + protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary, + protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest|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.getProtectedResourcesSummary(request, options, callback); + } + + /** + * Returns metadata about the resources protected by the given Cloud KMS + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} in the given Cloud organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * Required. Resource name of the organization. + * Example: organizations/123 + * @param {string} request.cryptoKey + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. + * @param {number} request.pageSize + * The maximum number of resources to return. The service may return fewer + * than this value. + * If unspecified, at most 500 resources will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * @param {string} request.pageToken + * A page token, received from a previous + * {@link protos.google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources|KeyTrackingService.SearchProtectedResources} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link protos.google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources|KeyTrackingService.SearchProtectedResources} + * must match the call that provided the page token. + * @param {string[]} [request.resourceTypes] + * Optional. A list of resource types that this request searches for. If + * empty, it will search all the [trackable resource + * types](https://cloud.google.com/kms/docs/view-key-usage#tracked-resource-types). + * + * Regular expressions are also supported. For example: + * + * * `compute.googleapis.com.*` snapshots resources whose type starts + * with `compute.googleapis.com`. + * * `.*Image` snapshots resources whose type ends with `Image`. + * * `.*Image.*` snapshots resources whose type contains `Image`. + * + * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported resource type, an INVALID_ARGUMENT error will be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.kms.inventory.v1.ProtectedResource|ProtectedResource}. + * 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 `searchProtectedResourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + searchProtectedResources( + request?: protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.inventory.v1.IProtectedResource[], + protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest|null, + protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse + ]>; + searchProtectedResources( + request: protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, + protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse|null|undefined, + protos.google.cloud.kms.inventory.v1.IProtectedResource>): void; + searchProtectedResources( + request: protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, + callback: PaginationCallback< + protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, + protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse|null|undefined, + protos.google.cloud.kms.inventory.v1.IProtectedResource>): void; + searchProtectedResources( + request?: protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, + protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse|null|undefined, + protos.google.cloud.kms.inventory.v1.IProtectedResource>, + callback?: PaginationCallback< + protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, + protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse|null|undefined, + protos.google.cloud.kms.inventory.v1.IProtectedResource>): + Promise<[ + protos.google.cloud.kms.inventory.v1.IProtectedResource[], + protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest|null, + protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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({ + 'scope': request.scope ?? '', + }); + this.initialize(); + return this.innerApiCalls.searchProtectedResources(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.scope + * Required. Resource name of the organization. + * Example: organizations/123 + * @param {string} request.cryptoKey + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. + * @param {number} request.pageSize + * The maximum number of resources to return. The service may return fewer + * than this value. + * If unspecified, at most 500 resources will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * @param {string} request.pageToken + * A page token, received from a previous + * {@link protos.google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources|KeyTrackingService.SearchProtectedResources} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link protos.google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources|KeyTrackingService.SearchProtectedResources} + * must match the call that provided the page token. + * @param {string[]} [request.resourceTypes] + * Optional. A list of resource types that this request searches for. If + * empty, it will search all the [trackable resource + * types](https://cloud.google.com/kms/docs/view-key-usage#tracked-resource-types). + * + * Regular expressions are also supported. For example: + * + * * `compute.googleapis.com.*` snapshots resources whose type starts + * with `compute.googleapis.com`. + * * `.*Image` snapshots resources whose type ends with `Image`. + * * `.*Image.*` snapshots resources whose type contains `Image`. + * + * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported resource type, an INVALID_ARGUMENT error will be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.kms.inventory.v1.ProtectedResource|ProtectedResource} 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 `searchProtectedResourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + searchProtectedResourcesStream( + request?: protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, + 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({ + 'scope': request.scope ?? '', + }); + const defaultCallSettings = this._defaults['searchProtectedResources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchProtectedResources.createStream( + this.innerApiCalls.searchProtectedResources as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `searchProtectedResources`, 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.scope + * Required. Resource name of the organization. + * Example: organizations/123 + * @param {string} request.cryptoKey + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. + * @param {number} request.pageSize + * The maximum number of resources to return. The service may return fewer + * than this value. + * If unspecified, at most 500 resources will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * @param {string} request.pageToken + * A page token, received from a previous + * {@link protos.google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources|KeyTrackingService.SearchProtectedResources} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link protos.google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources|KeyTrackingService.SearchProtectedResources} + * must match the call that provided the page token. + * @param {string[]} [request.resourceTypes] + * Optional. A list of resource types that this request searches for. If + * empty, it will search all the [trackable resource + * types](https://cloud.google.com/kms/docs/view-key-usage#tracked-resource-types). + * + * Regular expressions are also supported. For example: + * + * * `compute.googleapis.com.*` snapshots resources whose type starts + * with `compute.googleapis.com`. + * * `.*Image` snapshots resources whose type ends with `Image`. + * * `.*Image.*` snapshots resources whose type contains `Image`. + * + * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported resource type, an INVALID_ARGUMENT error will be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.kms.inventory.v1.ProtectedResource|ProtectedResource}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_tracking_service.search_protected_resources.js + * region_tag:kmsinventory_v1_generated_KeyTrackingService_SearchProtectedResources_async + */ + searchProtectedResourcesAsync( + request?: protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, + 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({ + 'scope': request.scope ?? '', + }); + const defaultCallSettings = this._defaults['searchProtectedResources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchProtectedResources.asyncIterate( + this.innerApiCalls['searchProtectedResources'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified cryptoKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @returns {string} Resource name string. + */ + cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { + return this.pathTemplates.cryptoKeyPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + }); + } + + /** + * Parse the project from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; + } + + /** + * Parse the location from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; + } + + /** + * Parse the key_ring from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; + } + + /** + * Parse the crypto_key from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; + } + + /** + * Return a fully-qualified cryptoKeyVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @param {string} crypto_key_version + * @returns {string} Resource name string. + */ + cryptoKeyVersionPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + crypto_key_version: cryptoKeyVersion, + }); + } + + /** + * Parse the project from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).project; + } + + /** + * Parse the location from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).location; + } + + /** + * Parse the key_ring from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).key_ring; + } + + /** + * Parse the crypto_key from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).crypto_key; + } + + /** + * Parse the crypto_key_version from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the crypto_key_version. + */ + matchCryptoKeyVersionFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).crypto_key_version; + } + + /** + * Return a fully-qualified importJob resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} import_job + * @returns {string} Resource name string. + */ + importJobPath(project:string,location:string,keyRing:string,importJob:string) { + return this.pathTemplates.importJobPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + import_job: importJob, + }); + } + + /** + * Parse the project from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the project. + */ + matchProjectFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).project; + } + + /** + * Parse the location from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the location. + */ + matchLocationFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).location; + } + + /** + * Parse the key_ring from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).key_ring; + } + + /** + * Parse the import_job from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the import_job. + */ + matchImportJobFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).import_job; + } + + /** + * Return a fully-qualified keyRing resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @returns {string} Resource name string. + */ + keyRingPath(project:string,location:string,keyRing:string) { + return this.pathTemplates.keyRingPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + }); + } + + /** + * Parse the project from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the project. + */ + matchProjectFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).project; + } + + /** + * Parse the location from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the location. + */ + matchLocationFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).location; + } + + /** + * Parse the key_ring from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).key_ring; + } + + /** + * Return a fully-qualified organization resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationPath(organization:string) { + return this.pathTemplates.organizationPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from Organization resource. + * + * @param {string} organizationName + * A fully-qualified path representing Organization resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationName(organizationName: string) { + return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; + } + + /** + * Return a fully-qualified projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @param {string} crypto_key_version + * @returns {string} Resource name string. + */ + projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + crypto_key_version: cryptoKeyVersion, + }); + } + + /** + * Parse the project from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).project; + } + + /** + * Parse the location from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).location; + } + + /** + * Parse the key_ring from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).key_ring; + } + + /** + * Parse the crypto_key from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).crypto_key; + } + + /** + * Parse the crypto_key_version from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. + * @returns {string} A string representing the crypto_key_version. + */ + matchCryptoKeyVersionFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).crypto_key_version; + } + + /** + * Return a fully-qualified projectLocationKeyRingCryptoKeyProtectedResourcesSummary resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @returns {string} Resource name string. + */ + projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPath(project:string,location:string,keyRing:string,cryptoKey:string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + }); + } + + /** + * Parse the project from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName).project; + } + + /** + * Parse the location from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName).location; + } + + /** + * Parse the key_ring from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName).key_ring; + } + + /** + * Parse the crypto_key from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource. + * + * @param {string} projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName + * A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string) { + return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName).crypto_key; + } + + /** + * Return a fully-qualified publicKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @param {string} crypto_key_version + * @returns {string} Resource name string. + */ + publicKeyPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { + return this.pathTemplates.publicKeyPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + crypto_key_version: cryptoKeyVersion, + }); + } + + /** + * Parse the project from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).project; + } + + /** + * Parse the location from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).location; + } + + /** + * Parse the key_ring from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).key_ring; + } + + /** + * Parse the crypto_key from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).crypto_key; + } + + /** + * Parse the crypto_key_version from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the crypto_key_version. + */ + matchCryptoKeyVersionFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).crypto_key_version; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.keyTrackingServiceStub && !this._terminated) { + return this.keyTrackingServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_client_config.json b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_client_config.json new file mode 100644 index 00000000000..c3128be608e --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_client_config.json @@ -0,0 +1,36 @@ +{ + "interfaces": { + "google.cloud.kms.inventory.v1.KeyTrackingService": { + "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": { + "GetProtectedResourcesSummary": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SearchProtectedResources": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_proto_list.json b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_proto_list.json new file mode 100644 index 00000000000..c3534b31a62 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/kms/inventory/v1/key_dashboard_service.proto", + "../../protos/google/cloud/kms/inventory/v1/key_tracking_service.proto", + "../../protos/google/cloud/kms/v1/resources.proto" +] diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-kms-inventory/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..886bbe354fa --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/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 inventory = require('@google-cloud/kms-inventory'); + +function main() { + const keyDashboardServiceClient = new inventory.KeyDashboardServiceClient(); + const keyTrackingServiceClient = new inventory.KeyTrackingServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-kms-inventory/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..102f3318ffb --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/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 {KeyDashboardServiceClient, KeyTrackingServiceClient} from '@google-cloud/kms-inventory'; + +// check that the client class type name can be used +function doStuffWithKeyDashboardServiceClient(client: KeyDashboardServiceClient) { + client.close(); +} +function doStuffWithKeyTrackingServiceClient(client: KeyTrackingServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const keyDashboardServiceClient = new KeyDashboardServiceClient(); + doStuffWithKeyDashboardServiceClient(keyDashboardServiceClient); + // check that the client instance can be created + const keyTrackingServiceClient = new KeyTrackingServiceClient(); + doStuffWithKeyTrackingServiceClient(keyTrackingServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/system-test/install.ts b/owl-bot-staging/google-cloud-kms-inventory/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/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-kms-inventory/v1/test/gapic_key_dashboard_service_v1.ts b/owl-bot-staging/google-cloud-kms-inventory/v1/test/gapic_key_dashboard_service_v1.ts new file mode 100644 index 00000000000..1f358dc742a --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/test/gapic_key_dashboard_service_v1.ts @@ -0,0 +1,869 @@ +// 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 keydashboardserviceModule 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.KeyDashboardServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = keydashboardserviceModule.v1.KeyDashboardServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = keydashboardserviceModule.v1.KeyDashboardServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = keydashboardserviceModule.v1.KeyDashboardServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.keyDashboardServiceStub, undefined); + await client.initialize(); + assert(client.keyDashboardServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.keyDashboardServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.keyDashboardServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + 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 keydashboardserviceModule.v1.KeyDashboardServiceClient({ + 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('listCryptoKeys', () => { + it('invokes listCryptoKeys without error', async () => { + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.ListCryptoKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + ]; + client.innerApiCalls.listCryptoKeys = stubSimpleCall(expectedResponse); + const [response] = await client.listCryptoKeys(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCryptoKeys without error using callback', async () => { + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.ListCryptoKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + ]; + client.innerApiCalls.listCryptoKeys = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCryptoKeys( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCryptoKeys with error', async () => { + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.ListCryptoKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCryptoKeys = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCryptoKeys(request), expectedError); + const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCryptoKeysStream without error', async () => { + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.ListCryptoKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + ]; + client.descriptors.page.listCryptoKeys.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCryptoKeysStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.CryptoKey[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKey) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listCryptoKeys.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCryptoKeys, request)); + assert( + (client.descriptors.page.listCryptoKeys.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listCryptoKeysStream with error', async () => { + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.ListCryptoKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCryptoKeys.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCryptoKeysStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.CryptoKey[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKey) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCryptoKeys.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCryptoKeys, request)); + assert( + (client.descriptors.page.listCryptoKeys.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCryptoKeys without error', async () => { + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.ListCryptoKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + ]; + client.descriptors.page.listCryptoKeys.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.kms.v1.ICryptoKey[] = []; + const iterable = client.listCryptoKeysAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCryptoKeys with error', async () => { + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.ListCryptoKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCryptoKeys.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCryptoKeysAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.kms.v1.ICryptoKey[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('cryptoKey', () => { + const fakePath = "/rendered/path/cryptoKey"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + }; + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.cryptoKeyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('cryptoKeyPath', () => { + const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCryptoKeyName', () => { + const result = client.matchProjectFromCryptoKeyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCryptoKeyName', () => { + const result = client.matchLocationFromCryptoKeyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromCryptoKeyName', () => { + const result = client.matchKeyRingFromCryptoKeyName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromCryptoKeyName', () => { + const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('cryptoKeyVersion', () => { + const fakePath = "/rendered/path/cryptoKeyVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + crypto_key_version: "cryptoKeyVersionValue", + }; + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.cryptoKeyVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('cryptoKeyVersionPath', () => { + const result = client.cryptoKeyVersionPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCryptoKeyVersionName', () => { + const result = client.matchProjectFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCryptoKeyVersionName', () => { + const result = client.matchLocationFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromCryptoKeyVersionName', () => { + const result = client.matchKeyRingFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromCryptoKeyVersionName', () => { + const result = client.matchCryptoKeyFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyVersionFromCryptoKeyVersionName', () => { + const result = client.matchCryptoKeyVersionFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "cryptoKeyVersionValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('importJob', () => { + const fakePath = "/rendered/path/importJob"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + import_job: "importJobValue", + }; + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.importJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.importJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('importJobPath', () => { + const result = client.importJobPath("projectValue", "locationValue", "keyRingValue", "importJobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.importJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromImportJobName', () => { + const result = client.matchProjectFromImportJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromImportJobName', () => { + const result = client.matchLocationFromImportJobName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromImportJobName', () => { + const result = client.matchKeyRingFromImportJobName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchImportJobFromImportJobName', () => { + const result = client.matchImportJobFromImportJobName(fakePath); + assert.strictEqual(result, "importJobValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('keyRing', () => { + const fakePath = "/rendered/path/keyRing"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + }; + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.keyRingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.keyRingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('keyRingPath', () => { + const result = client.keyRingPath("projectValue", "locationValue", "keyRingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.keyRingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromKeyRingName', () => { + const result = client.matchProjectFromKeyRingName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromKeyRingName', () => { + const result = client.matchLocationFromKeyRingName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromKeyRingName', () => { + const result = client.matchKeyRingFromKeyRingName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + 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('projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary', () => { + const fakePath = "/rendered/path/projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + crypto_key_version: "cryptoKeyVersionValue", + }; + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPath', () => { + const result = client.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { + const result = client.matchProjectFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { + const result = client.matchLocationFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { + const result = client.matchKeyRingFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { + const result = client.matchCryptoKeyFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyVersionFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { + const result = client.matchCryptoKeyVersionFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "cryptoKeyVersionValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKeyRingCryptoKeyProtectedResourcesSummary', () => { + const fakePath = "/rendered/path/projectLocationKeyRingCryptoKeyProtectedResourcesSummary"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + }; + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPath', () => { + const result = client.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName', () => { + const result = client.matchProjectFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName', () => { + const result = client.matchLocationFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName', () => { + const result = client.matchKeyRingFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName', () => { + const result = client.matchCryptoKeyFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('publicKey', () => { + const fakePath = "/rendered/path/publicKey"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + crypto_key_version: "cryptoKeyVersionValue", + }; + const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.publicKeyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.publicKeyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('publicKeyPath', () => { + const result = client.publicKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.publicKeyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromPublicKeyName', () => { + const result = client.matchProjectFromPublicKeyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromPublicKeyName', () => { + const result = client.matchLocationFromPublicKeyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromPublicKeyName', () => { + const result = client.matchKeyRingFromPublicKeyName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromPublicKeyName', () => { + const result = client.matchCryptoKeyFromPublicKeyName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyVersionFromPublicKeyName', () => { + const result = client.matchCryptoKeyVersionFromPublicKeyName(fakePath); + assert.strictEqual(result, "cryptoKeyVersionValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/test/gapic_key_tracking_service_v1.ts b/owl-bot-staging/google-cloud-kms-inventory/v1/test/gapic_key_tracking_service_v1.ts new file mode 100644 index 00000000000..3a0b697d7a7 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/v1/test/gapic_key_tracking_service_v1.ts @@ -0,0 +1,977 @@ +// 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 keytrackingserviceModule 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.KeyTrackingServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = keytrackingserviceModule.v1.KeyTrackingServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = keytrackingserviceModule.v1.KeyTrackingServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = keytrackingserviceModule.v1.KeyTrackingServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.keyTrackingServiceStub, undefined); + await client.initialize(); + assert(client.keyTrackingServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.keyTrackingServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.keyTrackingServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + 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 keytrackingserviceModule.v1.KeyTrackingServiceClient({ + 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('getProtectedResourcesSummary', () => { + it('invokes getProtectedResourcesSummary without error', async () => { + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.ProtectedResourcesSummary() + ); + client.innerApiCalls.getProtectedResourcesSummary = stubSimpleCall(expectedResponse); + const [response] = await client.getProtectedResourcesSummary(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getProtectedResourcesSummary as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getProtectedResourcesSummary as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getProtectedResourcesSummary without error using callback', async () => { + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.ProtectedResourcesSummary() + ); + client.innerApiCalls.getProtectedResourcesSummary = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getProtectedResourcesSummary( + request, + (err?: Error|null, result?: protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getProtectedResourcesSummary as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getProtectedResourcesSummary as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getProtectedResourcesSummary with error', async () => { + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getProtectedResourcesSummary = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getProtectedResourcesSummary(request), expectedError); + const actualRequest = (client.innerApiCalls.getProtectedResourcesSummary as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getProtectedResourcesSummary as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getProtectedResourcesSummary with closed client', async () => { + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getProtectedResourcesSummary(request), expectedError); + }); + }); + + describe('searchProtectedResources', () => { + it('invokes searchProtectedResources without error', async () => { + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), + generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), + generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), + ]; + client.innerApiCalls.searchProtectedResources = stubSimpleCall(expectedResponse); + const [response] = await client.searchProtectedResources(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.searchProtectedResources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchProtectedResources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchProtectedResources without error using callback', async () => { + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), + generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), + generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), + ]; + client.innerApiCalls.searchProtectedResources = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchProtectedResources( + request, + (err?: Error|null, result?: protos.google.cloud.kms.inventory.v1.IProtectedResource[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.searchProtectedResources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchProtectedResources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchProtectedResources with error', async () => { + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.searchProtectedResources = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchProtectedResources(request), expectedError); + const actualRequest = (client.innerApiCalls.searchProtectedResources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchProtectedResources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchProtectedResourcesStream without error', async () => { + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), + generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), + generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), + ]; + client.descriptors.page.searchProtectedResources.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.searchProtectedResourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.inventory.v1.ProtectedResource[] = []; + stream.on('data', (response: protos.google.cloud.kms.inventory.v1.ProtectedResource) => { + 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.searchProtectedResources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchProtectedResources, request)); + assert( + (client.descriptors.page.searchProtectedResources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes searchProtectedResourcesStream with error', async () => { + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchProtectedResources.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.searchProtectedResourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.inventory.v1.ProtectedResource[] = []; + stream.on('data', (response: protos.google.cloud.kms.inventory.v1.ProtectedResource) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.searchProtectedResources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchProtectedResources, request)); + assert( + (client.descriptors.page.searchProtectedResources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchProtectedResources without error', async () => { + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), + generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), + generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), + ]; + client.descriptors.page.searchProtectedResources.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.kms.inventory.v1.IProtectedResource[] = []; + const iterable = client.searchProtectedResourcesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.searchProtectedResources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.searchProtectedResources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchProtectedResources with error', async () => { + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchProtectedResources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.searchProtectedResourcesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.kms.inventory.v1.IProtectedResource[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.searchProtectedResources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.searchProtectedResources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('cryptoKey', () => { + const fakePath = "/rendered/path/cryptoKey"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + }; + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.cryptoKeyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('cryptoKeyPath', () => { + const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCryptoKeyName', () => { + const result = client.matchProjectFromCryptoKeyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCryptoKeyName', () => { + const result = client.matchLocationFromCryptoKeyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromCryptoKeyName', () => { + const result = client.matchKeyRingFromCryptoKeyName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromCryptoKeyName', () => { + const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('cryptoKeyVersion', () => { + const fakePath = "/rendered/path/cryptoKeyVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + crypto_key_version: "cryptoKeyVersionValue", + }; + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.cryptoKeyVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('cryptoKeyVersionPath', () => { + const result = client.cryptoKeyVersionPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCryptoKeyVersionName', () => { + const result = client.matchProjectFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCryptoKeyVersionName', () => { + const result = client.matchLocationFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromCryptoKeyVersionName', () => { + const result = client.matchKeyRingFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromCryptoKeyVersionName', () => { + const result = client.matchCryptoKeyFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyVersionFromCryptoKeyVersionName', () => { + const result = client.matchCryptoKeyVersionFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "cryptoKeyVersionValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('importJob', () => { + const fakePath = "/rendered/path/importJob"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + import_job: "importJobValue", + }; + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.importJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.importJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('importJobPath', () => { + const result = client.importJobPath("projectValue", "locationValue", "keyRingValue", "importJobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.importJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromImportJobName', () => { + const result = client.matchProjectFromImportJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromImportJobName', () => { + const result = client.matchLocationFromImportJobName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromImportJobName', () => { + const result = client.matchKeyRingFromImportJobName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchImportJobFromImportJobName', () => { + const result = client.matchImportJobFromImportJobName(fakePath); + assert.strictEqual(result, "importJobValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('keyRing', () => { + const fakePath = "/rendered/path/keyRing"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + }; + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.keyRingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.keyRingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('keyRingPath', () => { + const result = client.keyRingPath("projectValue", "locationValue", "keyRingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.keyRingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromKeyRingName', () => { + const result = client.matchProjectFromKeyRingName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromKeyRingName', () => { + const result = client.matchLocationFromKeyRingName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromKeyRingName', () => { + const result = client.matchKeyRingFromKeyRingName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organization', () => { + const fakePath = "/rendered/path/organization"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationPath', () => { + const result = client.organizationPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationName', () => { + const result = client.matchOrganizationFromOrganizationName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary', () => { + const fakePath = "/rendered/path/projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + crypto_key_version: "cryptoKeyVersionValue", + }; + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPath', () => { + const result = client.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { + const result = client.matchProjectFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { + const result = client.matchLocationFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { + const result = client.matchKeyRingFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { + const result = client.matchCryptoKeyFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyVersionFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { + const result = client.matchCryptoKeyVersionFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "cryptoKeyVersionValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKeyRingCryptoKeyProtectedResourcesSummary', () => { + const fakePath = "/rendered/path/projectLocationKeyRingCryptoKeyProtectedResourcesSummary"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + }; + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPath', () => { + const result = client.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName', () => { + const result = client.matchProjectFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName', () => { + const result = client.matchLocationFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName', () => { + const result = client.matchKeyRingFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName', () => { + const result = client.matchCryptoKeyFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('publicKey', () => { + const fakePath = "/rendered/path/publicKey"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + crypto_key_version: "cryptoKeyVersionValue", + }; + const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.publicKeyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.publicKeyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('publicKeyPath', () => { + const result = client.publicKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.publicKeyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromPublicKeyName', () => { + const result = client.matchProjectFromPublicKeyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromPublicKeyName', () => { + const result = client.matchLocationFromPublicKeyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromPublicKeyName', () => { + const result = client.matchKeyRingFromPublicKeyName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromPublicKeyName', () => { + const result = client.matchCryptoKeyFromPublicKeyName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyVersionFromPublicKeyName', () => { + const result = client.matchCryptoKeyVersionFromPublicKeyName(fakePath); + assert.strictEqual(result, "cryptoKeyVersionValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/tsconfig.json b/owl-bot-staging/google-cloud-kms-inventory/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/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-kms-inventory/v1/webpack.config.js b/owl-bot-staging/google-cloud-kms-inventory/v1/webpack.config.js new file mode 100644 index 00000000000..7e4c2732db0 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms-inventory/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: 'KeyDashboardService', + filename: './key-dashboard-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-kms/v1/.eslintignore b/owl-bot-staging/google-cloud-kms/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-kms/v1/.eslintrc.json b/owl-bot-staging/google-cloud-kms/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-kms/v1/.gitignore b/owl-bot-staging/google-cloud-kms/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/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-kms/v1/.jsdoc.js b/owl-bot-staging/google-cloud-kms/v1/.jsdoc.js new file mode 100644 index 00000000000..ff4782d58cb --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/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/kms', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-kms/v1/.mocharc.js b/owl-bot-staging/google-cloud-kms/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/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-kms/v1/.prettierrc.js b/owl-bot-staging/google-cloud-kms/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/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-kms/v1/README.md b/owl-bot-staging/google-cloud-kms/v1/README.md new file mode 100644 index 00000000000..ea8e413e5ae --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/README.md @@ -0,0 +1 @@ +Kms: Nodejs Client diff --git a/owl-bot-staging/google-cloud-kms/v1/package.json b/owl-bot-staging/google-cloud-kms/v1/package.json new file mode 100644 index 00000000000..38af1cff202 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/package.json @@ -0,0 +1,59 @@ +{ + "name": "@google-cloud/kms", + "version": "0.1.0", + "description": "Kms client for Node.js", + "repository": "googleapis/nodejs-kms", + "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 kms", + "kms", + "ekm service", + "key management service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/ekm_service.proto b/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/ekm_service.proto new file mode 100644 index 00000000000..da3056543db --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/ekm_service.proto @@ -0,0 +1,451 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.kms.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Kms.V1"; +option go_package = "cloud.google.com/go/kms/apiv1/kmspb;kmspb"; +option java_multiple_files = true; +option java_outer_classname = "EkmServiceProto"; +option java_package = "com.google.cloud.kms.v1"; +option php_namespace = "Google\\Cloud\\Kms\\V1"; +option (google.api.resource_definition) = { + type: "servicedirectory.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}" +}; + +// Google Cloud Key Management EKM Service +// +// Manages external cryptographic keys and operations using those keys. +// Implements a REST model with the following objects: +// * [EkmConnection][google.cloud.kms.v1.EkmConnection] +service EkmService { + option (google.api.default_host) = "cloudkms.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloudkms"; + + // Lists [EkmConnections][google.cloud.kms.v1.EkmConnection]. + rpc ListEkmConnections(ListEkmConnectionsRequest) + returns (ListEkmConnectionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/ekmConnections" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns metadata for a given + // [EkmConnection][google.cloud.kms.v1.EkmConnection]. + rpc GetEkmConnection(GetEkmConnectionRequest) returns (EkmConnection) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/ekmConnections/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new [EkmConnection][google.cloud.kms.v1.EkmConnection] in a given + // Project and Location. + rpc CreateEkmConnection(CreateEkmConnectionRequest) returns (EkmConnection) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/ekmConnections" + body: "ekm_connection" + }; + option (google.api.method_signature) = + "parent,ekm_connection_id,ekm_connection"; + } + + // Updates an [EkmConnection][google.cloud.kms.v1.EkmConnection]'s metadata. + rpc UpdateEkmConnection(UpdateEkmConnectionRequest) returns (EkmConnection) { + option (google.api.http) = { + patch: "/v1/{ekm_connection.name=projects/*/locations/*/ekmConnections/*}" + body: "ekm_connection" + }; + option (google.api.method_signature) = "ekm_connection,update_mask"; + } + + // Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource + // for a given project and location. + rpc GetEkmConfig(GetEkmConfigRequest) returns (EkmConfig) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/ekmConfig}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource + // for a given project and location. + rpc UpdateEkmConfig(UpdateEkmConfigRequest) returns (EkmConfig) { + option (google.api.http) = { + patch: "/v1/{ekm_config.name=projects/*/locations/*/ekmConfig}" + body: "ekm_config" + }; + option (google.api.method_signature) = "ekm_config,update_mask"; + } + + // Verifies that Cloud KMS can successfully connect to the external key + // manager specified by an [EkmConnection][google.cloud.kms.v1.EkmConnection]. + // If there is an error connecting to the EKM, this method returns a + // FAILED_PRECONDITION status containing structured information as described + // at https://cloud.google.com/kms/docs/reference/ekm_errors. + rpc VerifyConnectivity(VerifyConnectivityRequest) + returns (VerifyConnectivityResponse) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/ekmConnections/*}:verifyConnectivity" + }; + option (google.api.method_signature) = "name"; + } +} + +// Request message for +// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections]. +message ListEkmConnectionsRequest { + // Required. The resource name of the location associated with the + // [EkmConnections][google.cloud.kms.v1.EkmConnection] to list, in the format + // `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Optional limit on the number of + // [EkmConnections][google.cloud.kms.v1.EkmConnection] to include in the + // response. Further [EkmConnections][google.cloud.kms.v1.EkmConnection] can + // subsequently be obtained by including the + // [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token] + // in a subsequent request. If unspecified, the server will pick an + // appropriate default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional pagination token, returned earlier via + // [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only include resources that match the filter in the response. For + // more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. If not specified, the + // results will be sorted in the default order. For more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections]. +message ListEkmConnectionsResponse { + // The list of [EkmConnections][google.cloud.kms.v1.EkmConnection]. + repeated EkmConnection ekm_connections = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListEkmConnectionsRequest.page_token][google.cloud.kms.v1.ListEkmConnectionsRequest.page_token] + // to retrieve the next page of results. + string next_page_token = 2; + + // The total number of [EkmConnections][google.cloud.kms.v1.EkmConnection] + // that matched the query. + int32 total_size = 3; +} + +// Request message for +// [EkmService.GetEkmConnection][google.cloud.kms.v1.EkmService.GetEkmConnection]. +message GetEkmConnectionRequest { + // Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the + // [EkmConnection][google.cloud.kms.v1.EkmConnection] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/EkmConnection" + } + ]; +} + +// Request message for +// [EkmService.CreateEkmConnection][google.cloud.kms.v1.EkmService.CreateEkmConnection]. +message CreateEkmConnectionRequest { + // Required. The resource name of the location associated with the + // [EkmConnection][google.cloud.kms.v1.EkmConnection], in the format + // `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. It must be unique within a location and match the regular + // expression `[a-zA-Z0-9_-]{1,63}`. + string ekm_connection_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. An [EkmConnection][google.cloud.kms.v1.EkmConnection] with + // initial field values. + EkmConnection ekm_connection = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [EkmService.UpdateEkmConnection][google.cloud.kms.v1.EkmService.UpdateEkmConnection]. +message UpdateEkmConnectionRequest { + // Required. [EkmConnection][google.cloud.kms.v1.EkmConnection] with updated + // values. + EkmConnection ekm_connection = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. List of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [EkmService.GetEkmConfig][google.cloud.kms.v1.EkmService.GetEkmConfig]. +message GetEkmConfigRequest { + // Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the + // [EkmConfig][google.cloud.kms.v1.EkmConfig] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/EkmConfig" + } + ]; +} + +// Request message for +// [EkmService.UpdateEkmConfig][google.cloud.kms.v1.EkmService.UpdateEkmConfig]. +message UpdateEkmConfigRequest { + // Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values. + EkmConfig ekm_config = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. List of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// A [Certificate][google.cloud.kms.v1.Certificate] represents an X.509 +// certificate used to authenticate HTTPS connections to EKM replicas. +message Certificate { + // Required. The raw certificate bytes in DER format. + bytes raw_der = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. True if the certificate was parsed successfully. + bool parsed = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The issuer distinguished name in RFC 2253 format. Only present + // if [parsed][google.cloud.kms.v1.Certificate.parsed] is true. + string issuer = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The subject distinguished name in RFC 2253 format. Only + // present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true. + string subject = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The subject Alternative DNS names. Only present if + // [parsed][google.cloud.kms.v1.Certificate.parsed] is true. + repeated string subject_alternative_dns_names = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The certificate is not valid before this time. Only present if + // [parsed][google.cloud.kms.v1.Certificate.parsed] is true. + google.protobuf.Timestamp not_before_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The certificate is not valid after this time. Only present if + // [parsed][google.cloud.kms.v1.Certificate.parsed] is true. + google.protobuf.Timestamp not_after_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The certificate serial number as a hex string. Only present if + // [parsed][google.cloud.kms.v1.Certificate.parsed] is true. + string serial_number = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The SHA-256 certificate fingerprint as a hex string. Only + // present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true. + string sha256_fingerprint = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// An [EkmConnection][google.cloud.kms.v1.EkmConnection] represents an +// individual EKM connection. It can be used for creating +// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and +// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a +// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of +// [EXTERNAL_VPC][CryptoKeyVersion.ProtectionLevel.EXTERNAL_VPC], as well as +// performing cryptographic operations using keys created within the +// [EkmConnection][google.cloud.kms.v1.EkmConnection]. +message EkmConnection { + option (google.api.resource) = { + type: "cloudkms.googleapis.com/EkmConnection" + pattern: "projects/{project}/locations/{location}/ekmConnections/{ekm_connection}" + }; + + // A [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] + // represents an EKM replica that can be reached within an + // [EkmConnection][google.cloud.kms.v1.EkmConnection]. + message ServiceResolver { + // Required. The resource name of the Service Directory service pointing to + // an EKM replica, in the format + // `projects/*/locations/*/namespaces/*/services/*`. + string service_directory_service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "servicedirectory.googleapis.com/Service" + } + ]; + + // Optional. The filter applied to the endpoints of the resolved service. If + // no filter is specified, all endpoints will be considered. An endpoint + // will be chosen arbitrarily from the filtered list for each request. + // + // For endpoint filter syntax and examples, see + // https://cloud.google.com/service-directory/docs/reference/rpc/google.cloud.servicedirectory.v1#resolveservicerequest. + string endpoint_filter = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The hostname of the EKM replica used at TLS and HTTP layers. + string hostname = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. A list of leaf server certificates used to authenticate HTTPS + // connections to the EKM replica. Currently, a maximum of 10 + // [Certificate][google.cloud.kms.v1.Certificate] is supported. + repeated Certificate server_certificates = 4 + [(google.api.field_behavior) = REQUIRED]; + } + + // [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] + // describes who can perform control plane cryptographic operations using this + // [EkmConnection][google.cloud.kms.v1.EkmConnection]. + enum KeyManagementMode { + // Not specified. + KEY_MANAGEMENT_MODE_UNSPECIFIED = 0; + + // EKM-side key management operations on + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this + // [EkmConnection][google.cloud.kms.v1.EkmConnection] must be initiated from + // the EKM directly and cannot be performed from Cloud KMS. This means that: + // * When creating a + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] associated with + // this + // [EkmConnection][google.cloud.kms.v1.EkmConnection], the caller must + // supply the key path of pre-existing external key material that will be + // linked to the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + // * Destruction of external key material cannot be requested via the + // Cloud KMS API and must be performed directly in the EKM. + // * Automatic rotation of key material is not supported. + MANUAL = 1; + + // All [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this + // [EkmConnection][google.cloud.kms.v1.EkmConnection] use EKM-side key + // management operations initiated from Cloud KMS. This means that: + // * When a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + // associated with this [EkmConnection][google.cloud.kms.v1.EkmConnection] + // is + // created, the EKM automatically generates new key material and a new + // key path. The caller cannot supply the key path of pre-existing + // external key material. + // * Destruction of external key material associated with this + // [EkmConnection][google.cloud.kms.v1.EkmConnection] can be requested by + // calling [DestroyCryptoKeyVersion][EkmService.DestroyCryptoKeyVersion]. + // * Automatic rotation of key material is supported. + CLOUD_KMS = 2; + } + + // Output only. The resource name for the + // [EkmConnection][google.cloud.kms.v1.EkmConnection] in the format + // `projects/*/locations/*/ekmConnections/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which the + // [EkmConnection][google.cloud.kms.v1.EkmConnection] was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A list of + // [ServiceResolvers][google.cloud.kms.v1.EkmConnection.ServiceResolver] where + // the EKM can be reached. There should be one ServiceResolver per EKM + // replica. Currently, only a single + // [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] is + // supported. + repeated ServiceResolver service_resolvers = 3; + + // Optional. Etag of the currently stored + // [EkmConnection][google.cloud.kms.v1.EkmConnection]. + string etag = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Describes who can perform control plane operations on the EKM. If + // unset, this defaults to + // [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL]. + KeyManagementMode key_management_mode = 6 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Identifies the EKM Crypto Space that this + // [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This + // field is required if + // [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is + // [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS]. + string crypto_space_path = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// An [EkmConfig][google.cloud.kms.v1.EkmConfig] is a singleton resource that +// represents configuration parameters that apply to all +// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and +// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a +// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of +// [EXTERNAL_VPC][CryptoKeyVersion.ProtectionLevel.EXTERNAL_VPC] in a given +// project and location. +message EkmConfig { + option (google.api.resource) = { + type: "cloudkms.googleapis.com/EkmConfig" + pattern: "projects/{project}/locations/{location}/ekmConfig" + }; + + // Output only. The resource name for the + // [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format + // `projects/*/locations/*/ekmConfig`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Resource name of the default + // [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to + // the empty string removes the default. + string default_ekm_connection = 2 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/EkmConnection" + } + ]; +} + +// Request message for +// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity]. +message VerifyConnectivityRequest { + // Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the + // [EkmConnection][google.cloud.kms.v1.EkmConnection] to verify. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/EkmConnection" + } + ]; +} + +// Response message for +// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity]. +message VerifyConnectivityResponse {} diff --git a/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/resources.proto b/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/resources.proto new file mode 100644 index 00000000000..fb4e6534a69 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/resources.proto @@ -0,0 +1,920 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.kms.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Kms.V1"; +option go_package = "cloud.google.com/go/kms/apiv1/kmspb;kmspb"; +option java_multiple_files = true; +option java_outer_classname = "KmsResourcesProto"; +option java_package = "com.google.cloud.kms.v1"; +option php_namespace = "Google\\Cloud\\Kms\\V1"; + +// A [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of +// [CryptoKeys][google.cloud.kms.v1.CryptoKey]. +message KeyRing { + option (google.api.resource) = { + type: "cloudkms.googleapis.com/KeyRing" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}" + }; + + // Output only. The resource name for the + // [KeyRing][google.cloud.kms.v1.KeyRing] in the format + // `projects/*/locations/*/keyRings/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] + // was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that +// can be used for cryptographic operations. +// +// A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of zero or more +// [versions][google.cloud.kms.v1.CryptoKeyVersion], which represent the actual +// key material used in cryptographic operations. +message CryptoKey { + option (google.api.resource) = { + type: "cloudkms.googleapis.com/CryptoKey" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" + }; + + // [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] + // describes the cryptographic capabilities of a + // [CryptoKey][google.cloud.kms.v1.CryptoKey]. A given key can only be used + // for the operations allowed by its purpose. For more information, see [Key + // purposes](https://cloud.google.com/kms/docs/algorithms#key_purposes). + enum CryptoKeyPurpose { + // Not specified. + CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0; + + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used + // with [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and + // [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. + ENCRYPT_DECRYPT = 1; + + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used + // with + // [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign] + // and + // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. + ASYMMETRIC_SIGN = 5; + + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used + // with + // [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt] + // and + // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. + ASYMMETRIC_DECRYPT = 6; + + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used + // with [RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt] + // and [RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt]. + // This purpose is meant to be used for interoperable symmetric + // encryption and does not support automatic CryptoKey rotation. + RAW_ENCRYPT_DECRYPT = 7; + + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used + // with [MacSign][google.cloud.kms.v1.KeyManagementService.MacSign]. + MAC = 9; + } + + // Output only. The resource name for this + // [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format + // `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A copy of the "primary" + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used + // by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this + // [CryptoKey][google.cloud.kms.v1.CryptoKey] is given in + // [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name]. + // + // The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be + // updated via + // [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]. + // + // Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose] + // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT] + // may have a primary. For other keys, this field will be omitted. + CryptoKeyVersion primary = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. The immutable purpose of this + // [CryptoKey][google.cloud.kms.v1.CryptoKey]. + CryptoKeyPurpose purpose = 3 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time at which this + // [CryptoKey][google.cloud.kms.v1.CryptoKey] was created. + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], + // the Key Management Service will automatically: + // + // 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. + // 2. Mark the new version as primary. + // + // Key rotations performed manually via + // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] + // and + // [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion] + // do not affect + // [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]. + // + // Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose] + // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT] + // support automatic rotation. For other keys, this field must be omitted. + google.protobuf.Timestamp next_rotation_time = 7; + + // Controls the rate of automatic rotation. + oneof rotation_schedule { + // [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] + // will be advanced by this period when the service automatically rotates a + // key. Must be at least 24 hours and at most 876,000 hours. + // + // If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is + // set, + // [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] + // must also be set. + // + // Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose] + // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT] + // support automatic rotation. For other keys, this field must be omitted. + google.protobuf.Duration rotation_period = 8; + } + + // A template describing settings for new + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] instances. The + // properties of new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + // instances created by either + // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] + // or auto-rotation are controlled by this template. + CryptoKeyVersionTemplate version_template = 11; + + // Labels with user-defined metadata. For more information, see + // [Labeling Keys](https://cloud.google.com/kms/docs/labeling-keys). + map labels = 10; + + // Immutable. Whether this key may contain imported versions only. + bool import_only = 13 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. The period of time that versions of this key spend in the + // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] + // state before transitioning to + // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]. + // If not specified at creation time, the default duration is 24 hours. + google.protobuf.Duration destroy_scheduled_duration = 14 + [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. The resource name of the backend environment where the key + // material for all [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] + // associated with this [CryptoKey][google.cloud.kms.v1.CryptoKey] reside and + // where all related cryptographic operations are performed. Only applicable + // if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] have a + // [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of + // [EXTERNAL_VPC][CryptoKeyVersion.ProtectionLevel.EXTERNAL_VPC], with the + // resource name in the format `projects/*/locations/*/ekmConnections/*`. + // Note, this list is non-exhaustive and may apply to additional + // [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel] in the future. + string crypto_key_backend = 15 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { type: "*" } + ]; +} + +// A [CryptoKeyVersionTemplate][google.cloud.kms.v1.CryptoKeyVersionTemplate] +// specifies the properties to use when creating a new +// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], either manually +// with +// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] +// or automatically as a result of auto-rotation. +message CryptoKeyVersionTemplate { + // [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when creating + // a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this + // template. Immutable. Defaults to + // [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE]. + ProtectionLevel protection_level = 1; + + // Required. + // [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] + // to use when creating a + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this + // template. + // + // For backwards compatibility, GOOGLE_SYMMETRIC_ENCRYPTION is implied if both + // this field is omitted and + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is + // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. + CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 3 + [(google.api.field_behavior) = REQUIRED]; +} + +// Contains an HSM-generated attestation about a key operation. For more +// information, see [Verifying attestations] +// (https://cloud.google.com/kms/docs/attest-key). +message KeyOperationAttestation { + // Attestation formats provided by the HSM. + enum AttestationFormat { + // Not specified. + ATTESTATION_FORMAT_UNSPECIFIED = 0; + + // Cavium HSM attestation compressed with gzip. Note that this format is + // defined by Cavium and subject to change at any time. + // + // See + // https://www.marvell.com/products/security-solutions/nitrox-hs-adapters/software-key-attestation.html. + CAVIUM_V1_COMPRESSED = 3; + + // Cavium HSM attestation V2 compressed with gzip. This is a new format + // introduced in Cavium's version 3.2-08. + CAVIUM_V2_COMPRESSED = 4; + } + + // Certificate chains needed to verify the attestation. + // Certificates in chains are PEM-encoded and are ordered based on + // https://tools.ietf.org/html/rfc5246#section-7.4.2. + message CertificateChains { + // Cavium certificate chain corresponding to the attestation. + repeated string cavium_certs = 1; + + // Google card certificate chain corresponding to the attestation. + repeated string google_card_certs = 2; + + // Google partition certificate chain corresponding to the attestation. + repeated string google_partition_certs = 3; + } + + // Output only. The format of the attestation data. + AttestationFormat format = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The attestation data provided by the HSM when the key + // operation was performed. + bytes content = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The certificate chains needed to validate the attestation + CertificateChains cert_chains = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an +// individual cryptographic key, and the associated key material. +// +// An +// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] +// version can be used for cryptographic operations. +// +// For security reasons, the raw cryptographic key material represented by a +// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed +// or exported. It can only be used to encrypt, decrypt, or sign data when an +// authorized user or application invokes Cloud KMS. +message CryptoKeyVersion { + option (google.api.resource) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}" + }; + + // The algorithm of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating what + // parameters must be used for each cryptographic operation. + // + // The + // [GOOGLE_SYMMETRIC_ENCRYPTION][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION] + // algorithm is usable with + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] + // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. + // + // Algorithms beginning with `RSA_SIGN_` are usable with + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] + // [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]. + // + // The fields in the name after `RSA_SIGN_` correspond to the following + // parameters: padding algorithm, modulus bit length, and digest algorithm. + // + // For PSS, the salt length used is equal to the length of digest + // algorithm. For example, + // [RSA_SIGN_PSS_2048_SHA256][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256] + // will use PSS with a salt length of 256 bits or 32 bytes. + // + // Algorithms beginning with `RSA_DECRYPT_` are usable with + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] + // [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]. + // + // The fields in the name after `RSA_DECRYPT_` correspond to the following + // parameters: padding algorithm, modulus bit length, and digest algorithm. + // + // Algorithms beginning with `EC_SIGN_` are usable with + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] + // [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]. + // + // The fields in the name after `EC_SIGN_` correspond to the following + // parameters: elliptic curve, digest algorithm. + // + // Algorithms beginning with `HMAC_` are usable with + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] + // [MAC][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC]. + // + // The suffix following `HMAC_` corresponds to the hash algorithm being used + // (eg. SHA256). + // + // For more information, see [Key purposes and algorithms] + // (https://cloud.google.com/kms/docs/algorithms). + enum CryptoKeyVersionAlgorithm { + // Not specified. + CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED = 0; + + // Creates symmetric encryption keys. + GOOGLE_SYMMETRIC_ENCRYPTION = 1; + + // AES-GCM (Galois Counter Mode) using 128-bit keys. + AES_128_GCM = 41; + + // AES-GCM (Galois Counter Mode) using 256-bit keys. + AES_256_GCM = 19; + + // AES-CBC (Cipher Block Chaining Mode) using 128-bit keys. + AES_128_CBC = 42; + + // AES-CBC (Cipher Block Chaining Mode) using 256-bit keys. + AES_256_CBC = 43; + + // AES-CTR (Counter Mode) using 128-bit keys. + AES_128_CTR = 44; + + // AES-CTR (Counter Mode) using 256-bit keys. + AES_256_CTR = 45; + + // RSASSA-PSS 2048 bit key with a SHA256 digest. + RSA_SIGN_PSS_2048_SHA256 = 2; + + // RSASSA-PSS 3072 bit key with a SHA256 digest. + RSA_SIGN_PSS_3072_SHA256 = 3; + + // RSASSA-PSS 4096 bit key with a SHA256 digest. + RSA_SIGN_PSS_4096_SHA256 = 4; + + // RSASSA-PSS 4096 bit key with a SHA512 digest. + RSA_SIGN_PSS_4096_SHA512 = 15; + + // RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest. + RSA_SIGN_PKCS1_2048_SHA256 = 5; + + // RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest. + RSA_SIGN_PKCS1_3072_SHA256 = 6; + + // RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest. + RSA_SIGN_PKCS1_4096_SHA256 = 7; + + // RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest. + RSA_SIGN_PKCS1_4096_SHA512 = 16; + + // RSASSA-PKCS1-v1_5 signing without encoding, with a 2048 bit key. + RSA_SIGN_RAW_PKCS1_2048 = 28; + + // RSASSA-PKCS1-v1_5 signing without encoding, with a 3072 bit key. + RSA_SIGN_RAW_PKCS1_3072 = 29; + + // RSASSA-PKCS1-v1_5 signing without encoding, with a 4096 bit key. + RSA_SIGN_RAW_PKCS1_4096 = 30; + + // RSAES-OAEP 2048 bit key with a SHA256 digest. + RSA_DECRYPT_OAEP_2048_SHA256 = 8; + + // RSAES-OAEP 3072 bit key with a SHA256 digest. + RSA_DECRYPT_OAEP_3072_SHA256 = 9; + + // RSAES-OAEP 4096 bit key with a SHA256 digest. + RSA_DECRYPT_OAEP_4096_SHA256 = 10; + + // RSAES-OAEP 4096 bit key with a SHA512 digest. + RSA_DECRYPT_OAEP_4096_SHA512 = 17; + + // RSAES-OAEP 2048 bit key with a SHA1 digest. + RSA_DECRYPT_OAEP_2048_SHA1 = 37; + + // RSAES-OAEP 3072 bit key with a SHA1 digest. + RSA_DECRYPT_OAEP_3072_SHA1 = 38; + + // RSAES-OAEP 4096 bit key with a SHA1 digest. + RSA_DECRYPT_OAEP_4096_SHA1 = 39; + + // ECDSA on the NIST P-256 curve with a SHA256 digest. + // Other hash functions can also be used: + // https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms + EC_SIGN_P256_SHA256 = 12; + + // ECDSA on the NIST P-384 curve with a SHA384 digest. + // Other hash functions can also be used: + // https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms + EC_SIGN_P384_SHA384 = 13; + + // ECDSA on the non-NIST secp256k1 curve. This curve is only supported for + // HSM protection level. + // Other hash functions can also be used: + // https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms + EC_SIGN_SECP256K1_SHA256 = 31; + + // HMAC-SHA256 signing with a 256 bit key. + HMAC_SHA256 = 32; + + // HMAC-SHA1 signing with a 160 bit key. + HMAC_SHA1 = 33; + + // HMAC-SHA384 signing with a 384 bit key. + HMAC_SHA384 = 34; + + // HMAC-SHA512 signing with a 512 bit key. + HMAC_SHA512 = 35; + + // HMAC-SHA224 signing with a 224 bit key. + HMAC_SHA224 = 36; + + // Algorithm representing symmetric encryption by an external key manager. + EXTERNAL_SYMMETRIC_ENCRYPTION = 18; + } + + // The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], + // indicating if it can be used. + enum CryptoKeyVersionState { + // Not specified. + CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0; + + // This version is still being generated. It may not be used, enabled, + // disabled, or destroyed yet. Cloud KMS will automatically mark this + // version + // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] + // as soon as the version is ready. + PENDING_GENERATION = 5; + + // This version may be used for cryptographic operations. + ENABLED = 1; + + // This version may not be used, but the key material is still available, + // and the version can be placed back into the + // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] + // state. + DISABLED = 2; + + // This version is destroyed, and the key material is no longer stored. + // This version may only become + // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] + // again if this version is + // [reimport_eligible][google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible] + // and the original key material is reimported with a call to + // [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]. + DESTROYED = 3; + + // This version is scheduled for destruction, and will be destroyed soon. + // Call + // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] + // to put it back into the + // [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] + // state. + DESTROY_SCHEDULED = 4; + + // This version is still being imported. It may not be used, enabled, + // disabled, or destroyed yet. Cloud KMS will automatically mark this + // version + // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] + // as soon as the version is ready. + PENDING_IMPORT = 6; + + // This version was not imported successfully. It may not be used, enabled, + // disabled, or destroyed. The submitted key material has been discarded. + // Additional details can be found in + // [CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason]. + IMPORT_FAILED = 7; + + // This version was not generated successfully. It may not be used, enabled, + // disabled, or destroyed. Additional details can be found in + // [CryptoKeyVersion.generation_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason]. + GENERATION_FAILED = 8; + + // This version was destroyed, and it may not be used or enabled again. + // Cloud KMS is waiting for the corresponding key material residing in an + // external key manager to be destroyed. + PENDING_EXTERNAL_DESTRUCTION = 9; + + // This version was destroyed, and it may not be used or enabled again. + // However, Cloud KMS could not confirm that the corresponding key material + // residing in an external key manager was destroyed. Additional details can + // be found in + // [CryptoKeyVersion.external_destruction_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason]. + EXTERNAL_DESTRUCTION_FAILED = 10; + } + + // A view for [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]s. + // Controls the level of detail returned for + // [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] in + // [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions] + // and + // [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. + enum CryptoKeyVersionView { + // Default view for each + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not + // include the + // [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field. + CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED = 0; + + // Provides all fields in each + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the + // [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation]. + FULL = 1; + } + + // Output only. The resource name for this + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format + // `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The current state of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + CryptoKeyVersionState state = 3; + + // Output only. The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] + // describing how crypto operations are performed with this + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + ProtectionLevel protection_level = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The + // [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] + // that this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + // supports. + CryptoKeyVersionAlgorithm algorithm = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Statement that was generated and signed by the HSM at key + // creation time. Use this statement to verify attributes of the key as stored + // on the HSM, independently of Google. Only provided for key versions with + // [protection_level][google.cloud.kms.v1.CryptoKeyVersion.protection_level] + // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM]. + KeyOperationAttestation attestation = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created. + google.protobuf.Timestamp create_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time this + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was + // generated. + google.protobuf.Timestamp generate_time = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time this + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is + // scheduled for destruction. Only present if + // [state][google.cloud.kms.v1.CryptoKeyVersion.state] is + // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]. + google.protobuf.Timestamp destroy_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time this CryptoKeyVersion's key material was + // destroyed. Only present if + // [state][google.cloud.kms.v1.CryptoKeyVersion.state] is + // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]. + google.protobuf.Timestamp destroy_event_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The name of the [ImportJob][google.cloud.kms.v1.ImportJob] + // used in the most recent import of this + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Only present if + // the underlying key material was imported. + string import_job = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was + // most recently imported. + google.protobuf.Timestamp import_time = 15 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The root cause of the most recent import failure. Only present + // if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is + // [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]. + string import_failure_reason = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The root cause of the most recent generation failure. Only + // present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is + // [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED]. + string generation_failure_reason = 19 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The root cause of the most recent external destruction + // failure. Only present if + // [state][google.cloud.kms.v1.CryptoKeyVersion.state] is + // [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED]. + string external_destruction_failure_reason = 20 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // ExternalProtectionLevelOptions stores a group of additional fields for + // configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that + // are specific to the + // [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] protection level + // and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] + // protection levels. + ExternalProtectionLevelOptions external_protection_level_options = 17; + + // Output only. Whether or not this key version is eligible for reimport, by + // being specified as a target in + // [ImportCryptoKeyVersionRequest.crypto_key_version][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version]. + bool reimport_eligible = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The public key for a given +// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via +// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. +message PublicKey { + option (google.api.resource) = { + type: "cloudkms.googleapis.com/PublicKey" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/publicKey" + }; + + // The public key, encoded in PEM format. For more information, see the + // [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for + // [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and + // [Textual Encoding of Subject Public Key Info] + // (https://tools.ietf.org/html/rfc7468#section-13). + string pem = 1; + + // The + // [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] + // associated with this key. + CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2; + + // Integrity verification field. A CRC32C checksum of the returned + // [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of + // [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by + // computing the CRC32C checksum of + // [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your + // results to this field. Discard the response in case of non-matching + // checksum values, and perform a limited number of retries. A persistent + // mismatch may indicate an issue in your computation of the CRC32C checksum. + // Note: This field is defined as int64 for reasons of compatibility across + // different languages. However, it is a non-negative integer, which will + // never exceed 2^32-1, and can be safely downconverted to uint32 in languages + // that support this type. + // + // NOTE: This field is in Beta. + google.protobuf.Int64Value pem_crc32c = 3; + + // The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key. + // Provided here for verification. + // + // NOTE: This field is in Beta. + string name = 4; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key. + ProtectionLevel protection_level = 5; +} + +// An [ImportJob][google.cloud.kms.v1.ImportJob] can be used to create +// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and +// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] using pre-existing +// key material, generated outside of Cloud KMS. +// +// When an [ImportJob][google.cloud.kms.v1.ImportJob] is created, Cloud KMS will +// generate a "wrapping key", which is a public/private key pair. You use the +// wrapping key to encrypt (also known as wrap) the pre-existing key material to +// protect it during the import process. The nature of the wrapping key depends +// on the choice of +// [import_method][google.cloud.kms.v1.ImportJob.import_method]. When the +// wrapping key generation is complete, the +// [state][google.cloud.kms.v1.ImportJob.state] will be set to +// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] and the +// [public_key][google.cloud.kms.v1.ImportJob.public_key] can be fetched. The +// fetched public key can then be used to wrap your pre-existing key material. +// +// Once the key material is wrapped, it can be imported into a new +// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in an existing +// [CryptoKey][google.cloud.kms.v1.CryptoKey] by calling +// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]. +// Multiple [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can be +// imported with a single [ImportJob][google.cloud.kms.v1.ImportJob]. Cloud KMS +// uses the private key portion of the wrapping key to unwrap the key material. +// Only Cloud KMS has access to the private key. +// +// An [ImportJob][google.cloud.kms.v1.ImportJob] expires 3 days after it is +// created. Once expired, Cloud KMS will no longer be able to import or unwrap +// any key material that was wrapped with the +// [ImportJob][google.cloud.kms.v1.ImportJob]'s public key. +// +// For more information, see +// [Importing a key](https://cloud.google.com/kms/docs/importing-a-key). +message ImportJob { + option (google.api.resource) = { + type: "cloudkms.googleapis.com/ImportJob" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}" + }; + + // [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] describes the + // key wrapping method chosen for this + // [ImportJob][google.cloud.kms.v1.ImportJob]. + enum ImportMethod { + // Not specified. + IMPORT_METHOD_UNSPECIFIED = 0; + + // This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping + // scheme defined in the PKCS #11 standard. In summary, this involves + // wrapping the raw key with an ephemeral AES key, and wrapping the + // ephemeral AES key with a 3072 bit RSA key. For more details, see + // [RSA AES key wrap + // mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908). + RSA_OAEP_3072_SHA1_AES_256 = 1; + + // This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping + // scheme defined in the PKCS #11 standard. In summary, this involves + // wrapping the raw key with an ephemeral AES key, and wrapping the + // ephemeral AES key with a 4096 bit RSA key. For more details, see + // [RSA AES key wrap + // mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908). + RSA_OAEP_4096_SHA1_AES_256 = 2; + + // This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping + // scheme defined in the PKCS #11 standard. In summary, this involves + // wrapping the raw key with an ephemeral AES key, and wrapping the + // ephemeral AES key with a 3072 bit RSA key. For more details, see + // [RSA AES key wrap + // mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908). + RSA_OAEP_3072_SHA256_AES_256 = 3; + + // This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping + // scheme defined in the PKCS #11 standard. In summary, this involves + // wrapping the raw key with an ephemeral AES key, and wrapping the + // ephemeral AES key with a 4096 bit RSA key. For more details, see + // [RSA AES key wrap + // mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908). + RSA_OAEP_4096_SHA256_AES_256 = 4; + + // This ImportMethod represents RSAES-OAEP with a 3072 bit RSA key. The + // key material to be imported is wrapped directly with the RSA key. Due + // to technical limitations of RSA wrapping, this method cannot be used to + // wrap RSA keys for import. + RSA_OAEP_3072_SHA256 = 5; + + // This ImportMethod represents RSAES-OAEP with a 4096 bit RSA key. The + // key material to be imported is wrapped directly with the RSA key. Due + // to technical limitations of RSA wrapping, this method cannot be used to + // wrap RSA keys for import. + RSA_OAEP_4096_SHA256 = 6; + } + + // The state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if + // it can be used. + enum ImportJobState { + // Not specified. + IMPORT_JOB_STATE_UNSPECIFIED = 0; + + // The wrapping key for this job is still being generated. It may not be + // used. Cloud KMS will automatically mark this job as + // [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] as soon as + // the wrapping key is generated. + PENDING_GENERATION = 1; + + // This job may be used in + // [CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey] + // and + // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] + // requests. + ACTIVE = 2; + + // This job can no longer be used and may not leave this state once entered. + EXPIRED = 3; + } + + // The public key component of the wrapping key. For details of the type of + // key this public key corresponds to, see the + // [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod]. + message WrappingPublicKey { + // The public key, encoded in PEM format. For more information, see the [RFC + // 7468](https://tools.ietf.org/html/rfc7468) sections for [General + // Considerations](https://tools.ietf.org/html/rfc7468#section-2) and + // [Textual Encoding of Subject Public Key Info] + // (https://tools.ietf.org/html/rfc7468#section-13). + string pem = 1; + } + + // Output only. The resource name for this + // [ImportJob][google.cloud.kms.v1.ImportJob] in the format + // `projects/*/locations/*/keyRings/*/importJobs/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Immutable. The wrapping method to be used for incoming key + // material. + ImportMethod import_method = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Required. Immutable. The protection level of the + // [ImportJob][google.cloud.kms.v1.ImportJob]. This must match the + // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level] + // of the [version_template][google.cloud.kms.v1.CryptoKey.version_template] + // on the [CryptoKey][google.cloud.kms.v1.CryptoKey] you attempt to import + // into. + ProtectionLevel protection_level = 9 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Output only. The time at which this + // [ImportJob][google.cloud.kms.v1.ImportJob] was created. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]'s key + // material was generated. + google.protobuf.Timestamp generate_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this + // [ImportJob][google.cloud.kms.v1.ImportJob] is scheduled for expiration and + // can no longer be used to import key material. + google.protobuf.Timestamp expire_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob] + // expired. Only present if [state][google.cloud.kms.v1.ImportJob.state] is + // [EXPIRED][google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED]. + google.protobuf.Timestamp expire_event_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the + // [ImportJob][google.cloud.kms.v1.ImportJob], indicating if it can be used. + ImportJobState state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The public key with which to wrap key material prior to + // import. Only returned if [state][google.cloud.kms.v1.ImportJob.state] is + // [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]. + WrappingPublicKey public_key = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Statement that was generated and signed by the key creator + // (for example, an HSM) at key creation time. Use this statement to verify + // attributes of the key as stored on the HSM, independently of Google. + // Only present if the chosen + // [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] is one with a + // protection level of [HSM][google.cloud.kms.v1.ProtectionLevel.HSM]. + KeyOperationAttestation attestation = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// ExternalProtectionLevelOptions stores a group of additional fields for +// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that +// are specific to the [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] +// protection level and +// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] protection +// levels. +message ExternalProtectionLevelOptions { + // The URI for an external resource that this + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents. + string external_key_uri = 1; + + // The path to the external key material on the EKM when using + // [EkmConnection][google.cloud.kms.v1.EkmConnection] e.g., "v0/my/key". Set + // this field instead of external_key_uri when using an + // [EkmConnection][google.cloud.kms.v1.EkmConnection]. + string ekm_connection_key_path = 2; +} + +// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] specifies how +// cryptographic operations are performed. For more information, see [Protection +// levels] (https://cloud.google.com/kms/docs/algorithms#protection_levels). +enum ProtectionLevel { + // Not specified. + PROTECTION_LEVEL_UNSPECIFIED = 0; + + // Crypto operations are performed in software. + SOFTWARE = 1; + + // Crypto operations are performed in a Hardware Security Module. + HSM = 2; + + // Crypto operations are performed by an external key manager. + EXTERNAL = 3; + + // Crypto operations are performed in an EKM-over-VPC backend. + EXTERNAL_VPC = 4; +} diff --git a/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/service.proto b/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/service.proto new file mode 100644 index 00000000000..c9a0557141c --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/service.proto @@ -0,0 +1,2073 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.kms.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/kms/v1/resources.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/wrappers.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Kms.V1"; +option go_package = "cloud.google.com/go/kms/apiv1/kmspb;kmspb"; +option java_multiple_files = true; +option java_outer_classname = "KmsProto"; +option java_package = "com.google.cloud.kms.v1"; +option php_namespace = "Google\\Cloud\\Kms\\V1"; + +// Google Cloud Key Management Service +// +// Manages cryptographic keys and operations using those keys. Implements a REST +// model with the following objects: +// +// * [KeyRing][google.cloud.kms.v1.KeyRing] +// * [CryptoKey][google.cloud.kms.v1.CryptoKey] +// * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] +// * [ImportJob][google.cloud.kms.v1.ImportJob] +// +// If you are using manual gRPC libraries, see +// [Using gRPC with Cloud KMS](https://cloud.google.com/kms/docs/grpc). +service KeyManagementService { + option (google.api.default_host) = "cloudkms.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloudkms"; + + // Lists [KeyRings][google.cloud.kms.v1.KeyRing]. + rpc ListKeyRings(ListKeyRingsRequest) returns (ListKeyRingsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/keyRings" + }; + option (google.api.method_signature) = "parent"; + } + + // Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + rpc ListCryptoKeys(ListCryptoKeysRequest) returns (ListCryptoKeysResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/keyRings/*}/cryptoKeys" + }; + option (google.api.method_signature) = "parent"; + } + + // Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + rpc ListCryptoKeyVersions(ListCryptoKeyVersionsRequest) + returns (ListCryptoKeyVersionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions" + }; + option (google.api.method_signature) = "parent"; + } + + // Lists [ImportJobs][google.cloud.kms.v1.ImportJob]. + rpc ListImportJobs(ListImportJobsRequest) returns (ListImportJobsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/keyRings/*}/importJobs" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing]. + rpc GetKeyRing(GetKeyRingRequest) returns (KeyRing) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/keyRings/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as + // well as its [primary][google.cloud.kms.v1.CryptoKey.primary] + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + rpc GetCryptoKey(GetCryptoKeyRequest) returns (CryptoKey) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns metadata for a given + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + rpc GetCryptoKeyVersion(GetCryptoKeyVersionRequest) + returns (CryptoKeyVersion) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns the public key for the given + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be + // [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] + // or + // [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]. + rpc GetPublicKey(GetPublicKeyRequest) returns (PublicKey) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}/publicKey" + }; + option (google.api.method_signature) = "name"; + } + + // Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob]. + rpc GetImportJob(GetImportJobRequest) returns (ImportJob) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/keyRings/*/importJobs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and + // Location. + rpc CreateKeyRing(CreateKeyRingRequest) returns (KeyRing) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/keyRings" + body: "key_ring" + }; + option (google.api.method_signature) = "parent,key_ring_id,key_ring"; + } + + // Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a + // [KeyRing][google.cloud.kms.v1.KeyRing]. + // + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and + // [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] + // are required. + rpc CreateCryptoKey(CreateCryptoKeyRequest) returns (CryptoKey) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/keyRings/*}/cryptoKeys" + body: "crypto_key" + }; + option (google.api.method_signature) = "parent,crypto_key_id,crypto_key"; + } + + // Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a + // [CryptoKey][google.cloud.kms.v1.CryptoKey]. + // + // The server will assign the next sequential id. If unset, + // [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]. + rpc CreateCryptoKeyVersion(CreateCryptoKeyVersionRequest) + returns (CryptoKeyVersion) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions" + body: "crypto_key_version" + }; + option (google.api.method_signature) = "parent,crypto_key_version"; + } + + // Import wrapped key material into a + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + // + // All requests must specify a [CryptoKey][google.cloud.kms.v1.CryptoKey]. If + // a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] is additionally + // specified in the request, key material will be reimported into that + // version. Otherwise, a new version will be created, and will be assigned the + // next sequential id within the [CryptoKey][google.cloud.kms.v1.CryptoKey]. + rpc ImportCryptoKeyVersion(ImportCryptoKeyVersionRequest) + returns (CryptoKeyVersion) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions:import" + body: "*" + }; + } + + // Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a + // [KeyRing][google.cloud.kms.v1.KeyRing]. + // + // [ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is + // required. + rpc CreateImportJob(CreateImportJobRequest) returns (ImportJob) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/keyRings/*}/importJobs" + body: "import_job" + }; + option (google.api.method_signature) = "parent,import_job_id,import_job"; + } + + // Update a [CryptoKey][google.cloud.kms.v1.CryptoKey]. + rpc UpdateCryptoKey(UpdateCryptoKeyRequest) returns (CryptoKey) { + option (google.api.http) = { + patch: "/v1/{crypto_key.name=projects/*/locations/*/keyRings/*/cryptoKeys/*}" + body: "crypto_key" + }; + option (google.api.method_signature) = "crypto_key,update_mask"; + } + + // Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s + // metadata. + // + // [state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between + // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] + // and + // [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] + // using this method. See + // [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] + // and + // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] + // to move between other states. + rpc UpdateCryptoKeyVersion(UpdateCryptoKeyVersionRequest) + returns (CryptoKeyVersion) { + option (google.api.http) = { + patch: "/v1/{crypto_key_version.name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}" + body: "crypto_key_version" + }; + option (google.api.method_signature) = "crypto_key_version,update_mask"; + } + + // Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that + // will be used in + // [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. + // + // Returns an error if called on a key whose purpose is not + // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. + rpc UpdateCryptoKeyPrimaryVersion(UpdateCryptoKeyPrimaryVersionRequest) + returns (CryptoKey) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}:updatePrimaryVersion" + body: "*" + }; + option (google.api.method_signature) = "name,crypto_key_version_id"; + } + + // Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for + // destruction. + // + // Upon calling this method, + // [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will + // be set to + // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], + // and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will + // be set to the time + // [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] + // in the future. At that time, the + // [state][google.cloud.kms.v1.CryptoKeyVersion.state] will automatically + // change to + // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], + // and the key material will be irrevocably destroyed. + // + // Before the + // [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is + // reached, + // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] + // may be called to reverse the process. + rpc DestroyCryptoKeyVersion(DestroyCryptoKeyVersionRequest) + returns (CryptoKeyVersion) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:destroy" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the + // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] + // state. + // + // Upon restoration of the CryptoKeyVersion, + // [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + // [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], + // and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will + // be cleared. + rpc RestoreCryptoKeyVersion(RestoreCryptoKeyVersionRequest) + returns (CryptoKeyVersion) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:restore" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Encrypts data, so that it can only be recovered by a call to + // [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be + // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. + rpc Encrypt(EncryptRequest) returns (EncryptResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/**}:encrypt" + body: "*" + }; + option (google.api.method_signature) = "name,plaintext"; + } + + // Decrypts data that was protected by + // [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be + // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. + rpc Decrypt(DecryptRequest) returns (DecryptResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}:decrypt" + body: "*" + }; + option (google.api.method_signature) = "name,ciphertext"; + } + + // Encrypts data using portable cryptographic primitives. Most users should + // choose [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and + // [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt] rather than + // their raw counterparts. The + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be + // [RAW_ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT]. + rpc RawEncrypt(RawEncryptRequest) returns (RawEncryptResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:rawEncrypt" + body: "*" + }; + } + + // Decrypts data that was originally encrypted using a raw cryptographic + // mechanism. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] + // must be + // [RAW_ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT]. + rpc RawDecrypt(RawDecryptRequest) returns (RawDecryptResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:rawDecrypt" + body: "*" + }; + } + + // Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + // with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] + // ASYMMETRIC_SIGN, producing a signature that can be verified with the public + // key retrieved from + // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. + rpc AsymmetricSign(AsymmetricSignRequest) returns (AsymmetricSignResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:asymmetricSign" + body: "*" + }; + option (google.api.method_signature) = "name,digest"; + } + + // Decrypts data that was encrypted with a public key retrieved from + // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] + // corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + // with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] + // ASYMMETRIC_DECRYPT. + rpc AsymmetricDecrypt(AsymmetricDecryptRequest) + returns (AsymmetricDecryptResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:asymmetricDecrypt" + body: "*" + }; + option (google.api.method_signature) = "name,ciphertext"; + } + + // Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + // with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, + // producing a tag that can be verified by another source with the same key. + rpc MacSign(MacSignRequest) returns (MacSignResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:macSign" + body: "*" + }; + option (google.api.method_signature) = "name,data"; + } + + // Verifies MAC tag using a + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, and returns + // a response that indicates whether or not the verification was successful. + rpc MacVerify(MacVerifyRequest) returns (MacVerifyResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:macVerify" + body: "*" + }; + option (google.api.method_signature) = "name,data,mac"; + } + + // Generate random bytes using the Cloud KMS randomness source in the provided + // location. + rpc GenerateRandomBytes(GenerateRandomBytesRequest) + returns (GenerateRandomBytesResponse) { + option (google.api.http) = { + post: "/v1/{location=projects/*/locations/*}:generateRandomBytes" + body: "*" + }; + option (google.api.method_signature) = + "location,length_bytes,protection_level"; + } +} + +// Request message for +// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings]. +message ListKeyRingsRequest { + // Required. The resource name of the location associated with the + // [KeyRings][google.cloud.kms.v1.KeyRing], in the format + // `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Optional limit on the number of + // [KeyRings][google.cloud.kms.v1.KeyRing] to include in the response. Further + // [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by + // including the + // [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token] + // in a subsequent request. If unspecified, the server will pick an + // appropriate default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional pagination token, returned earlier via + // [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only include resources that match the filter in the response. For + // more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. If not specified, the + // results will be sorted in the default order. For more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. +message ListCryptoKeysRequest { + // Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] + // to list, in the format `projects/*/locations/*/keyRings/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/KeyRing" + } + ]; + + // Optional. Optional limit on the number of + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the response. + // Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be + // obtained by including the + // [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token] + // in a subsequent request. If unspecified, the server will pick an + // appropriate default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional pagination token, returned earlier via + // [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // The fields of the primary version to include in the response. + CryptoKeyVersion.CryptoKeyVersionView version_view = 4; + + // Optional. Only include resources that match the filter in the response. For + // more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string filter = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. If not specified, the + // results will be sorted in the default order. For more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string order_by = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]. +message ListCryptoKeyVersionsRequest { + // Required. The resource name of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format + // `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; + + // Optional. Optional limit on the number of + // [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to include in the + // response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] + // can subsequently be obtained by including the + // [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token] + // in a subsequent request. If unspecified, the server will pick an + // appropriate default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional pagination token, returned earlier via + // [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // The fields to include in the response. + CryptoKeyVersion.CryptoKeyVersionView view = 4; + + // Optional. Only include resources that match the filter in the response. For + // more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string filter = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. If not specified, the + // results will be sorted in the default order. For more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string order_by = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs]. +message ListImportJobsRequest { + // Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] + // to list, in the format `projects/*/locations/*/keyRings/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/KeyRing" + } + ]; + + // Optional. Optional limit on the number of + // [ImportJobs][google.cloud.kms.v1.ImportJob] to include in the response. + // Further [ImportJobs][google.cloud.kms.v1.ImportJob] can subsequently be + // obtained by including the + // [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token] + // in a subsequent request. If unspecified, the server will pick an + // appropriate default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional pagination token, returned earlier via + // [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only include resources that match the filter in the response. For + // more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. If not specified, the + // results will be sorted in the default order. For more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings]. +message ListKeyRingsResponse { + // The list of [KeyRings][google.cloud.kms.v1.KeyRing]. + repeated KeyRing key_rings = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] + // to retrieve the next page of results. + string next_page_token = 2; + + // The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched + // the query. + int32 total_size = 3; +} + +// Response message for +// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. +message ListCryptoKeysResponse { + // The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + repeated CryptoKey crypto_keys = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token] + // to retrieve the next page of results. + string next_page_token = 2; + + // The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that + // matched the query. + int32 total_size = 3; +} + +// Response message for +// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]. +message ListCryptoKeyVersionsResponse { + // The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + repeated CryptoKeyVersion crypto_key_versions = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token] + // to retrieve the next page of results. + string next_page_token = 2; + + // The total number of + // [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the + // query. + int32 total_size = 3; +} + +// Response message for +// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs]. +message ListImportJobsResponse { + // The list of [ImportJobs][google.cloud.kms.v1.ImportJob]. + repeated ImportJob import_jobs = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListImportJobsRequest.page_token][google.cloud.kms.v1.ListImportJobsRequest.page_token] + // to retrieve the next page of results. + string next_page_token = 2; + + // The total number of [ImportJobs][google.cloud.kms.v1.ImportJob] that + // matched the query. + int32 total_size = 3; +} + +// Request message for +// [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing]. +message GetKeyRingRequest { + // Required. The [name][google.cloud.kms.v1.KeyRing.name] of the + // [KeyRing][google.cloud.kms.v1.KeyRing] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/KeyRing" + } + ]; +} + +// Request message for +// [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey]. +message GetCryptoKeyRequest { + // Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; +} + +// Request message for +// [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion]. +message GetCryptoKeyVersionRequest { + // Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; +} + +// Request message for +// [KeyManagementService.GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. +message GetPublicKeyRequest { + // Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; +} + +// Request message for +// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob]. +message GetImportJobRequest { + // Required. The [name][google.cloud.kms.v1.ImportJob.name] of the + // [ImportJob][google.cloud.kms.v1.ImportJob] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/ImportJob" + } + ]; +} + +// Request message for +// [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing]. +message CreateKeyRingRequest { + // Required. The resource name of the location associated with the + // [KeyRings][google.cloud.kms.v1.KeyRing], in the format + // `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. It must be unique within a location and match the regular + // expression `[a-zA-Z0-9_-]{1,63}` + string key_ring_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field + // values. + KeyRing key_ring = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]. +message CreateCryptoKeyRequest { + // Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing + // associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/KeyRing" + } + ]; + + // Required. It must be unique within a KeyRing and match the regular + // expression `[a-zA-Z0-9_-]{1,63}` + string crypto_key_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field + // values. + CryptoKey crypto_key = 3 [(google.api.field_behavior) = REQUIRED]; + + // If set to true, the request will create a + // [CryptoKey][google.cloud.kms.v1.CryptoKey] without any + // [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. You must + // manually call + // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] + // or + // [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion] + // before you can use this [CryptoKey][google.cloud.kms.v1.CryptoKey]. + bool skip_initial_version_creation = 5; +} + +// Request message for +// [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]. +message CreateCryptoKeyVersionRequest { + // Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the + // [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; + + // Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with + // initial field values. + CryptoKeyVersion crypto_key_version = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]. +message ImportCryptoKeyVersionRequest { + // Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into. + // + // The create permission is only required on this key when creating a new + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; + + // Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of + // an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to + // target for an import operation. If this field is not present, a new + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the + // supplied key material is created. + // + // If this field is present, the supplied key material is imported into + // the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To + // import into an existing + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of + // [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent], + // have been previously created via [ImportCryptoKeyVersion][], and be in + // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED] + // or + // [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED] + // state. The key material and algorithm must match the previous + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained + // key material. + string crypto_key_version = 6 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; + + // Required. The + // [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] + // of the key being imported. This does not need to match the + // [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into. + CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The [name][google.cloud.kms.v1.ImportJob.name] of the + // [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key + // material. + string import_job = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The wrapped key material to import. + // + // Before wrapping, key material must be formatted. If importing symmetric key + // material, the expected key material format is plain bytes. If importing + // asymmetric key material, the expected key material format is PKCS#8-encoded + // DER (the PrivateKeyInfo structure from RFC 5208). + // + // When wrapping with import methods + // ([RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256] + // or + // [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256] + // or + // [RSA_OAEP_3072_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256] + // or + // [RSA_OAEP_4096_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]), + // + // this field must contain the concatenation of: + //
    + //
  1. An ephemeral AES-256 wrapping key wrapped with the + // [public_key][google.cloud.kms.v1.ImportJob.public_key] using + // RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an empty + // label. + //
  2. + //
  3. The formatted key to be imported, wrapped with the ephemeral AES-256 + // key using AES-KWP (RFC 5649). + //
  4. + //
+ // + // This format is the same as the format produced by PKCS#11 mechanism + // CKM_RSA_AES_KEY_WRAP. + // + // When wrapping with import methods + // ([RSA_OAEP_3072_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256] + // or + // [RSA_OAEP_4096_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]), + // + // this field must contain the formatted key to be imported, wrapped with the + // [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP + // with SHA-256, MGF1 with SHA-256, and an empty label. + bytes wrapped_key = 8 [(google.api.field_behavior) = OPTIONAL]; + + // This field is legacy. Use the field + // [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key] + // instead. + oneof wrapped_key_material { + // Optional. This field has the same meaning as + // [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]. + // Prefer to use that field in new work. Either that field or this field + // (but not both) must be specified. + bytes rsa_aes_wrapped_key = 5 [(google.api.field_behavior) = OPTIONAL]; + } +} + +// Request message for +// [KeyManagementService.CreateImportJob][google.cloud.kms.v1.KeyManagementService.CreateImportJob]. +message CreateImportJobRequest { + // Required. The [name][google.cloud.kms.v1.KeyRing.name] of the + // [KeyRing][google.cloud.kms.v1.KeyRing] associated with the + // [ImportJobs][google.cloud.kms.v1.ImportJob]. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/KeyRing" + } + ]; + + // Required. It must be unique within a KeyRing and match the regular + // expression `[a-zA-Z0-9_-]{1,63}` + string import_job_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field + // values. + ImportJob import_job = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey]. +message UpdateCryptoKeyRequest { + // Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values. + CryptoKey crypto_key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. List of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion]. +message UpdateCryptoKeyVersionRequest { + // Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with + // updated values. + CryptoKeyVersion crypto_key_version = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. List of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]. +message UpdateCryptoKeyPrimaryVersionRequest { + // Required. The resource name of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey] to update. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; + + // Required. The id of the child + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary. + string crypto_key_version_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]. +message DestroyCryptoKeyVersionRequest { + // Required. The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; +} + +// Request message for +// [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]. +message RestoreCryptoKeyVersionRequest { + // Required. The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; +} + +// Request message for +// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. +message EncryptRequest { + // Required. The resource name of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey] or + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for + // encryption. + // + // If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server + // will use its [primary version][google.cloud.kms.v1.CryptoKey.primary]. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "*" } + ]; + + // Required. The data to encrypt. Must be no larger than 64KiB. + // + // The maximum size depends on the key version's + // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. + // For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE], + // [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and + // [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the + // plaintext must be no larger than 64KiB. For + // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of + // the plaintext and additional_authenticated_data fields must be no larger + // than 8KiB. + bytes plaintext = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Optional data that, if specified, must also be provided during + // decryption through + // [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]. + // + // The maximum size depends on the key version's + // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. + // For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE], + // [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and + // [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys the + // AAD must be no larger than 64KiB. For + // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of + // the plaintext and additional_authenticated_data fields must be no larger + // than 8KiB. + bytes additional_authenticated_data = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional CRC32C checksum of the + // [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received + // [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext] + // using this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]) + // is equal to + // [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value plaintext_crc32c = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional CRC32C checksum of the + // [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received + // [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data] + // using this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]) + // is equal to + // [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value additional_authenticated_data_crc32c = 8 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. +message DecryptRequest { + // Required. The resource name of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The + // server will choose the appropriate version. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; + + // Required. The encrypted data originally returned in + // [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]. + bytes ciphertext = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Optional data that must match the data originally supplied in + // [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. + bytes additional_authenticated_data = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional CRC32C checksum of the + // [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received + // [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext] + // using this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]) + // is equal to + // [DecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value ciphertext_crc32c = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional CRC32C checksum of the + // [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received + // [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data] + // using this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]) + // is equal to + // [DecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value additional_authenticated_data_crc32c = 6 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt]. +message RawEncryptRequest { + // Required. The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for + // encryption. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The data to encrypt. Must be no larger than 64KiB. + // + // The maximum size depends on the key version's + // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. + // For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the + // plaintext must be no larger than 64KiB. For + // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of + // the plaintext and additional_authenticated_data fields must be no larger + // than 8KiB. + bytes plaintext = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Optional data that, if specified, must also be provided during + // decryption through + // [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]. + // + // This field may only be used in conjunction with an + // [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm] that accepts + // additional authenticated data (for example, AES-GCM). + // + // The maximum size depends on the key version's + // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. + // For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the + // plaintext must be no larger than 64KiB. For + // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of + // the plaintext and additional_authenticated_data fields must be no larger + // than 8KiB. + bytes additional_authenticated_data = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional CRC32C checksum of the + // [RawEncryptRequest.plaintext][google.cloud.kms.v1.RawEncryptRequest.plaintext]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received plaintext using this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that CRC32C(plaintext) is equal + // to plaintext_crc32c, and if so, perform a limited number of retries. A + // persistent mismatch may indicate an issue in your computation of the CRC32C + // checksum. Note: This field is defined as int64 for reasons of compatibility + // across different languages. However, it is a non-negative integer, which + // will never exceed 2^32-1, and can be safely downconverted to uint32 in + // languages that support this type. + google.protobuf.Int64Value plaintext_crc32c = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional CRC32C checksum of the + // [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received additional_authenticated_data using + // this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C(additional_authenticated_data) is equal to + // additional_authenticated_data_crc32c, and if so, perform + // a limited number of retries. A persistent mismatch may indicate an issue in + // your computation of the CRC32C checksum. + // Note: This field is defined as int64 for reasons of compatibility across + // different languages. However, it is a non-negative integer, which will + // never exceed 2^32-1, and can be safely downconverted to uint32 in languages + // that support this type. + google.protobuf.Int64Value additional_authenticated_data_crc32c = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A customer-supplied initialization vector that will be used for + // encryption. If it is not provided for AES-CBC and AES-CTR, one will be + // generated. It will be returned in + // [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector]. + bytes initialization_vector = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional CRC32C checksum of the + // [RawEncryptRequest.initialization_vector][google.cloud.kms.v1.RawEncryptRequest.initialization_vector]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received initialization_vector using this + // checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService] + // will report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C(initialization_vector) is equal to + // initialization_vector_crc32c, and if so, perform + // a limited number of retries. A persistent mismatch may indicate an issue in + // your computation of the CRC32C checksum. + // Note: This field is defined as int64 for reasons of compatibility across + // different languages. However, it is a non-negative integer, which will + // never exceed 2^32-1, and can be safely downconverted to uint32 in languages + // that support this type. + google.protobuf.Int64Value initialization_vector_crc32c = 7 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt]. +message RawDecryptRequest { + // Required. The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for + // decryption. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The encrypted data originally returned in + // [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext]. + bytes ciphertext = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Optional data that must match the data originally supplied in + // [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]. + bytes additional_authenticated_data = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Required. The initialization vector (IV) used during encryption, which must + // match the data originally provided in + // [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector]. + bytes initialization_vector = 4 [(google.api.field_behavior) = REQUIRED]; + + // The length of the authentication tag that is appended to the end of + // the ciphertext. If unspecified (0), the default value for the key's + // algorithm will be used (for AES-GCM, the default value is 16). + int32 tag_length = 5; + + // Optional. An optional CRC32C checksum of the + // [RawDecryptRequest.ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received ciphertext using this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that CRC32C(ciphertext) is equal + // to ciphertext_crc32c, and if so, perform a limited number of retries. A + // persistent mismatch may indicate an issue in your computation of the CRC32C + // checksum. Note: This field is defined as int64 for reasons of compatibility + // across different languages. However, it is a non-negative integer, which + // will never exceed 2^32-1, and can be safely downconverted to uint32 in + // languages that support this type. + google.protobuf.Int64Value ciphertext_crc32c = 6 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional CRC32C checksum of the + // [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received additional_authenticated_data using + // this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C(additional_authenticated_data) is equal to + // additional_authenticated_data_crc32c, and if so, perform + // a limited number of retries. A persistent mismatch may indicate an issue in + // your computation of the CRC32C checksum. + // Note: This field is defined as int64 for reasons of compatibility across + // different languages. However, it is a non-negative integer, which will + // never exceed 2^32-1, and can be safely downconverted to uint32 in languages + // that support this type. + google.protobuf.Int64Value additional_authenticated_data_crc32c = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional CRC32C checksum of the + // [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received initialization_vector using this + // checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService] + // will report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and + // if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. + // Note: This field is defined as int64 for reasons of compatibility across + // different languages. However, it is a non-negative integer, which will + // never exceed 2^32-1, and can be safely downconverted to uint32 in languages + // that support this type. + google.protobuf.Int64Value initialization_vector_crc32c = 8 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]. +message AsymmetricSignRequest { + // Required. The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for + // signing. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; + + // Optional. The digest of the data to sign. The digest must be produced with + // the same digest algorithm as specified by the key version's + // [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm]. + // + // This field may not be supplied if + // [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data] + // is supplied. + Digest digest = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional CRC32C checksum of the + // [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received + // [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest] + // using this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]) + // is equal to + // [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value digest_crc32c = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The data to sign. + // It can't be supplied if + // [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest] + // is supplied. + bytes data = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional CRC32C checksum of the + // [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received + // [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data] + // using this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]) + // is equal to + // [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value data_crc32c = 7 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]. +message AsymmetricDecryptRequest { + // Required. The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for + // decryption. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; + + // Required. The data encrypted with the named + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using + // OAEP. + bytes ciphertext = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional CRC32C checksum of the + // [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received + // [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext] + // using this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]) + // is equal to + // [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value ciphertext_crc32c = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign]. +message MacSignRequest { + // Required. The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for + // signing. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; + + // Required. The data to sign. The MAC tag is computed over this data field + // based on the specific algorithm. + bytes data = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional CRC32C checksum of the + // [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]. If + // specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService] + // will verify the integrity of the received + // [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] using this + // checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService] + // will report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]) is + // equal to + // [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value data_crc32c = 3 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify]. +message MacVerifyRequest { + // Required. The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for + // verification. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; + + // Required. The data used previously as a + // [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate + // the MAC tag. + bytes data = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional CRC32C checksum of the + // [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data]. If + // specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService] + // will verify the integrity of the received + // [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] using + // this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data]) + // is equal to + // [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value data_crc32c = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Required. The signature to verify. + bytes mac = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional CRC32C checksum of the + // [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]. If + // specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService] + // will verify the integrity of the received + // [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] using this + // checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService] + // will report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([MacVerifyRequest.tag][]) is equal to + // [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value mac_crc32c = 5 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]. +message GenerateRandomBytesRequest { + // The project-specific location in which to generate random bytes. + // For example, "projects/my-project/locations/us-central1". + string location = 1; + + // The length in bytes of the amount of randomness to retrieve. Minimum 8 + // bytes, maximum 1024 bytes. + int32 length_bytes = 2; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when + // generating the random data. Currently, only + // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is + // supported. + ProtectionLevel protection_level = 3; +} + +// Response message for +// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. +message EncryptResponse { + // The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in + // encryption. Check this field to verify that the intended resource was used + // for encryption. + string name = 1; + + // The encrypted data. + bytes ciphertext = 2; + + // Integrity verification field. A CRC32C checksum of the returned + // [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]. + // An integrity check of + // [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext] + // can be performed by computing the CRC32C checksum of + // [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext] + // and comparing your results to this field. Discard the response in case of + // non-matching checksum values, and perform a limited number of retries. A + // persistent mismatch may indicate an issue in your computation of the CRC32C + // checksum. Note: This field is defined as int64 for reasons of compatibility + // across different languages. However, it is a non-negative integer, which + // will never exceed 2^32-1, and can be safely downconverted to uint32 in + // languages that support this type. + google.protobuf.Int64Value ciphertext_crc32c = 4; + + // Integrity verification field. A flag indicating whether + // [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the + // [plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. A false value of + // this field indicates either that + // [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_plaintext_crc32c = 5; + + // Integrity verification field. A flag indicating whether + // [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the + // [AAD][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. A + // false value of this field indicates either that + // [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_additional_authenticated_data_crc32c = 6; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in + // encryption. + ProtectionLevel protection_level = 7; +} + +// Response message for +// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. +message DecryptResponse { + // The decrypted data originally supplied in + // [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. + bytes plaintext = 1; + + // Integrity verification field. A CRC32C checksum of the returned + // [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]. + // An integrity check of + // [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext] + // can be performed by computing the CRC32C checksum of + // [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext] + // and comparing your results to this field. Discard the response in case of + // non-matching checksum values, and perform a limited number of retries. A + // persistent mismatch may indicate an issue in your computation of the CRC32C + // checksum. Note: receiving this response message indicates that + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to + // successfully decrypt the + // [ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value plaintext_crc32c = 2; + + // Whether the Decryption was performed using the primary key version. + bool used_primary = 3; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in + // decryption. + ProtectionLevel protection_level = 4; +} + +// Response message for +// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt]. +message RawEncryptResponse { + // The encrypted data. In the case of AES-GCM, the authentication tag + // is the [tag_length][google.cloud.kms.v1.RawEncryptResponse.tag_length] + // bytes at the end of this field. + bytes ciphertext = 1; + + // The initialization vector (IV) generated by the service during + // encryption. This value must be stored and provided in + // [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector] + // at decryption time. + bytes initialization_vector = 2; + + // The length of the authentication tag that is appended to + // the end of the ciphertext. + int32 tag_length = 3; + + // Integrity verification field. A CRC32C checksum of the returned + // [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext]. + // An integrity check of ciphertext can be performed by computing the CRC32C + // checksum of ciphertext and comparing your results to this field. Discard + // the response in case of non-matching checksum values, and perform a limited + // number of retries. A persistent mismatch may indicate an issue in your + // computation of the CRC32C checksum. Note: This field is defined as int64 + // for reasons of compatibility across different languages. However, it is a + // non-negative integer, which will never exceed 2^32-1, and can be safely + // downconverted to uint32 in languages that support this type. + google.protobuf.Int64Value ciphertext_crc32c = 4; + + // Integrity verification field. A CRC32C checksum of the returned + // [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector]. + // An integrity check of initialization_vector can be performed by computing + // the CRC32C checksum of initialization_vector and comparing your results to + // this field. Discard the response in case of non-matching checksum values, + // and perform a limited number of retries. A persistent mismatch may indicate + // an issue in your computation of the CRC32C checksum. Note: This field is + // defined as int64 for reasons of compatibility across different languages. + // However, it is a non-negative integer, which will never exceed 2^32-1, and + // can be safely downconverted to uint32 in languages that support this type. + google.protobuf.Int64Value initialization_vector_crc32c = 5; + + // Integrity verification field. A flag indicating whether + // [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the plaintext. A false value of this + // field indicates either that + // [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_plaintext_crc32c = 6; + + // Integrity verification field. A flag indicating whether + // [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of additional_authenticated_data. A false + // value of this field indicates either that // + // [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_additional_authenticated_data_crc32c = 7; + + // Integrity verification field. A flag indicating whether + // [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of initialization_vector. A false value of + // this field indicates either that + // [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_initialization_vector_crc32c = 10; + + // The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in + // encryption. Check this field to verify that the intended resource was used + // for encryption. + string name = 8; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in + // encryption. + ProtectionLevel protection_level = 9; +} + +// Response message for +// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt]. +message RawDecryptResponse { + // The decrypted data. + bytes plaintext = 1; + + // Integrity verification field. A CRC32C checksum of the returned + // [RawDecryptResponse.plaintext][google.cloud.kms.v1.RawDecryptResponse.plaintext]. + // An integrity check of plaintext can be performed by computing the CRC32C + // checksum of plaintext and comparing your results to this field. Discard the + // response in case of non-matching checksum values, and perform a limited + // number of retries. A persistent mismatch may indicate an issue in your + // computation of the CRC32C checksum. Note: receiving this response message + // indicates that + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to + // successfully decrypt the + // [ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext]. + // Note: This field is defined as int64 for reasons of compatibility across + // different languages. However, it is a non-negative integer, which will + // never exceed 2^32-1, and can be safely downconverted to uint32 in languages + // that support this type. + google.protobuf.Int64Value plaintext_crc32c = 2; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in + // decryption. + ProtectionLevel protection_level = 3; + + // Integrity verification field. A flag indicating whether + // [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the ciphertext. A false value of this + // field indicates either that + // [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_ciphertext_crc32c = 4; + + // Integrity verification field. A flag indicating whether + // [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of additional_authenticated_data. A false + // value of this field indicates either that // + // [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_additional_authenticated_data_crc32c = 5; + + // Integrity verification field. A flag indicating whether + // [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of initialization_vector. A false value of + // this field indicates either that + // [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_initialization_vector_crc32c = 6; +} + +// Response message for +// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]. +message AsymmetricSignResponse { + // The created signature. + bytes signature = 1; + + // Integrity verification field. A CRC32C checksum of the returned + // [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]. + // An integrity check of + // [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature] + // can be performed by computing the CRC32C checksum of + // [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature] + // and comparing your results to this field. Discard the response in case of + // non-matching checksum values, and perform a limited number of retries. A + // persistent mismatch may indicate an issue in your computation of the CRC32C + // checksum. Note: This field is defined as int64 for reasons of compatibility + // across different languages. However, it is a non-negative integer, which + // will never exceed 2^32-1, and can be safely downconverted to uint32 in + // languages that support this type. + google.protobuf.Int64Value signature_crc32c = 2; + + // Integrity verification field. A flag indicating whether + // [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the + // [digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]. A false value + // of this field indicates either that + // [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_digest_crc32c = 3; + + // The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing. + // Check this field to verify that the intended resource was used for signing. + string name = 4; + + // Integrity verification field. A flag indicating whether + // [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the + // [data][google.cloud.kms.v1.AsymmetricSignRequest.data]. A false value of + // this field indicates either that + // [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_data_crc32c = 5; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing. + ProtectionLevel protection_level = 6; +} + +// Response message for +// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]. +message AsymmetricDecryptResponse { + // The decrypted data originally encrypted with the matching public key. + bytes plaintext = 1; + + // Integrity verification field. A CRC32C checksum of the returned + // [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]. + // An integrity check of + // [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext] + // can be performed by computing the CRC32C checksum of + // [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext] + // and comparing your results to this field. Discard the response in case of + // non-matching checksum values, and perform a limited number of retries. A + // persistent mismatch may indicate an issue in your computation of the CRC32C + // checksum. Note: This field is defined as int64 for reasons of compatibility + // across different languages. However, it is a non-negative integer, which + // will never exceed 2^32-1, and can be safely downconverted to uint32 in + // languages that support this type. + google.protobuf.Int64Value plaintext_crc32c = 2; + + // Integrity verification field. A flag indicating whether + // [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the + // [ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]. A + // false value of this field indicates either that + // [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_ciphertext_crc32c = 3; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in + // decryption. + ProtectionLevel protection_level = 4; +} + +// Response message for +// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign]. +message MacSignResponse { + // The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing. + // Check this field to verify that the intended resource was used for signing. + string name = 1; + + // The created signature. + bytes mac = 2; + + // Integrity verification field. A CRC32C checksum of the returned + // [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac]. An + // integrity check of + // [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] can be + // performed by computing the CRC32C checksum of + // [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] and + // comparing your results to this field. Discard the response in case of + // non-matching checksum values, and perform a limited number of retries. A + // persistent mismatch may indicate an issue in your computation of the CRC32C + // checksum. Note: This field is defined as int64 for reasons of compatibility + // across different languages. However, it is a non-negative integer, which + // will never exceed 2^32-1, and can be safely downconverted to uint32 in + // languages that support this type. + google.protobuf.Int64Value mac_crc32c = 3; + + // Integrity verification field. A flag indicating whether + // [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the + // [data][google.cloud.kms.v1.MacSignRequest.data]. A false value of this + // field indicates either that + // [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_data_crc32c = 4; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing. + ProtectionLevel protection_level = 5; +} + +// Response message for +// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify]. +message MacVerifyResponse { + // The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for + // verification. Check this field to verify that the intended resource was + // used for verification. + string name = 1; + + // This field indicates whether or not the verification operation for + // [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] over + // [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] was + // successful. + bool success = 2; + + // Integrity verification field. A flag indicating whether + // [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the + // [data][google.cloud.kms.v1.MacVerifyRequest.data]. A false value of this + // field indicates either that + // [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_data_crc32c = 3; + + // Integrity verification field. A flag indicating whether + // [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the + // [data][google.cloud.kms.v1.MacVerifyRequest.mac]. A false value of this + // field indicates either that + // [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_mac_crc32c = 4; + + // Integrity verification field. This value is used for the integrity + // verification of [MacVerifyResponse.success]. If the value of this field + // contradicts the value of [MacVerifyResponse.success], discard the response + // and perform a limited number of retries. + bool verified_success_integrity = 5; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for + // verification. + ProtectionLevel protection_level = 6; +} + +// Response message for +// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]. +message GenerateRandomBytesResponse { + // The generated data. + bytes data = 1; + + // Integrity verification field. A CRC32C checksum of the returned + // [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]. + // An integrity check of + // [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data] + // can be performed by computing the CRC32C checksum of + // [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data] + // and comparing your results to this field. Discard the response in case of + // non-matching checksum values, and perform a limited number of retries. A + // persistent mismatch may indicate an issue in your computation of the CRC32C + // checksum. Note: This field is defined as int64 for reasons of compatibility + // across different languages. However, it is a non-negative integer, which + // will never exceed 2^32-1, and can be safely downconverted to uint32 in + // languages that support this type. + google.protobuf.Int64Value data_crc32c = 3; +} + +// A [Digest][google.cloud.kms.v1.Digest] holds a cryptographic message digest. +message Digest { + // Required. The message digest. + oneof digest { + // A message digest produced with the SHA-256 algorithm. + bytes sha256 = 1; + + // A message digest produced with the SHA-384 algorithm. + bytes sha384 = 2; + + // A message digest produced with the SHA-512 algorithm. + bytes sha512 = 3; + } +} + +// Cloud KMS metadata for the given +// [google.cloud.location.Location][google.cloud.location.Location]. +message LocationMetadata { + // Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with + // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level] + // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] can be created in this + // location. + bool hsm_available = 1; + + // Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with + // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level] + // [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] can be created in + // this location. + bool ekm_available = 2; +} diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.create_ekm_connection.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.create_ekm_connection.js new file mode 100644 index 00000000000..58c67070167 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.create_ekm_connection.js @@ -0,0 +1,75 @@ +// 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, ekmConnectionId, ekmConnection) { + // [START cloudkms_v1_generated_EkmService_CreateEkmConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * EkmConnection google.cloud.kms.v1.EkmConnection, in the format + * `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Required. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}`. + */ + // const ekmConnectionId = 'abc123' + /** + * Required. An EkmConnection google.cloud.kms.v1.EkmConnection with + * initial field values. + */ + // const ekmConnection = {} + + // Imports the Kms library + const {EkmServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new EkmServiceClient(); + + async function callCreateEkmConnection() { + // Construct request + const request = { + parent, + ekmConnectionId, + ekmConnection, + }; + + // Run request + const response = await kmsClient.createEkmConnection(request); + console.log(response); + } + + callCreateEkmConnection(); + // [END cloudkms_v1_generated_EkmService_CreateEkmConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.get_ekm_config.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.get_ekm_config.js new file mode 100644 index 00000000000..1bd4b4ca6fc --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.get_ekm_config.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 cloudkms_v1_generated_EkmService_GetEkmConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.EkmConfig.name of the + * EkmConfig google.cloud.kms.v1.EkmConfig to get. + */ + // const name = 'abc123' + + // Imports the Kms library + const {EkmServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new EkmServiceClient(); + + async function callGetEkmConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.getEkmConfig(request); + console.log(response); + } + + callGetEkmConfig(); + // [END cloudkms_v1_generated_EkmService_GetEkmConfig_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-kms/v1/samples/generated/v1/ekm_service.get_ekm_connection.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.get_ekm_connection.js new file mode 100644 index 00000000000..c9d347d3fcc --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.get_ekm_connection.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 cloudkms_v1_generated_EkmService_GetEkmConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.EkmConnection.name of the + * EkmConnection google.cloud.kms.v1.EkmConnection to get. + */ + // const name = 'abc123' + + // Imports the Kms library + const {EkmServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new EkmServiceClient(); + + async function callGetEkmConnection() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.getEkmConnection(request); + console.log(response); + } + + callGetEkmConnection(); + // [END cloudkms_v1_generated_EkmService_GetEkmConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.list_ekm_connections.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.list_ekm_connections.js new file mode 100644 index 00000000000..f8353555c43 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.list_ekm_connections.js @@ -0,0 +1,94 @@ +// 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 cloudkms_v1_generated_EkmService_ListEkmConnections_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * EkmConnections google.cloud.kms.v1.EkmConnection to list, in the format + * `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Optional. Optional limit on the number of + * EkmConnections google.cloud.kms.v1.EkmConnection to include in the + * response. Further EkmConnections google.cloud.kms.v1.EkmConnection can + * subsequently be obtained by including the + * ListEkmConnectionsResponse.next_page_token google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Optional pagination token, returned earlier via + * ListEkmConnectionsResponse.next_page_token google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * Optional. Only include resources that match the filter in the response. For + * more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const orderBy = 'abc123' + + // Imports the Kms library + const {EkmServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new EkmServiceClient(); + + async function callListEkmConnections() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await kmsClient.listEkmConnectionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListEkmConnections(); + // [END cloudkms_v1_generated_EkmService_ListEkmConnections_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.update_ekm_config.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.update_ekm_config.js new file mode 100644 index 00000000000..58d479ffd12 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.update_ekm_config.js @@ -0,0 +1,66 @@ +// 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(ekmConfig, updateMask) { + // [START cloudkms_v1_generated_EkmService_UpdateEkmConfig_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. EkmConfig google.cloud.kms.v1.EkmConfig with updated values. + */ + // const ekmConfig = {} + /** + * Required. List of fields to be updated in this request. + */ + // const updateMask = {} + + // Imports the Kms library + const {EkmServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new EkmServiceClient(); + + async function callUpdateEkmConfig() { + // Construct request + const request = { + ekmConfig, + updateMask, + }; + + // Run request + const response = await kmsClient.updateEkmConfig(request); + console.log(response); + } + + callUpdateEkmConfig(); + // [END cloudkms_v1_generated_EkmService_UpdateEkmConfig_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-kms/v1/samples/generated/v1/ekm_service.update_ekm_connection.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.update_ekm_connection.js new file mode 100644 index 00000000000..be9cde05978 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.update_ekm_connection.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(ekmConnection, updateMask) { + // [START cloudkms_v1_generated_EkmService_UpdateEkmConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. EkmConnection google.cloud.kms.v1.EkmConnection with updated + * values. + */ + // const ekmConnection = {} + /** + * Required. List of fields to be updated in this request. + */ + // const updateMask = {} + + // Imports the Kms library + const {EkmServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new EkmServiceClient(); + + async function callUpdateEkmConnection() { + // Construct request + const request = { + ekmConnection, + updateMask, + }; + + // Run request + const response = await kmsClient.updateEkmConnection(request); + console.log(response); + } + + callUpdateEkmConnection(); + // [END cloudkms_v1_generated_EkmService_UpdateEkmConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.verify_connectivity.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.verify_connectivity.js new file mode 100644 index 00000000000..84e5eeaa873 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.verify_connectivity.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 cloudkms_v1_generated_EkmService_VerifyConnectivity_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.EkmConnection.name of the + * EkmConnection google.cloud.kms.v1.EkmConnection to verify. + */ + // const name = 'abc123' + + // Imports the Kms library + const {EkmServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new EkmServiceClient(); + + async function callVerifyConnectivity() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.verifyConnectivity(request); + console.log(response); + } + + callVerifyConnectivity(); + // [END cloudkms_v1_generated_EkmService_VerifyConnectivity_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-kms/v1/samples/generated/v1/key_management_service.asymmetric_decrypt.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.asymmetric_decrypt.js new file mode 100644 index 00000000000..3b8eb7c12a9 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.asymmetric_decrypt.js @@ -0,0 +1,92 @@ +// 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, ciphertext) { + // [START cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for + * decryption. + */ + // const name = 'abc123' + /** + * Required. The data encrypted with the named + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion's public key using + * OAEP. + */ + // const ciphertext = Buffer.from('string') + /** + * Optional. An optional CRC32C checksum of the + * AsymmetricDecryptRequest.ciphertext google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received + * AsymmetricDecryptRequest.ciphertext google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext + * using this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(AsymmetricDecryptRequest.ciphertext google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext) + * is equal to + * AsymmetricDecryptRequest.ciphertext_crc32c google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const ciphertextCrc32c = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callAsymmetricDecrypt() { + // Construct request + const request = { + name, + ciphertext, + }; + + // Run request + const response = await kmsClient.asymmetricDecrypt(request); + console.log(response); + } + + callAsymmetricDecrypt(); + // [END cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.asymmetric_sign.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.asymmetric_sign.js new file mode 100644 index 00000000000..32277ce68fb --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.asymmetric_sign.js @@ -0,0 +1,123 @@ +// 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 cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for + * signing. + */ + // const name = 'abc123' + /** + * Optional. The digest of the data to sign. The digest must be produced with + * the same digest algorithm as specified by the key version's + * algorithm google.cloud.kms.v1.CryptoKeyVersion.algorithm. + * This field may not be supplied if + * AsymmetricSignRequest.data google.cloud.kms.v1.AsymmetricSignRequest.data + * is supplied. + */ + // const digest = {} + /** + * Optional. An optional CRC32C checksum of the + * AsymmetricSignRequest.digest google.cloud.kms.v1.AsymmetricSignRequest.digest. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received + * AsymmetricSignRequest.digest google.cloud.kms.v1.AsymmetricSignRequest.digest + * using this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(AsymmetricSignRequest.digest google.cloud.kms.v1.AsymmetricSignRequest.digest) + * is equal to + * AsymmetricSignRequest.digest_crc32c google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const digestCrc32c = {} + /** + * Optional. The data to sign. + * It can't be supplied if + * AsymmetricSignRequest.digest google.cloud.kms.v1.AsymmetricSignRequest.digest + * is supplied. + */ + // const data = Buffer.from('string') + /** + * Optional. An optional CRC32C checksum of the + * AsymmetricSignRequest.data google.cloud.kms.v1.AsymmetricSignRequest.data. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received + * AsymmetricSignRequest.data google.cloud.kms.v1.AsymmetricSignRequest.data + * using this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(AsymmetricSignRequest.data google.cloud.kms.v1.AsymmetricSignRequest.data) + * is equal to + * AsymmetricSignRequest.data_crc32c google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const dataCrc32c = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callAsymmetricSign() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.asymmetricSign(request); + console.log(response); + } + + callAsymmetricSign(); + // [END cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_crypto_key.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_crypto_key.js new file mode 100644 index 00000000000..b54a03167aa --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_crypto_key.js @@ -0,0 +1,85 @@ +// 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, cryptoKeyId, cryptoKey) { + // [START cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.KeyRing.name of the KeyRing + * associated with the CryptoKeys google.cloud.kms.v1.CryptoKey. + */ + // const parent = 'abc123' + /** + * Required. It must be unique within a KeyRing and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + */ + // const cryptoKeyId = 'abc123' + /** + * Required. A CryptoKey google.cloud.kms.v1.CryptoKey with initial field + * values. + */ + // const cryptoKey = {} + /** + * If set to true, the request will create a + * CryptoKey google.cloud.kms.v1.CryptoKey without any + * CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion. You must + * manually call + * CreateCryptoKeyVersion google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion + * or + * ImportCryptoKeyVersion google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion + * before you can use this CryptoKey google.cloud.kms.v1.CryptoKey. + */ + // const skipInitialVersionCreation = true + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callCreateCryptoKey() { + // Construct request + const request = { + parent, + cryptoKeyId, + cryptoKey, + }; + + // Run request + const response = await kmsClient.createCryptoKey(request); + console.log(response); + } + + callCreateCryptoKey(); + // [END cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_crypto_key_version.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_crypto_key_version.js new file mode 100644 index 00000000000..88d3f0579a6 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_crypto_key_version.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, cryptoKeyVersion) { + // [START cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.CryptoKey.name of the + * CryptoKey google.cloud.kms.v1.CryptoKey associated with the + * CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion. + */ + // const parent = 'abc123' + /** + * Required. A CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion with + * initial field values. + */ + // const cryptoKeyVersion = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callCreateCryptoKeyVersion() { + // Construct request + const request = { + parent, + cryptoKeyVersion, + }; + + // Run request + const response = await kmsClient.createCryptoKeyVersion(request); + console.log(response); + } + + callCreateCryptoKeyVersion(); + // [END cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_import_job.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_import_job.js new file mode 100644 index 00000000000..73a8beb1271 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_import_job.js @@ -0,0 +1,75 @@ +// 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, importJobId, importJob) { + // [START cloudkms_v1_generated_KeyManagementService_CreateImportJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.KeyRing.name of the + * KeyRing google.cloud.kms.v1.KeyRing associated with the + * ImportJobs google.cloud.kms.v1.ImportJob. + */ + // const parent = 'abc123' + /** + * Required. It must be unique within a KeyRing and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + */ + // const importJobId = 'abc123' + /** + * Required. An ImportJob google.cloud.kms.v1.ImportJob with initial field + * values. + */ + // const importJob = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callCreateImportJob() { + // Construct request + const request = { + parent, + importJobId, + importJob, + }; + + // Run request + const response = await kmsClient.createImportJob(request); + console.log(response); + } + + callCreateImportJob(); + // [END cloudkms_v1_generated_KeyManagementService_CreateImportJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_key_ring.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_key_ring.js new file mode 100644 index 00000000000..dfca3c2077d --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_key_ring.js @@ -0,0 +1,75 @@ +// 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, keyRingId, keyRing) { + // [START cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * KeyRings google.cloud.kms.v1.KeyRing, in the format + * `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Required. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + */ + // const keyRingId = 'abc123' + /** + * Required. A KeyRing google.cloud.kms.v1.KeyRing with initial field + * values. + */ + // const keyRing = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callCreateKeyRing() { + // Construct request + const request = { + parent, + keyRingId, + keyRing, + }; + + // Run request + const response = await kmsClient.createKeyRing(request); + console.log(response); + } + + callCreateKeyRing(); + // [END cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.decrypt.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.decrypt.js new file mode 100644 index 00000000000..ea9cecee93e --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.decrypt.js @@ -0,0 +1,118 @@ +// 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, ciphertext) { + // [START cloudkms_v1_generated_KeyManagementService_Decrypt_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKey google.cloud.kms.v1.CryptoKey to use for decryption. The + * server will choose the appropriate version. + */ + // const name = 'abc123' + /** + * Required. The encrypted data originally returned in + * EncryptResponse.ciphertext google.cloud.kms.v1.EncryptResponse.ciphertext. + */ + // const ciphertext = Buffer.from('string') + /** + * Optional. Optional data that must match the data originally supplied in + * EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data. + */ + // const additionalAuthenticatedData = Buffer.from('string') + /** + * Optional. An optional CRC32C checksum of the + * DecryptRequest.ciphertext google.cloud.kms.v1.DecryptRequest.ciphertext. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received + * DecryptRequest.ciphertext google.cloud.kms.v1.DecryptRequest.ciphertext + * using this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(DecryptRequest.ciphertext google.cloud.kms.v1.DecryptRequest.ciphertext) + * is equal to + * DecryptRequest.ciphertext_crc32c google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const ciphertextCrc32c = {} + /** + * Optional. An optional CRC32C checksum of the + * DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received + * DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data + * using this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data) + * is equal to + * DecryptRequest.additional_authenticated_data_crc32c google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const additionalAuthenticatedDataCrc32c = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callDecrypt() { + // Construct request + const request = { + name, + ciphertext, + }; + + // Run request + const response = await kmsClient.decrypt(request); + console.log(response); + } + + callDecrypt(); + // [END cloudkms_v1_generated_KeyManagementService_Decrypt_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.destroy_crypto_key_version.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.destroy_crypto_key_version.js new file mode 100644 index 00000000000..50b0a9b66a0 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.destroy_crypto_key_version.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 cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to destroy. + */ + // const name = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callDestroyCryptoKeyVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.destroyCryptoKeyVersion(request); + console.log(response); + } + + callDestroyCryptoKeyVersion(); + // [END cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.encrypt.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.encrypt.js new file mode 100644 index 00000000000..dabbe16a547 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.encrypt.js @@ -0,0 +1,139 @@ +// 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, plaintext) { + // [START cloudkms_v1_generated_KeyManagementService_Encrypt_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKey google.cloud.kms.v1.CryptoKey or + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for + * encryption. + * If a CryptoKey google.cloud.kms.v1.CryptoKey is specified, the server + * will use its primary version google.cloud.kms.v1.CryptoKey.primary. + */ + // const name = 'abc123' + /** + * Required. The data to encrypt. Must be no larger than 64KiB. + * The maximum size depends on the key version's + * protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level. + * For SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE, + * EXTERNAL google.cloud.kms.v1.ProtectionLevel.EXTERNAL, and + * EXTERNAL_VPC google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC keys, the + * plaintext must be no larger than 64KiB. For + * HSM google.cloud.kms.v1.ProtectionLevel.HSM keys, the combined length of + * the plaintext and additional_authenticated_data fields must be no larger + * than 8KiB. + */ + // const plaintext = Buffer.from('string') + /** + * Optional. Optional data that, if specified, must also be provided during + * decryption through + * DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data. + * The maximum size depends on the key version's + * protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level. + * For SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE, + * EXTERNAL google.cloud.kms.v1.ProtectionLevel.EXTERNAL, and + * EXTERNAL_VPC google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC keys the + * AAD must be no larger than 64KiB. For + * HSM google.cloud.kms.v1.ProtectionLevel.HSM keys, the combined length of + * the plaintext and additional_authenticated_data fields must be no larger + * than 8KiB. + */ + // const additionalAuthenticatedData = Buffer.from('string') + /** + * Optional. An optional CRC32C checksum of the + * EncryptRequest.plaintext google.cloud.kms.v1.EncryptRequest.plaintext. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received + * EncryptRequest.plaintext google.cloud.kms.v1.EncryptRequest.plaintext + * using this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(EncryptRequest.plaintext google.cloud.kms.v1.EncryptRequest.plaintext) + * is equal to + * EncryptRequest.plaintext_crc32c google.cloud.kms.v1.EncryptRequest.plaintext_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const plaintextCrc32c = {} + /** + * Optional. An optional CRC32C checksum of the + * EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received + * EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data + * using this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data) + * is equal to + * EncryptRequest.additional_authenticated_data_crc32c google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const additionalAuthenticatedDataCrc32c = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callEncrypt() { + // Construct request + const request = { + name, + plaintext, + }; + + // Run request + const response = await kmsClient.encrypt(request); + console.log(response); + } + + callEncrypt(); + // [END cloudkms_v1_generated_KeyManagementService_Encrypt_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.generate_random_bytes.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.generate_random_bytes.js new file mode 100644 index 00000000000..c0df8619dcb --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.generate_random_bytes.js @@ -0,0 +1,73 @@ +// 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() { + // [START cloudkms_v1_generated_KeyManagementService_GenerateRandomBytes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The project-specific location in which to generate random bytes. + * For example, "projects/my-project/locations/us-central1". + */ + // const location = 'abc123' + /** + * The length in bytes of the amount of randomness to retrieve. Minimum 8 + * bytes, maximum 1024 bytes. + */ + // const lengthBytes = 1234 + /** + * The ProtectionLevel google.cloud.kms.v1.ProtectionLevel to use when + * generating the random data. Currently, only + * HSM google.cloud.kms.v1.ProtectionLevel.HSM protection level is + * supported. + */ + // const protectionLevel = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callGenerateRandomBytes() { + // Construct request + const request = { + }; + + // Run request + const response = await kmsClient.generateRandomBytes(request); + console.log(response); + } + + callGenerateRandomBytes(); + // [END cloudkms_v1_generated_KeyManagementService_GenerateRandomBytes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_crypto_key.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_crypto_key.js new file mode 100644 index 00000000000..56eb2dacf97 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_crypto_key.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 cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.CryptoKey.name of the + * CryptoKey google.cloud.kms.v1.CryptoKey to get. + */ + // const name = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callGetCryptoKey() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.getCryptoKey(request); + console.log(response); + } + + callGetCryptoKey(); + // [END cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_crypto_key_version.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_crypto_key_version.js new file mode 100644 index 00000000000..e0e3df10922 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_crypto_key_version.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 cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.CryptoKeyVersion.name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to get. + */ + // const name = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callGetCryptoKeyVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.getCryptoKeyVersion(request); + console.log(response); + } + + callGetCryptoKeyVersion(); + // [END cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_import_job.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_import_job.js new file mode 100644 index 00000000000..699bcd6bca8 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_import_job.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 cloudkms_v1_generated_KeyManagementService_GetImportJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.ImportJob.name of the + * ImportJob google.cloud.kms.v1.ImportJob to get. + */ + // const name = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callGetImportJob() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.getImportJob(request); + console.log(response); + } + + callGetImportJob(); + // [END cloudkms_v1_generated_KeyManagementService_GetImportJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_key_ring.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_key_ring.js new file mode 100644 index 00000000000..69afc7b2809 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_key_ring.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 cloudkms_v1_generated_KeyManagementService_GetKeyRing_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.KeyRing.name of the + * KeyRing google.cloud.kms.v1.KeyRing to get. + */ + // const name = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callGetKeyRing() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.getKeyRing(request); + console.log(response); + } + + callGetKeyRing(); + // [END cloudkms_v1_generated_KeyManagementService_GetKeyRing_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_public_key.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_public_key.js new file mode 100644 index 00000000000..019771352b5 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_public_key.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 cloudkms_v1_generated_KeyManagementService_GetPublicKey_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.CryptoKeyVersion.name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion public key to get. + */ + // const name = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callGetPublicKey() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.getPublicKey(request); + console.log(response); + } + + callGetPublicKey(); + // [END cloudkms_v1_generated_KeyManagementService_GetPublicKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.import_crypto_key_version.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.import_crypto_key_version.js new file mode 100644 index 00000000000..0d18113111e --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.import_crypto_key_version.js @@ -0,0 +1,145 @@ +// 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, algorithm, importJob) { + // [START cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.CryptoKey.name of the + * CryptoKey google.cloud.kms.v1.CryptoKey to be imported into. + * The create permission is only required on this key when creating a new + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion. + */ + // const parent = 'abc123' + /** + * Optional. The optional name google.cloud.kms.v1.CryptoKeyVersion.name of + * an existing CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to + * target for an import operation. If this field is not present, a new + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion containing the + * supplied key material is created. + * If this field is present, the supplied key material is imported into + * the existing CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion. To + * import into an existing + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion, the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion must be a child of + * ImportCryptoKeyVersionRequest.parent google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent, + * have been previously created via ImportCryptoKeyVersion , and be in + * DESTROYED google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED + * or + * IMPORT_FAILED google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED + * state. The key material and algorithm must match the previous + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion exactly if the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion has ever contained + * key material. + */ + // const cryptoKeyVersion = 'abc123' + /** + * Required. The + * algorithm google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm + * of the key being imported. This does not need to match the + * version_template google.cloud.kms.v1.CryptoKey.version_template of the + * CryptoKey google.cloud.kms.v1.CryptoKey this version imports into. + */ + // const algorithm = {} + /** + * Required. The name google.cloud.kms.v1.ImportJob.name of the + * ImportJob google.cloud.kms.v1.ImportJob that was used to wrap this key + * material. + */ + // const importJob = 'abc123' + /** + * Optional. The wrapped key material to import. + * Before wrapping, key material must be formatted. If importing symmetric key + * material, the expected key material format is plain bytes. If importing + * asymmetric key material, the expected key material format is PKCS#8-encoded + * DER (the PrivateKeyInfo structure from RFC 5208). + * When wrapping with import methods + * (RSA_OAEP_3072_SHA1_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256 + * or + * RSA_OAEP_4096_SHA1_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256 + * or + * RSA_OAEP_3072_SHA256_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256 + * or + * RSA_OAEP_4096_SHA256_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256), + * this field must contain the concatenation of: + *
    + *
  1. An ephemeral AES-256 wrapping key wrapped with the + * public_key google.cloud.kms.v1.ImportJob.public_key using + * RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an empty + * label. + *
  2. + *
  3. The formatted key to be imported, wrapped with the ephemeral AES-256 + * key using AES-KWP (RFC 5649). + *
  4. + *
+ * This format is the same as the format produced by PKCS#11 mechanism + * CKM_RSA_AES_KEY_WRAP. + * When wrapping with import methods + * (RSA_OAEP_3072_SHA256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256 + * or + * RSA_OAEP_4096_SHA256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256), + * this field must contain the formatted key to be imported, wrapped with the + * public_key google.cloud.kms.v1.ImportJob.public_key using RSAES-OAEP + * with SHA-256, MGF1 with SHA-256, and an empty label. + */ + // const wrappedKey = Buffer.from('string') + /** + * Optional. This field has the same meaning as + * wrapped_key google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key. + * Prefer to use that field in new work. Either that field or this field + * (but not both) must be specified. + */ + // const rsaAesWrappedKey = Buffer.from('string') + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callImportCryptoKeyVersion() { + // Construct request + const request = { + parent, + algorithm, + importJob, + }; + + // Run request + const response = await kmsClient.importCryptoKeyVersion(request); + console.log(response); + } + + callImportCryptoKeyVersion(); + // [END cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_crypto_key_versions.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_crypto_key_versions.js new file mode 100644 index 00000000000..2d5695aa5b4 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_crypto_key_versions.js @@ -0,0 +1,98 @@ +// 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 cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKey google.cloud.kms.v1.CryptoKey to list, in the format + * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. + */ + // const parent = 'abc123' + /** + * Optional. Optional limit on the number of + * CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion to include in the + * response. Further CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion + * can subsequently be obtained by including the + * ListCryptoKeyVersionsResponse.next_page_token google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Optional pagination token, returned earlier via + * ListCryptoKeyVersionsResponse.next_page_token google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * The fields to include in the response. + */ + // const view = {} + /** + * Optional. Only include resources that match the filter in the response. For + * more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const orderBy = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callListCryptoKeyVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await kmsClient.listCryptoKeyVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCryptoKeyVersions(); + // [END cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_crypto_keys.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_crypto_keys.js new file mode 100644 index 00000000000..615dc84a567 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_crypto_keys.js @@ -0,0 +1,97 @@ +// 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 cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the KeyRing google.cloud.kms.v1.KeyRing + * to list, in the format `projects/* /locations/* /keyRings/*`. + */ + // const parent = 'abc123' + /** + * Optional. Optional limit on the number of + * CryptoKeys google.cloud.kms.v1.CryptoKey to include in the response. + * Further CryptoKeys google.cloud.kms.v1.CryptoKey can subsequently be + * obtained by including the + * ListCryptoKeysResponse.next_page_token google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Optional pagination token, returned earlier via + * ListCryptoKeysResponse.next_page_token google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * The fields of the primary version to include in the response. + */ + // const versionView = {} + /** + * Optional. Only include resources that match the filter in the response. For + * more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const orderBy = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callListCryptoKeys() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await kmsClient.listCryptoKeysAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCryptoKeys(); + // [END cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_import_jobs.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_import_jobs.js new file mode 100644 index 00000000000..c6161bbe4fc --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_import_jobs.js @@ -0,0 +1,93 @@ +// 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 cloudkms_v1_generated_KeyManagementService_ListImportJobs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the KeyRing google.cloud.kms.v1.KeyRing + * to list, in the format `projects/* /locations/* /keyRings/*`. + */ + // const parent = 'abc123' + /** + * Optional. Optional limit on the number of + * ImportJobs google.cloud.kms.v1.ImportJob to include in the response. + * Further ImportJobs google.cloud.kms.v1.ImportJob can subsequently be + * obtained by including the + * ListImportJobsResponse.next_page_token google.cloud.kms.v1.ListImportJobsResponse.next_page_token + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Optional pagination token, returned earlier via + * ListImportJobsResponse.next_page_token google.cloud.kms.v1.ListImportJobsResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * Optional. Only include resources that match the filter in the response. For + * more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const orderBy = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callListImportJobs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await kmsClient.listImportJobsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListImportJobs(); + // [END cloudkms_v1_generated_KeyManagementService_ListImportJobs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_key_rings.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_key_rings.js new file mode 100644 index 00000000000..ccf1426a56e --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_key_rings.js @@ -0,0 +1,94 @@ +// 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 cloudkms_v1_generated_KeyManagementService_ListKeyRings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * KeyRings google.cloud.kms.v1.KeyRing, in the format + * `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Optional. Optional limit on the number of + * KeyRings google.cloud.kms.v1.KeyRing to include in the response. Further + * KeyRings google.cloud.kms.v1.KeyRing can subsequently be obtained by + * including the + * ListKeyRingsResponse.next_page_token google.cloud.kms.v1.ListKeyRingsResponse.next_page_token + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Optional pagination token, returned earlier via + * ListKeyRingsResponse.next_page_token google.cloud.kms.v1.ListKeyRingsResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * Optional. Only include resources that match the filter in the response. For + * more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const orderBy = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callListKeyRings() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await kmsClient.listKeyRingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListKeyRings(); + // [END cloudkms_v1_generated_KeyManagementService_ListKeyRings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.mac_sign.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.mac_sign.js new file mode 100644 index 00000000000..418a3cbcd3f --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.mac_sign.js @@ -0,0 +1,89 @@ +// 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, data) { + // [START cloudkms_v1_generated_KeyManagementService_MacSign_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for + * signing. + */ + // const name = 'abc123' + /** + * Required. The data to sign. The MAC tag is computed over this data field + * based on the specific algorithm. + */ + // const data = Buffer.from('string') + /** + * Optional. An optional CRC32C checksum of the + * MacSignRequest.data google.cloud.kms.v1.MacSignRequest.data. If + * specified, KeyManagementService google.cloud.kms.v1.KeyManagementService + * will verify the integrity of the received + * MacSignRequest.data google.cloud.kms.v1.MacSignRequest.data using this + * checksum. KeyManagementService google.cloud.kms.v1.KeyManagementService + * will report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(MacSignRequest.data google.cloud.kms.v1.MacSignRequest.data) is + * equal to + * MacSignRequest.data_crc32c google.cloud.kms.v1.MacSignRequest.data_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const dataCrc32c = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callMacSign() { + // Construct request + const request = { + name, + data, + }; + + // Run request + const response = await kmsClient.macSign(request); + console.log(response); + } + + callMacSign(); + // [END cloudkms_v1_generated_KeyManagementService_MacSign_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.mac_verify.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.mac_verify.js new file mode 100644 index 00000000000..eae353774e9 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.mac_verify.js @@ -0,0 +1,115 @@ +// 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, data, mac) { + // [START cloudkms_v1_generated_KeyManagementService_MacVerify_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for + * verification. + */ + // const name = 'abc123' + /** + * Required. The data used previously as a + * MacSignRequest.data google.cloud.kms.v1.MacSignRequest.data to generate + * the MAC tag. + */ + // const data = Buffer.from('string') + /** + * Optional. An optional CRC32C checksum of the + * MacVerifyRequest.data google.cloud.kms.v1.MacVerifyRequest.data. If + * specified, KeyManagementService google.cloud.kms.v1.KeyManagementService + * will verify the integrity of the received + * MacVerifyRequest.data google.cloud.kms.v1.MacVerifyRequest.data using + * this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(MacVerifyRequest.data google.cloud.kms.v1.MacVerifyRequest.data) + * is equal to + * MacVerifyRequest.data_crc32c google.cloud.kms.v1.MacVerifyRequest.data_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const dataCrc32c = {} + /** + * Required. The signature to verify. + */ + // const mac = Buffer.from('string') + /** + * Optional. An optional CRC32C checksum of the + * MacVerifyRequest.mac google.cloud.kms.v1.MacVerifyRequest.mac. If + * specified, KeyManagementService google.cloud.kms.v1.KeyManagementService + * will verify the integrity of the received + * MacVerifyRequest.mac google.cloud.kms.v1.MacVerifyRequest.mac using this + * checksum. KeyManagementService google.cloud.kms.v1.KeyManagementService + * will report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(MacVerifyRequest.tag ) is equal to + * MacVerifyRequest.mac_crc32c google.cloud.kms.v1.MacVerifyRequest.mac_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const macCrc32c = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callMacVerify() { + // Construct request + const request = { + name, + data, + mac, + }; + + // Run request + const response = await kmsClient.macVerify(request); + console.log(response); + } + + callMacVerify(); + // [END cloudkms_v1_generated_KeyManagementService_MacVerify_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.raw_decrypt.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.raw_decrypt.js new file mode 100644 index 00000000000..d03236a2a89 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.raw_decrypt.js @@ -0,0 +1,142 @@ +// 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, ciphertext, initializationVector) { + // [START cloudkms_v1_generated_KeyManagementService_RawDecrypt_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for + * decryption. + */ + // const name = 'abc123' + /** + * Required. The encrypted data originally returned in + * RawEncryptResponse.ciphertext google.cloud.kms.v1.RawEncryptResponse.ciphertext. + */ + // const ciphertext = Buffer.from('string') + /** + * Optional. Optional data that must match the data originally supplied in + * RawEncryptRequest.additional_authenticated_data google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data. + */ + // const additionalAuthenticatedData = Buffer.from('string') + /** + * Required. The initialization vector (IV) used during encryption, which must + * match the data originally provided in + * RawEncryptResponse.initialization_vector google.cloud.kms.v1.RawEncryptResponse.initialization_vector. + */ + // const initializationVector = Buffer.from('string') + /** + * The length of the authentication tag that is appended to the end of + * the ciphertext. If unspecified (0), the default value for the key's + * algorithm will be used (for AES-GCM, the default value is 16). + */ + // const tagLength = 1234 + /** + * Optional. An optional CRC32C checksum of the + * RawDecryptRequest.ciphertext google.cloud.kms.v1.RawDecryptRequest.ciphertext. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received ciphertext using this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that CRC32C(ciphertext) is equal + * to ciphertext_crc32c, and if so, perform a limited number of retries. A + * persistent mismatch may indicate an issue in your computation of the CRC32C + * checksum. Note: This field is defined as int64 for reasons of compatibility + * across different languages. However, it is a non-negative integer, which + * will never exceed 2^32-1, and can be safely downconverted to uint32 in + * languages that support this type. + */ + // const ciphertextCrc32c = {} + /** + * Optional. An optional CRC32C checksum of the + * RawDecryptRequest.additional_authenticated_data google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received additional_authenticated_data using + * this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(additional_authenticated_data) is equal to + * additional_authenticated_data_crc32c, and if so, perform + * a limited number of retries. A persistent mismatch may indicate an issue in + * your computation of the CRC32C checksum. + * Note: This field is defined as int64 for reasons of compatibility across + * different languages. However, it is a non-negative integer, which will + * never exceed 2^32-1, and can be safely downconverted to uint32 in languages + * that support this type. + */ + // const additionalAuthenticatedDataCrc32c = {} + /** + * Optional. An optional CRC32C checksum of the + * RawDecryptRequest.initialization_vector google.cloud.kms.v1.RawDecryptRequest.initialization_vector. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received initialization_vector using this + * checksum. KeyManagementService google.cloud.kms.v1.KeyManagementService + * will report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and + * if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. + * Note: This field is defined as int64 for reasons of compatibility across + * different languages. However, it is a non-negative integer, which will + * never exceed 2^32-1, and can be safely downconverted to uint32 in languages + * that support this type. + */ + // const initializationVectorCrc32c = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callRawDecrypt() { + // Construct request + const request = { + name, + ciphertext, + initializationVector, + }; + + // Run request + const response = await kmsClient.rawDecrypt(request); + console.log(response); + } + + callRawDecrypt(); + // [END cloudkms_v1_generated_KeyManagementService_RawDecrypt_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-kms/v1/samples/generated/v1/key_management_service.raw_encrypt.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.raw_encrypt.js new file mode 100644 index 00000000000..4b27306d4b2 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.raw_encrypt.js @@ -0,0 +1,154 @@ +// 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, plaintext) { + // [START cloudkms_v1_generated_KeyManagementService_RawEncrypt_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for + * encryption. + */ + // const name = 'abc123' + /** + * Required. The data to encrypt. Must be no larger than 64KiB. + * The maximum size depends on the key version's + * protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level. + * For SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE keys, the + * plaintext must be no larger than 64KiB. For + * HSM google.cloud.kms.v1.ProtectionLevel.HSM keys, the combined length of + * the plaintext and additional_authenticated_data fields must be no larger + * than 8KiB. + */ + // const plaintext = Buffer.from('string') + /** + * Optional. Optional data that, if specified, must also be provided during + * decryption through + * RawDecryptRequest.additional_authenticated_data google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data. + * This field may only be used in conjunction with an + * algorithm google.cloud.kms.v1.CryptoKeyVersion.algorithm that accepts + * additional authenticated data (for example, AES-GCM). + * The maximum size depends on the key version's + * protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level. + * For SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE keys, the + * plaintext must be no larger than 64KiB. For + * HSM google.cloud.kms.v1.ProtectionLevel.HSM keys, the combined length of + * the plaintext and additional_authenticated_data fields must be no larger + * than 8KiB. + */ + // const additionalAuthenticatedData = Buffer.from('string') + /** + * Optional. An optional CRC32C checksum of the + * RawEncryptRequest.plaintext google.cloud.kms.v1.RawEncryptRequest.plaintext. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received plaintext using this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that CRC32C(plaintext) is equal + * to plaintext_crc32c, and if so, perform a limited number of retries. A + * persistent mismatch may indicate an issue in your computation of the CRC32C + * checksum. Note: This field is defined as int64 for reasons of compatibility + * across different languages. However, it is a non-negative integer, which + * will never exceed 2^32-1, and can be safely downconverted to uint32 in + * languages that support this type. + */ + // const plaintextCrc32c = {} + /** + * Optional. An optional CRC32C checksum of the + * RawEncryptRequest.additional_authenticated_data google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received additional_authenticated_data using + * this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(additional_authenticated_data) is equal to + * additional_authenticated_data_crc32c, and if so, perform + * a limited number of retries. A persistent mismatch may indicate an issue in + * your computation of the CRC32C checksum. + * Note: This field is defined as int64 for reasons of compatibility across + * different languages. However, it is a non-negative integer, which will + * never exceed 2^32-1, and can be safely downconverted to uint32 in languages + * that support this type. + */ + // const additionalAuthenticatedDataCrc32c = {} + /** + * Optional. A customer-supplied initialization vector that will be used for + * encryption. If it is not provided for AES-CBC and AES-CTR, one will be + * generated. It will be returned in + * RawEncryptResponse.initialization_vector google.cloud.kms.v1.RawEncryptResponse.initialization_vector. + */ + // const initializationVector = Buffer.from('string') + /** + * Optional. An optional CRC32C checksum of the + * RawEncryptRequest.initialization_vector google.cloud.kms.v1.RawEncryptRequest.initialization_vector. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received initialization_vector using this + * checksum. KeyManagementService google.cloud.kms.v1.KeyManagementService + * will report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(initialization_vector) is equal to + * initialization_vector_crc32c, and if so, perform + * a limited number of retries. A persistent mismatch may indicate an issue in + * your computation of the CRC32C checksum. + * Note: This field is defined as int64 for reasons of compatibility across + * different languages. However, it is a non-negative integer, which will + * never exceed 2^32-1, and can be safely downconverted to uint32 in languages + * that support this type. + */ + // const initializationVectorCrc32c = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callRawEncrypt() { + // Construct request + const request = { + name, + plaintext, + }; + + // Run request + const response = await kmsClient.rawEncrypt(request); + console.log(response); + } + + callRawEncrypt(); + // [END cloudkms_v1_generated_KeyManagementService_RawEncrypt_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-kms/v1/samples/generated/v1/key_management_service.restore_crypto_key_version.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.restore_crypto_key_version.js new file mode 100644 index 00000000000..a3133d23f8e --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.restore_crypto_key_version.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 cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to restore. + */ + // const name = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callRestoreCryptoKeyVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.restoreCryptoKeyVersion(request); + console.log(response); + } + + callRestoreCryptoKeyVersion(); + // [END cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key.js new file mode 100644 index 00000000000..cafb6efa4ad --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key.js @@ -0,0 +1,66 @@ +// 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(cryptoKey, updateMask) { + // [START cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. CryptoKey google.cloud.kms.v1.CryptoKey with updated values. + */ + // const cryptoKey = {} + /** + * Required. List of fields to be updated in this request. + */ + // const updateMask = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callUpdateCryptoKey() { + // Construct request + const request = { + cryptoKey, + updateMask, + }; + + // Run request + const response = await kmsClient.updateCryptoKey(request); + console.log(response); + } + + callUpdateCryptoKey(); + // [END cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js new file mode 100644 index 00000000000..de28c966352 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js @@ -0,0 +1,68 @@ +// 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, cryptoKeyVersionId) { + // [START cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKey google.cloud.kms.v1.CryptoKey to update. + */ + // const name = 'abc123' + /** + * Required. The id of the child + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use as primary. + */ + // const cryptoKeyVersionId = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callUpdateCryptoKeyPrimaryVersion() { + // Construct request + const request = { + name, + cryptoKeyVersionId, + }; + + // Run request + const response = await kmsClient.updateCryptoKeyPrimaryVersion(request); + console.log(response); + } + + callUpdateCryptoKeyPrimaryVersion(); + // [END cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key_version.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key_version.js new file mode 100644 index 00000000000..309d3911278 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key_version.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(cryptoKeyVersion, updateMask) { + // [START cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion with + * updated values. + */ + // const cryptoKeyVersion = {} + /** + * Required. List of fields to be updated in this request. + */ + // const updateMask = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callUpdateCryptoKeyVersion() { + // Construct request + const request = { + cryptoKeyVersion, + updateMask, + }; + + // Run request + const response = await kmsClient.updateCryptoKeyVersion(request); + console.log(response); + } + + callUpdateCryptoKeyVersion(); + // [END cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/snippet_metadata_google.cloud.kms.v1.json b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/snippet_metadata_google.cloud.kms.v1.json new file mode 100644 index 00000000000..da9b7bd30e7 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/snippet_metadata_google.cloud.kms.v1.json @@ -0,0 +1,1723 @@ +{ + "clientLibrary": { + "name": "nodejs-kms", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.kms.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudkms_v1_generated_EkmService_ListEkmConnections_async", + "title": "EkmService listEkmConnections Sample", + "origin": "API_DEFINITION", + "description": " Lists [EkmConnections][google.cloud.kms.v1.EkmConnection].", + "canonical": true, + "file": "ekm_service.list_ekm_connections.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 86, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListEkmConnections", + "fullName": "google.cloud.kms.v1.EkmService.ListEkmConnections", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.ListEkmConnectionsResponse", + "client": { + "shortName": "EkmServiceClient", + "fullName": "google.cloud.kms.v1.EkmServiceClient" + }, + "method": { + "shortName": "ListEkmConnections", + "fullName": "google.cloud.kms.v1.EkmService.ListEkmConnections", + "service": { + "shortName": "EkmService", + "fullName": "google.cloud.kms.v1.EkmService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_EkmService_GetEkmConnection_async", + "title": "EkmService getEkmConnection Sample", + "origin": "API_DEFINITION", + "description": " Returns metadata for a given [EkmConnection][google.cloud.kms.v1.EkmConnection].", + "canonical": true, + "file": "ekm_service.get_ekm_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEkmConnection", + "fullName": "google.cloud.kms.v1.EkmService.GetEkmConnection", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.EkmConnection", + "client": { + "shortName": "EkmServiceClient", + "fullName": "google.cloud.kms.v1.EkmServiceClient" + }, + "method": { + "shortName": "GetEkmConnection", + "fullName": "google.cloud.kms.v1.EkmService.GetEkmConnection", + "service": { + "shortName": "EkmService", + "fullName": "google.cloud.kms.v1.EkmService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_EkmService_CreateEkmConnection_async", + "title": "EkmService createEkmConnection Sample", + "origin": "API_DEFINITION", + "description": " Creates a new [EkmConnection][google.cloud.kms.v1.EkmConnection] in a given Project and Location.", + "canonical": true, + "file": "ekm_service.create_ekm_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateEkmConnection", + "fullName": "google.cloud.kms.v1.EkmService.CreateEkmConnection", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "ekm_connection_id", + "type": "TYPE_STRING" + }, + { + "name": "ekm_connection", + "type": ".google.cloud.kms.v1.EkmConnection" + } + ], + "resultType": ".google.cloud.kms.v1.EkmConnection", + "client": { + "shortName": "EkmServiceClient", + "fullName": "google.cloud.kms.v1.EkmServiceClient" + }, + "method": { + "shortName": "CreateEkmConnection", + "fullName": "google.cloud.kms.v1.EkmService.CreateEkmConnection", + "service": { + "shortName": "EkmService", + "fullName": "google.cloud.kms.v1.EkmService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_EkmService_UpdateEkmConnection_async", + "title": "EkmService updateEkmConnection Sample", + "origin": "API_DEFINITION", + "description": " Updates an [EkmConnection][google.cloud.kms.v1.EkmConnection]'s metadata.", + "canonical": true, + "file": "ekm_service.update_ekm_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateEkmConnection", + "fullName": "google.cloud.kms.v1.EkmService.UpdateEkmConnection", + "async": true, + "parameters": [ + { + "name": "ekm_connection", + "type": ".google.cloud.kms.v1.EkmConnection" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.kms.v1.EkmConnection", + "client": { + "shortName": "EkmServiceClient", + "fullName": "google.cloud.kms.v1.EkmServiceClient" + }, + "method": { + "shortName": "UpdateEkmConnection", + "fullName": "google.cloud.kms.v1.EkmService.UpdateEkmConnection", + "service": { + "shortName": "EkmService", + "fullName": "google.cloud.kms.v1.EkmService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_EkmService_GetEkmConfig_async", + "title": "EkmService getEkmConfig Sample", + "origin": "API_DEFINITION", + "description": " Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project and location.", + "canonical": true, + "file": "ekm_service.get_ekm_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEkmConfig", + "fullName": "google.cloud.kms.v1.EkmService.GetEkmConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.EkmConfig", + "client": { + "shortName": "EkmServiceClient", + "fullName": "google.cloud.kms.v1.EkmServiceClient" + }, + "method": { + "shortName": "GetEkmConfig", + "fullName": "google.cloud.kms.v1.EkmService.GetEkmConfig", + "service": { + "shortName": "EkmService", + "fullName": "google.cloud.kms.v1.EkmService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_EkmService_UpdateEkmConfig_async", + "title": "EkmService updateEkmConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project and location.", + "canonical": true, + "file": "ekm_service.update_ekm_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateEkmConfig", + "fullName": "google.cloud.kms.v1.EkmService.UpdateEkmConfig", + "async": true, + "parameters": [ + { + "name": "ekm_config", + "type": ".google.cloud.kms.v1.EkmConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.kms.v1.EkmConfig", + "client": { + "shortName": "EkmServiceClient", + "fullName": "google.cloud.kms.v1.EkmServiceClient" + }, + "method": { + "shortName": "UpdateEkmConfig", + "fullName": "google.cloud.kms.v1.EkmService.UpdateEkmConfig", + "service": { + "shortName": "EkmService", + "fullName": "google.cloud.kms.v1.EkmService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_EkmService_VerifyConnectivity_async", + "title": "EkmService verifyConnectivity Sample", + "origin": "API_DEFINITION", + "description": " Verifies that Cloud KMS can successfully connect to the external key manager specified by an [EkmConnection][google.cloud.kms.v1.EkmConnection]. If there is an error connecting to the EKM, this method returns a FAILED_PRECONDITION status containing structured information as described at https://cloud.google.com/kms/docs/reference/ekm_errors.", + "canonical": true, + "file": "ekm_service.verify_connectivity.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "VerifyConnectivity", + "fullName": "google.cloud.kms.v1.EkmService.VerifyConnectivity", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.VerifyConnectivityResponse", + "client": { + "shortName": "EkmServiceClient", + "fullName": "google.cloud.kms.v1.EkmServiceClient" + }, + "method": { + "shortName": "VerifyConnectivity", + "fullName": "google.cloud.kms.v1.EkmService.VerifyConnectivity", + "service": { + "shortName": "EkmService", + "fullName": "google.cloud.kms.v1.EkmService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_ListKeyRings_async", + "title": "EkmService listKeyRings Sample", + "origin": "API_DEFINITION", + "description": " Lists [KeyRings][google.cloud.kms.v1.KeyRing].", + "canonical": true, + "file": "key_management_service.list_key_rings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 86, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListKeyRings", + "fullName": "google.cloud.kms.v1.KeyManagementService.ListKeyRings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.ListKeyRingsResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "ListKeyRings", + "fullName": "google.cloud.kms.v1.KeyManagementService.ListKeyRings", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async", + "title": "EkmService listCryptoKeys Sample", + "origin": "API_DEFINITION", + "description": " Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].", + "canonical": true, + "file": "key_management_service.list_crypto_keys.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 89, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCryptoKeys", + "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeys", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "version_view", + "type": ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.ListCryptoKeysResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "ListCryptoKeys", + "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeys", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async", + "title": "EkmService listCryptoKeyVersions Sample", + "origin": "API_DEFINITION", + "description": " Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].", + "canonical": true, + "file": "key_management_service.list_crypto_key_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 90, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCryptoKeyVersions", + "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.ListCryptoKeyVersionsResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "ListCryptoKeyVersions", + "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_ListImportJobs_async", + "title": "EkmService listImportJobs Sample", + "origin": "API_DEFINITION", + "description": " Lists [ImportJobs][google.cloud.kms.v1.ImportJob].", + "canonical": true, + "file": "key_management_service.list_import_jobs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListImportJobs", + "fullName": "google.cloud.kms.v1.KeyManagementService.ListImportJobs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.ListImportJobsResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "ListImportJobs", + "fullName": "google.cloud.kms.v1.KeyManagementService.ListImportJobs", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_GetKeyRing_async", + "title": "EkmService getKeyRing Sample", + "origin": "API_DEFINITION", + "description": " Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].", + "canonical": true, + "file": "key_management_service.get_key_ring.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetKeyRing", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetKeyRing", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.KeyRing", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "GetKeyRing", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetKeyRing", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async", + "title": "EkmService getCryptoKey Sample", + "origin": "API_DEFINITION", + "description": " Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].", + "canonical": true, + "file": "key_management_service.get_crypto_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCryptoKey", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKey", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "GetCryptoKey", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKey", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async", + "title": "EkmService getCryptoKeyVersion Sample", + "origin": "API_DEFINITION", + "description": " Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].", + "canonical": true, + "file": "key_management_service.get_crypto_key_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "GetCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_GetPublicKey_async", + "title": "EkmService getPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].", + "canonical": true, + "file": "key_management_service.get_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetPublicKey", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetPublicKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.PublicKey", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "GetPublicKey", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetPublicKey", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_GetImportJob_async", + "title": "EkmService getImportJob Sample", + "origin": "API_DEFINITION", + "description": " Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].", + "canonical": true, + "file": "key_management_service.get_import_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetImportJob", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetImportJob", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.ImportJob", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "GetImportJob", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetImportJob", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async", + "title": "EkmService createKeyRing Sample", + "origin": "API_DEFINITION", + "description": " Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.", + "canonical": true, + "file": "key_management_service.create_key_ring.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateKeyRing", + "fullName": "google.cloud.kms.v1.KeyManagementService.CreateKeyRing", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "key_ring_id", + "type": "TYPE_STRING" + }, + { + "name": "key_ring", + "type": ".google.cloud.kms.v1.KeyRing" + } + ], + "resultType": ".google.cloud.kms.v1.KeyRing", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "CreateKeyRing", + "fullName": "google.cloud.kms.v1.KeyManagementService.CreateKeyRing", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async", + "title": "EkmService createCryptoKey Sample", + "origin": "API_DEFINITION", + "description": " Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing]. [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.", + "canonical": true, + "file": "key_management_service.create_crypto_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateCryptoKey", + "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKey", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "crypto_key_id", + "type": "TYPE_STRING" + }, + { + "name": "crypto_key", + "type": ".google.cloud.kms.v1.CryptoKey" + }, + { + "name": "skip_initial_version_creation", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKey", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "CreateCryptoKey", + "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKey", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async", + "title": "EkmService createCryptoKeyVersion Sample", + "origin": "API_DEFINITION", + "description": " Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey]. The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].", + "canonical": true, + "file": "key_management_service.create_crypto_key_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "crypto_key_version", + "type": ".google.cloud.kms.v1.CryptoKeyVersion" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "CreateCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async", + "title": "EkmService importCryptoKeyVersion Sample", + "origin": "API_DEFINITION", + "description": " Import wrapped key material into a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. All requests must specify a [CryptoKey][google.cloud.kms.v1.CryptoKey]. If a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] is additionally specified in the request, key material will be reimported into that version. Otherwise, a new version will be created, and will be assigned the next sequential id within the [CryptoKey][google.cloud.kms.v1.CryptoKey].", + "canonical": true, + "file": "key_management_service.import_crypto_key_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 137, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "crypto_key_version", + "type": "TYPE_STRING" + }, + { + "name": "algorithm", + "type": ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm" + }, + { + "name": "import_job", + "type": "TYPE_STRING" + }, + { + "name": "wrapped_key", + "type": "TYPE_BYTES" + }, + { + "name": "rsa_aes_wrapped_key", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "ImportCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateImportJob_async", + "title": "EkmService createImportJob Sample", + "origin": "API_DEFINITION", + "description": " Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing]. [ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.", + "canonical": true, + "file": "key_management_service.create_import_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateImportJob", + "fullName": "google.cloud.kms.v1.KeyManagementService.CreateImportJob", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "import_job_id", + "type": "TYPE_STRING" + }, + { + "name": "import_job", + "type": ".google.cloud.kms.v1.ImportJob" + } + ], + "resultType": ".google.cloud.kms.v1.ImportJob", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "CreateImportJob", + "fullName": "google.cloud.kms.v1.KeyManagementService.CreateImportJob", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async", + "title": "EkmService updateCryptoKey Sample", + "origin": "API_DEFINITION", + "description": " Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].", + "canonical": true, + "file": "key_management_service.update_crypto_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCryptoKey", + "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey", + "async": true, + "parameters": [ + { + "name": "crypto_key", + "type": ".google.cloud.kms.v1.CryptoKey" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKey", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "UpdateCryptoKey", + "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async", + "title": "EkmService updateCryptoKeyVersion Sample", + "origin": "API_DEFINITION", + "description": " Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata. [state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to move between other states.", + "canonical": true, + "file": "key_management_service.update_crypto_key_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion", + "async": true, + "parameters": [ + { + "name": "crypto_key_version", + "type": ".google.cloud.kms.v1.CryptoKeyVersion" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "UpdateCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async", + "title": "EkmService updateCryptoKeyPrimaryVersion Sample", + "origin": "API_DEFINITION", + "description": " Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].", + "canonical": true, + "file": "key_management_service.update_crypto_key_primary_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCryptoKeyPrimaryVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "crypto_key_version_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKey", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "UpdateCryptoKeyPrimaryVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async", + "title": "EkmService destroyCryptoKeyVersion Sample", + "origin": "API_DEFINITION", + "description": " Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction. Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to the time [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] in the future. At that time, the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will automatically change to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed. Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.", + "canonical": true, + "file": "key_management_service.destroy_crypto_key_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DestroyCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "DestroyCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async", + "title": "EkmService restoreCryptoKeyVersion Sample", + "origin": "API_DEFINITION", + "description": " Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state. Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.", + "canonical": true, + "file": "key_management_service.restore_crypto_key_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "RestoreCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_Encrypt_async", + "title": "EkmService encrypt Sample", + "origin": "API_DEFINITION", + "description": " Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].", + "canonical": true, + "file": "key_management_service.encrypt.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 131, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Encrypt", + "fullName": "google.cloud.kms.v1.KeyManagementService.Encrypt", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "plaintext", + "type": "TYPE_BYTES" + }, + { + "name": "additional_authenticated_data", + "type": "TYPE_BYTES" + }, + { + "name": "plaintext_crc32c", + "type": ".google.protobuf.Int64Value" + }, + { + "name": "additional_authenticated_data_crc32c", + "type": ".google.protobuf.Int64Value" + } + ], + "resultType": ".google.cloud.kms.v1.EncryptResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "Encrypt", + "fullName": "google.cloud.kms.v1.KeyManagementService.Encrypt", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_Decrypt_async", + "title": "EkmService decrypt Sample", + "origin": "API_DEFINITION", + "description": " Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].", + "canonical": true, + "file": "key_management_service.decrypt.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 110, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Decrypt", + "fullName": "google.cloud.kms.v1.KeyManagementService.Decrypt", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "ciphertext", + "type": "TYPE_BYTES" + }, + { + "name": "additional_authenticated_data", + "type": "TYPE_BYTES" + }, + { + "name": "ciphertext_crc32c", + "type": ".google.protobuf.Int64Value" + }, + { + "name": "additional_authenticated_data_crc32c", + "type": ".google.protobuf.Int64Value" + } + ], + "resultType": ".google.cloud.kms.v1.DecryptResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "Decrypt", + "fullName": "google.cloud.kms.v1.KeyManagementService.Decrypt", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_RawEncrypt_async", + "title": "EkmService rawEncrypt Sample", + "origin": "API_DEFINITION", + "description": " Encrypts data using portable cryptographic primitives. Most users should choose [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt] rather than their raw counterparts. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [RAW_ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT].", + "canonical": true, + "file": "key_management_service.raw_encrypt.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 146, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RawEncrypt", + "fullName": "google.cloud.kms.v1.KeyManagementService.RawEncrypt", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "plaintext", + "type": "TYPE_BYTES" + }, + { + "name": "additional_authenticated_data", + "type": "TYPE_BYTES" + }, + { + "name": "plaintext_crc32c", + "type": ".google.protobuf.Int64Value" + }, + { + "name": "additional_authenticated_data_crc32c", + "type": ".google.protobuf.Int64Value" + }, + { + "name": "initialization_vector", + "type": "TYPE_BYTES" + }, + { + "name": "initialization_vector_crc32c", + "type": ".google.protobuf.Int64Value" + } + ], + "resultType": ".google.cloud.kms.v1.RawEncryptResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "RawEncrypt", + "fullName": "google.cloud.kms.v1.KeyManagementService.RawEncrypt", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_RawDecrypt_async", + "title": "EkmService rawDecrypt Sample", + "origin": "API_DEFINITION", + "description": " Decrypts data that was originally encrypted using a raw cryptographic mechanism. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [RAW_ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT].", + "canonical": true, + "file": "key_management_service.raw_decrypt.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 134, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RawDecrypt", + "fullName": "google.cloud.kms.v1.KeyManagementService.RawDecrypt", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "ciphertext", + "type": "TYPE_BYTES" + }, + { + "name": "additional_authenticated_data", + "type": "TYPE_BYTES" + }, + { + "name": "initialization_vector", + "type": "TYPE_BYTES" + }, + { + "name": "tag_length", + "type": "TYPE_INT32" + }, + { + "name": "ciphertext_crc32c", + "type": ".google.protobuf.Int64Value" + }, + { + "name": "additional_authenticated_data_crc32c", + "type": ".google.protobuf.Int64Value" + }, + { + "name": "initialization_vector_crc32c", + "type": ".google.protobuf.Int64Value" + } + ], + "resultType": ".google.cloud.kms.v1.RawDecryptResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "RawDecrypt", + "fullName": "google.cloud.kms.v1.KeyManagementService.RawDecrypt", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async", + "title": "EkmService asymmetricSign Sample", + "origin": "API_DEFINITION", + "description": " Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].", + "canonical": true, + "file": "key_management_service.asymmetric_sign.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 115, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AsymmetricSign", + "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricSign", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "digest", + "type": ".google.cloud.kms.v1.Digest" + }, + { + "name": "digest_crc32c", + "type": ".google.protobuf.Int64Value" + }, + { + "name": "data", + "type": "TYPE_BYTES" + }, + { + "name": "data_crc32c", + "type": ".google.protobuf.Int64Value" + } + ], + "resultType": ".google.cloud.kms.v1.AsymmetricSignResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "AsymmetricSign", + "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricSign", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async", + "title": "EkmService asymmetricDecrypt Sample", + "origin": "API_DEFINITION", + "description": " Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.", + "canonical": true, + "file": "key_management_service.asymmetric_decrypt.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AsymmetricDecrypt", + "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "ciphertext", + "type": "TYPE_BYTES" + }, + { + "name": "ciphertext_crc32c", + "type": ".google.protobuf.Int64Value" + } + ], + "resultType": ".google.cloud.kms.v1.AsymmetricDecryptResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "AsymmetricDecrypt", + "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_MacSign_async", + "title": "EkmService macSign Sample", + "origin": "API_DEFINITION", + "description": " Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, producing a tag that can be verified by another source with the same key.", + "canonical": true, + "file": "key_management_service.mac_sign.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 81, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "MacSign", + "fullName": "google.cloud.kms.v1.KeyManagementService.MacSign", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "data", + "type": "TYPE_BYTES" + }, + { + "name": "data_crc32c", + "type": ".google.protobuf.Int64Value" + } + ], + "resultType": ".google.cloud.kms.v1.MacSignResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "MacSign", + "fullName": "google.cloud.kms.v1.KeyManagementService.MacSign", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_MacVerify_async", + "title": "EkmService macVerify Sample", + "origin": "API_DEFINITION", + "description": " Verifies MAC tag using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, and returns a response that indicates whether or not the verification was successful.", + "canonical": true, + "file": "key_management_service.mac_verify.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 107, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "MacVerify", + "fullName": "google.cloud.kms.v1.KeyManagementService.MacVerify", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "data", + "type": "TYPE_BYTES" + }, + { + "name": "data_crc32c", + "type": ".google.protobuf.Int64Value" + }, + { + "name": "mac", + "type": "TYPE_BYTES" + }, + { + "name": "mac_crc32c", + "type": ".google.protobuf.Int64Value" + } + ], + "resultType": ".google.cloud.kms.v1.MacVerifyResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "MacVerify", + "fullName": "google.cloud.kms.v1.KeyManagementService.MacVerify", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_GenerateRandomBytes_async", + "title": "EkmService generateRandomBytes Sample", + "origin": "API_DEFINITION", + "description": " Generate random bytes using the Cloud KMS randomness source in the provided location.", + "canonical": true, + "file": "key_management_service.generate_random_bytes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateRandomBytes", + "fullName": "google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes", + "async": true, + "parameters": [ + { + "name": "location", + "type": "TYPE_STRING" + }, + { + "name": "length_bytes", + "type": "TYPE_INT32" + }, + { + "name": "protection_level", + "type": ".google.cloud.kms.v1.ProtectionLevel" + } + ], + "resultType": ".google.cloud.kms.v1.GenerateRandomBytesResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "GenerateRandomBytes", + "fullName": "google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-kms/v1/src/index.ts b/owl-bot-staging/google-cloud-kms/v1/src/index.ts new file mode 100644 index 00000000000..917816886be --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/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 EkmServiceClient = v1.EkmServiceClient; +type EkmServiceClient = v1.EkmServiceClient; +const KeyManagementServiceClient = v1.KeyManagementServiceClient; +type KeyManagementServiceClient = v1.KeyManagementServiceClient; +export {v1, EkmServiceClient, KeyManagementServiceClient}; +export default {v1, EkmServiceClient, KeyManagementServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_client.ts b/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_client.ts new file mode 100644 index 00000000000..b6d9a581ab6 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_client.ts @@ -0,0 +1,1696 @@ +// 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, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/ekm_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './ekm_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Google Cloud Key Management EKM Service + * + * Manages external cryptographic keys and operations using those keys. + * Implements a REST model with the following objects: + * * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection} + * @class + * @memberof v1 + */ +export class EkmServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + ekmServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of EkmServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new EkmServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof EkmServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // 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; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' + ), + cryptoKeyVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}' + ), + ekmConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/ekmConfig' + ), + ekmConnectionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/ekmConnections/{ekm_connection}' + ), + importJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}' + ), + keyRingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + publicKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/publicKey' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listEkmConnections: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'ekmConnections') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.kms.v1.EkmService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.ekmServiceStub) { + return this.ekmServiceStub; + } + + // Put together the "service stub" for + // google.cloud.kms.v1.EkmService. + this.ekmServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.kms.v1.EkmService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.kms.v1.EkmService, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const ekmServiceStubMethods = + ['listEkmConnections', 'getEkmConnection', 'createEkmConnection', 'updateEkmConnection', 'getEkmConfig', 'updateEkmConfig', 'verifyConnectivity']; + for (const methodName of ekmServiceStubMethods) { + const callPromise = this.ekmServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.ekmServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudkms.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'cloudkms.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloudkms' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Returns metadata for a given + * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link protos.google.cloud.kms.v1.EkmConnection.name|name} of the + * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection} to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/ekm_service.get_ekm_connection.js + * region_tag:cloudkms_v1_generated_EkmService_GetEkmConnection_async + */ + getEkmConnection( + request?: protos.google.cloud.kms.v1.IGetEkmConnectionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IGetEkmConnectionRequest|undefined, {}|undefined + ]>; + getEkmConnection( + request: protos.google.cloud.kms.v1.IGetEkmConnectionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IGetEkmConnectionRequest|null|undefined, + {}|null|undefined>): void; + getEkmConnection( + request: protos.google.cloud.kms.v1.IGetEkmConnectionRequest, + callback: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IGetEkmConnectionRequest|null|undefined, + {}|null|undefined>): void; + getEkmConnection( + request?: protos.google.cloud.kms.v1.IGetEkmConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IGetEkmConnectionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IGetEkmConnectionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IGetEkmConnectionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getEkmConnection(request, options, callback); + } +/** + * Creates a new {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection} in a given + * Project and Location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location associated with the + * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}, in the format + * `projects/* /locations/*`. + * @param {string} request.ekmConnectionId + * Required. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}`. + * @param {google.cloud.kms.v1.EkmConnection} request.ekmConnection + * Required. An {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection} with + * initial field values. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/ekm_service.create_ekm_connection.js + * region_tag:cloudkms_v1_generated_EkmService_CreateEkmConnection_async + */ + createEkmConnection( + request?: protos.google.cloud.kms.v1.ICreateEkmConnectionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.ICreateEkmConnectionRequest|undefined, {}|undefined + ]>; + createEkmConnection( + request: protos.google.cloud.kms.v1.ICreateEkmConnectionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.ICreateEkmConnectionRequest|null|undefined, + {}|null|undefined>): void; + createEkmConnection( + request: protos.google.cloud.kms.v1.ICreateEkmConnectionRequest, + callback: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.ICreateEkmConnectionRequest|null|undefined, + {}|null|undefined>): void; + createEkmConnection( + request?: protos.google.cloud.kms.v1.ICreateEkmConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.ICreateEkmConnectionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.ICreateEkmConnectionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.ICreateEkmConnectionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createEkmConnection(request, options, callback); + } +/** + * Updates an {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}'s metadata. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.kms.v1.EkmConnection} request.ekmConnection + * Required. {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection} with updated + * values. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. List of fields to be updated in this request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/ekm_service.update_ekm_connection.js + * region_tag:cloudkms_v1_generated_EkmService_UpdateEkmConnection_async + */ + updateEkmConnection( + request?: protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest|undefined, {}|undefined + ]>; + updateEkmConnection( + request: protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest|null|undefined, + {}|null|undefined>): void; + updateEkmConnection( + request: protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest, + callback: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest|null|undefined, + {}|null|undefined>): void; + updateEkmConnection( + request?: protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'ekm_connection.name': request.ekmConnection!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateEkmConnection(request, options, callback); + } +/** + * Returns the {@link protos.google.cloud.kms.v1.EkmConfig|EkmConfig} singleton resource + * for a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link protos.google.cloud.kms.v1.EkmConfig.name|name} of the + * {@link protos.google.cloud.kms.v1.EkmConfig|EkmConfig} to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.EkmConfig|EkmConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/ekm_service.get_ekm_config.js + * region_tag:cloudkms_v1_generated_EkmService_GetEkmConfig_async + */ + getEkmConfig( + request?: protos.google.cloud.kms.v1.IGetEkmConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IEkmConfig, + protos.google.cloud.kms.v1.IGetEkmConfigRequest|undefined, {}|undefined + ]>; + getEkmConfig( + request: protos.google.cloud.kms.v1.IGetEkmConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IEkmConfig, + protos.google.cloud.kms.v1.IGetEkmConfigRequest|null|undefined, + {}|null|undefined>): void; + getEkmConfig( + request: protos.google.cloud.kms.v1.IGetEkmConfigRequest, + callback: Callback< + protos.google.cloud.kms.v1.IEkmConfig, + protos.google.cloud.kms.v1.IGetEkmConfigRequest|null|undefined, + {}|null|undefined>): void; + getEkmConfig( + request?: protos.google.cloud.kms.v1.IGetEkmConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IEkmConfig, + protos.google.cloud.kms.v1.IGetEkmConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IEkmConfig, + protos.google.cloud.kms.v1.IGetEkmConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IEkmConfig, + protos.google.cloud.kms.v1.IGetEkmConfigRequest|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.getEkmConfig(request, options, callback); + } +/** + * Updates the {@link protos.google.cloud.kms.v1.EkmConfig|EkmConfig} singleton resource + * for a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.kms.v1.EkmConfig} request.ekmConfig + * Required. {@link protos.google.cloud.kms.v1.EkmConfig|EkmConfig} with updated values. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. List of fields to be updated in this request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.EkmConfig|EkmConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/ekm_service.update_ekm_config.js + * region_tag:cloudkms_v1_generated_EkmService_UpdateEkmConfig_async + */ + updateEkmConfig( + request?: protos.google.cloud.kms.v1.IUpdateEkmConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IEkmConfig, + protos.google.cloud.kms.v1.IUpdateEkmConfigRequest|undefined, {}|undefined + ]>; + updateEkmConfig( + request: protos.google.cloud.kms.v1.IUpdateEkmConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IEkmConfig, + protos.google.cloud.kms.v1.IUpdateEkmConfigRequest|null|undefined, + {}|null|undefined>): void; + updateEkmConfig( + request: protos.google.cloud.kms.v1.IUpdateEkmConfigRequest, + callback: Callback< + protos.google.cloud.kms.v1.IEkmConfig, + protos.google.cloud.kms.v1.IUpdateEkmConfigRequest|null|undefined, + {}|null|undefined>): void; + updateEkmConfig( + request?: protos.google.cloud.kms.v1.IUpdateEkmConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IEkmConfig, + protos.google.cloud.kms.v1.IUpdateEkmConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IEkmConfig, + protos.google.cloud.kms.v1.IUpdateEkmConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IEkmConfig, + protos.google.cloud.kms.v1.IUpdateEkmConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'ekm_config.name': request.ekmConfig!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateEkmConfig(request, options, callback); + } +/** + * Verifies that Cloud KMS can successfully connect to the external key + * manager specified by an {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}. + * If there is an error connecting to the EKM, this method returns a + * FAILED_PRECONDITION status containing structured information as described + * at https://cloud.google.com/kms/docs/reference/ekm_errors. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link protos.google.cloud.kms.v1.EkmConnection.name|name} of the + * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection} to verify. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.kms.v1.VerifyConnectivityResponse|VerifyConnectivityResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/ekm_service.verify_connectivity.js + * region_tag:cloudkms_v1_generated_EkmService_VerifyConnectivity_async + */ + verifyConnectivity( + request?: protos.google.cloud.kms.v1.IVerifyConnectivityRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IVerifyConnectivityResponse, + protos.google.cloud.kms.v1.IVerifyConnectivityRequest|undefined, {}|undefined + ]>; + verifyConnectivity( + request: protos.google.cloud.kms.v1.IVerifyConnectivityRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IVerifyConnectivityResponse, + protos.google.cloud.kms.v1.IVerifyConnectivityRequest|null|undefined, + {}|null|undefined>): void; + verifyConnectivity( + request: protos.google.cloud.kms.v1.IVerifyConnectivityRequest, + callback: Callback< + protos.google.cloud.kms.v1.IVerifyConnectivityResponse, + protos.google.cloud.kms.v1.IVerifyConnectivityRequest|null|undefined, + {}|null|undefined>): void; + verifyConnectivity( + request?: protos.google.cloud.kms.v1.IVerifyConnectivityRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IVerifyConnectivityResponse, + protos.google.cloud.kms.v1.IVerifyConnectivityRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IVerifyConnectivityResponse, + protos.google.cloud.kms.v1.IVerifyConnectivityRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IVerifyConnectivityResponse, + protos.google.cloud.kms.v1.IVerifyConnectivityRequest|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.verifyConnectivity(request, options, callback); + } + + /** + * Lists {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location associated with the + * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} to list, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} to include in the + * response. Further {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} can + * subsequently be obtained by including the + * {@link protos.google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link protos.google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listEkmConnectionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listEkmConnections( + request?: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IEkmConnection[], + protos.google.cloud.kms.v1.IListEkmConnectionsRequest|null, + protos.google.cloud.kms.v1.IListEkmConnectionsResponse + ]>; + listEkmConnections( + request: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + protos.google.cloud.kms.v1.IListEkmConnectionsResponse|null|undefined, + protos.google.cloud.kms.v1.IEkmConnection>): void; + listEkmConnections( + request: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + protos.google.cloud.kms.v1.IListEkmConnectionsResponse|null|undefined, + protos.google.cloud.kms.v1.IEkmConnection>): void; + listEkmConnections( + request?: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + protos.google.cloud.kms.v1.IListEkmConnectionsResponse|null|undefined, + protos.google.cloud.kms.v1.IEkmConnection>, + callback?: PaginationCallback< + protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + protos.google.cloud.kms.v1.IListEkmConnectionsResponse|null|undefined, + protos.google.cloud.kms.v1.IEkmConnection>): + Promise<[ + protos.google.cloud.kms.v1.IEkmConnection[], + protos.google.cloud.kms.v1.IListEkmConnectionsRequest|null, + protos.google.cloud.kms.v1.IListEkmConnectionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listEkmConnections(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location associated with the + * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} to list, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} to include in the + * response. Further {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} can + * subsequently be obtained by including the + * {@link protos.google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link protos.google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listEkmConnectionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listEkmConnectionsStream( + request?: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listEkmConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEkmConnections.createStream( + this.innerApiCalls.listEkmConnections as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listEkmConnections`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location associated with the + * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} to list, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} to include in the + * response. Further {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} can + * subsequently be obtained by including the + * {@link protos.google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link protos.google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/ekm_service.list_ekm_connections.js + * region_tag:cloudkms_v1_generated_EkmService_ListEkmConnections_async + */ + listEkmConnectionsAsync( + request?: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listEkmConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEkmConnections.asyncIterate( + this.innerApiCalls['listEkmConnections'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified cryptoKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @returns {string} Resource name string. + */ + cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { + return this.pathTemplates.cryptoKeyPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + }); + } + + /** + * Parse the project from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; + } + + /** + * Parse the location from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; + } + + /** + * Parse the key_ring from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; + } + + /** + * Parse the crypto_key from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; + } + + /** + * Return a fully-qualified cryptoKeyVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @param {string} crypto_key_version + * @returns {string} Resource name string. + */ + cryptoKeyVersionPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + crypto_key_version: cryptoKeyVersion, + }); + } + + /** + * Parse the project from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).project; + } + + /** + * Parse the location from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).location; + } + + /** + * Parse the key_ring from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).key_ring; + } + + /** + * Parse the crypto_key from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).crypto_key; + } + + /** + * Parse the crypto_key_version from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the crypto_key_version. + */ + matchCryptoKeyVersionFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).crypto_key_version; + } + + /** + * Return a fully-qualified ekmConfig resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + ekmConfigPath(project:string,location:string) { + return this.pathTemplates.ekmConfigPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from EkmConfig resource. + * + * @param {string} ekmConfigName + * A fully-qualified path representing EkmConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEkmConfigName(ekmConfigName: string) { + return this.pathTemplates.ekmConfigPathTemplate.match(ekmConfigName).project; + } + + /** + * Parse the location from EkmConfig resource. + * + * @param {string} ekmConfigName + * A fully-qualified path representing EkmConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEkmConfigName(ekmConfigName: string) { + return this.pathTemplates.ekmConfigPathTemplate.match(ekmConfigName).location; + } + + /** + * Return a fully-qualified ekmConnection resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} ekm_connection + * @returns {string} Resource name string. + */ + ekmConnectionPath(project:string,location:string,ekmConnection:string) { + return this.pathTemplates.ekmConnectionPathTemplate.render({ + project: project, + location: location, + ekm_connection: ekmConnection, + }); + } + + /** + * Parse the project from EkmConnection resource. + * + * @param {string} ekmConnectionName + * A fully-qualified path representing EkmConnection resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEkmConnectionName(ekmConnectionName: string) { + return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName).project; + } + + /** + * Parse the location from EkmConnection resource. + * + * @param {string} ekmConnectionName + * A fully-qualified path representing EkmConnection resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEkmConnectionName(ekmConnectionName: string) { + return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName).location; + } + + /** + * Parse the ekm_connection from EkmConnection resource. + * + * @param {string} ekmConnectionName + * A fully-qualified path representing EkmConnection resource. + * @returns {string} A string representing the ekm_connection. + */ + matchEkmConnectionFromEkmConnectionName(ekmConnectionName: string) { + return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName).ekm_connection; + } + + /** + * Return a fully-qualified importJob resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} import_job + * @returns {string} Resource name string. + */ + importJobPath(project:string,location:string,keyRing:string,importJob:string) { + return this.pathTemplates.importJobPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + import_job: importJob, + }); + } + + /** + * Parse the project from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the project. + */ + matchProjectFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).project; + } + + /** + * Parse the location from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the location. + */ + matchLocationFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).location; + } + + /** + * Parse the key_ring from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).key_ring; + } + + /** + * Parse the import_job from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the import_job. + */ + matchImportJobFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).import_job; + } + + /** + * Return a fully-qualified keyRing resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @returns {string} Resource name string. + */ + keyRingPath(project:string,location:string,keyRing:string) { + return this.pathTemplates.keyRingPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + }); + } + + /** + * Parse the project from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the project. + */ + matchProjectFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).project; + } + + /** + * Parse the location from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the location. + */ + matchLocationFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).location; + } + + /** + * Parse the key_ring from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).key_ring; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified publicKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @param {string} crypto_key_version + * @returns {string} Resource name string. + */ + publicKeyPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { + return this.pathTemplates.publicKeyPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + crypto_key_version: cryptoKeyVersion, + }); + } + + /** + * Parse the project from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).project; + } + + /** + * Parse the location from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).location; + } + + /** + * Parse the key_ring from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).key_ring; + } + + /** + * Parse the crypto_key from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).crypto_key; + } + + /** + * Parse the crypto_key_version from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the crypto_key_version. + */ + matchCryptoKeyVersionFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).crypto_key_version; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.ekmServiceStub && !this._terminated) { + return this.ekmServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_client_config.json b/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_client_config.json new file mode 100644 index 00000000000..b4ef489d214 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_client_config.json @@ -0,0 +1,58 @@ +{ + "interfaces": { + "google.cloud.kms.v1.EkmService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListEkmConnections": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetEkmConnection": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateEkmConnection": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateEkmConnection": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetEkmConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateEkmConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "VerifyConnectivity": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_proto_list.json b/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_proto_list.json new file mode 100644 index 00000000000..ad57fc558ee --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/kms/v1/ekm_service.proto", + "../../protos/google/cloud/kms/v1/resources.proto", + "../../protos/google/cloud/kms/v1/service.proto" +] diff --git a/owl-bot-staging/google-cloud-kms/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-kms/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..8070b887cfe --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/src/v1/gapic_metadata.json @@ -0,0 +1,407 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.kms.v1", + "libraryPackage": "@google-cloud/kms", + "services": { + "EkmService": { + "clients": { + "grpc": { + "libraryClient": "EkmServiceClient", + "rpcs": { + "GetEkmConnection": { + "methods": [ + "getEkmConnection" + ] + }, + "CreateEkmConnection": { + "methods": [ + "createEkmConnection" + ] + }, + "UpdateEkmConnection": { + "methods": [ + "updateEkmConnection" + ] + }, + "GetEkmConfig": { + "methods": [ + "getEkmConfig" + ] + }, + "UpdateEkmConfig": { + "methods": [ + "updateEkmConfig" + ] + }, + "VerifyConnectivity": { + "methods": [ + "verifyConnectivity" + ] + }, + "ListEkmConnections": { + "methods": [ + "listEkmConnections", + "listEkmConnectionsStream", + "listEkmConnectionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "EkmServiceClient", + "rpcs": { + "GetEkmConnection": { + "methods": [ + "getEkmConnection" + ] + }, + "CreateEkmConnection": { + "methods": [ + "createEkmConnection" + ] + }, + "UpdateEkmConnection": { + "methods": [ + "updateEkmConnection" + ] + }, + "GetEkmConfig": { + "methods": [ + "getEkmConfig" + ] + }, + "UpdateEkmConfig": { + "methods": [ + "updateEkmConfig" + ] + }, + "VerifyConnectivity": { + "methods": [ + "verifyConnectivity" + ] + }, + "ListEkmConnections": { + "methods": [ + "listEkmConnections", + "listEkmConnectionsStream", + "listEkmConnectionsAsync" + ] + } + } + } + } + }, + "KeyManagementService": { + "clients": { + "grpc": { + "libraryClient": "KeyManagementServiceClient", + "rpcs": { + "GetKeyRing": { + "methods": [ + "getKeyRing" + ] + }, + "GetCryptoKey": { + "methods": [ + "getCryptoKey" + ] + }, + "GetCryptoKeyVersion": { + "methods": [ + "getCryptoKeyVersion" + ] + }, + "GetPublicKey": { + "methods": [ + "getPublicKey" + ] + }, + "GetImportJob": { + "methods": [ + "getImportJob" + ] + }, + "CreateKeyRing": { + "methods": [ + "createKeyRing" + ] + }, + "CreateCryptoKey": { + "methods": [ + "createCryptoKey" + ] + }, + "CreateCryptoKeyVersion": { + "methods": [ + "createCryptoKeyVersion" + ] + }, + "ImportCryptoKeyVersion": { + "methods": [ + "importCryptoKeyVersion" + ] + }, + "CreateImportJob": { + "methods": [ + "createImportJob" + ] + }, + "UpdateCryptoKey": { + "methods": [ + "updateCryptoKey" + ] + }, + "UpdateCryptoKeyVersion": { + "methods": [ + "updateCryptoKeyVersion" + ] + }, + "UpdateCryptoKeyPrimaryVersion": { + "methods": [ + "updateCryptoKeyPrimaryVersion" + ] + }, + "DestroyCryptoKeyVersion": { + "methods": [ + "destroyCryptoKeyVersion" + ] + }, + "RestoreCryptoKeyVersion": { + "methods": [ + "restoreCryptoKeyVersion" + ] + }, + "Encrypt": { + "methods": [ + "encrypt" + ] + }, + "Decrypt": { + "methods": [ + "decrypt" + ] + }, + "RawEncrypt": { + "methods": [ + "rawEncrypt" + ] + }, + "RawDecrypt": { + "methods": [ + "rawDecrypt" + ] + }, + "AsymmetricSign": { + "methods": [ + "asymmetricSign" + ] + }, + "AsymmetricDecrypt": { + "methods": [ + "asymmetricDecrypt" + ] + }, + "MacSign": { + "methods": [ + "macSign" + ] + }, + "MacVerify": { + "methods": [ + "macVerify" + ] + }, + "GenerateRandomBytes": { + "methods": [ + "generateRandomBytes" + ] + }, + "ListKeyRings": { + "methods": [ + "listKeyRings", + "listKeyRingsStream", + "listKeyRingsAsync" + ] + }, + "ListCryptoKeys": { + "methods": [ + "listCryptoKeys", + "listCryptoKeysStream", + "listCryptoKeysAsync" + ] + }, + "ListCryptoKeyVersions": { + "methods": [ + "listCryptoKeyVersions", + "listCryptoKeyVersionsStream", + "listCryptoKeyVersionsAsync" + ] + }, + "ListImportJobs": { + "methods": [ + "listImportJobs", + "listImportJobsStream", + "listImportJobsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "KeyManagementServiceClient", + "rpcs": { + "GetKeyRing": { + "methods": [ + "getKeyRing" + ] + }, + "GetCryptoKey": { + "methods": [ + "getCryptoKey" + ] + }, + "GetCryptoKeyVersion": { + "methods": [ + "getCryptoKeyVersion" + ] + }, + "GetPublicKey": { + "methods": [ + "getPublicKey" + ] + }, + "GetImportJob": { + "methods": [ + "getImportJob" + ] + }, + "CreateKeyRing": { + "methods": [ + "createKeyRing" + ] + }, + "CreateCryptoKey": { + "methods": [ + "createCryptoKey" + ] + }, + "CreateCryptoKeyVersion": { + "methods": [ + "createCryptoKeyVersion" + ] + }, + "ImportCryptoKeyVersion": { + "methods": [ + "importCryptoKeyVersion" + ] + }, + "CreateImportJob": { + "methods": [ + "createImportJob" + ] + }, + "UpdateCryptoKey": { + "methods": [ + "updateCryptoKey" + ] + }, + "UpdateCryptoKeyVersion": { + "methods": [ + "updateCryptoKeyVersion" + ] + }, + "UpdateCryptoKeyPrimaryVersion": { + "methods": [ + "updateCryptoKeyPrimaryVersion" + ] + }, + "DestroyCryptoKeyVersion": { + "methods": [ + "destroyCryptoKeyVersion" + ] + }, + "RestoreCryptoKeyVersion": { + "methods": [ + "restoreCryptoKeyVersion" + ] + }, + "Encrypt": { + "methods": [ + "encrypt" + ] + }, + "Decrypt": { + "methods": [ + "decrypt" + ] + }, + "RawEncrypt": { + "methods": [ + "rawEncrypt" + ] + }, + "RawDecrypt": { + "methods": [ + "rawDecrypt" + ] + }, + "AsymmetricSign": { + "methods": [ + "asymmetricSign" + ] + }, + "AsymmetricDecrypt": { + "methods": [ + "asymmetricDecrypt" + ] + }, + "MacSign": { + "methods": [ + "macSign" + ] + }, + "MacVerify": { + "methods": [ + "macVerify" + ] + }, + "GenerateRandomBytes": { + "methods": [ + "generateRandomBytes" + ] + }, + "ListKeyRings": { + "methods": [ + "listKeyRings", + "listKeyRingsStream", + "listKeyRingsAsync" + ] + }, + "ListCryptoKeys": { + "methods": [ + "listCryptoKeys", + "listCryptoKeysStream", + "listCryptoKeysAsync" + ] + }, + "ListCryptoKeyVersions": { + "methods": [ + "listCryptoKeyVersions", + "listCryptoKeyVersionsStream", + "listCryptoKeyVersionsAsync" + ] + }, + "ListImportJobs": { + "methods": [ + "listImportJobs", + "listImportJobsStream", + "listImportJobsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-kms/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-kms/v1/src/v1/index.ts new file mode 100644 index 00000000000..5ecb6c75ce9 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/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 {EkmServiceClient} from './ekm_service_client'; +export {KeyManagementServiceClient} from './key_management_service_client'; diff --git a/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_client.ts b/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_client.ts new file mode 100644 index 00000000000..ebc65ca6b5f --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_client.ts @@ -0,0 +1,4292 @@ +// 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, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/key_management_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './key_management_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Google Cloud Key Management Service + * + * Manages cryptographic keys and operations using those keys. Implements a REST + * model with the following objects: + * + * * {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} + * * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} + * * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} + * * {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} + * + * If you are using manual gRPC libraries, see + * [Using gRPC with Cloud KMS](https://cloud.google.com/kms/docs/grpc). + * @class + * @memberof v1 + */ +export class KeyManagementServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + keyManagementServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of KeyManagementServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new KeyManagementServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof KeyManagementServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // 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; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' + ), + cryptoKeyVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}' + ), + ekmConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/ekmConfig' + ), + ekmConnectionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/ekmConnections/{ekm_connection}' + ), + importJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}' + ), + keyRingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + publicKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/publicKey' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listKeyRings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'keyRings'), + listCryptoKeys: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'cryptoKeys'), + listCryptoKeyVersions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'cryptoKeyVersions'), + listImportJobs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'importJobs') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.kms.v1.KeyManagementService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.keyManagementServiceStub) { + return this.keyManagementServiceStub; + } + + // Put together the "service stub" for + // google.cloud.kms.v1.KeyManagementService. + this.keyManagementServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.kms.v1.KeyManagementService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.kms.v1.KeyManagementService, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const keyManagementServiceStubMethods = + ['listKeyRings', 'listCryptoKeys', 'listCryptoKeyVersions', 'listImportJobs', 'getKeyRing', 'getCryptoKey', 'getCryptoKeyVersion', 'getPublicKey', 'getImportJob', 'createKeyRing', 'createCryptoKey', 'createCryptoKeyVersion', 'importCryptoKeyVersion', 'createImportJob', 'updateCryptoKey', 'updateCryptoKeyVersion', 'updateCryptoKeyPrimaryVersion', 'destroyCryptoKeyVersion', 'restoreCryptoKeyVersion', 'encrypt', 'decrypt', 'rawEncrypt', 'rawDecrypt', 'asymmetricSign', 'asymmetricDecrypt', 'macSign', 'macVerify', 'generateRandomBytes']; + for (const methodName of keyManagementServiceStubMethods) { + const callPromise = this.keyManagementServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.keyManagementServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudkms.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'cloudkms.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloudkms' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Returns metadata for a given {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link protos.google.cloud.kms.v1.KeyRing.name|name} of the + * {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.get_key_ring.js + * region_tag:cloudkms_v1_generated_KeyManagementService_GetKeyRing_async + */ + getKeyRing( + request?: protos.google.cloud.kms.v1.IGetKeyRingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.IGetKeyRingRequest|undefined, {}|undefined + ]>; + getKeyRing( + request: protos.google.cloud.kms.v1.IGetKeyRingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, + {}|null|undefined>): void; + getKeyRing( + request: protos.google.cloud.kms.v1.IGetKeyRingRequest, + callback: Callback< + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, + {}|null|undefined>): void; + getKeyRing( + request?: protos.google.cloud.kms.v1.IGetKeyRingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.IGetKeyRingRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getKeyRing(request, options, callback); + } +/** + * Returns metadata for a given {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}, as + * well as its {@link protos.google.cloud.kms.v1.CryptoKey.primary|primary} + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link protos.google.cloud.kms.v1.CryptoKey.name|name} of the + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.get_crypto_key.js + * region_tag:cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async + */ + getCryptoKey( + request?: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IGetCryptoKeyRequest|undefined, {}|undefined + ]>; + getCryptoKey( + request: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, + {}|null|undefined>): void; + getCryptoKey( + request: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, + {}|null|undefined>): void; + getCryptoKey( + request?: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IGetCryptoKeyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getCryptoKey(request, options, callback); + } +/** + * Returns metadata for a given + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link protos.google.cloud.kms.v1.CryptoKeyVersion.name|name} of the + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.get_crypto_key_version.js + * region_tag:cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async + */ + getCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|undefined, {}|undefined + ]>; + getCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): void; + getCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): void; + getCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getCryptoKeyVersion(request, options, callback); + } +/** + * Returns the public key for the given + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. The + * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} must be + * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN|ASYMMETRIC_SIGN} + * or + * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT|ASYMMETRIC_DECRYPT}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link protos.google.cloud.kms.v1.CryptoKeyVersion.name|name} of the + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} public key to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.PublicKey|PublicKey}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.get_public_key.js + * region_tag:cloudkms_v1_generated_KeyManagementService_GetPublicKey_async + */ + getPublicKey( + request?: protos.google.cloud.kms.v1.IGetPublicKeyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IPublicKey, + protos.google.cloud.kms.v1.IGetPublicKeyRequest|undefined, {}|undefined + ]>; + getPublicKey( + request: protos.google.cloud.kms.v1.IGetPublicKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IPublicKey, + protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + getPublicKey( + request: protos.google.cloud.kms.v1.IGetPublicKeyRequest, + callback: Callback< + protos.google.cloud.kms.v1.IPublicKey, + protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + getPublicKey( + request?: protos.google.cloud.kms.v1.IGetPublicKeyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IPublicKey, + protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IPublicKey, + protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IPublicKey, + protos.google.cloud.kms.v1.IGetPublicKeyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getPublicKey(request, options, callback); + } +/** + * Returns metadata for a given {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link protos.google.cloud.kms.v1.ImportJob.name|name} of the + * {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.get_import_job.js + * region_tag:cloudkms_v1_generated_KeyManagementService_GetImportJob_async + */ + getImportJob( + request?: protos.google.cloud.kms.v1.IGetImportJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.IGetImportJobRequest|undefined, {}|undefined + ]>; + getImportJob( + request: protos.google.cloud.kms.v1.IGetImportJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, + {}|null|undefined>): void; + getImportJob( + request: protos.google.cloud.kms.v1.IGetImportJobRequest, + callback: Callback< + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, + {}|null|undefined>): void; + getImportJob( + request?: protos.google.cloud.kms.v1.IGetImportJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.IGetImportJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getImportJob(request, options, callback); + } +/** + * Create a new {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} in a given Project and + * Location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location associated with the + * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}, in the format + * `projects/* /locations/*`. + * @param {string} request.keyRingId + * Required. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + * @param {google.cloud.kms.v1.KeyRing} request.keyRing + * Required. A {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} with initial field + * values. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.create_key_ring.js + * region_tag:cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async + */ + createKeyRing( + request?: protos.google.cloud.kms.v1.ICreateKeyRingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.ICreateKeyRingRequest|undefined, {}|undefined + ]>; + createKeyRing( + request: protos.google.cloud.kms.v1.ICreateKeyRingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, + {}|null|undefined>): void; + createKeyRing( + request: protos.google.cloud.kms.v1.ICreateKeyRingRequest, + callback: Callback< + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, + {}|null|undefined>): void; + createKeyRing( + request?: protos.google.cloud.kms.v1.ICreateKeyRingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.ICreateKeyRingRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createKeyRing(request, options, callback); + } +/** + * Create a new {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} within a + * {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. + * + * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} and + * {@link protos.google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm|CryptoKey.version_template.algorithm} + * are required. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link protos.google.cloud.kms.v1.KeyRing.name|name} of the KeyRing + * associated with the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys}. + * @param {string} request.cryptoKeyId + * Required. It must be unique within a KeyRing and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + * @param {google.cloud.kms.v1.CryptoKey} request.cryptoKey + * Required. A {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} with initial field + * values. + * @param {boolean} request.skipInitialVersionCreation + * If set to true, the request will create a + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} without any + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions}. You must + * manually call + * {@link protos.google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion|CreateCryptoKeyVersion} + * or + * {@link protos.google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion|ImportCryptoKeyVersion} + * before you can use this {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.create_crypto_key.js + * region_tag:cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async + */ + createCryptoKey( + request?: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|undefined, {}|undefined + ]>; + createCryptoKey( + request: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, + {}|null|undefined>): void; + createCryptoKey( + request: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, + {}|null|undefined>): void; + createCryptoKey( + request?: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createCryptoKey(request, options, callback); + } +/** + * Create a new {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} in a + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. + * + * The server will assign the next sequential id. If unset, + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|state} will be set to + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED|ENABLED}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link protos.google.cloud.kms.v1.CryptoKey.name|name} of the + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} associated with the + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions}. + * @param {google.cloud.kms.v1.CryptoKeyVersion} request.cryptoKeyVersion + * Required. A {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} with + * initial field values. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.create_crypto_key_version.js + * region_tag:cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async + */ + createCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|undefined, {}|undefined + ]>; + createCryptoKeyVersion( + request: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): void; + createCryptoKeyVersion( + request: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): void; + createCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createCryptoKeyVersion(request, options, callback); + } +/** + * Import wrapped key material into a + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. + * + * All requests must specify a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. If + * a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} is additionally + * specified in the request, key material will be reimported into that + * version. Otherwise, a new version will be created, and will be assigned the + * next sequential id within the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link protos.google.cloud.kms.v1.CryptoKey.name|name} of the + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to be imported into. + * + * The create permission is only required on this key when creating a new + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. + * @param {string} [request.cryptoKeyVersion] + * Optional. The optional {@link protos.google.cloud.kms.v1.CryptoKeyVersion.name|name} of + * an existing {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to + * target for an import operation. If this field is not present, a new + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} containing the + * supplied key material is created. + * + * If this field is present, the supplied key material is imported into + * the existing {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. To + * import into an existing + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}, the + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} must be a child of + * {@link protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent|ImportCryptoKeyVersionRequest.parent}, + * have been previously created via {@link protos.|ImportCryptoKeyVersion}, and be in + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED|DESTROYED} + * or + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED|IMPORT_FAILED} + * state. The key material and algorithm must match the previous + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} exactly if the + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} has ever contained + * key material. + * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm} request.algorithm + * Required. The + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|algorithm} + * of the key being imported. This does not need to match the + * {@link protos.google.cloud.kms.v1.CryptoKey.version_template|version_template} of the + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} this version imports into. + * @param {string} request.importJob + * Required. The {@link protos.google.cloud.kms.v1.ImportJob.name|name} of the + * {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} that was used to wrap this key + * material. + * @param {Buffer} [request.wrappedKey] + * Optional. The wrapped key material to import. + * + * Before wrapping, key material must be formatted. If importing symmetric key + * material, the expected key material format is plain bytes. If importing + * asymmetric key material, the expected key material format is PKCS#8-encoded + * DER (the PrivateKeyInfo structure from RFC 5208). + * + * When wrapping with import methods + * ({@link protos.google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256|RSA_OAEP_3072_SHA1_AES_256} + * or + * {@link protos.google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256|RSA_OAEP_4096_SHA1_AES_256} + * or + * {@link protos.google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256|RSA_OAEP_3072_SHA256_AES_256} + * or + * {@link protos.google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256|RSA_OAEP_4096_SHA256_AES_256}), + * + * this field must contain the concatenation of: + *
    + *
  1. An ephemeral AES-256 wrapping key wrapped with the + * {@link protos.google.cloud.kms.v1.ImportJob.public_key|public_key} using + * RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an empty + * label. + *
  2. + *
  3. The formatted key to be imported, wrapped with the ephemeral AES-256 + * key using AES-KWP (RFC 5649). + *
  4. + *
+ * + * This format is the same as the format produced by PKCS#11 mechanism + * CKM_RSA_AES_KEY_WRAP. + * + * When wrapping with import methods + * ({@link protos.google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256|RSA_OAEP_3072_SHA256} + * or + * {@link protos.google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256|RSA_OAEP_4096_SHA256}), + * + * this field must contain the formatted key to be imported, wrapped with the + * {@link protos.google.cloud.kms.v1.ImportJob.public_key|public_key} using RSAES-OAEP + * with SHA-256, MGF1 with SHA-256, and an empty label. + * @param {Buffer} [request.rsaAesWrappedKey] + * Optional. This field has the same meaning as + * {@link protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key|wrapped_key}. + * Prefer to use that field in new work. Either that field or this field + * (but not both) must be specified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.import_crypto_key_version.js + * region_tag:cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async + */ + importCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|undefined, {}|undefined + ]>; + importCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): void; + importCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): void; + importCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.importCryptoKeyVersion(request, options, callback); + } +/** + * Create a new {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} within a + * {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. + * + * {@link protos.google.cloud.kms.v1.ImportJob.import_method|ImportJob.import_method} is + * required. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link protos.google.cloud.kms.v1.KeyRing.name|name} of the + * {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} associated with the + * {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs}. + * @param {string} request.importJobId + * Required. It must be unique within a KeyRing and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + * @param {google.cloud.kms.v1.ImportJob} request.importJob + * Required. An {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} with initial field + * values. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.create_import_job.js + * region_tag:cloudkms_v1_generated_KeyManagementService_CreateImportJob_async + */ + createImportJob( + request?: protos.google.cloud.kms.v1.ICreateImportJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.ICreateImportJobRequest|undefined, {}|undefined + ]>; + createImportJob( + request: protos.google.cloud.kms.v1.ICreateImportJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, + {}|null|undefined>): void; + createImportJob( + request: protos.google.cloud.kms.v1.ICreateImportJobRequest, + callback: Callback< + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, + {}|null|undefined>): void; + createImportJob( + request?: protos.google.cloud.kms.v1.ICreateImportJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.ICreateImportJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createImportJob(request, options, callback); + } +/** + * Update a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.kms.v1.CryptoKey} request.cryptoKey + * Required. {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} with updated values. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. List of fields to be updated in this request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.update_crypto_key.js + * region_tag:cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async + */ + updateCryptoKey( + request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|undefined, {}|undefined + ]>; + updateCryptoKey( + request: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, + {}|null|undefined>): void; + updateCryptoKey( + request: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, + {}|null|undefined>): void; + updateCryptoKey( + request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'crypto_key.name': request.cryptoKey!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateCryptoKey(request, options, callback); + } +/** + * Update a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}'s + * metadata. + * + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|state} may be changed between + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED|ENABLED} + * and + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED|DISABLED} + * using this method. See + * {@link protos.google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion|DestroyCryptoKeyVersion} + * and + * {@link protos.google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion|RestoreCryptoKeyVersion} + * to move between other states. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.kms.v1.CryptoKeyVersion} request.cryptoKeyVersion + * Required. {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} with + * updated values. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. List of fields to be updated in this request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.update_crypto_key_version.js + * region_tag:cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async + */ + updateCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|undefined, {}|undefined + ]>; + updateCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): void; + updateCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): void; + updateCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'crypto_key_version.name': request.cryptoKeyVersion!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateCryptoKeyVersion(request, options, callback); + } +/** + * Update the version of a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} that + * will be used in + * {@link protos.google.cloud.kms.v1.KeyManagementService.Encrypt|Encrypt}. + * + * Returns an error if called on a key whose purpose is not + * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT|ENCRYPT_DECRYPT}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to update. + * @param {string} request.cryptoKeyVersionId + * Required. The id of the child + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use as primary. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.update_crypto_key_primary_version.js + * region_tag:cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async + */ + updateCryptoKeyPrimaryVersion( + request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|undefined, {}|undefined + ]>; + updateCryptoKeyPrimaryVersion( + request: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, + {}|null|undefined>): void; + updateCryptoKeyPrimaryVersion( + request: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, + {}|null|undefined>): void; + updateCryptoKeyPrimaryVersion( + request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateCryptoKeyPrimaryVersion(request, options, callback); + } +/** + * Schedule a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} for + * destruction. + * + * Upon calling this method, + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|CryptoKeyVersion.state} will + * be set to + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED|DESTROY_SCHEDULED}, + * and {@link protos.google.cloud.kms.v1.CryptoKeyVersion.destroy_time|destroy_time} will + * be set to the time + * {@link protos.google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration|destroy_scheduled_duration} + * in the future. At that time, the + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|state} will automatically + * change to + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED|DESTROYED}, + * and the key material will be irrevocably destroyed. + * + * Before the + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.destroy_time|destroy_time} is + * reached, + * {@link protos.google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion|RestoreCryptoKeyVersion} + * may be called to reverse the process. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to destroy. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.destroy_crypto_key_version.js + * region_tag:cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async + */ + destroyCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|undefined, {}|undefined + ]>; + destroyCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): void; + destroyCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): void; + destroyCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.destroyCryptoKeyVersion(request, options, callback); + } +/** + * Restore a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} in the + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED|DESTROY_SCHEDULED} + * state. + * + * Upon restoration of the CryptoKeyVersion, + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|state} will be set to + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED|DISABLED}, + * and {@link protos.google.cloud.kms.v1.CryptoKeyVersion.destroy_time|destroy_time} will + * be cleared. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to restore. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.restore_crypto_key_version.js + * region_tag:cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async + */ + restoreCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|undefined, {}|undefined + ]>; + restoreCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): void; + restoreCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): void; + restoreCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.restoreCryptoKeyVersion(request, options, callback); + } +/** + * Encrypts data, so that it can only be recovered by a call to + * {@link protos.google.cloud.kms.v1.KeyManagementService.Decrypt|Decrypt}. The + * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} must be + * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT|ENCRYPT_DECRYPT}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} or + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for + * encryption. + * + * If a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} is specified, the server + * will use its {@link protos.google.cloud.kms.v1.CryptoKey.primary|primary version}. + * @param {Buffer} request.plaintext + * Required. The data to encrypt. Must be no larger than 64KiB. + * + * The maximum size depends on the key version's + * {@link protos.google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level|protection_level}. + * For {@link protos.google.cloud.kms.v1.ProtectionLevel.SOFTWARE|SOFTWARE}, + * {@link protos.google.cloud.kms.v1.ProtectionLevel.EXTERNAL|EXTERNAL}, and + * {@link protos.google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC|EXTERNAL_VPC} keys, the + * plaintext must be no larger than 64KiB. For + * {@link protos.google.cloud.kms.v1.ProtectionLevel.HSM|HSM} keys, the combined length of + * the plaintext and additional_authenticated_data fields must be no larger + * than 8KiB. + * @param {Buffer} [request.additionalAuthenticatedData] + * Optional. Optional data that, if specified, must also be provided during + * decryption through + * {@link protos.google.cloud.kms.v1.DecryptRequest.additional_authenticated_data|DecryptRequest.additional_authenticated_data}. + * + * The maximum size depends on the key version's + * {@link protos.google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level|protection_level}. + * For {@link protos.google.cloud.kms.v1.ProtectionLevel.SOFTWARE|SOFTWARE}, + * {@link protos.google.cloud.kms.v1.ProtectionLevel.EXTERNAL|EXTERNAL}, and + * {@link protos.google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC|EXTERNAL_VPC} keys the + * AAD must be no larger than 64KiB. For + * {@link protos.google.cloud.kms.v1.ProtectionLevel.HSM|HSM} keys, the combined length of + * the plaintext and additional_authenticated_data fields must be no larger + * than 8KiB. + * @param {google.protobuf.Int64Value} [request.plaintextCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link protos.google.cloud.kms.v1.EncryptRequest.plaintext|EncryptRequest.plaintext}. + * If specified, + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received + * {@link protos.google.cloud.kms.v1.EncryptRequest.plaintext|EncryptRequest.plaintext} + * using this checksum. + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link protos.google.cloud.kms.v1.EncryptRequest.plaintext|EncryptRequest.plaintext}) + * is equal to + * {@link protos.google.cloud.kms.v1.EncryptRequest.plaintext_crc32c|EncryptRequest.plaintext_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + * @param {google.protobuf.Int64Value} [request.additionalAuthenticatedDataCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link protos.google.cloud.kms.v1.EncryptRequest.additional_authenticated_data|EncryptRequest.additional_authenticated_data}. + * If specified, + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received + * {@link protos.google.cloud.kms.v1.EncryptRequest.additional_authenticated_data|EncryptRequest.additional_authenticated_data} + * using this checksum. + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link protos.google.cloud.kms.v1.EncryptRequest.additional_authenticated_data|EncryptRequest.additional_authenticated_data}) + * is equal to + * {@link protos.google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c|EncryptRequest.additional_authenticated_data_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.EncryptResponse|EncryptResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.encrypt.js + * region_tag:cloudkms_v1_generated_KeyManagementService_Encrypt_async + */ + encrypt( + request?: protos.google.cloud.kms.v1.IEncryptRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IEncryptResponse, + protos.google.cloud.kms.v1.IEncryptRequest|undefined, {}|undefined + ]>; + encrypt( + request: protos.google.cloud.kms.v1.IEncryptRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IEncryptResponse, + protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, + {}|null|undefined>): void; + encrypt( + request: protos.google.cloud.kms.v1.IEncryptRequest, + callback: Callback< + protos.google.cloud.kms.v1.IEncryptResponse, + protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, + {}|null|undefined>): void; + encrypt( + request?: protos.google.cloud.kms.v1.IEncryptRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IEncryptResponse, + protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IEncryptResponse, + protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IEncryptResponse, + protos.google.cloud.kms.v1.IEncryptRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.encrypt(request, options, callback); + } +/** + * Decrypts data that was protected by + * {@link protos.google.cloud.kms.v1.KeyManagementService.Encrypt|Encrypt}. The + * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} must be + * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT|ENCRYPT_DECRYPT}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to use for decryption. The + * server will choose the appropriate version. + * @param {Buffer} request.ciphertext + * Required. The encrypted data originally returned in + * {@link protos.google.cloud.kms.v1.EncryptResponse.ciphertext|EncryptResponse.ciphertext}. + * @param {Buffer} [request.additionalAuthenticatedData] + * Optional. Optional data that must match the data originally supplied in + * {@link protos.google.cloud.kms.v1.EncryptRequest.additional_authenticated_data|EncryptRequest.additional_authenticated_data}. + * @param {google.protobuf.Int64Value} [request.ciphertextCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link protos.google.cloud.kms.v1.DecryptRequest.ciphertext|DecryptRequest.ciphertext}. + * If specified, + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received + * {@link protos.google.cloud.kms.v1.DecryptRequest.ciphertext|DecryptRequest.ciphertext} + * using this checksum. + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link protos.google.cloud.kms.v1.DecryptRequest.ciphertext|DecryptRequest.ciphertext}) + * is equal to + * {@link protos.google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c|DecryptRequest.ciphertext_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + * @param {google.protobuf.Int64Value} [request.additionalAuthenticatedDataCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link protos.google.cloud.kms.v1.DecryptRequest.additional_authenticated_data|DecryptRequest.additional_authenticated_data}. + * If specified, + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received + * {@link protos.google.cloud.kms.v1.DecryptRequest.additional_authenticated_data|DecryptRequest.additional_authenticated_data} + * using this checksum. + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link protos.google.cloud.kms.v1.DecryptRequest.additional_authenticated_data|DecryptRequest.additional_authenticated_data}) + * is equal to + * {@link protos.google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c|DecryptRequest.additional_authenticated_data_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.DecryptResponse|DecryptResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.decrypt.js + * region_tag:cloudkms_v1_generated_KeyManagementService_Decrypt_async + */ + decrypt( + request?: protos.google.cloud.kms.v1.IDecryptRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IDecryptResponse, + protos.google.cloud.kms.v1.IDecryptRequest|undefined, {}|undefined + ]>; + decrypt( + request: protos.google.cloud.kms.v1.IDecryptRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IDecryptResponse, + protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, + {}|null|undefined>): void; + decrypt( + request: protos.google.cloud.kms.v1.IDecryptRequest, + callback: Callback< + protos.google.cloud.kms.v1.IDecryptResponse, + protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, + {}|null|undefined>): void; + decrypt( + request?: protos.google.cloud.kms.v1.IDecryptRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IDecryptResponse, + protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IDecryptResponse, + protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IDecryptResponse, + protos.google.cloud.kms.v1.IDecryptRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.decrypt(request, options, callback); + } +/** + * Encrypts data using portable cryptographic primitives. Most users should + * choose {@link protos.google.cloud.kms.v1.KeyManagementService.Encrypt|Encrypt} and + * {@link protos.google.cloud.kms.v1.KeyManagementService.Decrypt|Decrypt} rather than + * their raw counterparts. The + * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} must be + * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT|RAW_ENCRYPT_DECRYPT}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for + * encryption. + * @param {Buffer} request.plaintext + * Required. The data to encrypt. Must be no larger than 64KiB. + * + * The maximum size depends on the key version's + * {@link protos.google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level|protection_level}. + * For {@link protos.google.cloud.kms.v1.ProtectionLevel.SOFTWARE|SOFTWARE} keys, the + * plaintext must be no larger than 64KiB. For + * {@link protos.google.cloud.kms.v1.ProtectionLevel.HSM|HSM} keys, the combined length of + * the plaintext and additional_authenticated_data fields must be no larger + * than 8KiB. + * @param {Buffer} [request.additionalAuthenticatedData] + * Optional. Optional data that, if specified, must also be provided during + * decryption through + * {@link protos.google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data|RawDecryptRequest.additional_authenticated_data}. + * + * This field may only be used in conjunction with an + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.algorithm|algorithm} that accepts + * additional authenticated data (for example, AES-GCM). + * + * The maximum size depends on the key version's + * {@link protos.google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level|protection_level}. + * For {@link protos.google.cloud.kms.v1.ProtectionLevel.SOFTWARE|SOFTWARE} keys, the + * plaintext must be no larger than 64KiB. For + * {@link protos.google.cloud.kms.v1.ProtectionLevel.HSM|HSM} keys, the combined length of + * the plaintext and additional_authenticated_data fields must be no larger + * than 8KiB. + * @param {google.protobuf.Int64Value} [request.plaintextCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link protos.google.cloud.kms.v1.RawEncryptRequest.plaintext|RawEncryptRequest.plaintext}. + * If specified, + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received plaintext using this checksum. + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that CRC32C(plaintext) is equal + * to plaintext_crc32c, and if so, perform a limited number of retries. A + * persistent mismatch may indicate an issue in your computation of the CRC32C + * checksum. Note: This field is defined as int64 for reasons of compatibility + * across different languages. However, it is a non-negative integer, which + * will never exceed 2^32-1, and can be safely downconverted to uint32 in + * languages that support this type. + * @param {google.protobuf.Int64Value} [request.additionalAuthenticatedDataCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link protos.google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data|RawEncryptRequest.additional_authenticated_data}. + * If specified, + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received additional_authenticated_data using + * this checksum. + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(additional_authenticated_data) is equal to + * additional_authenticated_data_crc32c, and if so, perform + * a limited number of retries. A persistent mismatch may indicate an issue in + * your computation of the CRC32C checksum. + * Note: This field is defined as int64 for reasons of compatibility across + * different languages. However, it is a non-negative integer, which will + * never exceed 2^32-1, and can be safely downconverted to uint32 in languages + * that support this type. + * @param {Buffer} [request.initializationVector] + * Optional. A customer-supplied initialization vector that will be used for + * encryption. If it is not provided for AES-CBC and AES-CTR, one will be + * generated. It will be returned in + * {@link protos.google.cloud.kms.v1.RawEncryptResponse.initialization_vector|RawEncryptResponse.initialization_vector}. + * @param {google.protobuf.Int64Value} [request.initializationVectorCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link protos.google.cloud.kms.v1.RawEncryptRequest.initialization_vector|RawEncryptRequest.initialization_vector}. + * If specified, + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received initialization_vector using this + * checksum. {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} + * will report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(initialization_vector) is equal to + * initialization_vector_crc32c, and if so, perform + * a limited number of retries. A persistent mismatch may indicate an issue in + * your computation of the CRC32C checksum. + * Note: This field is defined as int64 for reasons of compatibility across + * different languages. However, it is a non-negative integer, which will + * never exceed 2^32-1, and can be safely downconverted to uint32 in languages + * that support this type. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.RawEncryptResponse|RawEncryptResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.raw_encrypt.js + * region_tag:cloudkms_v1_generated_KeyManagementService_RawEncrypt_async + */ + rawEncrypt( + request?: protos.google.cloud.kms.v1.IRawEncryptRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IRawEncryptResponse, + protos.google.cloud.kms.v1.IRawEncryptRequest|undefined, {}|undefined + ]>; + rawEncrypt( + request: protos.google.cloud.kms.v1.IRawEncryptRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IRawEncryptResponse, + protos.google.cloud.kms.v1.IRawEncryptRequest|null|undefined, + {}|null|undefined>): void; + rawEncrypt( + request: protos.google.cloud.kms.v1.IRawEncryptRequest, + callback: Callback< + protos.google.cloud.kms.v1.IRawEncryptResponse, + protos.google.cloud.kms.v1.IRawEncryptRequest|null|undefined, + {}|null|undefined>): void; + rawEncrypt( + request?: protos.google.cloud.kms.v1.IRawEncryptRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IRawEncryptResponse, + protos.google.cloud.kms.v1.IRawEncryptRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IRawEncryptResponse, + protos.google.cloud.kms.v1.IRawEncryptRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IRawEncryptResponse, + protos.google.cloud.kms.v1.IRawEncryptRequest|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.rawEncrypt(request, options, callback); + } +/** + * Decrypts data that was originally encrypted using a raw cryptographic + * mechanism. The {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} + * must be + * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT|RAW_ENCRYPT_DECRYPT}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for + * decryption. + * @param {Buffer} request.ciphertext + * Required. The encrypted data originally returned in + * {@link protos.google.cloud.kms.v1.RawEncryptResponse.ciphertext|RawEncryptResponse.ciphertext}. + * @param {Buffer} [request.additionalAuthenticatedData] + * Optional. Optional data that must match the data originally supplied in + * {@link protos.google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data|RawEncryptRequest.additional_authenticated_data}. + * @param {Buffer} request.initializationVector + * Required. The initialization vector (IV) used during encryption, which must + * match the data originally provided in + * {@link protos.google.cloud.kms.v1.RawEncryptResponse.initialization_vector|RawEncryptResponse.initialization_vector}. + * @param {number} request.tagLength + * The length of the authentication tag that is appended to the end of + * the ciphertext. If unspecified (0), the default value for the key's + * algorithm will be used (for AES-GCM, the default value is 16). + * @param {google.protobuf.Int64Value} [request.ciphertextCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link protos.google.cloud.kms.v1.RawDecryptRequest.ciphertext|RawDecryptRequest.ciphertext}. + * If specified, + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received ciphertext using this checksum. + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that CRC32C(ciphertext) is equal + * to ciphertext_crc32c, and if so, perform a limited number of retries. A + * persistent mismatch may indicate an issue in your computation of the CRC32C + * checksum. Note: This field is defined as int64 for reasons of compatibility + * across different languages. However, it is a non-negative integer, which + * will never exceed 2^32-1, and can be safely downconverted to uint32 in + * languages that support this type. + * @param {google.protobuf.Int64Value} [request.additionalAuthenticatedDataCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link protos.google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data|RawDecryptRequest.additional_authenticated_data}. + * If specified, + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received additional_authenticated_data using + * this checksum. + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(additional_authenticated_data) is equal to + * additional_authenticated_data_crc32c, and if so, perform + * a limited number of retries. A persistent mismatch may indicate an issue in + * your computation of the CRC32C checksum. + * Note: This field is defined as int64 for reasons of compatibility across + * different languages. However, it is a non-negative integer, which will + * never exceed 2^32-1, and can be safely downconverted to uint32 in languages + * that support this type. + * @param {google.protobuf.Int64Value} [request.initializationVectorCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link protos.google.cloud.kms.v1.RawDecryptRequest.initialization_vector|RawDecryptRequest.initialization_vector}. + * If specified, + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received initialization_vector using this + * checksum. {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} + * will report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and + * if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. + * Note: This field is defined as int64 for reasons of compatibility across + * different languages. However, it is a non-negative integer, which will + * never exceed 2^32-1, and can be safely downconverted to uint32 in languages + * that support this type. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.RawDecryptResponse|RawDecryptResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.raw_decrypt.js + * region_tag:cloudkms_v1_generated_KeyManagementService_RawDecrypt_async + */ + rawDecrypt( + request?: protos.google.cloud.kms.v1.IRawDecryptRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IRawDecryptResponse, + protos.google.cloud.kms.v1.IRawDecryptRequest|undefined, {}|undefined + ]>; + rawDecrypt( + request: protos.google.cloud.kms.v1.IRawDecryptRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IRawDecryptResponse, + protos.google.cloud.kms.v1.IRawDecryptRequest|null|undefined, + {}|null|undefined>): void; + rawDecrypt( + request: protos.google.cloud.kms.v1.IRawDecryptRequest, + callback: Callback< + protos.google.cloud.kms.v1.IRawDecryptResponse, + protos.google.cloud.kms.v1.IRawDecryptRequest|null|undefined, + {}|null|undefined>): void; + rawDecrypt( + request?: protos.google.cloud.kms.v1.IRawDecryptRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IRawDecryptResponse, + protos.google.cloud.kms.v1.IRawDecryptRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IRawDecryptResponse, + protos.google.cloud.kms.v1.IRawDecryptRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IRawDecryptResponse, + protos.google.cloud.kms.v1.IRawDecryptRequest|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.rawDecrypt(request, options, callback); + } +/** + * Signs data using a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} + * with {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} + * ASYMMETRIC_SIGN, producing a signature that can be verified with the public + * key retrieved from + * {@link protos.google.cloud.kms.v1.KeyManagementService.GetPublicKey|GetPublicKey}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for + * signing. + * @param {google.cloud.kms.v1.Digest} [request.digest] + * Optional. The digest of the data to sign. The digest must be produced with + * the same digest algorithm as specified by the key version's + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.algorithm|algorithm}. + * + * This field may not be supplied if + * {@link protos.google.cloud.kms.v1.AsymmetricSignRequest.data|AsymmetricSignRequest.data} + * is supplied. + * @param {google.protobuf.Int64Value} [request.digestCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link protos.google.cloud.kms.v1.AsymmetricSignRequest.digest|AsymmetricSignRequest.digest}. + * If specified, + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received + * {@link protos.google.cloud.kms.v1.AsymmetricSignRequest.digest|AsymmetricSignRequest.digest} + * using this checksum. + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link protos.google.cloud.kms.v1.AsymmetricSignRequest.digest|AsymmetricSignRequest.digest}) + * is equal to + * {@link protos.google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c|AsymmetricSignRequest.digest_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + * @param {Buffer} [request.data] + * Optional. The data to sign. + * It can't be supplied if + * {@link protos.google.cloud.kms.v1.AsymmetricSignRequest.digest|AsymmetricSignRequest.digest} + * is supplied. + * @param {google.protobuf.Int64Value} [request.dataCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link protos.google.cloud.kms.v1.AsymmetricSignRequest.data|AsymmetricSignRequest.data}. + * If specified, + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received + * {@link protos.google.cloud.kms.v1.AsymmetricSignRequest.data|AsymmetricSignRequest.data} + * using this checksum. + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link protos.google.cloud.kms.v1.AsymmetricSignRequest.data|AsymmetricSignRequest.data}) + * is equal to + * {@link protos.google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c|AsymmetricSignRequest.data_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.AsymmetricSignResponse|AsymmetricSignResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.asymmetric_sign.js + * region_tag:cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async + */ + asymmetricSign( + request?: protos.google.cloud.kms.v1.IAsymmetricSignRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IAsymmetricSignResponse, + protos.google.cloud.kms.v1.IAsymmetricSignRequest|undefined, {}|undefined + ]>; + asymmetricSign( + request: protos.google.cloud.kms.v1.IAsymmetricSignRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IAsymmetricSignResponse, + protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, + {}|null|undefined>): void; + asymmetricSign( + request: protos.google.cloud.kms.v1.IAsymmetricSignRequest, + callback: Callback< + protos.google.cloud.kms.v1.IAsymmetricSignResponse, + protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, + {}|null|undefined>): void; + asymmetricSign( + request?: protos.google.cloud.kms.v1.IAsymmetricSignRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IAsymmetricSignResponse, + protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IAsymmetricSignResponse, + protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IAsymmetricSignResponse, + protos.google.cloud.kms.v1.IAsymmetricSignRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.asymmetricSign(request, options, callback); + } +/** + * Decrypts data that was encrypted with a public key retrieved from + * {@link protos.google.cloud.kms.v1.KeyManagementService.GetPublicKey|GetPublicKey} + * corresponding to a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} + * with {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} + * ASYMMETRIC_DECRYPT. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for + * decryption. + * @param {Buffer} request.ciphertext + * Required. The data encrypted with the named + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}'s public key using + * OAEP. + * @param {google.protobuf.Int64Value} [request.ciphertextCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link protos.google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext|AsymmetricDecryptRequest.ciphertext}. + * If specified, + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received + * {@link protos.google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext|AsymmetricDecryptRequest.ciphertext} + * using this checksum. + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link protos.google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext|AsymmetricDecryptRequest.ciphertext}) + * is equal to + * {@link protos.google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c|AsymmetricDecryptRequest.ciphertext_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.AsymmetricDecryptResponse|AsymmetricDecryptResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.asymmetric_decrypt.js + * region_tag:cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async + */ + asymmetricDecrypt( + request?: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, + protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|undefined, {}|undefined + ]>; + asymmetricDecrypt( + request: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, + protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, + {}|null|undefined>): void; + asymmetricDecrypt( + request: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, + callback: Callback< + protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, + protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, + {}|null|undefined>): void; + asymmetricDecrypt( + request?: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, + protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, + protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, + protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.asymmetricDecrypt(request, options, callback); + } +/** + * Signs data using a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} + * with {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} MAC, + * producing a tag that can be verified by another source with the same key. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for + * signing. + * @param {Buffer} request.data + * Required. The data to sign. The MAC tag is computed over this data field + * based on the specific algorithm. + * @param {google.protobuf.Int64Value} [request.dataCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link protos.google.cloud.kms.v1.MacSignRequest.data|MacSignRequest.data}. If + * specified, {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} + * will verify the integrity of the received + * {@link protos.google.cloud.kms.v1.MacSignRequest.data|MacSignRequest.data} using this + * checksum. {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} + * will report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link protos.google.cloud.kms.v1.MacSignRequest.data|MacSignRequest.data}) is + * equal to + * {@link protos.google.cloud.kms.v1.MacSignRequest.data_crc32c|MacSignRequest.data_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.MacSignResponse|MacSignResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.mac_sign.js + * region_tag:cloudkms_v1_generated_KeyManagementService_MacSign_async + */ + macSign( + request?: protos.google.cloud.kms.v1.IMacSignRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IMacSignResponse, + protos.google.cloud.kms.v1.IMacSignRequest|undefined, {}|undefined + ]>; + macSign( + request: protos.google.cloud.kms.v1.IMacSignRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IMacSignResponse, + protos.google.cloud.kms.v1.IMacSignRequest|null|undefined, + {}|null|undefined>): void; + macSign( + request: protos.google.cloud.kms.v1.IMacSignRequest, + callback: Callback< + protos.google.cloud.kms.v1.IMacSignResponse, + protos.google.cloud.kms.v1.IMacSignRequest|null|undefined, + {}|null|undefined>): void; + macSign( + request?: protos.google.cloud.kms.v1.IMacSignRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IMacSignResponse, + protos.google.cloud.kms.v1.IMacSignRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IMacSignResponse, + protos.google.cloud.kms.v1.IMacSignRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IMacSignResponse, + protos.google.cloud.kms.v1.IMacSignRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.macSign(request, options, callback); + } +/** + * Verifies MAC tag using a + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} with + * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} MAC, and returns + * a response that indicates whether or not the verification was successful. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for + * verification. + * @param {Buffer} request.data + * Required. The data used previously as a + * {@link protos.google.cloud.kms.v1.MacSignRequest.data|MacSignRequest.data} to generate + * the MAC tag. + * @param {google.protobuf.Int64Value} [request.dataCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link protos.google.cloud.kms.v1.MacVerifyRequest.data|MacVerifyRequest.data}. If + * specified, {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} + * will verify the integrity of the received + * {@link protos.google.cloud.kms.v1.MacVerifyRequest.data|MacVerifyRequest.data} using + * this checksum. + * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link protos.google.cloud.kms.v1.MacVerifyRequest.data|MacVerifyRequest.data}) + * is equal to + * {@link protos.google.cloud.kms.v1.MacVerifyRequest.data_crc32c|MacVerifyRequest.data_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + * @param {Buffer} request.mac + * Required. The signature to verify. + * @param {google.protobuf.Int64Value} [request.macCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link protos.google.cloud.kms.v1.MacVerifyRequest.mac|MacVerifyRequest.mac}. If + * specified, {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} + * will verify the integrity of the received + * {@link protos.google.cloud.kms.v1.MacVerifyRequest.mac|MacVerifyRequest.mac} using this + * checksum. {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} + * will report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link protos.|MacVerifyRequest.tag}) is equal to + * {@link protos.google.cloud.kms.v1.MacVerifyRequest.mac_crc32c|MacVerifyRequest.mac_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.MacVerifyResponse|MacVerifyResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.mac_verify.js + * region_tag:cloudkms_v1_generated_KeyManagementService_MacVerify_async + */ + macVerify( + request?: protos.google.cloud.kms.v1.IMacVerifyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IMacVerifyResponse, + protos.google.cloud.kms.v1.IMacVerifyRequest|undefined, {}|undefined + ]>; + macVerify( + request: protos.google.cloud.kms.v1.IMacVerifyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IMacVerifyResponse, + protos.google.cloud.kms.v1.IMacVerifyRequest|null|undefined, + {}|null|undefined>): void; + macVerify( + request: protos.google.cloud.kms.v1.IMacVerifyRequest, + callback: Callback< + protos.google.cloud.kms.v1.IMacVerifyResponse, + protos.google.cloud.kms.v1.IMacVerifyRequest|null|undefined, + {}|null|undefined>): void; + macVerify( + request?: protos.google.cloud.kms.v1.IMacVerifyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IMacVerifyResponse, + protos.google.cloud.kms.v1.IMacVerifyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IMacVerifyResponse, + protos.google.cloud.kms.v1.IMacVerifyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IMacVerifyResponse, + protos.google.cloud.kms.v1.IMacVerifyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.macVerify(request, options, callback); + } +/** + * Generate random bytes using the Cloud KMS randomness source in the provided + * location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.location + * The project-specific location in which to generate random bytes. + * For example, "projects/my-project/locations/us-central1". + * @param {number} request.lengthBytes + * The length in bytes of the amount of randomness to retrieve. Minimum 8 + * bytes, maximum 1024 bytes. + * @param {google.cloud.kms.v1.ProtectionLevel} request.protectionLevel + * The {@link protos.google.cloud.kms.v1.ProtectionLevel|ProtectionLevel} to use when + * generating the random data. Currently, only + * {@link protos.google.cloud.kms.v1.ProtectionLevel.HSM|HSM} protection level is + * supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.GenerateRandomBytesResponse|GenerateRandomBytesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.generate_random_bytes.js + * region_tag:cloudkms_v1_generated_KeyManagementService_GenerateRandomBytes_async + */ + generateRandomBytes( + request?: protos.google.cloud.kms.v1.IGenerateRandomBytesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, + protos.google.cloud.kms.v1.IGenerateRandomBytesRequest|undefined, {}|undefined + ]>; + generateRandomBytes( + request: protos.google.cloud.kms.v1.IGenerateRandomBytesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, + protos.google.cloud.kms.v1.IGenerateRandomBytesRequest|null|undefined, + {}|null|undefined>): void; + generateRandomBytes( + request: protos.google.cloud.kms.v1.IGenerateRandomBytesRequest, + callback: Callback< + protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, + protos.google.cloud.kms.v1.IGenerateRandomBytesRequest|null|undefined, + {}|null|undefined>): void; + generateRandomBytes( + request?: protos.google.cloud.kms.v1.IGenerateRandomBytesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, + protos.google.cloud.kms.v1.IGenerateRandomBytesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, + protos.google.cloud.kms.v1.IGenerateRandomBytesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, + protos.google.cloud.kms.v1.IGenerateRandomBytesRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'location': request.location ?? '', + }); + this.initialize(); + return this.innerApiCalls.generateRandomBytes(request, options, callback); + } + + /** + * Lists {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location associated with the + * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} to include in the response. Further + * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} can subsequently be obtained by + * including the + * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listKeyRingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listKeyRings( + request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IKeyRing[], + protos.google.cloud.kms.v1.IListKeyRingsRequest|null, + protos.google.cloud.kms.v1.IListKeyRingsResponse + ]>; + listKeyRings( + request: protos.google.cloud.kms.v1.IListKeyRingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListKeyRingsRequest, + protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, + protos.google.cloud.kms.v1.IKeyRing>): void; + listKeyRings( + request: protos.google.cloud.kms.v1.IListKeyRingsRequest, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListKeyRingsRequest, + protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, + protos.google.cloud.kms.v1.IKeyRing>): void; + listKeyRings( + request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.kms.v1.IListKeyRingsRequest, + protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, + protos.google.cloud.kms.v1.IKeyRing>, + callback?: PaginationCallback< + protos.google.cloud.kms.v1.IListKeyRingsRequest, + protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, + protos.google.cloud.kms.v1.IKeyRing>): + Promise<[ + protos.google.cloud.kms.v1.IKeyRing[], + protos.google.cloud.kms.v1.IListKeyRingsRequest|null, + protos.google.cloud.kms.v1.IListKeyRingsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listKeyRings(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location associated with the + * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} to include in the response. Further + * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} can subsequently be obtained by + * including the + * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listKeyRingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listKeyRingsStream( + request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listKeyRings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listKeyRings.createStream( + this.innerApiCalls.listKeyRings as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listKeyRings`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location associated with the + * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} to include in the response. Further + * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} can subsequently be obtained by + * including the + * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.list_key_rings.js + * region_tag:cloudkms_v1_generated_KeyManagementService_ListKeyRings_async + */ + listKeyRingsAsync( + request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listKeyRings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listKeyRings.asyncIterate( + this.innerApiCalls['listKeyRings'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} + * to list, in the format `projects/* /locations/* /keyRings/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} to include in the response. + * Further {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} can subsequently be + * obtained by including the + * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token}. + * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.versionView + * The fields of the primary version to include in the response. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCryptoKeysAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCryptoKeys( + request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKey[], + protos.google.cloud.kms.v1.IListCryptoKeysRequest|null, + protos.google.cloud.kms.v1.IListCryptoKeysResponse + ]>; + listCryptoKeys( + request: protos.google.cloud.kms.v1.IListCryptoKeysRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListCryptoKeysRequest, + protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, + protos.google.cloud.kms.v1.ICryptoKey>): void; + listCryptoKeys( + request: protos.google.cloud.kms.v1.IListCryptoKeysRequest, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListCryptoKeysRequest, + protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, + protos.google.cloud.kms.v1.ICryptoKey>): void; + listCryptoKeys( + request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.kms.v1.IListCryptoKeysRequest, + protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, + protos.google.cloud.kms.v1.ICryptoKey>, + callback?: PaginationCallback< + protos.google.cloud.kms.v1.IListCryptoKeysRequest, + protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, + protos.google.cloud.kms.v1.ICryptoKey>): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKey[], + protos.google.cloud.kms.v1.IListCryptoKeysRequest|null, + protos.google.cloud.kms.v1.IListCryptoKeysResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listCryptoKeys(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} + * to list, in the format `projects/* /locations/* /keyRings/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} to include in the response. + * Further {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} can subsequently be + * obtained by including the + * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token}. + * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.versionView + * The fields of the primary version to include in the response. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCryptoKeysAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCryptoKeysStream( + request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listCryptoKeys']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCryptoKeys.createStream( + this.innerApiCalls.listCryptoKeys as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCryptoKeys`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} + * to list, in the format `projects/* /locations/* /keyRings/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} to include in the response. + * Further {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} can subsequently be + * obtained by including the + * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token}. + * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.versionView + * The fields of the primary version to include in the response. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.list_crypto_keys.js + * region_tag:cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async + */ + listCryptoKeysAsync( + request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listCryptoKeys']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCryptoKeys.asyncIterate( + this.innerApiCalls['listCryptoKeys'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to list, in the format + * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} to include in the + * response. Further {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} + * can subsequently be obtained by including the + * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token}. + * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.view + * The fields to include in the response. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCryptoKeyVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCryptoKeyVersions( + request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKeyVersion[], + protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest|null, + protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse + ]>; + listCryptoKeyVersions( + request: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, + protos.google.cloud.kms.v1.ICryptoKeyVersion>): void; + listCryptoKeyVersions( + request: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, + protos.google.cloud.kms.v1.ICryptoKeyVersion>): void; + listCryptoKeyVersions( + request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, + protos.google.cloud.kms.v1.ICryptoKeyVersion>, + callback?: PaginationCallback< + protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, + protos.google.cloud.kms.v1.ICryptoKeyVersion>): + Promise<[ + protos.google.cloud.kms.v1.ICryptoKeyVersion[], + protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest|null, + protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listCryptoKeyVersions(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to list, in the format + * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} to include in the + * response. Further {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} + * can subsequently be obtained by including the + * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token}. + * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.view + * The fields to include in the response. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCryptoKeyVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCryptoKeyVersionsStream( + request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listCryptoKeyVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCryptoKeyVersions.createStream( + this.innerApiCalls.listCryptoKeyVersions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCryptoKeyVersions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the + * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to list, in the format + * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} to include in the + * response. Further {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} + * can subsequently be obtained by including the + * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token}. + * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.view + * The fields to include in the response. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.list_crypto_key_versions.js + * region_tag:cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async + */ + listCryptoKeyVersionsAsync( + request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listCryptoKeyVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCryptoKeyVersions.asyncIterate( + this.innerApiCalls['listCryptoKeyVersions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} + * to list, in the format `projects/* /locations/* /keyRings/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} to include in the response. + * Further {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} can subsequently be + * obtained by including the + * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listImportJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listImportJobs( + request?: protos.google.cloud.kms.v1.IListImportJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.kms.v1.IImportJob[], + protos.google.cloud.kms.v1.IListImportJobsRequest|null, + protos.google.cloud.kms.v1.IListImportJobsResponse + ]>; + listImportJobs( + request: protos.google.cloud.kms.v1.IListImportJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListImportJobsRequest, + protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, + protos.google.cloud.kms.v1.IImportJob>): void; + listImportJobs( + request: protos.google.cloud.kms.v1.IListImportJobsRequest, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListImportJobsRequest, + protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, + protos.google.cloud.kms.v1.IImportJob>): void; + listImportJobs( + request?: protos.google.cloud.kms.v1.IListImportJobsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.kms.v1.IListImportJobsRequest, + protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, + protos.google.cloud.kms.v1.IImportJob>, + callback?: PaginationCallback< + protos.google.cloud.kms.v1.IListImportJobsRequest, + protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, + protos.google.cloud.kms.v1.IImportJob>): + Promise<[ + protos.google.cloud.kms.v1.IImportJob[], + protos.google.cloud.kms.v1.IListImportJobsRequest|null, + protos.google.cloud.kms.v1.IListImportJobsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listImportJobs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} + * to list, in the format `projects/* /locations/* /keyRings/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} to include in the response. + * Further {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} can subsequently be + * obtained by including the + * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listImportJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listImportJobsStream( + request?: protos.google.cloud.kms.v1.IListImportJobsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listImportJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listImportJobs.createStream( + this.innerApiCalls.listImportJobs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listImportJobs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} + * to list, in the format `projects/* /locations/* /keyRings/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} to include in the response. + * Further {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} can subsequently be + * obtained by including the + * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.list_import_jobs.js + * region_tag:cloudkms_v1_generated_KeyManagementService_ListImportJobs_async + */ + listImportJobsAsync( + request?: protos.google.cloud.kms.v1.IListImportJobsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listImportJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listImportJobs.asyncIterate( + this.innerApiCalls['listImportJobs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified cryptoKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @returns {string} Resource name string. + */ + cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { + return this.pathTemplates.cryptoKeyPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + }); + } + + /** + * Parse the project from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; + } + + /** + * Parse the location from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; + } + + /** + * Parse the key_ring from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; + } + + /** + * Parse the crypto_key from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; + } + + /** + * Return a fully-qualified cryptoKeyVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @param {string} crypto_key_version + * @returns {string} Resource name string. + */ + cryptoKeyVersionPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + crypto_key_version: cryptoKeyVersion, + }); + } + + /** + * Parse the project from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).project; + } + + /** + * Parse the location from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).location; + } + + /** + * Parse the key_ring from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).key_ring; + } + + /** + * Parse the crypto_key from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).crypto_key; + } + + /** + * Parse the crypto_key_version from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the crypto_key_version. + */ + matchCryptoKeyVersionFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).crypto_key_version; + } + + /** + * Return a fully-qualified ekmConfig resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + ekmConfigPath(project:string,location:string) { + return this.pathTemplates.ekmConfigPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from EkmConfig resource. + * + * @param {string} ekmConfigName + * A fully-qualified path representing EkmConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEkmConfigName(ekmConfigName: string) { + return this.pathTemplates.ekmConfigPathTemplate.match(ekmConfigName).project; + } + + /** + * Parse the location from EkmConfig resource. + * + * @param {string} ekmConfigName + * A fully-qualified path representing EkmConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEkmConfigName(ekmConfigName: string) { + return this.pathTemplates.ekmConfigPathTemplate.match(ekmConfigName).location; + } + + /** + * Return a fully-qualified ekmConnection resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} ekm_connection + * @returns {string} Resource name string. + */ + ekmConnectionPath(project:string,location:string,ekmConnection:string) { + return this.pathTemplates.ekmConnectionPathTemplate.render({ + project: project, + location: location, + ekm_connection: ekmConnection, + }); + } + + /** + * Parse the project from EkmConnection resource. + * + * @param {string} ekmConnectionName + * A fully-qualified path representing EkmConnection resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEkmConnectionName(ekmConnectionName: string) { + return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName).project; + } + + /** + * Parse the location from EkmConnection resource. + * + * @param {string} ekmConnectionName + * A fully-qualified path representing EkmConnection resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEkmConnectionName(ekmConnectionName: string) { + return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName).location; + } + + /** + * Parse the ekm_connection from EkmConnection resource. + * + * @param {string} ekmConnectionName + * A fully-qualified path representing EkmConnection resource. + * @returns {string} A string representing the ekm_connection. + */ + matchEkmConnectionFromEkmConnectionName(ekmConnectionName: string) { + return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName).ekm_connection; + } + + /** + * Return a fully-qualified importJob resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} import_job + * @returns {string} Resource name string. + */ + importJobPath(project:string,location:string,keyRing:string,importJob:string) { + return this.pathTemplates.importJobPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + import_job: importJob, + }); + } + + /** + * Parse the project from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the project. + */ + matchProjectFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).project; + } + + /** + * Parse the location from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the location. + */ + matchLocationFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).location; + } + + /** + * Parse the key_ring from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).key_ring; + } + + /** + * Parse the import_job from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the import_job. + */ + matchImportJobFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).import_job; + } + + /** + * Return a fully-qualified keyRing resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @returns {string} Resource name string. + */ + keyRingPath(project:string,location:string,keyRing:string) { + return this.pathTemplates.keyRingPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + }); + } + + /** + * Parse the project from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the project. + */ + matchProjectFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).project; + } + + /** + * Parse the location from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the location. + */ + matchLocationFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).location; + } + + /** + * Parse the key_ring from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).key_ring; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified publicKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @param {string} crypto_key_version + * @returns {string} Resource name string. + */ + publicKeyPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { + return this.pathTemplates.publicKeyPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + crypto_key_version: cryptoKeyVersion, + }); + } + + /** + * Parse the project from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).project; + } + + /** + * Parse the location from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).location; + } + + /** + * Parse the key_ring from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).key_ring; + } + + /** + * Parse the crypto_key from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).crypto_key; + } + + /** + * Parse the crypto_key_version from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the crypto_key_version. + */ + matchCryptoKeyVersionFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).crypto_key_version; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.keyManagementServiceStub && !this._terminated) { + return this.keyManagementServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_client_config.json b/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_client_config.json new file mode 100644 index 00000000000..d30f20d20ed --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_client_config.json @@ -0,0 +1,164 @@ +{ + "interfaces": { + "google.cloud.kms.v1.KeyManagementService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListKeyRings": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListCryptoKeys": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListCryptoKeyVersions": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListImportJobs": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetKeyRing": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetCryptoKey": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetCryptoKeyVersion": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetPublicKey": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetImportJob": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateKeyRing": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateCryptoKey": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateCryptoKeyVersion": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ImportCryptoKeyVersion": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateImportJob": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateCryptoKey": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateCryptoKeyVersion": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateCryptoKeyPrimaryVersion": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DestroyCryptoKeyVersion": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RestoreCryptoKeyVersion": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "Encrypt": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "Decrypt": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RawEncrypt": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RawDecrypt": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AsymmetricSign": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "AsymmetricDecrypt": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "MacSign": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "MacVerify": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GenerateRandomBytes": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_proto_list.json b/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_proto_list.json new file mode 100644 index 00000000000..ad57fc558ee --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/kms/v1/ekm_service.proto", + "../../protos/google/cloud/kms/v1/resources.proto", + "../../protos/google/cloud/kms/v1/service.proto" +] diff --git a/owl-bot-staging/google-cloud-kms/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-kms/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..269c314a82c --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/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 kms = require('@google-cloud/kms'); + +function main() { + const ekmServiceClient = new kms.EkmServiceClient(); + const keyManagementServiceClient = new kms.KeyManagementServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-kms/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-kms/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..d2b8592b58d --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/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 {EkmServiceClient, KeyManagementServiceClient} from '@google-cloud/kms'; + +// check that the client class type name can be used +function doStuffWithEkmServiceClient(client: EkmServiceClient) { + client.close(); +} +function doStuffWithKeyManagementServiceClient(client: KeyManagementServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const ekmServiceClient = new EkmServiceClient(); + doStuffWithEkmServiceClient(ekmServiceClient); + // check that the client instance can be created + const keyManagementServiceClient = new KeyManagementServiceClient(); + doStuffWithKeyManagementServiceClient(keyManagementServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-kms/v1/system-test/install.ts b/owl-bot-staging/google-cloud-kms/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/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-kms/v1/test/gapic_ekm_service_v1.ts b/owl-bot-staging/google-cloud-kms/v1/test/gapic_ekm_service_v1.ts new file mode 100644 index 00000000000..6acdc45f4ce --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/test/gapic_ekm_service_v1.ts @@ -0,0 +1,1943 @@ +// 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 ekmserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.EkmServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = ekmserviceModule.v1.EkmServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = ekmserviceModule.v1.EkmServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = ekmserviceModule.v1.EkmServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new ekmserviceModule.v1.EkmServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.ekmServiceStub, undefined); + await client.initialize(); + assert(client.ekmServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.ekmServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.ekmServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getEkmConnection', () => { + it('invokes getEkmConnection without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetEkmConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetEkmConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EkmConnection() + ); + client.innerApiCalls.getEkmConnection = stubSimpleCall(expectedResponse); + const [response] = await client.getEkmConnection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getEkmConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEkmConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEkmConnection without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetEkmConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetEkmConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EkmConnection() + ); + client.innerApiCalls.getEkmConnection = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEkmConnection( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IEkmConnection|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getEkmConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEkmConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEkmConnection with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetEkmConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetEkmConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEkmConnection = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEkmConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.getEkmConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEkmConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEkmConnection with closed client', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetEkmConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetEkmConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getEkmConnection(request), expectedError); + }); + }); + + describe('createEkmConnection', () => { + it('invokes createEkmConnection without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateEkmConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateEkmConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EkmConnection() + ); + client.innerApiCalls.createEkmConnection = stubSimpleCall(expectedResponse); + const [response] = await client.createEkmConnection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createEkmConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEkmConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEkmConnection without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateEkmConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateEkmConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EkmConnection() + ); + client.innerApiCalls.createEkmConnection = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createEkmConnection( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IEkmConnection|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createEkmConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEkmConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEkmConnection with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateEkmConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateEkmConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEkmConnection = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createEkmConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.createEkmConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEkmConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEkmConnection with closed client', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateEkmConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateEkmConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createEkmConnection(request), expectedError); + }); + }); + + describe('updateEkmConnection', () => { + it('invokes updateEkmConnection without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateEkmConnectionRequest() + ); + request.ekmConnection ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateEkmConnectionRequest', ['ekmConnection', 'name']); + request.ekmConnection.name = defaultValue1; + const expectedHeaderRequestParams = `ekm_connection.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EkmConnection() + ); + client.innerApiCalls.updateEkmConnection = stubSimpleCall(expectedResponse); + const [response] = await client.updateEkmConnection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateEkmConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEkmConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEkmConnection without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateEkmConnectionRequest() + ); + request.ekmConnection ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateEkmConnectionRequest', ['ekmConnection', 'name']); + request.ekmConnection.name = defaultValue1; + const expectedHeaderRequestParams = `ekm_connection.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EkmConnection() + ); + client.innerApiCalls.updateEkmConnection = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateEkmConnection( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IEkmConnection|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateEkmConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEkmConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEkmConnection with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateEkmConnectionRequest() + ); + request.ekmConnection ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateEkmConnectionRequest', ['ekmConnection', 'name']); + request.ekmConnection.name = defaultValue1; + const expectedHeaderRequestParams = `ekm_connection.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEkmConnection = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateEkmConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.updateEkmConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEkmConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEkmConnection with closed client', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateEkmConnectionRequest() + ); + request.ekmConnection ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateEkmConnectionRequest', ['ekmConnection', 'name']); + request.ekmConnection.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateEkmConnection(request), expectedError); + }); + }); + + describe('getEkmConfig', () => { + it('invokes getEkmConfig without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetEkmConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetEkmConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EkmConfig() + ); + client.innerApiCalls.getEkmConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getEkmConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getEkmConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEkmConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEkmConfig without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetEkmConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetEkmConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EkmConfig() + ); + client.innerApiCalls.getEkmConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEkmConfig( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IEkmConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getEkmConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEkmConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEkmConfig with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetEkmConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetEkmConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEkmConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEkmConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.getEkmConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEkmConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEkmConfig with closed client', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetEkmConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetEkmConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getEkmConfig(request), expectedError); + }); + }); + + describe('updateEkmConfig', () => { + it('invokes updateEkmConfig without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateEkmConfigRequest() + ); + request.ekmConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateEkmConfigRequest', ['ekmConfig', 'name']); + request.ekmConfig.name = defaultValue1; + const expectedHeaderRequestParams = `ekm_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EkmConfig() + ); + client.innerApiCalls.updateEkmConfig = stubSimpleCall(expectedResponse); + const [response] = await client.updateEkmConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateEkmConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEkmConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEkmConfig without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateEkmConfigRequest() + ); + request.ekmConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateEkmConfigRequest', ['ekmConfig', 'name']); + request.ekmConfig.name = defaultValue1; + const expectedHeaderRequestParams = `ekm_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EkmConfig() + ); + client.innerApiCalls.updateEkmConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateEkmConfig( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IEkmConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateEkmConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEkmConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEkmConfig with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateEkmConfigRequest() + ); + request.ekmConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateEkmConfigRequest', ['ekmConfig', 'name']); + request.ekmConfig.name = defaultValue1; + const expectedHeaderRequestParams = `ekm_config.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEkmConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateEkmConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.updateEkmConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEkmConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEkmConfig with closed client', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateEkmConfigRequest() + ); + request.ekmConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateEkmConfigRequest', ['ekmConfig', 'name']); + request.ekmConfig.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateEkmConfig(request), expectedError); + }); + }); + + describe('verifyConnectivity', () => { + it('invokes verifyConnectivity without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.VerifyConnectivityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.VerifyConnectivityRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.VerifyConnectivityResponse() + ); + client.innerApiCalls.verifyConnectivity = stubSimpleCall(expectedResponse); + const [response] = await client.verifyConnectivity(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.verifyConnectivity as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.verifyConnectivity as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes verifyConnectivity without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.VerifyConnectivityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.VerifyConnectivityRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.VerifyConnectivityResponse() + ); + client.innerApiCalls.verifyConnectivity = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.verifyConnectivity( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IVerifyConnectivityResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.verifyConnectivity as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.verifyConnectivity as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes verifyConnectivity with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.VerifyConnectivityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.VerifyConnectivityRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.verifyConnectivity = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.verifyConnectivity(request), expectedError); + const actualRequest = (client.innerApiCalls.verifyConnectivity as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.verifyConnectivity as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes verifyConnectivity with closed client', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.VerifyConnectivityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.VerifyConnectivityRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.verifyConnectivity(request), expectedError); + }); + }); + + describe('listEkmConnections', () => { + it('invokes listEkmConnections without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListEkmConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + ]; + client.innerApiCalls.listEkmConnections = stubSimpleCall(expectedResponse); + const [response] = await client.listEkmConnections(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listEkmConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEkmConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEkmConnections without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListEkmConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + ]; + client.innerApiCalls.listEkmConnections = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEkmConnections( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IEkmConnection[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listEkmConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEkmConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEkmConnections with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListEkmConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEkmConnections = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listEkmConnections(request), expectedError); + const actualRequest = (client.innerApiCalls.listEkmConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEkmConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEkmConnectionsStream without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListEkmConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + ]; + client.descriptors.page.listEkmConnections.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listEkmConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.EkmConnection[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.EkmConnection) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listEkmConnections.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listEkmConnections, request)); + assert( + (client.descriptors.page.listEkmConnections.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listEkmConnectionsStream with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListEkmConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEkmConnections.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listEkmConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.EkmConnection[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.EkmConnection) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listEkmConnections.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listEkmConnections, request)); + assert( + (client.descriptors.page.listEkmConnections.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listEkmConnections without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListEkmConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + ]; + client.descriptors.page.listEkmConnections.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.kms.v1.IEkmConnection[] = []; + const iterable = client.listEkmConnectionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listEkmConnections.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listEkmConnections.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listEkmConnections with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListEkmConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEkmConnections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listEkmConnectionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.kms.v1.IEkmConnection[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listEkmConnections.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listEkmConnections.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('cryptoKey', () => { + const fakePath = "/rendered/path/cryptoKey"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + }; + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.cryptoKeyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('cryptoKeyPath', () => { + const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCryptoKeyName', () => { + const result = client.matchProjectFromCryptoKeyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCryptoKeyName', () => { + const result = client.matchLocationFromCryptoKeyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromCryptoKeyName', () => { + const result = client.matchKeyRingFromCryptoKeyName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromCryptoKeyName', () => { + const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('cryptoKeyVersion', () => { + const fakePath = "/rendered/path/cryptoKeyVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + crypto_key_version: "cryptoKeyVersionValue", + }; + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.cryptoKeyVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('cryptoKeyVersionPath', () => { + const result = client.cryptoKeyVersionPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCryptoKeyVersionName', () => { + const result = client.matchProjectFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCryptoKeyVersionName', () => { + const result = client.matchLocationFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromCryptoKeyVersionName', () => { + const result = client.matchKeyRingFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromCryptoKeyVersionName', () => { + const result = client.matchCryptoKeyFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyVersionFromCryptoKeyVersionName', () => { + const result = client.matchCryptoKeyVersionFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "cryptoKeyVersionValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('ekmConfig', () => { + const fakePath = "/rendered/path/ekmConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.ekmConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.ekmConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('ekmConfigPath', () => { + const result = client.ekmConfigPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.ekmConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromEkmConfigName', () => { + const result = client.matchProjectFromEkmConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.ekmConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromEkmConfigName', () => { + const result = client.matchLocationFromEkmConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.ekmConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('ekmConnection', () => { + const fakePath = "/rendered/path/ekmConnection"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + ekm_connection: "ekmConnectionValue", + }; + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.ekmConnectionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.ekmConnectionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('ekmConnectionPath', () => { + const result = client.ekmConnectionPath("projectValue", "locationValue", "ekmConnectionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.ekmConnectionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromEkmConnectionName', () => { + const result = client.matchProjectFromEkmConnectionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromEkmConnectionName', () => { + const result = client.matchLocationFromEkmConnectionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEkmConnectionFromEkmConnectionName', () => { + const result = client.matchEkmConnectionFromEkmConnectionName(fakePath); + assert.strictEqual(result, "ekmConnectionValue"); + assert((client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('importJob', () => { + const fakePath = "/rendered/path/importJob"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + import_job: "importJobValue", + }; + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.importJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.importJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('importJobPath', () => { + const result = client.importJobPath("projectValue", "locationValue", "keyRingValue", "importJobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.importJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromImportJobName', () => { + const result = client.matchProjectFromImportJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromImportJobName', () => { + const result = client.matchLocationFromImportJobName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromImportJobName', () => { + const result = client.matchKeyRingFromImportJobName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchImportJobFromImportJobName', () => { + const result = client.matchImportJobFromImportJobName(fakePath); + assert.strictEqual(result, "importJobValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('keyRing', () => { + const fakePath = "/rendered/path/keyRing"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + }; + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.keyRingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.keyRingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('keyRingPath', () => { + const result = client.keyRingPath("projectValue", "locationValue", "keyRingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.keyRingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromKeyRingName', () => { + const result = client.matchProjectFromKeyRingName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromKeyRingName', () => { + const result = client.matchLocationFromKeyRingName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromKeyRingName', () => { + const result = client.matchKeyRingFromKeyRingName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('publicKey', () => { + const fakePath = "/rendered/path/publicKey"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + crypto_key_version: "cryptoKeyVersionValue", + }; + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.publicKeyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.publicKeyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('publicKeyPath', () => { + const result = client.publicKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.publicKeyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromPublicKeyName', () => { + const result = client.matchProjectFromPublicKeyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromPublicKeyName', () => { + const result = client.matchLocationFromPublicKeyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromPublicKeyName', () => { + const result = client.matchKeyRingFromPublicKeyName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromPublicKeyName', () => { + const result = client.matchCryptoKeyFromPublicKeyName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyVersionFromPublicKeyName', () => { + const result = client.matchCryptoKeyVersionFromPublicKeyName(fakePath); + assert.strictEqual(result, "cryptoKeyVersionValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-kms/v1/test/gapic_key_management_service_v1.ts b/owl-bot-staging/google-cloud-kms/v1/test/gapic_key_management_service_v1.ts new file mode 100644 index 00000000000..512dc0fd5fe --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/v1/test/gapic_key_management_service_v1.ts @@ -0,0 +1,4622 @@ +// 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 keymanagementserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.KeyManagementServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = keymanagementserviceModule.v1.KeyManagementServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = keymanagementserviceModule.v1.KeyManagementServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = keymanagementserviceModule.v1.KeyManagementServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.keyManagementServiceStub, undefined); + await client.initialize(); + assert(client.keyManagementServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.keyManagementServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.keyManagementServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getKeyRing', () => { + it('invokes getKeyRing without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetKeyRingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetKeyRingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.KeyRing() + ); + client.innerApiCalls.getKeyRing = stubSimpleCall(expectedResponse); + const [response] = await client.getKeyRing(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getKeyRing as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getKeyRing as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getKeyRing without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetKeyRingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetKeyRingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.KeyRing() + ); + client.innerApiCalls.getKeyRing = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getKeyRing( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IKeyRing|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getKeyRing as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getKeyRing as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getKeyRing with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetKeyRingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetKeyRingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getKeyRing = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getKeyRing(request), expectedError); + const actualRequest = (client.innerApiCalls.getKeyRing as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getKeyRing as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getKeyRing with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetKeyRingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetKeyRingRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getKeyRing(request), expectedError); + }); + }); + + describe('getCryptoKey', () => { + it('invokes getCryptoKey without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetCryptoKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKey() + ); + client.innerApiCalls.getCryptoKey = stubSimpleCall(expectedResponse); + const [response] = await client.getCryptoKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCryptoKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCryptoKey without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetCryptoKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKey() + ); + client.innerApiCalls.getCryptoKey = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCryptoKey( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCryptoKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCryptoKey with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetCryptoKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getCryptoKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCryptoKey(request), expectedError); + const actualRequest = (client.innerApiCalls.getCryptoKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCryptoKey with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetCryptoKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCryptoKey(request), expectedError); + }); + }); + + describe('getCryptoKeyVersion', () => { + it('invokes getCryptoKeyVersion without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.getCryptoKeyVersion = stubSimpleCall(expectedResponse); + const [response] = await client.getCryptoKeyVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCryptoKeyVersion without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.getCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCryptoKeyVersion( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCryptoKeyVersion with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getCryptoKeyVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCryptoKeyVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCryptoKeyVersion with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCryptoKeyVersion(request), expectedError); + }); + }); + + describe('getPublicKey', () => { + it('invokes getPublicKey without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.PublicKey() + ); + client.innerApiCalls.getPublicKey = stubSimpleCall(expectedResponse); + const [response] = await client.getPublicKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPublicKey without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.PublicKey() + ); + client.innerApiCalls.getPublicKey = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getPublicKey( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IPublicKey|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPublicKey with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getPublicKey(request), expectedError); + const actualRequest = (client.innerApiCalls.getPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPublicKey with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getPublicKey(request), expectedError); + }); + }); + + describe('getImportJob', () => { + it('invokes getImportJob without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.ImportJob() + ); + client.innerApiCalls.getImportJob = stubSimpleCall(expectedResponse); + const [response] = await client.getImportJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getImportJob without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.ImportJob() + ); + client.innerApiCalls.getImportJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getImportJob( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IImportJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getImportJob with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getImportJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getImportJob(request), expectedError); + const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getImportJob with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GetImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getImportJob(request), expectedError); + }); + }); + + describe('createKeyRing', () => { + it('invokes createKeyRing without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateKeyRingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateKeyRingRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.KeyRing() + ); + client.innerApiCalls.createKeyRing = stubSimpleCall(expectedResponse); + const [response] = await client.createKeyRing(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createKeyRing as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createKeyRing as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createKeyRing without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateKeyRingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateKeyRingRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.KeyRing() + ); + client.innerApiCalls.createKeyRing = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createKeyRing( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IKeyRing|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createKeyRing as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createKeyRing as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createKeyRing with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateKeyRingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateKeyRingRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createKeyRing = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createKeyRing(request), expectedError); + const actualRequest = (client.innerApiCalls.createKeyRing as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createKeyRing as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createKeyRing with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateKeyRingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateKeyRingRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createKeyRing(request), expectedError); + }); + }); + + describe('createCryptoKey', () => { + it('invokes createCryptoKey without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKey() + ); + client.innerApiCalls.createCryptoKey = stubSimpleCall(expectedResponse); + const [response] = await client.createCryptoKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createCryptoKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCryptoKey without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKey() + ); + client.innerApiCalls.createCryptoKey = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCryptoKey( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createCryptoKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCryptoKey with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCryptoKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createCryptoKey(request), expectedError); + const actualRequest = (client.innerApiCalls.createCryptoKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCryptoKey with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createCryptoKey(request), expectedError); + }); + }); + + describe('createCryptoKeyVersion', () => { + it('invokes createCryptoKeyVersion without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.createCryptoKeyVersion = stubSimpleCall(expectedResponse); + const [response] = await client.createCryptoKeyVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCryptoKeyVersion without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.createCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCryptoKeyVersion( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCryptoKeyVersion with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCryptoKeyVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createCryptoKeyVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCryptoKeyVersion with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createCryptoKeyVersion(request), expectedError); + }); + }); + + describe('importCryptoKeyVersion', () => { + it('invokes importCryptoKeyVersion without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.importCryptoKeyVersion = stubSimpleCall(expectedResponse); + const [response] = await client.importCryptoKeyVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importCryptoKeyVersion without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.importCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importCryptoKeyVersion( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importCryptoKeyVersion with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importCryptoKeyVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.importCryptoKeyVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importCryptoKeyVersion with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.importCryptoKeyVersion(request), expectedError); + }); + }); + + describe('createImportJob', () => { + it('invokes createImportJob without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateImportJobRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.ImportJob() + ); + client.innerApiCalls.createImportJob = stubSimpleCall(expectedResponse); + const [response] = await client.createImportJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createImportJob without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateImportJobRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.ImportJob() + ); + client.innerApiCalls.createImportJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createImportJob( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IImportJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createImportJob with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateImportJobRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createImportJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createImportJob(request), expectedError); + const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createImportJob with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.CreateImportJobRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createImportJob(request), expectedError); + }); + }); + + describe('updateCryptoKey', () => { + it('invokes updateCryptoKey without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() + ); + request.cryptoKey ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyRequest', ['cryptoKey', 'name']); + request.cryptoKey.name = defaultValue1; + const expectedHeaderRequestParams = `crypto_key.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKey() + ); + client.innerApiCalls.updateCryptoKey = stubSimpleCall(expectedResponse); + const [response] = await client.updateCryptoKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCryptoKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKey without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() + ); + request.cryptoKey ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyRequest', ['cryptoKey', 'name']); + request.cryptoKey.name = defaultValue1; + const expectedHeaderRequestParams = `crypto_key.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKey() + ); + client.innerApiCalls.updateCryptoKey = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCryptoKey( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCryptoKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKey with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() + ); + request.cryptoKey ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyRequest', ['cryptoKey', 'name']); + request.cryptoKey.name = defaultValue1; + const expectedHeaderRequestParams = `crypto_key.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCryptoKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateCryptoKey(request), expectedError); + const actualRequest = (client.innerApiCalls.updateCryptoKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKey with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() + ); + request.cryptoKey ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyRequest', ['cryptoKey', 'name']); + request.cryptoKey.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateCryptoKey(request), expectedError); + }); + }); + + describe('updateCryptoKeyVersion', () => { + it('invokes updateCryptoKeyVersion without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() + ); + request.cryptoKeyVersion ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', ['cryptoKeyVersion', 'name']); + request.cryptoKeyVersion.name = defaultValue1; + const expectedHeaderRequestParams = `crypto_key_version.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.updateCryptoKeyVersion = stubSimpleCall(expectedResponse); + const [response] = await client.updateCryptoKeyVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKeyVersion without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() + ); + request.cryptoKeyVersion ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', ['cryptoKeyVersion', 'name']); + request.cryptoKeyVersion.name = defaultValue1; + const expectedHeaderRequestParams = `crypto_key_version.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.updateCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCryptoKeyVersion( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKeyVersion with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() + ); + request.cryptoKeyVersion ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', ['cryptoKeyVersion', 'name']); + request.cryptoKeyVersion.name = defaultValue1; + const expectedHeaderRequestParams = `crypto_key_version.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCryptoKeyVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateCryptoKeyVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKeyVersion with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() + ); + request.cryptoKeyVersion ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', ['cryptoKeyVersion', 'name']); + request.cryptoKeyVersion.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateCryptoKeyVersion(request), expectedError); + }); + }); + + describe('updateCryptoKeyPrimaryVersion', () => { + it('invokes updateCryptoKeyPrimaryVersion without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKey() + ); + client.innerApiCalls.updateCryptoKeyPrimaryVersion = stubSimpleCall(expectedResponse); + const [response] = await client.updateCryptoKeyPrimaryVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKeyPrimaryVersion without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKey() + ); + client.innerApiCalls.updateCryptoKeyPrimaryVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCryptoKeyPrimaryVersion( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKeyPrimaryVersion with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCryptoKeyPrimaryVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateCryptoKeyPrimaryVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKeyPrimaryVersion with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateCryptoKeyPrimaryVersion(request), expectedError); + }); + }); + + describe('destroyCryptoKeyVersion', () => { + it('invokes destroyCryptoKeyVersion without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.destroyCryptoKeyVersion = stubSimpleCall(expectedResponse); + const [response] = await client.destroyCryptoKeyVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes destroyCryptoKeyVersion without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.destroyCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.destroyCryptoKeyVersion( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes destroyCryptoKeyVersion with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.destroyCryptoKeyVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.destroyCryptoKeyVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes destroyCryptoKeyVersion with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.destroyCryptoKeyVersion(request), expectedError); + }); + }); + + describe('restoreCryptoKeyVersion', () => { + it('invokes restoreCryptoKeyVersion without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.restoreCryptoKeyVersion = stubSimpleCall(expectedResponse); + const [response] = await client.restoreCryptoKeyVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreCryptoKeyVersion without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.restoreCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreCryptoKeyVersion( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreCryptoKeyVersion with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreCryptoKeyVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.restoreCryptoKeyVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreCryptoKeyVersion with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.restoreCryptoKeyVersion(request), expectedError); + }); + }); + + describe('encrypt', () => { + it('invokes encrypt without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.EncryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.EncryptRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EncryptResponse() + ); + client.innerApiCalls.encrypt = stubSimpleCall(expectedResponse); + const [response] = await client.encrypt(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.encrypt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.encrypt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes encrypt without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.EncryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.EncryptRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EncryptResponse() + ); + client.innerApiCalls.encrypt = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.encrypt( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IEncryptResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.encrypt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.encrypt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes encrypt with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.EncryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.EncryptRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.encrypt = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.encrypt(request), expectedError); + const actualRequest = (client.innerApiCalls.encrypt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.encrypt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes encrypt with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.EncryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.EncryptRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.encrypt(request), expectedError); + }); + }); + + describe('decrypt', () => { + it('invokes decrypt without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.DecryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.DecryptRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.DecryptResponse() + ); + client.innerApiCalls.decrypt = stubSimpleCall(expectedResponse); + const [response] = await client.decrypt(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.decrypt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.decrypt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes decrypt without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.DecryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.DecryptRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.DecryptResponse() + ); + client.innerApiCalls.decrypt = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.decrypt( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IDecryptResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.decrypt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.decrypt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes decrypt with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.DecryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.DecryptRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.decrypt = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.decrypt(request), expectedError); + const actualRequest = (client.innerApiCalls.decrypt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.decrypt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes decrypt with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.DecryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.DecryptRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.decrypt(request), expectedError); + }); + }); + + describe('rawEncrypt', () => { + it('invokes rawEncrypt without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.RawEncryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.RawEncryptRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.RawEncryptResponse() + ); + client.innerApiCalls.rawEncrypt = stubSimpleCall(expectedResponse); + const [response] = await client.rawEncrypt(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rawEncrypt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rawEncrypt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rawEncrypt without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.RawEncryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.RawEncryptRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.RawEncryptResponse() + ); + client.innerApiCalls.rawEncrypt = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rawEncrypt( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IRawEncryptResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rawEncrypt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rawEncrypt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rawEncrypt with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.RawEncryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.RawEncryptRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rawEncrypt = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.rawEncrypt(request), expectedError); + const actualRequest = (client.innerApiCalls.rawEncrypt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rawEncrypt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rawEncrypt with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.RawEncryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.RawEncryptRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.rawEncrypt(request), expectedError); + }); + }); + + describe('rawDecrypt', () => { + it('invokes rawDecrypt without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.RawDecryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.RawDecryptRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.RawDecryptResponse() + ); + client.innerApiCalls.rawDecrypt = stubSimpleCall(expectedResponse); + const [response] = await client.rawDecrypt(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rawDecrypt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rawDecrypt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rawDecrypt without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.RawDecryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.RawDecryptRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.RawDecryptResponse() + ); + client.innerApiCalls.rawDecrypt = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rawDecrypt( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IRawDecryptResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rawDecrypt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rawDecrypt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rawDecrypt with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.RawDecryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.RawDecryptRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rawDecrypt = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.rawDecrypt(request), expectedError); + const actualRequest = (client.innerApiCalls.rawDecrypt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rawDecrypt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rawDecrypt with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.RawDecryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.RawDecryptRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.rawDecrypt(request), expectedError); + }); + }); + + describe('asymmetricSign', () => { + it('invokes asymmetricSign without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricSignRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricSignRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricSignResponse() + ); + client.innerApiCalls.asymmetricSign = stubSimpleCall(expectedResponse); + const [response] = await client.asymmetricSign(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.asymmetricSign as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.asymmetricSign as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes asymmetricSign without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricSignRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricSignRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricSignResponse() + ); + client.innerApiCalls.asymmetricSign = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.asymmetricSign( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IAsymmetricSignResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.asymmetricSign as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.asymmetricSign as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes asymmetricSign with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricSignRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricSignRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.asymmetricSign = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.asymmetricSign(request), expectedError); + const actualRequest = (client.innerApiCalls.asymmetricSign as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.asymmetricSign as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes asymmetricSign with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricSignRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricSignRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.asymmetricSign(request), expectedError); + }); + }); + + describe('asymmetricDecrypt', () => { + it('invokes asymmetricDecrypt without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricDecryptRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricDecryptResponse() + ); + client.innerApiCalls.asymmetricDecrypt = stubSimpleCall(expectedResponse); + const [response] = await client.asymmetricDecrypt(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.asymmetricDecrypt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.asymmetricDecrypt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes asymmetricDecrypt without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricDecryptRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricDecryptResponse() + ); + client.innerApiCalls.asymmetricDecrypt = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.asymmetricDecrypt( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IAsymmetricDecryptResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.asymmetricDecrypt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.asymmetricDecrypt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes asymmetricDecrypt with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricDecryptRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.asymmetricDecrypt = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.asymmetricDecrypt(request), expectedError); + const actualRequest = (client.innerApiCalls.asymmetricDecrypt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.asymmetricDecrypt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes asymmetricDecrypt with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricDecryptRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.asymmetricDecrypt(request), expectedError); + }); + }); + + describe('macSign', () => { + it('invokes macSign without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.MacSignRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.MacSignRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.MacSignResponse() + ); + client.innerApiCalls.macSign = stubSimpleCall(expectedResponse); + const [response] = await client.macSign(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.macSign as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.macSign as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes macSign without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.MacSignRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.MacSignRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.MacSignResponse() + ); + client.innerApiCalls.macSign = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.macSign( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IMacSignResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.macSign as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.macSign as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes macSign with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.MacSignRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.MacSignRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.macSign = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.macSign(request), expectedError); + const actualRequest = (client.innerApiCalls.macSign as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.macSign as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes macSign with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.MacSignRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.MacSignRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.macSign(request), expectedError); + }); + }); + + describe('macVerify', () => { + it('invokes macVerify without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.MacVerifyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.MacVerifyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.MacVerifyResponse() + ); + client.innerApiCalls.macVerify = stubSimpleCall(expectedResponse); + const [response] = await client.macVerify(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.macVerify as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.macVerify as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes macVerify without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.MacVerifyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.MacVerifyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.MacVerifyResponse() + ); + client.innerApiCalls.macVerify = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.macVerify( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IMacVerifyResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.macVerify as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.macVerify as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes macVerify with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.MacVerifyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.MacVerifyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.macVerify = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.macVerify(request), expectedError); + const actualRequest = (client.innerApiCalls.macVerify as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.macVerify as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes macVerify with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.MacVerifyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.MacVerifyRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.macVerify(request), expectedError); + }); + }); + + describe('generateRandomBytes', () => { + it('invokes generateRandomBytes without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GenerateRandomBytesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GenerateRandomBytesRequest', ['location']); + request.location = defaultValue1; + const expectedHeaderRequestParams = `location=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.GenerateRandomBytesResponse() + ); + client.innerApiCalls.generateRandomBytes = stubSimpleCall(expectedResponse); + const [response] = await client.generateRandomBytes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateRandomBytes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateRandomBytes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateRandomBytes without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GenerateRandomBytesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GenerateRandomBytesRequest', ['location']); + request.location = defaultValue1; + const expectedHeaderRequestParams = `location=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.GenerateRandomBytesResponse() + ); + client.innerApiCalls.generateRandomBytes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateRandomBytes( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IGenerateRandomBytesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateRandomBytes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateRandomBytes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateRandomBytes with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GenerateRandomBytesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GenerateRandomBytesRequest', ['location']); + request.location = defaultValue1; + const expectedHeaderRequestParams = `location=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateRandomBytes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateRandomBytes(request), expectedError); + const actualRequest = (client.innerApiCalls.generateRandomBytes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateRandomBytes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateRandomBytes with closed client', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GenerateRandomBytesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.GenerateRandomBytesRequest', ['location']); + request.location = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateRandomBytes(request), expectedError); + }); + }); + + describe('listKeyRings', () => { + it('invokes listKeyRings without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListKeyRingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + ]; + client.innerApiCalls.listKeyRings = stubSimpleCall(expectedResponse); + const [response] = await client.listKeyRings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listKeyRings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listKeyRings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listKeyRings without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListKeyRingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + ]; + client.innerApiCalls.listKeyRings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listKeyRings( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IKeyRing[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listKeyRings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listKeyRings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listKeyRings with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListKeyRingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listKeyRings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listKeyRings(request), expectedError); + const actualRequest = (client.innerApiCalls.listKeyRings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listKeyRings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listKeyRingsStream without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListKeyRingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + ]; + client.descriptors.page.listKeyRings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listKeyRingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.KeyRing[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.KeyRing) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listKeyRings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listKeyRings, request)); + assert( + (client.descriptors.page.listKeyRings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listKeyRingsStream with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListKeyRingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listKeyRings.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listKeyRingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.KeyRing[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.KeyRing) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listKeyRings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listKeyRings, request)); + assert( + (client.descriptors.page.listKeyRings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listKeyRings without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListKeyRingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + ]; + client.descriptors.page.listKeyRings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.kms.v1.IKeyRing[] = []; + const iterable = client.listKeyRingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listKeyRings with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListKeyRingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listKeyRings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listKeyRingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.kms.v1.IKeyRing[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listCryptoKeys', () => { + it('invokes listCryptoKeys without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + ]; + client.innerApiCalls.listCryptoKeys = stubSimpleCall(expectedResponse); + const [response] = await client.listCryptoKeys(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCryptoKeys without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + ]; + client.innerApiCalls.listCryptoKeys = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCryptoKeys( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCryptoKeys with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCryptoKeys = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCryptoKeys(request), expectedError); + const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCryptoKeysStream without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + ]; + client.descriptors.page.listCryptoKeys.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCryptoKeysStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.CryptoKey[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKey) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listCryptoKeys.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCryptoKeys, request)); + assert( + (client.descriptors.page.listCryptoKeys.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listCryptoKeysStream with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCryptoKeys.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCryptoKeysStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.CryptoKey[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKey) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCryptoKeys.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCryptoKeys, request)); + assert( + (client.descriptors.page.listCryptoKeys.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCryptoKeys without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + ]; + client.descriptors.page.listCryptoKeys.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.kms.v1.ICryptoKey[] = []; + const iterable = client.listCryptoKeysAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCryptoKeys with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCryptoKeys.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCryptoKeysAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.kms.v1.ICryptoKey[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listCryptoKeyVersions', () => { + it('invokes listCryptoKeyVersions without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), + ]; + client.innerApiCalls.listCryptoKeyVersions = stubSimpleCall(expectedResponse); + const [response] = await client.listCryptoKeyVersions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCryptoKeyVersions without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), + ]; + client.innerApiCalls.listCryptoKeyVersions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCryptoKeyVersions( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCryptoKeyVersions with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCryptoKeyVersions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCryptoKeyVersions(request), expectedError); + const actualRequest = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCryptoKeyVersionsStream without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), + ]; + client.descriptors.page.listCryptoKeyVersions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCryptoKeyVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.CryptoKeyVersion[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKeyVersion) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listCryptoKeyVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCryptoKeyVersions, request)); + assert( + (client.descriptors.page.listCryptoKeyVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listCryptoKeyVersionsStream with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCryptoKeyVersions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCryptoKeyVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.CryptoKeyVersion[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKeyVersion) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCryptoKeyVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCryptoKeyVersions, request)); + assert( + (client.descriptors.page.listCryptoKeyVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCryptoKeyVersions without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), + ]; + client.descriptors.page.listCryptoKeyVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.kms.v1.ICryptoKeyVersion[] = []; + const iterable = client.listCryptoKeyVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCryptoKeyVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listCryptoKeyVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCryptoKeyVersions with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCryptoKeyVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCryptoKeyVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.kms.v1.ICryptoKeyVersion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCryptoKeyVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listCryptoKeyVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listImportJobs', () => { + it('invokes listImportJobs without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListImportJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + ]; + client.innerApiCalls.listImportJobs = stubSimpleCall(expectedResponse); + const [response] = await client.listImportJobs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listImportJobs without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListImportJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + ]; + client.innerApiCalls.listImportJobs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listImportJobs( + request, + (err?: Error|null, result?: protos.google.cloud.kms.v1.IImportJob[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listImportJobs with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListImportJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listImportJobs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listImportJobs(request), expectedError); + const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listImportJobsStream without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListImportJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + ]; + client.descriptors.page.listImportJobs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listImportJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.ImportJob[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.ImportJob) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listImportJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listImportJobs, request)); + assert( + (client.descriptors.page.listImportJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listImportJobsStream with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListImportJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listImportJobs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listImportJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.ImportJob[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.ImportJob) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listImportJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listImportJobs, request)); + assert( + (client.descriptors.page.listImportJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listImportJobs without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListImportJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + ]; + client.descriptors.page.listImportJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.kms.v1.IImportJob[] = []; + const iterable = client.listImportJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listImportJobs with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListImportJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listImportJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listImportJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.kms.v1.IImportJob[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('cryptoKey', () => { + const fakePath = "/rendered/path/cryptoKey"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + }; + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.cryptoKeyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('cryptoKeyPath', () => { + const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCryptoKeyName', () => { + const result = client.matchProjectFromCryptoKeyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCryptoKeyName', () => { + const result = client.matchLocationFromCryptoKeyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromCryptoKeyName', () => { + const result = client.matchKeyRingFromCryptoKeyName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromCryptoKeyName', () => { + const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('cryptoKeyVersion', () => { + const fakePath = "/rendered/path/cryptoKeyVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + crypto_key_version: "cryptoKeyVersionValue", + }; + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.cryptoKeyVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('cryptoKeyVersionPath', () => { + const result = client.cryptoKeyVersionPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCryptoKeyVersionName', () => { + const result = client.matchProjectFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCryptoKeyVersionName', () => { + const result = client.matchLocationFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromCryptoKeyVersionName', () => { + const result = client.matchKeyRingFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromCryptoKeyVersionName', () => { + const result = client.matchCryptoKeyFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyVersionFromCryptoKeyVersionName', () => { + const result = client.matchCryptoKeyVersionFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, "cryptoKeyVersionValue"); + assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('ekmConfig', () => { + const fakePath = "/rendered/path/ekmConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.ekmConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.ekmConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('ekmConfigPath', () => { + const result = client.ekmConfigPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.ekmConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromEkmConfigName', () => { + const result = client.matchProjectFromEkmConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.ekmConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromEkmConfigName', () => { + const result = client.matchLocationFromEkmConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.ekmConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('ekmConnection', () => { + const fakePath = "/rendered/path/ekmConnection"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + ekm_connection: "ekmConnectionValue", + }; + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.ekmConnectionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.ekmConnectionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('ekmConnectionPath', () => { + const result = client.ekmConnectionPath("projectValue", "locationValue", "ekmConnectionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.ekmConnectionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromEkmConnectionName', () => { + const result = client.matchProjectFromEkmConnectionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromEkmConnectionName', () => { + const result = client.matchLocationFromEkmConnectionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEkmConnectionFromEkmConnectionName', () => { + const result = client.matchEkmConnectionFromEkmConnectionName(fakePath); + assert.strictEqual(result, "ekmConnectionValue"); + assert((client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('importJob', () => { + const fakePath = "/rendered/path/importJob"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + import_job: "importJobValue", + }; + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.importJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.importJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('importJobPath', () => { + const result = client.importJobPath("projectValue", "locationValue", "keyRingValue", "importJobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.importJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromImportJobName', () => { + const result = client.matchProjectFromImportJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromImportJobName', () => { + const result = client.matchLocationFromImportJobName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromImportJobName', () => { + const result = client.matchKeyRingFromImportJobName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchImportJobFromImportJobName', () => { + const result = client.matchImportJobFromImportJobName(fakePath); + assert.strictEqual(result, "importJobValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('keyRing', () => { + const fakePath = "/rendered/path/keyRing"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + }; + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.keyRingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.keyRingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('keyRingPath', () => { + const result = client.keyRingPath("projectValue", "locationValue", "keyRingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.keyRingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromKeyRingName', () => { + const result = client.matchProjectFromKeyRingName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromKeyRingName', () => { + const result = client.matchLocationFromKeyRingName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromKeyRingName', () => { + const result = client.matchKeyRingFromKeyRingName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('publicKey', () => { + const fakePath = "/rendered/path/publicKey"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + key_ring: "keyRingValue", + crypto_key: "cryptoKeyValue", + crypto_key_version: "cryptoKeyVersionValue", + }; + const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.publicKeyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.publicKeyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('publicKeyPath', () => { + const result = client.publicKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.publicKeyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromPublicKeyName', () => { + const result = client.matchProjectFromPublicKeyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromPublicKeyName', () => { + const result = client.matchLocationFromPublicKeyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyRingFromPublicKeyName', () => { + const result = client.matchKeyRingFromPublicKeyName(fakePath); + assert.strictEqual(result, "keyRingValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyFromPublicKeyName', () => { + const result = client.matchCryptoKeyFromPublicKeyName(fakePath); + assert.strictEqual(result, "cryptoKeyValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCryptoKeyVersionFromPublicKeyName', () => { + const result = client.matchCryptoKeyVersionFromPublicKeyName(fakePath); + assert.strictEqual(result, "cryptoKeyVersionValue"); + assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-kms/v1/tsconfig.json b/owl-bot-staging/google-cloud-kms/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/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-kms/v1/webpack.config.js b/owl-bot-staging/google-cloud-kms/v1/webpack.config.js new file mode 100644 index 00000000000..ea2d522ae9e --- /dev/null +++ b/owl-bot-staging/google-cloud-kms/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: 'EkmService', + filename: './ekm-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; diff --git a/owl-bot-staging/google-cloud-language/v1/.eslintignore b/owl-bot-staging/google-cloud-language/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-language/v1/.eslintrc.json b/owl-bot-staging/google-cloud-language/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-language/v1/.gitignore b/owl-bot-staging/google-cloud-language/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-language/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-language/v1/.jsdoc.js b/owl-bot-staging/google-cloud-language/v1/.jsdoc.js new file mode 100644 index 00000000000..31167957cc8 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/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/language', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-language/v1/.mocharc.js b/owl-bot-staging/google-cloud-language/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/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-language/v1/.prettierrc.js b/owl-bot-staging/google-cloud-language/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-language/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-language/v1/README.md b/owl-bot-staging/google-cloud-language/v1/README.md new file mode 100644 index 00000000000..7287da54696 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/README.md @@ -0,0 +1 @@ +Language: Nodejs Client diff --git a/owl-bot-staging/google-cloud-language/v1/package.json b/owl-bot-staging/google-cloud-language/v1/package.json new file mode 100644 index 00000000000..c158c05feac --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/language", + "version": "0.1.0", + "description": "Language client for Node.js", + "repository": "googleapis/nodejs-language", + "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 language", + "language", + "language service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-language/v1/protos/google/cloud/language/v1/language_service.proto b/owl-bot-staging/google-cloud-language/v1/protos/google/cloud/language/v1/language_service.proto new file mode 100644 index 00000000000..d34240827c3 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/protos/google/cloud/language/v1/language_service.proto @@ -0,0 +1,1211 @@ +// 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 +// +// 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.language.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; + +option go_package = "cloud.google.com/go/language/apiv1/languagepb;languagepb"; +option java_multiple_files = true; +option java_outer_classname = "LanguageServiceProto"; +option java_package = "com.google.cloud.language.v1"; + +// Provides text analysis operations such as sentiment analysis and entity +// recognition. +service LanguageService { + option (google.api.default_host) = "language.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-language," + "https://www.googleapis.com/auth/cloud-platform"; + + // Analyzes the sentiment of the provided text. + rpc AnalyzeSentiment(AnalyzeSentimentRequest) + returns (AnalyzeSentimentResponse) { + option (google.api.http) = { + post: "/v1/documents:analyzeSentiment" + body: "*" + }; + option (google.api.method_signature) = "document,encoding_type"; + option (google.api.method_signature) = "document"; + } + + // Finds named entities (currently proper names and common nouns) in the text + // along with entity types, salience, mentions for each entity, and + // other properties. + rpc AnalyzeEntities(AnalyzeEntitiesRequest) + returns (AnalyzeEntitiesResponse) { + option (google.api.http) = { + post: "/v1/documents:analyzeEntities" + body: "*" + }; + option (google.api.method_signature) = "document,encoding_type"; + option (google.api.method_signature) = "document"; + } + + // Finds entities, similar to + // [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] + // in the text and analyzes sentiment associated with each entity and its + // mentions. + rpc AnalyzeEntitySentiment(AnalyzeEntitySentimentRequest) + returns (AnalyzeEntitySentimentResponse) { + option (google.api.http) = { + post: "/v1/documents:analyzeEntitySentiment" + body: "*" + }; + option (google.api.method_signature) = "document,encoding_type"; + option (google.api.method_signature) = "document"; + } + + // Analyzes the syntax of the text and provides sentence boundaries and + // tokenization along with part of speech tags, dependency trees, and other + // properties. + rpc AnalyzeSyntax(AnalyzeSyntaxRequest) returns (AnalyzeSyntaxResponse) { + option (google.api.http) = { + post: "/v1/documents:analyzeSyntax" + body: "*" + }; + option (google.api.method_signature) = "document,encoding_type"; + option (google.api.method_signature) = "document"; + } + + // Classifies a document into categories. + rpc ClassifyText(ClassifyTextRequest) returns (ClassifyTextResponse) { + option (google.api.http) = { + post: "/v1/documents:classifyText" + body: "*" + }; + option (google.api.method_signature) = "document"; + } + + // Moderates a document for harmful and sensitive categories. + rpc ModerateText(ModerateTextRequest) returns (ModerateTextResponse) { + option (google.api.http) = { + post: "/v1/documents:moderateText" + body: "*" + }; + option (google.api.method_signature) = "document"; + } + + // A convenience method that provides all the features that analyzeSentiment, + // analyzeEntities, and analyzeSyntax provide in one call. + rpc AnnotateText(AnnotateTextRequest) returns (AnnotateTextResponse) { + option (google.api.http) = { + post: "/v1/documents:annotateText" + body: "*" + }; + option (google.api.method_signature) = "document,features,encoding_type"; + option (google.api.method_signature) = "document,features"; + } +} + +// Represents the input to API methods. +message Document { + // The document types enum. + enum Type { + // The content type is not specified. + TYPE_UNSPECIFIED = 0; + + // Plain text + PLAIN_TEXT = 1; + + // HTML + HTML = 2; + } + + // Required. If the type is not set or is `TYPE_UNSPECIFIED`, + // returns an `INVALID_ARGUMENT` error. + Type type = 1; + + // The source of the document: a string containing the content or a + // Google Cloud Storage URI. + oneof source { + // The content of the input in string format. + // Cloud audit logging exempt since it is based on user data. + string content = 2; + + // The Google Cloud Storage URI where the file content is located. + // This URI must be of the form: gs://bucket_name/object_name. For more + // details, see https://cloud.google.com/storage/docs/reference-uris. + // NOTE: Cloud Storage object versioning is not supported. + string gcs_content_uri = 3; + } + + // The language of the document (if not specified, the language is + // automatically detected). Both ISO and BCP-47 language codes are + // accepted.
+ // [Language + // Support](https://cloud.google.com/natural-language/docs/languages) lists + // currently supported languages for each API method. If the language (either + // specified by the caller or automatically detected) is not supported by the + // called API method, an `INVALID_ARGUMENT` error is returned. + string language = 4; +} + +// Represents a sentence in the input document. +message Sentence { + // The sentence text. + TextSpan text = 1; + + // For calls to [AnalyzeSentiment][] or if + // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment] + // is set to true, this field will contain the sentiment for the sentence. + Sentiment sentiment = 2; +} + +// Represents the text encoding that the caller uses to process the output. +// Providing an `EncodingType` is recommended because the API provides the +// beginning offsets for various outputs, such as tokens and mentions, and +// languages that natively use different text encodings may access offsets +// differently. +enum EncodingType { + // If `EncodingType` is not specified, encoding-dependent information (such as + // `begin_offset`) will be set at `-1`. + NONE = 0; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-8 encoding of the input. C++ and Go are examples of languages + // that use this encoding natively. + UTF8 = 1; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-16 encoding of the input. Java and JavaScript are examples of + // languages that use this encoding natively. + UTF16 = 2; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-32 encoding of the input. Python is an example of a language + // that uses this encoding natively. + UTF32 = 3; +} + +// Represents a phrase in the text that is a known entity, such as +// a person, an organization, or location. The API associates information, such +// as salience and mentions, with entities. +message Entity { + // The type of the entity. For most entity types, the associated metadata is a + // Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table + // below lists the associated fields for entities that have different + // metadata. + enum Type { + // Unknown + UNKNOWN = 0; + + // Person + PERSON = 1; + + // Location + LOCATION = 2; + + // Organization + ORGANIZATION = 3; + + // Event + EVENT = 4; + + // Artwork + WORK_OF_ART = 5; + + // Consumer product + CONSUMER_GOOD = 6; + + // Other types of entities + OTHER = 7; + + // Phone number + // + // The metadata lists the phone number, formatted according to local + // convention, plus whichever additional elements appear in the text: + // + // * `number` - the actual number, broken down into sections as per local + // convention + // * `national_prefix` - country code, if detected + // * `area_code` - region or area code, if detected + // * `extension` - phone extension (to be dialed after connection), if + // detected + PHONE_NUMBER = 9; + + // Address + // + // The metadata identifies the street number and locality plus whichever + // additional elements appear in the text: + // + // * `street_number` - street number + // * `locality` - city or town + // * `street_name` - street/route name, if detected + // * `postal_code` - postal code, if detected + // * `country` - country, if detected< + // * `broad_region` - administrative area, such as the state, if detected + // * `narrow_region` - smaller administrative area, such as county, if + // detected + // * `sublocality` - used in Asian addresses to demark a district within a + // city, if detected + ADDRESS = 10; + + // Date + // + // The metadata identifies the components of the date: + // + // * `year` - four digit year, if detected + // * `month` - two digit month number, if detected + // * `day` - two digit day number, if detected + DATE = 11; + + // Number + // + // The metadata is the number itself. + NUMBER = 12; + + // Price + // + // The metadata identifies the `value` and `currency`. + PRICE = 13; + } + + // The representative name for the entity. + string name = 1; + + // The entity type. + Type type = 2; + + // Metadata associated with the entity. + // + // For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) + // and Knowledge Graph MID (`mid`), if they are available. For the metadata + // associated with other entity types, see the Type table below. + map metadata = 3; + + // The salience score associated with the entity in the [0, 1.0] range. + // + // The salience score for an entity provides information about the + // importance or centrality of that entity to the entire document text. + // Scores closer to 0 are less salient, while scores closer to 1.0 are highly + // salient. + float salience = 4; + + // The mentions of this entity in the input document. The API currently + // supports proper noun mentions. + repeated EntityMention mentions = 5; + + // For calls to [AnalyzeEntitySentiment][] or if + // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] + // is set to true, this field will contain the aggregate sentiment expressed + // for this entity in the provided document. + Sentiment sentiment = 6; +} + +// Represents the smallest syntactic building block of the text. +message Token { + // The token text. + TextSpan text = 1; + + // Parts of speech tag for this token. + PartOfSpeech part_of_speech = 2; + + // Dependency tree parse for this token. + DependencyEdge dependency_edge = 3; + + // [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. + string lemma = 4; +} + +// Represents the feeling associated with the entire text or entities in +// the text. +message Sentiment { + // A non-negative number in the [0, +inf) range, which represents + // the absolute magnitude of sentiment regardless of score (positive or + // negative). + float magnitude = 2; + + // Sentiment score between -1.0 (negative sentiment) and 1.0 + // (positive sentiment). + float score = 3; +} + +// Represents part of speech information for a token. Parts of speech +// are as defined in +// http://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf +message PartOfSpeech { + // The part of speech tags enum. + enum Tag { + // Unknown + UNKNOWN = 0; + + // Adjective + ADJ = 1; + + // Adposition (preposition and postposition) + ADP = 2; + + // Adverb + ADV = 3; + + // Conjunction + CONJ = 4; + + // Determiner + DET = 5; + + // Noun (common and proper) + NOUN = 6; + + // Cardinal number + NUM = 7; + + // Pronoun + PRON = 8; + + // Particle or other function word + PRT = 9; + + // Punctuation + PUNCT = 10; + + // Verb (all tenses and modes) + VERB = 11; + + // Other: foreign words, typos, abbreviations + X = 12; + + // Affix + AFFIX = 13; + } + + // The characteristic of a verb that expresses time flow during an event. + enum Aspect { + // Aspect is not applicable in the analyzed language or is not predicted. + ASPECT_UNKNOWN = 0; + + // Perfective + PERFECTIVE = 1; + + // Imperfective + IMPERFECTIVE = 2; + + // Progressive + PROGRESSIVE = 3; + } + + // The grammatical function performed by a noun or pronoun in a phrase, + // clause, or sentence. In some languages, other parts of speech, such as + // adjective and determiner, take case inflection in agreement with the noun. + enum Case { + // Case is not applicable in the analyzed language or is not predicted. + CASE_UNKNOWN = 0; + + // Accusative + ACCUSATIVE = 1; + + // Adverbial + ADVERBIAL = 2; + + // Complementive + COMPLEMENTIVE = 3; + + // Dative + DATIVE = 4; + + // Genitive + GENITIVE = 5; + + // Instrumental + INSTRUMENTAL = 6; + + // Locative + LOCATIVE = 7; + + // Nominative + NOMINATIVE = 8; + + // Oblique + OBLIQUE = 9; + + // Partitive + PARTITIVE = 10; + + // Prepositional + PREPOSITIONAL = 11; + + // Reflexive + REFLEXIVE_CASE = 12; + + // Relative + RELATIVE_CASE = 13; + + // Vocative + VOCATIVE = 14; + } + + // Depending on the language, Form can be categorizing different forms of + // verbs, adjectives, adverbs, etc. For example, categorizing inflected + // endings of verbs and adjectives or distinguishing between short and long + // forms of adjectives and participles + enum Form { + // Form is not applicable in the analyzed language or is not predicted. + FORM_UNKNOWN = 0; + + // Adnomial + ADNOMIAL = 1; + + // Auxiliary + AUXILIARY = 2; + + // Complementizer + COMPLEMENTIZER = 3; + + // Final ending + FINAL_ENDING = 4; + + // Gerund + GERUND = 5; + + // Realis + REALIS = 6; + + // Irrealis + IRREALIS = 7; + + // Short form + SHORT = 8; + + // Long form + LONG = 9; + + // Order form + ORDER = 10; + + // Specific form + SPECIFIC = 11; + } + + // Gender classes of nouns reflected in the behaviour of associated words. + enum Gender { + // Gender is not applicable in the analyzed language or is not predicted. + GENDER_UNKNOWN = 0; + + // Feminine + FEMININE = 1; + + // Masculine + MASCULINE = 2; + + // Neuter + NEUTER = 3; + } + + // The grammatical feature of verbs, used for showing modality and attitude. + enum Mood { + // Mood is not applicable in the analyzed language or is not predicted. + MOOD_UNKNOWN = 0; + + // Conditional + CONDITIONAL_MOOD = 1; + + // Imperative + IMPERATIVE = 2; + + // Indicative + INDICATIVE = 3; + + // Interrogative + INTERROGATIVE = 4; + + // Jussive + JUSSIVE = 5; + + // Subjunctive + SUBJUNCTIVE = 6; + } + + // Count distinctions. + enum Number { + // Number is not applicable in the analyzed language or is not predicted. + NUMBER_UNKNOWN = 0; + + // Singular + SINGULAR = 1; + + // Plural + PLURAL = 2; + + // Dual + DUAL = 3; + } + + // The distinction between the speaker, second person, third person, etc. + enum Person { + // Person is not applicable in the analyzed language or is not predicted. + PERSON_UNKNOWN = 0; + + // First + FIRST = 1; + + // Second + SECOND = 2; + + // Third + THIRD = 3; + + // Reflexive + REFLEXIVE_PERSON = 4; + } + + // This category shows if the token is part of a proper name. + enum Proper { + // Proper is not applicable in the analyzed language or is not predicted. + PROPER_UNKNOWN = 0; + + // Proper + PROPER = 1; + + // Not proper + NOT_PROPER = 2; + } + + // Reciprocal features of a pronoun. + enum Reciprocity { + // Reciprocity is not applicable in the analyzed language or is not + // predicted. + RECIPROCITY_UNKNOWN = 0; + + // Reciprocal + RECIPROCAL = 1; + + // Non-reciprocal + NON_RECIPROCAL = 2; + } + + // Time reference. + enum Tense { + // Tense is not applicable in the analyzed language or is not predicted. + TENSE_UNKNOWN = 0; + + // Conditional + CONDITIONAL_TENSE = 1; + + // Future + FUTURE = 2; + + // Past + PAST = 3; + + // Present + PRESENT = 4; + + // Imperfect + IMPERFECT = 5; + + // Pluperfect + PLUPERFECT = 6; + } + + // The relationship between the action that a verb expresses and the + // participants identified by its arguments. + enum Voice { + // Voice is not applicable in the analyzed language or is not predicted. + VOICE_UNKNOWN = 0; + + // Active + ACTIVE = 1; + + // Causative + CAUSATIVE = 2; + + // Passive + PASSIVE = 3; + } + + // The part of speech tag. + Tag tag = 1; + + // The grammatical aspect. + Aspect aspect = 2; + + // The grammatical case. + Case case = 3; + + // The grammatical form. + Form form = 4; + + // The grammatical gender. + Gender gender = 5; + + // The grammatical mood. + Mood mood = 6; + + // The grammatical number. + Number number = 7; + + // The grammatical person. + Person person = 8; + + // The grammatical properness. + Proper proper = 9; + + // The grammatical reciprocity. + Reciprocity reciprocity = 10; + + // The grammatical tense. + Tense tense = 11; + + // The grammatical voice. + Voice voice = 12; +} + +// Represents dependency parse tree information for a token. (For more +// information on dependency labels, see +// http://www.aclweb.org/anthology/P13-2017 +message DependencyEdge { + // The parse label enum for the token. + enum Label { + // Unknown + UNKNOWN = 0; + + // Abbreviation modifier + ABBREV = 1; + + // Adjectival complement + ACOMP = 2; + + // Adverbial clause modifier + ADVCL = 3; + + // Adverbial modifier + ADVMOD = 4; + + // Adjectival modifier of an NP + AMOD = 5; + + // Appositional modifier of an NP + APPOS = 6; + + // Attribute dependent of a copular verb + ATTR = 7; + + // Auxiliary (non-main) verb + AUX = 8; + + // Passive auxiliary + AUXPASS = 9; + + // Coordinating conjunction + CC = 10; + + // Clausal complement of a verb or adjective + CCOMP = 11; + + // Conjunct + CONJ = 12; + + // Clausal subject + CSUBJ = 13; + + // Clausal passive subject + CSUBJPASS = 14; + + // Dependency (unable to determine) + DEP = 15; + + // Determiner + DET = 16; + + // Discourse + DISCOURSE = 17; + + // Direct object + DOBJ = 18; + + // Expletive + EXPL = 19; + + // Goes with (part of a word in a text not well edited) + GOESWITH = 20; + + // Indirect object + IOBJ = 21; + + // Marker (word introducing a subordinate clause) + MARK = 22; + + // Multi-word expression + MWE = 23; + + // Multi-word verbal expression + MWV = 24; + + // Negation modifier + NEG = 25; + + // Noun compound modifier + NN = 26; + + // Noun phrase used as an adverbial modifier + NPADVMOD = 27; + + // Nominal subject + NSUBJ = 28; + + // Passive nominal subject + NSUBJPASS = 29; + + // Numeric modifier of a noun + NUM = 30; + + // Element of compound number + NUMBER = 31; + + // Punctuation mark + P = 32; + + // Parataxis relation + PARATAXIS = 33; + + // Participial modifier + PARTMOD = 34; + + // The complement of a preposition is a clause + PCOMP = 35; + + // Object of a preposition + POBJ = 36; + + // Possession modifier + POSS = 37; + + // Postverbal negative particle + POSTNEG = 38; + + // Predicate complement + PRECOMP = 39; + + // Preconjunt + PRECONJ = 40; + + // Predeterminer + PREDET = 41; + + // Prefix + PREF = 42; + + // Prepositional modifier + PREP = 43; + + // The relationship between a verb and verbal morpheme + PRONL = 44; + + // Particle + PRT = 45; + + // Associative or possessive marker + PS = 46; + + // Quantifier phrase modifier + QUANTMOD = 47; + + // Relative clause modifier + RCMOD = 48; + + // Complementizer in relative clause + RCMODREL = 49; + + // Ellipsis without a preceding predicate + RDROP = 50; + + // Referent + REF = 51; + + // Remnant + REMNANT = 52; + + // Reparandum + REPARANDUM = 53; + + // Root + ROOT = 54; + + // Suffix specifying a unit of number + SNUM = 55; + + // Suffix + SUFF = 56; + + // Temporal modifier + TMOD = 57; + + // Topic marker + TOPIC = 58; + + // Clause headed by an infinite form of the verb that modifies a noun + VMOD = 59; + + // Vocative + VOCATIVE = 60; + + // Open clausal complement + XCOMP = 61; + + // Name suffix + SUFFIX = 62; + + // Name title + TITLE = 63; + + // Adverbial phrase modifier + ADVPHMOD = 64; + + // Causative auxiliary + AUXCAUS = 65; + + // Helper auxiliary + AUXVV = 66; + + // Rentaishi (Prenominal modifier) + DTMOD = 67; + + // Foreign words + FOREIGN = 68; + + // Keyword + KW = 69; + + // List for chains of comparable items + LIST = 70; + + // Nominalized clause + NOMC = 71; + + // Nominalized clausal subject + NOMCSUBJ = 72; + + // Nominalized clausal passive + NOMCSUBJPASS = 73; + + // Compound of numeric modifier + NUMC = 74; + + // Copula + COP = 75; + + // Dislocated relation (for fronted/topicalized elements) + DISLOCATED = 76; + + // Aspect marker + ASP = 77; + + // Genitive modifier + GMOD = 78; + + // Genitive object + GOBJ = 79; + + // Infinitival modifier + INFMOD = 80; + + // Measure + MES = 81; + + // Nominal complement of a noun + NCOMP = 82; + } + + // Represents the head of this token in the dependency tree. + // This is the index of the token which has an arc going to this token. + // The index is the position of the token in the array of tokens returned + // by the API method. If this token is a root token, then the + // `head_token_index` is its own index. + int32 head_token_index = 1; + + // The parse label for the token. + Label label = 2; +} + +// Represents a mention for an entity in the text. Currently, proper noun +// mentions are supported. +message EntityMention { + // The supported types of mentions. + enum Type { + // Unknown + TYPE_UNKNOWN = 0; + + // Proper name + PROPER = 1; + + // Common noun (or noun compound) + COMMON = 2; + } + + // The mention text. + TextSpan text = 1; + + // The type of the entity mention. + Type type = 2; + + // For calls to [AnalyzeEntitySentiment][] or if + // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] + // is set to true, this field will contain the sentiment expressed for this + // mention of the entity in the provided document. + Sentiment sentiment = 3; +} + +// Represents an output piece of text. +message TextSpan { + // The content of the output text. + string content = 1; + + // The API calculates the beginning offset of the content in the original + // document according to the + // [EncodingType][google.cloud.language.v1.EncodingType] specified in the API + // request. + int32 begin_offset = 2; +} + +// Represents a category returned from the text classifier. +message ClassificationCategory { + // The name of the category representing the document. + string name = 1; + + // The classifier's confidence of the category. Number represents how certain + // the classifier is that this category represents the given text. + float confidence = 2; +} + +// Model options available for classification requests. +message ClassificationModelOptions { + // Options for the V1 model. + message V1Model {} + + // Options for the V2 model. + message V2Model { + // The content categories used for classification. + enum ContentCategoriesVersion { + // If `ContentCategoriesVersion` is not specified, this option will + // default to `V1`. + CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0; + + // Legacy content categories of our initial launch in 2017. + V1 = 1; + + // Updated content categories in 2022. + V2 = 2; + } + + // The content categories used for classification. + ContentCategoriesVersion content_categories_version = 1; + } + + // If this field is not set, then the `v1_model` will be used by default. + oneof model_type { + // Setting this field will use the V1 model and V1 content categories + // version. The V1 model is a legacy model; support for this will be + // discontinued in the future. + V1Model v1_model = 1; + + // Setting this field will use the V2 model with the appropriate content + // categories version. The V2 model is a better performing model. + V2Model v2_model = 2; + } +} + +// The sentiment analysis request message. +message AnalyzeSentimentRequest { + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // The encoding type used by the API to calculate sentence offsets. + EncodingType encoding_type = 2; +} + +// The sentiment analysis response message. +message AnalyzeSentimentResponse { + // The overall sentiment of the input document. + Sentiment document_sentiment = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1.Document.language] field + // for more details. + string language = 2; + + // The sentiment for all the sentences in the document. + repeated Sentence sentences = 3; +} + +// The entity-level sentiment analysis request message. +message AnalyzeEntitySentimentRequest { + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 2; +} + +// The entity-level sentiment analysis response message. +message AnalyzeEntitySentimentResponse { + // The recognized entities in the input document with associated sentiments. + repeated Entity entities = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1.Document.language] field + // for more details. + string language = 2; +} + +// The entity analysis request message. +message AnalyzeEntitiesRequest { + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 2; +} + +// The entity analysis response message. +message AnalyzeEntitiesResponse { + // The recognized entities in the input document. + repeated Entity entities = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1.Document.language] field + // for more details. + string language = 2; +} + +// The syntax analysis request message. +message AnalyzeSyntaxRequest { + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 2; +} + +// The syntax analysis response message. +message AnalyzeSyntaxResponse { + // Sentences in the input document. + repeated Sentence sentences = 1; + + // Tokens, along with their syntactic information, in the input document. + repeated Token tokens = 2; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1.Document.language] field + // for more details. + string language = 3; +} + +// The document classification request message. +message ClassifyTextRequest { + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // Model options to use for classification. Defaults to v1 options if not + // specified. + ClassificationModelOptions classification_model_options = 3; +} + +// The document classification response message. +message ClassifyTextResponse { + // Categories representing the input document. + repeated ClassificationCategory categories = 1; +} + +// The document moderation request message. +message ModerateTextRequest { + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The document moderation response message. +message ModerateTextResponse { + // Harmful and sensitive categories representing the input document. + repeated ClassificationCategory moderation_categories = 1; +} + +// The request message for the text annotation API, which can perform multiple +// analysis types (sentiment, entities, and syntax) in one call. +message AnnotateTextRequest { + // All available features for sentiment, syntax, and semantic analysis. + // Setting each one to true will enable that specific analysis for the input. + message Features { + // Extract syntax information. + bool extract_syntax = 1; + + // Extract entities. + bool extract_entities = 2; + + // Extract document-level sentiment. + bool extract_document_sentiment = 3; + + // Extract entities and their associated sentiment. + bool extract_entity_sentiment = 4; + + // Classify the full document into categories. + bool classify_text = 6; + + // Moderate the document for harmful and sensitive categories. + bool moderate_text = 11; + + // The model options to use for classification. Defaults to v1 options + // if not specified. Only used if `classify_text` is set to true. + ClassificationModelOptions classification_model_options = 10; + } + + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The enabled features. + Features features = 2 [(google.api.field_behavior) = REQUIRED]; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 3; +} + +// The text annotations response message. +message AnnotateTextResponse { + // Sentences in the input document. Populated if the user enables + // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. + repeated Sentence sentences = 1; + + // Tokens, along with their syntactic information, in the input document. + // Populated if the user enables + // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. + repeated Token tokens = 2; + + // Entities, along with their semantic information, in the input document. + // Populated if the user enables + // [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. + repeated Entity entities = 3; + + // The overall sentiment for the document. Populated if the user enables + // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. + Sentiment document_sentiment = 4; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1.Document.language] field + // for more details. + string language = 5; + + // Categories identified in the input document. + repeated ClassificationCategory categories = 6; + + // Harmful and sensitive categories identified in the input document. + repeated ClassificationCategory moderation_categories = 7; +} diff --git a/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_entities.js b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_entities.js new file mode 100644 index 00000000000..e8a4cb64a31 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_entities.js @@ -0,0 +1,65 @@ +// 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(document) { + // [START language_v1_generated_LanguageService_AnalyzeEntities_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. Input document. + */ + // const document = {} + /** + * The encoding type used by the API to calculate offsets. + */ + // const encodingType = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v1; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callAnalyzeEntities() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await languageClient.analyzeEntities(request); + console.log(response); + } + + callAnalyzeEntities(); + // [END language_v1_generated_LanguageService_AnalyzeEntities_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-language/v1/samples/generated/v1/language_service.analyze_entity_sentiment.js b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_entity_sentiment.js new file mode 100644 index 00000000000..64f3211aaa4 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_entity_sentiment.js @@ -0,0 +1,65 @@ +// 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(document) { + // [START language_v1_generated_LanguageService_AnalyzeEntitySentiment_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. Input document. + */ + // const document = {} + /** + * The encoding type used by the API to calculate offsets. + */ + // const encodingType = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v1; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callAnalyzeEntitySentiment() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await languageClient.analyzeEntitySentiment(request); + console.log(response); + } + + callAnalyzeEntitySentiment(); + // [END language_v1_generated_LanguageService_AnalyzeEntitySentiment_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-language/v1/samples/generated/v1/language_service.analyze_sentiment.js b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_sentiment.js new file mode 100644 index 00000000000..7870a9486c5 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_sentiment.js @@ -0,0 +1,65 @@ +// 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(document) { + // [START language_v1_generated_LanguageService_AnalyzeSentiment_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. Input document. + */ + // const document = {} + /** + * The encoding type used by the API to calculate sentence offsets. + */ + // const encodingType = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v1; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callAnalyzeSentiment() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await languageClient.analyzeSentiment(request); + console.log(response); + } + + callAnalyzeSentiment(); + // [END language_v1_generated_LanguageService_AnalyzeSentiment_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-language/v1/samples/generated/v1/language_service.analyze_syntax.js b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_syntax.js new file mode 100644 index 00000000000..1a213628c7a --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_syntax.js @@ -0,0 +1,65 @@ +// 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(document) { + // [START language_v1_generated_LanguageService_AnalyzeSyntax_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. Input document. + */ + // const document = {} + /** + * The encoding type used by the API to calculate offsets. + */ + // const encodingType = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v1; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callAnalyzeSyntax() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await languageClient.analyzeSyntax(request); + console.log(response); + } + + callAnalyzeSyntax(); + // [END language_v1_generated_LanguageService_AnalyzeSyntax_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-language/v1/samples/generated/v1/language_service.annotate_text.js b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.annotate_text.js new file mode 100644 index 00000000000..3c41f6a879a --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.annotate_text.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(document, features) { + // [START language_v1_generated_LanguageService_AnnotateText_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. Input document. + */ + // const document = {} + /** + * Required. The enabled features. + */ + // const features = {} + /** + * The encoding type used by the API to calculate offsets. + */ + // const encodingType = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v1; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callAnnotateText() { + // Construct request + const request = { + document, + features, + }; + + // Run request + const response = await languageClient.annotateText(request); + console.log(response); + } + + callAnnotateText(); + // [END language_v1_generated_LanguageService_AnnotateText_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-language/v1/samples/generated/v1/language_service.classify_text.js b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.classify_text.js new file mode 100644 index 00000000000..b8191d121f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.classify_text.js @@ -0,0 +1,66 @@ +// 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(document) { + // [START language_v1_generated_LanguageService_ClassifyText_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. Input document. + */ + // const document = {} + /** + * Model options to use for classification. Defaults to v1 options if not + * specified. + */ + // const classificationModelOptions = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v1; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callClassifyText() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await languageClient.classifyText(request); + console.log(response); + } + + callClassifyText(); + // [END language_v1_generated_LanguageService_ClassifyText_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-language/v1/samples/generated/v1/language_service.moderate_text.js b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.moderate_text.js new file mode 100644 index 00000000000..271b9fe1e1f --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.moderate_text.js @@ -0,0 +1,61 @@ +// 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(document) { + // [START language_v1_generated_LanguageService_ModerateText_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. Input document. + */ + // const document = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v1; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callModerateText() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await languageClient.moderateText(request); + console.log(response); + } + + callModerateText(); + // [END language_v1_generated_LanguageService_ModerateText_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-language/v1/samples/generated/v1/snippet_metadata_google.cloud.language.v1.json b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/snippet_metadata_google.cloud.language.v1.json new file mode 100644 index 00000000000..0ac8ed666ea --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/snippet_metadata_google.cloud.language.v1.json @@ -0,0 +1,323 @@ +{ + "clientLibrary": { + "name": "nodejs-language", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.language.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "language_v1_generated_LanguageService_AnalyzeSentiment_async", + "title": "LanguageService analyzeSentiment Sample", + "origin": "API_DEFINITION", + "description": " Analyzes the sentiment of the provided text.", + "canonical": true, + "file": "language_service.analyze_sentiment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeSentiment", + "fullName": "google.cloud.language.v1.LanguageService.AnalyzeSentiment", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v1.Document" + }, + { + "name": "encoding_type", + "type": ".google.cloud.language.v1.EncodingType" + } + ], + "resultType": ".google.cloud.language.v1.AnalyzeSentimentResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v1.LanguageServiceClient" + }, + "method": { + "shortName": "AnalyzeSentiment", + "fullName": "google.cloud.language.v1.LanguageService.AnalyzeSentiment", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v1.LanguageService" + } + } + } + }, + { + "regionTag": "language_v1_generated_LanguageService_AnalyzeEntities_async", + "title": "LanguageService analyzeEntities Sample", + "origin": "API_DEFINITION", + "description": " Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties.", + "canonical": true, + "file": "language_service.analyze_entities.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeEntities", + "fullName": "google.cloud.language.v1.LanguageService.AnalyzeEntities", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v1.Document" + }, + { + "name": "encoding_type", + "type": ".google.cloud.language.v1.EncodingType" + } + ], + "resultType": ".google.cloud.language.v1.AnalyzeEntitiesResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v1.LanguageServiceClient" + }, + "method": { + "shortName": "AnalyzeEntities", + "fullName": "google.cloud.language.v1.LanguageService.AnalyzeEntities", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v1.LanguageService" + } + } + } + }, + { + "regionTag": "language_v1_generated_LanguageService_AnalyzeEntitySentiment_async", + "title": "LanguageService analyzeEntitySentiment Sample", + "origin": "API_DEFINITION", + "description": " Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes sentiment associated with each entity and its mentions.", + "canonical": true, + "file": "language_service.analyze_entity_sentiment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeEntitySentiment", + "fullName": "google.cloud.language.v1.LanguageService.AnalyzeEntitySentiment", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v1.Document" + }, + { + "name": "encoding_type", + "type": ".google.cloud.language.v1.EncodingType" + } + ], + "resultType": ".google.cloud.language.v1.AnalyzeEntitySentimentResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v1.LanguageServiceClient" + }, + "method": { + "shortName": "AnalyzeEntitySentiment", + "fullName": "google.cloud.language.v1.LanguageService.AnalyzeEntitySentiment", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v1.LanguageService" + } + } + } + }, + { + "regionTag": "language_v1_generated_LanguageService_AnalyzeSyntax_async", + "title": "LanguageService analyzeSyntax Sample", + "origin": "API_DEFINITION", + "description": " Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.", + "canonical": true, + "file": "language_service.analyze_syntax.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeSyntax", + "fullName": "google.cloud.language.v1.LanguageService.AnalyzeSyntax", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v1.Document" + }, + { + "name": "encoding_type", + "type": ".google.cloud.language.v1.EncodingType" + } + ], + "resultType": ".google.cloud.language.v1.AnalyzeSyntaxResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v1.LanguageServiceClient" + }, + "method": { + "shortName": "AnalyzeSyntax", + "fullName": "google.cloud.language.v1.LanguageService.AnalyzeSyntax", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v1.LanguageService" + } + } + } + }, + { + "regionTag": "language_v1_generated_LanguageService_ClassifyText_async", + "title": "LanguageService classifyText Sample", + "origin": "API_DEFINITION", + "description": " Classifies a document into categories.", + "canonical": true, + "file": "language_service.classify_text.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ClassifyText", + "fullName": "google.cloud.language.v1.LanguageService.ClassifyText", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v1.Document" + }, + { + "name": "classification_model_options", + "type": ".google.cloud.language.v1.ClassificationModelOptions" + } + ], + "resultType": ".google.cloud.language.v1.ClassifyTextResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v1.LanguageServiceClient" + }, + "method": { + "shortName": "ClassifyText", + "fullName": "google.cloud.language.v1.LanguageService.ClassifyText", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v1.LanguageService" + } + } + } + }, + { + "regionTag": "language_v1_generated_LanguageService_ModerateText_async", + "title": "LanguageService moderateText Sample", + "origin": "API_DEFINITION", + "description": " Moderates a document for harmful and sensitive categories.", + "canonical": true, + "file": "language_service.moderate_text.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ModerateText", + "fullName": "google.cloud.language.v1.LanguageService.ModerateText", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v1.Document" + } + ], + "resultType": ".google.cloud.language.v1.ModerateTextResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v1.LanguageServiceClient" + }, + "method": { + "shortName": "ModerateText", + "fullName": "google.cloud.language.v1.LanguageService.ModerateText", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v1.LanguageService" + } + } + } + }, + { + "regionTag": "language_v1_generated_LanguageService_AnnotateText_async", + "title": "LanguageService annotateText Sample", + "origin": "API_DEFINITION", + "description": " A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and analyzeSyntax provide in one call.", + "canonical": true, + "file": "language_service.annotate_text.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnnotateText", + "fullName": "google.cloud.language.v1.LanguageService.AnnotateText", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v1.Document" + }, + { + "name": "features", + "type": ".google.cloud.language.v1.AnnotateTextRequest.Features" + }, + { + "name": "encoding_type", + "type": ".google.cloud.language.v1.EncodingType" + } + ], + "resultType": ".google.cloud.language.v1.AnnotateTextResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v1.LanguageServiceClient" + }, + "method": { + "shortName": "AnnotateText", + "fullName": "google.cloud.language.v1.LanguageService.AnnotateText", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v1.LanguageService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-language/v1/src/index.ts b/owl-bot-staging/google-cloud-language/v1/src/index.ts new file mode 100644 index 00000000000..d518ad8805f --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/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 v1 from './v1'; +const LanguageServiceClient = v1.LanguageServiceClient; +type LanguageServiceClient = v1.LanguageServiceClient; +export {v1, LanguageServiceClient}; +export default {v1, LanguageServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-language/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-language/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..14d2569e068 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/src/v1/gapic_metadata.json @@ -0,0 +1,93 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.language.v1", + "libraryPackage": "@google-cloud/language", + "services": { + "LanguageService": { + "clients": { + "grpc": { + "libraryClient": "LanguageServiceClient", + "rpcs": { + "AnalyzeSentiment": { + "methods": [ + "analyzeSentiment" + ] + }, + "AnalyzeEntities": { + "methods": [ + "analyzeEntities" + ] + }, + "AnalyzeEntitySentiment": { + "methods": [ + "analyzeEntitySentiment" + ] + }, + "AnalyzeSyntax": { + "methods": [ + "analyzeSyntax" + ] + }, + "ClassifyText": { + "methods": [ + "classifyText" + ] + }, + "ModerateText": { + "methods": [ + "moderateText" + ] + }, + "AnnotateText": { + "methods": [ + "annotateText" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "LanguageServiceClient", + "rpcs": { + "AnalyzeSentiment": { + "methods": [ + "analyzeSentiment" + ] + }, + "AnalyzeEntities": { + "methods": [ + "analyzeEntities" + ] + }, + "AnalyzeEntitySentiment": { + "methods": [ + "analyzeEntitySentiment" + ] + }, + "AnalyzeSyntax": { + "methods": [ + "analyzeSyntax" + ] + }, + "ClassifyText": { + "methods": [ + "classifyText" + ] + }, + "ModerateText": { + "methods": [ + "moderateText" + ] + }, + "AnnotateText": { + "methods": [ + "annotateText" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-language/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-language/v1/src/v1/index.ts new file mode 100644 index 00000000000..3275c17250d --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/src/v1/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 {LanguageServiceClient} from './language_service_client'; diff --git a/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_client.ts b/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_client.ts new file mode 100644 index 00000000000..25bcaf6be1f --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_client.ts @@ -0,0 +1,786 @@ +// 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/v1/language_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './language_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Provides text analysis operations such as sentiment analysis and entity + * recognition. + * @class + * @memberof v1 + */ +export class LanguageServiceClient { + 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}; + languageServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of LanguageServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 LanguageServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof LanguageServiceClient; + 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 { + 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.language.v1.LanguageService', 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.languageServiceStub) { + return this.languageServiceStub; + } + + // Put together the "service stub" for + // google.cloud.language.v1.LanguageService. + this.languageServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.language.v1.LanguageService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.language.v1.LanguageService, + 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 languageServiceStubMethods = + ['analyzeSentiment', 'analyzeEntities', 'analyzeEntitySentiment', 'analyzeSyntax', 'classifyText', 'moderateText', 'annotateText']; + for (const methodName of languageServiceStubMethods) { + const callPromise = this.languageServiceStub.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.languageServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'language.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 'language.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-language', + '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 -- + // ------------------- +/** + * Analyzes the sentiment of the provided text. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v1.Document} request.document + * Required. Input document. + * @param {google.cloud.language.v1.EncodingType} request.encodingType + * The encoding type used by the API to calculate sentence offsets. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1.AnalyzeSentimentResponse|AnalyzeSentimentResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/language_service.analyze_sentiment.js + * region_tag:language_v1_generated_LanguageService_AnalyzeSentiment_async + */ + analyzeSentiment( + request?: protos.google.cloud.language.v1.IAnalyzeSentimentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v1.IAnalyzeSentimentResponse, + protos.google.cloud.language.v1.IAnalyzeSentimentRequest|undefined, {}|undefined + ]>; + analyzeSentiment( + request: protos.google.cloud.language.v1.IAnalyzeSentimentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v1.IAnalyzeSentimentResponse, + protos.google.cloud.language.v1.IAnalyzeSentimentRequest|null|undefined, + {}|null|undefined>): void; + analyzeSentiment( + request: protos.google.cloud.language.v1.IAnalyzeSentimentRequest, + callback: Callback< + protos.google.cloud.language.v1.IAnalyzeSentimentResponse, + protos.google.cloud.language.v1.IAnalyzeSentimentRequest|null|undefined, + {}|null|undefined>): void; + analyzeSentiment( + request?: protos.google.cloud.language.v1.IAnalyzeSentimentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v1.IAnalyzeSentimentResponse, + protos.google.cloud.language.v1.IAnalyzeSentimentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v1.IAnalyzeSentimentResponse, + protos.google.cloud.language.v1.IAnalyzeSentimentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v1.IAnalyzeSentimentResponse, + protos.google.cloud.language.v1.IAnalyzeSentimentRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.analyzeSentiment(request, options, callback); + } +/** + * Finds named entities (currently proper names and common nouns) in the text + * along with entity types, salience, mentions for each entity, and + * other properties. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v1.Document} request.document + * Required. Input document. + * @param {google.cloud.language.v1.EncodingType} request.encodingType + * The encoding type used by the API to calculate offsets. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1.AnalyzeEntitiesResponse|AnalyzeEntitiesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/language_service.analyze_entities.js + * region_tag:language_v1_generated_LanguageService_AnalyzeEntities_async + */ + analyzeEntities( + request?: protos.google.cloud.language.v1.IAnalyzeEntitiesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v1.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v1.IAnalyzeEntitiesRequest|undefined, {}|undefined + ]>; + analyzeEntities( + request: protos.google.cloud.language.v1.IAnalyzeEntitiesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v1.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v1.IAnalyzeEntitiesRequest|null|undefined, + {}|null|undefined>): void; + analyzeEntities( + request: protos.google.cloud.language.v1.IAnalyzeEntitiesRequest, + callback: Callback< + protos.google.cloud.language.v1.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v1.IAnalyzeEntitiesRequest|null|undefined, + {}|null|undefined>): void; + analyzeEntities( + request?: protos.google.cloud.language.v1.IAnalyzeEntitiesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v1.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v1.IAnalyzeEntitiesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v1.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v1.IAnalyzeEntitiesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v1.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v1.IAnalyzeEntitiesRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.analyzeEntities(request, options, callback); + } +/** + * Finds entities, similar to + * {@link protos.google.cloud.language.v1.LanguageService.AnalyzeEntities|AnalyzeEntities} + * in the text and analyzes sentiment associated with each entity and its + * mentions. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v1.Document} request.document + * Required. Input document. + * @param {google.cloud.language.v1.EncodingType} request.encodingType + * The encoding type used by the API to calculate offsets. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1.AnalyzeEntitySentimentResponse|AnalyzeEntitySentimentResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/language_service.analyze_entity_sentiment.js + * region_tag:language_v1_generated_LanguageService_AnalyzeEntitySentiment_async + */ + analyzeEntitySentiment( + request?: protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v1.IAnalyzeEntitySentimentResponse, + protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest|undefined, {}|undefined + ]>; + analyzeEntitySentiment( + request: protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v1.IAnalyzeEntitySentimentResponse, + protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest|null|undefined, + {}|null|undefined>): void; + analyzeEntitySentiment( + request: protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest, + callback: Callback< + protos.google.cloud.language.v1.IAnalyzeEntitySentimentResponse, + protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest|null|undefined, + {}|null|undefined>): void; + analyzeEntitySentiment( + request?: protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v1.IAnalyzeEntitySentimentResponse, + protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v1.IAnalyzeEntitySentimentResponse, + protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v1.IAnalyzeEntitySentimentResponse, + protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.analyzeEntitySentiment(request, options, callback); + } +/** + * Analyzes the syntax of the text and provides sentence boundaries and + * tokenization along with part of speech tags, dependency trees, and other + * properties. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v1.Document} request.document + * Required. Input document. + * @param {google.cloud.language.v1.EncodingType} request.encodingType + * The encoding type used by the API to calculate offsets. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1.AnalyzeSyntaxResponse|AnalyzeSyntaxResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/language_service.analyze_syntax.js + * region_tag:language_v1_generated_LanguageService_AnalyzeSyntax_async + */ + analyzeSyntax( + request?: protos.google.cloud.language.v1.IAnalyzeSyntaxRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v1.IAnalyzeSyntaxResponse, + protos.google.cloud.language.v1.IAnalyzeSyntaxRequest|undefined, {}|undefined + ]>; + analyzeSyntax( + request: protos.google.cloud.language.v1.IAnalyzeSyntaxRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v1.IAnalyzeSyntaxResponse, + protos.google.cloud.language.v1.IAnalyzeSyntaxRequest|null|undefined, + {}|null|undefined>): void; + analyzeSyntax( + request: protos.google.cloud.language.v1.IAnalyzeSyntaxRequest, + callback: Callback< + protos.google.cloud.language.v1.IAnalyzeSyntaxResponse, + protos.google.cloud.language.v1.IAnalyzeSyntaxRequest|null|undefined, + {}|null|undefined>): void; + analyzeSyntax( + request?: protos.google.cloud.language.v1.IAnalyzeSyntaxRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v1.IAnalyzeSyntaxResponse, + protos.google.cloud.language.v1.IAnalyzeSyntaxRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v1.IAnalyzeSyntaxResponse, + protos.google.cloud.language.v1.IAnalyzeSyntaxRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v1.IAnalyzeSyntaxResponse, + protos.google.cloud.language.v1.IAnalyzeSyntaxRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.analyzeSyntax(request, options, callback); + } +/** + * Classifies a document into categories. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v1.Document} request.document + * Required. Input document. + * @param {google.cloud.language.v1.ClassificationModelOptions} request.classificationModelOptions + * Model options to use for classification. Defaults to v1 options if not + * specified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1.ClassifyTextResponse|ClassifyTextResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/language_service.classify_text.js + * region_tag:language_v1_generated_LanguageService_ClassifyText_async + */ + classifyText( + request?: protos.google.cloud.language.v1.IClassifyTextRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v1.IClassifyTextResponse, + protos.google.cloud.language.v1.IClassifyTextRequest|undefined, {}|undefined + ]>; + classifyText( + request: protos.google.cloud.language.v1.IClassifyTextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v1.IClassifyTextResponse, + protos.google.cloud.language.v1.IClassifyTextRequest|null|undefined, + {}|null|undefined>): void; + classifyText( + request: protos.google.cloud.language.v1.IClassifyTextRequest, + callback: Callback< + protos.google.cloud.language.v1.IClassifyTextResponse, + protos.google.cloud.language.v1.IClassifyTextRequest|null|undefined, + {}|null|undefined>): void; + classifyText( + request?: protos.google.cloud.language.v1.IClassifyTextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v1.IClassifyTextResponse, + protos.google.cloud.language.v1.IClassifyTextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v1.IClassifyTextResponse, + protos.google.cloud.language.v1.IClassifyTextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v1.IClassifyTextResponse, + protos.google.cloud.language.v1.IClassifyTextRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.classifyText(request, options, callback); + } +/** + * Moderates a document for harmful and sensitive categories. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v1.Document} request.document + * Required. Input document. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1.ModerateTextResponse|ModerateTextResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/language_service.moderate_text.js + * region_tag:language_v1_generated_LanguageService_ModerateText_async + */ + moderateText( + request?: protos.google.cloud.language.v1.IModerateTextRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v1.IModerateTextResponse, + protos.google.cloud.language.v1.IModerateTextRequest|undefined, {}|undefined + ]>; + moderateText( + request: protos.google.cloud.language.v1.IModerateTextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v1.IModerateTextResponse, + protos.google.cloud.language.v1.IModerateTextRequest|null|undefined, + {}|null|undefined>): void; + moderateText( + request: protos.google.cloud.language.v1.IModerateTextRequest, + callback: Callback< + protos.google.cloud.language.v1.IModerateTextResponse, + protos.google.cloud.language.v1.IModerateTextRequest|null|undefined, + {}|null|undefined>): void; + moderateText( + request?: protos.google.cloud.language.v1.IModerateTextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v1.IModerateTextResponse, + protos.google.cloud.language.v1.IModerateTextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v1.IModerateTextResponse, + protos.google.cloud.language.v1.IModerateTextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v1.IModerateTextResponse, + protos.google.cloud.language.v1.IModerateTextRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.moderateText(request, options, callback); + } +/** + * A convenience method that provides all the features that analyzeSentiment, + * analyzeEntities, and analyzeSyntax provide in one call. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v1.Document} request.document + * Required. Input document. + * @param {google.cloud.language.v1.AnnotateTextRequest.Features} request.features + * Required. The enabled features. + * @param {google.cloud.language.v1.EncodingType} request.encodingType + * The encoding type used by the API to calculate offsets. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1.AnnotateTextResponse|AnnotateTextResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/language_service.annotate_text.js + * region_tag:language_v1_generated_LanguageService_AnnotateText_async + */ + annotateText( + request?: protos.google.cloud.language.v1.IAnnotateTextRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v1.IAnnotateTextResponse, + protos.google.cloud.language.v1.IAnnotateTextRequest|undefined, {}|undefined + ]>; + annotateText( + request: protos.google.cloud.language.v1.IAnnotateTextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v1.IAnnotateTextResponse, + protos.google.cloud.language.v1.IAnnotateTextRequest|null|undefined, + {}|null|undefined>): void; + annotateText( + request: protos.google.cloud.language.v1.IAnnotateTextRequest, + callback: Callback< + protos.google.cloud.language.v1.IAnnotateTextResponse, + protos.google.cloud.language.v1.IAnnotateTextRequest|null|undefined, + {}|null|undefined>): void; + annotateText( + request?: protos.google.cloud.language.v1.IAnnotateTextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v1.IAnnotateTextResponse, + protos.google.cloud.language.v1.IAnnotateTextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v1.IAnnotateTextResponse, + protos.google.cloud.language.v1.IAnnotateTextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v1.IAnnotateTextResponse, + protos.google.cloud.language.v1.IAnnotateTextRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.annotateText(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.languageServiceStub && !this._terminated) { + return this.languageServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_client_config.json b/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_client_config.json new file mode 100644 index 00000000000..ba23b0097e0 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_client_config.json @@ -0,0 +1,60 @@ +{ + "interfaces": { + "google.cloud.language.v1.LanguageService": { + "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": { + "AnalyzeSentiment": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "AnalyzeEntities": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "AnalyzeEntitySentiment": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "AnalyzeSyntax": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ClassifyText": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ModerateText": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AnnotateText": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_proto_list.json b/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_proto_list.json new file mode 100644 index 00000000000..0456052873e --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/language/v1/language_service.proto" +] diff --git a/owl-bot-staging/google-cloud-language/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-language/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..46600ec0cdc --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/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 language = require('@google-cloud/language'); + +function main() { + const languageServiceClient = new language.LanguageServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-language/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-language/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..e2767ca4173 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/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 {LanguageServiceClient} from '@google-cloud/language'; + +// check that the client class type name can be used +function doStuffWithLanguageServiceClient(client: LanguageServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const languageServiceClient = new LanguageServiceClient(); + doStuffWithLanguageServiceClient(languageServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-language/v1/system-test/install.ts b/owl-bot-staging/google-cloud-language/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/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-language/v1/test/gapic_language_service_v1.ts b/owl-bot-staging/google-cloud-language/v1/test/gapic_language_service_v1.ts new file mode 100644 index 00000000000..b1fb333436f --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1/test/gapic_language_service_v1.ts @@ -0,0 +1,675 @@ +// 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 languageserviceModule 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('v1.LanguageServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = languageserviceModule.v1.LanguageServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = languageserviceModule.v1.LanguageServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = languageserviceModule.v1.LanguageServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new languageserviceModule.v1.LanguageServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.languageServiceStub, undefined); + await client.initialize(); + assert(client.languageServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.languageServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.languageServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new languageserviceModule.v1.LanguageServiceClient({ + 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 languageserviceModule.v1.LanguageServiceClient({ + 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('analyzeSentiment', () => { + it('invokes analyzeSentiment without error', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeSentimentRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeSentimentResponse() + ); + client.innerApiCalls.analyzeSentiment = stubSimpleCall(expectedResponse); + const [response] = await client.analyzeSentiment(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeSentiment without error using callback', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeSentimentRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeSentimentResponse() + ); + client.innerApiCalls.analyzeSentiment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeSentiment( + request, + (err?: Error|null, result?: protos.google.cloud.language.v1.IAnalyzeSentimentResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeSentiment with error', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeSentimentRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeSentiment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.analyzeSentiment(request), expectedError); + }); + + it('invokes analyzeSentiment with closed client', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeSentimentRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeSentiment(request), expectedError); + }); + }); + + describe('analyzeEntities', () => { + it('invokes analyzeEntities without error', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeEntitiesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeEntitiesResponse() + ); + client.innerApiCalls.analyzeEntities = stubSimpleCall(expectedResponse); + const [response] = await client.analyzeEntities(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeEntities without error using callback', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeEntitiesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeEntitiesResponse() + ); + client.innerApiCalls.analyzeEntities = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeEntities( + request, + (err?: Error|null, result?: protos.google.cloud.language.v1.IAnalyzeEntitiesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeEntities with error', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeEntitiesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeEntities = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.analyzeEntities(request), expectedError); + }); + + it('invokes analyzeEntities with closed client', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeEntitiesRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeEntities(request), expectedError); + }); + }); + + describe('analyzeEntitySentiment', () => { + it('invokes analyzeEntitySentiment without error', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeEntitySentimentRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeEntitySentimentResponse() + ); + client.innerApiCalls.analyzeEntitySentiment = stubSimpleCall(expectedResponse); + const [response] = await client.analyzeEntitySentiment(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeEntitySentiment without error using callback', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeEntitySentimentRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeEntitySentimentResponse() + ); + client.innerApiCalls.analyzeEntitySentiment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeEntitySentiment( + request, + (err?: Error|null, result?: protos.google.cloud.language.v1.IAnalyzeEntitySentimentResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeEntitySentiment with error', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeEntitySentimentRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeEntitySentiment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.analyzeEntitySentiment(request), expectedError); + }); + + it('invokes analyzeEntitySentiment with closed client', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeEntitySentimentRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeEntitySentiment(request), expectedError); + }); + }); + + describe('analyzeSyntax', () => { + it('invokes analyzeSyntax without error', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeSyntaxRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeSyntaxResponse() + ); + client.innerApiCalls.analyzeSyntax = stubSimpleCall(expectedResponse); + const [response] = await client.analyzeSyntax(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeSyntax without error using callback', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeSyntaxRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeSyntaxResponse() + ); + client.innerApiCalls.analyzeSyntax = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeSyntax( + request, + (err?: Error|null, result?: protos.google.cloud.language.v1.IAnalyzeSyntaxResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeSyntax with error', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeSyntaxRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeSyntax = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.analyzeSyntax(request), expectedError); + }); + + it('invokes analyzeSyntax with closed client', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnalyzeSyntaxRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeSyntax(request), expectedError); + }); + }); + + describe('classifyText', () => { + it('invokes classifyText without error', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.ClassifyTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1.ClassifyTextResponse() + ); + client.innerApiCalls.classifyText = stubSimpleCall(expectedResponse); + const [response] = await client.classifyText(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes classifyText without error using callback', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.ClassifyTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1.ClassifyTextResponse() + ); + client.innerApiCalls.classifyText = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.classifyText( + request, + (err?: Error|null, result?: protos.google.cloud.language.v1.IClassifyTextResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes classifyText with error', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.ClassifyTextRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.classifyText = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.classifyText(request), expectedError); + }); + + it('invokes classifyText with closed client', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.ClassifyTextRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.classifyText(request), expectedError); + }); + }); + + describe('moderateText', () => { + it('invokes moderateText without error', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.ModerateTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1.ModerateTextResponse() + ); + client.innerApiCalls.moderateText = stubSimpleCall(expectedResponse); + const [response] = await client.moderateText(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes moderateText without error using callback', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.ModerateTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1.ModerateTextResponse() + ); + client.innerApiCalls.moderateText = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.moderateText( + request, + (err?: Error|null, result?: protos.google.cloud.language.v1.IModerateTextResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes moderateText with error', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.ModerateTextRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.moderateText = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.moderateText(request), expectedError); + }); + + it('invokes moderateText with closed client', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.ModerateTextRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.moderateText(request), expectedError); + }); + }); + + describe('annotateText', () => { + it('invokes annotateText without error', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnnotateTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1.AnnotateTextResponse() + ); + client.innerApiCalls.annotateText = stubSimpleCall(expectedResponse); + const [response] = await client.annotateText(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes annotateText without error using callback', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnnotateTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1.AnnotateTextResponse() + ); + client.innerApiCalls.annotateText = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.annotateText( + request, + (err?: Error|null, result?: protos.google.cloud.language.v1.IAnnotateTextResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes annotateText with error', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnnotateTextRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.annotateText = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.annotateText(request), expectedError); + }); + + it('invokes annotateText with closed client', async () => { + const client = new languageserviceModule.v1.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1.AnnotateTextRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.annotateText(request), expectedError); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-language/v1/tsconfig.json b/owl-bot-staging/google-cloud-language/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-language/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-language/v1/webpack.config.js b/owl-bot-staging/google-cloud-language/v1/webpack.config.js new file mode 100644 index 00000000000..c90df1063ed --- /dev/null +++ b/owl-bot-staging/google-cloud-language/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: 'LanguageService', + filename: './language-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-language/v1beta2/.eslintignore b/owl-bot-staging/google-cloud-language/v1beta2/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-language/v1beta2/.eslintrc.json b/owl-bot-staging/google-cloud-language/v1beta2/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-language/v1beta2/.gitignore b/owl-bot-staging/google-cloud-language/v1beta2/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/.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-language/v1beta2/.jsdoc.js b/owl-bot-staging/google-cloud-language/v1beta2/.jsdoc.js new file mode 100644 index 00000000000..31167957cc8 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/.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/language', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-language/v1beta2/.mocharc.js b/owl-bot-staging/google-cloud-language/v1beta2/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/.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-language/v1beta2/.prettierrc.js b/owl-bot-staging/google-cloud-language/v1beta2/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/.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-language/v1beta2/README.md b/owl-bot-staging/google-cloud-language/v1beta2/README.md new file mode 100644 index 00000000000..7287da54696 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/README.md @@ -0,0 +1 @@ +Language: Nodejs Client diff --git a/owl-bot-staging/google-cloud-language/v1beta2/package.json b/owl-bot-staging/google-cloud-language/v1beta2/package.json new file mode 100644 index 00000000000..c158c05feac --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/language", + "version": "0.1.0", + "description": "Language client for Node.js", + "repository": "googleapis/nodejs-language", + "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 language", + "language", + "language service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-language/v1beta2/protos/google/cloud/language/v1beta2/language_service.proto b/owl-bot-staging/google-cloud-language/v1beta2/protos/google/cloud/language/v1beta2/language_service.proto new file mode 100644 index 00000000000..95c169be080 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/protos/google/cloud/language/v1beta2/language_service.proto @@ -0,0 +1,1235 @@ +// 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 +// +// 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.language.v1beta2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; + +option go_package = "cloud.google.com/go/language/apiv1beta2/languagepb;languagepb"; +option java_multiple_files = true; +option java_outer_classname = "LanguageServiceProto"; +option java_package = "com.google.cloud.language.v1beta2"; + +// Provides text analysis operations such as sentiment analysis and entity +// recognition. +service LanguageService { + option (google.api.default_host) = "language.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-language," + "https://www.googleapis.com/auth/cloud-platform"; + + // Analyzes the sentiment of the provided text. + rpc AnalyzeSentiment(AnalyzeSentimentRequest) + returns (AnalyzeSentimentResponse) { + option (google.api.http) = { + post: "/v1beta2/documents:analyzeSentiment" + body: "*" + }; + option (google.api.method_signature) = "document,encoding_type"; + option (google.api.method_signature) = "document"; + } + + // Finds named entities (currently proper names and common nouns) in the text + // along with entity types, salience, mentions for each entity, and + // other properties. + rpc AnalyzeEntities(AnalyzeEntitiesRequest) + returns (AnalyzeEntitiesResponse) { + option (google.api.http) = { + post: "/v1beta2/documents:analyzeEntities" + body: "*" + }; + option (google.api.method_signature) = "document,encoding_type"; + option (google.api.method_signature) = "document"; + } + + // Finds entities, similar to + // [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] + // in the text and analyzes sentiment associated with each entity and its + // mentions. + rpc AnalyzeEntitySentiment(AnalyzeEntitySentimentRequest) + returns (AnalyzeEntitySentimentResponse) { + option (google.api.http) = { + post: "/v1beta2/documents:analyzeEntitySentiment" + body: "*" + }; + option (google.api.method_signature) = "document,encoding_type"; + option (google.api.method_signature) = "document"; + } + + // Analyzes the syntax of the text and provides sentence boundaries and + // tokenization along with part of speech tags, dependency trees, and other + // properties. + rpc AnalyzeSyntax(AnalyzeSyntaxRequest) returns (AnalyzeSyntaxResponse) { + option (google.api.http) = { + post: "/v1beta2/documents:analyzeSyntax" + body: "*" + }; + option (google.api.method_signature) = "document,encoding_type"; + option (google.api.method_signature) = "document"; + } + + // Classifies a document into categories. + rpc ClassifyText(ClassifyTextRequest) returns (ClassifyTextResponse) { + option (google.api.http) = { + post: "/v1beta2/documents:classifyText" + body: "*" + }; + option (google.api.method_signature) = "document"; + } + + // Moderates a document for harmful and sensitive categories. + rpc ModerateText(ModerateTextRequest) returns (ModerateTextResponse) { + option (google.api.http) = { + post: "/v1beta2/documents:moderateText" + body: "*" + }; + option (google.api.method_signature) = "document"; + } + + // A convenience method that provides all syntax, sentiment, entity, and + // classification features in one call. + rpc AnnotateText(AnnotateTextRequest) returns (AnnotateTextResponse) { + option (google.api.http) = { + post: "/v1beta2/documents:annotateText" + body: "*" + }; + option (google.api.method_signature) = "document,features,encoding_type"; + option (google.api.method_signature) = "document,features"; + } +} + +// Represents the input to API methods. +message Document { + // The document types enum. + enum Type { + // The content type is not specified. + TYPE_UNSPECIFIED = 0; + + // Plain text + PLAIN_TEXT = 1; + + // HTML + HTML = 2; + } + + // Ways of handling boilerplate detected in the document + enum BoilerplateHandling { + // The boilerplate handling is not specified. + BOILERPLATE_HANDLING_UNSPECIFIED = 0; + + // Do not analyze detected boilerplate. Reference web URI is required for + // detecting boilerplate. + SKIP_BOILERPLATE = 1; + + // Treat boilerplate the same as content. + KEEP_BOILERPLATE = 2; + } + + // Required. If the type is not set or is `TYPE_UNSPECIFIED`, + // returns an `INVALID_ARGUMENT` error. + Type type = 1; + + // The source of the document: a string containing the content or a + // Google Cloud Storage URI. + oneof source { + // The content of the input in string format. + // Cloud audit logging exempt since it is based on user data. + string content = 2; + + // The Google Cloud Storage URI where the file content is located. + // This URI must be of the form: gs://bucket_name/object_name. For more + // details, see https://cloud.google.com/storage/docs/reference-uris. + // NOTE: Cloud Storage object versioning is not supported. + string gcs_content_uri = 3; + } + + // The language of the document (if not specified, the language is + // automatically detected). Both ISO and BCP-47 language codes are + // accepted.
+ // [Language + // Support](https://cloud.google.com/natural-language/docs/languages) lists + // currently supported languages for each API method. If the language (either + // specified by the caller or automatically detected) is not supported by the + // called API method, an `INVALID_ARGUMENT` error is returned. + string language = 4; + + // The web URI where the document comes from. This URI is not used for + // fetching the content, but as a hint for analyzing the document. + string reference_web_uri = 5; + + // Indicates how detected boilerplate(e.g. advertisements, copyright + // declarations, banners) should be handled for this document. If not + // specified, boilerplate will be treated the same as content. + BoilerplateHandling boilerplate_handling = 6; +} + +// Represents a sentence in the input document. +message Sentence { + // The sentence text. + TextSpan text = 1; + + // For calls to [AnalyzeSentiment][] or if + // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment] + // is set to true, this field will contain the sentiment for the sentence. + Sentiment sentiment = 2; +} + +// Represents the text encoding that the caller uses to process the output. +// Providing an `EncodingType` is recommended because the API provides the +// beginning offsets for various outputs, such as tokens and mentions, and +// languages that natively use different text encodings may access offsets +// differently. +enum EncodingType { + // If `EncodingType` is not specified, encoding-dependent information (such as + // `begin_offset`) will be set at `-1`. + NONE = 0; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-8 encoding of the input. C++ and Go are examples of languages + // that use this encoding natively. + UTF8 = 1; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-16 encoding of the input. Java and JavaScript are examples of + // languages that use this encoding natively. + UTF16 = 2; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-32 encoding of the input. Python is an example of a language + // that uses this encoding natively. + UTF32 = 3; +} + +// Represents a phrase in the text that is a known entity, such as +// a person, an organization, or location. The API associates information, such +// as salience and mentions, with entities. +message Entity { + // The type of the entity. For most entity types, the associated metadata is a + // Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table + // below lists the associated fields for entities that have different + // metadata. + enum Type { + // Unknown + UNKNOWN = 0; + + // Person + PERSON = 1; + + // Location + LOCATION = 2; + + // Organization + ORGANIZATION = 3; + + // Event + EVENT = 4; + + // Artwork + WORK_OF_ART = 5; + + // Consumer product + CONSUMER_GOOD = 6; + + // Other types of entities + OTHER = 7; + + // Phone number + // + // The metadata lists the phone number, formatted according to local + // convention, plus whichever additional elements appear in the text: + // + // * `number` - the actual number, broken down into sections as per local + // convention + // * `national_prefix` - country code, if detected + // * `area_code` - region or area code, if detected + // * `extension` - phone extension (to be dialed after connection), if + // detected + PHONE_NUMBER = 9; + + // Address + // + // The metadata identifies the street number and locality plus whichever + // additional elements appear in the text: + // + // * `street_number` - street number + // * `locality` - city or town + // * `street_name` - street/route name, if detected + // * `postal_code` - postal code, if detected + // * `country` - country, if detected< + // * `broad_region` - administrative area, such as the state, if detected + // * `narrow_region` - smaller administrative area, such as county, if + // detected + // * `sublocality` - used in Asian addresses to demark a district within a + // city, if detected + ADDRESS = 10; + + // Date + // + // The metadata identifies the components of the date: + // + // * `year` - four digit year, if detected + // * `month` - two digit month number, if detected + // * `day` - two digit day number, if detected + DATE = 11; + + // Number + // + // The metadata is the number itself. + NUMBER = 12; + + // Price + // + // The metadata identifies the `value` and `currency`. + PRICE = 13; + } + + // The representative name for the entity. + string name = 1; + + // The entity type. + Type type = 2; + + // Metadata associated with the entity. + // + // For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) + // and Knowledge Graph MID (`mid`), if they are available. For the metadata + // associated with other entity types, see the Type table below. + map metadata = 3; + + // The salience score associated with the entity in the [0, 1.0] range. + // + // The salience score for an entity provides information about the + // importance or centrality of that entity to the entire document text. + // Scores closer to 0 are less salient, while scores closer to 1.0 are highly + // salient. + float salience = 4; + + // The mentions of this entity in the input document. The API currently + // supports proper noun mentions. + repeated EntityMention mentions = 5; + + // For calls to [AnalyzeEntitySentiment][] or if + // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] + // is set to true, this field will contain the aggregate sentiment expressed + // for this entity in the provided document. + Sentiment sentiment = 6; +} + +// Represents the smallest syntactic building block of the text. +message Token { + // The token text. + TextSpan text = 1; + + // Parts of speech tag for this token. + PartOfSpeech part_of_speech = 2; + + // Dependency tree parse for this token. + DependencyEdge dependency_edge = 3; + + // [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. + string lemma = 4; +} + +// Represents the feeling associated with the entire text or entities in +// the text. +// Next ID: 6 +message Sentiment { + // A non-negative number in the [0, +inf) range, which represents + // the absolute magnitude of sentiment regardless of score (positive or + // negative). + float magnitude = 2; + + // Sentiment score between -1.0 (negative sentiment) and 1.0 + // (positive sentiment). + float score = 3; +} + +// Represents part of speech information for a token. +message PartOfSpeech { + // The part of speech tags enum. + enum Tag { + // Unknown + UNKNOWN = 0; + + // Adjective + ADJ = 1; + + // Adposition (preposition and postposition) + ADP = 2; + + // Adverb + ADV = 3; + + // Conjunction + CONJ = 4; + + // Determiner + DET = 5; + + // Noun (common and proper) + NOUN = 6; + + // Cardinal number + NUM = 7; + + // Pronoun + PRON = 8; + + // Particle or other function word + PRT = 9; + + // Punctuation + PUNCT = 10; + + // Verb (all tenses and modes) + VERB = 11; + + // Other: foreign words, typos, abbreviations + X = 12; + + // Affix + AFFIX = 13; + } + + // The characteristic of a verb that expresses time flow during an event. + enum Aspect { + // Aspect is not applicable in the analyzed language or is not predicted. + ASPECT_UNKNOWN = 0; + + // Perfective + PERFECTIVE = 1; + + // Imperfective + IMPERFECTIVE = 2; + + // Progressive + PROGRESSIVE = 3; + } + + // The grammatical function performed by a noun or pronoun in a phrase, + // clause, or sentence. In some languages, other parts of speech, such as + // adjective and determiner, take case inflection in agreement with the noun. + enum Case { + // Case is not applicable in the analyzed language or is not predicted. + CASE_UNKNOWN = 0; + + // Accusative + ACCUSATIVE = 1; + + // Adverbial + ADVERBIAL = 2; + + // Complementive + COMPLEMENTIVE = 3; + + // Dative + DATIVE = 4; + + // Genitive + GENITIVE = 5; + + // Instrumental + INSTRUMENTAL = 6; + + // Locative + LOCATIVE = 7; + + // Nominative + NOMINATIVE = 8; + + // Oblique + OBLIQUE = 9; + + // Partitive + PARTITIVE = 10; + + // Prepositional + PREPOSITIONAL = 11; + + // Reflexive + REFLEXIVE_CASE = 12; + + // Relative + RELATIVE_CASE = 13; + + // Vocative + VOCATIVE = 14; + } + + // Depending on the language, Form can be categorizing different forms of + // verbs, adjectives, adverbs, etc. For example, categorizing inflected + // endings of verbs and adjectives or distinguishing between short and long + // forms of adjectives and participles + enum Form { + // Form is not applicable in the analyzed language or is not predicted. + FORM_UNKNOWN = 0; + + // Adnomial + ADNOMIAL = 1; + + // Auxiliary + AUXILIARY = 2; + + // Complementizer + COMPLEMENTIZER = 3; + + // Final ending + FINAL_ENDING = 4; + + // Gerund + GERUND = 5; + + // Realis + REALIS = 6; + + // Irrealis + IRREALIS = 7; + + // Short form + SHORT = 8; + + // Long form + LONG = 9; + + // Order form + ORDER = 10; + + // Specific form + SPECIFIC = 11; + } + + // Gender classes of nouns reflected in the behaviour of associated words. + enum Gender { + // Gender is not applicable in the analyzed language or is not predicted. + GENDER_UNKNOWN = 0; + + // Feminine + FEMININE = 1; + + // Masculine + MASCULINE = 2; + + // Neuter + NEUTER = 3; + } + + // The grammatical feature of verbs, used for showing modality and attitude. + enum Mood { + // Mood is not applicable in the analyzed language or is not predicted. + MOOD_UNKNOWN = 0; + + // Conditional + CONDITIONAL_MOOD = 1; + + // Imperative + IMPERATIVE = 2; + + // Indicative + INDICATIVE = 3; + + // Interrogative + INTERROGATIVE = 4; + + // Jussive + JUSSIVE = 5; + + // Subjunctive + SUBJUNCTIVE = 6; + } + + // Count distinctions. + enum Number { + // Number is not applicable in the analyzed language or is not predicted. + NUMBER_UNKNOWN = 0; + + // Singular + SINGULAR = 1; + + // Plural + PLURAL = 2; + + // Dual + DUAL = 3; + } + + // The distinction between the speaker, second person, third person, etc. + enum Person { + // Person is not applicable in the analyzed language or is not predicted. + PERSON_UNKNOWN = 0; + + // First + FIRST = 1; + + // Second + SECOND = 2; + + // Third + THIRD = 3; + + // Reflexive + REFLEXIVE_PERSON = 4; + } + + // This category shows if the token is part of a proper name. + enum Proper { + // Proper is not applicable in the analyzed language or is not predicted. + PROPER_UNKNOWN = 0; + + // Proper + PROPER = 1; + + // Not proper + NOT_PROPER = 2; + } + + // Reciprocal features of a pronoun. + enum Reciprocity { + // Reciprocity is not applicable in the analyzed language or is not + // predicted. + RECIPROCITY_UNKNOWN = 0; + + // Reciprocal + RECIPROCAL = 1; + + // Non-reciprocal + NON_RECIPROCAL = 2; + } + + // Time reference. + enum Tense { + // Tense is not applicable in the analyzed language or is not predicted. + TENSE_UNKNOWN = 0; + + // Conditional + CONDITIONAL_TENSE = 1; + + // Future + FUTURE = 2; + + // Past + PAST = 3; + + // Present + PRESENT = 4; + + // Imperfect + IMPERFECT = 5; + + // Pluperfect + PLUPERFECT = 6; + } + + // The relationship between the action that a verb expresses and the + // participants identified by its arguments. + enum Voice { + // Voice is not applicable in the analyzed language or is not predicted. + VOICE_UNKNOWN = 0; + + // Active + ACTIVE = 1; + + // Causative + CAUSATIVE = 2; + + // Passive + PASSIVE = 3; + } + + // The part of speech tag. + Tag tag = 1; + + // The grammatical aspect. + Aspect aspect = 2; + + // The grammatical case. + Case case = 3; + + // The grammatical form. + Form form = 4; + + // The grammatical gender. + Gender gender = 5; + + // The grammatical mood. + Mood mood = 6; + + // The grammatical number. + Number number = 7; + + // The grammatical person. + Person person = 8; + + // The grammatical properness. + Proper proper = 9; + + // The grammatical reciprocity. + Reciprocity reciprocity = 10; + + // The grammatical tense. + Tense tense = 11; + + // The grammatical voice. + Voice voice = 12; +} + +// Represents dependency parse tree information for a token. +message DependencyEdge { + // The parse label enum for the token. + enum Label { + // Unknown + UNKNOWN = 0; + + // Abbreviation modifier + ABBREV = 1; + + // Adjectival complement + ACOMP = 2; + + // Adverbial clause modifier + ADVCL = 3; + + // Adverbial modifier + ADVMOD = 4; + + // Adjectival modifier of an NP + AMOD = 5; + + // Appositional modifier of an NP + APPOS = 6; + + // Attribute dependent of a copular verb + ATTR = 7; + + // Auxiliary (non-main) verb + AUX = 8; + + // Passive auxiliary + AUXPASS = 9; + + // Coordinating conjunction + CC = 10; + + // Clausal complement of a verb or adjective + CCOMP = 11; + + // Conjunct + CONJ = 12; + + // Clausal subject + CSUBJ = 13; + + // Clausal passive subject + CSUBJPASS = 14; + + // Dependency (unable to determine) + DEP = 15; + + // Determiner + DET = 16; + + // Discourse + DISCOURSE = 17; + + // Direct object + DOBJ = 18; + + // Expletive + EXPL = 19; + + // Goes with (part of a word in a text not well edited) + GOESWITH = 20; + + // Indirect object + IOBJ = 21; + + // Marker (word introducing a subordinate clause) + MARK = 22; + + // Multi-word expression + MWE = 23; + + // Multi-word verbal expression + MWV = 24; + + // Negation modifier + NEG = 25; + + // Noun compound modifier + NN = 26; + + // Noun phrase used as an adverbial modifier + NPADVMOD = 27; + + // Nominal subject + NSUBJ = 28; + + // Passive nominal subject + NSUBJPASS = 29; + + // Numeric modifier of a noun + NUM = 30; + + // Element of compound number + NUMBER = 31; + + // Punctuation mark + P = 32; + + // Parataxis relation + PARATAXIS = 33; + + // Participial modifier + PARTMOD = 34; + + // The complement of a preposition is a clause + PCOMP = 35; + + // Object of a preposition + POBJ = 36; + + // Possession modifier + POSS = 37; + + // Postverbal negative particle + POSTNEG = 38; + + // Predicate complement + PRECOMP = 39; + + // Preconjunt + PRECONJ = 40; + + // Predeterminer + PREDET = 41; + + // Prefix + PREF = 42; + + // Prepositional modifier + PREP = 43; + + // The relationship between a verb and verbal morpheme + PRONL = 44; + + // Particle + PRT = 45; + + // Associative or possessive marker + PS = 46; + + // Quantifier phrase modifier + QUANTMOD = 47; + + // Relative clause modifier + RCMOD = 48; + + // Complementizer in relative clause + RCMODREL = 49; + + // Ellipsis without a preceding predicate + RDROP = 50; + + // Referent + REF = 51; + + // Remnant + REMNANT = 52; + + // Reparandum + REPARANDUM = 53; + + // Root + ROOT = 54; + + // Suffix specifying a unit of number + SNUM = 55; + + // Suffix + SUFF = 56; + + // Temporal modifier + TMOD = 57; + + // Topic marker + TOPIC = 58; + + // Clause headed by an infinite form of the verb that modifies a noun + VMOD = 59; + + // Vocative + VOCATIVE = 60; + + // Open clausal complement + XCOMP = 61; + + // Name suffix + SUFFIX = 62; + + // Name title + TITLE = 63; + + // Adverbial phrase modifier + ADVPHMOD = 64; + + // Causative auxiliary + AUXCAUS = 65; + + // Helper auxiliary + AUXVV = 66; + + // Rentaishi (Prenominal modifier) + DTMOD = 67; + + // Foreign words + FOREIGN = 68; + + // Keyword + KW = 69; + + // List for chains of comparable items + LIST = 70; + + // Nominalized clause + NOMC = 71; + + // Nominalized clausal subject + NOMCSUBJ = 72; + + // Nominalized clausal passive + NOMCSUBJPASS = 73; + + // Compound of numeric modifier + NUMC = 74; + + // Copula + COP = 75; + + // Dislocated relation (for fronted/topicalized elements) + DISLOCATED = 76; + + // Aspect marker + ASP = 77; + + // Genitive modifier + GMOD = 78; + + // Genitive object + GOBJ = 79; + + // Infinitival modifier + INFMOD = 80; + + // Measure + MES = 81; + + // Nominal complement of a noun + NCOMP = 82; + } + + // Represents the head of this token in the dependency tree. + // This is the index of the token which has an arc going to this token. + // The index is the position of the token in the array of tokens returned + // by the API method. If this token is a root token, then the + // `head_token_index` is its own index. + int32 head_token_index = 1; + + // The parse label for the token. + Label label = 2; +} + +// Represents a mention for an entity in the text. Currently, proper noun +// mentions are supported. +message EntityMention { + // The supported types of mentions. + enum Type { + // Unknown + TYPE_UNKNOWN = 0; + + // Proper name + PROPER = 1; + + // Common noun (or noun compound) + COMMON = 2; + } + + // The mention text. + TextSpan text = 1; + + // The type of the entity mention. + Type type = 2; + + // For calls to [AnalyzeEntitySentiment][] or if + // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] + // is set to true, this field will contain the sentiment expressed for this + // mention of the entity in the provided document. + Sentiment sentiment = 3; +} + +// Represents an output piece of text. +message TextSpan { + // The content of the output text. + string content = 1; + + // The API calculates the beginning offset of the content in the original + // document according to the + // [EncodingType][google.cloud.language.v1beta2.EncodingType] specified in the + // API request. + int32 begin_offset = 2; +} + +// Represents a category returned from the text classifier. +message ClassificationCategory { + // The name of the category representing the document. + string name = 1; + + // The classifier's confidence of the category. Number represents how certain + // the classifier is that this category represents the given text. + float confidence = 2; +} + +// Model options available for classification requests. +message ClassificationModelOptions { + // Options for the V1 model. + message V1Model {} + + // Options for the V2 model. + message V2Model { + // The content categories used for classification. + enum ContentCategoriesVersion { + // If `ContentCategoriesVersion` is not specified, this option will + // default to `V1`. + CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0; + + // Legacy content categories of our initial launch in 2017. + V1 = 1; + + // Updated content categories in 2022. + V2 = 2; + } + + // The content categories used for classification. + ContentCategoriesVersion content_categories_version = 1; + } + + // If this field is not set, then the `v1_model` will be used by default. + oneof model_type { + // Setting this field will use the V1 model and V1 content categories + // version. The V1 model is a legacy model; support for this will be + // discontinued in the future. + V1Model v1_model = 1; + + // Setting this field will use the V2 model with the appropriate content + // categories version. The V2 model is a better performing model. + V2Model v2_model = 2; + } +} + +// The sentiment analysis request message. +message AnalyzeSentimentRequest { + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // The encoding type used by the API to calculate sentence offsets for the + // sentence sentiment. + EncodingType encoding_type = 2; +} + +// The sentiment analysis response message. +message AnalyzeSentimentResponse { + // The overall sentiment of the input document. + Sentiment document_sentiment = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta2.Document.language] + // field for more details. + string language = 2; + + // The sentiment for all the sentences in the document. + repeated Sentence sentences = 3; +} + +// The entity-level sentiment analysis request message. +message AnalyzeEntitySentimentRequest { + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 2; +} + +// The entity-level sentiment analysis response message. +message AnalyzeEntitySentimentResponse { + // The recognized entities in the input document with associated sentiments. + repeated Entity entities = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta2.Document.language] + // field for more details. + string language = 2; +} + +// The entity analysis request message. +message AnalyzeEntitiesRequest { + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 2; +} + +// The entity analysis response message. +message AnalyzeEntitiesResponse { + // The recognized entities in the input document. + repeated Entity entities = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta2.Document.language] + // field for more details. + string language = 2; +} + +// The syntax analysis request message. +message AnalyzeSyntaxRequest { + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 2; +} + +// The syntax analysis response message. +message AnalyzeSyntaxResponse { + // Sentences in the input document. + repeated Sentence sentences = 1; + + // Tokens, along with their syntactic information, in the input document. + repeated Token tokens = 2; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta2.Document.language] + // field for more details. + string language = 3; +} + +// The document classification request message. +message ClassifyTextRequest { + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // Model options to use for classification. Defaults to v1 options if not + // specified. + ClassificationModelOptions classification_model_options = 3; +} + +// The document classification response message. +message ClassifyTextResponse { + // Categories representing the input document. + repeated ClassificationCategory categories = 1; +} + +// The document moderation request message. +message ModerateTextRequest { + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The document moderation response message. +message ModerateTextResponse { + // Harmful and sensitive categories representing the input document. + repeated ClassificationCategory moderation_categories = 1; +} + +// The request message for the text annotation API, which can perform multiple +// analysis types (sentiment, entities, and syntax) in one call. +message AnnotateTextRequest { + // All available features for sentiment, syntax, and semantic analysis. + // Setting each one to true will enable that specific analysis for the input. + // Next ID: 12 + message Features { + // Extract syntax information. + bool extract_syntax = 1; + + // Extract entities. + bool extract_entities = 2; + + // Extract document-level sentiment. + bool extract_document_sentiment = 3; + + // Extract entities and their associated sentiment. + bool extract_entity_sentiment = 4; + + // Classify the full document into categories. If this is true, + // the API will use the default model which classifies into a + // [predefined + // taxonomy](https://cloud.google.com/natural-language/docs/categories). + bool classify_text = 6; + + // Moderate the document for harmful and sensitive categories. + bool moderate_text = 11; + + // The model options to use for classification. Defaults to v1 options + // if not specified. Only used if `classify_text` is set to true. + ClassificationModelOptions classification_model_options = 10; + } + + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The enabled features. + Features features = 2 [(google.api.field_behavior) = REQUIRED]; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 3; +} + +// The text annotations response message. +message AnnotateTextResponse { + // Sentences in the input document. Populated if the user enables + // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax]. + repeated Sentence sentences = 1; + + // Tokens, along with their syntactic information, in the input document. + // Populated if the user enables + // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax]. + repeated Token tokens = 2; + + // Entities, along with their semantic information, in the input document. + // Populated if the user enables + // [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entities]. + repeated Entity entities = 3; + + // The overall sentiment for the document. Populated if the user enables + // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment]. + Sentiment document_sentiment = 4; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta2.Document.language] + // field for more details. + string language = 5; + + // Categories identified in the input document. + repeated ClassificationCategory categories = 6; + + // Harmful and sensitive categories identified in the input document. + repeated ClassificationCategory moderation_categories = 8; +} diff --git a/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_entities.js b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_entities.js new file mode 100644 index 00000000000..c8f261cb905 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_entities.js @@ -0,0 +1,65 @@ +// 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(document) { + // [START language_v1beta2_generated_LanguageService_AnalyzeEntities_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. Input document. + */ + // const document = {} + /** + * The encoding type used by the API to calculate offsets. + */ + // const encodingType = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v1beta2; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callAnalyzeEntities() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await languageClient.analyzeEntities(request); + console.log(response); + } + + callAnalyzeEntities(); + // [END language_v1beta2_generated_LanguageService_AnalyzeEntities_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-language/v1beta2/samples/generated/v1beta2/language_service.analyze_entity_sentiment.js b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_entity_sentiment.js new file mode 100644 index 00000000000..51a1ead03b3 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_entity_sentiment.js @@ -0,0 +1,65 @@ +// 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(document) { + // [START language_v1beta2_generated_LanguageService_AnalyzeEntitySentiment_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. Input document. + */ + // const document = {} + /** + * The encoding type used by the API to calculate offsets. + */ + // const encodingType = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v1beta2; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callAnalyzeEntitySentiment() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await languageClient.analyzeEntitySentiment(request); + console.log(response); + } + + callAnalyzeEntitySentiment(); + // [END language_v1beta2_generated_LanguageService_AnalyzeEntitySentiment_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-language/v1beta2/samples/generated/v1beta2/language_service.analyze_sentiment.js b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_sentiment.js new file mode 100644 index 00000000000..31213ead7a1 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_sentiment.js @@ -0,0 +1,66 @@ +// 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(document) { + // [START language_v1beta2_generated_LanguageService_AnalyzeSentiment_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. Input document. + */ + // const document = {} + /** + * The encoding type used by the API to calculate sentence offsets for the + * sentence sentiment. + */ + // const encodingType = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v1beta2; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callAnalyzeSentiment() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await languageClient.analyzeSentiment(request); + console.log(response); + } + + callAnalyzeSentiment(); + // [END language_v1beta2_generated_LanguageService_AnalyzeSentiment_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-language/v1beta2/samples/generated/v1beta2/language_service.analyze_syntax.js b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_syntax.js new file mode 100644 index 00000000000..b125c505102 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_syntax.js @@ -0,0 +1,65 @@ +// 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(document) { + // [START language_v1beta2_generated_LanguageService_AnalyzeSyntax_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. Input document. + */ + // const document = {} + /** + * The encoding type used by the API to calculate offsets. + */ + // const encodingType = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v1beta2; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callAnalyzeSyntax() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await languageClient.analyzeSyntax(request); + console.log(response); + } + + callAnalyzeSyntax(); + // [END language_v1beta2_generated_LanguageService_AnalyzeSyntax_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-language/v1beta2/samples/generated/v1beta2/language_service.annotate_text.js b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.annotate_text.js new file mode 100644 index 00000000000..520f7ab3106 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.annotate_text.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(document, features) { + // [START language_v1beta2_generated_LanguageService_AnnotateText_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. Input document. + */ + // const document = {} + /** + * Required. The enabled features. + */ + // const features = {} + /** + * The encoding type used by the API to calculate offsets. + */ + // const encodingType = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v1beta2; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callAnnotateText() { + // Construct request + const request = { + document, + features, + }; + + // Run request + const response = await languageClient.annotateText(request); + console.log(response); + } + + callAnnotateText(); + // [END language_v1beta2_generated_LanguageService_AnnotateText_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-language/v1beta2/samples/generated/v1beta2/language_service.classify_text.js b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.classify_text.js new file mode 100644 index 00000000000..f431d864f6c --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.classify_text.js @@ -0,0 +1,66 @@ +// 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(document) { + // [START language_v1beta2_generated_LanguageService_ClassifyText_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. Input document. + */ + // const document = {} + /** + * Model options to use for classification. Defaults to v1 options if not + * specified. + */ + // const classificationModelOptions = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v1beta2; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callClassifyText() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await languageClient.classifyText(request); + console.log(response); + } + + callClassifyText(); + // [END language_v1beta2_generated_LanguageService_ClassifyText_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-language/v1beta2/samples/generated/v1beta2/language_service.moderate_text.js b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.moderate_text.js new file mode 100644 index 00000000000..2992deaa659 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.moderate_text.js @@ -0,0 +1,61 @@ +// 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(document) { + // [START language_v1beta2_generated_LanguageService_ModerateText_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. Input document. + */ + // const document = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v1beta2; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callModerateText() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await languageClient.moderateText(request); + console.log(response); + } + + callModerateText(); + // [END language_v1beta2_generated_LanguageService_ModerateText_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-language/v1beta2/samples/generated/v1beta2/snippet_metadata_google.cloud.language.v1beta2.json b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/snippet_metadata_google.cloud.language.v1beta2.json new file mode 100644 index 00000000000..7f46630d8de --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/snippet_metadata_google.cloud.language.v1beta2.json @@ -0,0 +1,323 @@ +{ + "clientLibrary": { + "name": "nodejs-language", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.language.v1beta2", + "version": "v1beta2" + } + ] + }, + "snippets": [ + { + "regionTag": "language_v1beta2_generated_LanguageService_AnalyzeSentiment_async", + "title": "LanguageService analyzeSentiment Sample", + "origin": "API_DEFINITION", + "description": " Analyzes the sentiment of the provided text.", + "canonical": true, + "file": "language_service.analyze_sentiment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeSentiment", + "fullName": "google.cloud.language.v1beta2.LanguageService.AnalyzeSentiment", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v1beta2.Document" + }, + { + "name": "encoding_type", + "type": ".google.cloud.language.v1beta2.EncodingType" + } + ], + "resultType": ".google.cloud.language.v1beta2.AnalyzeSentimentResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v1beta2.LanguageServiceClient" + }, + "method": { + "shortName": "AnalyzeSentiment", + "fullName": "google.cloud.language.v1beta2.LanguageService.AnalyzeSentiment", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v1beta2.LanguageService" + } + } + } + }, + { + "regionTag": "language_v1beta2_generated_LanguageService_AnalyzeEntities_async", + "title": "LanguageService analyzeEntities Sample", + "origin": "API_DEFINITION", + "description": " Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties.", + "canonical": true, + "file": "language_service.analyze_entities.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeEntities", + "fullName": "google.cloud.language.v1beta2.LanguageService.AnalyzeEntities", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v1beta2.Document" + }, + { + "name": "encoding_type", + "type": ".google.cloud.language.v1beta2.EncodingType" + } + ], + "resultType": ".google.cloud.language.v1beta2.AnalyzeEntitiesResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v1beta2.LanguageServiceClient" + }, + "method": { + "shortName": "AnalyzeEntities", + "fullName": "google.cloud.language.v1beta2.LanguageService.AnalyzeEntities", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v1beta2.LanguageService" + } + } + } + }, + { + "regionTag": "language_v1beta2_generated_LanguageService_AnalyzeEntitySentiment_async", + "title": "LanguageService analyzeEntitySentiment Sample", + "origin": "API_DEFINITION", + "description": " Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text and analyzes sentiment associated with each entity and its mentions.", + "canonical": true, + "file": "language_service.analyze_entity_sentiment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeEntitySentiment", + "fullName": "google.cloud.language.v1beta2.LanguageService.AnalyzeEntitySentiment", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v1beta2.Document" + }, + { + "name": "encoding_type", + "type": ".google.cloud.language.v1beta2.EncodingType" + } + ], + "resultType": ".google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v1beta2.LanguageServiceClient" + }, + "method": { + "shortName": "AnalyzeEntitySentiment", + "fullName": "google.cloud.language.v1beta2.LanguageService.AnalyzeEntitySentiment", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v1beta2.LanguageService" + } + } + } + }, + { + "regionTag": "language_v1beta2_generated_LanguageService_AnalyzeSyntax_async", + "title": "LanguageService analyzeSyntax Sample", + "origin": "API_DEFINITION", + "description": " Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.", + "canonical": true, + "file": "language_service.analyze_syntax.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeSyntax", + "fullName": "google.cloud.language.v1beta2.LanguageService.AnalyzeSyntax", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v1beta2.Document" + }, + { + "name": "encoding_type", + "type": ".google.cloud.language.v1beta2.EncodingType" + } + ], + "resultType": ".google.cloud.language.v1beta2.AnalyzeSyntaxResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v1beta2.LanguageServiceClient" + }, + "method": { + "shortName": "AnalyzeSyntax", + "fullName": "google.cloud.language.v1beta2.LanguageService.AnalyzeSyntax", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v1beta2.LanguageService" + } + } + } + }, + { + "regionTag": "language_v1beta2_generated_LanguageService_ClassifyText_async", + "title": "LanguageService classifyText Sample", + "origin": "API_DEFINITION", + "description": " Classifies a document into categories.", + "canonical": true, + "file": "language_service.classify_text.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ClassifyText", + "fullName": "google.cloud.language.v1beta2.LanguageService.ClassifyText", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v1beta2.Document" + }, + { + "name": "classification_model_options", + "type": ".google.cloud.language.v1beta2.ClassificationModelOptions" + } + ], + "resultType": ".google.cloud.language.v1beta2.ClassifyTextResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v1beta2.LanguageServiceClient" + }, + "method": { + "shortName": "ClassifyText", + "fullName": "google.cloud.language.v1beta2.LanguageService.ClassifyText", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v1beta2.LanguageService" + } + } + } + }, + { + "regionTag": "language_v1beta2_generated_LanguageService_ModerateText_async", + "title": "LanguageService moderateText Sample", + "origin": "API_DEFINITION", + "description": " Moderates a document for harmful and sensitive categories.", + "canonical": true, + "file": "language_service.moderate_text.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ModerateText", + "fullName": "google.cloud.language.v1beta2.LanguageService.ModerateText", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v1beta2.Document" + } + ], + "resultType": ".google.cloud.language.v1beta2.ModerateTextResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v1beta2.LanguageServiceClient" + }, + "method": { + "shortName": "ModerateText", + "fullName": "google.cloud.language.v1beta2.LanguageService.ModerateText", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v1beta2.LanguageService" + } + } + } + }, + { + "regionTag": "language_v1beta2_generated_LanguageService_AnnotateText_async", + "title": "LanguageService annotateText Sample", + "origin": "API_DEFINITION", + "description": " A convenience method that provides all syntax, sentiment, entity, and classification features in one call.", + "canonical": true, + "file": "language_service.annotate_text.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnnotateText", + "fullName": "google.cloud.language.v1beta2.LanguageService.AnnotateText", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v1beta2.Document" + }, + { + "name": "features", + "type": ".google.cloud.language.v1beta2.AnnotateTextRequest.Features" + }, + { + "name": "encoding_type", + "type": ".google.cloud.language.v1beta2.EncodingType" + } + ], + "resultType": ".google.cloud.language.v1beta2.AnnotateTextResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v1beta2.LanguageServiceClient" + }, + "method": { + "shortName": "AnnotateText", + "fullName": "google.cloud.language.v1beta2.LanguageService.AnnotateText", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v1beta2.LanguageService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-language/v1beta2/src/index.ts b/owl-bot-staging/google-cloud-language/v1beta2/src/index.ts new file mode 100644 index 00000000000..0af96dc62b7 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/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 v1beta2 from './v1beta2'; +const LanguageServiceClient = v1beta2.LanguageServiceClient; +type LanguageServiceClient = v1beta2.LanguageServiceClient; +export {v1beta2, LanguageServiceClient}; +export default {v1beta2, LanguageServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/gapic_metadata.json b/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/gapic_metadata.json new file mode 100644 index 00000000000..0a44c556085 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/gapic_metadata.json @@ -0,0 +1,93 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.language.v1beta2", + "libraryPackage": "@google-cloud/language", + "services": { + "LanguageService": { + "clients": { + "grpc": { + "libraryClient": "LanguageServiceClient", + "rpcs": { + "AnalyzeSentiment": { + "methods": [ + "analyzeSentiment" + ] + }, + "AnalyzeEntities": { + "methods": [ + "analyzeEntities" + ] + }, + "AnalyzeEntitySentiment": { + "methods": [ + "analyzeEntitySentiment" + ] + }, + "AnalyzeSyntax": { + "methods": [ + "analyzeSyntax" + ] + }, + "ClassifyText": { + "methods": [ + "classifyText" + ] + }, + "ModerateText": { + "methods": [ + "moderateText" + ] + }, + "AnnotateText": { + "methods": [ + "annotateText" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "LanguageServiceClient", + "rpcs": { + "AnalyzeSentiment": { + "methods": [ + "analyzeSentiment" + ] + }, + "AnalyzeEntities": { + "methods": [ + "analyzeEntities" + ] + }, + "AnalyzeEntitySentiment": { + "methods": [ + "analyzeEntitySentiment" + ] + }, + "AnalyzeSyntax": { + "methods": [ + "analyzeSyntax" + ] + }, + "ClassifyText": { + "methods": [ + "classifyText" + ] + }, + "ModerateText": { + "methods": [ + "moderateText" + ] + }, + "AnnotateText": { + "methods": [ + "annotateText" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/index.ts b/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/index.ts new file mode 100644 index 00000000000..3275c17250d --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/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 {LanguageServiceClient} from './language_service_client'; diff --git a/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_client.ts b/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_client.ts new file mode 100644 index 00000000000..951cc2dce11 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_client.ts @@ -0,0 +1,787 @@ +// 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/v1beta2/language_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './language_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Provides text analysis operations such as sentiment analysis and entity + * recognition. + * @class + * @memberof v1beta2 + */ +export class LanguageServiceClient { + 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}; + languageServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of LanguageServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 LanguageServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof LanguageServiceClient; + 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 { + 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.language.v1beta2.LanguageService', 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.languageServiceStub) { + return this.languageServiceStub; + } + + // Put together the "service stub" for + // google.cloud.language.v1beta2.LanguageService. + this.languageServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.language.v1beta2.LanguageService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.language.v1beta2.LanguageService, + 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 languageServiceStubMethods = + ['analyzeSentiment', 'analyzeEntities', 'analyzeEntitySentiment', 'analyzeSyntax', 'classifyText', 'moderateText', 'annotateText']; + for (const methodName of languageServiceStubMethods) { + const callPromise = this.languageServiceStub.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.languageServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'language.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 'language.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-language', + '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 -- + // ------------------- +/** + * Analyzes the sentiment of the provided text. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v1beta2.Document} request.document + * Required. Input document. + * @param {google.cloud.language.v1beta2.EncodingType} request.encodingType + * The encoding type used by the API to calculate sentence offsets for the + * sentence sentiment. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1beta2.AnalyzeSentimentResponse|AnalyzeSentimentResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/language_service.analyze_sentiment.js + * region_tag:language_v1beta2_generated_LanguageService_AnalyzeSentiment_async + */ + analyzeSentiment( + request?: protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v1beta2.IAnalyzeSentimentResponse, + protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest|undefined, {}|undefined + ]>; + analyzeSentiment( + request: protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v1beta2.IAnalyzeSentimentResponse, + protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest|null|undefined, + {}|null|undefined>): void; + analyzeSentiment( + request: protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest, + callback: Callback< + protos.google.cloud.language.v1beta2.IAnalyzeSentimentResponse, + protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest|null|undefined, + {}|null|undefined>): void; + analyzeSentiment( + request?: protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v1beta2.IAnalyzeSentimentResponse, + protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v1beta2.IAnalyzeSentimentResponse, + protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v1beta2.IAnalyzeSentimentResponse, + protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.analyzeSentiment(request, options, callback); + } +/** + * Finds named entities (currently proper names and common nouns) in the text + * along with entity types, salience, mentions for each entity, and + * other properties. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v1beta2.Document} request.document + * Required. Input document. + * @param {google.cloud.language.v1beta2.EncodingType} request.encodingType + * The encoding type used by the API to calculate offsets. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1beta2.AnalyzeEntitiesResponse|AnalyzeEntitiesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/language_service.analyze_entities.js + * region_tag:language_v1beta2_generated_LanguageService_AnalyzeEntities_async + */ + analyzeEntities( + request?: protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v1beta2.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest|undefined, {}|undefined + ]>; + analyzeEntities( + request: protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v1beta2.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest|null|undefined, + {}|null|undefined>): void; + analyzeEntities( + request: protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest, + callback: Callback< + protos.google.cloud.language.v1beta2.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest|null|undefined, + {}|null|undefined>): void; + analyzeEntities( + request?: protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v1beta2.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v1beta2.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v1beta2.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.analyzeEntities(request, options, callback); + } +/** + * Finds entities, similar to + * {@link protos.google.cloud.language.v1beta2.LanguageService.AnalyzeEntities|AnalyzeEntities} + * in the text and analyzes sentiment associated with each entity and its + * mentions. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v1beta2.Document} request.document + * Required. Input document. + * @param {google.cloud.language.v1beta2.EncodingType} request.encodingType + * The encoding type used by the API to calculate offsets. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse|AnalyzeEntitySentimentResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/language_service.analyze_entity_sentiment.js + * region_tag:language_v1beta2_generated_LanguageService_AnalyzeEntitySentiment_async + */ + analyzeEntitySentiment( + request?: protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentResponse, + protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest|undefined, {}|undefined + ]>; + analyzeEntitySentiment( + request: protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentResponse, + protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest|null|undefined, + {}|null|undefined>): void; + analyzeEntitySentiment( + request: protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest, + callback: Callback< + protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentResponse, + protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest|null|undefined, + {}|null|undefined>): void; + analyzeEntitySentiment( + request?: protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentResponse, + protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentResponse, + protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentResponse, + protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.analyzeEntitySentiment(request, options, callback); + } +/** + * Analyzes the syntax of the text and provides sentence boundaries and + * tokenization along with part of speech tags, dependency trees, and other + * properties. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v1beta2.Document} request.document + * Required. Input document. + * @param {google.cloud.language.v1beta2.EncodingType} request.encodingType + * The encoding type used by the API to calculate offsets. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1beta2.AnalyzeSyntaxResponse|AnalyzeSyntaxResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/language_service.analyze_syntax.js + * region_tag:language_v1beta2_generated_LanguageService_AnalyzeSyntax_async + */ + analyzeSyntax( + request?: protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v1beta2.IAnalyzeSyntaxResponse, + protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest|undefined, {}|undefined + ]>; + analyzeSyntax( + request: protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v1beta2.IAnalyzeSyntaxResponse, + protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest|null|undefined, + {}|null|undefined>): void; + analyzeSyntax( + request: protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest, + callback: Callback< + protos.google.cloud.language.v1beta2.IAnalyzeSyntaxResponse, + protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest|null|undefined, + {}|null|undefined>): void; + analyzeSyntax( + request?: protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v1beta2.IAnalyzeSyntaxResponse, + protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v1beta2.IAnalyzeSyntaxResponse, + protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v1beta2.IAnalyzeSyntaxResponse, + protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.analyzeSyntax(request, options, callback); + } +/** + * Classifies a document into categories. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v1beta2.Document} request.document + * Required. Input document. + * @param {google.cloud.language.v1beta2.ClassificationModelOptions} request.classificationModelOptions + * Model options to use for classification. Defaults to v1 options if not + * specified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1beta2.ClassifyTextResponse|ClassifyTextResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/language_service.classify_text.js + * region_tag:language_v1beta2_generated_LanguageService_ClassifyText_async + */ + classifyText( + request?: protos.google.cloud.language.v1beta2.IClassifyTextRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v1beta2.IClassifyTextResponse, + protos.google.cloud.language.v1beta2.IClassifyTextRequest|undefined, {}|undefined + ]>; + classifyText( + request: protos.google.cloud.language.v1beta2.IClassifyTextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v1beta2.IClassifyTextResponse, + protos.google.cloud.language.v1beta2.IClassifyTextRequest|null|undefined, + {}|null|undefined>): void; + classifyText( + request: protos.google.cloud.language.v1beta2.IClassifyTextRequest, + callback: Callback< + protos.google.cloud.language.v1beta2.IClassifyTextResponse, + protos.google.cloud.language.v1beta2.IClassifyTextRequest|null|undefined, + {}|null|undefined>): void; + classifyText( + request?: protos.google.cloud.language.v1beta2.IClassifyTextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v1beta2.IClassifyTextResponse, + protos.google.cloud.language.v1beta2.IClassifyTextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v1beta2.IClassifyTextResponse, + protos.google.cloud.language.v1beta2.IClassifyTextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v1beta2.IClassifyTextResponse, + protos.google.cloud.language.v1beta2.IClassifyTextRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.classifyText(request, options, callback); + } +/** + * Moderates a document for harmful and sensitive categories. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v1beta2.Document} request.document + * Required. Input document. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1beta2.ModerateTextResponse|ModerateTextResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/language_service.moderate_text.js + * region_tag:language_v1beta2_generated_LanguageService_ModerateText_async + */ + moderateText( + request?: protos.google.cloud.language.v1beta2.IModerateTextRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v1beta2.IModerateTextResponse, + protos.google.cloud.language.v1beta2.IModerateTextRequest|undefined, {}|undefined + ]>; + moderateText( + request: protos.google.cloud.language.v1beta2.IModerateTextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v1beta2.IModerateTextResponse, + protos.google.cloud.language.v1beta2.IModerateTextRequest|null|undefined, + {}|null|undefined>): void; + moderateText( + request: protos.google.cloud.language.v1beta2.IModerateTextRequest, + callback: Callback< + protos.google.cloud.language.v1beta2.IModerateTextResponse, + protos.google.cloud.language.v1beta2.IModerateTextRequest|null|undefined, + {}|null|undefined>): void; + moderateText( + request?: protos.google.cloud.language.v1beta2.IModerateTextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v1beta2.IModerateTextResponse, + protos.google.cloud.language.v1beta2.IModerateTextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v1beta2.IModerateTextResponse, + protos.google.cloud.language.v1beta2.IModerateTextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v1beta2.IModerateTextResponse, + protos.google.cloud.language.v1beta2.IModerateTextRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.moderateText(request, options, callback); + } +/** + * A convenience method that provides all syntax, sentiment, entity, and + * classification features in one call. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v1beta2.Document} request.document + * Required. Input document. + * @param {google.cloud.language.v1beta2.AnnotateTextRequest.Features} request.features + * Required. The enabled features. + * @param {google.cloud.language.v1beta2.EncodingType} request.encodingType + * The encoding type used by the API to calculate offsets. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1beta2.AnnotateTextResponse|AnnotateTextResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/language_service.annotate_text.js + * region_tag:language_v1beta2_generated_LanguageService_AnnotateText_async + */ + annotateText( + request?: protos.google.cloud.language.v1beta2.IAnnotateTextRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v1beta2.IAnnotateTextResponse, + protos.google.cloud.language.v1beta2.IAnnotateTextRequest|undefined, {}|undefined + ]>; + annotateText( + request: protos.google.cloud.language.v1beta2.IAnnotateTextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v1beta2.IAnnotateTextResponse, + protos.google.cloud.language.v1beta2.IAnnotateTextRequest|null|undefined, + {}|null|undefined>): void; + annotateText( + request: protos.google.cloud.language.v1beta2.IAnnotateTextRequest, + callback: Callback< + protos.google.cloud.language.v1beta2.IAnnotateTextResponse, + protos.google.cloud.language.v1beta2.IAnnotateTextRequest|null|undefined, + {}|null|undefined>): void; + annotateText( + request?: protos.google.cloud.language.v1beta2.IAnnotateTextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v1beta2.IAnnotateTextResponse, + protos.google.cloud.language.v1beta2.IAnnotateTextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v1beta2.IAnnotateTextResponse, + protos.google.cloud.language.v1beta2.IAnnotateTextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v1beta2.IAnnotateTextResponse, + protos.google.cloud.language.v1beta2.IAnnotateTextRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.annotateText(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.languageServiceStub && !this._terminated) { + return this.languageServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_client_config.json b/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_client_config.json new file mode 100644 index 00000000000..59cb784dc03 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_client_config.json @@ -0,0 +1,60 @@ +{ + "interfaces": { + "google.cloud.language.v1beta2.LanguageService": { + "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": { + "AnalyzeSentiment": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "AnalyzeEntities": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "AnalyzeEntitySentiment": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "AnalyzeSyntax": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ClassifyText": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ModerateText": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AnnotateText": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_proto_list.json b/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_proto_list.json new file mode 100644 index 00000000000..d5314f41309 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/language/v1beta2/language_service.proto" +] diff --git a/owl-bot-staging/google-cloud-language/v1beta2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-language/v1beta2/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..46600ec0cdc --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/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 language = require('@google-cloud/language'); + +function main() { + const languageServiceClient = new language.LanguageServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-language/v1beta2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-language/v1beta2/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..e2767ca4173 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/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 {LanguageServiceClient} from '@google-cloud/language'; + +// check that the client class type name can be used +function doStuffWithLanguageServiceClient(client: LanguageServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const languageServiceClient = new LanguageServiceClient(); + doStuffWithLanguageServiceClient(languageServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-language/v1beta2/system-test/install.ts b/owl-bot-staging/google-cloud-language/v1beta2/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/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-language/v1beta2/test/gapic_language_service_v1beta2.ts b/owl-bot-staging/google-cloud-language/v1beta2/test/gapic_language_service_v1beta2.ts new file mode 100644 index 00000000000..c0f805a8793 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/test/gapic_language_service_v1beta2.ts @@ -0,0 +1,675 @@ +// 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 languageserviceModule 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('v1beta2.LanguageServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = languageserviceModule.v1beta2.LanguageServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = languageserviceModule.v1beta2.LanguageServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = languageserviceModule.v1beta2.LanguageServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.languageServiceStub, undefined); + await client.initialize(); + assert(client.languageServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.languageServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.languageServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + 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 languageserviceModule.v1beta2.LanguageServiceClient({ + 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('analyzeSentiment', () => { + it('invokes analyzeSentiment without error', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeSentimentRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeSentimentResponse() + ); + client.innerApiCalls.analyzeSentiment = stubSimpleCall(expectedResponse); + const [response] = await client.analyzeSentiment(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeSentiment without error using callback', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeSentimentRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeSentimentResponse() + ); + client.innerApiCalls.analyzeSentiment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeSentiment( + request, + (err?: Error|null, result?: protos.google.cloud.language.v1beta2.IAnalyzeSentimentResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeSentiment with error', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeSentimentRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeSentiment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.analyzeSentiment(request), expectedError); + }); + + it('invokes analyzeSentiment with closed client', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeSentimentRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeSentiment(request), expectedError); + }); + }); + + describe('analyzeEntities', () => { + it('invokes analyzeEntities without error', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeEntitiesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeEntitiesResponse() + ); + client.innerApiCalls.analyzeEntities = stubSimpleCall(expectedResponse); + const [response] = await client.analyzeEntities(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeEntities without error using callback', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeEntitiesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeEntitiesResponse() + ); + client.innerApiCalls.analyzeEntities = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeEntities( + request, + (err?: Error|null, result?: protos.google.cloud.language.v1beta2.IAnalyzeEntitiesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeEntities with error', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeEntitiesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeEntities = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.analyzeEntities(request), expectedError); + }); + + it('invokes analyzeEntities with closed client', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeEntitiesRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeEntities(request), expectedError); + }); + }); + + describe('analyzeEntitySentiment', () => { + it('invokes analyzeEntitySentiment without error', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse() + ); + client.innerApiCalls.analyzeEntitySentiment = stubSimpleCall(expectedResponse); + const [response] = await client.analyzeEntitySentiment(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeEntitySentiment without error using callback', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse() + ); + client.innerApiCalls.analyzeEntitySentiment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeEntitySentiment( + request, + (err?: Error|null, result?: protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeEntitySentiment with error', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeEntitySentiment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.analyzeEntitySentiment(request), expectedError); + }); + + it('invokes analyzeEntitySentiment with closed client', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeEntitySentiment(request), expectedError); + }); + }); + + describe('analyzeSyntax', () => { + it('invokes analyzeSyntax without error', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeSyntaxRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeSyntaxResponse() + ); + client.innerApiCalls.analyzeSyntax = stubSimpleCall(expectedResponse); + const [response] = await client.analyzeSyntax(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeSyntax without error using callback', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeSyntaxRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeSyntaxResponse() + ); + client.innerApiCalls.analyzeSyntax = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeSyntax( + request, + (err?: Error|null, result?: protos.google.cloud.language.v1beta2.IAnalyzeSyntaxResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeSyntax with error', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeSyntaxRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeSyntax = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.analyzeSyntax(request), expectedError); + }); + + it('invokes analyzeSyntax with closed client', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnalyzeSyntaxRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeSyntax(request), expectedError); + }); + }); + + describe('classifyText', () => { + it('invokes classifyText without error', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.ClassifyTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1beta2.ClassifyTextResponse() + ); + client.innerApiCalls.classifyText = stubSimpleCall(expectedResponse); + const [response] = await client.classifyText(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes classifyText without error using callback', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.ClassifyTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1beta2.ClassifyTextResponse() + ); + client.innerApiCalls.classifyText = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.classifyText( + request, + (err?: Error|null, result?: protos.google.cloud.language.v1beta2.IClassifyTextResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes classifyText with error', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.ClassifyTextRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.classifyText = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.classifyText(request), expectedError); + }); + + it('invokes classifyText with closed client', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.ClassifyTextRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.classifyText(request), expectedError); + }); + }); + + describe('moderateText', () => { + it('invokes moderateText without error', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.ModerateTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1beta2.ModerateTextResponse() + ); + client.innerApiCalls.moderateText = stubSimpleCall(expectedResponse); + const [response] = await client.moderateText(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes moderateText without error using callback', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.ModerateTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1beta2.ModerateTextResponse() + ); + client.innerApiCalls.moderateText = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.moderateText( + request, + (err?: Error|null, result?: protos.google.cloud.language.v1beta2.IModerateTextResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes moderateText with error', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.ModerateTextRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.moderateText = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.moderateText(request), expectedError); + }); + + it('invokes moderateText with closed client', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.ModerateTextRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.moderateText(request), expectedError); + }); + }); + + describe('annotateText', () => { + it('invokes annotateText without error', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnnotateTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnnotateTextResponse() + ); + client.innerApiCalls.annotateText = stubSimpleCall(expectedResponse); + const [response] = await client.annotateText(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes annotateText without error using callback', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnnotateTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnnotateTextResponse() + ); + client.innerApiCalls.annotateText = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.annotateText( + request, + (err?: Error|null, result?: protos.google.cloud.language.v1beta2.IAnnotateTextResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes annotateText with error', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnnotateTextRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.annotateText = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.annotateText(request), expectedError); + }); + + it('invokes annotateText with closed client', async () => { + const client = new languageserviceModule.v1beta2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v1beta2.AnnotateTextRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.annotateText(request), expectedError); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-language/v1beta2/tsconfig.json b/owl-bot-staging/google-cloud-language/v1beta2/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/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-language/v1beta2/webpack.config.js b/owl-bot-staging/google-cloud-language/v1beta2/webpack.config.js new file mode 100644 index 00000000000..c90df1063ed --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v1beta2/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: 'LanguageService', + filename: './language-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-language/v2/.eslintignore b/owl-bot-staging/google-cloud-language/v2/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-language/v2/.eslintrc.json b/owl-bot-staging/google-cloud-language/v2/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-language/v2/.gitignore b/owl-bot-staging/google-cloud-language/v2/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/.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-language/v2/.jsdoc.js b/owl-bot-staging/google-cloud-language/v2/.jsdoc.js new file mode 100644 index 00000000000..31167957cc8 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/.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/language', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-language/v2/.mocharc.js b/owl-bot-staging/google-cloud-language/v2/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/.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-language/v2/.prettierrc.js b/owl-bot-staging/google-cloud-language/v2/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/.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-language/v2/README.md b/owl-bot-staging/google-cloud-language/v2/README.md new file mode 100644 index 00000000000..7287da54696 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/README.md @@ -0,0 +1 @@ +Language: Nodejs Client diff --git a/owl-bot-staging/google-cloud-language/v2/package.json b/owl-bot-staging/google-cloud-language/v2/package.json new file mode 100644 index 00000000000..c158c05feac --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/language", + "version": "0.1.0", + "description": "Language client for Node.js", + "repository": "googleapis/nodejs-language", + "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 language", + "language", + "language service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-language/v2/protos/google/cloud/language/v2/language_service.proto b/owl-bot-staging/google-cloud-language/v2/protos/google/cloud/language/v2/language_service.proto new file mode 100644 index 00000000000..acbdbd4f6ad --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/protos/google/cloud/language/v2/language_service.proto @@ -0,0 +1,504 @@ +// 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 +// +// 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.language.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; + +option go_package = "cloud.google.com/go/language/apiv2/languagepb;languagepb"; +option java_multiple_files = true; +option java_outer_classname = "LanguageServiceProto"; +option java_package = "com.google.cloud.language.v2"; + +// Provides text analysis operations such as sentiment analysis and entity +// recognition. +service LanguageService { + option (google.api.default_host) = "language.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-language," + "https://www.googleapis.com/auth/cloud-platform"; + + // Analyzes the sentiment of the provided text. + rpc AnalyzeSentiment(AnalyzeSentimentRequest) + returns (AnalyzeSentimentResponse) { + option (google.api.http) = { + post: "/v2/documents:analyzeSentiment" + body: "*" + }; + option (google.api.method_signature) = "document,encoding_type"; + option (google.api.method_signature) = "document"; + } + + // Finds named entities (currently proper names and common nouns) in the text + // along with entity types, probability, mentions for each entity, and + // other properties. + rpc AnalyzeEntities(AnalyzeEntitiesRequest) + returns (AnalyzeEntitiesResponse) { + option (google.api.http) = { + post: "/v2/documents:analyzeEntities" + body: "*" + }; + option (google.api.method_signature) = "document,encoding_type"; + option (google.api.method_signature) = "document"; + } + + // Classifies a document into categories. + rpc ClassifyText(ClassifyTextRequest) returns (ClassifyTextResponse) { + option (google.api.http) = { + post: "/v2/documents:classifyText" + body: "*" + }; + option (google.api.method_signature) = "document"; + } + + // Moderates a document for harmful and sensitive categories. + rpc ModerateText(ModerateTextRequest) returns (ModerateTextResponse) { + option (google.api.http) = { + post: "/v2/documents:moderateText" + body: "*" + }; + option (google.api.method_signature) = "document"; + } + + // A convenience method that provides all features in one call. + rpc AnnotateText(AnnotateTextRequest) returns (AnnotateTextResponse) { + option (google.api.http) = { + post: "/v2/documents:annotateText" + body: "*" + }; + option (google.api.method_signature) = "document,features,encoding_type"; + option (google.api.method_signature) = "document,features"; + } +} + +// Represents the input to API methods. +message Document { + // The document types enum. + enum Type { + // The content type is not specified. + TYPE_UNSPECIFIED = 0; + + // Plain text + PLAIN_TEXT = 1; + + // HTML + HTML = 2; + } + + // Required. If the type is not set or is `TYPE_UNSPECIFIED`, + // returns an `INVALID_ARGUMENT` error. + Type type = 1; + + // The source of the document: a string containing the content or a + // Google Cloud Storage URI. + oneof source { + // The content of the input in string format. + // Cloud audit logging exempt since it is based on user data. + string content = 2; + + // The Google Cloud Storage URI where the file content is located. + // This URI must be of the form: gs://bucket_name/object_name. For more + // details, see https://cloud.google.com/storage/docs/reference-uris. + // NOTE: Cloud Storage object versioning is not supported. + string gcs_content_uri = 3; + } + + // Optional. The language of the document (if not specified, the language is + // automatically detected). Both ISO and BCP-47 language codes are + // accepted.
+ // [Language + // Support](https://cloud.google.com/natural-language/docs/languages) lists + // currently supported languages for each API method. If the language (either + // specified by the caller or automatically detected) is not supported by the + // called API method, an `INVALID_ARGUMENT` error is returned. + string language_code = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents a sentence in the input document. +message Sentence { + // The sentence text. + TextSpan text = 1; + + // For calls to [AnalyzeSentiment][] or if + // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_document_sentiment] + // is set to true, this field will contain the sentiment for the sentence. + Sentiment sentiment = 2; +} + +// Represents the text encoding that the caller uses to process the output. +// Providing an `EncodingType` is recommended because the API provides the +// beginning offsets for various outputs, such as tokens and mentions, and +// languages that natively use different text encodings may access offsets +// differently. +enum EncodingType { + // If `EncodingType` is not specified, encoding-dependent information (such as + // `begin_offset`) will be set at `-1`. + NONE = 0; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-8 encoding of the input. C++ and Go are examples of languages + // that use this encoding natively. + UTF8 = 1; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-16 encoding of the input. Java and JavaScript are examples of + // languages that use this encoding natively. + UTF16 = 2; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-32 encoding of the input. Python is an example of a language + // that uses this encoding natively. + UTF32 = 3; +} + +// Represents a phrase in the text that is a known entity, such as +// a person, an organization, or location. The API associates information, such +// as probability and mentions, with entities. +message Entity { + // The type of the entity. For most entity types, the associated metadata is a + // Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table + // below lists the associated fields for entities that have different + // metadata. + enum Type { + // Unknown + UNKNOWN = 0; + + // Person + PERSON = 1; + + // Location + LOCATION = 2; + + // Organization + ORGANIZATION = 3; + + // Event + EVENT = 4; + + // Artwork + WORK_OF_ART = 5; + + // Consumer product + CONSUMER_GOOD = 6; + + // Other types of entities + OTHER = 7; + + // Phone number + // + // The metadata lists the phone number, formatted according to local + // convention, plus whichever additional elements appear in the text: + // + // * `number` - the actual number, broken down into sections as per local + // convention + // * `national_prefix` - country code, if detected + // * `area_code` - region or area code, if detected + // * `extension` - phone extension (to be dialed after connection), if + // detected + PHONE_NUMBER = 9; + + // Address + // + // The metadata identifies the street number and locality plus whichever + // additional elements appear in the text: + // + // * `street_number` - street number + // * `locality` - city or town + // * `street_name` - street/route name, if detected + // * `postal_code` - postal code, if detected + // * `country` - country, if detected< + // * `broad_region` - administrative area, such as the state, if detected + // * `narrow_region` - smaller administrative area, such as county, if + // detected + // * `sublocality` - used in Asian addresses to demark a district within a + // city, if detected + ADDRESS = 10; + + // Date + // + // The metadata identifies the components of the date: + // + // * `year` - four digit year, if detected + // * `month` - two digit month number, if detected + // * `day` - two digit day number, if detected + DATE = 11; + + // Number + // + // The metadata is the number itself. + NUMBER = 12; + + // Price + // + // The metadata identifies the `value` and `currency`. + PRICE = 13; + } + + // The representative name for the entity. + string name = 1; + + // The entity type. + Type type = 2; + + // Metadata associated with the entity. + // + // For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) + // and Knowledge Graph MID (`mid`), if they are available. For the metadata + // associated with other entity types, see the Type table below. + map metadata = 3; + + // The mentions of this entity in the input document. The API currently + // supports proper noun mentions. + repeated EntityMention mentions = 5; + + // For calls to [AnalyzeEntitySentiment][] or if + // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_entity_sentiment] + // is set to true, this field will contain the aggregate sentiment expressed + // for this entity in the provided document. + Sentiment sentiment = 6; +} + +// Represents the feeling associated with the entire text or entities in +// the text. +message Sentiment { + // A non-negative number in the [0, +inf) range, which represents + // the absolute magnitude of sentiment regardless of score (positive or + // negative). + float magnitude = 1; + + // Sentiment score between -1.0 (negative sentiment) and 1.0 + // (positive sentiment). + float score = 2; +} + +// Represents a mention for an entity in the text. Currently, proper noun +// mentions are supported. +message EntityMention { + // The supported types of mentions. + enum Type { + // Unknown + TYPE_UNKNOWN = 0; + + // Proper name + PROPER = 1; + + // Common noun (or noun compound) + COMMON = 2; + } + + // The mention text. + TextSpan text = 1; + + // The type of the entity mention. + Type type = 2; + + // For calls to [AnalyzeEntitySentiment][] or if + // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_entity_sentiment] + // is set to true, this field will contain the sentiment expressed for this + // mention of the entity in the provided document. + Sentiment sentiment = 3; + + // Probability score associated with the entity. + // + // The score shows the probability of the entity mention being the entity + // type. The score is in (0, 1] range. + float probability = 4; +} + +// Represents a text span in the input document. +message TextSpan { + // The content of the text span, which is a substring of the document. + string content = 1; + + // The API calculates the beginning offset of the content in the original + // document according to the + // [EncodingType][google.cloud.language.v2.EncodingType] specified in the API + // request. + int32 begin_offset = 2; +} + +// Represents a category returned from the text classifier. +message ClassificationCategory { + // The name of the category representing the document. + string name = 1; + + // The classifier's confidence of the category. Number represents how certain + // the classifier is that this category represents the given text. + float confidence = 2; +} + +// The sentiment analysis request message. +message AnalyzeSentimentRequest { + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // The encoding type used by the API to calculate sentence offsets. + EncodingType encoding_type = 2; +} + +// The sentiment analysis response message. +message AnalyzeSentimentResponse { + // The overall sentiment of the input document. + Sentiment document_sentiment = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][] field for more details. + string language_code = 2; + + // The sentiment for all the sentences in the document. + repeated Sentence sentences = 3; + + // Whether the language is officially supported. The API may still return a + // response when the language is not supported, but it is on a best effort + // basis. + bool language_supported = 4; +} + +// The entity analysis request message. +message AnalyzeEntitiesRequest { + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 2; +} + +// The entity analysis response message. +message AnalyzeEntitiesResponse { + // The recognized entities in the input document. + repeated Entity entities = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][] field for more details. + string language_code = 2; + + // Whether the language is officially supported. The API may still return a + // response when the language is not supported, but it is on a best effort + // basis. + bool language_supported = 3; +} + +// The document classification request message. +message ClassifyTextRequest { + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The document classification response message. +message ClassifyTextResponse { + // Categories representing the input document. + repeated ClassificationCategory categories = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][] field for more details. + string language_code = 2; + + // Whether the language is officially supported. The API may still return a + // response when the language is not supported, but it is on a best effort + // basis. + bool language_supported = 3; +} + +// The document moderation request message. +message ModerateTextRequest { + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The document moderation response message. +message ModerateTextResponse { + // Harmful and sensitive categories representing the input document. + repeated ClassificationCategory moderation_categories = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][] field for more details. + string language_code = 2; + + // Whether the language is officially supported. The API may still return a + // response when the language is not supported, but it is on a best effort + // basis. + bool language_supported = 3; +} + +// The request message for the text annotation API, which can perform multiple +// analysis types in one call. +message AnnotateTextRequest { + // All available features. + // Setting each one to true will enable that specific analysis for the input. + message Features { + // Optional. Extract entities. + bool extract_entities = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Extract document-level sentiment. + bool extract_document_sentiment = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Classify the full document into categories. + bool classify_text = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Moderate the document for harmful and sensitive categories. + bool moderate_text = 5 [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. Input document. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The enabled features. + Features features = 2 [(google.api.field_behavior) = REQUIRED]; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 3; +} + +// The text annotations response message. +message AnnotateTextResponse { + // Sentences in the input document. Populated if the user enables + // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_document_sentiment]. + repeated Sentence sentences = 1; + + // Entities, along with their semantic information, in the input document. + // Populated if the user enables + // [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v2.AnnotateTextRequest.Features.extract_entities] + // or + // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_entity_sentiment]. + repeated Entity entities = 2; + + // The overall sentiment for the document. Populated if the user enables + // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_document_sentiment]. + Sentiment document_sentiment = 3; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][] field for more details. + string language_code = 4; + + // Categories identified in the input document. + repeated ClassificationCategory categories = 5; + + // Harmful and sensitive categories identified in the input document. + repeated ClassificationCategory moderation_categories = 6; + + // Whether the language is officially supported by all requested features. + // The API may still return a response when the language is not supported, but + // it is on a best effort basis. + bool language_supported = 7; +} diff --git a/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.analyze_entities.js b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.analyze_entities.js new file mode 100644 index 00000000000..7cdeb63e0ee --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.analyze_entities.js @@ -0,0 +1,65 @@ +// 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(document) { + // [START language_v2_generated_LanguageService_AnalyzeEntities_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. Input document. + */ + // const document = {} + /** + * The encoding type used by the API to calculate offsets. + */ + // const encodingType = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v2; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callAnalyzeEntities() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await languageClient.analyzeEntities(request); + console.log(response); + } + + callAnalyzeEntities(); + // [END language_v2_generated_LanguageService_AnalyzeEntities_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-language/v2/samples/generated/v2/language_service.analyze_sentiment.js b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.analyze_sentiment.js new file mode 100644 index 00000000000..97bc408febe --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.analyze_sentiment.js @@ -0,0 +1,65 @@ +// 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(document) { + // [START language_v2_generated_LanguageService_AnalyzeSentiment_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. Input document. + */ + // const document = {} + /** + * The encoding type used by the API to calculate sentence offsets. + */ + // const encodingType = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v2; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callAnalyzeSentiment() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await languageClient.analyzeSentiment(request); + console.log(response); + } + + callAnalyzeSentiment(); + // [END language_v2_generated_LanguageService_AnalyzeSentiment_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-language/v2/samples/generated/v2/language_service.annotate_text.js b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.annotate_text.js new file mode 100644 index 00000000000..5f920ce2afb --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.annotate_text.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(document, features) { + // [START language_v2_generated_LanguageService_AnnotateText_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. Input document. + */ + // const document = {} + /** + * Required. The enabled features. + */ + // const features = {} + /** + * The encoding type used by the API to calculate offsets. + */ + // const encodingType = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v2; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callAnnotateText() { + // Construct request + const request = { + document, + features, + }; + + // Run request + const response = await languageClient.annotateText(request); + console.log(response); + } + + callAnnotateText(); + // [END language_v2_generated_LanguageService_AnnotateText_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-language/v2/samples/generated/v2/language_service.classify_text.js b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.classify_text.js new file mode 100644 index 00000000000..844d9edd8c2 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.classify_text.js @@ -0,0 +1,61 @@ +// 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(document) { + // [START language_v2_generated_LanguageService_ClassifyText_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. Input document. + */ + // const document = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v2; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callClassifyText() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await languageClient.classifyText(request); + console.log(response); + } + + callClassifyText(); + // [END language_v2_generated_LanguageService_ClassifyText_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-language/v2/samples/generated/v2/language_service.moderate_text.js b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.moderate_text.js new file mode 100644 index 00000000000..159e0228c25 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.moderate_text.js @@ -0,0 +1,61 @@ +// 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(document) { + // [START language_v2_generated_LanguageService_ModerateText_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. Input document. + */ + // const document = {} + + // Imports the Language library + const {LanguageServiceClient} = require('@google-cloud/language').v2; + + // Instantiates a client + const languageClient = new LanguageServiceClient(); + + async function callModerateText() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await languageClient.moderateText(request); + console.log(response); + } + + callModerateText(); + // [END language_v2_generated_LanguageService_ModerateText_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-language/v2/samples/generated/v2/snippet_metadata_google.cloud.language.v2.json b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/snippet_metadata_google.cloud.language.v2.json new file mode 100644 index 00000000000..2472641268a --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/snippet_metadata_google.cloud.language.v2.json @@ -0,0 +1,231 @@ +{ + "clientLibrary": { + "name": "nodejs-language", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.language.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "language_v2_generated_LanguageService_AnalyzeSentiment_async", + "title": "LanguageService analyzeSentiment Sample", + "origin": "API_DEFINITION", + "description": " Analyzes the sentiment of the provided text.", + "canonical": true, + "file": "language_service.analyze_sentiment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeSentiment", + "fullName": "google.cloud.language.v2.LanguageService.AnalyzeSentiment", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v2.Document" + }, + { + "name": "encoding_type", + "type": ".google.cloud.language.v2.EncodingType" + } + ], + "resultType": ".google.cloud.language.v2.AnalyzeSentimentResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v2.LanguageServiceClient" + }, + "method": { + "shortName": "AnalyzeSentiment", + "fullName": "google.cloud.language.v2.LanguageService.AnalyzeSentiment", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v2.LanguageService" + } + } + } + }, + { + "regionTag": "language_v2_generated_LanguageService_AnalyzeEntities_async", + "title": "LanguageService analyzeEntities Sample", + "origin": "API_DEFINITION", + "description": " Finds named entities (currently proper names and common nouns) in the text along with entity types, probability, mentions for each entity, and other properties.", + "canonical": true, + "file": "language_service.analyze_entities.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeEntities", + "fullName": "google.cloud.language.v2.LanguageService.AnalyzeEntities", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v2.Document" + }, + { + "name": "encoding_type", + "type": ".google.cloud.language.v2.EncodingType" + } + ], + "resultType": ".google.cloud.language.v2.AnalyzeEntitiesResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v2.LanguageServiceClient" + }, + "method": { + "shortName": "AnalyzeEntities", + "fullName": "google.cloud.language.v2.LanguageService.AnalyzeEntities", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v2.LanguageService" + } + } + } + }, + { + "regionTag": "language_v2_generated_LanguageService_ClassifyText_async", + "title": "LanguageService classifyText Sample", + "origin": "API_DEFINITION", + "description": " Classifies a document into categories.", + "canonical": true, + "file": "language_service.classify_text.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ClassifyText", + "fullName": "google.cloud.language.v2.LanguageService.ClassifyText", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v2.Document" + } + ], + "resultType": ".google.cloud.language.v2.ClassifyTextResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v2.LanguageServiceClient" + }, + "method": { + "shortName": "ClassifyText", + "fullName": "google.cloud.language.v2.LanguageService.ClassifyText", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v2.LanguageService" + } + } + } + }, + { + "regionTag": "language_v2_generated_LanguageService_ModerateText_async", + "title": "LanguageService moderateText Sample", + "origin": "API_DEFINITION", + "description": " Moderates a document for harmful and sensitive categories.", + "canonical": true, + "file": "language_service.moderate_text.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ModerateText", + "fullName": "google.cloud.language.v2.LanguageService.ModerateText", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v2.Document" + } + ], + "resultType": ".google.cloud.language.v2.ModerateTextResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v2.LanguageServiceClient" + }, + "method": { + "shortName": "ModerateText", + "fullName": "google.cloud.language.v2.LanguageService.ModerateText", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v2.LanguageService" + } + } + } + }, + { + "regionTag": "language_v2_generated_LanguageService_AnnotateText_async", + "title": "LanguageService annotateText Sample", + "origin": "API_DEFINITION", + "description": " A convenience method that provides all features in one call.", + "canonical": true, + "file": "language_service.annotate_text.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnnotateText", + "fullName": "google.cloud.language.v2.LanguageService.AnnotateText", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.language.v2.Document" + }, + { + "name": "features", + "type": ".google.cloud.language.v2.AnnotateTextRequest.Features" + }, + { + "name": "encoding_type", + "type": ".google.cloud.language.v2.EncodingType" + } + ], + "resultType": ".google.cloud.language.v2.AnnotateTextResponse", + "client": { + "shortName": "LanguageServiceClient", + "fullName": "google.cloud.language.v2.LanguageServiceClient" + }, + "method": { + "shortName": "AnnotateText", + "fullName": "google.cloud.language.v2.LanguageService.AnnotateText", + "service": { + "shortName": "LanguageService", + "fullName": "google.cloud.language.v2.LanguageService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-language/v2/src/index.ts b/owl-bot-staging/google-cloud-language/v2/src/index.ts new file mode 100644 index 00000000000..29aa24ffe34 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/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 v2 from './v2'; +const LanguageServiceClient = v2.LanguageServiceClient; +type LanguageServiceClient = v2.LanguageServiceClient; +export {v2, LanguageServiceClient}; +export default {v2, LanguageServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-language/v2/src/v2/gapic_metadata.json b/owl-bot-staging/google-cloud-language/v2/src/v2/gapic_metadata.json new file mode 100644 index 00000000000..44c7d62017a --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/src/v2/gapic_metadata.json @@ -0,0 +1,73 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.language.v2", + "libraryPackage": "@google-cloud/language", + "services": { + "LanguageService": { + "clients": { + "grpc": { + "libraryClient": "LanguageServiceClient", + "rpcs": { + "AnalyzeSentiment": { + "methods": [ + "analyzeSentiment" + ] + }, + "AnalyzeEntities": { + "methods": [ + "analyzeEntities" + ] + }, + "ClassifyText": { + "methods": [ + "classifyText" + ] + }, + "ModerateText": { + "methods": [ + "moderateText" + ] + }, + "AnnotateText": { + "methods": [ + "annotateText" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "LanguageServiceClient", + "rpcs": { + "AnalyzeSentiment": { + "methods": [ + "analyzeSentiment" + ] + }, + "AnalyzeEntities": { + "methods": [ + "analyzeEntities" + ] + }, + "ClassifyText": { + "methods": [ + "classifyText" + ] + }, + "ModerateText": { + "methods": [ + "moderateText" + ] + }, + "AnnotateText": { + "methods": [ + "annotateText" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-language/v2/src/v2/index.ts b/owl-bot-staging/google-cloud-language/v2/src/v2/index.ts new file mode 100644 index 00000000000..3275c17250d --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/src/v2/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 {LanguageServiceClient} from './language_service_client'; diff --git a/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_client.ts b/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_client.ts new file mode 100644 index 00000000000..ed5758c63b8 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_client.ts @@ -0,0 +1,643 @@ +// 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/v2/language_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './language_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Provides text analysis operations such as sentiment analysis and entity + * recognition. + * @class + * @memberof v2 + */ +export class LanguageServiceClient { + 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}; + languageServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of LanguageServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 LanguageServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof LanguageServiceClient; + 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 { + 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.language.v2.LanguageService', 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.languageServiceStub) { + return this.languageServiceStub; + } + + // Put together the "service stub" for + // google.cloud.language.v2.LanguageService. + this.languageServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.language.v2.LanguageService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.language.v2.LanguageService, + 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 languageServiceStubMethods = + ['analyzeSentiment', 'analyzeEntities', 'classifyText', 'moderateText', 'annotateText']; + for (const methodName of languageServiceStubMethods) { + const callPromise = this.languageServiceStub.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.languageServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'language.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 'language.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-language', + '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 -- + // ------------------- +/** + * Analyzes the sentiment of the provided text. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v2.Document} request.document + * Required. Input document. + * @param {google.cloud.language.v2.EncodingType} request.encodingType + * The encoding type used by the API to calculate sentence offsets. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v2.AnalyzeSentimentResponse|AnalyzeSentimentResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/language_service.analyze_sentiment.js + * region_tag:language_v2_generated_LanguageService_AnalyzeSentiment_async + */ + analyzeSentiment( + request?: protos.google.cloud.language.v2.IAnalyzeSentimentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v2.IAnalyzeSentimentResponse, + protos.google.cloud.language.v2.IAnalyzeSentimentRequest|undefined, {}|undefined + ]>; + analyzeSentiment( + request: protos.google.cloud.language.v2.IAnalyzeSentimentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v2.IAnalyzeSentimentResponse, + protos.google.cloud.language.v2.IAnalyzeSentimentRequest|null|undefined, + {}|null|undefined>): void; + analyzeSentiment( + request: protos.google.cloud.language.v2.IAnalyzeSentimentRequest, + callback: Callback< + protos.google.cloud.language.v2.IAnalyzeSentimentResponse, + protos.google.cloud.language.v2.IAnalyzeSentimentRequest|null|undefined, + {}|null|undefined>): void; + analyzeSentiment( + request?: protos.google.cloud.language.v2.IAnalyzeSentimentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v2.IAnalyzeSentimentResponse, + protos.google.cloud.language.v2.IAnalyzeSentimentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v2.IAnalyzeSentimentResponse, + protos.google.cloud.language.v2.IAnalyzeSentimentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v2.IAnalyzeSentimentResponse, + protos.google.cloud.language.v2.IAnalyzeSentimentRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.analyzeSentiment(request, options, callback); + } +/** + * Finds named entities (currently proper names and common nouns) in the text + * along with entity types, probability, mentions for each entity, and + * other properties. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v2.Document} request.document + * Required. Input document. + * @param {google.cloud.language.v2.EncodingType} request.encodingType + * The encoding type used by the API to calculate offsets. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v2.AnalyzeEntitiesResponse|AnalyzeEntitiesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/language_service.analyze_entities.js + * region_tag:language_v2_generated_LanguageService_AnalyzeEntities_async + */ + analyzeEntities( + request?: protos.google.cloud.language.v2.IAnalyzeEntitiesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v2.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v2.IAnalyzeEntitiesRequest|undefined, {}|undefined + ]>; + analyzeEntities( + request: protos.google.cloud.language.v2.IAnalyzeEntitiesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v2.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v2.IAnalyzeEntitiesRequest|null|undefined, + {}|null|undefined>): void; + analyzeEntities( + request: protos.google.cloud.language.v2.IAnalyzeEntitiesRequest, + callback: Callback< + protos.google.cloud.language.v2.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v2.IAnalyzeEntitiesRequest|null|undefined, + {}|null|undefined>): void; + analyzeEntities( + request?: protos.google.cloud.language.v2.IAnalyzeEntitiesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v2.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v2.IAnalyzeEntitiesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v2.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v2.IAnalyzeEntitiesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v2.IAnalyzeEntitiesResponse, + protos.google.cloud.language.v2.IAnalyzeEntitiesRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.analyzeEntities(request, options, callback); + } +/** + * Classifies a document into categories. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v2.Document} request.document + * Required. Input document. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v2.ClassifyTextResponse|ClassifyTextResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/language_service.classify_text.js + * region_tag:language_v2_generated_LanguageService_ClassifyText_async + */ + classifyText( + request?: protos.google.cloud.language.v2.IClassifyTextRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v2.IClassifyTextResponse, + protos.google.cloud.language.v2.IClassifyTextRequest|undefined, {}|undefined + ]>; + classifyText( + request: protos.google.cloud.language.v2.IClassifyTextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v2.IClassifyTextResponse, + protos.google.cloud.language.v2.IClassifyTextRequest|null|undefined, + {}|null|undefined>): void; + classifyText( + request: protos.google.cloud.language.v2.IClassifyTextRequest, + callback: Callback< + protos.google.cloud.language.v2.IClassifyTextResponse, + protos.google.cloud.language.v2.IClassifyTextRequest|null|undefined, + {}|null|undefined>): void; + classifyText( + request?: protos.google.cloud.language.v2.IClassifyTextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v2.IClassifyTextResponse, + protos.google.cloud.language.v2.IClassifyTextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v2.IClassifyTextResponse, + protos.google.cloud.language.v2.IClassifyTextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v2.IClassifyTextResponse, + protos.google.cloud.language.v2.IClassifyTextRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.classifyText(request, options, callback); + } +/** + * Moderates a document for harmful and sensitive categories. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v2.Document} request.document + * Required. Input document. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v2.ModerateTextResponse|ModerateTextResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/language_service.moderate_text.js + * region_tag:language_v2_generated_LanguageService_ModerateText_async + */ + moderateText( + request?: protos.google.cloud.language.v2.IModerateTextRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v2.IModerateTextResponse, + protos.google.cloud.language.v2.IModerateTextRequest|undefined, {}|undefined + ]>; + moderateText( + request: protos.google.cloud.language.v2.IModerateTextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v2.IModerateTextResponse, + protos.google.cloud.language.v2.IModerateTextRequest|null|undefined, + {}|null|undefined>): void; + moderateText( + request: protos.google.cloud.language.v2.IModerateTextRequest, + callback: Callback< + protos.google.cloud.language.v2.IModerateTextResponse, + protos.google.cloud.language.v2.IModerateTextRequest|null|undefined, + {}|null|undefined>): void; + moderateText( + request?: protos.google.cloud.language.v2.IModerateTextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v2.IModerateTextResponse, + protos.google.cloud.language.v2.IModerateTextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v2.IModerateTextResponse, + protos.google.cloud.language.v2.IModerateTextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v2.IModerateTextResponse, + protos.google.cloud.language.v2.IModerateTextRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.moderateText(request, options, callback); + } +/** + * A convenience method that provides all features in one call. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.language.v2.Document} request.document + * Required. Input document. + * @param {google.cloud.language.v2.AnnotateTextRequest.Features} request.features + * Required. The enabled features. + * @param {google.cloud.language.v2.EncodingType} request.encodingType + * The encoding type used by the API to calculate offsets. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v2.AnnotateTextResponse|AnnotateTextResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/language_service.annotate_text.js + * region_tag:language_v2_generated_LanguageService_AnnotateText_async + */ + annotateText( + request?: protos.google.cloud.language.v2.IAnnotateTextRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.language.v2.IAnnotateTextResponse, + protos.google.cloud.language.v2.IAnnotateTextRequest|undefined, {}|undefined + ]>; + annotateText( + request: protos.google.cloud.language.v2.IAnnotateTextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.language.v2.IAnnotateTextResponse, + protos.google.cloud.language.v2.IAnnotateTextRequest|null|undefined, + {}|null|undefined>): void; + annotateText( + request: protos.google.cloud.language.v2.IAnnotateTextRequest, + callback: Callback< + protos.google.cloud.language.v2.IAnnotateTextResponse, + protos.google.cloud.language.v2.IAnnotateTextRequest|null|undefined, + {}|null|undefined>): void; + annotateText( + request?: protos.google.cloud.language.v2.IAnnotateTextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.language.v2.IAnnotateTextResponse, + protos.google.cloud.language.v2.IAnnotateTextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.language.v2.IAnnotateTextResponse, + protos.google.cloud.language.v2.IAnnotateTextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.language.v2.IAnnotateTextResponse, + protos.google.cloud.language.v2.IAnnotateTextRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.annotateText(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.languageServiceStub && !this._terminated) { + return this.languageServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_client_config.json b/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_client_config.json new file mode 100644 index 00000000000..fbe98e549af --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.language.v2.LanguageService": { + "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": { + "AnalyzeSentiment": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "AnalyzeEntities": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ClassifyText": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ModerateText": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "AnnotateText": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_proto_list.json b/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_proto_list.json new file mode 100644 index 00000000000..a463a4e6f9c --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/language/v2/language_service.proto" +] diff --git a/owl-bot-staging/google-cloud-language/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-language/v2/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..46600ec0cdc --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/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 language = require('@google-cloud/language'); + +function main() { + const languageServiceClient = new language.LanguageServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-language/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-language/v2/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..e2767ca4173 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/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 {LanguageServiceClient} from '@google-cloud/language'; + +// check that the client class type name can be used +function doStuffWithLanguageServiceClient(client: LanguageServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const languageServiceClient = new LanguageServiceClient(); + doStuffWithLanguageServiceClient(languageServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-language/v2/system-test/install.ts b/owl-bot-staging/google-cloud-language/v2/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/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-language/v2/test/gapic_language_service_v2.ts b/owl-bot-staging/google-cloud-language/v2/test/gapic_language_service_v2.ts new file mode 100644 index 00000000000..9c0281ce08e --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/test/gapic_language_service_v2.ts @@ -0,0 +1,525 @@ +// 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 languageserviceModule 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('v2.LanguageServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = languageserviceModule.v2.LanguageServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = languageserviceModule.v2.LanguageServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = languageserviceModule.v2.LanguageServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new languageserviceModule.v2.LanguageServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.languageServiceStub, undefined); + await client.initialize(); + assert(client.languageServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.languageServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.languageServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new languageserviceModule.v2.LanguageServiceClient({ + 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 languageserviceModule.v2.LanguageServiceClient({ + 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('analyzeSentiment', () => { + it('invokes analyzeSentiment without error', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.AnalyzeSentimentRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v2.AnalyzeSentimentResponse() + ); + client.innerApiCalls.analyzeSentiment = stubSimpleCall(expectedResponse); + const [response] = await client.analyzeSentiment(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeSentiment without error using callback', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.AnalyzeSentimentRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v2.AnalyzeSentimentResponse() + ); + client.innerApiCalls.analyzeSentiment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeSentiment( + request, + (err?: Error|null, result?: protos.google.cloud.language.v2.IAnalyzeSentimentResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeSentiment with error', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.AnalyzeSentimentRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeSentiment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.analyzeSentiment(request), expectedError); + }); + + it('invokes analyzeSentiment with closed client', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.AnalyzeSentimentRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeSentiment(request), expectedError); + }); + }); + + describe('analyzeEntities', () => { + it('invokes analyzeEntities without error', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.AnalyzeEntitiesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v2.AnalyzeEntitiesResponse() + ); + client.innerApiCalls.analyzeEntities = stubSimpleCall(expectedResponse); + const [response] = await client.analyzeEntities(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeEntities without error using callback', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.AnalyzeEntitiesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v2.AnalyzeEntitiesResponse() + ); + client.innerApiCalls.analyzeEntities = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeEntities( + request, + (err?: Error|null, result?: protos.google.cloud.language.v2.IAnalyzeEntitiesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes analyzeEntities with error', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.AnalyzeEntitiesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeEntities = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.analyzeEntities(request), expectedError); + }); + + it('invokes analyzeEntities with closed client', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.AnalyzeEntitiesRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeEntities(request), expectedError); + }); + }); + + describe('classifyText', () => { + it('invokes classifyText without error', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.ClassifyTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v2.ClassifyTextResponse() + ); + client.innerApiCalls.classifyText = stubSimpleCall(expectedResponse); + const [response] = await client.classifyText(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes classifyText without error using callback', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.ClassifyTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v2.ClassifyTextResponse() + ); + client.innerApiCalls.classifyText = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.classifyText( + request, + (err?: Error|null, result?: protos.google.cloud.language.v2.IClassifyTextResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes classifyText with error', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.ClassifyTextRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.classifyText = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.classifyText(request), expectedError); + }); + + it('invokes classifyText with closed client', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.ClassifyTextRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.classifyText(request), expectedError); + }); + }); + + describe('moderateText', () => { + it('invokes moderateText without error', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.ModerateTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v2.ModerateTextResponse() + ); + client.innerApiCalls.moderateText = stubSimpleCall(expectedResponse); + const [response] = await client.moderateText(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes moderateText without error using callback', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.ModerateTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v2.ModerateTextResponse() + ); + client.innerApiCalls.moderateText = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.moderateText( + request, + (err?: Error|null, result?: protos.google.cloud.language.v2.IModerateTextResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes moderateText with error', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.ModerateTextRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.moderateText = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.moderateText(request), expectedError); + }); + + it('invokes moderateText with closed client', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.ModerateTextRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.moderateText(request), expectedError); + }); + }); + + describe('annotateText', () => { + it('invokes annotateText without error', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.AnnotateTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v2.AnnotateTextResponse() + ); + client.innerApiCalls.annotateText = stubSimpleCall(expectedResponse); + const [response] = await client.annotateText(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes annotateText without error using callback', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.AnnotateTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.language.v2.AnnotateTextResponse() + ); + client.innerApiCalls.annotateText = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.annotateText( + request, + (err?: Error|null, result?: protos.google.cloud.language.v2.IAnnotateTextResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes annotateText with error', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.AnnotateTextRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.annotateText = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.annotateText(request), expectedError); + }); + + it('invokes annotateText with closed client', async () => { + const client = new languageserviceModule.v2.LanguageServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.language.v2.AnnotateTextRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.annotateText(request), expectedError); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-language/v2/tsconfig.json b/owl-bot-staging/google-cloud-language/v2/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/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-language/v2/webpack.config.js b/owl-bot-staging/google-cloud-language/v2/webpack.config.js new file mode 100644 index 00000000000..c90df1063ed --- /dev/null +++ b/owl-bot-staging/google-cloud-language/v2/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: 'LanguageService', + filename: './language-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-lifesciences/v2beta/.eslintignore b/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintrc.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/.gitignore b/owl-bot-staging/google-cloud-lifesciences/v2beta/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/.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-lifesciences/v2beta/.jsdoc.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/.jsdoc.js new file mode 100644 index 00000000000..4d130c236fc --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/.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/life-sciences', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/.mocharc.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/.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-lifesciences/v2beta/.prettierrc.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/.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-lifesciences/v2beta/README.md b/owl-bot-staging/google-cloud-lifesciences/v2beta/README.md new file mode 100644 index 00000000000..d2c6675dd1e --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/README.md @@ -0,0 +1 @@ +Lifesciences: Nodejs Client diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/package.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/package.json new file mode 100644 index 00000000000..8c1173acd7d --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/life-sciences", + "version": "0.1.0", + "description": "Lifesciences client for Node.js", + "repository": "googleapis/nodejs-lifesciences", + "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 lifesciences", + "lifesciences", + "workflows service v2 beta" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/protos/google/cloud/lifesciences/v2beta/workflows.proto b/owl-bot-staging/google-cloud-lifesciences/v2beta/protos/google/cloud/lifesciences/v2beta/workflows.proto new file mode 100644 index 00000000000..162ca8fbeaf --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/protos/google/cloud/lifesciences/v2beta/workflows.proto @@ -0,0 +1,783 @@ +// 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 +// +// 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.lifesciences.v2beta; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/code.proto"; + +option csharp_namespace = "Google.Cloud.LifeSciences.V2Beta"; +option go_package = "cloud.google.com/go/lifesciences/apiv2beta/lifesciencespb;lifesciencespb"; +option java_multiple_files = true; +option java_outer_classname = "WorkflowsProto"; +option java_package = "com.google.cloud.lifesciences.v2beta"; +option objc_class_prefix = "CLSW"; +option php_namespace = "Google\\Cloud\\LifeSciences\\V2beta"; +option ruby_package = "Google::Cloud::LifeSciences::V2beta"; + +// A service for running workflows, such as pipelines consisting of Docker +// containers. +service WorkflowsServiceV2Beta { + option (google.api.default_host) = "lifesciences.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Runs a pipeline. The returned Operation's [metadata] + // [google.longrunning.Operation.metadata] field will contain a + // [google.cloud.lifesciences.v2beta.Metadata][google.cloud.lifesciences.v2beta.Metadata] + // object describing the status of the pipeline execution. The + // [response][google.longrunning.Operation.response] field will contain a + // [google.cloud.lifesciences.v2beta.RunPipelineResponse][google.cloud.lifesciences.v2beta.RunPipelineResponse] + // object if the pipeline completes successfully. + // + // **Note:** Before you can use this method, the *Life Sciences Service Agent* + // must have access to your project. This is done automatically when the + // Cloud Life Sciences API is first enabled, but if you delete this permission + // you must disable and re-enable the API to grant the Life Sciences + // Service Agent the required permissions. + // Authorization requires the following [Google + // IAM](https://cloud.google.com/iam/) permission: + // + // * `lifesciences.workflows.run` + rpc RunPipeline(RunPipelineRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta/{parent=projects/*/locations/*}/pipelines:run" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "RunPipelineResponse" + metadata_type: "Metadata" + }; + } +} + +// The arguments to the `RunPipeline` method. The requesting user must have +// the `iam.serviceAccounts.actAs` permission for the Cloud Life Sciences +// service account or the request will fail. +message RunPipelineRequest { + // The project and location that this request should be executed against. + string parent = 4; + + // Required. The description of the pipeline to run. + Pipeline pipeline = 1 [(google.api.field_behavior) = REQUIRED]; + + // User-defined labels to associate with the returned operation. These + // labels are not propagated to any Google Cloud Platform resources used by + // the operation, and can be modified at any time. + // + // To associate labels with resources created while executing the operation, + // see the appropriate resource message (for example, `VirtualMachine`). + map labels = 2; + + // The name of an existing Pub/Sub topic. The server will publish + // messages to this topic whenever the status of the operation changes. + // The Life Sciences Service Agent account must have publisher permissions to + // the specified topic or notifications will not be sent. + string pub_sub_topic = 3; +} + +// The response to the RunPipeline method, returned in the operation's result +// field on success. +message RunPipelineResponse {} + +// Specifies a series of actions to execute, expressed as Docker containers. +message Pipeline { + // The list of actions to execute, in the order they are specified. + repeated Action actions = 1; + + // The resources required for execution. + Resources resources = 2; + + // The environment to pass into every action. Each action can also specify + // additional environment variables but cannot delete an entry from this map + // (though they can overwrite it with a different value). + map environment = 3; + + // The encrypted environment to pass into every action. Each action can also + // specify its own encrypted environment. + // + // The secret must decrypt to a JSON-encoded dictionary where key-value pairs + // serve as environment variable names and their values. The decoded + // environment variables can overwrite the values specified by the + // `environment` field. + Secret encrypted_environment = 5; + + // The maximum amount of time to give the pipeline to complete. This includes + // the time spent waiting for a worker to be allocated. If the pipeline fails + // to complete before the timeout, it will be cancelled and the error code + // will be set to DEADLINE_EXCEEDED. + // + // If unspecified, it will default to 7 days. + google.protobuf.Duration timeout = 4; +} + +// Specifies a single action that runs a Docker container. +message Action { + // An optional name for the container. The container hostname will be set to + // this name, making it useful for inter-container communication. The name + // must contain only upper and lowercase alphanumeric characters and hyphens + // and cannot start with a hyphen. + string container_name = 1; + + // Required. The URI to pull the container image from. Note that all images + // referenced by actions in the pipeline are pulled before the first action + // runs. If multiple actions reference the same image, it is only pulled once, + // ensuring that the same image is used for all actions in a single pipeline. + // + // The image URI can be either a complete host and image specification (e.g., + // quay.io/biocontainers/samtools), a library and image name (e.g., + // google/cloud-sdk) or a bare image name ('bash') to pull from the default + // library. No schema is required in any of these cases. + // + // If the specified image is not public, the service account specified for + // the Virtual Machine must have access to pull the images from GCR, or + // appropriate credentials must be specified in the + // [google.cloud.lifesciences.v2beta.Action.credentials][google.cloud.lifesciences.v2beta.Action.credentials] + // field. + string image_uri = 2 [(google.api.field_behavior) = REQUIRED]; + + // If specified, overrides the `CMD` specified in the container. If the + // container also has an `ENTRYPOINT` the values are used as entrypoint + // arguments. Otherwise, they are used as a command and arguments to run + // inside the container. + repeated string commands = 3; + + // If specified, overrides the `ENTRYPOINT` specified in the container. + string entrypoint = 4; + + // The environment to pass into the container. This environment is merged + // with values specified in the + // [google.cloud.lifesciences.v2beta.Pipeline][google.cloud.lifesciences.v2beta.Pipeline] + // message, overwriting any duplicate values. + // + // In addition to the values passed here, a few other values are + // automatically injected into the environment. These cannot be hidden or + // overwritten. + // + // `GOOGLE_PIPELINE_FAILED` will be set to "1" if the pipeline failed + // because an action has exited with a non-zero status (and did not have the + // `IGNORE_EXIT_STATUS` flag set). This can be used to determine if additional + // debug or logging actions should execute. + // + // `GOOGLE_LAST_EXIT_STATUS` will be set to the exit status of the last + // non-background action that executed. This can be used by workflow engine + // authors to determine whether an individual action has succeeded or failed. + map environment = 5; + + // The encrypted environment to pass into the container. This environment is + // merged with values specified in the + // [google.cloud.lifesciences.v2beta.Pipeline][google.cloud.lifesciences.v2beta.Pipeline] + // message, overwriting any duplicate values. + // + // The secret must decrypt to a JSON-encoded dictionary where key-value pairs + // serve as environment variable names and their values. The decoded + // environment variables can overwrite the values specified by the + // `environment` field. + Secret encrypted_environment = 21; + + // An optional identifier for a PID namespace to run the action inside. + // Multiple actions should use the same string to share a namespace. If + // unspecified, a separate isolated namespace is used. + string pid_namespace = 6; + + // A map of containers to host port mappings for this container. If the + // container already specifies exposed ports, use the + // `PUBLISH_EXPOSED_PORTS` flag instead. + // + // The host port number must be less than 65536. If it is zero, an unused + // random port is assigned. To determine the resulting port number, consult + // the `ContainerStartedEvent` in the operation metadata. + map port_mappings = 8; + + // A list of mounts to make available to the action. + // + // In addition to the values specified here, every action has a special + // virtual disk mounted under `/google` that contains log files and other + // operational components. + // + //
    + //
  • /google/logs All logs written during the pipeline + // execution.
  • + //
  • /google/logs/output The combined standard output and + // standard error of all actions run as part of the pipeline + // execution.
  • + //
  • /google/logs/action/*/stdout The complete contents of + // each individual action's standard output.
  • + //
  • /google/logs/action/*/stderr The complete contents of + // each individual action's standard error output.
  • + //
+ repeated Mount mounts = 9; + + // Labels to associate with the action. This field is provided to assist + // workflow engine authors in identifying actions (for example, to indicate + // what sort of action they perform, such as localization or debugging). + // They are returned in the operation metadata, but are otherwise ignored. + map labels = 10; + + // If the specified image is hosted on a private registry other than Google + // Container Registry, the credentials required to pull the image must be + // specified here as an encrypted secret. + // + // The secret must decrypt to a JSON-encoded dictionary containing both + // `username` and `password` keys. + Secret credentials = 11; + + // The maximum amount of time to give the action to complete. If the action + // fails to complete before the timeout, it will be terminated and the exit + // status will be non-zero. The pipeline will continue or terminate based + // on the rules defined by the `ALWAYS_RUN` and `IGNORE_EXIT_STATUS` flags. + google.protobuf.Duration timeout = 12; + + // Normally, a non-zero exit status causes the pipeline to fail. This flag + // allows execution of other actions to continue instead. + bool ignore_exit_status = 13; + + // This flag allows an action to continue running in the background while + // executing subsequent actions. This is useful to provide services to + // other actions (or to provide debugging support tools like SSH servers). + bool run_in_background = 14; + + // By default, after an action fails, no further actions are run. This flag + // indicates that this action must be run even if the pipeline has already + // failed. This is useful for actions that copy output files off of the VM + // or for debugging. Note that no actions will be run if image prefetching + // fails. + bool always_run = 15; + + // Enable access to the FUSE device for this action. Filesystems can then + // be mounted into disks shared with other actions. The other actions do + // not need the `enable_fuse` flag to access the mounted filesystem. + // + // This has the effect of causing the container to be executed with + // `CAP_SYS_ADMIN` and exposes `/dev/fuse` to the container, so use it only + // for containers you trust. + bool enable_fuse = 16; + + // Exposes all ports specified by `EXPOSE` statements in the container. To + // discover the host side port numbers, consult the `ACTION_STARTED` event + // in the operation metadata. + bool publish_exposed_ports = 17; + + // All container images are typically downloaded before any actions are + // executed. This helps prevent typos in URIs or issues like lack of disk + // space from wasting large amounts of compute resources. + // + // If set, this flag prevents the worker from downloading the image until + // just before the action is executed. + bool disable_image_prefetch = 18; + + // A small portion of the container's standard error stream is typically + // captured and returned inside the `ContainerStoppedEvent`. Setting this + // flag disables this functionality. + bool disable_standard_error_capture = 19; + + // Prevents the container from accessing the external network. + bool block_external_network = 20; +} + +// Holds encrypted information that is only decrypted and stored in RAM +// by the worker VM when running the pipeline. +message Secret { + // The name of the Cloud KMS key that will be used to decrypt the secret + // value. The VM service account must have the required permissions and + // authentication scopes to invoke the `decrypt` method on the specified key. + string key_name = 1; + + // The value of the cipherText response from the `encrypt` method. This field + // is intentionally unaudited. + string cipher_text = 2; +} + +// Carries information about a particular disk mount inside a container. +message Mount { + // The name of the disk to mount, as specified in the resources section. + string disk = 1; + + // The path to mount the disk inside the container. + string path = 2; + + // If true, the disk is mounted read-only inside the container. + bool read_only = 3; +} + +// The system resources for the pipeline run. +// +// At least one zone or region must be specified or the pipeline run will fail. +message Resources { + // The list of regions allowed for VM allocation. If set, the `zones` field + // must not be set. + repeated string regions = 2; + + // The list of zones allowed for VM allocation. If set, the `regions` field + // must not be set. + repeated string zones = 3; + + // The virtual machine specification. + VirtualMachine virtual_machine = 4; +} + +// Carries information about a Compute Engine VM resource. +message VirtualMachine { + // Required. The machine type of the virtual machine to create. Must be the + // short name of a standard machine type (such as "n1-standard-1") or a custom + // machine type (such as "custom-1-4096", where "1" indicates the number of + // vCPUs and "4096" indicates the memory in MB). See [Creating an instance + // with a custom machine + // type](https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type#create) + // for more specifications on creating a custom machine type. + string machine_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // If true, allocate a preemptible VM. + bool preemptible = 2; + + // Optional set of labels to apply to the VM and any attached disk resources. + // These labels must adhere to the [name and value + // restrictions](https://cloud.google.com/compute/docs/labeling-resources) on + // VM labels imposed by Compute Engine. + // + // Labels keys with the prefix 'google-' are reserved for use by Google. + // + // Labels applied at creation time to the VM. Applied on a best-effort basis + // to attached disk resources shortly after VM creation. + map labels = 3; + + // The list of disks to create and attach to the VM. + // + // Specify either the `volumes[]` field or the `disks[]` field, but not both. + repeated Disk disks = 4; + + // The VM network configuration. + Network network = 5; + + // The list of accelerators to attach to the VM. + repeated Accelerator accelerators = 6; + + // The service account to install on the VM. This account does not need + // any permissions other than those required by the pipeline. + ServiceAccount service_account = 7; + + // The size of the boot disk, in GB. The boot disk must be large + // enough to accommodate all of the Docker images from each action in the + // pipeline at the same time. If not specified, a small but reasonable + // default value is used. + int32 boot_disk_size_gb = 8; + + // The CPU platform to request. An instance based on a newer platform can be + // allocated, but never one with fewer capabilities. The value of this + // parameter must be a valid Compute Engine CPU platform name (such as "Intel + // Skylake"). This parameter is only useful for carefully optimized work + // loads where the CPU platform has a significant impact. + // + // For more information about the effect of this parameter, see + // https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform. + string cpu_platform = 9; + + // The host operating system image to use. + // + // Currently, only Container-Optimized OS images can be used. + // + // The default value is `projects/cos-cloud/global/images/family/cos-stable`, + // which selects the latest stable release of Container-Optimized OS. + // + // This option is provided to allow testing against the beta release of the + // operating system to ensure that the new version does not interact + // negatively with production pipelines. + // + // To test a pipeline against the beta release of Container-Optimized OS, + // use the value `projects/cos-cloud/global/images/family/cos-beta`. + string boot_image = 10; + + // The NVIDIA driver version to use when attaching an NVIDIA GPU accelerator. + // The version specified here must be compatible with the GPU libraries + // contained in the container being executed, and must be one of the drivers + // hosted in the `nvidia-drivers-us-public` bucket on Google Cloud Storage. + string nvidia_driver_version = 11 [deprecated = true]; + + // Whether Stackdriver monitoring should be enabled on the VM. + bool enable_stackdriver_monitoring = 12; + + // The Compute Engine Disk Images to use as a Docker cache. The disks will be + // mounted into the Docker folder in a way that the images present in the + // cache will not need to be pulled. The digests of the cached images must + // match those of the tags used or the latest version will still be pulled. + // The root directory of the ext4 image must contain `image` and `overlay2` + // directories copied from the Docker directory of a VM where the desired + // Docker images have already been pulled. Any images pulled that are not + // cached will be stored on the first cache disk instead of the boot disk. + // Only a single image is supported. + repeated string docker_cache_images = 13; + + // The list of disks and other storage to create or attach to the VM. + // + // Specify either the `volumes[]` field or the `disks[]` field, but not both. + repeated Volume volumes = 14; + + // If specified, the VM will only be allocated inside the matching + // reservation. It will fail if the VM parameters don't match the reservation. + string reservation = 15; +} + +// Carries information about a Google Cloud service account. +message ServiceAccount { + // Email address of the service account. If not specified, the default + // Compute Engine service account for the project will be used. + string email = 1; + + // List of scopes to be enabled for this service account on the VM, in + // addition to the cloud-platform API scope that will be added by default. + repeated string scopes = 2; +} + +// Carries information about an accelerator that can be attached to a VM. +message Accelerator { + // The accelerator type string (for example, "nvidia-tesla-k80"). + // + // Only NVIDIA GPU accelerators are currently supported. If an NVIDIA GPU is + // attached, the required runtime libraries will be made available to all + // containers under `/usr/local/nvidia`. The driver version to install must + // be specified using the NVIDIA driver version parameter on the virtual + // machine specification. Note that attaching a GPU increases the worker VM + // startup time by a few minutes. + string type = 1; + + // How many accelerators of this type to attach. + int64 count = 2; +} + +// VM networking options. +message Network { + // The network name to attach the VM's network interface to. The value will + // be prefixed with `global/networks/` unless it contains a `/`, in which + // case it is assumed to be a fully specified network resource URL. + // + // If unspecified, the global default network is used. + string network = 1; + + // If set to true, do not attach a public IP address to the VM. Note that + // without a public IP address, additional configuration is required to + // allow the VM to access Google services. + // + // See https://cloud.google.com/vpc/docs/configure-private-google-access + // for more information. + bool use_private_address = 2; + + // If the specified network is configured for custom subnet creation, the + // name of the subnetwork to attach the instance to must be specified here. + // + // The value is prefixed with `regions/*/subnetworks/` unless it contains a + // `/`, in which case it is assumed to be a fully specified subnetwork + // resource URL. + // + // If the `*` character appears in the value, it is replaced with the region + // that the virtual machine has been allocated in. + string subnetwork = 3; +} + +// Carries information about a disk that can be attached to a VM. +// +// See https://cloud.google.com/compute/docs/disks/performance for more +// information about disk type, size, and performance considerations. +// +// Specify either [`Volume`][google.cloud.lifesciences.v2beta.Volume] or +// [`Disk`][google.cloud.lifesciences.v2beta.Disk], but not both. +message Disk { + // A user-supplied name for the disk. Used when mounting the disk into + // actions. The name must contain only upper and lowercase alphanumeric + // characters and hyphens and cannot start with a hyphen. + string name = 1; + + // The size, in GB, of the disk to attach. If the size is not + // specified, a default is chosen to ensure reasonable I/O performance. + // + // If the disk type is specified as `local-ssd`, multiple local drives are + // automatically combined to provide the requested size. Note, however, that + // each physical SSD is 375GB in size, and no more than 8 drives can be + // attached to a single instance. + int32 size_gb = 2; + + // The Compute Engine disk type. If unspecified, `pd-standard` is used. + string type = 3; + + // An optional image to put on the disk before attaching it to the VM. + string source_image = 4; +} + +// Carries information about storage that can be attached to a VM. +// +// Specify either [`Volume`][google.cloud.lifesciences.v2beta.Volume] or +// [`Disk`][google.cloud.lifesciences.v2beta.Disk], but not both. +message Volume { + // A user-supplied name for the volume. Used when mounting the volume into + // [`Actions`][google.cloud.lifesciences.v2beta.Action]. The name must contain + // only upper and lowercase alphanumeric characters and hyphens and cannot + // start with a hyphen. + string volume = 1; + + oneof storage { + // Configuration for a persistent disk. + PersistentDisk persistent_disk = 2; + + // Configuration for a existing disk. + ExistingDisk existing_disk = 3; + + // Configuration for an NFS mount. + NFSMount nfs_mount = 4; + } +} + +// Configuration for a persistent disk to be attached to the VM. +// +// See https://cloud.google.com/compute/docs/disks/performance for more +// information about disk type, size, and performance considerations. +message PersistentDisk { + // The size, in GB, of the disk to attach. If the size is not + // specified, a default is chosen to ensure reasonable I/O performance. + // + // If the disk type is specified as `local-ssd`, multiple local drives are + // automatically combined to provide the requested size. Note, however, that + // each physical SSD is 375GB in size, and no more than 8 drives can be + // attached to a single instance. + int32 size_gb = 1; + + // The Compute Engine disk type. If unspecified, `pd-standard` is used. + string type = 2; + + // An image to put on the disk before attaching it to the VM. + string source_image = 3; +} + +// Configuration for an existing disk to be attached to the VM. +message ExistingDisk { + // If `disk` contains slashes, the Cloud Life Sciences API assumes that it is + // a complete URL for the disk. If `disk` does not contain slashes, the Cloud + // Life Sciences API assumes that the disk is a zonal disk and a URL will be + // generated of the form `zones//disks/`, where `` is the + // zone in which the instance is allocated. The disk must be ext4 formatted. + // + // If all `Mount` references to this disk have the `read_only` flag set to + // true, the disk will be attached in `read-only` mode and can be shared with + // other instances. Otherwise, the disk will be available for writing but + // cannot be shared. + string disk = 1; +} + +// Configuration for an `NFSMount` to be attached to the VM. +message NFSMount { + // A target NFS mount. The target must be specified as `address:/mount". + string target = 1; +} + +// Carries information about the pipeline execution that is returned +// in the long running operation's metadata field. +message Metadata { + // The pipeline this operation represents. + Pipeline pipeline = 1; + + // The user-defined labels associated with this operation. + map labels = 2; + + // The list of events that have happened so far during the execution of this + // operation. + repeated Event events = 3; + + // The time at which the operation was created by the API. + google.protobuf.Timestamp create_time = 4; + + // The first time at which resources were allocated to execute the pipeline. + google.protobuf.Timestamp start_time = 5; + + // The time at which execution was completed and resources were cleaned up. + google.protobuf.Timestamp end_time = 6; + + // The name of the Cloud Pub/Sub topic where notifications of operation status + // changes are sent. + string pub_sub_topic = 7; +} + +// Carries information about events that occur during pipeline execution. +message Event { + // The time at which the event occurred. + google.protobuf.Timestamp timestamp = 1; + + // A human-readable description of the event. Note that these strings can + // change at any time without notice. Any application logic must use the + // information in the `details` field. + string description = 2; + + // Machine-readable details about the event. + oneof details { + // See + // [google.cloud.lifesciences.v2beta.DelayedEvent][google.cloud.lifesciences.v2beta.DelayedEvent]. + DelayedEvent delayed = 17; + + // See + // [google.cloud.lifesciences.v2beta.WorkerAssignedEvent][google.cloud.lifesciences.v2beta.WorkerAssignedEvent]. + WorkerAssignedEvent worker_assigned = 18; + + // See + // [google.cloud.lifesciences.v2beta.WorkerReleasedEvent][google.cloud.lifesciences.v2beta.WorkerReleasedEvent]. + WorkerReleasedEvent worker_released = 19; + + // See + // [google.cloud.lifesciences.v2beta.PullStartedEvent][google.cloud.lifesciences.v2beta.PullStartedEvent]. + PullStartedEvent pull_started = 20; + + // See + // [google.cloud.lifesciences.v2beta.PullStoppedEvent][google.cloud.lifesciences.v2beta.PullStoppedEvent]. + PullStoppedEvent pull_stopped = 21; + + // See + // [google.cloud.lifesciences.v2beta.ContainerStartedEvent][google.cloud.lifesciences.v2beta.ContainerStartedEvent]. + ContainerStartedEvent container_started = 22; + + // See + // [google.cloud.lifesciences.v2beta.ContainerStoppedEvent][google.cloud.lifesciences.v2beta.ContainerStoppedEvent]. + ContainerStoppedEvent container_stopped = 23; + + // See + // [google.cloud.lifesciences.v2beta.ContainerKilledEvent][google.cloud.lifesciences.v2beta.ContainerKilledEvent]. + ContainerKilledEvent container_killed = 24; + + // See + // [google.cloud.lifesciences.v2beta.UnexpectedExitStatusEvent][google.cloud.lifesciences.v2beta.UnexpectedExitStatusEvent]. + UnexpectedExitStatusEvent unexpected_exit_status = 25; + + // See + // [google.cloud.lifesciences.v2beta.FailedEvent][google.cloud.lifesciences.v2beta.FailedEvent]. + FailedEvent failed = 26; + } +} + +// An event generated whenever a resource limitation or transient error +// delays execution of a pipeline that was otherwise ready to run. +message DelayedEvent { + // A textual description of the cause of the delay. The string can change + // without notice because it is often generated by another service (such as + // Compute Engine). + string cause = 1; + + // If the delay was caused by a resource shortage, this field lists the + // Compute Engine metrics that are preventing this operation from running + // (for example, `CPUS` or `INSTANCES`). If the particular metric is not + // known, a single `UNKNOWN` metric will be present. + repeated string metrics = 2; +} + +// An event generated after a worker VM has been assigned to run the +// pipeline. +message WorkerAssignedEvent { + // The zone the worker is running in. + string zone = 1; + + // The worker's instance name. + string instance = 2; + + // The machine type that was assigned for the worker. + string machine_type = 3; +} + +// An event generated when the worker VM that was assigned to the pipeline +// has been released (deleted). +message WorkerReleasedEvent { + // The zone the worker was running in. + string zone = 1; + + // The worker's instance name. + string instance = 2; +} + +// An event generated when the worker starts pulling an image. +message PullStartedEvent { + // The URI of the image that was pulled. + string image_uri = 1; +} + +// An event generated when the worker stops pulling an image. +message PullStoppedEvent { + // The URI of the image that was pulled. + string image_uri = 1; +} + +// An event generated when a container starts. +message ContainerStartedEvent { + // The numeric ID of the action that started this container. + int32 action_id = 1; + + // The container-to-host port mappings installed for this container. This + // set will contain any ports exposed using the `PUBLISH_EXPOSED_PORTS` flag + // as well as any specified in the `Action` definition. + map port_mappings = 2; + + // The public IP address that can be used to connect to the container. This + // field is only populated when at least one port mapping is present. If the + // instance was created with a private address, this field will be empty even + // if port mappings exist. + string ip_address = 3; +} + +// An event generated when a container exits. +message ContainerStoppedEvent { + // The numeric ID of the action that started this container. + int32 action_id = 1; + + // The exit status of the container. + int32 exit_status = 2; + + // The tail end of any content written to standard error by the container. + // If the content emits large amounts of debugging noise or contains + // sensitive information, you can prevent the content from being printed by + // setting the `DISABLE_STANDARD_ERROR_CAPTURE` flag. + // + // Note that only a small amount of the end of the stream is captured here. + // The entire stream is stored in the `/google/logs` directory mounted into + // each action, and can be copied off the machine as described elsewhere. + string stderr = 3; +} + +// An event generated when the execution of a container results in a +// non-zero exit status that was not otherwise ignored. Execution will +// continue, but only actions that are flagged as `ALWAYS_RUN` will be +// executed. Other actions will be skipped. +message UnexpectedExitStatusEvent { + // The numeric ID of the action that started the container. + int32 action_id = 1; + + // The exit status of the container. + int32 exit_status = 2; +} + +// An event generated when a container is forcibly terminated by the +// worker. Currently, this only occurs when the container outlives the +// timeout specified by the user. +message ContainerKilledEvent { + // The numeric ID of the action that started the container. + int32 action_id = 1; +} + +// An event generated when the execution of a pipeline has failed. Note +// that other events can continue to occur after this event. +message FailedEvent { + // The Google standard error code that best describes this failure. + google.rpc.Code code = 1; + + // The human-readable description of the cause of the failure. + string cause = 2; +} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/snippet_metadata_google.cloud.lifesciences.v2beta.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/snippet_metadata_google.cloud.lifesciences.v2beta.json new file mode 100644 index 00000000000..3785dc98d68 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/snippet_metadata_google.cloud.lifesciences.v2beta.json @@ -0,0 +1,67 @@ +{ + "clientLibrary": { + "name": "nodejs-lifesciences", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.lifesciences.v2beta", + "version": "v2beta" + } + ] + }, + "snippets": [ + { + "regionTag": "lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async", + "title": "WorkflowsServiceV2Beta runPipeline Sample", + "origin": "API_DEFINITION", + "description": " Runs a pipeline. The returned Operation's [metadata] [google.longrunning.Operation.metadata] field will contain a [google.cloud.lifesciences.v2beta.Metadata][google.cloud.lifesciences.v2beta.Metadata] object describing the status of the pipeline execution. The [response][google.longrunning.Operation.response] field will contain a [google.cloud.lifesciences.v2beta.RunPipelineResponse][google.cloud.lifesciences.v2beta.RunPipelineResponse] object if the pipeline completes successfully. **Note:** Before you can use this method, the *Life Sciences Service Agent* must have access to your project. This is done automatically when the Cloud Life Sciences API is first enabled, but if you delete this permission you must disable and re-enable the API to grant the Life Sciences Service Agent the required permissions. Authorization requires the following [Google IAM](https://cloud.google.com/iam/) permission: * `lifesciences.workflows.run`", + "canonical": true, + "file": "workflows_service_v2_beta.run_pipeline.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RunPipeline", + "fullName": "google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta.RunPipeline", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "pipeline", + "type": ".google.cloud.lifesciences.v2beta.Pipeline" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "pub_sub_topic", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkflowsServiceV2BetaClient", + "fullName": "google.cloud.lifesciences.v2beta.WorkflowsServiceV2BetaClient" + }, + "method": { + "shortName": "RunPipeline", + "fullName": "google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta.RunPipeline", + "service": { + "shortName": "WorkflowsServiceV2Beta", + "fullName": "google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js new file mode 100644 index 00000000000..e6d6edf42b1 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.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(pipeline) { + // [START lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The project and location that this request should be executed against. + */ + // const parent = 'abc123' + /** + * Required. The description of the pipeline to run. + */ + // const pipeline = {} + /** + * User-defined labels to associate with the returned operation. These + * labels are not propagated to any Google Cloud Platform resources used by + * the operation, and can be modified at any time. + * To associate labels with resources created while executing the operation, + * see the appropriate resource message (for example, `VirtualMachine`). + */ + // const labels = [1,2,3,4] + /** + * The name of an existing Pub/Sub topic. The server will publish + * messages to this topic whenever the status of the operation changes. + * The Life Sciences Service Agent account must have publisher permissions to + * the specified topic or notifications will not be sent. + */ + // const pubSubTopic = 'abc123' + + // Imports the Lifesciences library + const {WorkflowsServiceV2BetaClient} = require('@google-cloud/life-sciences').v2beta; + + // Instantiates a client + const lifesciencesClient = new WorkflowsServiceV2BetaClient(); + + async function callRunPipeline() { + // Construct request + const request = { + pipeline, + }; + + // Run request + const [operation] = await lifesciencesClient.runPipeline(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRunPipeline(); + // [END lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_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-lifesciences/v2beta/src/index.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/index.ts new file mode 100644 index 00000000000..1957bdc6074 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/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 v2beta from './v2beta'; +const WorkflowsServiceV2BetaClient = v2beta.WorkflowsServiceV2BetaClient; +type WorkflowsServiceV2BetaClient = v2beta.WorkflowsServiceV2BetaClient; +export {v2beta, WorkflowsServiceV2BetaClient}; +export default {v2beta, WorkflowsServiceV2BetaClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/gapic_metadata.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/gapic_metadata.json new file mode 100644 index 00000000000..443e9dc9c80 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/gapic_metadata.json @@ -0,0 +1,33 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.lifesciences.v2beta", + "libraryPackage": "@google-cloud/life-sciences", + "services": { + "WorkflowsServiceV2Beta": { + "clients": { + "grpc": { + "libraryClient": "WorkflowsServiceV2BetaClient", + "rpcs": { + "RunPipeline": { + "methods": [ + "runPipeline" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "WorkflowsServiceV2BetaClient", + "rpcs": { + "RunPipeline": { + "methods": [ + "runPipeline" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/index.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/index.ts new file mode 100644 index 00000000000..ee7dd34b610 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/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 {WorkflowsServiceV2BetaClient} from './workflows_service_v2_beta_client'; diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts new file mode 100644 index 00000000000..96ac33824f3 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts @@ -0,0 +1,714 @@ +// 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, GrpcClientOptions, LROperation, LocationsClient, LocationProtos} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta/workflows_service_v2_beta_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './workflows_service_v2_beta_client_config.json'; +const version = require('../../../package.json').version; + +/** + * A service for running workflows, such as pipelines consisting of Docker + * containers. + * @class + * @memberof v2beta + */ +export class WorkflowsServiceV2BetaClient { + 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}; + locationsClient: LocationsClient; + operationsClient: gax.OperationsClient; + workflowsServiceV2BetaStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of WorkflowsServiceV2BetaClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 WorkflowsServiceV2BetaClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof WorkflowsServiceV2BetaClient; + 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + 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); + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2beta/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2beta/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2beta/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v2beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v2beta/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const runPipelineResponse = protoFilesRoot.lookup( + '.google.cloud.lifesciences.v2beta.RunPipelineResponse') as gax.protobuf.Type; + const runPipelineMetadata = protoFilesRoot.lookup( + '.google.cloud.lifesciences.v2beta.Metadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + runPipeline: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + runPipelineResponse.decode.bind(runPipelineResponse), + runPipelineMetadata.decode.bind(runPipelineMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta', 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.workflowsServiceV2BetaStub) { + return this.workflowsServiceV2BetaStub; + } + + // Put together the "service stub" for + // google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta. + this.workflowsServiceV2BetaStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta, + 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 workflowsServiceV2BetaStubMethods = + ['runPipeline']; + for (const methodName of workflowsServiceV2BetaStubMethods) { + const callPromise = this.workflowsServiceV2BetaStub.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.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.workflowsServiceV2BetaStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'lifesciences.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 'lifesciences.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 -- + // ------------------- + +/** + * Runs a pipeline. The returned Operation's [metadata] + * [google.longrunning.Operation.metadata] field will contain a + * {@link protos.google.cloud.lifesciences.v2beta.Metadata|google.cloud.lifesciences.v2beta.Metadata} + * object describing the status of the pipeline execution. The + * {@link protos.google.longrunning.Operation.response|response} field will contain a + * {@link protos.google.cloud.lifesciences.v2beta.RunPipelineResponse|google.cloud.lifesciences.v2beta.RunPipelineResponse} + * object if the pipeline completes successfully. + * + * **Note:** Before you can use this method, the *Life Sciences Service Agent* + * must have access to your project. This is done automatically when the + * Cloud Life Sciences API is first enabled, but if you delete this permission + * you must disable and re-enable the API to grant the Life Sciences + * Service Agent the required permissions. + * Authorization requires the following [Google + * IAM](https://cloud.google.com/iam/) permission: + * + * * `lifesciences.workflows.run` + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The project and location that this request should be executed against. + * @param {google.cloud.lifesciences.v2beta.Pipeline} request.pipeline + * Required. The description of the pipeline to run. + * @param {number[]} request.labels + * User-defined labels to associate with the returned operation. These + * labels are not propagated to any Google Cloud Platform resources used by + * the operation, and can be modified at any time. + * + * To associate labels with resources created while executing the operation, + * see the appropriate resource message (for example, `VirtualMachine`). + * @param {string} request.pubSubTopic + * The name of an existing Pub/Sub topic. The server will publish + * messages to this topic whenever the status of the operation changes. + * The Life Sciences Service Agent account must have publisher permissions to + * the specified topic or notifications will not be sent. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js + * region_tag:lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async + */ + runPipeline( + request?: protos.google.cloud.lifesciences.v2beta.IRunPipelineRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + runPipeline( + request: protos.google.cloud.lifesciences.v2beta.IRunPipelineRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runPipeline( + request: protos.google.cloud.lifesciences.v2beta.IRunPipelineRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runPipeline( + request?: protos.google.cloud.lifesciences.v2beta.IRunPipelineRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.runPipeline(request, options, callback); + } +/** + * Check the status of the long running operation returned by `runPipeline()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js + * region_tag:lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async + */ + async checkRunPipelineProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runPipeline, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(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.workflowsServiceV2BetaStub && !this._terminated) { + return this.workflowsServiceV2BetaStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client_config.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client_config.json new file mode 100644 index 00000000000..9c8434c1b8d --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta": { + "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": { + "RunPipeline": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_proto_list.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_proto_list.json new file mode 100644 index 00000000000..b8302b0ea69 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/lifesciences/v2beta/workflows.proto" +] diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..0076cf26656 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/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 lifesciences = require('@google-cloud/life-sciences'); + +function main() { + const workflowsServiceV2BetaClient = new lifesciences.WorkflowsServiceV2BetaClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..6c8d3f3a893 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/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 {WorkflowsServiceV2BetaClient} from '@google-cloud/life-sciences'; + +// check that the client class type name can be used +function doStuffWithWorkflowsServiceV2BetaClient(client: WorkflowsServiceV2BetaClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const workflowsServiceV2BetaClient = new WorkflowsServiceV2BetaClient(); + doStuffWithWorkflowsServiceV2BetaClient(workflowsServiceV2BetaClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/install.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/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-lifesciences/v2beta/test/gapic_workflows_service_v2_beta_v2beta.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/test/gapic_workflows_service_v2_beta_v2beta.ts new file mode 100644 index 00000000000..ac1c16f373d --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/test/gapic_workflows_service_v2_beta_v2beta.ts @@ -0,0 +1,757 @@ +// 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 workflowsservicev2betaModule from '../src'; + +import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function 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('v2beta.WorkflowsServiceV2BetaClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsServiceV2BetaStub, undefined); + await client.initialize(); + assert(client.workflowsServiceV2BetaStub); + }); + + it('has close method for the initialized client', done => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.workflowsServiceV2BetaStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsServiceV2BetaStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + 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 workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + 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('runPipeline', () => { + it('invokes runPipeline without error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.lifesciences.v2beta.RunPipelineRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.lifesciences.v2beta.RunPipelineRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.runPipeline = stubLongRunningCall(expectedResponse); + const [operation] = await client.runPipeline(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.runPipeline as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runPipeline as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runPipeline without error using callback', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.lifesciences.v2beta.RunPipelineRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.lifesciences.v2beta.RunPipelineRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.runPipeline = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.runPipeline( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.runPipeline as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runPipeline as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runPipeline with call error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.lifesciences.v2beta.RunPipelineRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.lifesciences.v2beta.RunPipelineRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runPipeline = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.runPipeline(request), expectedError); + const actualRequest = (client.innerApiCalls.runPipeline as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runPipeline as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runPipeline with LRO error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.lifesciences.v2beta.RunPipelineRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.lifesciences.v2beta.RunPipelineRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runPipeline = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.runPipeline(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.runPipeline as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runPipeline as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRunPipelineProgress without error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRunPipelineProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRunPipelineProgress with error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRunPipelineProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/tsconfig.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/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-lifesciences/v2beta/webpack.config.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/webpack.config.js new file mode 100644 index 00000000000..e7f6079e4d2 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/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: 'WorkflowsServiceV2Beta', + filename: './workflows-service-v2-beta.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-managedidentities/v1/.eslintignore b/owl-bot-staging/google-cloud-managedidentities/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/.eslintrc.json b/owl-bot-staging/google-cloud-managedidentities/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/.gitignore b/owl-bot-staging/google-cloud-managedidentities/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1/.jsdoc.js b/owl-bot-staging/google-cloud-managedidentities/v1/.jsdoc.js new file mode 100644 index 00000000000..fe671cd4e4e --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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/managed-identities', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/.mocharc.js b/owl-bot-staging/google-cloud-managedidentities/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1/.prettierrc.js b/owl-bot-staging/google-cloud-managedidentities/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1/README.md b/owl-bot-staging/google-cloud-managedidentities/v1/README.md new file mode 100644 index 00000000000..94f33d69900 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/README.md @@ -0,0 +1 @@ +Managedidentities: Nodejs Client diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/package.json b/owl-bot-staging/google-cloud-managedidentities/v1/package.json new file mode 100644 index 00000000000..fa591ecc6c5 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/managed-identities", + "version": "0.1.0", + "description": "Managedidentities client for Node.js", + "repository": "googleapis/nodejs-managedidentities", + "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 managedidentities", + "managedidentities", + "managed identities service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/protos/google/cloud/managedidentities/v1/managed_identities_service.proto b/owl-bot-staging/google-cloud-managedidentities/v1/protos/google/cloud/managedidentities/v1/managed_identities_service.proto new file mode 100644 index 00000000000..3a8d14ef1df --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/protos/google/cloud/managedidentities/v1/managed_identities_service.proto @@ -0,0 +1,422 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.managedidentities.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/managedidentities/v1/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ManagedIdentities.V1"; +option go_package = "cloud.google.com/go/managedidentities/apiv1/managedidentitiespb;managedidentitiespb"; +option java_multiple_files = true; +option java_outer_classname = "ManagedIdentitiesServiceProto"; +option java_package = "com.google.cloud.managedidentities.v1"; +option objc_class_prefix = "GCMI"; +option php_namespace = "Google\\Cloud\\ManagedIdentities\\V1"; +option ruby_package = "Google::Cloud::ManagedIdentities::V1"; + +// API Overview +// +// The `managedidentites.googleapis.com` service implements the Google Cloud +// Managed Identites API for identity services +// (e.g. Microsoft Active Directory). +// +// The Managed Identities service provides methods to manage +// (create/read/update/delete) domains, reset managed identities admin password, +// add/remove domain controllers in GCP regions and add/remove VPC peering. +// +// Data Model +// +// The Managed Identities service exposes the following resources: +// +// * Locations as global, named as follows: +// `projects/{project_id}/locations/global`. +// +// * Domains, named as follows: +// `/projects/{project_id}/locations/global/domain/{domain_name}`. +// +// The `{domain_name}` refers to fully qualified domain name in the customer +// project e.g. mydomain.myorganization.com, with the following restrictions: +// +// * Must contain only lowercase letters, numbers, periods and hyphens. +// * Must start with a letter. +// * Must contain between 2-64 characters. +// * Must end with a number or a letter. +// * Must not start with period. +// * First segement length (mydomain form example above) shouldn't exceed +// 15 chars. +// * The last segment cannot be fully numeric. +// * Must be unique within the customer project. +service ManagedIdentitiesService { + option (google.api.default_host) = "managedidentities.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a Microsoft AD domain. + rpc CreateMicrosoftAdDomain(CreateMicrosoftAdDomainRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/global}/domains" + body: "domain" + }; + option (google.api.method_signature) = "parent,domain_name,domain"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Resets a domain's administrator password. + rpc ResetAdminPassword(ResetAdminPasswordRequest) returns (ResetAdminPasswordResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/global/domains/*}:resetAdminPassword" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Lists domains in a project. + rpc ListDomains(ListDomainsRequest) returns (ListDomainsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/global}/domains" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets information about a domain. + rpc GetDomain(GetDomainRequest) returns (Domain) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/global/domains/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the metadata and configuration of a domain. + rpc UpdateDomain(UpdateDomainRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{domain.name=projects/*/locations/global/domains/*}" + body: "domain" + }; + option (google.api.method_signature) = "domain,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Deletes a domain. + rpc DeleteDomain(DeleteDomainRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/global/domains/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OpMetadata" + }; + } + + // Adds an AD trust to a domain. + rpc AttachTrust(AttachTrustRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/global/domains/*}:attachTrust" + body: "*" + }; + option (google.api.method_signature) = "name,trust"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Updates the DNS conditional forwarder. + rpc ReconfigureTrust(ReconfigureTrustRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/global/domains/*}:reconfigureTrust" + body: "*" + }; + option (google.api.method_signature) = "name,target_domain_name,target_dns_ip_addresses"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Removes an AD trust. + rpc DetachTrust(DetachTrustRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/global/domains/*}:detachTrust" + body: "*" + }; + option (google.api.method_signature) = "name,trust"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Validates a trust state, that the target domain is reachable, and that the + // target domain is able to accept incoming trust requests. + rpc ValidateTrust(ValidateTrustRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/global/domains/*}:validateTrust" + body: "*" + }; + option (google.api.method_signature) = "name,trust"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } +} + +// Represents the metadata of the long-running operation. +message OpMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool requested_cancellation = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for +// [CreateMicrosoftAdDomain][google.cloud.managedidentities.v1.CreateMicrosoftAdDomain] +message CreateMicrosoftAdDomainRequest { + // Required. The resource project name and location using the form: + // `projects/{project_id}/locations/global` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The fully qualified domain name. + // e.g. mydomain.myorganization.com, with the following restrictions: + // + // * Must contain only lowercase letters, numbers, periods and hyphens. + // * Must start with a letter. + // * Must contain between 2-64 characters. + // * Must end with a number or a letter. + // * Must not start with period. + // * First segement length (mydomain form example above) shouldn't exceed + // 15 chars. + // * The last segment cannot be fully numeric. + // * Must be unique within the customer project. + string domain_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A Managed Identity domain resource. + Domain domain = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [ResetAdminPassword][google.cloud.managedidentities.v1.ResetAdminPassword] +message ResetAdminPasswordRequest { + // Required. The domain resource name using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; +} + +// Response message for +// [ResetAdminPassword][google.cloud.managedidentities.v1.ResetAdminPassword] +message ResetAdminPasswordResponse { + // A random password. See [admin][google.cloud.managedidentities.v1.Domain.admin] for more information. + string password = 1; +} + +// Request message for +// [ListDomains][google.cloud.managedidentities.v1.ListDomains] +message ListDomainsRequest { + // Required. The resource name of the domain location using the form: + // `projects/{project_id}/locations/global` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Optional. The maximum number of items to return. + // If not specified, a default value of 1000 will be used. + // Regardless of the page_size value, the response may include a partial list. + // Callers should rely on a response's + // [next_page_token][google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token] + // to determine if there are additional results to list. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The `next_page_token` value returned from a previous ListDomainsRequest + // request, if any. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A filter specifying constraints of a list operation. + // For example, `Domain.fqdn="mydomain.myorginization"`. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the ordering of results. See + // [Sorting + // order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + // for more information. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [ListDomains][google.cloud.managedidentities.v1.ListDomains] +message ListDomainsResponse { + // A list of Managed Identities Service domains in the project. + repeated Domain domains = 1; + + // A token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; + + // A list of locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for [GetDomain][google.cloud.managedidentities.v1.GetDomain] +message GetDomainRequest { + // Required. The domain resource name using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; +} + +// Request message for +// [UpdateDomain][google.cloud.managedidentities.v1.UpdateDomain] +message UpdateDomainRequest { + // Required. Mask of fields to update. At least one path must be supplied in this + // field. The elements of the repeated paths field may only include + // fields from [Domain][google.cloud.managedidentities.v1.Domain]: + // * `labels` + // * `locations` + // * `authorized_networks` + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Domain message with updated fields. Only supported fields specified in + // update_mask are updated. + Domain domain = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [DeleteDomain][google.cloud.managedidentities.v1.DeleteDomain] +message DeleteDomainRequest { + // Required. The domain resource name using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; +} + +// Request message for +// [AttachTrust][google.cloud.managedidentities.v1.AttachTrust] +message AttachTrustRequest { + // Required. The resource domain name, project name and location using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The domain trust resource. + Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [ReconfigureTrust][google.cloud.managedidentities.v1.ReconfigureTrust] +message ReconfigureTrustRequest { + // Required. The resource domain name, project name and location using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The fully-qualified target domain name which will be in trust with current + // domain. + string target_domain_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The target DNS server IP addresses to resolve the remote domain involved + // in the trust. + repeated string target_dns_ip_addresses = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [DetachTrust][google.cloud.managedidentities.v1.DetachTrust] +message DetachTrustRequest { + // Required. The resource domain name, project name, and location using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The domain trust resource to removed. + Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [ValidateTrust][google.cloud.managedidentities.v1.ValidateTrust] +message ValidateTrustRequest { + // Required. The resource domain name, project name, and location using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The domain trust to validate trust state for. + Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/protos/google/cloud/managedidentities/v1/resource.proto b/owl-bot-staging/google-cloud-managedidentities/v1/protos/google/cloud/managedidentities/v1/resource.proto new file mode 100644 index 00000000000..f03917ca0d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/protos/google/cloud/managedidentities/v1/resource.proto @@ -0,0 +1,212 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.managedidentities.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ManagedIdentities.V1"; +option go_package = "cloud.google.com/go/managedidentities/apiv1/managedidentitiespb;managedidentitiespb"; +option java_multiple_files = true; +option java_outer_classname = "ResourceProto"; +option java_package = "com.google.cloud.managedidentities.v1"; +option php_namespace = "Google\\Cloud\\ManagedIdentities\\V1"; +option ruby_package = "Google::Cloud::ManagedIdentities::V1"; + +// Represents a managed Microsoft Active Directory domain. +message Domain { + option (google.api.resource) = { + type: "managedidentities.googleapis.com/Domain" + pattern: "projects/{project}/locations/{location}/domains/{domain}" + }; + + // Represents the different states of a managed domain. + enum State { + // Not set. + STATE_UNSPECIFIED = 0; + + // The domain is being created. + CREATING = 1; + + // The domain has been created and is fully usable. + READY = 2; + + // The domain's configuration is being updated. + UPDATING = 3; + + // The domain is being deleted. + DELETING = 4; + + // The domain is being repaired and may be unusable. Details + // can be found in the `status_message` field. + REPAIRING = 5; + + // The domain is undergoing maintenance. + PERFORMING_MAINTENANCE = 6; + + // The domain is not serving requests. + UNAVAILABLE = 7; + } + + // Required. The unique name of the domain using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}`. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Resource labels that can contain user-provided metadata. + map labels = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The full names of the Google Compute Engine + // [networks](/compute/docs/networks-and-firewalls#networks) the domain + // instance is connected to. Networks can be added using UpdateDomain. + // The domain is only available on networks listed in `authorized_networks`. + // If CIDR subnets overlap between networks, domain creation will fail. + repeated string authorized_networks = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The CIDR range of internal addresses that are reserved for this + // domain. Reserved networks must be /24 or larger. Ranges must be + // unique and non-overlapping with existing subnets in + // [Domain].[authorized_networks]. + string reserved_ip_range = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. Locations where domain needs to be provisioned. + // [regions][compute/docs/regions-zones/] + // e.g. us-west1 or us-east4 + // Service supports up to 4 locations at once. Each location will use a /26 + // block. + repeated string locations = 5 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The name of delegated administrator account used to perform + // Active Directory operations. If not specified, `setupadmin` will be used. + string admin = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The fully-qualified domain name of the exposed domain used by + // clients to connect to the service. Similar to what would be chosen for an + // Active Directory set up on an internal network. + string fqdn = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the instance was created. + google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update time. + google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of this domain. + State state = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current status of this + // domain, if available. + string status_message = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current trusts associated with the domain. + repeated Trust trusts = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents a relationship between two domains. This allows a controller in +// one domain to authenticate a user in another domain. +message Trust { + // Represents the different states of a domain trust. + enum State { + // Not set. + STATE_UNSPECIFIED = 0; + + // The domain trust is being created. + CREATING = 1; + + // The domain trust is being updated. + UPDATING = 2; + + // The domain trust is being deleted. + DELETING = 3; + + // The domain trust is connected. + CONNECTED = 4; + + // The domain trust is disconnected. + DISCONNECTED = 5; + } + + // Represents the different inter-forest trust types. + enum TrustType { + // Not set. + TRUST_TYPE_UNSPECIFIED = 0; + + // The forest trust. + FOREST = 1; + + // The external domain trust. + EXTERNAL = 2; + } + + // Represents the direction of trust. + // See + // [System.DirectoryServices.ActiveDirectory.TrustDirection](https://docs.microsoft.com/en-us/dotnet/api/system.directoryservices.activedirectory.trustdirection?view=netframework-4.7.2) + // for more information. + enum TrustDirection { + // Not set. + TRUST_DIRECTION_UNSPECIFIED = 0; + + // The inbound direction represents the trusting side. + INBOUND = 1; + + // The outboud direction represents the trusted side. + OUTBOUND = 2; + + // The bidirectional direction represents the trusted / trusting side. + BIDIRECTIONAL = 3; + } + + // Required. The fully qualified target domain name which will be in trust with the + // current domain. + string target_domain_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The type of trust represented by the trust resource. + TrustType trust_type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The trust direction, which decides if the current domain is trusted, + // trusting, or both. + TrustDirection trust_direction = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The trust authentication type, which decides whether the trusted side has + // forest/domain wide access or selective access to an approved set of + // resources. + bool selective_authentication = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The target DNS server IP addresses which can resolve the remote domain + // involved in the trust. + repeated string target_dns_ip_addresses = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. The trust secret used for the handshake with the target domain. This will + // not be stored. + string trust_handshake_secret = 6 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The time the instance was created. + google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update time. + google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the trust. + State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current state of the trust, if available. + string state_description = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last heartbeat time when the trust was known to be connected. + google.protobuf.Timestamp last_trust_heartbeat_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.attach_trust.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.attach_trust.js new file mode 100644 index 00000000000..1e14de62219 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.attach_trust.js @@ -0,0 +1,68 @@ +// 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, trust) { + // [START managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_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 domain name, project name and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + /** + * Required. The domain trust resource. + */ + // const trust = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callAttachTrust() { + // Construct request + const request = { + name, + trust, + }; + + // Run request + const [operation] = await managedidentitiesClient.attachTrust(request); + const [response] = await operation.promise(); + console.log(response); + } + + callAttachTrust(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_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-managedidentities/v1/samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js new file mode 100644 index 00000000000..223036e6fee --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js @@ -0,0 +1,83 @@ +// 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, domainName, domain) { + // [START managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_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 project name and location using the form: + * `projects/{project_id}/locations/global` + */ + // const parent = 'abc123' + /** + * Required. The fully qualified domain name. + * e.g. mydomain.myorganization.com, with the following restrictions: + * * Must contain only lowercase letters, numbers, periods and hyphens. + * * Must start with a letter. + * * Must contain between 2-64 characters. + * * Must end with a number or a letter. + * * Must not start with period. + * * First segement length (mydomain form example above) shouldn't exceed + * 15 chars. + * * The last segment cannot be fully numeric. + * * Must be unique within the customer project. + */ + // const domainName = 'abc123' + /** + * Required. A Managed Identity domain resource. + */ + // const domain = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callCreateMicrosoftAdDomain() { + // Construct request + const request = { + parent, + domainName, + domain, + }; + + // Run request + const [operation] = await managedidentitiesClient.createMicrosoftAdDomain(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateMicrosoftAdDomain(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_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-managedidentities/v1/samples/generated/v1/managed_identities_service.delete_domain.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.delete_domain.js new file mode 100644 index 00000000000..556030402d0 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.delete_domain.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 managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_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 domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callDeleteDomain() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await managedidentitiesClient.deleteDomain(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteDomain(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_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-managedidentities/v1/samples/generated/v1/managed_identities_service.detach_trust.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.detach_trust.js new file mode 100644 index 00000000000..dcf2546599f --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.detach_trust.js @@ -0,0 +1,68 @@ +// 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, trust) { + // [START managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_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 domain name, project name, and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + /** + * Required. The domain trust resource to removed. + */ + // const trust = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callDetachTrust() { + // Construct request + const request = { + name, + trust, + }; + + // Run request + const [operation] = await managedidentitiesClient.detachTrust(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDetachTrust(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_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-managedidentities/v1/samples/generated/v1/managed_identities_service.get_domain.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.get_domain.js new file mode 100644 index 00000000000..6b19f68c1c9 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.get_domain.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 managedidentities_v1_generated_ManagedIdentitiesService_GetDomain_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 domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callGetDomain() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await managedidentitiesClient.getDomain(request); + console.log(response); + } + + callGetDomain(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_GetDomain_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-managedidentities/v1/samples/generated/v1/managed_identities_service.list_domains.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.list_domains.js new file mode 100644 index 00000000000..eecf2cc4103 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.list_domains.js @@ -0,0 +1,90 @@ +// 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 managedidentities_v1_generated_ManagedIdentitiesService_ListDomains_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the domain location using the form: + * `projects/{project_id}/locations/global` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return. + * If not specified, a default value of 1000 will be used. + * Regardless of the page_size value, the response may include a partial list. + * Callers should rely on a response's + * next_page_token google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token + * to determine if there are additional results to list. + */ + // const pageSize = 1234 + /** + * Optional. The `next_page_token` value returned from a previous ListDomainsRequest + * request, if any. + */ + // const pageToken = 'abc123' + /** + * Optional. A filter specifying constraints of a list operation. + * For example, `Domain.fqdn="mydomain.myorginization"`. + */ + // const filter = 'abc123' + /** + * Optional. Specifies the ordering of results. See + * Sorting + * order (https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + */ + // const orderBy = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callListDomains() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await managedidentitiesClient.listDomainsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDomains(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_ListDomains_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-managedidentities/v1/samples/generated/v1/managed_identities_service.reconfigure_trust.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.reconfigure_trust.js new file mode 100644 index 00000000000..2a1cea1709d --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.reconfigure_trust.js @@ -0,0 +1,75 @@ +// 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, targetDomainName, targetDnsIpAddresses) { + // [START managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_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 domain name, project name and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + /** + * Required. The fully-qualified target domain name which will be in trust with current + * domain. + */ + // const targetDomainName = 'abc123' + /** + * Required. The target DNS server IP addresses to resolve the remote domain involved + * in the trust. + */ + // const targetDnsIpAddresses = ['abc','def'] + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callReconfigureTrust() { + // Construct request + const request = { + name, + targetDomainName, + targetDnsIpAddresses, + }; + + // Run request + const [operation] = await managedidentitiesClient.reconfigureTrust(request); + const [response] = await operation.promise(); + console.log(response); + } + + callReconfigureTrust(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_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-managedidentities/v1/samples/generated/v1/managed_identities_service.reset_admin_password.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.reset_admin_password.js new file mode 100644 index 00000000000..2ac2b42ab8e --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.reset_admin_password.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 managedidentities_v1_generated_ManagedIdentitiesService_ResetAdminPassword_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 domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callResetAdminPassword() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await managedidentitiesClient.resetAdminPassword(request); + console.log(response); + } + + callResetAdminPassword(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_ResetAdminPassword_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-managedidentities/v1/samples/generated/v1/managed_identities_service.update_domain.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.update_domain.js new file mode 100644 index 00000000000..264f1dcab68 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.update_domain.js @@ -0,0 +1,73 @@ +// 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(updateMask, domain) { + // [START managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_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. Mask of fields to update. At least one path must be supplied in this + * field. The elements of the repeated paths field may only include + * fields from Domain google.cloud.managedidentities.v1.Domain: + * * `labels` + * * `locations` + * * `authorized_networks` + */ + // const updateMask = {} + /** + * Required. Domain message with updated fields. Only supported fields specified in + * update_mask are updated. + */ + // const domain = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callUpdateDomain() { + // Construct request + const request = { + updateMask, + domain, + }; + + // Run request + const [operation] = await managedidentitiesClient.updateDomain(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateDomain(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_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-managedidentities/v1/samples/generated/v1/managed_identities_service.validate_trust.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.validate_trust.js new file mode 100644 index 00000000000..3788dacefd4 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.validate_trust.js @@ -0,0 +1,68 @@ +// 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, trust) { + // [START managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_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 domain name, project name, and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + /** + * Required. The domain trust to validate trust state for. + */ + // const trust = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callValidateTrust() { + // Construct request + const request = { + name, + trust, + }; + + // Run request + const [operation] = await managedidentitiesClient.validateTrust(request); + const [response] = await operation.promise(); + console.log(response); + } + + callValidateTrust(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_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-managedidentities/v1/samples/generated/v1/snippet_metadata_google.cloud.managedidentities.v1.json b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/snippet_metadata_google.cloud.managedidentities.v1.json new file mode 100644 index 00000000000..334c969c455 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/snippet_metadata_google.cloud.managedidentities.v1.json @@ -0,0 +1,463 @@ +{ + "clientLibrary": { + "name": "nodejs-managedidentities", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.managedidentities.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async", + "title": "ManagedIdentitiesService createMicrosoftAdDomain Sample", + "origin": "API_DEFINITION", + "description": " Creates a Microsoft AD domain.", + "canonical": true, + "file": "managed_identities_service.create_microsoft_ad_domain.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateMicrosoftAdDomain", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.CreateMicrosoftAdDomain", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "domain_name", + "type": "TYPE_STRING" + }, + { + "name": "domain", + "type": ".google.cloud.managedidentities.v1.Domain" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "CreateMicrosoftAdDomain", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.CreateMicrosoftAdDomain", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_ResetAdminPassword_async", + "title": "ManagedIdentitiesService resetAdminPassword Sample", + "origin": "API_DEFINITION", + "description": " Resets a domain's administrator password.", + "canonical": true, + "file": "managed_identities_service.reset_admin_password.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ResetAdminPassword", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ResetAdminPassword", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.managedidentities.v1.ResetAdminPasswordResponse", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "ResetAdminPassword", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ResetAdminPassword", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_ListDomains_async", + "title": "ManagedIdentitiesService listDomains Sample", + "origin": "API_DEFINITION", + "description": " Lists domains in a project.", + "canonical": true, + "file": "managed_identities_service.list_domains.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDomains", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ListDomains", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.managedidentities.v1.ListDomainsResponse", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "ListDomains", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ListDomains", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_GetDomain_async", + "title": "ManagedIdentitiesService getDomain Sample", + "origin": "API_DEFINITION", + "description": " Gets information about a domain.", + "canonical": true, + "file": "managed_identities_service.get_domain.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDomain", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.GetDomain", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.managedidentities.v1.Domain", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "GetDomain", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.GetDomain", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_async", + "title": "ManagedIdentitiesService updateDomain Sample", + "origin": "API_DEFINITION", + "description": " Updates the metadata and configuration of a domain.", + "canonical": true, + "file": "managed_identities_service.update_domain.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateDomain", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.UpdateDomain", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "domain", + "type": ".google.cloud.managedidentities.v1.Domain" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "UpdateDomain", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.UpdateDomain", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_async", + "title": "ManagedIdentitiesService deleteDomain Sample", + "origin": "API_DEFINITION", + "description": " Deletes a domain.", + "canonical": true, + "file": "managed_identities_service.delete_domain.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteDomain", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.DeleteDomain", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "DeleteDomain", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.DeleteDomain", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_async", + "title": "ManagedIdentitiesService attachTrust Sample", + "origin": "API_DEFINITION", + "description": " Adds an AD trust to a domain.", + "canonical": true, + "file": "managed_identities_service.attach_trust.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AttachTrust", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.AttachTrust", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "trust", + "type": ".google.cloud.managedidentities.v1.Trust" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "AttachTrust", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.AttachTrust", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_async", + "title": "ManagedIdentitiesService reconfigureTrust Sample", + "origin": "API_DEFINITION", + "description": " Updates the DNS conditional forwarder.", + "canonical": true, + "file": "managed_identities_service.reconfigure_trust.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReconfigureTrust", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ReconfigureTrust", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "target_domain_name", + "type": "TYPE_STRING" + }, + { + "name": "target_dns_ip_addresses", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "ReconfigureTrust", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ReconfigureTrust", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_async", + "title": "ManagedIdentitiesService detachTrust Sample", + "origin": "API_DEFINITION", + "description": " Removes an AD trust.", + "canonical": true, + "file": "managed_identities_service.detach_trust.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DetachTrust", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.DetachTrust", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "trust", + "type": ".google.cloud.managedidentities.v1.Trust" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "DetachTrust", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.DetachTrust", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_async", + "title": "ManagedIdentitiesService validateTrust Sample", + "origin": "API_DEFINITION", + "description": " Validates a trust state, that the target domain is reachable, and that the target domain is able to accept incoming trust requests.", + "canonical": true, + "file": "managed_identities_service.validate_trust.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ValidateTrust", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ValidateTrust", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "trust", + "type": ".google.cloud.managedidentities.v1.Trust" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "ValidateTrust", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ValidateTrust", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/src/index.ts b/owl-bot-staging/google-cloud-managedidentities/v1/src/index.ts new file mode 100644 index 00000000000..5a561f375b1 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/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 v1 from './v1'; +const ManagedIdentitiesServiceClient = v1.ManagedIdentitiesServiceClient; +type ManagedIdentitiesServiceClient = v1.ManagedIdentitiesServiceClient; +export {v1, ManagedIdentitiesServiceClient}; +export default {v1, ManagedIdentitiesServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..f9a5a085c68 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/gapic_metadata.json @@ -0,0 +1,127 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.managedidentities.v1", + "libraryPackage": "@google-cloud/managed-identities", + "services": { + "ManagedIdentitiesService": { + "clients": { + "grpc": { + "libraryClient": "ManagedIdentitiesServiceClient", + "rpcs": { + "ResetAdminPassword": { + "methods": [ + "resetAdminPassword" + ] + }, + "GetDomain": { + "methods": [ + "getDomain" + ] + }, + "CreateMicrosoftAdDomain": { + "methods": [ + "createMicrosoftAdDomain" + ] + }, + "UpdateDomain": { + "methods": [ + "updateDomain" + ] + }, + "DeleteDomain": { + "methods": [ + "deleteDomain" + ] + }, + "AttachTrust": { + "methods": [ + "attachTrust" + ] + }, + "ReconfigureTrust": { + "methods": [ + "reconfigureTrust" + ] + }, + "DetachTrust": { + "methods": [ + "detachTrust" + ] + }, + "ValidateTrust": { + "methods": [ + "validateTrust" + ] + }, + "ListDomains": { + "methods": [ + "listDomains", + "listDomainsStream", + "listDomainsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ManagedIdentitiesServiceClient", + "rpcs": { + "ResetAdminPassword": { + "methods": [ + "resetAdminPassword" + ] + }, + "GetDomain": { + "methods": [ + "getDomain" + ] + }, + "CreateMicrosoftAdDomain": { + "methods": [ + "createMicrosoftAdDomain" + ] + }, + "UpdateDomain": { + "methods": [ + "updateDomain" + ] + }, + "DeleteDomain": { + "methods": [ + "deleteDomain" + ] + }, + "AttachTrust": { + "methods": [ + "attachTrust" + ] + }, + "ReconfigureTrust": { + "methods": [ + "reconfigureTrust" + ] + }, + "DetachTrust": { + "methods": [ + "detachTrust" + ] + }, + "ValidateTrust": { + "methods": [ + "validateTrust" + ] + }, + "ListDomains": { + "methods": [ + "listDomains", + "listDomainsStream", + "listDomainsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/index.ts new file mode 100644 index 00000000000..b8fd8f0320d --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/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 {ManagedIdentitiesServiceClient} from './managed_identities_service_client'; diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_client.ts b/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_client.ts new file mode 100644 index 00000000000..bc5c56f4fb5 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_client.ts @@ -0,0 +1,1574 @@ +// 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, GrpcClientOptions, LROperation, 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/managed_identities_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './managed_identities_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * API Overview + * + * The `managedidentites.googleapis.com` service implements the Google Cloud + * Managed Identites API for identity services + * (e.g. Microsoft Active Directory). + * + * The Managed Identities service provides methods to manage + * (create/read/update/delete) domains, reset managed identities admin password, + * add/remove domain controllers in GCP regions and add/remove VPC peering. + * + * Data Model + * + * The Managed Identities service exposes the following resources: + * + * * Locations as global, named as follows: + * `projects/{project_id}/locations/global`. + * + * * Domains, named as follows: + * `/projects/{project_id}/locations/global/domain/{domain_name}`. + * + * The `{domain_name}` refers to fully qualified domain name in the customer + * project e.g. mydomain.myorganization.com, with the following restrictions: + * + * * Must contain only lowercase letters, numbers, periods and hyphens. + * * Must start with a letter. + * * Must contain between 2-64 characters. + * * Must end with a number or a letter. + * * Must not start with period. + * * First segement length (mydomain form example above) shouldn't exceed + * 15 chars. + * * The last segment cannot be fully numeric. + * * Must be unique within the customer project. + * @class + * @memberof v1 + */ +export class ManagedIdentitiesServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + managedIdentitiesServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ManagedIdentitiesServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 ManagedIdentitiesServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ManagedIdentitiesServiceClient; + 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 { + 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 = { + domainPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/domains/{domain}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // 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 = { + listDomains: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'domains') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/global/domains/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/global/peerings/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/global/domains/*/backups/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/global/domains/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/global/peerings/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/global/domains/*/backups/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/global/domains/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/global/peerings/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/global/domains/*/backups/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/global/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/global/operations}',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createMicrosoftAdDomainResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; + const createMicrosoftAdDomainMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; + const updateDomainResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; + const updateDomainMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; + const deleteDomainResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteDomainMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; + const attachTrustResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; + const attachTrustMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; + const reconfigureTrustResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; + const reconfigureTrustMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; + const detachTrustResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; + const detachTrustMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; + const validateTrustResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; + const validateTrustMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createMicrosoftAdDomain: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createMicrosoftAdDomainResponse.decode.bind(createMicrosoftAdDomainResponse), + createMicrosoftAdDomainMetadata.decode.bind(createMicrosoftAdDomainMetadata)), + updateDomain: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateDomainResponse.decode.bind(updateDomainResponse), + updateDomainMetadata.decode.bind(updateDomainMetadata)), + deleteDomain: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteDomainResponse.decode.bind(deleteDomainResponse), + deleteDomainMetadata.decode.bind(deleteDomainMetadata)), + attachTrust: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + attachTrustResponse.decode.bind(attachTrustResponse), + attachTrustMetadata.decode.bind(attachTrustMetadata)), + reconfigureTrust: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + reconfigureTrustResponse.decode.bind(reconfigureTrustResponse), + reconfigureTrustMetadata.decode.bind(reconfigureTrustMetadata)), + detachTrust: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + detachTrustResponse.decode.bind(detachTrustResponse), + detachTrustMetadata.decode.bind(detachTrustMetadata)), + validateTrust: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + validateTrustResponse.decode.bind(validateTrustResponse), + validateTrustMetadata.decode.bind(validateTrustMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.managedidentities.v1.ManagedIdentitiesService', 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.managedIdentitiesServiceStub) { + return this.managedIdentitiesServiceStub; + } + + // Put together the "service stub" for + // google.cloud.managedidentities.v1.ManagedIdentitiesService. + this.managedIdentitiesServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.managedidentities.v1.ManagedIdentitiesService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.managedidentities.v1.ManagedIdentitiesService, + 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 managedIdentitiesServiceStubMethods = + ['createMicrosoftAdDomain', 'resetAdminPassword', 'listDomains', 'getDomain', 'updateDomain', 'deleteDomain', 'attachTrust', 'reconfigureTrust', 'detachTrust', 'validateTrust']; + for (const methodName of managedIdentitiesServiceStubMethods) { + const callPromise = this.managedIdentitiesServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.managedIdentitiesServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'managedidentities.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 'managedidentities.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 -- + // ------------------- +/** + * Resets a domain's administrator password. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.managedidentities.v1.ResetAdminPasswordResponse|ResetAdminPasswordResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/managed_identities_service.reset_admin_password.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ResetAdminPassword_async + */ + resetAdminPassword( + request?: protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|undefined, {}|undefined + ]>; + resetAdminPassword( + request: protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|null|undefined, + {}|null|undefined>): void; + resetAdminPassword( + request: protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest, + callback: Callback< + protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|null|undefined, + {}|null|undefined>): void; + resetAdminPassword( + request?: protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|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.resetAdminPassword(request, options, callback); + } +/** + * Gets information about a domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.managedidentities.v1.Domain|Domain}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/managed_identities_service.get_domain.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_GetDomain_async + */ + getDomain( + request?: protos.google.cloud.managedidentities.v1.IGetDomainRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.managedidentities.v1.IDomain, + protos.google.cloud.managedidentities.v1.IGetDomainRequest|undefined, {}|undefined + ]>; + getDomain( + request: protos.google.cloud.managedidentities.v1.IGetDomainRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.managedidentities.v1.IDomain, + protos.google.cloud.managedidentities.v1.IGetDomainRequest|null|undefined, + {}|null|undefined>): void; + getDomain( + request: protos.google.cloud.managedidentities.v1.IGetDomainRequest, + callback: Callback< + protos.google.cloud.managedidentities.v1.IDomain, + protos.google.cloud.managedidentities.v1.IGetDomainRequest|null|undefined, + {}|null|undefined>): void; + getDomain( + request?: protos.google.cloud.managedidentities.v1.IGetDomainRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.managedidentities.v1.IDomain, + protos.google.cloud.managedidentities.v1.IGetDomainRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.managedidentities.v1.IDomain, + protos.google.cloud.managedidentities.v1.IGetDomainRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.managedidentities.v1.IDomain, + protos.google.cloud.managedidentities.v1.IGetDomainRequest|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.getDomain(request, options, callback); + } + +/** + * Creates a Microsoft AD domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource project name and location using the form: + * `projects/{project_id}/locations/global` + * @param {string} request.domainName + * Required. The fully qualified domain name. + * e.g. mydomain.myorganization.com, with the following restrictions: + * + * * Must contain only lowercase letters, numbers, periods and hyphens. + * * Must start with a letter. + * * Must contain between 2-64 characters. + * * Must end with a number or a letter. + * * Must not start with period. + * * First segement length (mydomain form example above) shouldn't exceed + * 15 chars. + * * The last segment cannot be fully numeric. + * * Must be unique within the customer project. + * @param {google.cloud.managedidentities.v1.Domain} request.domain + * Required. A Managed Identity domain 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async + */ + createMicrosoftAdDomain( + request?: protos.google.cloud.managedidentities.v1.ICreateMicrosoftAdDomainRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createMicrosoftAdDomain( + request: protos.google.cloud.managedidentities.v1.ICreateMicrosoftAdDomainRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMicrosoftAdDomain( + request: protos.google.cloud.managedidentities.v1.ICreateMicrosoftAdDomainRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMicrosoftAdDomain( + request?: protos.google.cloud.managedidentities.v1.ICreateMicrosoftAdDomainRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createMicrosoftAdDomain(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createMicrosoftAdDomain()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async + */ + async checkCreateMicrosoftAdDomainProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMicrosoftAdDomain, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the metadata and configuration of a domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. At least one path must be supplied in this + * field. The elements of the repeated paths field may only include + * fields from {@link protos.google.cloud.managedidentities.v1.Domain|Domain}: + * * `labels` + * * `locations` + * * `authorized_networks` + * @param {google.cloud.managedidentities.v1.Domain} request.domain + * Required. Domain message with updated fields. Only supported fields specified in + * update_mask are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/managed_identities_service.update_domain.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_async + */ + updateDomain( + request?: protos.google.cloud.managedidentities.v1.IUpdateDomainRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateDomain( + request: protos.google.cloud.managedidentities.v1.IUpdateDomainRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateDomain( + request: protos.google.cloud.managedidentities.v1.IUpdateDomainRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateDomain( + request?: protos.google.cloud.managedidentities.v1.IUpdateDomainRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'domain.name': request.domain!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateDomain(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateDomain()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/managed_identities_service.update_domain.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_async + */ + async checkUpdateDomainProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDomain, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/managed_identities_service.delete_domain.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_async + */ + deleteDomain( + request?: protos.google.cloud.managedidentities.v1.IDeleteDomainRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteDomain( + request: protos.google.cloud.managedidentities.v1.IDeleteDomainRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteDomain( + request: protos.google.cloud.managedidentities.v1.IDeleteDomainRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteDomain( + request?: protos.google.cloud.managedidentities.v1.IDeleteDomainRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteDomain(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteDomain()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/managed_identities_service.delete_domain.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_async + */ + async checkDeleteDomainProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteDomain, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Adds an AD trust to a domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource domain name, project name and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {google.cloud.managedidentities.v1.Trust} request.trust + * Required. The domain trust 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/managed_identities_service.attach_trust.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_async + */ + attachTrust( + request?: protos.google.cloud.managedidentities.v1.IAttachTrustRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + attachTrust( + request: protos.google.cloud.managedidentities.v1.IAttachTrustRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + attachTrust( + request: protos.google.cloud.managedidentities.v1.IAttachTrustRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + attachTrust( + request?: protos.google.cloud.managedidentities.v1.IAttachTrustRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.attachTrust(request, options, callback); + } +/** + * Check the status of the long running operation returned by `attachTrust()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/managed_identities_service.attach_trust.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_async + */ + async checkAttachTrustProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.attachTrust, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the DNS conditional forwarder. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource domain name, project name and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {string} request.targetDomainName + * Required. The fully-qualified target domain name which will be in trust with current + * domain. + * @param {string[]} request.targetDnsIpAddresses + * Required. The target DNS server IP addresses to resolve the remote domain involved + * in the trust. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/managed_identities_service.reconfigure_trust.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_async + */ + reconfigureTrust( + request?: protos.google.cloud.managedidentities.v1.IReconfigureTrustRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + reconfigureTrust( + request: protos.google.cloud.managedidentities.v1.IReconfigureTrustRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + reconfigureTrust( + request: protos.google.cloud.managedidentities.v1.IReconfigureTrustRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + reconfigureTrust( + request?: protos.google.cloud.managedidentities.v1.IReconfigureTrustRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.reconfigureTrust(request, options, callback); + } +/** + * Check the status of the long running operation returned by `reconfigureTrust()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/managed_identities_service.reconfigure_trust.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_async + */ + async checkReconfigureTrustProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.reconfigureTrust, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Removes an AD trust. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource domain name, project name, and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {google.cloud.managedidentities.v1.Trust} request.trust + * Required. The domain trust resource to removed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/managed_identities_service.detach_trust.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_async + */ + detachTrust( + request?: protos.google.cloud.managedidentities.v1.IDetachTrustRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + detachTrust( + request: protos.google.cloud.managedidentities.v1.IDetachTrustRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + detachTrust( + request: protos.google.cloud.managedidentities.v1.IDetachTrustRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + detachTrust( + request?: protos.google.cloud.managedidentities.v1.IDetachTrustRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.detachTrust(request, options, callback); + } +/** + * Check the status of the long running operation returned by `detachTrust()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/managed_identities_service.detach_trust.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_async + */ + async checkDetachTrustProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.detachTrust, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Validates a trust state, that the target domain is reachable, and that the + * target domain is able to accept incoming trust requests. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource domain name, project name, and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {google.cloud.managedidentities.v1.Trust} request.trust + * Required. The domain trust to validate trust state for. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/managed_identities_service.validate_trust.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_async + */ + validateTrust( + request?: protos.google.cloud.managedidentities.v1.IValidateTrustRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + validateTrust( + request: protos.google.cloud.managedidentities.v1.IValidateTrustRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + validateTrust( + request: protos.google.cloud.managedidentities.v1.IValidateTrustRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + validateTrust( + request?: protos.google.cloud.managedidentities.v1.IValidateTrustRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.validateTrust(request, options, callback); + } +/** + * Check the status of the long running operation returned by `validateTrust()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/managed_identities_service.validate_trust.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_async + */ + async checkValidateTrustProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.validateTrust, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists domains in a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the domain location using the form: + * `projects/{project_id}/locations/global` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return. + * If not specified, a default value of 1000 will be used. + * Regardless of the page_size value, the response may include a partial list. + * Callers should rely on a response's + * {@link protos.google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token|next_page_token} + * to determine if there are additional results to list. + * @param {string} [request.pageToken] + * Optional. The `next_page_token` value returned from a previous ListDomainsRequest + * request, if any. + * @param {string} [request.filter] + * Optional. A filter specifying constraints of a list operation. + * For example, `Domain.fqdn="mydomain.myorginization"`. + * @param {string} [request.orderBy] + * Optional. Specifies the ordering of results. See + * [Sorting + * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.managedidentities.v1.Domain|Domain}. + * 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 `listDomainsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDomains( + request?: protos.google.cloud.managedidentities.v1.IListDomainsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.managedidentities.v1.IDomain[], + protos.google.cloud.managedidentities.v1.IListDomainsRequest|null, + protos.google.cloud.managedidentities.v1.IListDomainsResponse + ]>; + listDomains( + request: protos.google.cloud.managedidentities.v1.IListDomainsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.managedidentities.v1.IListDomainsRequest, + protos.google.cloud.managedidentities.v1.IListDomainsResponse|null|undefined, + protos.google.cloud.managedidentities.v1.IDomain>): void; + listDomains( + request: protos.google.cloud.managedidentities.v1.IListDomainsRequest, + callback: PaginationCallback< + protos.google.cloud.managedidentities.v1.IListDomainsRequest, + protos.google.cloud.managedidentities.v1.IListDomainsResponse|null|undefined, + protos.google.cloud.managedidentities.v1.IDomain>): void; + listDomains( + request?: protos.google.cloud.managedidentities.v1.IListDomainsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.managedidentities.v1.IListDomainsRequest, + protos.google.cloud.managedidentities.v1.IListDomainsResponse|null|undefined, + protos.google.cloud.managedidentities.v1.IDomain>, + callback?: PaginationCallback< + protos.google.cloud.managedidentities.v1.IListDomainsRequest, + protos.google.cloud.managedidentities.v1.IListDomainsResponse|null|undefined, + protos.google.cloud.managedidentities.v1.IDomain>): + Promise<[ + protos.google.cloud.managedidentities.v1.IDomain[], + protos.google.cloud.managedidentities.v1.IListDomainsRequest|null, + protos.google.cloud.managedidentities.v1.IListDomainsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listDomains(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the domain location using the form: + * `projects/{project_id}/locations/global` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return. + * If not specified, a default value of 1000 will be used. + * Regardless of the page_size value, the response may include a partial list. + * Callers should rely on a response's + * {@link protos.google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token|next_page_token} + * to determine if there are additional results to list. + * @param {string} [request.pageToken] + * Optional. The `next_page_token` value returned from a previous ListDomainsRequest + * request, if any. + * @param {string} [request.filter] + * Optional. A filter specifying constraints of a list operation. + * For example, `Domain.fqdn="mydomain.myorginization"`. + * @param {string} [request.orderBy] + * Optional. Specifies the ordering of results. See + * [Sorting + * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + * @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 protos.google.cloud.managedidentities.v1.Domain|Domain} 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 `listDomainsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDomainsStream( + request?: protos.google.cloud.managedidentities.v1.IListDomainsRequest, + 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['listDomains']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDomains.createStream( + this.innerApiCalls.listDomains as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listDomains`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the domain location using the form: + * `projects/{project_id}/locations/global` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return. + * If not specified, a default value of 1000 will be used. + * Regardless of the page_size value, the response may include a partial list. + * Callers should rely on a response's + * {@link protos.google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token|next_page_token} + * to determine if there are additional results to list. + * @param {string} [request.pageToken] + * Optional. The `next_page_token` value returned from a previous ListDomainsRequest + * request, if any. + * @param {string} [request.filter] + * Optional. A filter specifying constraints of a list operation. + * For example, `Domain.fqdn="mydomain.myorginization"`. + * @param {string} [request.orderBy] + * Optional. Specifies the ordering of results. See + * [Sorting + * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.managedidentities.v1.Domain|Domain}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/managed_identities_service.list_domains.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ListDomains_async + */ + listDomainsAsync( + request?: protos.google.cloud.managedidentities.v1.IListDomainsRequest, + 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['listDomains']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDomains.asyncIterate( + this.innerApiCalls['listDomains'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified domain resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} domain + * @returns {string} Resource name string. + */ + domainPath(project:string,location:string,domain:string) { + return this.pathTemplates.domainPathTemplate.render({ + project: project, + location: location, + domain: domain, + }); + } + + /** + * Parse the project from Domain resource. + * + * @param {string} domainName + * A fully-qualified path representing Domain resource. + * @returns {string} A string representing the project. + */ + matchProjectFromDomainName(domainName: string) { + return this.pathTemplates.domainPathTemplate.match(domainName).project; + } + + /** + * Parse the location from Domain resource. + * + * @param {string} domainName + * A fully-qualified path representing Domain resource. + * @returns {string} A string representing the location. + */ + matchLocationFromDomainName(domainName: string) { + return this.pathTemplates.domainPathTemplate.match(domainName).location; + } + + /** + * Parse the domain from Domain resource. + * + * @param {string} domainName + * A fully-qualified path representing Domain resource. + * @returns {string} A string representing the domain. + */ + matchDomainFromDomainName(domainName: string) { + return this.pathTemplates.domainPathTemplate.match(domainName).domain; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified 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; + } + + /** + * 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.managedIdentitiesServiceStub && !this._terminated) { + return this.managedIdentitiesServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_client_config.json b/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_client_config.json new file mode 100644 index 00000000000..96889cb3b0d --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_client_config.json @@ -0,0 +1,76 @@ +{ + "interfaces": { + "google.cloud.managedidentities.v1.ManagedIdentitiesService": { + "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": { + "CreateMicrosoftAdDomain": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ResetAdminPassword": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListDomains": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetDomain": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateDomain": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteDomain": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AttachTrust": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ReconfigureTrust": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DetachTrust": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ValidateTrust": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_proto_list.json b/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_proto_list.json new file mode 100644 index 00000000000..6200ede0f78 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/managedidentities/v1/managed_identities_service.proto", + "../../protos/google/cloud/managedidentities/v1/resource.proto" +] diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-managedidentities/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..19557c14fd8 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/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 managedidentities = require('@google-cloud/managed-identities'); + +function main() { + const managedIdentitiesServiceClient = new managedidentities.ManagedIdentitiesServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-managedidentities/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..58efb744a28 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/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 {ManagedIdentitiesServiceClient} from '@google-cloud/managed-identities'; + +// check that the client class type name can be used +function doStuffWithManagedIdentitiesServiceClient(client: ManagedIdentitiesServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const managedIdentitiesServiceClient = new ManagedIdentitiesServiceClient(); + doStuffWithManagedIdentitiesServiceClient(managedIdentitiesServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/system-test/install.ts b/owl-bot-staging/google-cloud-managedidentities/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1/test/gapic_managed_identities_service_v1.ts b/owl-bot-staging/google-cloud-managedidentities/v1/test/gapic_managed_identities_service_v1.ts new file mode 100644 index 00000000000..ca4c29002ed --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1/test/gapic_managed_identities_service_v1.ts @@ -0,0 +1,1873 @@ +// 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 managedidentitiesserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.ManagedIdentitiesServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.managedIdentitiesServiceStub, undefined); + await client.initialize(); + assert(client.managedIdentitiesServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.managedIdentitiesServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.managedIdentitiesServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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 managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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('resetAdminPassword', () => { + it('invokes resetAdminPassword without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ResetAdminPasswordRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ResetAdminPasswordRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ResetAdminPasswordResponse() + ); + client.innerApiCalls.resetAdminPassword = stubSimpleCall(expectedResponse); + const [response] = await client.resetAdminPassword(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetAdminPassword without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ResetAdminPasswordRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ResetAdminPasswordRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ResetAdminPasswordResponse() + ); + client.innerApiCalls.resetAdminPassword = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetAdminPassword( + request, + (err?: Error|null, result?: protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetAdminPassword with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ResetAdminPasswordRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ResetAdminPasswordRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetAdminPassword = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.resetAdminPassword(request), expectedError); + const actualRequest = (client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetAdminPassword with closed client', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ResetAdminPasswordRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ResetAdminPasswordRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.resetAdminPassword(request), expectedError); + }); + }); + + describe('getDomain', () => { + it('invokes getDomain without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.GetDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.GetDomainRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.Domain() + ); + client.innerApiCalls.getDomain = stubSimpleCall(expectedResponse); + const [response] = await client.getDomain(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDomain without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.GetDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.GetDomainRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.Domain() + ); + client.innerApiCalls.getDomain = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDomain( + request, + (err?: Error|null, result?: protos.google.cloud.managedidentities.v1.IDomain|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDomain with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.GetDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.GetDomainRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDomain = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDomain(request), expectedError); + const actualRequest = (client.innerApiCalls.getDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDomain with closed client', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.GetDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.GetDomainRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDomain(request), expectedError); + }); + }); + + describe('createMicrosoftAdDomain', () => { + it('invokes createMicrosoftAdDomain without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(expectedResponse); + const [operation] = await client.createMicrosoftAdDomain(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMicrosoftAdDomain without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMicrosoftAdDomain( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMicrosoftAdDomain with call error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createMicrosoftAdDomain(request), expectedError); + const actualRequest = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMicrosoftAdDomain with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createMicrosoftAdDomain(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateMicrosoftAdDomainProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateMicrosoftAdDomainProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateMicrosoftAdDomainProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateMicrosoftAdDomainProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateDomain', () => { + it('invokes updateDomain without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.UpdateDomainRequest() + ); + request.domain ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.UpdateDomainRequest', ['domain', 'name']); + request.domain.name = defaultValue1; + const expectedHeaderRequestParams = `domain.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateDomain = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateDomain(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDomain without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.UpdateDomainRequest() + ); + request.domain ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.UpdateDomainRequest', ['domain', 'name']); + request.domain.name = defaultValue1; + const expectedHeaderRequestParams = `domain.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateDomain = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDomain( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDomain with call error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.UpdateDomainRequest() + ); + request.domain ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.UpdateDomainRequest', ['domain', 'name']); + request.domain.name = defaultValue1; + const expectedHeaderRequestParams = `domain.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDomain = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateDomain(request), expectedError); + const actualRequest = (client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDomain with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.UpdateDomainRequest() + ); + request.domain ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.UpdateDomainRequest', ['domain', 'name']); + request.domain.name = defaultValue1; + const expectedHeaderRequestParams = `domain.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDomain = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateDomain(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateDomainProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateDomainProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateDomainProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateDomainProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteDomain', () => { + it('invokes deleteDomain without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.DeleteDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.DeleteDomainRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteDomain = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteDomain(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDomain without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.DeleteDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.DeleteDomainRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteDomain = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDomain( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDomain with call error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.DeleteDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.DeleteDomainRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDomain = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteDomain(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDomain with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.DeleteDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.DeleteDomainRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDomain = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteDomain(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteDomainProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteDomainProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteDomainProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteDomainProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('attachTrust', () => { + it('invokes attachTrust without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.AttachTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.AttachTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.attachTrust = stubLongRunningCall(expectedResponse); + const [operation] = await client.attachTrust(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes attachTrust without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.AttachTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.AttachTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.attachTrust = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.attachTrust( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes attachTrust with call error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.AttachTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.AttachTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.attachTrust = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.attachTrust(request), expectedError); + const actualRequest = (client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes attachTrust with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.AttachTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.AttachTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.attachTrust = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.attachTrust(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkAttachTrustProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkAttachTrustProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkAttachTrustProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkAttachTrustProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('reconfigureTrust', () => { + it('invokes reconfigureTrust without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ReconfigureTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ReconfigureTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reconfigureTrust = stubLongRunningCall(expectedResponse); + const [operation] = await client.reconfigureTrust(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reconfigureTrust without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ReconfigureTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ReconfigureTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reconfigureTrust = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reconfigureTrust( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reconfigureTrust with call error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ReconfigureTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ReconfigureTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reconfigureTrust = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.reconfigureTrust(request), expectedError); + const actualRequest = (client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reconfigureTrust with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ReconfigureTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ReconfigureTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reconfigureTrust = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.reconfigureTrust(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkReconfigureTrustProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkReconfigureTrustProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkReconfigureTrustProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkReconfigureTrustProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('detachTrust', () => { + it('invokes detachTrust without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.DetachTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.DetachTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.detachTrust = stubLongRunningCall(expectedResponse); + const [operation] = await client.detachTrust(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detachTrust without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.DetachTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.DetachTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.detachTrust = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.detachTrust( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detachTrust with call error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.DetachTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.DetachTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.detachTrust = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.detachTrust(request), expectedError); + const actualRequest = (client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detachTrust with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.DetachTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.DetachTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.detachTrust = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.detachTrust(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDetachTrustProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDetachTrustProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDetachTrustProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDetachTrustProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('validateTrust', () => { + it('invokes validateTrust without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ValidateTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ValidateTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.validateTrust = stubLongRunningCall(expectedResponse); + const [operation] = await client.validateTrust(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes validateTrust without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ValidateTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ValidateTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.validateTrust = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.validateTrust( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes validateTrust with call error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ValidateTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ValidateTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.validateTrust = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.validateTrust(request), expectedError); + const actualRequest = (client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes validateTrust with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ValidateTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ValidateTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.validateTrust = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.validateTrust(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkValidateTrustProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkValidateTrustProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkValidateTrustProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkValidateTrustProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listDomains', () => { + it('invokes listDomains without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ListDomainsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ListDomainsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + ]; + client.innerApiCalls.listDomains = stubSimpleCall(expectedResponse); + const [response] = await client.listDomains(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDomains as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDomains as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDomains without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ListDomainsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ListDomainsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + ]; + client.innerApiCalls.listDomains = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDomains( + request, + (err?: Error|null, result?: protos.google.cloud.managedidentities.v1.IDomain[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDomains as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDomains as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDomains with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ListDomainsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ListDomainsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDomains = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDomains(request), expectedError); + const actualRequest = (client.innerApiCalls.listDomains as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDomains as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDomainsStream without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ListDomainsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ListDomainsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + ]; + client.descriptors.page.listDomains.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listDomainsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.managedidentities.v1.Domain[] = []; + stream.on('data', (response: protos.google.cloud.managedidentities.v1.Domain) => { + 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.listDomains.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDomains, request)); + assert( + (client.descriptors.page.listDomains.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listDomainsStream with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ListDomainsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ListDomainsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDomains.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listDomainsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.managedidentities.v1.Domain[] = []; + stream.on('data', (response: protos.google.cloud.managedidentities.v1.Domain) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listDomains.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDomains, request)); + assert( + (client.descriptors.page.listDomains.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDomains without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ListDomainsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ListDomainsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + ]; + client.descriptors.page.listDomains.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.managedidentities.v1.IDomain[] = []; + const iterable = client.listDomainsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDomains.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDomains.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDomains with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1.ListDomainsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1.ListDomainsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDomains.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDomainsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.managedidentities.v1.IDomain[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDomains.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDomains.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('domain', () => { + const fakePath = "/rendered/path/domain"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + domain: "domainValue", + }; + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.domainPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.domainPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('domainPath', () => { + const result = client.domainPath("projectValue", "locationValue", "domainValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.domainPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromDomainName', () => { + const result = client.matchProjectFromDomainName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.domainPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromDomainName', () => { + const result = client.matchLocationFromDomainName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.domainPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDomainFromDomainName', () => { + const result = client.matchDomainFromDomainName(fakePath); + assert.strictEqual(result, "domainValue"); + assert((client.pathTemplates.domainPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/tsconfig.json b/owl-bot-staging/google-cloud-managedidentities/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1/webpack.config.js b/owl-bot-staging/google-cloud-managedidentities/v1/webpack.config.js new file mode 100644 index 00000000000..934d7017657 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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: 'ManagedIdentitiesService', + filename: './managed-identities-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-managedidentities/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-managedidentities/v1beta1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-managedidentities/v1beta1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/.gitignore b/owl-bot-staging/google-cloud-managedidentities/v1beta1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/.jsdoc.js new file mode 100644 index 00000000000..fe671cd4e4e --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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/managed-identities', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1beta1/README.md b/owl-bot-staging/google-cloud-managedidentities/v1beta1/README.md new file mode 100644 index 00000000000..94f33d69900 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/README.md @@ -0,0 +1 @@ +Managedidentities: Nodejs Client diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/package.json b/owl-bot-staging/google-cloud-managedidentities/v1beta1/package.json new file mode 100644 index 00000000000..fa591ecc6c5 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/managed-identities", + "version": "0.1.0", + "description": "Managedidentities client for Node.js", + "repository": "googleapis/nodejs-managedidentities", + "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 managedidentities", + "managedidentities", + "managed identities service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto b/owl-bot-staging/google-cloud-managedidentities/v1beta1/protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto new file mode 100644 index 00000000000..8abe4a8c6df --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto @@ -0,0 +1,389 @@ +// 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.managedidentities.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/managedidentities/v1beta1/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ManagedIdentities.V1Beta1"; +option go_package = "cloud.google.com/go/managedidentities/apiv1beta1/managedidentitiespb;managedidentitiespb"; +option java_multiple_files = true; +option java_outer_classname = "ManagedIdentitiesServiceProto"; +option java_package = "com.google.cloud.managedidentities.v1beta1"; +option objc_class_prefix = "GCMI"; +option php_namespace = "Google\\Cloud\\ManagedIdentities\\V1beta1"; +option ruby_package = "Google::Cloud::ManagedIdentities::V1beta1"; + +service ManagedIdentitiesService { + option (google.api.default_host) = "managedidentities.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a Microsoft AD domain. + rpc CreateMicrosoftAdDomain(CreateMicrosoftAdDomainRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/global}/domains" + body: "domain" + }; + option (google.api.method_signature) = "parent,domain_name,domain"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Resets a domain's administrator password. + rpc ResetAdminPassword(ResetAdminPasswordRequest) returns (ResetAdminPasswordResponse) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/global/domains/*}:resetAdminPassword" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Lists domains in a project. + rpc ListDomains(ListDomainsRequest) returns (ListDomainsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/locations/global}/domains" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets information about a domain. + rpc GetDomain(GetDomainRequest) returns (Domain) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/global/domains/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the metadata and configuration of a domain. + rpc UpdateDomain(UpdateDomainRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta1/{domain.name=projects/*/locations/global/domains/*}" + body: "domain" + }; + option (google.api.method_signature) = "domain,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Deletes a domain. + rpc DeleteDomain(DeleteDomainRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta1/{name=projects/*/locations/global/domains/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OpMetadata" + }; + } + + // Adds an AD trust to a domain. + rpc AttachTrust(AttachTrustRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/global/domains/*}:attachTrust" + body: "*" + }; + option (google.api.method_signature) = "name,trust"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Updates the DNS conditional forwarder. + rpc ReconfigureTrust(ReconfigureTrustRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/global/domains/*}:reconfigureTrust" + body: "*" + }; + option (google.api.method_signature) = "name,target_domain_name,target_dns_ip_addresses"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Removes an AD trust. + rpc DetachTrust(DetachTrustRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/global/domains/*}:detachTrust" + body: "*" + }; + option (google.api.method_signature) = "name,trust"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Validates a trust state, that the target domain is reachable, and that the + // target domain is able to accept incoming trust requests. + rpc ValidateTrust(ValidateTrustRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/global/domains/*}:validateTrust" + body: "*" + }; + option (google.api.method_signature) = "name,trust"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } +} + +// Represents the metadata of the long-running operation. +message OpMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool requested_cancellation = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for +// [CreateMicrosoftAdDomain][google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomain] +message CreateMicrosoftAdDomainRequest { + // Required. The resource project name and location using the form: + // `projects/{project_id}/locations/global` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. A domain name, e.g. mydomain.myorg.com, with the following restrictions: + // * Must contain only lowercase letters, numbers, periods and hyphens. + // * Must start with a letter. + // * Must contain between 2-64 characters. + // * Must end with a number or a letter. + // * Must not start with period. + // * First segment length (mydomain form example above) shouldn't exceed + // 15 chars. + // * The last segment cannot be fully numeric. + // * Must be unique within the customer project. + string domain_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A Managed Identity domain resource. + Domain domain = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [ResetAdminPassword][google.cloud.managedidentities.v1beta1.ResetAdminPassword] +message ResetAdminPasswordRequest { + // Required. The domain resource name using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; +} + +// Response message for +// [ResetAdminPassword][google.cloud.managedidentities.v1beta1.ResetAdminPassword] +message ResetAdminPasswordResponse { + // A random password. See [admin][google.cloud.managedidentities.v1beta1.Domain.admin] for more information. + string password = 1; +} + +// Request message for +// [ListDomains][google.cloud.managedidentities.v1beta1.ListDomains] +message ListDomainsRequest { + // Required. The resource name of the domain location using the form: + // `projects/{project_id}/locations/global` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Optional. The maximum number of items to return. + // If not specified, a default value of 1000 will be used. + // Regardless of the page_size value, the response may include a partial list. + // Callers should rely on a response's + // [next_page_token][google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token] + // to determine if there are additional results to list. + int32 page_size = 2; + + // The `next_page_token` value returned from a previous ListDomainsRequest + // request, if any. + string page_token = 3; + + // Optional. A filter specifying constraints of a list operation. + // For example, `Domain.fqdn="mydomain.myorginization"`. + string filter = 4; + + // Optional. Specifies the ordering of results. See + // [Sorting + // order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + // for more information. + string order_by = 5; +} + +// Response message for +// [ListDomains][google.cloud.managedidentities.v1beta1.ListDomains] +message ListDomainsResponse { + // A list of Managed Identities Service domains in the project. + repeated Domain domains = 1; + + // A token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; + + // A list of locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [GetDomain][google.cloud.managedidentities.v1beta1.GetDomain] +message GetDomainRequest { + // Required. The domain resource name using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; +} + +// Request message for +// [UpdateDomain][google.cloud.managedidentities.v1beta1.UpdateDomain] +message UpdateDomainRequest { + // Required. Mask of fields to update. At least one path must be supplied in this + // field. The elements of the repeated paths field may only include + // fields from [Domain][google.cloud.managedidentities.v1beta1.Domain]: + // * `labels` + // * `locations` + // * `authorized_networks` + // * `audit_logs_enabled` + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Domain message with updated fields. Only supported fields specified in + // update_mask are updated. + Domain domain = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [DeleteDomain][google.cloud.managedidentities.v1beta1.DeleteDomain] +message DeleteDomainRequest { + // Required. The domain resource name using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; +} + +// Request message for +// [AttachTrust][google.cloud.managedidentities.v1beta1.AttachTrust] +message AttachTrustRequest { + // Required. The resource domain name, project name and location using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The domain trust resource. + Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [ReconfigureTrust][google.cloud.managedidentities.v1beta1.ReconfigureTrust] +message ReconfigureTrustRequest { + // Required. The resource domain name, project name and location using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The fully-qualified target domain name which will be in trust with current + // domain. + string target_domain_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The target DNS server IP addresses to resolve the remote domain involved + // in the trust. + repeated string target_dns_ip_addresses = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [DetachTrust][google.cloud.managedidentities.v1beta1.DetachTrust] +message DetachTrustRequest { + // Required. The resource domain name, project name, and location using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The domain trust resource to removed. + Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [ValidateTrust][google.cloud.managedidentities.v1beta1.ValidateTrust] +message ValidateTrustRequest { + // Required. The resource domain name, project name, and location using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The domain trust to validate trust state for. + Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/protos/google/cloud/managedidentities/v1beta1/resource.proto b/owl-bot-staging/google-cloud-managedidentities/v1beta1/protos/google/cloud/managedidentities/v1beta1/resource.proto new file mode 100644 index 00000000000..7fa7cc0c08b --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/protos/google/cloud/managedidentities/v1beta1/resource.proto @@ -0,0 +1,216 @@ +// 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.managedidentities.v1beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ManagedIdentities.V1Beta1"; +option go_package = "cloud.google.com/go/managedidentities/apiv1beta1/managedidentitiespb;managedidentitiespb"; +option java_multiple_files = true; +option java_outer_classname = "ResourceProto"; +option java_package = "com.google.cloud.managedidentities.v1beta1"; +option php_namespace = "Google\\Cloud\\ManagedIdentities\\V1beta1"; +option ruby_package = "Google::Cloud::ManagedIdentities::V1beta1"; + +// Represents a managed Microsoft Active Directory domain. +// If the domain is being changed, it will be placed into the UPDATING state, +// which indicates that the resource is being reconciled. At this point, Get +// will reflect an intermediate state. +message Domain { + option (google.api.resource) = { + type: "managedidentities.googleapis.com/Domain" + pattern: "projects/{project}/locations/{location}/domains/{domain}" + }; + + // Represents the different states of a managed domain. + enum State { + // Not set. + STATE_UNSPECIFIED = 0; + + // The domain is being created. + CREATING = 1; + + // The domain has been created and is fully usable. + READY = 2; + + // The domain's configuration is being updated. + UPDATING = 3; + + // The domain is being deleted. + DELETING = 4; + + // The domain is being repaired and may be unusable. Details + // can be found in the `status_message` field. + REPAIRING = 5; + + // The domain is undergoing maintenance. + PERFORMING_MAINTENANCE = 6; + + // The domain is not serving requests. + UNAVAILABLE = 7; + } + + // Output only. The unique name of the domain using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Resource labels that can contain user-provided metadata. + map labels = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The full names of the Google Compute Engine + // [networks](/compute/docs/networks-and-firewalls#networks) the domain + // instance is connected to. Networks can be added using UpdateDomain. + // The domain is only available on networks listed in `authorized_networks`. + // If CIDR subnets overlap between networks, domain creation will fail. + repeated string authorized_networks = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The CIDR range of internal addresses that are reserved for this + // domain. Reserved networks must be /24 or larger. Ranges must be + // unique and non-overlapping with existing subnets in + // [Domain].[authorized_networks]. + string reserved_ip_range = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. Locations where domain needs to be provisioned. + // [regions][compute/docs/regions-zones/] + // e.g. us-west1 or us-east4 + // Service supports up to 4 locations at once. Each location will use a /26 + // block. + repeated string locations = 5 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The name of delegated administrator account used to perform + // Active Directory operations. If not specified, `setupadmin` will be used. + string admin = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The fully-qualified domain name of the exposed domain used by + // clients to connect to the service. Similar to what would be chosen for an + // Active Directory set up on an internal network. + string fqdn = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the instance was created. + google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update time. + google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of this domain. + State state = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current status of this + // domain, if available. + string status_message = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current trusts associated with the domain. + repeated Trust trusts = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents a relationship between two domains. This allows a controller in +// one domain to authenticate a user in another domain. +message Trust { + // Represents the different states of a domain trust. + enum State { + // Not set. + STATE_UNSPECIFIED = 0; + + // The domain trust is being created. + CREATING = 1; + + // The domain trust is being updated. + UPDATING = 2; + + // The domain trust is being deleted. + DELETING = 3; + + // The domain trust is connected. + CONNECTED = 4; + + // The domain trust is disconnected. + DISCONNECTED = 5; + } + + // Represents the different inter-forest trust types. + enum TrustType { + // Not set. + TRUST_TYPE_UNSPECIFIED = 0; + + // The forest trust. + FOREST = 1; + + // The external domain trust. + EXTERNAL = 2; + } + + // Represents the direction of trust. + // See + // [System.DirectoryServices.ActiveDirectory.TrustDirection](https://docs.microsoft.com/en-us/dotnet/api/system.directoryservices.activedirectory.trustdirection?view=netframework-4.7.2) + // for more information. + enum TrustDirection { + // Not set. + TRUST_DIRECTION_UNSPECIFIED = 0; + + // The inbound direction represents the trusting side. + INBOUND = 1; + + // The outboud direction represents the trusted side. + OUTBOUND = 2; + + // The bidirectional direction represents the trusted / trusting side. + BIDIRECTIONAL = 3; + } + + // The fully qualified target domain name which will be in trust with the + // current domain. + string target_domain_name = 1; + + // The type of trust represented by the trust resource. + TrustType trust_type = 2; + + // The trust direction, which decides if the current domain is trusted, + // trusting, or both. + TrustDirection trust_direction = 3; + + // The trust authentication type, which decides whether the trusted side has + // forest/domain wide access or selective access to an approved set of + // resources. + bool selective_authentication = 4; + + // The target DNS server IP addresses which can resolve the remote domain + // involved in the trust. + repeated string target_dns_ip_addresses = 5; + + // Input only. The trust secret used for the handshake + // with the target domain. It will not be stored. + string trust_handshake_secret = 6 [(google.api.field_behavior) = INPUT_ONLY]; + + // Output only. The time the instance was created. + google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update time. + google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the trust. + State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current state of the + // trust, if available. + string state_description = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last heartbeat time when the trust was known to be + // connected. + google.protobuf.Timestamp last_trust_heartbeat_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.attach_trust.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.attach_trust.js new file mode 100644 index 00000000000..50bf3636b7e --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.attach_trust.js @@ -0,0 +1,68 @@ +// 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, trust) { + // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_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 domain name, project name and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + /** + * Required. The domain trust resource. + */ + // const trust = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callAttachTrust() { + // Construct request + const request = { + name, + trust, + }; + + // Run request + const [operation] = await managedidentitiesClient.attachTrust(request); + const [response] = await operation.promise(); + console.log(response); + } + + callAttachTrust(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js new file mode 100644 index 00000000000..4c894996741 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js @@ -0,0 +1,82 @@ +// 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, domainName, domain) { + // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_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 project name and location using the form: + * `projects/{project_id}/locations/global` + */ + // const parent = 'abc123' + /** + * Required. A domain name, e.g. mydomain.myorg.com, with the following restrictions: + * * Must contain only lowercase letters, numbers, periods and hyphens. + * * Must start with a letter. + * * Must contain between 2-64 characters. + * * Must end with a number or a letter. + * * Must not start with period. + * * First segment length (mydomain form example above) shouldn't exceed + * 15 chars. + * * The last segment cannot be fully numeric. + * * Must be unique within the customer project. + */ + // const domainName = 'abc123' + /** + * Required. A Managed Identity domain resource. + */ + // const domain = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callCreateMicrosoftAdDomain() { + // Construct request + const request = { + parent, + domainName, + domain, + }; + + // Run request + const [operation] = await managedidentitiesClient.createMicrosoftAdDomain(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateMicrosoftAdDomain(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.delete_domain.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.delete_domain.js new file mode 100644 index 00000000000..5763f1fb766 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.delete_domain.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 managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_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 domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callDeleteDomain() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await managedidentitiesClient.deleteDomain(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteDomain(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.detach_trust.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.detach_trust.js new file mode 100644 index 00000000000..e108972aef5 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.detach_trust.js @@ -0,0 +1,68 @@ +// 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, trust) { + // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_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 domain name, project name, and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + /** + * Required. The domain trust resource to removed. + */ + // const trust = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callDetachTrust() { + // Construct request + const request = { + name, + trust, + }; + + // Run request + const [operation] = await managedidentitiesClient.detachTrust(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDetachTrust(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.get_domain.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.get_domain.js new file mode 100644 index 00000000000..c0e7156cf1c --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.get_domain.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 managedidentities_v1beta1_generated_ManagedIdentitiesService_GetDomain_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 domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callGetDomain() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await managedidentitiesClient.getDomain(request); + console.log(response); + } + + callGetDomain(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_GetDomain_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.list_domains.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.list_domains.js new file mode 100644 index 00000000000..b41790dbac6 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.list_domains.js @@ -0,0 +1,90 @@ +// 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 managedidentities_v1beta1_generated_ManagedIdentitiesService_ListDomains_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the domain location using the form: + * `projects/{project_id}/locations/global` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return. + * If not specified, a default value of 1000 will be used. + * Regardless of the page_size value, the response may include a partial list. + * Callers should rely on a response's + * next_page_token google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token + * to determine if there are additional results to list. + */ + // const pageSize = 1234 + /** + * The `next_page_token` value returned from a previous ListDomainsRequest + * request, if any. + */ + // const pageToken = 'abc123' + /** + * Optional. A filter specifying constraints of a list operation. + * For example, `Domain.fqdn="mydomain.myorginization"`. + */ + // const filter = 'abc123' + /** + * Optional. Specifies the ordering of results. See + * Sorting + * order (https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + */ + // const orderBy = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callListDomains() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await managedidentitiesClient.listDomainsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDomains(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_ListDomains_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js new file mode 100644 index 00000000000..baba2066365 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js @@ -0,0 +1,75 @@ +// 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, targetDomainName, targetDnsIpAddresses) { + // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_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 domain name, project name and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + /** + * Required. The fully-qualified target domain name which will be in trust with current + * domain. + */ + // const targetDomainName = 'abc123' + /** + * Required. The target DNS server IP addresses to resolve the remote domain involved + * in the trust. + */ + // const targetDnsIpAddresses = ['abc','def'] + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callReconfigureTrust() { + // Construct request + const request = { + name, + targetDomainName, + targetDnsIpAddresses, + }; + + // Run request + const [operation] = await managedidentitiesClient.reconfigureTrust(request); + const [response] = await operation.promise(); + console.log(response); + } + + callReconfigureTrust(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.reset_admin_password.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.reset_admin_password.js new file mode 100644 index 00000000000..b75686772d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.reset_admin_password.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 managedidentities_v1beta1_generated_ManagedIdentitiesService_ResetAdminPassword_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 domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callResetAdminPassword() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await managedidentitiesClient.resetAdminPassword(request); + console.log(response); + } + + callResetAdminPassword(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_ResetAdminPassword_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.update_domain.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.update_domain.js new file mode 100644 index 00000000000..02d32c37c05 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.update_domain.js @@ -0,0 +1,74 @@ +// 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(updateMask, domain) { + // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_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. Mask of fields to update. At least one path must be supplied in this + * field. The elements of the repeated paths field may only include + * fields from Domain google.cloud.managedidentities.v1beta1.Domain: + * * `labels` + * * `locations` + * * `authorized_networks` + * * `audit_logs_enabled` + */ + // const updateMask = {} + /** + * Required. Domain message with updated fields. Only supported fields specified in + * update_mask are updated. + */ + // const domain = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callUpdateDomain() { + // Construct request + const request = { + updateMask, + domain, + }; + + // Run request + const [operation] = await managedidentitiesClient.updateDomain(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateDomain(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.validate_trust.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.validate_trust.js new file mode 100644 index 00000000000..88731f3c320 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.validate_trust.js @@ -0,0 +1,68 @@ +// 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, trust) { + // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_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 domain name, project name, and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + /** + * Required. The domain trust to validate trust state for. + */ + // const trust = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callValidateTrust() { + // Construct request + const request = { + name, + trust, + }; + + // Run request + const [operation] = await managedidentitiesClient.validateTrust(request); + const [response] = await operation.promise(); + console.log(response); + } + + callValidateTrust(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_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-managedidentities/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.managedidentities.v1beta1.json b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.managedidentities.v1beta1.json new file mode 100644 index 00000000000..006c222675d --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.managedidentities.v1beta1.json @@ -0,0 +1,463 @@ +{ + "clientLibrary": { + "name": "nodejs-managedidentities", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.managedidentities.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async", + "title": "ManagedIdentitiesService createMicrosoftAdDomain Sample", + "origin": "API_DEFINITION", + "description": " Creates a Microsoft AD domain.", + "canonical": true, + "file": "managed_identities_service.create_microsoft_ad_domain.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateMicrosoftAdDomain", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.CreateMicrosoftAdDomain", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "domain_name", + "type": "TYPE_STRING" + }, + { + "name": "domain", + "type": ".google.cloud.managedidentities.v1beta1.Domain" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "CreateMicrosoftAdDomain", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.CreateMicrosoftAdDomain", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_ResetAdminPassword_async", + "title": "ManagedIdentitiesService resetAdminPassword Sample", + "origin": "API_DEFINITION", + "description": " Resets a domain's administrator password.", + "canonical": true, + "file": "managed_identities_service.reset_admin_password.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ResetAdminPassword", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ResetAdminPassword", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.managedidentities.v1beta1.ResetAdminPasswordResponse", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "ResetAdminPassword", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ResetAdminPassword", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_ListDomains_async", + "title": "ManagedIdentitiesService listDomains Sample", + "origin": "API_DEFINITION", + "description": " Lists domains in a project.", + "canonical": true, + "file": "managed_identities_service.list_domains.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDomains", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ListDomains", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.managedidentities.v1beta1.ListDomainsResponse", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "ListDomains", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ListDomains", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_GetDomain_async", + "title": "ManagedIdentitiesService getDomain Sample", + "origin": "API_DEFINITION", + "description": " Gets information about a domain.", + "canonical": true, + "file": "managed_identities_service.get_domain.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDomain", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.GetDomain", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.managedidentities.v1beta1.Domain", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "GetDomain", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.GetDomain", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_async", + "title": "ManagedIdentitiesService updateDomain Sample", + "origin": "API_DEFINITION", + "description": " Updates the metadata and configuration of a domain.", + "canonical": true, + "file": "managed_identities_service.update_domain.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateDomain", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.UpdateDomain", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "domain", + "type": ".google.cloud.managedidentities.v1beta1.Domain" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "UpdateDomain", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.UpdateDomain", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_async", + "title": "ManagedIdentitiesService deleteDomain Sample", + "origin": "API_DEFINITION", + "description": " Deletes a domain.", + "canonical": true, + "file": "managed_identities_service.delete_domain.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteDomain", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.DeleteDomain", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "DeleteDomain", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.DeleteDomain", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_async", + "title": "ManagedIdentitiesService attachTrust Sample", + "origin": "API_DEFINITION", + "description": " Adds an AD trust to a domain.", + "canonical": true, + "file": "managed_identities_service.attach_trust.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AttachTrust", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.AttachTrust", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "trust", + "type": ".google.cloud.managedidentities.v1beta1.Trust" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "AttachTrust", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.AttachTrust", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_async", + "title": "ManagedIdentitiesService reconfigureTrust Sample", + "origin": "API_DEFINITION", + "description": " Updates the DNS conditional forwarder.", + "canonical": true, + "file": "managed_identities_service.reconfigure_trust.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReconfigureTrust", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ReconfigureTrust", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "target_domain_name", + "type": "TYPE_STRING" + }, + { + "name": "target_dns_ip_addresses", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "ReconfigureTrust", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ReconfigureTrust", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_async", + "title": "ManagedIdentitiesService detachTrust Sample", + "origin": "API_DEFINITION", + "description": " Removes an AD trust.", + "canonical": true, + "file": "managed_identities_service.detach_trust.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DetachTrust", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.DetachTrust", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "trust", + "type": ".google.cloud.managedidentities.v1beta1.Trust" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "DetachTrust", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.DetachTrust", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_async", + "title": "ManagedIdentitiesService validateTrust Sample", + "origin": "API_DEFINITION", + "description": " Validates a trust state, that the target domain is reachable, and that the target domain is able to accept incoming trust requests.", + "canonical": true, + "file": "managed_identities_service.validate_trust.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ValidateTrust", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ValidateTrust", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "trust", + "type": ".google.cloud.managedidentities.v1beta1.Trust" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "ValidateTrust", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ValidateTrust", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/index.ts new file mode 100644 index 00000000000..d6ef87eaf1c --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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 ManagedIdentitiesServiceClient = v1beta1.ManagedIdentitiesServiceClient; +type ManagedIdentitiesServiceClient = v1beta1.ManagedIdentitiesServiceClient; +export {v1beta1, ManagedIdentitiesServiceClient}; +export default {v1beta1, ManagedIdentitiesServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/gapic_metadata.json new file mode 100644 index 00000000000..7566a4e2905 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/gapic_metadata.json @@ -0,0 +1,127 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.managedidentities.v1beta1", + "libraryPackage": "@google-cloud/managed-identities", + "services": { + "ManagedIdentitiesService": { + "clients": { + "grpc": { + "libraryClient": "ManagedIdentitiesServiceClient", + "rpcs": { + "ResetAdminPassword": { + "methods": [ + "resetAdminPassword" + ] + }, + "GetDomain": { + "methods": [ + "getDomain" + ] + }, + "CreateMicrosoftAdDomain": { + "methods": [ + "createMicrosoftAdDomain" + ] + }, + "UpdateDomain": { + "methods": [ + "updateDomain" + ] + }, + "DeleteDomain": { + "methods": [ + "deleteDomain" + ] + }, + "AttachTrust": { + "methods": [ + "attachTrust" + ] + }, + "ReconfigureTrust": { + "methods": [ + "reconfigureTrust" + ] + }, + "DetachTrust": { + "methods": [ + "detachTrust" + ] + }, + "ValidateTrust": { + "methods": [ + "validateTrust" + ] + }, + "ListDomains": { + "methods": [ + "listDomains", + "listDomainsStream", + "listDomainsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ManagedIdentitiesServiceClient", + "rpcs": { + "ResetAdminPassword": { + "methods": [ + "resetAdminPassword" + ] + }, + "GetDomain": { + "methods": [ + "getDomain" + ] + }, + "CreateMicrosoftAdDomain": { + "methods": [ + "createMicrosoftAdDomain" + ] + }, + "UpdateDomain": { + "methods": [ + "updateDomain" + ] + }, + "DeleteDomain": { + "methods": [ + "deleteDomain" + ] + }, + "AttachTrust": { + "methods": [ + "attachTrust" + ] + }, + "ReconfigureTrust": { + "methods": [ + "reconfigureTrust" + ] + }, + "DetachTrust": { + "methods": [ + "detachTrust" + ] + }, + "ValidateTrust": { + "methods": [ + "validateTrust" + ] + }, + "ListDomains": { + "methods": [ + "listDomains", + "listDomainsStream", + "listDomainsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/index.ts new file mode 100644 index 00000000000..b8fd8f0320d --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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 {ManagedIdentitiesServiceClient} from './managed_identities_service_client'; diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_client.ts b/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_client.ts new file mode 100644 index 00000000000..0042fb75503 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_client.ts @@ -0,0 +1,1541 @@ +// 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, GrpcClientOptions, LROperation, 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/v1beta1/managed_identities_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './managed_identities_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * @class + * @memberof v1beta1 + */ +export class ManagedIdentitiesServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + managedIdentitiesServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ManagedIdentitiesServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 ManagedIdentitiesServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ManagedIdentitiesServiceClient; + 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 { + 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 = { + domainPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/domains/{domain}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // 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 = { + listDomains: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'domains') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta1/{resource=projects/*/locations/global/domains/*}:getIamPolicy',additional_bindings: [{get: '/v1beta1/{resource=projects/*/locations/global/peerings/*}:getIamPolicy',},{get: '/v1beta1/{resource=projects/*/locations/global/domains/*/backups/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta1/{resource=projects/*/locations/global/domains/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta1/{resource=projects/*/locations/global/peerings/*}:setIamPolicy',body: '*',},{post: '/v1beta1/{resource=projects/*/locations/global/domains/*/backups/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta1/{resource=projects/*/locations/global/domains/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta1/{resource=projects/*/locations/global/peerings/*}:testIamPermissions',body: '*',},{post: '/v1beta1/{resource=projects/*/locations/global/domains/*/backups/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=projects/*/locations/global/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/{name=projects/*/locations/global/operations}',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createMicrosoftAdDomainResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; + const createMicrosoftAdDomainMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; + const updateDomainResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; + const updateDomainMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; + const deleteDomainResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteDomainMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; + const attachTrustResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; + const attachTrustMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; + const reconfigureTrustResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; + const reconfigureTrustMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; + const detachTrustResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; + const detachTrustMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; + const validateTrustResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; + const validateTrustMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createMicrosoftAdDomain: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createMicrosoftAdDomainResponse.decode.bind(createMicrosoftAdDomainResponse), + createMicrosoftAdDomainMetadata.decode.bind(createMicrosoftAdDomainMetadata)), + updateDomain: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateDomainResponse.decode.bind(updateDomainResponse), + updateDomainMetadata.decode.bind(updateDomainMetadata)), + deleteDomain: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteDomainResponse.decode.bind(deleteDomainResponse), + deleteDomainMetadata.decode.bind(deleteDomainMetadata)), + attachTrust: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + attachTrustResponse.decode.bind(attachTrustResponse), + attachTrustMetadata.decode.bind(attachTrustMetadata)), + reconfigureTrust: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + reconfigureTrustResponse.decode.bind(reconfigureTrustResponse), + reconfigureTrustMetadata.decode.bind(reconfigureTrustMetadata)), + detachTrust: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + detachTrustResponse.decode.bind(detachTrustResponse), + detachTrustMetadata.decode.bind(detachTrustMetadata)), + validateTrust: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + validateTrustResponse.decode.bind(validateTrustResponse), + validateTrustMetadata.decode.bind(validateTrustMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.managedidentities.v1beta1.ManagedIdentitiesService', 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.managedIdentitiesServiceStub) { + return this.managedIdentitiesServiceStub; + } + + // Put together the "service stub" for + // google.cloud.managedidentities.v1beta1.ManagedIdentitiesService. + this.managedIdentitiesServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.managedidentities.v1beta1.ManagedIdentitiesService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.managedidentities.v1beta1.ManagedIdentitiesService, + 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 managedIdentitiesServiceStubMethods = + ['createMicrosoftAdDomain', 'resetAdminPassword', 'listDomains', 'getDomain', 'updateDomain', 'deleteDomain', 'attachTrust', 'reconfigureTrust', 'detachTrust', 'validateTrust']; + for (const methodName of managedIdentitiesServiceStubMethods) { + const callPromise = this.managedIdentitiesServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.managedIdentitiesServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'managedidentities.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 'managedidentities.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 -- + // ------------------- +/** + * Resets a domain's administrator password. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordResponse|ResetAdminPasswordResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/managed_identities_service.reset_admin_password.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ResetAdminPassword_async + */ + resetAdminPassword( + request?: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|undefined, {}|undefined + ]>; + resetAdminPassword( + request: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|null|undefined, + {}|null|undefined>): void; + resetAdminPassword( + request: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest, + callback: Callback< + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|null|undefined, + {}|null|undefined>): void; + resetAdminPassword( + request?: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|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.resetAdminPassword(request, options, callback); + } +/** + * Gets information about a domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.managedidentities.v1beta1.Domain|Domain}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/managed_identities_service.get_domain.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_GetDomain_async + */ + getDomain( + request?: protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.managedidentities.v1beta1.IDomain, + protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|undefined, {}|undefined + ]>; + getDomain( + request: protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.managedidentities.v1beta1.IDomain, + protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|null|undefined, + {}|null|undefined>): void; + getDomain( + request: protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest, + callback: Callback< + protos.google.cloud.managedidentities.v1beta1.IDomain, + protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|null|undefined, + {}|null|undefined>): void; + getDomain( + request?: protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.managedidentities.v1beta1.IDomain, + protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.managedidentities.v1beta1.IDomain, + protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.managedidentities.v1beta1.IDomain, + protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|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.getDomain(request, options, callback); + } + +/** + * Creates a Microsoft AD domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource project name and location using the form: + * `projects/{project_id}/locations/global` + * @param {string} request.domainName + * Required. A domain name, e.g. mydomain.myorg.com, with the following restrictions: + * * Must contain only lowercase letters, numbers, periods and hyphens. + * * Must start with a letter. + * * Must contain between 2-64 characters. + * * Must end with a number or a letter. + * * Must not start with period. + * * First segment length (mydomain form example above) shouldn't exceed + * 15 chars. + * * The last segment cannot be fully numeric. + * * Must be unique within the customer project. + * @param {google.cloud.managedidentities.v1beta1.Domain} request.domain + * Required. A Managed Identity domain 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async + */ + createMicrosoftAdDomain( + request?: protos.google.cloud.managedidentities.v1beta1.ICreateMicrosoftAdDomainRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createMicrosoftAdDomain( + request: protos.google.cloud.managedidentities.v1beta1.ICreateMicrosoftAdDomainRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMicrosoftAdDomain( + request: protos.google.cloud.managedidentities.v1beta1.ICreateMicrosoftAdDomainRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMicrosoftAdDomain( + request?: protos.google.cloud.managedidentities.v1beta1.ICreateMicrosoftAdDomainRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createMicrosoftAdDomain(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createMicrosoftAdDomain()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async + */ + async checkCreateMicrosoftAdDomainProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMicrosoftAdDomain, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the metadata and configuration of a domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. At least one path must be supplied in this + * field. The elements of the repeated paths field may only include + * fields from {@link protos.google.cloud.managedidentities.v1beta1.Domain|Domain}: + * * `labels` + * * `locations` + * * `authorized_networks` + * * `audit_logs_enabled` + * @param {google.cloud.managedidentities.v1beta1.Domain} request.domain + * Required. Domain message with updated fields. Only supported fields specified in + * update_mask are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/managed_identities_service.update_domain.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_async + */ + updateDomain( + request?: protos.google.cloud.managedidentities.v1beta1.IUpdateDomainRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateDomain( + request: protos.google.cloud.managedidentities.v1beta1.IUpdateDomainRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateDomain( + request: protos.google.cloud.managedidentities.v1beta1.IUpdateDomainRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateDomain( + request?: protos.google.cloud.managedidentities.v1beta1.IUpdateDomainRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'domain.name': request.domain!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateDomain(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateDomain()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/managed_identities_service.update_domain.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_async + */ + async checkUpdateDomainProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDomain, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/managed_identities_service.delete_domain.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_async + */ + deleteDomain( + request?: protos.google.cloud.managedidentities.v1beta1.IDeleteDomainRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteDomain( + request: protos.google.cloud.managedidentities.v1beta1.IDeleteDomainRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteDomain( + request: protos.google.cloud.managedidentities.v1beta1.IDeleteDomainRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteDomain( + request?: protos.google.cloud.managedidentities.v1beta1.IDeleteDomainRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteDomain(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteDomain()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/managed_identities_service.delete_domain.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_async + */ + async checkDeleteDomainProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteDomain, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Adds an AD trust to a domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource domain name, project name and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {google.cloud.managedidentities.v1beta1.Trust} request.trust + * Required. The domain trust 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/managed_identities_service.attach_trust.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_async + */ + attachTrust( + request?: protos.google.cloud.managedidentities.v1beta1.IAttachTrustRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + attachTrust( + request: protos.google.cloud.managedidentities.v1beta1.IAttachTrustRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + attachTrust( + request: protos.google.cloud.managedidentities.v1beta1.IAttachTrustRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + attachTrust( + request?: protos.google.cloud.managedidentities.v1beta1.IAttachTrustRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.attachTrust(request, options, callback); + } +/** + * Check the status of the long running operation returned by `attachTrust()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/managed_identities_service.attach_trust.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_async + */ + async checkAttachTrustProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.attachTrust, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the DNS conditional forwarder. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource domain name, project name and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {string} request.targetDomainName + * Required. The fully-qualified target domain name which will be in trust with current + * domain. + * @param {string[]} request.targetDnsIpAddresses + * Required. The target DNS server IP addresses to resolve the remote domain involved + * in the trust. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_async + */ + reconfigureTrust( + request?: protos.google.cloud.managedidentities.v1beta1.IReconfigureTrustRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + reconfigureTrust( + request: protos.google.cloud.managedidentities.v1beta1.IReconfigureTrustRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + reconfigureTrust( + request: protos.google.cloud.managedidentities.v1beta1.IReconfigureTrustRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + reconfigureTrust( + request?: protos.google.cloud.managedidentities.v1beta1.IReconfigureTrustRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.reconfigureTrust(request, options, callback); + } +/** + * Check the status of the long running operation returned by `reconfigureTrust()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_async + */ + async checkReconfigureTrustProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.reconfigureTrust, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Removes an AD trust. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource domain name, project name, and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {google.cloud.managedidentities.v1beta1.Trust} request.trust + * Required. The domain trust resource to removed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/managed_identities_service.detach_trust.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_async + */ + detachTrust( + request?: protos.google.cloud.managedidentities.v1beta1.IDetachTrustRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + detachTrust( + request: protos.google.cloud.managedidentities.v1beta1.IDetachTrustRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + detachTrust( + request: protos.google.cloud.managedidentities.v1beta1.IDetachTrustRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + detachTrust( + request?: protos.google.cloud.managedidentities.v1beta1.IDetachTrustRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.detachTrust(request, options, callback); + } +/** + * Check the status of the long running operation returned by `detachTrust()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/managed_identities_service.detach_trust.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_async + */ + async checkDetachTrustProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.detachTrust, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Validates a trust state, that the target domain is reachable, and that the + * target domain is able to accept incoming trust requests. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource domain name, project name, and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {google.cloud.managedidentities.v1beta1.Trust} request.trust + * Required. The domain trust to validate trust state for. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/managed_identities_service.validate_trust.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_async + */ + validateTrust( + request?: protos.google.cloud.managedidentities.v1beta1.IValidateTrustRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + validateTrust( + request: protos.google.cloud.managedidentities.v1beta1.IValidateTrustRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + validateTrust( + request: protos.google.cloud.managedidentities.v1beta1.IValidateTrustRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + validateTrust( + request?: protos.google.cloud.managedidentities.v1beta1.IValidateTrustRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.validateTrust(request, options, callback); + } +/** + * Check the status of the long running operation returned by `validateTrust()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/managed_identities_service.validate_trust.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_async + */ + async checkValidateTrustProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.validateTrust, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists domains in a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the domain location using the form: + * `projects/{project_id}/locations/global` + * @param {number} request.pageSize + * Optional. The maximum number of items to return. + * If not specified, a default value of 1000 will be used. + * Regardless of the page_size value, the response may include a partial list. + * Callers should rely on a response's + * {@link protos.google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token|next_page_token} + * to determine if there are additional results to list. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous ListDomainsRequest + * request, if any. + * @param {string} request.filter + * Optional. A filter specifying constraints of a list operation. + * For example, `Domain.fqdn="mydomain.myorginization"`. + * @param {string} request.orderBy + * Optional. Specifies the ordering of results. See + * [Sorting + * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.managedidentities.v1beta1.Domain|Domain}. + * 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 `listDomainsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDomains( + request?: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.managedidentities.v1beta1.IDomain[], + protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest|null, + protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse + ]>; + listDomains( + request: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse|null|undefined, + protos.google.cloud.managedidentities.v1beta1.IDomain>): void; + listDomains( + request: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + callback: PaginationCallback< + protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse|null|undefined, + protos.google.cloud.managedidentities.v1beta1.IDomain>): void; + listDomains( + request?: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse|null|undefined, + protos.google.cloud.managedidentities.v1beta1.IDomain>, + callback?: PaginationCallback< + protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse|null|undefined, + protos.google.cloud.managedidentities.v1beta1.IDomain>): + Promise<[ + protos.google.cloud.managedidentities.v1beta1.IDomain[], + protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest|null, + protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listDomains(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the domain location using the form: + * `projects/{project_id}/locations/global` + * @param {number} request.pageSize + * Optional. The maximum number of items to return. + * If not specified, a default value of 1000 will be used. + * Regardless of the page_size value, the response may include a partial list. + * Callers should rely on a response's + * {@link protos.google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token|next_page_token} + * to determine if there are additional results to list. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous ListDomainsRequest + * request, if any. + * @param {string} request.filter + * Optional. A filter specifying constraints of a list operation. + * For example, `Domain.fqdn="mydomain.myorginization"`. + * @param {string} request.orderBy + * Optional. Specifies the ordering of results. See + * [Sorting + * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + * @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 protos.google.cloud.managedidentities.v1beta1.Domain|Domain} 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 `listDomainsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDomainsStream( + request?: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + 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['listDomains']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDomains.createStream( + this.innerApiCalls.listDomains as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listDomains`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the domain location using the form: + * `projects/{project_id}/locations/global` + * @param {number} request.pageSize + * Optional. The maximum number of items to return. + * If not specified, a default value of 1000 will be used. + * Regardless of the page_size value, the response may include a partial list. + * Callers should rely on a response's + * {@link protos.google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token|next_page_token} + * to determine if there are additional results to list. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous ListDomainsRequest + * request, if any. + * @param {string} request.filter + * Optional. A filter specifying constraints of a list operation. + * For example, `Domain.fqdn="mydomain.myorginization"`. + * @param {string} request.orderBy + * Optional. Specifies the ordering of results. See + * [Sorting + * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.managedidentities.v1beta1.Domain|Domain}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/managed_identities_service.list_domains.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ListDomains_async + */ + listDomainsAsync( + request?: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + 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['listDomains']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDomains.asyncIterate( + this.innerApiCalls['listDomains'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified domain resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} domain + * @returns {string} Resource name string. + */ + domainPath(project:string,location:string,domain:string) { + return this.pathTemplates.domainPathTemplate.render({ + project: project, + location: location, + domain: domain, + }); + } + + /** + * Parse the project from Domain resource. + * + * @param {string} domainName + * A fully-qualified path representing Domain resource. + * @returns {string} A string representing the project. + */ + matchProjectFromDomainName(domainName: string) { + return this.pathTemplates.domainPathTemplate.match(domainName).project; + } + + /** + * Parse the location from Domain resource. + * + * @param {string} domainName + * A fully-qualified path representing Domain resource. + * @returns {string} A string representing the location. + */ + matchLocationFromDomainName(domainName: string) { + return this.pathTemplates.domainPathTemplate.match(domainName).location; + } + + /** + * Parse the domain from Domain resource. + * + * @param {string} domainName + * A fully-qualified path representing Domain resource. + * @returns {string} A string representing the domain. + */ + matchDomainFromDomainName(domainName: string) { + return this.pathTemplates.domainPathTemplate.match(domainName).domain; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified 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; + } + + /** + * 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.managedIdentitiesServiceStub && !this._terminated) { + return this.managedIdentitiesServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_client_config.json b/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_client_config.json new file mode 100644 index 00000000000..c863d5ec9a6 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_client_config.json @@ -0,0 +1,66 @@ +{ + "interfaces": { + "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService": { + "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": { + "CreateMicrosoftAdDomain": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ResetAdminPassword": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListDomains": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetDomain": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateDomain": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteDomain": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AttachTrust": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ReconfigureTrust": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DetachTrust": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ValidateTrust": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_proto_list.json b/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_proto_list.json new file mode 100644 index 00000000000..dbe47297a1a --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto", + "../../protos/google/cloud/managedidentities/v1beta1/resource.proto" +] diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..19557c14fd8 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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 managedidentities = require('@google-cloud/managed-identities'); + +function main() { + const managedIdentitiesServiceClient = new managedidentities.ManagedIdentitiesServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..58efb744a28 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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 {ManagedIdentitiesServiceClient} from '@google-cloud/managed-identities'; + +// check that the client class type name can be used +function doStuffWithManagedIdentitiesServiceClient(client: ManagedIdentitiesServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const managedIdentitiesServiceClient = new ManagedIdentitiesServiceClient(); + doStuffWithManagedIdentitiesServiceClient(managedIdentitiesServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1beta1/test/gapic_managed_identities_service_v1beta1.ts b/owl-bot-staging/google-cloud-managedidentities/v1beta1/test/gapic_managed_identities_service_v1beta1.ts new file mode 100644 index 00000000000..62863e662c4 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/v1beta1/test/gapic_managed_identities_service_v1beta1.ts @@ -0,0 +1,1873 @@ +// 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 managedidentitiesserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta1.ManagedIdentitiesServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.managedIdentitiesServiceStub, undefined); + await client.initialize(); + assert(client.managedIdentitiesServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.managedIdentitiesServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.managedIdentitiesServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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 managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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('resetAdminPassword', () => { + it('invokes resetAdminPassword without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordResponse() + ); + client.innerApiCalls.resetAdminPassword = stubSimpleCall(expectedResponse); + const [response] = await client.resetAdminPassword(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetAdminPassword without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordResponse() + ); + client.innerApiCalls.resetAdminPassword = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetAdminPassword( + request, + (err?: Error|null, result?: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetAdminPassword with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetAdminPassword = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.resetAdminPassword(request), expectedError); + const actualRequest = (client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetAdminPassword with closed client', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.resetAdminPassword(request), expectedError); + }); + }); + + describe('getDomain', () => { + it('invokes getDomain without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.GetDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.GetDomainRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.Domain() + ); + client.innerApiCalls.getDomain = stubSimpleCall(expectedResponse); + const [response] = await client.getDomain(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDomain without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.GetDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.GetDomainRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.Domain() + ); + client.innerApiCalls.getDomain = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDomain( + request, + (err?: Error|null, result?: protos.google.cloud.managedidentities.v1beta1.IDomain|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDomain with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.GetDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.GetDomainRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDomain = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDomain(request), expectedError); + const actualRequest = (client.innerApiCalls.getDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDomain with closed client', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.GetDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.GetDomainRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDomain(request), expectedError); + }); + }); + + describe('createMicrosoftAdDomain', () => { + it('invokes createMicrosoftAdDomain without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(expectedResponse); + const [operation] = await client.createMicrosoftAdDomain(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMicrosoftAdDomain without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMicrosoftAdDomain( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMicrosoftAdDomain with call error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createMicrosoftAdDomain(request), expectedError); + const actualRequest = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMicrosoftAdDomain with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createMicrosoftAdDomain(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateMicrosoftAdDomainProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateMicrosoftAdDomainProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateMicrosoftAdDomainProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateMicrosoftAdDomainProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateDomain', () => { + it('invokes updateDomain without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.UpdateDomainRequest() + ); + request.domain ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.UpdateDomainRequest', ['domain', 'name']); + request.domain.name = defaultValue1; + const expectedHeaderRequestParams = `domain.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateDomain = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateDomain(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDomain without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.UpdateDomainRequest() + ); + request.domain ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.UpdateDomainRequest', ['domain', 'name']); + request.domain.name = defaultValue1; + const expectedHeaderRequestParams = `domain.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateDomain = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDomain( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDomain with call error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.UpdateDomainRequest() + ); + request.domain ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.UpdateDomainRequest', ['domain', 'name']); + request.domain.name = defaultValue1; + const expectedHeaderRequestParams = `domain.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDomain = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateDomain(request), expectedError); + const actualRequest = (client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDomain with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.UpdateDomainRequest() + ); + request.domain ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.UpdateDomainRequest', ['domain', 'name']); + request.domain.name = defaultValue1; + const expectedHeaderRequestParams = `domain.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDomain = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateDomain(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateDomainProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateDomainProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateDomainProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateDomainProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteDomain', () => { + it('invokes deleteDomain without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.DeleteDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.DeleteDomainRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteDomain = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteDomain(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDomain without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.DeleteDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.DeleteDomainRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteDomain = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDomain( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDomain with call error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.DeleteDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.DeleteDomainRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDomain = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteDomain(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDomain with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.DeleteDomainRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.DeleteDomainRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDomain = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteDomain(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteDomainProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteDomainProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteDomainProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteDomainProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('attachTrust', () => { + it('invokes attachTrust without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.AttachTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.AttachTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.attachTrust = stubLongRunningCall(expectedResponse); + const [operation] = await client.attachTrust(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes attachTrust without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.AttachTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.AttachTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.attachTrust = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.attachTrust( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes attachTrust with call error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.AttachTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.AttachTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.attachTrust = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.attachTrust(request), expectedError); + const actualRequest = (client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes attachTrust with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.AttachTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.AttachTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.attachTrust = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.attachTrust(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkAttachTrustProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkAttachTrustProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkAttachTrustProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkAttachTrustProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('reconfigureTrust', () => { + it('invokes reconfigureTrust without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reconfigureTrust = stubLongRunningCall(expectedResponse); + const [operation] = await client.reconfigureTrust(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reconfigureTrust without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reconfigureTrust = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reconfigureTrust( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reconfigureTrust with call error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reconfigureTrust = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.reconfigureTrust(request), expectedError); + const actualRequest = (client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reconfigureTrust with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reconfigureTrust = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.reconfigureTrust(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkReconfigureTrustProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkReconfigureTrustProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkReconfigureTrustProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkReconfigureTrustProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('detachTrust', () => { + it('invokes detachTrust without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.DetachTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.DetachTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.detachTrust = stubLongRunningCall(expectedResponse); + const [operation] = await client.detachTrust(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detachTrust without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.DetachTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.DetachTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.detachTrust = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.detachTrust( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detachTrust with call error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.DetachTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.DetachTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.detachTrust = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.detachTrust(request), expectedError); + const actualRequest = (client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detachTrust with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.DetachTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.DetachTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.detachTrust = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.detachTrust(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDetachTrustProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDetachTrustProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDetachTrustProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDetachTrustProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('validateTrust', () => { + it('invokes validateTrust without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ValidateTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ValidateTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.validateTrust = stubLongRunningCall(expectedResponse); + const [operation] = await client.validateTrust(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes validateTrust without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ValidateTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ValidateTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.validateTrust = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.validateTrust( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes validateTrust with call error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ValidateTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ValidateTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.validateTrust = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.validateTrust(request), expectedError); + const actualRequest = (client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes validateTrust with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ValidateTrustRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ValidateTrustRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.validateTrust = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.validateTrust(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkValidateTrustProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkValidateTrustProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkValidateTrustProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkValidateTrustProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listDomains', () => { + it('invokes listDomains without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ListDomainsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + ]; + client.innerApiCalls.listDomains = stubSimpleCall(expectedResponse); + const [response] = await client.listDomains(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDomains as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDomains as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDomains without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ListDomainsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + ]; + client.innerApiCalls.listDomains = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDomains( + request, + (err?: Error|null, result?: protos.google.cloud.managedidentities.v1beta1.IDomain[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDomains as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDomains as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDomains with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ListDomainsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDomains = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDomains(request), expectedError); + const actualRequest = (client.innerApiCalls.listDomains as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDomains as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDomainsStream without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ListDomainsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + ]; + client.descriptors.page.listDomains.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listDomainsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.managedidentities.v1beta1.Domain[] = []; + stream.on('data', (response: protos.google.cloud.managedidentities.v1beta1.Domain) => { + 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.listDomains.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDomains, request)); + assert( + (client.descriptors.page.listDomains.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listDomainsStream with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ListDomainsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDomains.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listDomainsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.managedidentities.v1beta1.Domain[] = []; + stream.on('data', (response: protos.google.cloud.managedidentities.v1beta1.Domain) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listDomains.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDomains, request)); + assert( + (client.descriptors.page.listDomains.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDomains without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ListDomainsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + ]; + client.descriptors.page.listDomains.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.managedidentities.v1beta1.IDomain[] = []; + const iterable = client.listDomainsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDomains.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDomains.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDomains with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ListDomainsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDomains.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDomainsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.managedidentities.v1beta1.IDomain[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDomains.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDomains.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('domain', () => { + const fakePath = "/rendered/path/domain"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + domain: "domainValue", + }; + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.domainPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.domainPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('domainPath', () => { + const result = client.domainPath("projectValue", "locationValue", "domainValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.domainPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromDomainName', () => { + const result = client.matchProjectFromDomainName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.domainPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromDomainName', () => { + const result = client.matchLocationFromDomainName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.domainPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDomainFromDomainName', () => { + const result = client.matchDomainFromDomainName(fakePath); + assert.strictEqual(result, "domainValue"); + assert((client.pathTemplates.domainPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-managedidentities/v1beta1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/webpack.config.js new file mode 100644 index 00000000000..934d7017657 --- /dev/null +++ b/owl-bot-staging/google-cloud-managedidentities/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: 'ManagedIdentitiesService', + filename: './managed-identities-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-mediatranslation/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.gitignore b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/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-mediatranslation/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.jsdoc.js new file mode 100644 index 00000000000..16d4d3203ff --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/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/media-translation', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/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-mediatranslation/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/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-mediatranslation/v1beta1/README.md b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/README.md new file mode 100644 index 00000000000..16fe5858f75 --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/README.md @@ -0,0 +1 @@ +Mediatranslation: Nodejs Client diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/package.json b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/package.json new file mode 100644 index 00000000000..f1f1d60fee8 --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/media-translation", + "version": "0.1.0", + "description": "Mediatranslation client for Node.js", + "repository": "googleapis/nodejs-mediatranslation", + "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 mediatranslation", + "mediatranslation", + "speech translation service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/protos/google/cloud/mediatranslation/v1beta1/media_translation.proto b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/protos/google/cloud/mediatranslation/v1beta1/media_translation.proto new file mode 100644 index 00000000000..63aff80c927 --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/protos/google/cloud/mediatranslation/v1beta1/media_translation.proto @@ -0,0 +1,204 @@ +// 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.mediatranslation.v1beta1; + +import "google/api/field_behavior.proto"; +import "google/rpc/status.proto"; +import "google/api/client.proto"; + +option cc_enable_arenas = true; +option go_package = "cloud.google.com/go/mediatranslation/apiv1beta1/mediatranslationpb;mediatranslationpb"; +option java_multiple_files = true; +option java_outer_classname = "MediaTranslationProto"; +option java_package = "com.google.cloud.mediatranslation.v1beta1"; +option csharp_namespace = "Google.Cloud.MediaTranslation.V1Beta1"; +option ruby_package = "Google::Cloud::MediaTranslation::V1beta1"; +option php_namespace = "Google\\Cloud\\MediaTranslation\\V1beta1"; + +// Provides translation from/to media types. +service SpeechTranslationService { + option (google.api.default_host) = "mediatranslation.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Performs bidirectional streaming speech translation: receive results while + // sending audio. This method is only available via the gRPC API (not REST). + rpc StreamingTranslateSpeech(stream StreamingTranslateSpeechRequest) returns (stream StreamingTranslateSpeechResponse) { + } +} + +// Provides information to the speech translation that specifies how to process +// the request. +message TranslateSpeechConfig { + // Required. Encoding of audio data. + // Supported formats: + // + // - `linear16` + // + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + // + // - `flac` + // + // `flac` (Free Lossless Audio Codec) is the recommended encoding + // because it is lossless--therefore recognition is not compromised--and + // requires only about half the bandwidth of `linear16`. + // + // - `mulaw` + // + // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + // + // - `amr` + // + // Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. + // + // - `amr-wb` + // + // Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. + // + // - `ogg-opus` + // + // Opus encoded audio frames in [Ogg](https://wikipedia.org/wiki/Ogg) + // container. `sample_rate_hertz` must be one of 8000, 12000, 16000, 24000, + // or 48000. + // + // - `mp3` + // + // MP3 audio. Support all standard MP3 bitrates (which range from 32-320 + // kbps). When using this encoding, `sample_rate_hertz` has to match the + // sample rate of the file being used. + string audio_encoding = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Source language code (BCP-47) of the input audio. + string source_language_code = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Target language code (BCP-47) of the output. + string target_language_code = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Sample rate in Hertz of the audio data. Valid values are: + // 8000-48000. 16000 is optimal. For best results, set the sampling rate of + // the audio source to 16000 Hz. If that's not possible, use the native sample + // rate of the audio source (instead of re-sampling). + int32 sample_rate_hertz = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. `google-provided-model/video` and + // `google-provided-model/enhanced-phone-call` are premium models. + // `google-provided-model/phone-call` is not premium model. + string model = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Config used for streaming translation. +message StreamingTranslateSpeechConfig { + // Required. The common config for all the following audio contents. + TranslateSpeechConfig audio_config = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. If `false` or omitted, the system performs + // continuous translation (continuing to wait for and process audio even if + // the user pauses speaking) until the client closes the input stream (gRPC + // API) or until the maximum time limit has been reached. May return multiple + // `StreamingTranslateSpeechResult`s with the `is_final` flag set to `true`. + // + // If `true`, the speech translator will detect a single spoken utterance. + // When it detects that the user has paused or stopped speaking, it will + // return an `END_OF_SINGLE_UTTERANCE` event and cease translation. + // When the client receives 'END_OF_SINGLE_UTTERANCE' event, the client should + // stop sending the requests. However, clients should keep receiving remaining + // responses until the stream is terminated. To construct the complete + // sentence in a streaming way, one should override (if 'is_final' of previous + // response is false), or append (if 'is_final' of previous response is true). + bool single_utterance = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The top-level message sent by the client for the `StreamingTranslateSpeech` +// method. Multiple `StreamingTranslateSpeechRequest` messages are sent. The +// first message must contain a `streaming_config` message and must not contain +// `audio_content` data. All subsequent messages must contain `audio_content` +// data and must not contain a `streaming_config` message. +message StreamingTranslateSpeechRequest { + // The streaming request, which is either a streaming config or content. + oneof streaming_request { + // Provides information to the recognizer that specifies how to process the + // request. The first `StreamingTranslateSpeechRequest` message must contain + // a `streaming_config` message. + StreamingTranslateSpeechConfig streaming_config = 1; + + // The audio data to be translated. Sequential chunks of audio data are sent + // in sequential `StreamingTranslateSpeechRequest` messages. The first + // `StreamingTranslateSpeechRequest` message must not contain + // `audio_content` data and all subsequent `StreamingTranslateSpeechRequest` + // messages must contain `audio_content` data. The audio bytes must be + // encoded as specified in `StreamingTranslateSpeechConfig`. Note: as with + // all bytes fields, protobuffers use a pure binary representation (not + // base64). + bytes audio_content = 2; + } +} + +// A streaming speech translation result corresponding to a portion of the audio +// that is currently being processed. +message StreamingTranslateSpeechResult { + // Text translation result. + message TextTranslationResult { + // Output only. The translated sentence. + string translation = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. If `false`, this `StreamingTranslateSpeechResult` represents + // an interim result that may change. If `true`, this is the final time the + // translation service will return this particular + // `StreamingTranslateSpeechResult`, the streaming translator will not + // return any further hypotheses for this portion of the transcript and + // corresponding audio. + bool is_final = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Translation result. + oneof result { + // Text translation result. + TextTranslationResult text_translation_result = 1; + } +} + +// A streaming speech translation response corresponding to a portion of +// the audio currently processed. +message StreamingTranslateSpeechResponse { + // Indicates the type of speech event. + enum SpeechEventType { + // No speech event specified. + SPEECH_EVENT_TYPE_UNSPECIFIED = 0; + + // This event indicates that the server has detected the end of the user's + // speech utterance and expects no additional speech. Therefore, the server + // will not process additional audio (although it may subsequently return + // additional results). When the client receives 'END_OF_SINGLE_UTTERANCE' + // event, the client should stop sending the requests. However, clients + // should keep receiving remaining responses until the stream is terminated. + // To construct the complete sentence in a streaming way, one should + // override (if 'is_final' of previous response is false), or append (if + // 'is_final' of previous response is true). This event is only sent if + // `single_utterance` was set to `true`, and is not used otherwise. + END_OF_SINGLE_UTTERANCE = 1; + } + + // Output only. If set, returns a [google.rpc.Status][google.rpc.Status] message that + // specifies the error for the operation. + google.rpc.Status error = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The translation result that is currently being processed (is_final could be + // true or false). + StreamingTranslateSpeechResult result = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Indicates the type of speech event. + SpeechEventType speech_event_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.mediatranslation.v1beta1.json b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.mediatranslation.v1beta1.json new file mode 100644 index 00000000000..4d12e4092a2 --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.mediatranslation.v1beta1.json @@ -0,0 +1,59 @@ +{ + "clientLibrary": { + "name": "nodejs-mediatranslation", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.mediatranslation.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "mediatranslation_v1beta1_generated_SpeechTranslationService_StreamingTranslateSpeech_async", + "title": "SpeechTranslationService streamingTranslateSpeech Sample", + "origin": "API_DEFINITION", + "description": " Performs bidirectional streaming speech translation: receive results while sending audio. This method is only available via the gRPC API (not REST).", + "canonical": true, + "file": "speech_translation_service.streaming_translate_speech.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StreamingTranslateSpeech", + "fullName": "google.cloud.mediatranslation.v1beta1.SpeechTranslationService.StreamingTranslateSpeech", + "async": true, + "parameters": [ + { + "name": "streaming_config", + "type": ".google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechConfig" + }, + { + "name": "audio_content", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse", + "client": { + "shortName": "SpeechTranslationServiceClient", + "fullName": "google.cloud.mediatranslation.v1beta1.SpeechTranslationServiceClient" + }, + "method": { + "shortName": "StreamingTranslateSpeech", + "fullName": "google.cloud.mediatranslation.v1beta1.SpeechTranslationService.StreamingTranslateSpeech", + "service": { + "shortName": "SpeechTranslationService", + "fullName": "google.cloud.mediatranslation.v1beta1.SpeechTranslationService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/samples/generated/v1beta1/speech_translation_service.streaming_translate_speech.js b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/samples/generated/v1beta1/speech_translation_service.streaming_translate_speech.js new file mode 100644 index 00000000000..3523410caf7 --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/samples/generated/v1beta1/speech_translation_service.streaming_translate_speech.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() { + // [START mediatranslation_v1beta1_generated_SpeechTranslationService_StreamingTranslateSpeech_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. + */ + /** + * Provides information to the recognizer that specifies how to process the + * request. The first `StreamingTranslateSpeechRequest` message must contain + * a `streaming_config` message. + */ + // const streamingConfig = {} + /** + * The audio data to be translated. Sequential chunks of audio data are sent + * in sequential `StreamingTranslateSpeechRequest` messages. The first + * `StreamingTranslateSpeechRequest` message must not contain + * `audio_content` data and all subsequent `StreamingTranslateSpeechRequest` + * messages must contain `audio_content` data. The audio bytes must be + * encoded as specified in `StreamingTranslateSpeechConfig`. Note: as with + * all bytes fields, protobuffers use a pure binary representation (not + * base64). + */ + // const audioContent = Buffer.from('string') + + // Imports the Mediatranslation library + const {SpeechTranslationServiceClient} = require('@google-cloud/media-translation').v1beta1; + + // Instantiates a client + const mediatranslationClient = new SpeechTranslationServiceClient(); + + async function callStreamingTranslateSpeech() { + // Construct request + const request = { + }; + + // Run request + const stream = await mediatranslationClient.streamingTranslateSpeech(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callStreamingTranslateSpeech(); + // [END mediatranslation_v1beta1_generated_SpeechTranslationService_StreamingTranslateSpeech_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-mediatranslation/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/index.ts new file mode 100644 index 00000000000..da4ad7ca4db --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/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 SpeechTranslationServiceClient = v1beta1.SpeechTranslationServiceClient; +type SpeechTranslationServiceClient = v1beta1.SpeechTranslationServiceClient; +export {v1beta1, SpeechTranslationServiceClient}; +export default {v1beta1, SpeechTranslationServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/gapic_metadata.json new file mode 100644 index 00000000000..0a32f7ae25f --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/gapic_metadata.json @@ -0,0 +1,27 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.mediatranslation.v1beta1", + "libraryPackage": "@google-cloud/media-translation", + "services": { + "SpeechTranslationService": { + "clients": { + "grpc": { + "libraryClient": "SpeechTranslationServiceClient", + "rpcs": { + "StreamingTranslateSpeech": { + "methods": [ + "streamingTranslateSpeech" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SpeechTranslationServiceClient", + "rpcs": {} + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/index.ts new file mode 100644 index 00000000000..e0ce5ec8f2c --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/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 {SpeechTranslationServiceClient} from './speech_translation_service_client'; diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_client.ts b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_client.ts new file mode 100644 index 00000000000..f7858946705 --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_client.ts @@ -0,0 +1,342 @@ +// 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 {PassThrough} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta1/speech_translation_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './speech_translation_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Provides translation from/to media types. + * @class + * @memberof v1beta1 + */ +export class SpeechTranslationServiceClient { + 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}; + speechTranslationServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SpeechTranslationServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 SpeechTranslationServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SpeechTranslationServiceClient; + 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 { + 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); + + // Some of the methods on this service provide streaming responses. + // Provide descriptors for these. + this.descriptors.stream = { + streamingTranslateSpeech: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.mediatranslation.v1beta1.SpeechTranslationService', 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.speechTranslationServiceStub) { + return this.speechTranslationServiceStub; + } + + // Put together the "service stub" for + // google.cloud.mediatranslation.v1beta1.SpeechTranslationService. + this.speechTranslationServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.mediatranslation.v1beta1.SpeechTranslationService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.mediatranslation.v1beta1.SpeechTranslationService, + 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 speechTranslationServiceStubMethods = + ['streamingTranslateSpeech']; + for (const methodName of speechTranslationServiceStubMethods) { + const callPromise = this.speechTranslationServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + if (methodName in this.descriptors.stream) { + const stream = new PassThrough(); + setImmediate(() => { + stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); + }); + return stream; + } + 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.stream[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.speechTranslationServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'mediatranslation.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 'mediatranslation.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 -- + // ------------------- + +/** + * Performs bidirectional streaming speech translation: receive results while + * sending audio. This method is only available via the gRPC API (not REST). + * + * @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 is both readable and writable. It accepts objects + * representing {@link protos.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechRequest|StreamingTranslateSpeechRequest} for write() method, and + * will emit objects representing {@link protos.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse|StreamingTranslateSpeechResponse} on 'data' event asynchronously. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/speech_translation_service.streaming_translate_speech.js + * region_tag:mediatranslation_v1beta1_generated_SpeechTranslationService_StreamingTranslateSpeech_async + */ + streamingTranslateSpeech( + options?: CallOptions): + gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.streamingTranslateSpeech(null, options); + } + + + /** + * 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.speechTranslationServiceStub && !this._terminated) { + return this.speechTranslationServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_client_config.json b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_client_config.json new file mode 100644 index 00000000000..75bcb1e3260 --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.mediatranslation.v1beta1.SpeechTranslationService": { + "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": { + "StreamingTranslateSpeech": { + "timeout_millis": 400000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_proto_list.json b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_proto_list.json new file mode 100644 index 00000000000..ede436a2170 --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/mediatranslation/v1beta1/media_translation.proto" +] diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..aa7872d9645 --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/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 mediatranslation = require('@google-cloud/media-translation'); + +function main() { + const speechTranslationServiceClient = new mediatranslation.SpeechTranslationServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..9cee11a1b5b --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/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 {SpeechTranslationServiceClient} from '@google-cloud/media-translation'; + +// check that the client class type name can be used +function doStuffWithSpeechTranslationServiceClient(client: SpeechTranslationServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const speechTranslationServiceClient = new SpeechTranslationServiceClient(); + doStuffWithSpeechTranslationServiceClient(speechTranslationServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/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-mediatranslation/v1beta1/test/gapic_speech_translation_service_v1beta1.ts b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/test/gapic_speech_translation_service_v1beta1.ts new file mode 100644 index 00000000000..47a6b583328 --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/test/gapic_speech_translation_service_v1beta1.ts @@ -0,0 +1,217 @@ +// 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 speechtranslationserviceModule 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 stubBidiStreamingCall(response?: ResponseType, error?: Error) { + const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + return sinon.stub().returns(mockStream); +} + +describe('v1beta1.SpeechTranslationServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.speechTranslationServiceStub, undefined); + await client.initialize(); + assert(client.speechTranslationServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.speechTranslationServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.speechTranslationServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient({ + 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 speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient({ + 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('streamingTranslateSpeech', () => { + it('invokes streamingTranslateSpeech without error', async () => { + const client = new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechRequest() + ); + + const expectedResponse = generateSampleMessage( + new protos.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse() + ); + client.innerApiCalls.streamingTranslateSpeech = stubBidiStreamingCall(expectedResponse); + const stream = client.streamingTranslateSpeech(); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.streamingTranslateSpeech as SinonStub) + .getCall(0).calledWith(null)); + assert.deepStrictEqual(((stream as unknown as PassThrough) + ._transform as SinonStub).getCall(0).args[0], request); + }); + + it('invokes streamingTranslateSpeech with error', async () => { + const client = new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.streamingTranslateSpeech = stubBidiStreamingCall(undefined, expectedError); + const stream = client.streamingTranslateSpeech(); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert((client.innerApiCalls.streamingTranslateSpeech as SinonStub) + .getCall(0).calledWith(null)); + assert.deepStrictEqual(((stream as unknown as PassThrough) + ._transform as SinonStub).getCall(0).args[0], request); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/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-mediatranslation/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/webpack.config.js new file mode 100644 index 00000000000..52c6d008165 --- /dev/null +++ b/owl-bot-staging/google-cloud-mediatranslation/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: 'SpeechTranslationService', + filename: './speech-translation-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-memcache/v1/.eslintignore b/owl-bot-staging/google-cloud-memcache/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-memcache/v1/.eslintrc.json b/owl-bot-staging/google-cloud-memcache/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-memcache/v1/.gitignore b/owl-bot-staging/google-cloud-memcache/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/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-memcache/v1/.jsdoc.js b/owl-bot-staging/google-cloud-memcache/v1/.jsdoc.js new file mode 100644 index 00000000000..3933f5c8b73 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/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/memcache', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-memcache/v1/.mocharc.js b/owl-bot-staging/google-cloud-memcache/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/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-memcache/v1/.prettierrc.js b/owl-bot-staging/google-cloud-memcache/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/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-memcache/v1/README.md b/owl-bot-staging/google-cloud-memcache/v1/README.md new file mode 100644 index 00000000000..fc7ba0933a7 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/README.md @@ -0,0 +1 @@ +Memcache: Nodejs Client diff --git a/owl-bot-staging/google-cloud-memcache/v1/package.json b/owl-bot-staging/google-cloud-memcache/v1/package.json new file mode 100644 index 00000000000..ac0a246880d --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/memcache", + "version": "0.1.0", + "description": "Memcache client for Node.js", + "repository": "googleapis/nodejs-memcache", + "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 memcache", + "memcache", + "cloud memcache" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-memcache/v1/protos/google/cloud/memcache/v1/cloud_memcache.proto b/owl-bot-staging/google-cloud-memcache/v1/protos/google/cloud/memcache/v1/cloud_memcache.proto new file mode 100644 index 00000000000..47606fab4ba --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/protos/google/cloud/memcache/v1/cloud_memcache.proto @@ -0,0 +1,618 @@ +// 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 +// +// 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.memcache.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/dayofweek.proto"; +import "google/type/timeofday.proto"; + +option go_package = "cloud.google.com/go/memcache/apiv1/memcachepb;memcachepb"; +option java_multiple_files = true; +option java_outer_classname = "CloudMemcacheProto"; +option java_package = "com.google.cloud.memcache.v1"; + +// Configures and manages Cloud Memorystore for Memcached instances. +// +// +// The `memcache.googleapis.com` service implements the Google Cloud Memorystore +// for Memcached API and defines the following resource model for managing +// Memorystore Memcached (also called Memcached below) instances: +// * The service works with a collection of cloud projects, named: `/projects/*` +// * Each project has a collection of available locations, named: `/locations/*` +// * Each location has a collection of Memcached instances, named: +// `/instances/*` +// * As such, Memcached instances are resources of the form: +// `/projects/{project_id}/locations/{location_id}/instances/{instance_id}` +// +// Note that location_id must be a GCP `region`; for example: +// * `projects/my-memcached-project/locations/us-central1/instances/my-memcached` +service CloudMemcache { + option (google.api.default_host) = "memcache.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists Instances in a given location. + rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/instances" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single Instance. + rpc GetInstance(GetInstanceRequest) returns (Instance) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/instances/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new Instance in a given location. + rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/instances" + body: "instance" + }; + option (google.api.method_signature) = "parent,instance,instance_id"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.memcache.v1.Instance" + metadata_type: "google.cloud.memcache.v1.OperationMetadata" + }; + } + + // Updates an existing Instance in a given project and location. + rpc UpdateInstance(UpdateInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{instance.name=projects/*/locations/*/instances/*}" + body: "instance" + }; + option (google.api.method_signature) = "instance,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.memcache.v1.Instance" + metadata_type: "google.cloud.memcache.v1.OperationMetadata" + }; + } + + // Updates the defined Memcached parameters for an existing instance. + // This method only stages the parameters, it must be followed by + // `ApplyParameters` to apply the parameters to nodes of the Memcached + // instance. + rpc UpdateParameters(UpdateParametersRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{name=projects/*/locations/*/instances/*}:updateParameters" + body: "*" + }; + option (google.api.method_signature) = "name,update_mask,parameters"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.memcache.v1.Instance" + metadata_type: "google.cloud.memcache.v1.OperationMetadata" + }; + } + + // Deletes a single Instance. + rpc DeleteInstance(DeleteInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/instances/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.memcache.v1.OperationMetadata" + }; + } + + // `ApplyParameters` restarts the set of specified nodes in order to update + // them to the current set of parameters for the Memcached Instance. + rpc ApplyParameters(ApplyParametersRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/instances/*}:applyParameters" + body: "*" + }; + option (google.api.method_signature) = "name,node_ids,apply_all"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.memcache.v1.Instance" + metadata_type: "google.cloud.memcache.v1.OperationMetadata" + }; + } + + // Reschedules upcoming maintenance event. + rpc RescheduleMaintenance(RescheduleMaintenanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{instance=projects/*/locations/*/instances/*}:rescheduleMaintenance" + body: "*" + }; + option (google.api.method_signature) = "instance, reschedule_type, schedule_time"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.memcache.v1.Instance" + metadata_type: "google.cloud.memcache.v1.OperationMetadata" + }; + } +} + +// A Memorystore for Memcached instance +message Instance { + option (google.api.resource) = { + type: "memcache.googleapis.com/Instance" + pattern: "projects/{project}/locations/{location}/instances/{instance}" + }; + + // Different states of a Memcached instance. + enum State { + // State not set. + STATE_UNSPECIFIED = 0; + + // Memcached instance is being created. + CREATING = 1; + + // Memcached instance has been created and ready to be used. + READY = 2; + + // Memcached instance is updating configuration such as maintenance policy + // and schedule. + UPDATING = 3; + + // Memcached instance is being deleted. + DELETING = 4; + + // Memcached instance is going through maintenance, e.g. data plane rollout. + PERFORMING_MAINTENANCE = 5; + } + + // Configuration for a Memcached Node. + message NodeConfig { + // Required. Number of cpus per Memcached node. + int32 cpu_count = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Memory size in MiB for each Memcached node. + int32 memory_size_mb = 2 [(google.api.field_behavior) = REQUIRED]; + } + + message Node { + // Different states of a Memcached node. + enum State { + // Node state is not set. + STATE_UNSPECIFIED = 0; + + // Node is being created. + CREATING = 1; + + // Node has been created and ready to be used. + READY = 2; + + // Node is being deleted. + DELETING = 3; + + // Node is being updated. + UPDATING = 4; + } + + // Output only. Identifier of the Memcached node. The node id does not + // include project or location like the Memcached instance name. + string node_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Location (GCP Zone) for the Memcached node. + string zone = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Current state of the Memcached node. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Hostname or IP address of the Memcached node used by the + // clients to connect to the Memcached server on this node. + string host = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The port number of the Memcached server on this node. + int32 port = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User defined parameters currently applied to the node. + MemcacheParameters parameters = 6; + } + + message InstanceMessage { + enum Code { + // Message Code not set. + CODE_UNSPECIFIED = 0; + + // Memcached nodes are distributed unevenly. + ZONE_DISTRIBUTION_UNBALANCED = 1; + } + + // A code that correspond to one type of user-facing message. + Code code = 1; + + // Message on memcached instance which will be exposed to users. + string message = 2; + } + + // Required. Unique name of the resource in this scope including project and + // location using the form: + // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + // + // Note: Memcached instances are managed and addressed at the regional level + // so `location_id` here refers to a Google Cloud region; however, users may + // choose which zones Memcached nodes should be provisioned in within an + // instance. Refer to [zones][google.cloud.memcache.v1.Instance.zones] field for more details. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // User provided name for the instance, which is only used for display + // purposes. Cannot be more than 80 characters. + string display_name = 2; + + // Resource labels to represent user-provided metadata. + // Refer to cloud documentation on labels for more details. + // https://cloud.google.com/compute/docs/labeling-resources + map labels = 3; + + // The full name of the Google Compute Engine + // [network](/compute/docs/networks-and-firewalls#networks) to which the + // instance is connected. If left unspecified, the `default` network + // will be used. + string authorized_network = 4; + + // Zones in which Memcached nodes should be provisioned. + // Memcached nodes will be equally distributed across these zones. If not + // provided, the service will by default create nodes in all zones in the + // region for the instance. + repeated string zones = 5; + + // Required. Number of nodes in the Memcached instance. + int32 node_count = 6 [(google.api.field_behavior) = REQUIRED]; + + // Required. Configuration for Memcached nodes. + NodeConfig node_config = 7 [(google.api.field_behavior) = REQUIRED]; + + // The major version of Memcached software. + // If not provided, latest supported version will be used. Currently the + // latest supported major version is `MEMCACHE_1_5`. + // The minor version will be automatically determined by our system based on + // the latest supported minor version. + MemcacheVersion memcache_version = 9; + + // User defined parameters to apply to the memcached process + // on each node. + MemcacheParameters parameters = 11; + + // Output only. List of Memcached nodes. + // Refer to [Node][google.cloud.memcache.v1.Instance.Node] message for more details. + repeated Node memcache_nodes = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the instance was created. + google.protobuf.Timestamp create_time = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the instance was updated. + google.protobuf.Timestamp update_time = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The state of this Memcached instance. + State state = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The full version of memcached server running on this instance. + // System automatically determines the full memcached version for an instance + // based on the input MemcacheVersion. + // The full version format will be "memcached-1.5.16". + string memcache_full_version = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // List of messages that describe the current state of the Memcached instance. + repeated InstanceMessage instance_messages = 19; + + // Output only. Endpoint for the Discovery API. + string discovery_endpoint = 20 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The maintenance policy for the instance. If not provided, + // the maintenance event will be performed based on Memorystore + // internal rollout schedule. + MaintenancePolicy maintenance_policy = 21; + + // Output only. Published maintenance schedule. + MaintenanceSchedule maintenance_schedule = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Maintenance policy per instance. +message MaintenancePolicy { + // Output only. The time when the policy was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the policy was updated. + google.protobuf.Timestamp update_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Description of what this policy is for. Create/Update methods + // return INVALID_ARGUMENT if the length is greater than 512. + string description = 3; + + // Required. Maintenance window that is applied to resources covered by this + // policy. Minimum 1. For the current version, the maximum number of + // weekly_maintenance_windows is expected to be one. + repeated WeeklyMaintenanceWindow weekly_maintenance_window = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// Time window specified for weekly operations. +message WeeklyMaintenanceWindow { + // Required. Allows to define schedule that runs specified day of the week. + google.type.DayOfWeek day = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Start time of the window in UTC. + google.type.TimeOfDay start_time = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Duration of the time window. + google.protobuf.Duration duration = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Upcoming maintenance schedule. +message MaintenanceSchedule { + // Output only. The start time of any upcoming scheduled maintenance for this instance. + google.protobuf.Timestamp start_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The end time of any upcoming scheduled maintenance for this instance. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The deadline that the maintenance schedule start time can not go beyond, + // including reschedule. + google.protobuf.Timestamp schedule_deadline_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request for [RescheduleMaintenance][google.cloud.memcache.v1.CloudMemcache.RescheduleMaintenance]. +message RescheduleMaintenanceRequest { + // Reschedule options. + enum RescheduleType { + // Not set. + RESCHEDULE_TYPE_UNSPECIFIED = 0; + + // If the user wants to schedule the maintenance to happen now. + IMMEDIATE = 1; + + // If the user wants to use the existing maintenance policy to find the + // next available window. + NEXT_AVAILABLE_WINDOW = 2; + + // If the user wants to reschedule the maintenance to a specific time. + SPECIFIC_TIME = 3; + } + + // Required. Memcache instance resource name using the form: + // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + // where `location_id` refers to a GCP region. + string instance = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "memcache.googleapis.com/Instance" + } + ]; + + // Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well. + RescheduleType reschedule_type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Timestamp when the maintenance shall be rescheduled to if + // reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for + // example `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp schedule_time = 3; +} + +// Request for [ListInstances][google.cloud.memcache.v1.CloudMemcache.ListInstances]. +message ListInstancesRequest { + // Required. The resource name of the instance location using the form: + // `projects/{project_id}/locations/{location_id}` + // where `location_id` refers to a GCP region + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of items to return. + // + // If not specified, a default value of 1000 will be used by the service. + // Regardless of the `page_size` value, the response may include a partial + // list and a caller should only rely on response's + // [`next_page_token`][google.cloud.memcache.v1.ListInstancesResponse.next_page_token] + // to determine if there are more instances left to be queried. + int32 page_size = 2; + + // The `next_page_token` value returned from a previous List request, if any. + string page_token = 3; + + // List filter. For example, exclude all Memcached instances with name as + // my-instance by specifying `"name != my-instance"`. + string filter = 4; + + // Sort results. Supported values are "name", "name desc" or "" (unsorted). + string order_by = 5; +} + +// Response for [ListInstances][google.cloud.memcache.v1.CloudMemcache.ListInstances]. +message ListInstancesResponse { + // A list of Memcached instances in the project in the specified location, + // or across all locations. + // + // If the `location_id` in the parent field of the request is "-", all regions + // available to the project are queried, and the results aggregated. + repeated Instance instances = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request for [GetInstance][google.cloud.memcache.v1.CloudMemcache.GetInstance]. +message GetInstanceRequest { + // Required. Memcached instance resource name in the format: + // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + // where `location_id` refers to a GCP region + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "memcache.googleapis.com/Instance" + } + ]; +} + +// Request for [CreateInstance][google.cloud.memcache.v1.CloudMemcache.CreateInstance]. +message CreateInstanceRequest { + // Required. The resource name of the instance location using the form: + // `projects/{project_id}/locations/{location_id}` + // where `location_id` refers to a GCP region + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The logical name of the Memcached instance in the user + // project with the following restrictions: + // + // * Must contain only lowercase letters, numbers, and hyphens. + // * Must start with a letter. + // * Must be between 1-40 characters. + // * Must end with a number or a letter. + // * Must be unique within the user project / location. + // + // If any of the above are not met, the API raises an invalid argument error. + string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A Memcached Instance + Instance instance = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for [UpdateInstance][google.cloud.memcache.v1.CloudMemcache.UpdateInstance]. +message UpdateInstanceRequest { + // Required. Mask of fields to update. + // + // * `displayName` + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A Memcached Instance. + // Only fields specified in update_mask are updated. + Instance instance = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for [DeleteInstance][google.cloud.memcache.v1.CloudMemcache.DeleteInstance]. +message DeleteInstanceRequest { + // Required. Memcached instance resource name in the format: + // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + // where `location_id` refers to a GCP region + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "memcache.googleapis.com/Instance" + } + ]; +} + +// Request for [ApplyParameters][google.cloud.memcache.v1.CloudMemcache.ApplyParameters]. +message ApplyParametersRequest { + // Required. Resource name of the Memcached instance for which parameter group updates + // should be applied. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "memcache.googleapis.com/Instance" + } + ]; + + // Nodes to which the instance-level parameter group is applied. + repeated string node_ids = 2; + + // Whether to apply instance-level parameter group to all nodes. If set to + // true, users are restricted from specifying individual nodes, and + // `ApplyParameters` updates all nodes within the instance. + bool apply_all = 3; +} + +// Request for [UpdateParameters][google.cloud.memcache.v1.CloudMemcache.UpdateParameters]. +message UpdateParametersRequest { + // Required. Resource name of the Memcached instance for which the parameters should be + // updated. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "memcache.googleapis.com/Instance" + } + ]; + + // Required. Mask of fields to update. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // The parameters to apply to the instance. + MemcacheParameters parameters = 3; +} + +// Memcached versions supported by our service. +enum MemcacheVersion { + MEMCACHE_VERSION_UNSPECIFIED = 0; + + // Memcached 1.5 version. + MEMCACHE_1_5 = 1; +} + +message MemcacheParameters { + // Output only. The unique ID associated with this set of parameters. Users + // can use this id to determine if the parameters associated with the instance + // differ from the parameters associated with the nodes. A discrepancy between + // parameter ids can inform users that they may need to take action to apply + // parameters on nodes. + string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User defined set of parameters to use in the memcached process. + map params = 3; +} + +// Represents the metadata of a long-running operation. +message OperationMetadata { + // Output only. Time when the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_detail = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Metadata for the given [google.cloud.location.Location][google.cloud.location.Location]. +message LocationMetadata { + // Output only. The set of available zones in the location. The map is keyed + // by the lowercase ID of each zone, as defined by GCE. These keys can be + // specified in the `zones` field when creating a Memcached instance. + map available_zones = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +message ZoneMetadata { + +} diff --git a/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.apply_parameters.js b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.apply_parameters.js new file mode 100644 index 00000000000..58617c0077e --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.apply_parameters.js @@ -0,0 +1,73 @@ +// 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 memcache_v1_generated_CloudMemcache_ApplyParameters_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. Resource name of the Memcached instance for which parameter group updates + * should be applied. + */ + // const name = 'abc123' + /** + * Nodes to which the instance-level parameter group is applied. + */ + // const nodeIds = ['abc','def'] + /** + * Whether to apply instance-level parameter group to all nodes. If set to + * true, users are restricted from specifying individual nodes, and + * `ApplyParameters` updates all nodes within the instance. + */ + // const applyAll = true + + // Imports the Memcache library + const {CloudMemcacheClient} = require('@google-cloud/memcache').v1; + + // Instantiates a client + const memcacheClient = new CloudMemcacheClient(); + + async function callApplyParameters() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await memcacheClient.applyParameters(request); + const [response] = await operation.promise(); + console.log(response); + } + + callApplyParameters(); + // [END memcache_v1_generated_CloudMemcache_ApplyParameters_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-memcache/v1/samples/generated/v1/cloud_memcache.create_instance.js b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.create_instance.js new file mode 100644 index 00000000000..c3bcb26f195 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.create_instance.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, instanceId, instance) { + // [START memcache_v1_generated_CloudMemcache_CreateInstance_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the instance location using the form: + * `projects/{project_id}/locations/{location_id}` + * where `location_id` refers to a GCP region + */ + // const parent = 'abc123' + /** + * Required. The logical name of the Memcached instance in the user + * project with the following restrictions: + * * Must contain only lowercase letters, numbers, and hyphens. + * * Must start with a letter. + * * Must be between 1-40 characters. + * * Must end with a number or a letter. + * * Must be unique within the user project / location. + * If any of the above are not met, the API raises an invalid argument error. + */ + // const instanceId = 'abc123' + /** + * Required. A Memcached Instance + */ + // const instance = {} + + // Imports the Memcache library + const {CloudMemcacheClient} = require('@google-cloud/memcache').v1; + + // Instantiates a client + const memcacheClient = new CloudMemcacheClient(); + + async function callCreateInstance() { + // Construct request + const request = { + parent, + instanceId, + instance, + }; + + // Run request + const [operation] = await memcacheClient.createInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateInstance(); + // [END memcache_v1_generated_CloudMemcache_CreateInstance_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-memcache/v1/samples/generated/v1/cloud_memcache.delete_instance.js b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.delete_instance.js new file mode 100644 index 00000000000..45c11b5b8e2 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.delete_instance.js @@ -0,0 +1,64 @@ +// 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 memcache_v1_generated_CloudMemcache_DeleteInstance_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. Memcached instance resource name in the format: + * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + * where `location_id` refers to a GCP region + */ + // const name = 'abc123' + + // Imports the Memcache library + const {CloudMemcacheClient} = require('@google-cloud/memcache').v1; + + // Instantiates a client + const memcacheClient = new CloudMemcacheClient(); + + async function callDeleteInstance() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await memcacheClient.deleteInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteInstance(); + // [END memcache_v1_generated_CloudMemcache_DeleteInstance_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-memcache/v1/samples/generated/v1/cloud_memcache.get_instance.js b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.get_instance.js new file mode 100644 index 00000000000..37800fd0025 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.get_instance.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 memcache_v1_generated_CloudMemcache_GetInstance_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. Memcached instance resource name in the format: + * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + * where `location_id` refers to a GCP region + */ + // const name = 'abc123' + + // Imports the Memcache library + const {CloudMemcacheClient} = require('@google-cloud/memcache').v1; + + // Instantiates a client + const memcacheClient = new CloudMemcacheClient(); + + async function callGetInstance() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await memcacheClient.getInstance(request); + console.log(response); + } + + callGetInstance(); + // [END memcache_v1_generated_CloudMemcache_GetInstance_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-memcache/v1/samples/generated/v1/cloud_memcache.list_instances.js b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.list_instances.js new file mode 100644 index 00000000000..a3638999476 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.list_instances.js @@ -0,0 +1,87 @@ +// 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 memcache_v1_generated_CloudMemcache_ListInstances_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the instance location using the form: + * `projects/{project_id}/locations/{location_id}` + * where `location_id` refers to a GCP region + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + * If not specified, a default value of 1000 will be used by the service. + * Regardless of the `page_size` value, the response may include a partial + * list and a caller should only rely on response's + * `next_page_token` google.cloud.memcache.v1.ListInstancesResponse.next_page_token + * to determine if there are more instances left to be queried. + */ + // const pageSize = 1234 + /** + * The `next_page_token` value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + /** + * List filter. For example, exclude all Memcached instances with name as + * my-instance by specifying `"name != my-instance"`. + */ + // const filter = 'abc123' + /** + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + */ + // const orderBy = 'abc123' + + // Imports the Memcache library + const {CloudMemcacheClient} = require('@google-cloud/memcache').v1; + + // Instantiates a client + const memcacheClient = new CloudMemcacheClient(); + + async function callListInstances() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await memcacheClient.listInstancesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListInstances(); + // [END memcache_v1_generated_CloudMemcache_ListInstances_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-memcache/v1/samples/generated/v1/cloud_memcache.reschedule_maintenance.js b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.reschedule_maintenance.js new file mode 100644 index 00000000000..37e39556d41 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.reschedule_maintenance.js @@ -0,0 +1,75 @@ +// 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(instance, rescheduleType) { + // [START memcache_v1_generated_CloudMemcache_RescheduleMaintenance_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. Memcache instance resource name using the form: + * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + * where `location_id` refers to a GCP region. + */ + // const instance = 'abc123' + /** + * Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well. + */ + // const rescheduleType = {} + /** + * Timestamp when the maintenance shall be rescheduled to if + * reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for + * example `2012-11-15T16:19:00.094Z`. + */ + // const scheduleTime = {} + + // Imports the Memcache library + const {CloudMemcacheClient} = require('@google-cloud/memcache').v1; + + // Instantiates a client + const memcacheClient = new CloudMemcacheClient(); + + async function callRescheduleMaintenance() { + // Construct request + const request = { + instance, + rescheduleType, + }; + + // Run request + const [operation] = await memcacheClient.rescheduleMaintenance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRescheduleMaintenance(); + // [END memcache_v1_generated_CloudMemcache_RescheduleMaintenance_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-memcache/v1/samples/generated/v1/cloud_memcache.update_instance.js b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.update_instance.js new file mode 100644 index 00000000000..019bd2e2a0b --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.update_instance.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(updateMask, instance) { + // [START memcache_v1_generated_CloudMemcache_UpdateInstance_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. Mask of fields to update. + * * `displayName` + */ + // const updateMask = {} + /** + * Required. A Memcached Instance. + * Only fields specified in update_mask are updated. + */ + // const instance = {} + + // Imports the Memcache library + const {CloudMemcacheClient} = require('@google-cloud/memcache').v1; + + // Instantiates a client + const memcacheClient = new CloudMemcacheClient(); + + async function callUpdateInstance() { + // Construct request + const request = { + updateMask, + instance, + }; + + // Run request + const [operation] = await memcacheClient.updateInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateInstance(); + // [END memcache_v1_generated_CloudMemcache_UpdateInstance_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-memcache/v1/samples/generated/v1/cloud_memcache.update_parameters.js b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.update_parameters.js new file mode 100644 index 00000000000..0c10086620d --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.update_parameters.js @@ -0,0 +1,72 @@ +// 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, updateMask) { + // [START memcache_v1_generated_CloudMemcache_UpdateParameters_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. Resource name of the Memcached instance for which the parameters should be + * updated. + */ + // const name = 'abc123' + /** + * Required. Mask of fields to update. + */ + // const updateMask = {} + /** + * The parameters to apply to the instance. + */ + // const parameters = {} + + // Imports the Memcache library + const {CloudMemcacheClient} = require('@google-cloud/memcache').v1; + + // Instantiates a client + const memcacheClient = new CloudMemcacheClient(); + + async function callUpdateParameters() { + // Construct request + const request = { + name, + updateMask, + }; + + // Run request + const [operation] = await memcacheClient.updateParameters(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateParameters(); + // [END memcache_v1_generated_CloudMemcache_UpdateParameters_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-memcache/v1/samples/generated/v1/snippet_metadata_google.cloud.memcache.v1.json b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/snippet_metadata_google.cloud.memcache.v1.json new file mode 100644 index 00000000000..8d1ed37fe55 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/snippet_metadata_google.cloud.memcache.v1.json @@ -0,0 +1,387 @@ +{ + "clientLibrary": { + "name": "nodejs-memcache", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.memcache.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "memcache_v1_generated_CloudMemcache_ListInstances_async", + "title": "CloudMemcache listInstances Sample", + "origin": "API_DEFINITION", + "description": " Lists Instances in a given location.", + "canonical": true, + "file": "cloud_memcache.list_instances.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListInstances", + "fullName": "google.cloud.memcache.v1.CloudMemcache.ListInstances", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.memcache.v1.ListInstancesResponse", + "client": { + "shortName": "CloudMemcacheClient", + "fullName": "google.cloud.memcache.v1.CloudMemcacheClient" + }, + "method": { + "shortName": "ListInstances", + "fullName": "google.cloud.memcache.v1.CloudMemcache.ListInstances", + "service": { + "shortName": "CloudMemcache", + "fullName": "google.cloud.memcache.v1.CloudMemcache" + } + } + } + }, + { + "regionTag": "memcache_v1_generated_CloudMemcache_GetInstance_async", + "title": "CloudMemcache getInstance Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single Instance.", + "canonical": true, + "file": "cloud_memcache.get_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetInstance", + "fullName": "google.cloud.memcache.v1.CloudMemcache.GetInstance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.memcache.v1.Instance", + "client": { + "shortName": "CloudMemcacheClient", + "fullName": "google.cloud.memcache.v1.CloudMemcacheClient" + }, + "method": { + "shortName": "GetInstance", + "fullName": "google.cloud.memcache.v1.CloudMemcache.GetInstance", + "service": { + "shortName": "CloudMemcache", + "fullName": "google.cloud.memcache.v1.CloudMemcache" + } + } + } + }, + { + "regionTag": "memcache_v1_generated_CloudMemcache_CreateInstance_async", + "title": "CloudMemcache createInstance Sample", + "origin": "API_DEFINITION", + "description": " Creates a new Instance in a given location.", + "canonical": true, + "file": "cloud_memcache.create_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateInstance", + "fullName": "google.cloud.memcache.v1.CloudMemcache.CreateInstance", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "instance_id", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": ".google.cloud.memcache.v1.Instance" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudMemcacheClient", + "fullName": "google.cloud.memcache.v1.CloudMemcacheClient" + }, + "method": { + "shortName": "CreateInstance", + "fullName": "google.cloud.memcache.v1.CloudMemcache.CreateInstance", + "service": { + "shortName": "CloudMemcache", + "fullName": "google.cloud.memcache.v1.CloudMemcache" + } + } + } + }, + { + "regionTag": "memcache_v1_generated_CloudMemcache_UpdateInstance_async", + "title": "CloudMemcache updateInstance Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing Instance in a given project and location.", + "canonical": true, + "file": "cloud_memcache.update_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateInstance", + "fullName": "google.cloud.memcache.v1.CloudMemcache.UpdateInstance", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "instance", + "type": ".google.cloud.memcache.v1.Instance" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudMemcacheClient", + "fullName": "google.cloud.memcache.v1.CloudMemcacheClient" + }, + "method": { + "shortName": "UpdateInstance", + "fullName": "google.cloud.memcache.v1.CloudMemcache.UpdateInstance", + "service": { + "shortName": "CloudMemcache", + "fullName": "google.cloud.memcache.v1.CloudMemcache" + } + } + } + }, + { + "regionTag": "memcache_v1_generated_CloudMemcache_UpdateParameters_async", + "title": "CloudMemcache updateParameters Sample", + "origin": "API_DEFINITION", + "description": " Updates the defined Memcached parameters for an existing instance. This method only stages the parameters, it must be followed by `ApplyParameters` to apply the parameters to nodes of the Memcached instance.", + "canonical": true, + "file": "cloud_memcache.update_parameters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateParameters", + "fullName": "google.cloud.memcache.v1.CloudMemcache.UpdateParameters", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "parameters", + "type": ".google.cloud.memcache.v1.MemcacheParameters" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudMemcacheClient", + "fullName": "google.cloud.memcache.v1.CloudMemcacheClient" + }, + "method": { + "shortName": "UpdateParameters", + "fullName": "google.cloud.memcache.v1.CloudMemcache.UpdateParameters", + "service": { + "shortName": "CloudMemcache", + "fullName": "google.cloud.memcache.v1.CloudMemcache" + } + } + } + }, + { + "regionTag": "memcache_v1_generated_CloudMemcache_DeleteInstance_async", + "title": "CloudMemcache deleteInstance Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single Instance.", + "canonical": true, + "file": "cloud_memcache.delete_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteInstance", + "fullName": "google.cloud.memcache.v1.CloudMemcache.DeleteInstance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudMemcacheClient", + "fullName": "google.cloud.memcache.v1.CloudMemcacheClient" + }, + "method": { + "shortName": "DeleteInstance", + "fullName": "google.cloud.memcache.v1.CloudMemcache.DeleteInstance", + "service": { + "shortName": "CloudMemcache", + "fullName": "google.cloud.memcache.v1.CloudMemcache" + } + } + } + }, + { + "regionTag": "memcache_v1_generated_CloudMemcache_ApplyParameters_async", + "title": "CloudMemcache applyParameters Sample", + "origin": "API_DEFINITION", + "description": " `ApplyParameters` restarts the set of specified nodes in order to update them to the current set of parameters for the Memcached Instance.", + "canonical": true, + "file": "cloud_memcache.apply_parameters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ApplyParameters", + "fullName": "google.cloud.memcache.v1.CloudMemcache.ApplyParameters", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "node_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "apply_all", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudMemcacheClient", + "fullName": "google.cloud.memcache.v1.CloudMemcacheClient" + }, + "method": { + "shortName": "ApplyParameters", + "fullName": "google.cloud.memcache.v1.CloudMemcache.ApplyParameters", + "service": { + "shortName": "CloudMemcache", + "fullName": "google.cloud.memcache.v1.CloudMemcache" + } + } + } + }, + { + "regionTag": "memcache_v1_generated_CloudMemcache_RescheduleMaintenance_async", + "title": "CloudMemcache rescheduleMaintenance Sample", + "origin": "API_DEFINITION", + "description": " Reschedules upcoming maintenance event.", + "canonical": true, + "file": "cloud_memcache.reschedule_maintenance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RescheduleMaintenance", + "fullName": "google.cloud.memcache.v1.CloudMemcache.RescheduleMaintenance", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "reschedule_type", + "type": ".google.cloud.memcache.v1.RescheduleMaintenanceRequest.RescheduleType" + }, + { + "name": "schedule_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudMemcacheClient", + "fullName": "google.cloud.memcache.v1.CloudMemcacheClient" + }, + "method": { + "shortName": "RescheduleMaintenance", + "fullName": "google.cloud.memcache.v1.CloudMemcache.RescheduleMaintenance", + "service": { + "shortName": "CloudMemcache", + "fullName": "google.cloud.memcache.v1.CloudMemcache" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-memcache/v1/src/index.ts b/owl-bot-staging/google-cloud-memcache/v1/src/index.ts new file mode 100644 index 00000000000..7920946ca3b --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/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 v1 from './v1'; +const CloudMemcacheClient = v1.CloudMemcacheClient; +type CloudMemcacheClient = v1.CloudMemcacheClient; +export {v1, CloudMemcacheClient}; +export default {v1, CloudMemcacheClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_client.ts b/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_client.ts new file mode 100644 index 00000000000..6648bde98e3 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_client.ts @@ -0,0 +1,1619 @@ +// 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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/cloud_memcache_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './cloud_memcache_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Configures and manages Cloud Memorystore for Memcached instances. + * + * + * The `memcache.googleapis.com` service implements the Google Cloud Memorystore + * for Memcached API and defines the following resource model for managing + * Memorystore Memcached (also called Memcached below) instances: + * * The service works with a collection of cloud projects, named: `/projects/*` + * * Each project has a collection of available locations, named: `/locations/*` + * * Each location has a collection of Memcached instances, named: + * `/instances/*` + * * As such, Memcached instances are resources of the form: + * `/projects/{project_id}/locations/{location_id}/instances/{instance_id}` + * + * Note that location_id must be a GCP `region`; for example: + * * `projects/my-memcached-project/locations/us-central1/instances/my-memcached` + * @class + * @memberof v1 + */ +export class CloudMemcacheClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + cloudMemcacheStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CloudMemcacheClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 CloudMemcacheClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CloudMemcacheClient; + 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + 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 = { + instancePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/instances/{instance}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listInstances: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'instances') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createInstanceResponse = protoFilesRoot.lookup( + '.google.cloud.memcache.v1.Instance') as gax.protobuf.Type; + const createInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.memcache.v1.OperationMetadata') as gax.protobuf.Type; + const updateInstanceResponse = protoFilesRoot.lookup( + '.google.cloud.memcache.v1.Instance') as gax.protobuf.Type; + const updateInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.memcache.v1.OperationMetadata') as gax.protobuf.Type; + const updateParametersResponse = protoFilesRoot.lookup( + '.google.cloud.memcache.v1.Instance') as gax.protobuf.Type; + const updateParametersMetadata = protoFilesRoot.lookup( + '.google.cloud.memcache.v1.OperationMetadata') as gax.protobuf.Type; + const deleteInstanceResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.memcache.v1.OperationMetadata') as gax.protobuf.Type; + const applyParametersResponse = protoFilesRoot.lookup( + '.google.cloud.memcache.v1.Instance') as gax.protobuf.Type; + const applyParametersMetadata = protoFilesRoot.lookup( + '.google.cloud.memcache.v1.OperationMetadata') as gax.protobuf.Type; + const rescheduleMaintenanceResponse = protoFilesRoot.lookup( + '.google.cloud.memcache.v1.Instance') as gax.protobuf.Type; + const rescheduleMaintenanceMetadata = protoFilesRoot.lookup( + '.google.cloud.memcache.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createInstanceResponse.decode.bind(createInstanceResponse), + createInstanceMetadata.decode.bind(createInstanceMetadata)), + updateInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateInstanceResponse.decode.bind(updateInstanceResponse), + updateInstanceMetadata.decode.bind(updateInstanceMetadata)), + updateParameters: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateParametersResponse.decode.bind(updateParametersResponse), + updateParametersMetadata.decode.bind(updateParametersMetadata)), + deleteInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteInstanceResponse.decode.bind(deleteInstanceResponse), + deleteInstanceMetadata.decode.bind(deleteInstanceMetadata)), + applyParameters: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + applyParametersResponse.decode.bind(applyParametersResponse), + applyParametersMetadata.decode.bind(applyParametersMetadata)), + rescheduleMaintenance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + rescheduleMaintenanceResponse.decode.bind(rescheduleMaintenanceResponse), + rescheduleMaintenanceMetadata.decode.bind(rescheduleMaintenanceMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.memcache.v1.CloudMemcache', 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.cloudMemcacheStub) { + return this.cloudMemcacheStub; + } + + // Put together the "service stub" for + // google.cloud.memcache.v1.CloudMemcache. + this.cloudMemcacheStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.memcache.v1.CloudMemcache') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.memcache.v1.CloudMemcache, + 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 cloudMemcacheStubMethods = + ['listInstances', 'getInstance', 'createInstance', 'updateInstance', 'updateParameters', 'deleteInstance', 'applyParameters', 'rescheduleMaintenance']; + for (const methodName of cloudMemcacheStubMethods) { + const callPromise = this.cloudMemcacheStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.cloudMemcacheStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'memcache.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 'memcache.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 -- + // ------------------- +/** + * Gets details of a single Instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Memcached instance resource name in the format: + * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + * where `location_id` refers to a GCP region + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.memcache.v1.Instance|Instance}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_memcache.get_instance.js + * region_tag:memcache_v1_generated_CloudMemcache_GetInstance_async + */ + getInstance( + request?: protos.google.cloud.memcache.v1.IGetInstanceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.memcache.v1.IInstance, + protos.google.cloud.memcache.v1.IGetInstanceRequest|undefined, {}|undefined + ]>; + getInstance( + request: protos.google.cloud.memcache.v1.IGetInstanceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.memcache.v1.IInstance, + protos.google.cloud.memcache.v1.IGetInstanceRequest|null|undefined, + {}|null|undefined>): void; + getInstance( + request: protos.google.cloud.memcache.v1.IGetInstanceRequest, + callback: Callback< + protos.google.cloud.memcache.v1.IInstance, + protos.google.cloud.memcache.v1.IGetInstanceRequest|null|undefined, + {}|null|undefined>): void; + getInstance( + request?: protos.google.cloud.memcache.v1.IGetInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.memcache.v1.IInstance, + protos.google.cloud.memcache.v1.IGetInstanceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.memcache.v1.IInstance, + protos.google.cloud.memcache.v1.IGetInstanceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.memcache.v1.IInstance, + protos.google.cloud.memcache.v1.IGetInstanceRequest|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.getInstance(request, options, callback); + } + +/** + * Creates a new Instance in a given location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the instance location using the form: + * `projects/{project_id}/locations/{location_id}` + * where `location_id` refers to a GCP region + * @param {string} request.instanceId + * Required. The logical name of the Memcached instance in the user + * project with the following restrictions: + * + * * Must contain only lowercase letters, numbers, and hyphens. + * * Must start with a letter. + * * Must be between 1-40 characters. + * * Must end with a number or a letter. + * * Must be unique within the user project / location. + * + * If any of the above are not met, the API raises an invalid argument error. + * @param {google.cloud.memcache.v1.Instance} request.instance + * Required. A Memcached Instance + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_memcache.create_instance.js + * region_tag:memcache_v1_generated_CloudMemcache_CreateInstance_async + */ + createInstance( + request?: protos.google.cloud.memcache.v1.ICreateInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createInstance( + request: protos.google.cloud.memcache.v1.ICreateInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createInstance( + request: protos.google.cloud.memcache.v1.ICreateInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createInstance( + request?: protos.google.cloud.memcache.v1.ICreateInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createInstance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_memcache.create_instance.js + * region_tag:memcache_v1_generated_CloudMemcache_CreateInstance_async + */ + async checkCreateInstanceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createInstance, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an existing Instance in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. + * + * * `displayName` + * @param {google.cloud.memcache.v1.Instance} request.instance + * Required. A Memcached Instance. + * Only fields specified in update_mask are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_memcache.update_instance.js + * region_tag:memcache_v1_generated_CloudMemcache_UpdateInstance_async + */ + updateInstance( + request?: protos.google.cloud.memcache.v1.IUpdateInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateInstance( + request: protos.google.cloud.memcache.v1.IUpdateInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateInstance( + request: protos.google.cloud.memcache.v1.IUpdateInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateInstance( + request?: protos.google.cloud.memcache.v1.IUpdateInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'instance.name': request.instance!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateInstance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_memcache.update_instance.js + * region_tag:memcache_v1_generated_CloudMemcache_UpdateInstance_async + */ + async checkUpdateInstanceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateInstance, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the defined Memcached parameters for an existing instance. + * This method only stages the parameters, it must be followed by + * `ApplyParameters` to apply the parameters to nodes of the Memcached + * instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the Memcached instance for which the parameters should be + * updated. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. + * @param {google.cloud.memcache.v1.MemcacheParameters} request.parameters + * The parameters to apply to the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_memcache.update_parameters.js + * region_tag:memcache_v1_generated_CloudMemcache_UpdateParameters_async + */ + updateParameters( + request?: protos.google.cloud.memcache.v1.IUpdateParametersRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateParameters( + request: protos.google.cloud.memcache.v1.IUpdateParametersRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateParameters( + request: protos.google.cloud.memcache.v1.IUpdateParametersRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateParameters( + request?: protos.google.cloud.memcache.v1.IUpdateParametersRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateParameters(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateParameters()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_memcache.update_parameters.js + * region_tag:memcache_v1_generated_CloudMemcache_UpdateParameters_async + */ + async checkUpdateParametersProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateParameters, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single Instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Memcached instance resource name in the format: + * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + * where `location_id` refers to a GCP region + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_memcache.delete_instance.js + * region_tag:memcache_v1_generated_CloudMemcache_DeleteInstance_async + */ + deleteInstance( + request?: protos.google.cloud.memcache.v1.IDeleteInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteInstance( + request: protos.google.cloud.memcache.v1.IDeleteInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteInstance( + request: protos.google.cloud.memcache.v1.IDeleteInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteInstance( + request?: protos.google.cloud.memcache.v1.IDeleteInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteInstance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_memcache.delete_instance.js + * region_tag:memcache_v1_generated_CloudMemcache_DeleteInstance_async + */ + async checkDeleteInstanceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteInstance, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * `ApplyParameters` restarts the set of specified nodes in order to update + * them to the current set of parameters for the Memcached Instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the Memcached instance for which parameter group updates + * should be applied. + * @param {string[]} request.nodeIds + * Nodes to which the instance-level parameter group is applied. + * @param {boolean} request.applyAll + * Whether to apply instance-level parameter group to all nodes. If set to + * true, users are restricted from specifying individual nodes, and + * `ApplyParameters` updates all nodes within the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_memcache.apply_parameters.js + * region_tag:memcache_v1_generated_CloudMemcache_ApplyParameters_async + */ + applyParameters( + request?: protos.google.cloud.memcache.v1.IApplyParametersRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + applyParameters( + request: protos.google.cloud.memcache.v1.IApplyParametersRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + applyParameters( + request: protos.google.cloud.memcache.v1.IApplyParametersRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + applyParameters( + request?: protos.google.cloud.memcache.v1.IApplyParametersRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.applyParameters(request, options, callback); + } +/** + * Check the status of the long running operation returned by `applyParameters()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_memcache.apply_parameters.js + * region_tag:memcache_v1_generated_CloudMemcache_ApplyParameters_async + */ + async checkApplyParametersProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.applyParameters, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Reschedules upcoming maintenance event. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Memcache instance resource name using the form: + * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + * where `location_id` refers to a GCP region. + * @param {google.cloud.memcache.v1.RescheduleMaintenanceRequest.RescheduleType} request.rescheduleType + * Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well. + * @param {google.protobuf.Timestamp} request.scheduleTime + * Timestamp when the maintenance shall be rescheduled to if + * reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for + * example `2012-11-15T16:19:00.094Z`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_memcache.reschedule_maintenance.js + * region_tag:memcache_v1_generated_CloudMemcache_RescheduleMaintenance_async + */ + rescheduleMaintenance( + request?: protos.google.cloud.memcache.v1.IRescheduleMaintenanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + rescheduleMaintenance( + request: protos.google.cloud.memcache.v1.IRescheduleMaintenanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + rescheduleMaintenance( + request: protos.google.cloud.memcache.v1.IRescheduleMaintenanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + rescheduleMaintenance( + request?: protos.google.cloud.memcache.v1.IRescheduleMaintenanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'instance': request.instance ?? '', + }); + this.initialize(); + return this.innerApiCalls.rescheduleMaintenance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `rescheduleMaintenance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_memcache.reschedule_maintenance.js + * region_tag:memcache_v1_generated_CloudMemcache_RescheduleMaintenance_async + */ + async checkRescheduleMaintenanceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.rescheduleMaintenance, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists Instances in a given location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the instance location using the form: + * `projects/{project_id}/locations/{location_id}` + * where `location_id` refers to a GCP region + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 1000 will be used by the service. + * Regardless of the `page_size` value, the response may include a partial + * list and a caller should only rely on response's + * {@link protos.google.cloud.memcache.v1.ListInstancesResponse.next_page_token|`next_page_token`} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. For example, exclude all Memcached instances with name as + * my-instance by specifying `"name != my-instance"`. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.memcache.v1.Instance|Instance}. + * 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 `listInstancesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listInstances( + request?: protos.google.cloud.memcache.v1.IListInstancesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.memcache.v1.IInstance[], + protos.google.cloud.memcache.v1.IListInstancesRequest|null, + protos.google.cloud.memcache.v1.IListInstancesResponse + ]>; + listInstances( + request: protos.google.cloud.memcache.v1.IListInstancesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.memcache.v1.IListInstancesRequest, + protos.google.cloud.memcache.v1.IListInstancesResponse|null|undefined, + protos.google.cloud.memcache.v1.IInstance>): void; + listInstances( + request: protos.google.cloud.memcache.v1.IListInstancesRequest, + callback: PaginationCallback< + protos.google.cloud.memcache.v1.IListInstancesRequest, + protos.google.cloud.memcache.v1.IListInstancesResponse|null|undefined, + protos.google.cloud.memcache.v1.IInstance>): void; + listInstances( + request?: protos.google.cloud.memcache.v1.IListInstancesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.memcache.v1.IListInstancesRequest, + protos.google.cloud.memcache.v1.IListInstancesResponse|null|undefined, + protos.google.cloud.memcache.v1.IInstance>, + callback?: PaginationCallback< + protos.google.cloud.memcache.v1.IListInstancesRequest, + protos.google.cloud.memcache.v1.IListInstancesResponse|null|undefined, + protos.google.cloud.memcache.v1.IInstance>): + Promise<[ + protos.google.cloud.memcache.v1.IInstance[], + protos.google.cloud.memcache.v1.IListInstancesRequest|null, + protos.google.cloud.memcache.v1.IListInstancesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listInstances(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the instance location using the form: + * `projects/{project_id}/locations/{location_id}` + * where `location_id` refers to a GCP region + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 1000 will be used by the service. + * Regardless of the `page_size` value, the response may include a partial + * list and a caller should only rely on response's + * {@link protos.google.cloud.memcache.v1.ListInstancesResponse.next_page_token|`next_page_token`} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. For example, exclude all Memcached instances with name as + * my-instance by specifying `"name != my-instance"`. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @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 protos.google.cloud.memcache.v1.Instance|Instance} 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 `listInstancesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listInstancesStream( + request?: protos.google.cloud.memcache.v1.IListInstancesRequest, + 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['listInstances']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listInstances.createStream( + this.innerApiCalls.listInstances as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listInstances`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the instance location using the form: + * `projects/{project_id}/locations/{location_id}` + * where `location_id` refers to a GCP region + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 1000 will be used by the service. + * Regardless of the `page_size` value, the response may include a partial + * list and a caller should only rely on response's + * {@link protos.google.cloud.memcache.v1.ListInstancesResponse.next_page_token|`next_page_token`} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. For example, exclude all Memcached instances with name as + * my-instance by specifying `"name != my-instance"`. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.memcache.v1.Instance|Instance}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_memcache.list_instances.js + * region_tag:memcache_v1_generated_CloudMemcache_ListInstances_async + */ + listInstancesAsync( + request?: protos.google.cloud.memcache.v1.IListInstancesRequest, + 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['listInstances']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listInstances.asyncIterate( + this.innerApiCalls['listInstances'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified instance resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} instance + * @returns {string} Resource name string. + */ + instancePath(project:string,location:string,instance:string) { + return this.pathTemplates.instancePathTemplate.render({ + project: project, + location: location, + instance: instance, + }); + } + + /** + * Parse the project from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).project; + } + + /** + * Parse the location from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).location; + } + + /** + * Parse the instance from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).instance; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.cloudMemcacheStub && !this._terminated) { + return this.cloudMemcacheStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_client_config.json b/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_client_config.json new file mode 100644 index 00000000000..6703aba61f7 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_client_config.json @@ -0,0 +1,66 @@ +{ + "interfaces": { + "google.cloud.memcache.v1.CloudMemcache": { + "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": { + "ListInstances": { + "timeout_millis": 1200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetInstance": { + "timeout_millis": 1200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateInstance": { + "timeout_millis": 1200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateInstance": { + "timeout_millis": 1200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateParameters": { + "timeout_millis": 1200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteInstance": { + "timeout_millis": 1200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ApplyParameters": { + "timeout_millis": 1200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RescheduleMaintenance": { + "timeout_millis": 1200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_proto_list.json b/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_proto_list.json new file mode 100644 index 00000000000..759395dd6de --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/memcache/v1/cloud_memcache.proto" +] diff --git a/owl-bot-staging/google-cloud-memcache/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-memcache/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..9ac5b347836 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/src/v1/gapic_metadata.json @@ -0,0 +1,107 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.memcache.v1", + "libraryPackage": "@google-cloud/memcache", + "services": { + "CloudMemcache": { + "clients": { + "grpc": { + "libraryClient": "CloudMemcacheClient", + "rpcs": { + "GetInstance": { + "methods": [ + "getInstance" + ] + }, + "CreateInstance": { + "methods": [ + "createInstance" + ] + }, + "UpdateInstance": { + "methods": [ + "updateInstance" + ] + }, + "UpdateParameters": { + "methods": [ + "updateParameters" + ] + }, + "DeleteInstance": { + "methods": [ + "deleteInstance" + ] + }, + "ApplyParameters": { + "methods": [ + "applyParameters" + ] + }, + "RescheduleMaintenance": { + "methods": [ + "rescheduleMaintenance" + ] + }, + "ListInstances": { + "methods": [ + "listInstances", + "listInstancesStream", + "listInstancesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CloudMemcacheClient", + "rpcs": { + "GetInstance": { + "methods": [ + "getInstance" + ] + }, + "CreateInstance": { + "methods": [ + "createInstance" + ] + }, + "UpdateInstance": { + "methods": [ + "updateInstance" + ] + }, + "UpdateParameters": { + "methods": [ + "updateParameters" + ] + }, + "DeleteInstance": { + "methods": [ + "deleteInstance" + ] + }, + "ApplyParameters": { + "methods": [ + "applyParameters" + ] + }, + "RescheduleMaintenance": { + "methods": [ + "rescheduleMaintenance" + ] + }, + "ListInstances": { + "methods": [ + "listInstances", + "listInstancesStream", + "listInstancesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-memcache/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-memcache/v1/src/v1/index.ts new file mode 100644 index 00000000000..bd2e3e67c99 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/src/v1/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 {CloudMemcacheClient} from './cloud_memcache_client'; diff --git a/owl-bot-staging/google-cloud-memcache/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-memcache/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..4a105a18a37 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/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 memcache = require('@google-cloud/memcache'); + +function main() { + const cloudMemcacheClient = new memcache.CloudMemcacheClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-memcache/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-memcache/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..b6fcb720803 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/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 {CloudMemcacheClient} from '@google-cloud/memcache'; + +// check that the client class type name can be used +function doStuffWithCloudMemcacheClient(client: CloudMemcacheClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const cloudMemcacheClient = new CloudMemcacheClient(); + doStuffWithCloudMemcacheClient(cloudMemcacheClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-memcache/v1/system-test/install.ts b/owl-bot-staging/google-cloud-memcache/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/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-memcache/v1/test/gapic_cloud_memcache_v1.ts b/owl-bot-staging/google-cloud-memcache/v1/test/gapic_cloud_memcache_v1.ts new file mode 100644 index 00000000000..02af34118ac --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1/test/gapic_cloud_memcache_v1.ts @@ -0,0 +1,2002 @@ +// 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 cloudmemcacheModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.CloudMemcacheClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = cloudmemcacheModule.v1.CloudMemcacheClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = cloudmemcacheModule.v1.CloudMemcacheClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = cloudmemcacheModule.v1.CloudMemcacheClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudMemcacheStub, undefined); + await client.initialize(); + assert(client.cloudMemcacheStub); + }); + + it('has close method for the initialized client', done => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.cloudMemcacheStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudMemcacheStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + 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 cloudmemcacheModule.v1.CloudMemcacheClient({ + 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('getInstance', () => { + it('invokes getInstance without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.GetInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.memcache.v1.Instance() + ); + client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); + const [response] = await client.getInstance(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInstance without error using callback', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.GetInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.memcache.v1.Instance() + ); + client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInstance( + request, + (err?: Error|null, result?: protos.google.cloud.memcache.v1.IInstance|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInstance with error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.GetInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getInstance(request), expectedError); + const actualRequest = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInstance with closed client', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.GetInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getInstance(request), expectedError); + }); + }); + + describe('createInstance', () => { + it('invokes createInstance without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.CreateInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.CreateInstanceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.createInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createInstance without error using callback', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.CreateInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.CreateInstanceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createInstance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createInstance with call error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.CreateInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.CreateInstanceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createInstance(request), expectedError); + const actualRequest = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createInstance with LRO error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.CreateInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.CreateInstanceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createInstance(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateInstanceProgress without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateInstanceProgress with error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateInstance', () => { + it('invokes updateInstance without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.UpdateInstanceRequest() + ); + request.instance ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.UpdateInstanceRequest', ['instance', 'name']); + request.instance.name = defaultValue1; + const expectedHeaderRequestParams = `instance.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateInstance without error using callback', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.UpdateInstanceRequest() + ); + request.instance ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.UpdateInstanceRequest', ['instance', 'name']); + request.instance.name = defaultValue1; + const expectedHeaderRequestParams = `instance.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateInstance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateInstance with call error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.UpdateInstanceRequest() + ); + request.instance ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.UpdateInstanceRequest', ['instance', 'name']); + request.instance.name = defaultValue1; + const expectedHeaderRequestParams = `instance.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateInstance(request), expectedError); + const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateInstance with LRO error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.UpdateInstanceRequest() + ); + request.instance ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.UpdateInstanceRequest', ['instance', 'name']); + request.instance.name = defaultValue1; + const expectedHeaderRequestParams = `instance.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateInstance(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateInstanceProgress without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateInstanceProgress with error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateParameters', () => { + it('invokes updateParameters without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.UpdateParametersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.UpdateParametersRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateParameters = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateParameters(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateParameters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateParameters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateParameters without error using callback', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.UpdateParametersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.UpdateParametersRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateParameters = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateParameters( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateParameters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateParameters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateParameters with call error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.UpdateParametersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.UpdateParametersRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateParameters = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateParameters(request), expectedError); + const actualRequest = (client.innerApiCalls.updateParameters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateParameters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateParameters with LRO error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.UpdateParametersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.UpdateParametersRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateParameters = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateParameters(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateParameters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateParameters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateParametersProgress without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateParametersProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateParametersProgress with error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateParametersProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteInstance', () => { + it('invokes deleteInstance without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.DeleteInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.DeleteInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteInstance without error using callback', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.DeleteInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.DeleteInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteInstance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteInstance with call error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.DeleteInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.DeleteInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteInstance(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteInstance with LRO error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.DeleteInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.DeleteInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteInstance(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteInstanceProgress without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteInstanceProgress with error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('applyParameters', () => { + it('invokes applyParameters without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.ApplyParametersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.ApplyParametersRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.applyParameters = stubLongRunningCall(expectedResponse); + const [operation] = await client.applyParameters(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.applyParameters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.applyParameters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes applyParameters without error using callback', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.ApplyParametersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.ApplyParametersRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.applyParameters = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.applyParameters( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.applyParameters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.applyParameters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes applyParameters with call error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.ApplyParametersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.ApplyParametersRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.applyParameters = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.applyParameters(request), expectedError); + const actualRequest = (client.innerApiCalls.applyParameters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.applyParameters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes applyParameters with LRO error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.ApplyParametersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.ApplyParametersRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.applyParameters = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.applyParameters(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.applyParameters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.applyParameters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkApplyParametersProgress without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkApplyParametersProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkApplyParametersProgress with error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkApplyParametersProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('rescheduleMaintenance', () => { + it('invokes rescheduleMaintenance without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.RescheduleMaintenanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.RescheduleMaintenanceRequest', ['instance']); + request.instance = defaultValue1; + const expectedHeaderRequestParams = `instance=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.rescheduleMaintenance = stubLongRunningCall(expectedResponse); + const [operation] = await client.rescheduleMaintenance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rescheduleMaintenance without error using callback', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.RescheduleMaintenanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.RescheduleMaintenanceRequest', ['instance']); + request.instance = defaultValue1; + const expectedHeaderRequestParams = `instance=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.rescheduleMaintenance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rescheduleMaintenance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rescheduleMaintenance with call error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.RescheduleMaintenanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.RescheduleMaintenanceRequest', ['instance']); + request.instance = defaultValue1; + const expectedHeaderRequestParams = `instance=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rescheduleMaintenance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.rescheduleMaintenance(request), expectedError); + const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rescheduleMaintenance with LRO error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.RescheduleMaintenanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.RescheduleMaintenanceRequest', ['instance']); + request.instance = defaultValue1; + const expectedHeaderRequestParams = `instance=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rescheduleMaintenance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.rescheduleMaintenance(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRescheduleMaintenanceProgress without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRescheduleMaintenanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRescheduleMaintenanceProgress with error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRescheduleMaintenanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listInstances', () => { + it('invokes listInstances without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.ListInstancesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.ListInstancesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), + generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), + generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), + ]; + client.innerApiCalls.listInstances = stubSimpleCall(expectedResponse); + const [response] = await client.listInstances(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listInstances as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listInstances without error using callback', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.ListInstancesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.ListInstancesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), + generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), + generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), + ]; + client.innerApiCalls.listInstances = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listInstances( + request, + (err?: Error|null, result?: protos.google.cloud.memcache.v1.IInstance[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listInstances as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listInstances with error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.ListInstancesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.ListInstancesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listInstances = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listInstances(request), expectedError); + const actualRequest = (client.innerApiCalls.listInstances as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listInstancesStream without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.ListInstancesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.ListInstancesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), + generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), + generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), + ]; + client.descriptors.page.listInstances.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listInstancesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.memcache.v1.Instance[] = []; + stream.on('data', (response: protos.google.cloud.memcache.v1.Instance) => { + 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.listInstances.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); + assert( + (client.descriptors.page.listInstances.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listInstancesStream with error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.ListInstancesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.ListInstancesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInstances.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listInstancesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.memcache.v1.Instance[] = []; + stream.on('data', (response: protos.google.cloud.memcache.v1.Instance) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listInstances.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); + assert( + (client.descriptors.page.listInstances.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listInstances without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.ListInstancesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.ListInstancesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), + generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), + generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), + ]; + client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.memcache.v1.IInstance[] = []; + const iterable = client.listInstancesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listInstances with error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1.ListInstancesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1.ListInstancesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listInstancesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.memcache.v1.IInstance[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('instance', () => { + const fakePath = "/rendered/path/instance"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + instance: "instanceValue", + }; + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.instancePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath("projectValue", "locationValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromInstanceName', () => { + const result = client.matchLocationFromInstanceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-memcache/v1/tsconfig.json b/owl-bot-staging/google-cloud-memcache/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/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-memcache/v1/webpack.config.js b/owl-bot-staging/google-cloud-memcache/v1/webpack.config.js new file mode 100644 index 00000000000..798f84c54f5 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/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: 'CloudMemcache', + filename: './cloud-memcache.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-memcache/v1beta2/.eslintignore b/owl-bot-staging/google-cloud-memcache/v1beta2/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/.eslintrc.json b/owl-bot-staging/google-cloud-memcache/v1beta2/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/.gitignore b/owl-bot-staging/google-cloud-memcache/v1beta2/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/.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-memcache/v1beta2/.jsdoc.js b/owl-bot-staging/google-cloud-memcache/v1beta2/.jsdoc.js new file mode 100644 index 00000000000..3933f5c8b73 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/.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/memcache', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/.mocharc.js b/owl-bot-staging/google-cloud-memcache/v1beta2/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/.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-memcache/v1beta2/.prettierrc.js b/owl-bot-staging/google-cloud-memcache/v1beta2/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/.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-memcache/v1beta2/README.md b/owl-bot-staging/google-cloud-memcache/v1beta2/README.md new file mode 100644 index 00000000000..fc7ba0933a7 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/README.md @@ -0,0 +1 @@ +Memcache: Nodejs Client diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/package.json b/owl-bot-staging/google-cloud-memcache/v1beta2/package.json new file mode 100644 index 00000000000..ac0a246880d --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/memcache", + "version": "0.1.0", + "description": "Memcache client for Node.js", + "repository": "googleapis/nodejs-memcache", + "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 memcache", + "memcache", + "cloud memcache" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/protos/google/cloud/memcache/v1beta2/cloud_memcache.proto b/owl-bot-staging/google-cloud-memcache/v1beta2/protos/google/cloud/memcache/v1beta2/cloud_memcache.proto new file mode 100644 index 00000000000..d69951f1245 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/protos/google/cloud/memcache/v1beta2/cloud_memcache.proto @@ -0,0 +1,658 @@ +// 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 +// +// 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.memcache.v1beta2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/dayofweek.proto"; +import "google/type/timeofday.proto"; + +option go_package = "cloud.google.com/go/memcache/apiv1beta2/memcachepb;memcachepb"; +option java_multiple_files = true; +option java_outer_classname = "CloudMemcacheProto"; +option java_package = "com.google.cloud.memcache.v1beta2"; + +// Configures and manages Cloud Memorystore for Memcached instances. +// +// +// The `memcache.googleapis.com` service implements the Google Cloud Memorystore +// for Memcached API and defines the following resource model for managing +// Memorystore Memcached (also called Memcached below) instances: +// * The service works with a collection of cloud projects, named: `/projects/*` +// * Each project has a collection of available locations, named: `/locations/*` +// * Each location has a collection of Memcached instances, named: +// `/instances/*` +// * As such, Memcached instances are resources of the form: +// `/projects/{project_id}/locations/{location_id}/instances/{instance_id}` +// +// Note that location_id must be a GCP `region`; for example: +// * `projects/my-memcached-project/locations/us-central1/instances/my-memcached` +service CloudMemcache { + option (google.api.default_host) = "memcache.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists Instances in a given location. + rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) { + option (google.api.http) = { + get: "/v1beta2/{parent=projects/*/locations/*}/instances" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single Instance. + rpc GetInstance(GetInstanceRequest) returns (Instance) { + option (google.api.http) = { + get: "/v1beta2/{name=projects/*/locations/*/instances/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new Instance in a given location. + rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta2/{parent=projects/*/locations/*}/instances" + body: "resource" + }; + option (google.api.method_signature) = "parent,instance_id,resource"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.memcache.v1beta2.Instance" + metadata_type: "google.cloud.memcache.v1beta2.OperationMetadata" + }; + } + + // Updates an existing Instance in a given project and location. + rpc UpdateInstance(UpdateInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta2/{resource.name=projects/*/locations/*/instances/*}" + body: "resource" + }; + option (google.api.method_signature) = "update_mask,resource"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.memcache.v1beta2.Instance" + metadata_type: "google.cloud.memcache.v1beta2.OperationMetadata" + }; + } + + // Updates the defined Memcached parameters for an existing instance. + // This method only stages the parameters, it must be followed by + // `ApplyParameters` to apply the parameters to nodes of the Memcached + // instance. + rpc UpdateParameters(UpdateParametersRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta2/{name=projects/*/locations/*/instances/*}:updateParameters" + body: "*" + }; + option (google.api.method_signature) = "name,update_mask,parameters"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.memcache.v1beta2.Instance" + metadata_type: "google.cloud.memcache.v1beta2.OperationMetadata" + }; + } + + // Deletes a single Instance. + rpc DeleteInstance(DeleteInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta2/{name=projects/*/locations/*/instances/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.memcache.v1beta2.OperationMetadata" + }; + } + + // `ApplyParameters` restarts the set of specified nodes in order to update + // them to the current set of parameters for the Memcached Instance. + rpc ApplyParameters(ApplyParametersRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta2/{name=projects/*/locations/*/instances/*}:applyParameters" + body: "*" + }; + option (google.api.method_signature) = "name,node_ids,apply_all"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.memcache.v1beta2.Instance" + metadata_type: "google.cloud.memcache.v1beta2.OperationMetadata" + }; + } + + // Updates software on the selected nodes of the Instance. + rpc ApplySoftwareUpdate(ApplySoftwareUpdateRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta2/{instance=projects/*/locations/*/instances/*}:applySoftwareUpdate" + body: "*" + }; + option (google.api.method_signature) = "instance,node_ids,apply_all"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.memcache.v1beta2.Instance" + metadata_type: "google.cloud.memcache.v1beta2.OperationMetadata" + }; + } + + // Performs the apply phase of the RescheduleMaintenance verb. + rpc RescheduleMaintenance(RescheduleMaintenanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta2/{instance=projects/*/locations/*/instances/*}:rescheduleMaintenance" + body: "*" + }; + option (google.api.method_signature) = "instance, reschedule_type, schedule_time"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.memcache.v1beta2.Instance" + metadata_type: "google.cloud.memcache.v1beta2.OperationMetadata" + }; + } +} + +// A Memorystore for Memcached instance +message Instance { + option (google.api.resource) = { + type: "memcache.googleapis.com/Instance" + pattern: "projects/{project}/locations/{location}/instances/{instance}" + }; + + // Different states of a Memcached instance. + enum State { + // State not set. + STATE_UNSPECIFIED = 0; + + // Memcached instance is being created. + CREATING = 1; + + // Memcached instance has been created and ready to be used. + READY = 2; + + // Memcached instance is updating configuration such as maintenance policy + // and schedule. + UPDATING = 3; + + // Memcached instance is being deleted. + DELETING = 4; + + // Memcached instance is going through maintenance, e.g. data plane rollout. + PERFORMING_MAINTENANCE = 5; + } + + // Configuration for a Memcached Node. + message NodeConfig { + // Required. Number of cpus per Memcached node. + int32 cpu_count = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Memory size in MiB for each Memcached node. + int32 memory_size_mb = 2 [(google.api.field_behavior) = REQUIRED]; + } + + message Node { + // Different states of a Memcached node. + enum State { + // Node state is not set. + STATE_UNSPECIFIED = 0; + + // Node is being created. + CREATING = 1; + + // Node has been created and ready to be used. + READY = 2; + + // Node is being deleted. + DELETING = 3; + + // Node is being updated. + UPDATING = 4; + } + + // Output only. Identifier of the Memcached node. The node id does not + // include project or location like the Memcached instance name. + string node_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Location (GCP Zone) for the Memcached node. + string zone = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Current state of the Memcached node. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Hostname or IP address of the Memcached node used by the + // clients to connect to the Memcached server on this node. + string host = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The port number of the Memcached server on this node. + int32 port = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User defined parameters currently applied to the node. + MemcacheParameters parameters = 6; + + // Output only. Returns true if there is an update waiting to be applied + bool update_available = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + message InstanceMessage { + enum Code { + // Message Code not set. + CODE_UNSPECIFIED = 0; + + // Memcached nodes are distributed unevenly. + ZONE_DISTRIBUTION_UNBALANCED = 1; + } + + // A code that correspond to one type of user-facing message. + Code code = 1; + + // Message on memcached instance which will be exposed to users. + string message = 2; + } + + // Required. Unique name of the resource in this scope including project and + // location using the form: + // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + // + // Note: Memcached instances are managed and addressed at the regional level + // so `location_id` here refers to a Google Cloud region; however, users may + // choose which zones Memcached nodes should be provisioned in within an + // instance. Refer to [zones][google.cloud.memcache.v1beta2.Instance.zones] field for more details. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // User provided name for the instance, which is only used for display + // purposes. Cannot be more than 80 characters. + string display_name = 2; + + // Resource labels to represent user-provided metadata. + // Refer to cloud documentation on labels for more details. + // https://cloud.google.com/compute/docs/labeling-resources + map labels = 3; + + // The full name of the Google Compute Engine + // [network](https://cloud.google.com/vpc/docs/vpc) to which the + // instance is connected. If left unspecified, the `default` network + // will be used. + string authorized_network = 4; + + // Zones in which Memcached nodes should be provisioned. + // Memcached nodes will be equally distributed across these zones. If not + // provided, the service will by default create nodes in all zones in the + // region for the instance. + repeated string zones = 5; + + // Required. Number of nodes in the Memcached instance. + int32 node_count = 6 [(google.api.field_behavior) = REQUIRED]; + + // Required. Configuration for Memcached nodes. + NodeConfig node_config = 7 [(google.api.field_behavior) = REQUIRED]; + + // The major version of Memcached software. + // If not provided, latest supported version will be used. Currently the + // latest supported major version is `MEMCACHE_1_5`. + // The minor version will be automatically determined by our system based on + // the latest supported minor version. + MemcacheVersion memcache_version = 9; + + // User defined parameters to apply to the memcached process + // on each node. + MemcacheParameters parameters = 11; + + // Output only. List of Memcached nodes. + // Refer to [Node][google.cloud.memcache.v1beta2.Instance.Node] message for more details. + repeated Node memcache_nodes = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the instance was created. + google.protobuf.Timestamp create_time = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the instance was updated. + google.protobuf.Timestamp update_time = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The state of this Memcached instance. + State state = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The full version of memcached server running on this instance. + // System automatically determines the full memcached version for an instance + // based on the input MemcacheVersion. + // The full version format will be "memcached-1.5.16". + string memcache_full_version = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // List of messages that describe the current state of the Memcached instance. + repeated InstanceMessage instance_messages = 19; + + // Output only. Endpoint for the Discovery API. + string discovery_endpoint = 20 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Returns true if there is an update waiting to be applied + bool update_available = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The maintenance policy for the instance. If not provided, + // the maintenance event will be performed based on Memorystore + // internal rollout schedule. + MaintenancePolicy maintenance_policy = 22; + + // Output only. Published maintenance schedule. + MaintenanceSchedule maintenance_schedule = 23 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Maintenance policy per instance. +message MaintenancePolicy { + // Output only. The time when the policy was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the policy was updated. + google.protobuf.Timestamp update_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Description of what this policy is for. Create/Update methods + // return INVALID_ARGUMENT if the length is greater than 512. + string description = 3; + + // Required. Maintenance window that is applied to resources covered by this + // policy. Minimum 1. For the current version, the maximum number of + // weekly_maintenance_windows is expected to be one. + repeated WeeklyMaintenanceWindow weekly_maintenance_window = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// Time window specified for weekly operations. +message WeeklyMaintenanceWindow { + // Required. Allows to define schedule that runs specified day of the week. + google.type.DayOfWeek day = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Start time of the window in UTC. + google.type.TimeOfDay start_time = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Duration of the time window. + google.protobuf.Duration duration = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Upcoming maintenance schedule. +message MaintenanceSchedule { + // Output only. The start time of any upcoming scheduled maintenance for this instance. + google.protobuf.Timestamp start_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The end time of any upcoming scheduled maintenance for this instance. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The deadline that the maintenance schedule start time can not go beyond, + // including reschedule. + google.protobuf.Timestamp schedule_deadline_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request for [ListInstances][google.cloud.memcache.v1beta2.CloudMemcache.ListInstances]. +message ListInstancesRequest { + // Required. The resource name of the instance location using the form: + // `projects/{project_id}/locations/{location_id}` + // where `location_id` refers to a GCP region + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of items to return. + // + // If not specified, a default value of 1000 will be used by the service. + // Regardless of the `page_size` value, the response may include a partial + // list and a caller should only rely on response's + // [`next_page_token`][google.cloud.memcache.v1beta2.ListInstancesResponse.next_page_token] + // to determine if there are more instances left to be queried. + int32 page_size = 2; + + // The `next_page_token` value returned from a previous List request, if any. + string page_token = 3; + + // List filter. For example, exclude all Memcached instances with name as + // my-instance by specifying `"name != my-instance"`. + string filter = 4; + + // Sort results. Supported values are "name", "name desc" or "" (unsorted). + string order_by = 5; +} + +// Response for [ListInstances][google.cloud.memcache.v1beta2.CloudMemcache.ListInstances]. +message ListInstancesResponse { + // A list of Memcached instances in the project in the specified location, + // or across all locations. + // + // If the `location_id` in the parent field of the request is "-", all regions + // available to the project are queried, and the results aggregated. + repeated Instance resources = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request for [GetInstance][google.cloud.memcache.v1beta2.CloudMemcache.GetInstance]. +message GetInstanceRequest { + // Required. Memcached instance resource name in the format: + // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + // where `location_id` refers to a GCP region + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "memcache.googleapis.com/Instance" + } + ]; +} + +// Request for [CreateInstance][google.cloud.memcache.v1beta2.CloudMemcache.CreateInstance]. +message CreateInstanceRequest { + // Required. The resource name of the instance location using the form: + // `projects/{project_id}/locations/{location_id}` + // where `location_id` refers to a GCP region + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The logical name of the Memcached instance in the user + // project with the following restrictions: + // + // * Must contain only lowercase letters, numbers, and hyphens. + // * Must start with a letter. + // * Must be between 1-40 characters. + // * Must end with a number or a letter. + // * Must be unique within the user project / location. + // + // If any of the above are not met, the API raises an invalid argument error. + string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A Memcached [Instance] resource + Instance resource = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for [UpdateInstance][google.cloud.memcache.v1beta2.CloudMemcache.UpdateInstance]. +message UpdateInstanceRequest { + // Required. Mask of fields to update. + // + // * `displayName` + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A Memcached [Instance] resource. + // Only fields specified in update_mask are updated. + Instance resource = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for [DeleteInstance][google.cloud.memcache.v1beta2.CloudMemcache.DeleteInstance]. +message DeleteInstanceRequest { + // Required. Memcached instance resource name in the format: + // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + // where `location_id` refers to a GCP region + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "memcache.googleapis.com/Instance" + } + ]; +} + +// Request for [RescheduleMaintenance][google.cloud.memcache.v1beta2.CloudMemcache.RescheduleMaintenance]. +message RescheduleMaintenanceRequest { + // Reschedule options. + enum RescheduleType { + // Not set. + RESCHEDULE_TYPE_UNSPECIFIED = 0; + + // If the user wants to schedule the maintenance to happen now. + IMMEDIATE = 1; + + // If the user wants to use the existing maintenance policy to find the + // next available window. + NEXT_AVAILABLE_WINDOW = 2; + + // If the user wants to reschedule the maintenance to a specific time. + SPECIFIC_TIME = 3; + } + + // Required. Memcache instance resource name using the form: + // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + // where `location_id` refers to a GCP region. + string instance = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "memcache.googleapis.com/Instance" + } + ]; + + // Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well. + RescheduleType reschedule_type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Timestamp when the maintenance shall be rescheduled to if + // reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for + // example `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp schedule_time = 3; +} + +// Request for [ApplyParameters][google.cloud.memcache.v1beta2.CloudMemcache.ApplyParameters]. +message ApplyParametersRequest { + // Required. Resource name of the Memcached instance for which parameter group updates + // should be applied. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "memcache.googleapis.com/Instance" + } + ]; + + // Nodes to which the instance-level parameter group is applied. + repeated string node_ids = 2; + + // Whether to apply instance-level parameter group to all nodes. If set to + // true, users are restricted from specifying individual nodes, and + // `ApplyParameters` updates all nodes within the instance. + bool apply_all = 3; +} + +// Request for [UpdateParameters][google.cloud.memcache.v1beta2.CloudMemcache.UpdateParameters]. +message UpdateParametersRequest { + // Required. Resource name of the Memcached instance for which the parameters should be + // updated. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "memcache.googleapis.com/Instance" + } + ]; + + // Required. Mask of fields to update. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // The parameters to apply to the instance. + MemcacheParameters parameters = 3; +} + +// Request for [ApplySoftwareUpdate][google.cloud.memcache.v1beta2.CloudMemcache.ApplySoftwareUpdate]. +message ApplySoftwareUpdateRequest { + // Required. Resource name of the Memcached instance for which software update should be + // applied. + string instance = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "memcache.googleapis.com/Instance" + } + ]; + + // Nodes to which we should apply the update to. Note all the selected nodes + // are updated in parallel. + repeated string node_ids = 2; + + // Whether to apply the update to all nodes. If set to + // true, will explicitly restrict users from specifying any nodes, and apply + // software update to all nodes (where applicable) within the instance. + bool apply_all = 3; +} + +// Memcached versions supported by our service. +enum MemcacheVersion { + MEMCACHE_VERSION_UNSPECIFIED = 0; + + // Memcached 1.5 version. + MEMCACHE_1_5 = 1; +} + +message MemcacheParameters { + // Output only. The unique ID associated with this set of parameters. Users + // can use this id to determine if the parameters associated with the instance + // differ from the parameters associated with the nodes. A discrepancy between + // parameter ids can inform users that they may need to take action to apply + // parameters on nodes. + string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User defined set of parameters to use in the memcached process. + map params = 3; +} + +// Represents the metadata of a long-running operation. +message OperationMetadata { + // Output only. Time when the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_detail = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Metadata for the given [google.cloud.location.Location][google.cloud.location.Location]. +message LocationMetadata { + // Output only. The set of available zones in the location. The map is keyed + // by the lowercase ID of each zone, as defined by GCE. These keys can be + // specified in the `zones` field when creating a Memcached instance. + map available_zones = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +message ZoneMetadata { + +} diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.apply_parameters.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.apply_parameters.js new file mode 100644 index 00000000000..3ef904fb3a7 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.apply_parameters.js @@ -0,0 +1,73 @@ +// 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 memcache_v1beta2_generated_CloudMemcache_ApplyParameters_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. Resource name of the Memcached instance for which parameter group updates + * should be applied. + */ + // const name = 'abc123' + /** + * Nodes to which the instance-level parameter group is applied. + */ + // const nodeIds = ['abc','def'] + /** + * Whether to apply instance-level parameter group to all nodes. If set to + * true, users are restricted from specifying individual nodes, and + * `ApplyParameters` updates all nodes within the instance. + */ + // const applyAll = true + + // Imports the Memcache library + const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; + + // Instantiates a client + const memcacheClient = new CloudMemcacheClient(); + + async function callApplyParameters() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await memcacheClient.applyParameters(request); + const [response] = await operation.promise(); + console.log(response); + } + + callApplyParameters(); + // [END memcache_v1beta2_generated_CloudMemcache_ApplyParameters_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-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.apply_software_update.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.apply_software_update.js new file mode 100644 index 00000000000..ebbdfff1cec --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.apply_software_update.js @@ -0,0 +1,74 @@ +// 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(instance) { + // [START memcache_v1beta2_generated_CloudMemcache_ApplySoftwareUpdate_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. Resource name of the Memcached instance for which software update should be + * applied. + */ + // const instance = 'abc123' + /** + * Nodes to which we should apply the update to. Note all the selected nodes + * are updated in parallel. + */ + // const nodeIds = ['abc','def'] + /** + * Whether to apply the update to all nodes. If set to + * true, will explicitly restrict users from specifying any nodes, and apply + * software update to all nodes (where applicable) within the instance. + */ + // const applyAll = true + + // Imports the Memcache library + const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; + + // Instantiates a client + const memcacheClient = new CloudMemcacheClient(); + + async function callApplySoftwareUpdate() { + // Construct request + const request = { + instance, + }; + + // Run request + const [operation] = await memcacheClient.applySoftwareUpdate(request); + const [response] = await operation.promise(); + console.log(response); + } + + callApplySoftwareUpdate(); + // [END memcache_v1beta2_generated_CloudMemcache_ApplySoftwareUpdate_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-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.create_instance.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.create_instance.js new file mode 100644 index 00000000000..83148a2e55d --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.create_instance.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, instanceId, resource) { + // [START memcache_v1beta2_generated_CloudMemcache_CreateInstance_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the instance location using the form: + * `projects/{project_id}/locations/{location_id}` + * where `location_id` refers to a GCP region + */ + // const parent = 'abc123' + /** + * Required. The logical name of the Memcached instance in the user + * project with the following restrictions: + * * Must contain only lowercase letters, numbers, and hyphens. + * * Must start with a letter. + * * Must be between 1-40 characters. + * * Must end with a number or a letter. + * * Must be unique within the user project / location. + * If any of the above are not met, the API raises an invalid argument error. + */ + // const instanceId = 'abc123' + /** + * Required. A Memcached Instance resource + */ + // const resource = {} + + // Imports the Memcache library + const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; + + // Instantiates a client + const memcacheClient = new CloudMemcacheClient(); + + async function callCreateInstance() { + // Construct request + const request = { + parent, + instanceId, + resource, + }; + + // Run request + const [operation] = await memcacheClient.createInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateInstance(); + // [END memcache_v1beta2_generated_CloudMemcache_CreateInstance_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-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.delete_instance.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.delete_instance.js new file mode 100644 index 00000000000..7bd66b43898 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.delete_instance.js @@ -0,0 +1,64 @@ +// 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 memcache_v1beta2_generated_CloudMemcache_DeleteInstance_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. Memcached instance resource name in the format: + * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + * where `location_id` refers to a GCP region + */ + // const name = 'abc123' + + // Imports the Memcache library + const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; + + // Instantiates a client + const memcacheClient = new CloudMemcacheClient(); + + async function callDeleteInstance() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await memcacheClient.deleteInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteInstance(); + // [END memcache_v1beta2_generated_CloudMemcache_DeleteInstance_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-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.get_instance.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.get_instance.js new file mode 100644 index 00000000000..86408684165 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.get_instance.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 memcache_v1beta2_generated_CloudMemcache_GetInstance_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. Memcached instance resource name in the format: + * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + * where `location_id` refers to a GCP region + */ + // const name = 'abc123' + + // Imports the Memcache library + const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; + + // Instantiates a client + const memcacheClient = new CloudMemcacheClient(); + + async function callGetInstance() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await memcacheClient.getInstance(request); + console.log(response); + } + + callGetInstance(); + // [END memcache_v1beta2_generated_CloudMemcache_GetInstance_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-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.list_instances.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.list_instances.js new file mode 100644 index 00000000000..189dcbe7759 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.list_instances.js @@ -0,0 +1,87 @@ +// 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 memcache_v1beta2_generated_CloudMemcache_ListInstances_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the instance location using the form: + * `projects/{project_id}/locations/{location_id}` + * where `location_id` refers to a GCP region + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + * If not specified, a default value of 1000 will be used by the service. + * Regardless of the `page_size` value, the response may include a partial + * list and a caller should only rely on response's + * `next_page_token` google.cloud.memcache.v1beta2.ListInstancesResponse.next_page_token + * to determine if there are more instances left to be queried. + */ + // const pageSize = 1234 + /** + * The `next_page_token` value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + /** + * List filter. For example, exclude all Memcached instances with name as + * my-instance by specifying `"name != my-instance"`. + */ + // const filter = 'abc123' + /** + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + */ + // const orderBy = 'abc123' + + // Imports the Memcache library + const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; + + // Instantiates a client + const memcacheClient = new CloudMemcacheClient(); + + async function callListInstances() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await memcacheClient.listInstancesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListInstances(); + // [END memcache_v1beta2_generated_CloudMemcache_ListInstances_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-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.reschedule_maintenance.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.reschedule_maintenance.js new file mode 100644 index 00000000000..73bde4e413a --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.reschedule_maintenance.js @@ -0,0 +1,75 @@ +// 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(instance, rescheduleType) { + // [START memcache_v1beta2_generated_CloudMemcache_RescheduleMaintenance_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. Memcache instance resource name using the form: + * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + * where `location_id` refers to a GCP region. + */ + // const instance = 'abc123' + /** + * Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well. + */ + // const rescheduleType = {} + /** + * Timestamp when the maintenance shall be rescheduled to if + * reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for + * example `2012-11-15T16:19:00.094Z`. + */ + // const scheduleTime = {} + + // Imports the Memcache library + const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; + + // Instantiates a client + const memcacheClient = new CloudMemcacheClient(); + + async function callRescheduleMaintenance() { + // Construct request + const request = { + instance, + rescheduleType, + }; + + // Run request + const [operation] = await memcacheClient.rescheduleMaintenance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRescheduleMaintenance(); + // [END memcache_v1beta2_generated_CloudMemcache_RescheduleMaintenance_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-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.update_instance.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.update_instance.js new file mode 100644 index 00000000000..19425eca79e --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.update_instance.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(updateMask, resource) { + // [START memcache_v1beta2_generated_CloudMemcache_UpdateInstance_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. Mask of fields to update. + * * `displayName` + */ + // const updateMask = {} + /** + * Required. A Memcached Instance resource. + * Only fields specified in update_mask are updated. + */ + // const resource = {} + + // Imports the Memcache library + const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; + + // Instantiates a client + const memcacheClient = new CloudMemcacheClient(); + + async function callUpdateInstance() { + // Construct request + const request = { + updateMask, + resource, + }; + + // Run request + const [operation] = await memcacheClient.updateInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateInstance(); + // [END memcache_v1beta2_generated_CloudMemcache_UpdateInstance_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-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.update_parameters.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.update_parameters.js new file mode 100644 index 00000000000..9837e22e51a --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.update_parameters.js @@ -0,0 +1,72 @@ +// 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, updateMask) { + // [START memcache_v1beta2_generated_CloudMemcache_UpdateParameters_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. Resource name of the Memcached instance for which the parameters should be + * updated. + */ + // const name = 'abc123' + /** + * Required. Mask of fields to update. + */ + // const updateMask = {} + /** + * The parameters to apply to the instance. + */ + // const parameters = {} + + // Imports the Memcache library + const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; + + // Instantiates a client + const memcacheClient = new CloudMemcacheClient(); + + async function callUpdateParameters() { + // Construct request + const request = { + name, + updateMask, + }; + + // Run request + const [operation] = await memcacheClient.updateParameters(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateParameters(); + // [END memcache_v1beta2_generated_CloudMemcache_UpdateParameters_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-memcache/v1beta2/samples/generated/v1beta2/snippet_metadata_google.cloud.memcache.v1beta2.json b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/snippet_metadata_google.cloud.memcache.v1beta2.json new file mode 100644 index 00000000000..29c62d4469c --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/snippet_metadata_google.cloud.memcache.v1beta2.json @@ -0,0 +1,435 @@ +{ + "clientLibrary": { + "name": "nodejs-memcache", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.memcache.v1beta2", + "version": "v1beta2" + } + ] + }, + "snippets": [ + { + "regionTag": "memcache_v1beta2_generated_CloudMemcache_ListInstances_async", + "title": "CloudMemcache listInstances Sample", + "origin": "API_DEFINITION", + "description": " Lists Instances in a given location.", + "canonical": true, + "file": "cloud_memcache.list_instances.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListInstances", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.ListInstances", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.memcache.v1beta2.ListInstancesResponse", + "client": { + "shortName": "CloudMemcacheClient", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" + }, + "method": { + "shortName": "ListInstances", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.ListInstances", + "service": { + "shortName": "CloudMemcache", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" + } + } + } + }, + { + "regionTag": "memcache_v1beta2_generated_CloudMemcache_GetInstance_async", + "title": "CloudMemcache getInstance Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single Instance.", + "canonical": true, + "file": "cloud_memcache.get_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetInstance", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.GetInstance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.memcache.v1beta2.Instance", + "client": { + "shortName": "CloudMemcacheClient", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" + }, + "method": { + "shortName": "GetInstance", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.GetInstance", + "service": { + "shortName": "CloudMemcache", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" + } + } + } + }, + { + "regionTag": "memcache_v1beta2_generated_CloudMemcache_CreateInstance_async", + "title": "CloudMemcache createInstance Sample", + "origin": "API_DEFINITION", + "description": " Creates a new Instance in a given location.", + "canonical": true, + "file": "cloud_memcache.create_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateInstance", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.CreateInstance", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "instance_id", + "type": "TYPE_STRING" + }, + { + "name": "resource", + "type": ".google.cloud.memcache.v1beta2.Instance" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudMemcacheClient", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" + }, + "method": { + "shortName": "CreateInstance", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.CreateInstance", + "service": { + "shortName": "CloudMemcache", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" + } + } + } + }, + { + "regionTag": "memcache_v1beta2_generated_CloudMemcache_UpdateInstance_async", + "title": "CloudMemcache updateInstance Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing Instance in a given project and location.", + "canonical": true, + "file": "cloud_memcache.update_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateInstance", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.UpdateInstance", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "resource", + "type": ".google.cloud.memcache.v1beta2.Instance" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudMemcacheClient", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" + }, + "method": { + "shortName": "UpdateInstance", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.UpdateInstance", + "service": { + "shortName": "CloudMemcache", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" + } + } + } + }, + { + "regionTag": "memcache_v1beta2_generated_CloudMemcache_UpdateParameters_async", + "title": "CloudMemcache updateParameters Sample", + "origin": "API_DEFINITION", + "description": " Updates the defined Memcached parameters for an existing instance. This method only stages the parameters, it must be followed by `ApplyParameters` to apply the parameters to nodes of the Memcached instance.", + "canonical": true, + "file": "cloud_memcache.update_parameters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateParameters", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.UpdateParameters", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "parameters", + "type": ".google.cloud.memcache.v1beta2.MemcacheParameters" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudMemcacheClient", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" + }, + "method": { + "shortName": "UpdateParameters", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.UpdateParameters", + "service": { + "shortName": "CloudMemcache", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" + } + } + } + }, + { + "regionTag": "memcache_v1beta2_generated_CloudMemcache_DeleteInstance_async", + "title": "CloudMemcache deleteInstance Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single Instance.", + "canonical": true, + "file": "cloud_memcache.delete_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteInstance", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.DeleteInstance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudMemcacheClient", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" + }, + "method": { + "shortName": "DeleteInstance", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.DeleteInstance", + "service": { + "shortName": "CloudMemcache", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" + } + } + } + }, + { + "regionTag": "memcache_v1beta2_generated_CloudMemcache_ApplyParameters_async", + "title": "CloudMemcache applyParameters Sample", + "origin": "API_DEFINITION", + "description": " `ApplyParameters` restarts the set of specified nodes in order to update them to the current set of parameters for the Memcached Instance.", + "canonical": true, + "file": "cloud_memcache.apply_parameters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ApplyParameters", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.ApplyParameters", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "node_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "apply_all", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudMemcacheClient", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" + }, + "method": { + "shortName": "ApplyParameters", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.ApplyParameters", + "service": { + "shortName": "CloudMemcache", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" + } + } + } + }, + { + "regionTag": "memcache_v1beta2_generated_CloudMemcache_ApplySoftwareUpdate_async", + "title": "CloudMemcache applySoftwareUpdate Sample", + "origin": "API_DEFINITION", + "description": " Updates software on the selected nodes of the Instance.", + "canonical": true, + "file": "cloud_memcache.apply_software_update.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ApplySoftwareUpdate", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.ApplySoftwareUpdate", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "node_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "apply_all", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudMemcacheClient", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" + }, + "method": { + "shortName": "ApplySoftwareUpdate", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.ApplySoftwareUpdate", + "service": { + "shortName": "CloudMemcache", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" + } + } + } + }, + { + "regionTag": "memcache_v1beta2_generated_CloudMemcache_RescheduleMaintenance_async", + "title": "CloudMemcache rescheduleMaintenance Sample", + "origin": "API_DEFINITION", + "description": " Performs the apply phase of the RescheduleMaintenance verb.", + "canonical": true, + "file": "cloud_memcache.reschedule_maintenance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RescheduleMaintenance", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.RescheduleMaintenance", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "reschedule_type", + "type": ".google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest.RescheduleType" + }, + { + "name": "schedule_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudMemcacheClient", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" + }, + "method": { + "shortName": "RescheduleMaintenance", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.RescheduleMaintenance", + "service": { + "shortName": "CloudMemcache", + "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/src/index.ts b/owl-bot-staging/google-cloud-memcache/v1beta2/src/index.ts new file mode 100644 index 00000000000..cecd99af5a7 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/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 v1beta2 from './v1beta2'; +const CloudMemcacheClient = v1beta2.CloudMemcacheClient; +type CloudMemcacheClient = v1beta2.CloudMemcacheClient; +export {v1beta2, CloudMemcacheClient}; +export default {v1beta2, CloudMemcacheClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_client.ts b/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_client.ts new file mode 100644 index 00000000000..86c2e73594c --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_client.ts @@ -0,0 +1,1724 @@ +// 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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta2/cloud_memcache_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './cloud_memcache_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Configures and manages Cloud Memorystore for Memcached instances. + * + * + * The `memcache.googleapis.com` service implements the Google Cloud Memorystore + * for Memcached API and defines the following resource model for managing + * Memorystore Memcached (also called Memcached below) instances: + * * The service works with a collection of cloud projects, named: `/projects/*` + * * Each project has a collection of available locations, named: `/locations/*` + * * Each location has a collection of Memcached instances, named: + * `/instances/*` + * * As such, Memcached instances are resources of the form: + * `/projects/{project_id}/locations/{location_id}/instances/{instance_id}` + * + * Note that location_id must be a GCP `region`; for example: + * * `projects/my-memcached-project/locations/us-central1/instances/my-memcached` + * @class + * @memberof v1beta2 + */ +export class CloudMemcacheClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + cloudMemcacheStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CloudMemcacheClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 CloudMemcacheClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CloudMemcacheClient; + 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + 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 = { + instancePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/instances/{instance}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listInstances: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta2/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta2/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta2/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta2/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createInstanceResponse = protoFilesRoot.lookup( + '.google.cloud.memcache.v1beta2.Instance') as gax.protobuf.Type; + const createInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.memcache.v1beta2.OperationMetadata') as gax.protobuf.Type; + const updateInstanceResponse = protoFilesRoot.lookup( + '.google.cloud.memcache.v1beta2.Instance') as gax.protobuf.Type; + const updateInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.memcache.v1beta2.OperationMetadata') as gax.protobuf.Type; + const updateParametersResponse = protoFilesRoot.lookup( + '.google.cloud.memcache.v1beta2.Instance') as gax.protobuf.Type; + const updateParametersMetadata = protoFilesRoot.lookup( + '.google.cloud.memcache.v1beta2.OperationMetadata') as gax.protobuf.Type; + const deleteInstanceResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.memcache.v1beta2.OperationMetadata') as gax.protobuf.Type; + const applyParametersResponse = protoFilesRoot.lookup( + '.google.cloud.memcache.v1beta2.Instance') as gax.protobuf.Type; + const applyParametersMetadata = protoFilesRoot.lookup( + '.google.cloud.memcache.v1beta2.OperationMetadata') as gax.protobuf.Type; + const applySoftwareUpdateResponse = protoFilesRoot.lookup( + '.google.cloud.memcache.v1beta2.Instance') as gax.protobuf.Type; + const applySoftwareUpdateMetadata = protoFilesRoot.lookup( + '.google.cloud.memcache.v1beta2.OperationMetadata') as gax.protobuf.Type; + const rescheduleMaintenanceResponse = protoFilesRoot.lookup( + '.google.cloud.memcache.v1beta2.Instance') as gax.protobuf.Type; + const rescheduleMaintenanceMetadata = protoFilesRoot.lookup( + '.google.cloud.memcache.v1beta2.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createInstanceResponse.decode.bind(createInstanceResponse), + createInstanceMetadata.decode.bind(createInstanceMetadata)), + updateInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateInstanceResponse.decode.bind(updateInstanceResponse), + updateInstanceMetadata.decode.bind(updateInstanceMetadata)), + updateParameters: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateParametersResponse.decode.bind(updateParametersResponse), + updateParametersMetadata.decode.bind(updateParametersMetadata)), + deleteInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteInstanceResponse.decode.bind(deleteInstanceResponse), + deleteInstanceMetadata.decode.bind(deleteInstanceMetadata)), + applyParameters: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + applyParametersResponse.decode.bind(applyParametersResponse), + applyParametersMetadata.decode.bind(applyParametersMetadata)), + applySoftwareUpdate: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + applySoftwareUpdateResponse.decode.bind(applySoftwareUpdateResponse), + applySoftwareUpdateMetadata.decode.bind(applySoftwareUpdateMetadata)), + rescheduleMaintenance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + rescheduleMaintenanceResponse.decode.bind(rescheduleMaintenanceResponse), + rescheduleMaintenanceMetadata.decode.bind(rescheduleMaintenanceMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.memcache.v1beta2.CloudMemcache', 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.cloudMemcacheStub) { + return this.cloudMemcacheStub; + } + + // Put together the "service stub" for + // google.cloud.memcache.v1beta2.CloudMemcache. + this.cloudMemcacheStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.memcache.v1beta2.CloudMemcache') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.memcache.v1beta2.CloudMemcache, + 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 cloudMemcacheStubMethods = + ['listInstances', 'getInstance', 'createInstance', 'updateInstance', 'updateParameters', 'deleteInstance', 'applyParameters', 'applySoftwareUpdate', 'rescheduleMaintenance']; + for (const methodName of cloudMemcacheStubMethods) { + const callPromise = this.cloudMemcacheStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.cloudMemcacheStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'memcache.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 'memcache.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 -- + // ------------------- +/** + * Gets details of a single Instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Memcached instance resource name in the format: + * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + * where `location_id` refers to a GCP region + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.memcache.v1beta2.Instance|Instance}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/cloud_memcache.get_instance.js + * region_tag:memcache_v1beta2_generated_CloudMemcache_GetInstance_async + */ + getInstance( + request?: protos.google.cloud.memcache.v1beta2.IGetInstanceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.memcache.v1beta2.IInstance, + protos.google.cloud.memcache.v1beta2.IGetInstanceRequest|undefined, {}|undefined + ]>; + getInstance( + request: protos.google.cloud.memcache.v1beta2.IGetInstanceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.memcache.v1beta2.IInstance, + protos.google.cloud.memcache.v1beta2.IGetInstanceRequest|null|undefined, + {}|null|undefined>): void; + getInstance( + request: protos.google.cloud.memcache.v1beta2.IGetInstanceRequest, + callback: Callback< + protos.google.cloud.memcache.v1beta2.IInstance, + protos.google.cloud.memcache.v1beta2.IGetInstanceRequest|null|undefined, + {}|null|undefined>): void; + getInstance( + request?: protos.google.cloud.memcache.v1beta2.IGetInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.memcache.v1beta2.IInstance, + protos.google.cloud.memcache.v1beta2.IGetInstanceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.memcache.v1beta2.IInstance, + protos.google.cloud.memcache.v1beta2.IGetInstanceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.memcache.v1beta2.IInstance, + protos.google.cloud.memcache.v1beta2.IGetInstanceRequest|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.getInstance(request, options, callback); + } + +/** + * Creates a new Instance in a given location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the instance location using the form: + * `projects/{project_id}/locations/{location_id}` + * where `location_id` refers to a GCP region + * @param {string} request.instanceId + * Required. The logical name of the Memcached instance in the user + * project with the following restrictions: + * + * * Must contain only lowercase letters, numbers, and hyphens. + * * Must start with a letter. + * * Must be between 1-40 characters. + * * Must end with a number or a letter. + * * Must be unique within the user project / location. + * + * If any of the above are not met, the API raises an invalid argument error. + * @param {google.cloud.memcache.v1beta2.Instance} request.resource + * Required. A Memcached [Instance] 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/cloud_memcache.create_instance.js + * region_tag:memcache_v1beta2_generated_CloudMemcache_CreateInstance_async + */ + createInstance( + request?: protos.google.cloud.memcache.v1beta2.ICreateInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createInstance( + request: protos.google.cloud.memcache.v1beta2.ICreateInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createInstance( + request: protos.google.cloud.memcache.v1beta2.ICreateInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createInstance( + request?: protos.google.cloud.memcache.v1beta2.ICreateInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createInstance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/cloud_memcache.create_instance.js + * region_tag:memcache_v1beta2_generated_CloudMemcache_CreateInstance_async + */ + async checkCreateInstanceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createInstance, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an existing Instance in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. + * + * * `displayName` + * @param {google.cloud.memcache.v1beta2.Instance} request.resource + * Required. A Memcached [Instance] resource. + * Only fields specified in update_mask are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/cloud_memcache.update_instance.js + * region_tag:memcache_v1beta2_generated_CloudMemcache_UpdateInstance_async + */ + updateInstance( + request?: protos.google.cloud.memcache.v1beta2.IUpdateInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateInstance( + request: protos.google.cloud.memcache.v1beta2.IUpdateInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateInstance( + request: protos.google.cloud.memcache.v1beta2.IUpdateInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateInstance( + request?: protos.google.cloud.memcache.v1beta2.IUpdateInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource.name': request.resource!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateInstance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/cloud_memcache.update_instance.js + * region_tag:memcache_v1beta2_generated_CloudMemcache_UpdateInstance_async + */ + async checkUpdateInstanceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateInstance, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the defined Memcached parameters for an existing instance. + * This method only stages the parameters, it must be followed by + * `ApplyParameters` to apply the parameters to nodes of the Memcached + * instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the Memcached instance for which the parameters should be + * updated. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. + * @param {google.cloud.memcache.v1beta2.MemcacheParameters} request.parameters + * The parameters to apply to the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/cloud_memcache.update_parameters.js + * region_tag:memcache_v1beta2_generated_CloudMemcache_UpdateParameters_async + */ + updateParameters( + request?: protos.google.cloud.memcache.v1beta2.IUpdateParametersRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateParameters( + request: protos.google.cloud.memcache.v1beta2.IUpdateParametersRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateParameters( + request: protos.google.cloud.memcache.v1beta2.IUpdateParametersRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateParameters( + request?: protos.google.cloud.memcache.v1beta2.IUpdateParametersRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateParameters(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateParameters()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/cloud_memcache.update_parameters.js + * region_tag:memcache_v1beta2_generated_CloudMemcache_UpdateParameters_async + */ + async checkUpdateParametersProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateParameters, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single Instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Memcached instance resource name in the format: + * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + * where `location_id` refers to a GCP region + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/cloud_memcache.delete_instance.js + * region_tag:memcache_v1beta2_generated_CloudMemcache_DeleteInstance_async + */ + deleteInstance( + request?: protos.google.cloud.memcache.v1beta2.IDeleteInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteInstance( + request: protos.google.cloud.memcache.v1beta2.IDeleteInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteInstance( + request: protos.google.cloud.memcache.v1beta2.IDeleteInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteInstance( + request?: protos.google.cloud.memcache.v1beta2.IDeleteInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteInstance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/cloud_memcache.delete_instance.js + * region_tag:memcache_v1beta2_generated_CloudMemcache_DeleteInstance_async + */ + async checkDeleteInstanceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteInstance, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * `ApplyParameters` restarts the set of specified nodes in order to update + * them to the current set of parameters for the Memcached Instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the Memcached instance for which parameter group updates + * should be applied. + * @param {string[]} request.nodeIds + * Nodes to which the instance-level parameter group is applied. + * @param {boolean} request.applyAll + * Whether to apply instance-level parameter group to all nodes. If set to + * true, users are restricted from specifying individual nodes, and + * `ApplyParameters` updates all nodes within the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/cloud_memcache.apply_parameters.js + * region_tag:memcache_v1beta2_generated_CloudMemcache_ApplyParameters_async + */ + applyParameters( + request?: protos.google.cloud.memcache.v1beta2.IApplyParametersRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + applyParameters( + request: protos.google.cloud.memcache.v1beta2.IApplyParametersRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + applyParameters( + request: protos.google.cloud.memcache.v1beta2.IApplyParametersRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + applyParameters( + request?: protos.google.cloud.memcache.v1beta2.IApplyParametersRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.applyParameters(request, options, callback); + } +/** + * Check the status of the long running operation returned by `applyParameters()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/cloud_memcache.apply_parameters.js + * region_tag:memcache_v1beta2_generated_CloudMemcache_ApplyParameters_async + */ + async checkApplyParametersProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.applyParameters, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates software on the selected nodes of the Instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Resource name of the Memcached instance for which software update should be + * applied. + * @param {string[]} request.nodeIds + * Nodes to which we should apply the update to. Note all the selected nodes + * are updated in parallel. + * @param {boolean} request.applyAll + * Whether to apply the update to all nodes. If set to + * true, will explicitly restrict users from specifying any nodes, and apply + * software update to all nodes (where applicable) within the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/cloud_memcache.apply_software_update.js + * region_tag:memcache_v1beta2_generated_CloudMemcache_ApplySoftwareUpdate_async + */ + applySoftwareUpdate( + request?: protos.google.cloud.memcache.v1beta2.IApplySoftwareUpdateRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + applySoftwareUpdate( + request: protos.google.cloud.memcache.v1beta2.IApplySoftwareUpdateRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + applySoftwareUpdate( + request: protos.google.cloud.memcache.v1beta2.IApplySoftwareUpdateRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + applySoftwareUpdate( + request?: protos.google.cloud.memcache.v1beta2.IApplySoftwareUpdateRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'instance': request.instance ?? '', + }); + this.initialize(); + return this.innerApiCalls.applySoftwareUpdate(request, options, callback); + } +/** + * Check the status of the long running operation returned by `applySoftwareUpdate()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/cloud_memcache.apply_software_update.js + * region_tag:memcache_v1beta2_generated_CloudMemcache_ApplySoftwareUpdate_async + */ + async checkApplySoftwareUpdateProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.applySoftwareUpdate, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Performs the apply phase of the RescheduleMaintenance verb. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Memcache instance resource name using the form: + * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + * where `location_id` refers to a GCP region. + * @param {google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest.RescheduleType} request.rescheduleType + * Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well. + * @param {google.protobuf.Timestamp} request.scheduleTime + * Timestamp when the maintenance shall be rescheduled to if + * reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for + * example `2012-11-15T16:19:00.094Z`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/cloud_memcache.reschedule_maintenance.js + * region_tag:memcache_v1beta2_generated_CloudMemcache_RescheduleMaintenance_async + */ + rescheduleMaintenance( + request?: protos.google.cloud.memcache.v1beta2.IRescheduleMaintenanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + rescheduleMaintenance( + request: protos.google.cloud.memcache.v1beta2.IRescheduleMaintenanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + rescheduleMaintenance( + request: protos.google.cloud.memcache.v1beta2.IRescheduleMaintenanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + rescheduleMaintenance( + request?: protos.google.cloud.memcache.v1beta2.IRescheduleMaintenanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'instance': request.instance ?? '', + }); + this.initialize(); + return this.innerApiCalls.rescheduleMaintenance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `rescheduleMaintenance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/cloud_memcache.reschedule_maintenance.js + * region_tag:memcache_v1beta2_generated_CloudMemcache_RescheduleMaintenance_async + */ + async checkRescheduleMaintenanceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.rescheduleMaintenance, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists Instances in a given location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the instance location using the form: + * `projects/{project_id}/locations/{location_id}` + * where `location_id` refers to a GCP region + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 1000 will be used by the service. + * Regardless of the `page_size` value, the response may include a partial + * list and a caller should only rely on response's + * {@link protos.google.cloud.memcache.v1beta2.ListInstancesResponse.next_page_token|`next_page_token`} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. For example, exclude all Memcached instances with name as + * my-instance by specifying `"name != my-instance"`. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.memcache.v1beta2.Instance|Instance}. + * 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 `listInstancesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listInstances( + request?: protos.google.cloud.memcache.v1beta2.IListInstancesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.memcache.v1beta2.IInstance[], + protos.google.cloud.memcache.v1beta2.IListInstancesRequest|null, + protos.google.cloud.memcache.v1beta2.IListInstancesResponse + ]>; + listInstances( + request: protos.google.cloud.memcache.v1beta2.IListInstancesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.memcache.v1beta2.IListInstancesRequest, + protos.google.cloud.memcache.v1beta2.IListInstancesResponse|null|undefined, + protos.google.cloud.memcache.v1beta2.IInstance>): void; + listInstances( + request: protos.google.cloud.memcache.v1beta2.IListInstancesRequest, + callback: PaginationCallback< + protos.google.cloud.memcache.v1beta2.IListInstancesRequest, + protos.google.cloud.memcache.v1beta2.IListInstancesResponse|null|undefined, + protos.google.cloud.memcache.v1beta2.IInstance>): void; + listInstances( + request?: protos.google.cloud.memcache.v1beta2.IListInstancesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.memcache.v1beta2.IListInstancesRequest, + protos.google.cloud.memcache.v1beta2.IListInstancesResponse|null|undefined, + protos.google.cloud.memcache.v1beta2.IInstance>, + callback?: PaginationCallback< + protos.google.cloud.memcache.v1beta2.IListInstancesRequest, + protos.google.cloud.memcache.v1beta2.IListInstancesResponse|null|undefined, + protos.google.cloud.memcache.v1beta2.IInstance>): + Promise<[ + protos.google.cloud.memcache.v1beta2.IInstance[], + protos.google.cloud.memcache.v1beta2.IListInstancesRequest|null, + protos.google.cloud.memcache.v1beta2.IListInstancesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listInstances(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the instance location using the form: + * `projects/{project_id}/locations/{location_id}` + * where `location_id` refers to a GCP region + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 1000 will be used by the service. + * Regardless of the `page_size` value, the response may include a partial + * list and a caller should only rely on response's + * {@link protos.google.cloud.memcache.v1beta2.ListInstancesResponse.next_page_token|`next_page_token`} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. For example, exclude all Memcached instances with name as + * my-instance by specifying `"name != my-instance"`. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @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 protos.google.cloud.memcache.v1beta2.Instance|Instance} 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 `listInstancesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listInstancesStream( + request?: protos.google.cloud.memcache.v1beta2.IListInstancesRequest, + 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['listInstances']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listInstances.createStream( + this.innerApiCalls.listInstances as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listInstances`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the instance location using the form: + * `projects/{project_id}/locations/{location_id}` + * where `location_id` refers to a GCP region + * @param {number} request.pageSize + * The maximum number of items to return. + * + * If not specified, a default value of 1000 will be used by the service. + * Regardless of the `page_size` value, the response may include a partial + * list and a caller should only rely on response's + * {@link protos.google.cloud.memcache.v1beta2.ListInstancesResponse.next_page_token|`next_page_token`} + * to determine if there are more instances left to be queried. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. For example, exclude all Memcached instances with name as + * my-instance by specifying `"name != my-instance"`. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.memcache.v1beta2.Instance|Instance}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta2/cloud_memcache.list_instances.js + * region_tag:memcache_v1beta2_generated_CloudMemcache_ListInstances_async + */ + listInstancesAsync( + request?: protos.google.cloud.memcache.v1beta2.IListInstancesRequest, + 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['listInstances']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listInstances.asyncIterate( + this.innerApiCalls['listInstances'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified instance resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} instance + * @returns {string} Resource name string. + */ + instancePath(project:string,location:string,instance:string) { + return this.pathTemplates.instancePathTemplate.render({ + project: project, + location: location, + instance: instance, + }); + } + + /** + * Parse the project from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).project; + } + + /** + * Parse the location from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).location; + } + + /** + * Parse the instance from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).instance; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.cloudMemcacheStub && !this._terminated) { + return this.cloudMemcacheStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_client_config.json b/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_client_config.json new file mode 100644 index 00000000000..efab044ce2f --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_client_config.json @@ -0,0 +1,71 @@ +{ + "interfaces": { + "google.cloud.memcache.v1beta2.CloudMemcache": { + "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": { + "ListInstances": { + "timeout_millis": 1200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetInstance": { + "timeout_millis": 1200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateInstance": { + "timeout_millis": 1200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateInstance": { + "timeout_millis": 1200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateParameters": { + "timeout_millis": 1200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteInstance": { + "timeout_millis": 1200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ApplyParameters": { + "timeout_millis": 1200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ApplySoftwareUpdate": { + "timeout_millis": 1200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RescheduleMaintenance": { + "timeout_millis": 1200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_proto_list.json b/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_proto_list.json new file mode 100644 index 00000000000..f37919f31b7 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/memcache/v1beta2/cloud_memcache.proto" +] diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/gapic_metadata.json b/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/gapic_metadata.json new file mode 100644 index 00000000000..a1b142ce36e --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/gapic_metadata.json @@ -0,0 +1,117 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.memcache.v1beta2", + "libraryPackage": "@google-cloud/memcache", + "services": { + "CloudMemcache": { + "clients": { + "grpc": { + "libraryClient": "CloudMemcacheClient", + "rpcs": { + "GetInstance": { + "methods": [ + "getInstance" + ] + }, + "CreateInstance": { + "methods": [ + "createInstance" + ] + }, + "UpdateInstance": { + "methods": [ + "updateInstance" + ] + }, + "UpdateParameters": { + "methods": [ + "updateParameters" + ] + }, + "DeleteInstance": { + "methods": [ + "deleteInstance" + ] + }, + "ApplyParameters": { + "methods": [ + "applyParameters" + ] + }, + "ApplySoftwareUpdate": { + "methods": [ + "applySoftwareUpdate" + ] + }, + "RescheduleMaintenance": { + "methods": [ + "rescheduleMaintenance" + ] + }, + "ListInstances": { + "methods": [ + "listInstances", + "listInstancesStream", + "listInstancesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CloudMemcacheClient", + "rpcs": { + "GetInstance": { + "methods": [ + "getInstance" + ] + }, + "CreateInstance": { + "methods": [ + "createInstance" + ] + }, + "UpdateInstance": { + "methods": [ + "updateInstance" + ] + }, + "UpdateParameters": { + "methods": [ + "updateParameters" + ] + }, + "DeleteInstance": { + "methods": [ + "deleteInstance" + ] + }, + "ApplyParameters": { + "methods": [ + "applyParameters" + ] + }, + "ApplySoftwareUpdate": { + "methods": [ + "applySoftwareUpdate" + ] + }, + "RescheduleMaintenance": { + "methods": [ + "rescheduleMaintenance" + ] + }, + "ListInstances": { + "methods": [ + "listInstances", + "listInstancesStream", + "listInstancesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/index.ts b/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/index.ts new file mode 100644 index 00000000000..bd2e3e67c99 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/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 {CloudMemcacheClient} from './cloud_memcache_client'; diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-memcache/v1beta2/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..4a105a18a37 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/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 memcache = require('@google-cloud/memcache'); + +function main() { + const cloudMemcacheClient = new memcache.CloudMemcacheClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-memcache/v1beta2/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..b6fcb720803 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/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 {CloudMemcacheClient} from '@google-cloud/memcache'; + +// check that the client class type name can be used +function doStuffWithCloudMemcacheClient(client: CloudMemcacheClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const cloudMemcacheClient = new CloudMemcacheClient(); + doStuffWithCloudMemcacheClient(cloudMemcacheClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/system-test/install.ts b/owl-bot-staging/google-cloud-memcache/v1beta2/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/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-memcache/v1beta2/test/gapic_cloud_memcache_v1beta2.ts b/owl-bot-staging/google-cloud-memcache/v1beta2/test/gapic_cloud_memcache_v1beta2.ts new file mode 100644 index 00000000000..04b716b3a60 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/test/gapic_cloud_memcache_v1beta2.ts @@ -0,0 +1,2156 @@ +// 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 cloudmemcacheModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta2.CloudMemcacheClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = cloudmemcacheModule.v1beta2.CloudMemcacheClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = cloudmemcacheModule.v1beta2.CloudMemcacheClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = cloudmemcacheModule.v1beta2.CloudMemcacheClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudMemcacheStub, undefined); + await client.initialize(); + assert(client.cloudMemcacheStub); + }); + + it('has close method for the initialized client', done => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.cloudMemcacheStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudMemcacheStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + 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 cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + 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('getInstance', () => { + it('invokes getInstance without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.GetInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.Instance() + ); + client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); + const [response] = await client.getInstance(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInstance without error using callback', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.GetInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.Instance() + ); + client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInstance( + request, + (err?: Error|null, result?: protos.google.cloud.memcache.v1beta2.IInstance|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInstance with error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.GetInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getInstance(request), expectedError); + const actualRequest = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInstance with closed client', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.GetInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getInstance(request), expectedError); + }); + }); + + describe('createInstance', () => { + it('invokes createInstance without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.CreateInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.CreateInstanceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.createInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createInstance without error using callback', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.CreateInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.CreateInstanceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createInstance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createInstance with call error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.CreateInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.CreateInstanceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createInstance(request), expectedError); + const actualRequest = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createInstance with LRO error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.CreateInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.CreateInstanceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createInstance(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateInstanceProgress without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateInstanceProgress with error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateInstance', () => { + it('invokes updateInstance without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.UpdateInstanceRequest() + ); + request.resource ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.UpdateInstanceRequest', ['resource', 'name']); + request.resource.name = defaultValue1; + const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateInstance without error using callback', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.UpdateInstanceRequest() + ); + request.resource ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.UpdateInstanceRequest', ['resource', 'name']); + request.resource.name = defaultValue1; + const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateInstance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateInstance with call error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.UpdateInstanceRequest() + ); + request.resource ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.UpdateInstanceRequest', ['resource', 'name']); + request.resource.name = defaultValue1; + const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateInstance(request), expectedError); + const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateInstance with LRO error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.UpdateInstanceRequest() + ); + request.resource ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.UpdateInstanceRequest', ['resource', 'name']); + request.resource.name = defaultValue1; + const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateInstance(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateInstanceProgress without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateInstanceProgress with error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateParameters', () => { + it('invokes updateParameters without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.UpdateParametersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.UpdateParametersRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateParameters = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateParameters(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateParameters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateParameters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateParameters without error using callback', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.UpdateParametersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.UpdateParametersRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateParameters = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateParameters( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateParameters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateParameters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateParameters with call error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.UpdateParametersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.UpdateParametersRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateParameters = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateParameters(request), expectedError); + const actualRequest = (client.innerApiCalls.updateParameters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateParameters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateParameters with LRO error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.UpdateParametersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.UpdateParametersRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateParameters = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateParameters(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateParameters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateParameters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateParametersProgress without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateParametersProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateParametersProgress with error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateParametersProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteInstance', () => { + it('invokes deleteInstance without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.DeleteInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.DeleteInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteInstance without error using callback', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.DeleteInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.DeleteInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteInstance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteInstance with call error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.DeleteInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.DeleteInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteInstance(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteInstance with LRO error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.DeleteInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.DeleteInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteInstance(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteInstanceProgress without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteInstanceProgress with error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('applyParameters', () => { + it('invokes applyParameters without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.ApplyParametersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.ApplyParametersRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.applyParameters = stubLongRunningCall(expectedResponse); + const [operation] = await client.applyParameters(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.applyParameters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.applyParameters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes applyParameters without error using callback', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.ApplyParametersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.ApplyParametersRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.applyParameters = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.applyParameters( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.applyParameters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.applyParameters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes applyParameters with call error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.ApplyParametersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.ApplyParametersRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.applyParameters = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.applyParameters(request), expectedError); + const actualRequest = (client.innerApiCalls.applyParameters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.applyParameters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes applyParameters with LRO error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.ApplyParametersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.ApplyParametersRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.applyParameters = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.applyParameters(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.applyParameters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.applyParameters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkApplyParametersProgress without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkApplyParametersProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkApplyParametersProgress with error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkApplyParametersProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('applySoftwareUpdate', () => { + it('invokes applySoftwareUpdate without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest', ['instance']); + request.instance = defaultValue1; + const expectedHeaderRequestParams = `instance=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.applySoftwareUpdate = stubLongRunningCall(expectedResponse); + const [operation] = await client.applySoftwareUpdate(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.applySoftwareUpdate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.applySoftwareUpdate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes applySoftwareUpdate without error using callback', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest', ['instance']); + request.instance = defaultValue1; + const expectedHeaderRequestParams = `instance=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.applySoftwareUpdate = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.applySoftwareUpdate( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.applySoftwareUpdate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.applySoftwareUpdate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes applySoftwareUpdate with call error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest', ['instance']); + request.instance = defaultValue1; + const expectedHeaderRequestParams = `instance=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.applySoftwareUpdate = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.applySoftwareUpdate(request), expectedError); + const actualRequest = (client.innerApiCalls.applySoftwareUpdate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.applySoftwareUpdate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes applySoftwareUpdate with LRO error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest', ['instance']); + request.instance = defaultValue1; + const expectedHeaderRequestParams = `instance=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.applySoftwareUpdate = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.applySoftwareUpdate(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.applySoftwareUpdate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.applySoftwareUpdate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkApplySoftwareUpdateProgress without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkApplySoftwareUpdateProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkApplySoftwareUpdateProgress with error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkApplySoftwareUpdateProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('rescheduleMaintenance', () => { + it('invokes rescheduleMaintenance without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest', ['instance']); + request.instance = defaultValue1; + const expectedHeaderRequestParams = `instance=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.rescheduleMaintenance = stubLongRunningCall(expectedResponse); + const [operation] = await client.rescheduleMaintenance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rescheduleMaintenance without error using callback', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest', ['instance']); + request.instance = defaultValue1; + const expectedHeaderRequestParams = `instance=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.rescheduleMaintenance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rescheduleMaintenance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rescheduleMaintenance with call error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest', ['instance']); + request.instance = defaultValue1; + const expectedHeaderRequestParams = `instance=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rescheduleMaintenance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.rescheduleMaintenance(request), expectedError); + const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rescheduleMaintenance with LRO error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest', ['instance']); + request.instance = defaultValue1; + const expectedHeaderRequestParams = `instance=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rescheduleMaintenance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.rescheduleMaintenance(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRescheduleMaintenanceProgress without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRescheduleMaintenanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRescheduleMaintenanceProgress with error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRescheduleMaintenanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listInstances', () => { + it('invokes listInstances without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.ListInstancesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.ListInstancesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), + generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), + generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), + ]; + client.innerApiCalls.listInstances = stubSimpleCall(expectedResponse); + const [response] = await client.listInstances(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listInstances as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listInstances without error using callback', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.ListInstancesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.ListInstancesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), + generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), + generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), + ]; + client.innerApiCalls.listInstances = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listInstances( + request, + (err?: Error|null, result?: protos.google.cloud.memcache.v1beta2.IInstance[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listInstances as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listInstances with error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.ListInstancesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.ListInstancesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listInstances = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listInstances(request), expectedError); + const actualRequest = (client.innerApiCalls.listInstances as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listInstancesStream without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.ListInstancesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.ListInstancesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), + generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), + generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), + ]; + client.descriptors.page.listInstances.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listInstancesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.memcache.v1beta2.Instance[] = []; + stream.on('data', (response: protos.google.cloud.memcache.v1beta2.Instance) => { + 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.listInstances.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); + assert( + (client.descriptors.page.listInstances.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listInstancesStream with error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.ListInstancesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.ListInstancesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInstances.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listInstancesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.memcache.v1beta2.Instance[] = []; + stream.on('data', (response: protos.google.cloud.memcache.v1beta2.Instance) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listInstances.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); + assert( + (client.descriptors.page.listInstances.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listInstances without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.ListInstancesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.ListInstancesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), + generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), + generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), + ]; + client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.memcache.v1beta2.IInstance[] = []; + const iterable = client.listInstancesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listInstances with error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.memcache.v1beta2.ListInstancesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.memcache.v1beta2.ListInstancesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listInstancesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.memcache.v1beta2.IInstance[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('instance', () => { + const fakePath = "/rendered/path/instance"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + instance: "instanceValue", + }; + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.instancePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath("projectValue", "locationValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromInstanceName', () => { + const result = client.matchLocationFromInstanceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/tsconfig.json b/owl-bot-staging/google-cloud-memcache/v1beta2/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/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-memcache/v1beta2/webpack.config.js b/owl-bot-staging/google-cloud-memcache/v1beta2/webpack.config.js new file mode 100644 index 00000000000..798f84c54f5 --- /dev/null +++ b/owl-bot-staging/google-cloud-memcache/v1beta2/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: 'CloudMemcache', + filename: './cloud-memcache.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-metastore/v1/.eslintignore b/owl-bot-staging/google-cloud-metastore/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-metastore/v1/.eslintrc.json b/owl-bot-staging/google-cloud-metastore/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/.gitignore b/owl-bot-staging/google-cloud-metastore/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/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-metastore/v1/.jsdoc.js b/owl-bot-staging/google-cloud-metastore/v1/.jsdoc.js new file mode 100644 index 00000000000..77430ad8c15 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/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/dataproc-metastore', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-metastore/v1/.mocharc.js b/owl-bot-staging/google-cloud-metastore/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/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-metastore/v1/.prettierrc.js b/owl-bot-staging/google-cloud-metastore/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/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-metastore/v1/README.md b/owl-bot-staging/google-cloud-metastore/v1/README.md new file mode 100644 index 00000000000..24afb9017c6 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/README.md @@ -0,0 +1 @@ +Metastore: Nodejs Client diff --git a/owl-bot-staging/google-cloud-metastore/v1/package.json b/owl-bot-staging/google-cloud-metastore/v1/package.json new file mode 100644 index 00000000000..e14926927ea --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/package.json @@ -0,0 +1,59 @@ +{ + "name": "@google-cloud/dataproc-metastore", + "version": "0.1.0", + "description": "Metastore client for Node.js", + "repository": "googleapis/nodejs-metastore", + "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 metastore", + "metastore", + "dataproc metastore", + "dataproc metastore federation" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore.proto b/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore.proto new file mode 100644 index 00000000000..1c999e9ba3a --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore.proto @@ -0,0 +1,1602 @@ +// 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 +// +// 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.metastore.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/type/dayofweek.proto"; + +option go_package = "cloud.google.com/go/metastore/apiv1/metastorepb;metastorepb"; +option java_multiple_files = true; +option java_outer_classname = "MetastoreProto"; +option java_package = "com.google.cloud.metastore.v1"; +option php_namespace = "Google\\Cloud\\Metastore\\V1"; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Network" + pattern: "projects/{project}/global/networks/{network}" +}; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Subnetwork" + pattern: "projects/{project}/regions/{region}/subnetworks/{subnetwork}" +}; +option (google.api.resource_definition) = { + type: "dataplex.googleapis.com/Lake" + pattern: "projects/{project}/locations/{location}/lakes/{lake}" +}; + +// Configures and manages metastore services. +// Metastore services are fully managed, highly available, autoscaled, +// autohealing, OSS-native deployments of technical metadata management +// software. Each metastore service exposes a network endpoint through which +// metadata queries are served. Metadata queries can originate from a variety +// of sources, including Apache Hive, Apache Presto, and Apache Spark. +// +// The Dataproc Metastore API defines the following resource model: +// +// * The service works with a collection of Google Cloud projects, named: +// `/projects/*` +// * Each project has a collection of available locations, named: `/locations/*` +// (a location must refer to a Google Cloud `region`) +// * Each location has a collection of services, named: `/services/*` +// * Dataproc Metastore services are resources with names of the form: +// +// `/projects/{project_number}/locations/{location_id}/services/{service_id}`. +service DataprocMetastore { + option (google.api.default_host) = "metastore.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists services in a project and location. + rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/services" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a single service. + rpc GetService(GetServiceRequest) returns (Service) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/services/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a metastore service in a project and location. + rpc CreateService(CreateServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/services" + body: "service" + }; + option (google.api.method_signature) = "parent,service,service_id"; + option (google.longrunning.operation_info) = { + response_type: "Service" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Updates the parameters of a single service. + rpc UpdateService(UpdateServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{service.name=projects/*/locations/*/services/*}" + body: "service" + }; + option (google.api.method_signature) = "service,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Service" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Deletes a single service. + rpc DeleteService(DeleteServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/services/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Lists imports in a service. + rpc ListMetadataImports(ListMetadataImportsRequest) + returns (ListMetadataImportsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/services/*}/metadataImports" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single import. + rpc GetMetadataImport(GetMetadataImportRequest) returns (MetadataImport) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/services/*/metadataImports/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new MetadataImport in a given project and location. + rpc CreateMetadataImport(CreateMetadataImportRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/services/*}/metadataImports" + body: "metadata_import" + }; + option (google.api.method_signature) = + "parent,metadata_import,metadata_import_id"; + option (google.longrunning.operation_info) = { + response_type: "MetadataImport" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Updates a single import. + // Only the description field of MetadataImport is supported to be updated. + rpc UpdateMetadataImport(UpdateMetadataImportRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{metadata_import.name=projects/*/locations/*/services/*/metadataImports/*}" + body: "metadata_import" + }; + option (google.api.method_signature) = "metadata_import,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "MetadataImport" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Exports metadata from a service. + rpc ExportMetadata(ExportMetadataRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{service=projects/*/locations/*/services/*}:exportMetadata" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "MetadataExport" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Restores a service from a backup. + rpc RestoreService(RestoreServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{service=projects/*/locations/*/services/*}:restore" + body: "*" + }; + option (google.api.method_signature) = "service,backup"; + option (google.longrunning.operation_info) = { + response_type: "Restore" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Lists backups in a service. + rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/services/*}/backups" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single backup. + rpc GetBackup(GetBackupRequest) returns (Backup) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/services/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new backup in a given project and location. + rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/services/*}/backups" + body: "backup" + }; + option (google.api.method_signature) = "parent,backup,backup_id"; + option (google.longrunning.operation_info) = { + response_type: "Backup" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Deletes a single backup. + rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/services/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Query DPMS metadata. + rpc QueryMetadata(QueryMetadataRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{service=projects/*/locations/*/services/*}:queryMetadata" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "QueryMetadataResponse" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Move a table to another database. + rpc MoveTableToDatabase(MoveTableToDatabaseRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{service=projects/*/locations/*/services/*}:moveTableToDatabase" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "MoveTableToDatabaseResponse" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Alter metadata resource location. The metadata resource can be a database, + // table, or partition. This functionality only updates the parent directory + // for the respective metadata resource and does not transfer any existing + // data to the new location. + rpc AlterMetadataResourceLocation(AlterMetadataResourceLocationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{service=projects/*/locations/*/services/*}:alterLocation" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "AlterMetadataResourceLocationResponse" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } +} + +// A managed metastore service that serves metadata queries. +message Service { + option (google.api.resource) = { + type: "metastore.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/services/{service}" + }; + + // The current state of the metastore service. + enum State { + // The state of the metastore service is unknown. + STATE_UNSPECIFIED = 0; + + // The metastore service is in the process of being created. + CREATING = 1; + + // The metastore service is running and ready to serve queries. + ACTIVE = 2; + + // The metastore service is entering suspension. Its query-serving + // availability may cease unexpectedly. + SUSPENDING = 3; + + // The metastore service is suspended and unable to serve queries. + SUSPENDED = 4; + + // The metastore service is being updated. It remains usable but cannot + // accept additional update requests or be deleted at this time. + UPDATING = 5; + + // The metastore service is undergoing deletion. It cannot be used. + DELETING = 6; + + // The metastore service has encountered an error and cannot be used. The + // metastore service should be deleted. + ERROR = 7; + } + + // Available service tiers. + enum Tier { + // The tier is not set. + TIER_UNSPECIFIED = 0; + + // The developer tier provides limited scalability and no fault tolerance. + // Good for low-cost proof-of-concept. + DEVELOPER = 1; + + // The enterprise tier provides multi-zone high availability, and sufficient + // scalability for enterprise-level Dataproc Metastore workloads. + ENTERPRISE = 3; + } + + // Release channels bundle features of varying levels of stability. Newer + // features may be introduced initially into less stable release channels and + // can be automatically promoted into more stable release channels. + enum ReleaseChannel { + // Release channel is not specified. + RELEASE_CHANNEL_UNSPECIFIED = 0; + + // The `CANARY` release channel contains the newest features, which may be + // unstable and subject to unresolved issues with no known workarounds. + // Services using the `CANARY` release channel are not subject to any SLAs. + CANARY = 1; + + // The `STABLE` release channel contains features that are considered stable + // and have been validated for production use. + STABLE = 2; + } + + // The backend database type for the metastore service. + enum DatabaseType { + // The DATABASE_TYPE is not set. + DATABASE_TYPE_UNSPECIFIED = 0; + + // MySQL is used to persist the metastore data. + MYSQL = 1; + + // Spanner is used to persist the metastore data. + SPANNER = 2; + } + + // Configuration properties specific to the underlying metastore service + // technology (the software that serves metastore queries). + oneof metastore_config { + // Configuration information specific to running Hive metastore + // software as the metastore service. + HiveMetastoreConfig hive_metastore_config = 5; + } + + // Immutable. The relative resource name of the metastore service, in the + // following format: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the metastore service was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metastore service was last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-defined labels for the metastore service. + map labels = 4; + + // Immutable. The relative resource name of the VPC network on which the + // instance can be accessed. It is specified in the following form: + // + // `projects/{project_number}/global/networks/{network_id}`. + string network = 7 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } + ]; + + // Output only. The URI of the endpoint used to access the metastore service. + string endpoint_uri = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The TCP port at which the metastore service is reached. Default: 9083. + int32 port = 9; + + // Output only. The current state of the metastore service. + State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current state of the + // metastore service, if available. + string state_message = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A Cloud Storage URI (starting with `gs://`) that specifies + // where artifacts related to the metastore service are stored. + string artifact_gcs_uri = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The tier of the service. + Tier tier = 13; + + // The one hour maintenance window of the metastore service. This specifies + // when the service can be restarted for maintenance purposes in UTC time. + // Maintenance window is not needed for services with the SPANNER + // database type. + MaintenanceWindow maintenance_window = 15; + + // Output only. The globally unique resource identifier of the metastore + // service. + string uid = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The metadata management activities of the metastore service. + MetadataManagementActivity metadata_management_activity = 17 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. The release channel of the service. + // If unspecified, defaults to `STABLE`. + ReleaseChannel release_channel = 19 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. Information used to configure the Dataproc Metastore service to + // encrypt customer data at rest. Cannot be updated. + EncryptionConfig encryption_config = 20 + [(google.api.field_behavior) = IMMUTABLE]; + + // The configuration specifying the network settings for the + // Dataproc Metastore service. + NetworkConfig network_config = 21; + + // Immutable. The database type that the Metastore service stores its data. + DatabaseType database_type = 22 [(google.api.field_behavior) = IMMUTABLE]; + + // The configuration specifying telemetry settings for the Dataproc Metastore + // service. If unspecified defaults to `JSON`. + TelemetryConfig telemetry_config = 23; + + // Scaling configuration of the metastore service. + ScalingConfig scaling_config = 24; +} + +// Maintenance window. This specifies when Dataproc Metastore +// may perform system maintenance operation to the service. +message MaintenanceWindow { + // The hour of day (0-23) when the window starts. + google.protobuf.Int32Value hour_of_day = 1; + + // The day of week, when the window starts. + google.type.DayOfWeek day_of_week = 2; +} + +// Specifies configuration information specific to running Hive metastore +// software as the metastore service. +message HiveMetastoreConfig { + // Protocols available for serving the metastore service endpoint. + enum EndpointProtocol { + // The protocol is not set. + ENDPOINT_PROTOCOL_UNSPECIFIED = 0; + + // Use the legacy Apache Thrift protocol for the metastore service endpoint. + THRIFT = 1; + + // Use the modernized gRPC protocol for the metastore service endpoint. + GRPC = 2; + } + + // Immutable. The Hive metastore schema version. + string version = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // A mapping of Hive metastore configuration key-value pairs to apply to the + // Hive metastore (configured in `hive-site.xml`). The mappings + // override system defaults (some keys cannot be overridden). These + // overrides are also applied to auxiliary versions and can be further + // customized in the auxiliary version's `AuxiliaryVersionConfig`. + map config_overrides = 2; + + // Information used to configure the Hive metastore service as a service + // principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + // method and specify this field's path + // (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + // while omitting this field from the request's `service`. + KerberosConfig kerberos_config = 3; + + // The protocol to use for the metastore service endpoint. If unspecified, + // defaults to `THRIFT`. + EndpointProtocol endpoint_protocol = 4; + + // A mapping of Hive metastore version to the auxiliary version + // configuration. When specified, a secondary Hive metastore service is + // created along with the primary service. All auxiliary versions must be less + // than the service's primary version. The key is the auxiliary service name + // and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This + // means that the first character must be a lowercase letter, and all the + // following characters must be hyphens, lowercase letters, or digits, except + // the last character, which cannot be a hyphen. + map auxiliary_versions = 5; +} + +// Configuration information for a Kerberos principal. +message KerberosConfig { + // A Kerberos keytab file that can be used to authenticate a service principal + // with a Kerberos Key Distribution Center (KDC). + Secret keytab = 1; + + // A Kerberos principal that exists in the both the keytab the KDC + // to authenticate as. A typical principal is of the form + // `primary/instance@REALM`, but there is no exact format. + string principal = 2; + + // A Cloud Storage URI that specifies the path to a + // krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + // although the file does not need to be named krb5.conf explicitly. + string krb5_config_gcs_uri = 3; +} + +// A securely stored value. +message Secret { + oneof value { + // The relative resource name of a Secret Manager secret version, in the + // following form: + // + // `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. + string cloud_secret = 2; + } +} + +// Encryption settings for the service. +message EncryptionConfig { + // The fully qualified customer provided Cloud KMS key name to use for + // customer data encryption, in the following form: + // + // `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + string kms_key = 1; +} + +// Configuration information for the auxiliary service versions. +message AuxiliaryVersionConfig { + // The Hive metastore version of the auxiliary service. It must be less + // than the primary Hive metastore service's version. + string version = 1; + + // A mapping of Hive metastore configuration key-value pairs to apply to the + // auxiliary Hive metastore (configured in `hive-site.xml`) in addition to + // the primary version's overrides. If keys are present in both the auxiliary + // version's overrides and the primary version's overrides, the value from + // the auxiliary version's overrides takes precedence. + map config_overrides = 2; + + // Output only. The network configuration contains the endpoint URI(s) of the + // auxiliary Hive metastore service. + NetworkConfig network_config = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Network configuration for the Dataproc Metastore service. +message NetworkConfig { + // Contains information of the customer's network configurations. + message Consumer { + oneof vpc_resource { + // Immutable. The subnetwork of the customer project from which an IP + // address is reserved and used as the Dataproc Metastore service's + // endpoint. It is accessible to hosts in the subnet and to all + // hosts in a subnet in the same region and same network. There must + // be at least one IP address available in the subnet's primary range. The + // subnet is specified in the following form: + // + // `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` + string subnetwork = 1 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { + type: "compute.googleapis.com/Subnetwork" + } + ]; + } + + // Output only. The URI of the endpoint used to access the metastore + // service. + string endpoint_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Immutable. The consumer-side network configuration for the Dataproc + // Metastore instance. + repeated Consumer consumers = 1 [(google.api.field_behavior) = IMMUTABLE]; +} + +// Telemetry Configuration for the Dataproc Metastore service. +message TelemetryConfig { + enum LogFormat { + // The LOG_FORMAT is not set. + LOG_FORMAT_UNSPECIFIED = 0; + + // Logging output uses the legacy `textPayload` format. + LEGACY = 1; + + // Logging output uses the `jsonPayload` format. + JSON = 2; + } + + // The output format of the Dataproc Metastore service's logs. + LogFormat log_format = 1; +} + +// The metadata management activities of the metastore service. +message MetadataManagementActivity { + // Output only. The latest metadata exports of the metastore service. + repeated MetadataExport metadata_exports = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The latest restores of the metastore service. + repeated Restore restores = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A metastore resource that imports metadata. +message MetadataImport { + option (google.api.resource) = { + type: "metastore.googleapis.com/MetadataImport" + pattern: "projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}" + }; + + // A specification of the location of and metadata about a database dump from + // a relational database management system. + message DatabaseDump { + // The type of the database. + enum DatabaseType { + // The type of the source database is unknown. + DATABASE_TYPE_UNSPECIFIED = 0; + + // The type of the source database is MySQL. + MYSQL = 1; + } + + // The type of the database. + DatabaseType database_type = 1 [deprecated = true]; + + // A Cloud Storage object or folder URI that specifies the source from which + // to import metadata. It must begin with `gs://`. + string gcs_uri = 2; + + // The name of the source database. + string source_database = 3 [deprecated = true]; + + // Optional. The type of the database dump. If unspecified, defaults to + // `MYSQL`. + DatabaseDumpSpec.Type type = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // The current state of the metadata import. + enum State { + // The state of the metadata import is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata import is running. + RUNNING = 1; + + // The metadata import completed successfully. + SUCCEEDED = 2; + + // The metadata import is being updated. + UPDATING = 3; + + // The metadata import failed, and attempted metadata changes were rolled + // back. + FAILED = 4; + } + + // The metadata to be imported. + oneof metadata { + // Immutable. A database dump from a pre-existing metastore's database. + DatabaseDump database_dump = 6 [(google.api.field_behavior) = IMMUTABLE]; + } + + // Immutable. The relative resource name of the metadata import, of the form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // The description of the metadata import. + string description = 2; + + // Output only. The time when the metadata import was started. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metadata import was last updated. + google.protobuf.Timestamp update_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metadata import finished. + google.protobuf.Timestamp end_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the metadata import. + State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a metadata export operation. +message MetadataExport { + // The current state of the metadata export. + enum State { + // The state of the metadata export is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata export is running. + RUNNING = 1; + + // The metadata export completed successfully. + SUCCEEDED = 2; + + // The metadata export failed. + FAILED = 3; + + // The metadata export is cancelled. + CANCELLED = 4; + } + + oneof destination { + // Output only. A Cloud Storage URI of a folder that metadata are exported + // to, in the form of + // `gs:////`, where + // `` is automatically generated. + string destination_gcs_uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Output only. The time when the export started. + google.protobuf.Timestamp start_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the export ended. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the export. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The type of the database dump. + DatabaseDumpSpec.Type database_dump_type = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a backup resource. +message Backup { + option (google.api.resource) = { + type: "metastore.googleapis.com/Backup" + pattern: "projects/{project}/locations/{location}/services/{service}/backups/{backup}" + }; + + // The current state of the backup. + enum State { + // The state of the backup is unknown. + STATE_UNSPECIFIED = 0; + + // The backup is being created. + CREATING = 1; + + // The backup is being deleted. + DELETING = 2; + + // The backup is active and ready to use. + ACTIVE = 3; + + // The backup failed. + FAILED = 4; + + // The backup is being restored. + RESTORING = 5; + } + + // Immutable. The relative resource name of the backup, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the backup was started. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the backup finished creating. + google.protobuf.Timestamp end_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the backup. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The revision of the service at the time of backup. + Service service_revision = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The description of the backup. + string description = 6; + + // Output only. Services that are restoring from the backup. + repeated string restoring_services = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a metadata restore operation. +message Restore { + // The current state of the restore. + enum State { + // The state of the metadata restore is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata restore is running. + RUNNING = 1; + + // The metadata restore completed successfully. + SUCCEEDED = 2; + + // The metadata restore failed. + FAILED = 3; + + // The metadata restore is cancelled. + CANCELLED = 4; + } + + // The type of restore. If unspecified, defaults to `METADATA_ONLY`. + enum RestoreType { + // The restore type is unknown. + RESTORE_TYPE_UNSPECIFIED = 0; + + // The service's metadata and configuration are restored. + FULL = 1; + + // Only the service's metadata is restored. + METADATA_ONLY = 2; + } + + // Output only. The time when the restore started. + google.protobuf.Timestamp start_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the restore ended. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the restore. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The relative resource name of the metastore service backup to + // restore from, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string backup = 4 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Output only. The type of restore. + RestoreType type = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The restore details containing the revision of the service to + // be restored to, in format of JSON. + string details = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents the scaling configuration of a metastore service. +message ScalingConfig { + // Metastore instance sizes. + enum InstanceSize { + // Unspecified instance size + INSTANCE_SIZE_UNSPECIFIED = 0; + + // Extra small instance size, maps to a scaling factor of 0.1. + EXTRA_SMALL = 1; + + // Small instance size, maps to a scaling factor of 0.5. + SMALL = 2; + + // Medium instance size, maps to a scaling factor of 1.0. + MEDIUM = 3; + + // Large instance size, maps to a scaling factor of 3.0. + LARGE = 4; + + // Extra large instance size, maps to a scaling factor of 6.0. + EXTRA_LARGE = 5; + } + + // Represents either a predetermined instance size or a numeric + // scaling factor. + oneof scaling_model { + // An enum of readable instance sizes, with each instance size mapping to a + // float value (e.g. InstanceSize.EXTRA_SMALL = scaling_factor(0.1)) + InstanceSize instance_size = 1; + + // Scaling factor, increments of 0.1 for values less than 1.0, and + // increments of 1.0 for values greater than 1.0. + float scaling_factor = 2; + } +} + +// Request message for +// [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices]. +message ListServicesRequest { + // Required. The relative resource name of the location of metastore services + // to list, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. The maximum number of services to return. The response may + // contain less than the maximum number. If unspecified, no more than 500 + // services are returned. The maximum value is 1000; values above 1000 are + // changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + // must match the call that provided the page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices]. +message ListServicesResponse { + // The services in the specified location. + repeated Service services = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [DataprocMetastore.GetService][google.cloud.metastore.v1.DataprocMetastore.GetService]. +message GetServiceRequest { + // Required. The relative resource name of the metastore service to retrieve, + // in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; +} + +// Request message for +// [DataprocMetastore.CreateService][google.cloud.metastore.v1.DataprocMetastore.CreateService]. +message CreateServiceRequest { + // Required. The relative resource name of the location in which to create a + // metastore service, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The ID of the metastore service, which is used as the final + // component of the metastore service's name. + // + // This value must be between 2 and 63 characters long inclusive, begin with a + // letter, end with a letter or number, and consist of alpha-numeric + // ASCII characters or hyphens. + string service_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Metastore service to create. The `name` field is + // ignored. The ID of the created metastore service must be provided in + // the request's `service_id` field. + Service service = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.UpdateService][google.cloud.metastore.v1.DataprocMetastore.UpdateService]. +message UpdateServiceRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metastore service resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The metastore service to update. The server only merges fields + // in the service if they are specified in `update_mask`. + // + // The metastore service's `name` field is used to identify the metastore + // service to be updated. + Service service = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.DeleteService][google.cloud.metastore.v1.DataprocMetastore.DeleteService]. +message DeleteServiceRequest { + // Required. The relative resource name of the metastore service to delete, in + // the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports]. +message ListMetadataImportsRequest { + // Required. The relative resource name of the service whose metadata imports + // to list, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/MetadataImport" + } + ]; + + // Optional. The maximum number of imports to return. The response may contain + // less than the maximum number. If unspecified, no more than 500 imports are + // returned. The maximum value is 1000; values above 1000 are changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + // must match the call that provided the page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports]. +message ListMetadataImportsResponse { + // The imports in the specified service. + repeated MetadataImport metadata_imports = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [DataprocMetastore.GetMetadataImport][google.cloud.metastore.v1.DataprocMetastore.GetMetadataImport]. +message GetMetadataImportRequest { + // Required. The relative resource name of the metadata import to retrieve, in + // the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/MetadataImport" + } + ]; +} + +// Request message for +// [DataprocMetastore.CreateMetadataImport][google.cloud.metastore.v1.DataprocMetastore.CreateMetadataImport]. +message CreateMetadataImportRequest { + // Required. The relative resource name of the service in which to create a + // metastore import, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/MetadataImport" + } + ]; + + // Required. The ID of the metadata import, which is used as the final + // component of the metadata import's name. + // + // This value must be between 1 and 64 characters long, begin with a letter, + // end with a letter or number, and consist of alpha-numeric ASCII characters + // or hyphens. + string metadata_import_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The metadata import to create. The `name` field is ignored. The + // ID of the created metadata import must be provided in the request's + // `metadata_import_id` field. + MetadataImport metadata_import = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.UpdateMetadataImport][google.cloud.metastore.v1.DataprocMetastore.UpdateMetadataImport]. +message UpdateMetadataImportRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metadata import resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The metadata import to update. The server only merges fields + // in the import if they are specified in `update_mask`. + // + // The metadata import's `name` field is used to identify the metastore + // import to be updated. + MetadataImport metadata_import = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups]. +message ListBackupsRequest { + // Required. The relative resource name of the service whose backups to + // list, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. The maximum number of backups to return. The response may contain + // less than the maximum number. If unspecified, no more than 500 backups are + // returned. The maximum value is 1000; values above 1000 are changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups] + // must match the call that provided the page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups]. +message ListBackupsResponse { + // The backups of the specified service. + repeated Backup backups = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [DataprocMetastore.GetBackup][google.cloud.metastore.v1.DataprocMetastore.GetBackup]. +message GetBackupRequest { + // Required. The relative resource name of the backup to retrieve, in the + // following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; +} + +// Request message for +// [DataprocMetastore.CreateBackup][google.cloud.metastore.v1.DataprocMetastore.CreateBackup]. +message CreateBackupRequest { + // Required. The relative resource name of the service in which to create a + // backup of the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Backup" + } + ]; + + // Required. The ID of the backup, which is used as the final component of the + // backup's name. + // + // This value must be between 1 and 64 characters long, begin with a letter, + // end with a letter or number, and consist of alpha-numeric ASCII characters + // or hyphens. + string backup_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The backup to create. The `name` field is ignored. The ID of the + // created backup must be provided in the request's `backup_id` field. + Backup backup = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.DeleteBackup][google.cloud.metastore.v1.DataprocMetastore.DeleteBackup]. +message DeleteBackupRequest { + // Required. The relative resource name of the backup to delete, in the + // following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.ExportMetadata][google.cloud.metastore.v1.DataprocMetastore.ExportMetadata]. +message ExportMetadataRequest { + // Required. Destination that metadata is exported to. + oneof destination { + // A Cloud Storage URI of a folder, in the format + // `gs:///`. A sub-folder + // `` containing exported files will be created below it. + string destination_gcs_folder = 2; + } + + // Required. The relative resource name of the metastore service to run + // export, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The type of the database dump. If unspecified, defaults to + // `MYSQL`. + DatabaseDumpSpec.Type database_dump_type = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [DataprocMetastore.Restore][]. +message RestoreServiceRequest { + // Required. The relative resource name of the metastore service to run + // restore, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The relative resource name of the metastore service backup to + // restore from, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string backup = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + Restore.RestoreType restore_type = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents the metadata of a long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the caller has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a + // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + // `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Metadata about the service in a location. +message LocationMetadata { + // A specification of a supported version of the Hive Metastore software. + message HiveMetastoreVersion { + // The semantic version of the Hive Metastore software. + string version = 1; + + // Whether `version` will be chosen by the server if a metastore service is + // created with a `HiveMetastoreConfig` that omits the `version`. + bool is_default = 2; + } + + // The versions of Hive Metastore that can be used when creating a new + // metastore service in this location. The server guarantees that exactly one + // `HiveMetastoreVersion` in the list will set `is_default`. + repeated HiveMetastoreVersion supported_hive_metastore_versions = 1; +} + +// The specification of database dump to import from or export to. +message DatabaseDumpSpec { + // The type of the database dump. + enum Type { + // The type of the database dump is unknown. + TYPE_UNSPECIFIED = 0; + + // Database dump is a MySQL dump file. + MYSQL = 1; + + // Database dump contains Avro files. + AVRO = 2; + } +} + +// Request message for +// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1.DataprocMetastore.QueryMetadata]. +message QueryMetadataRequest { + // Required. The relative resource name of the metastore service to query + // metadata, in the following format: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Required. A read-only SQL query to execute against the metadata database. + // The query cannot change or mutate the data. + string query = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for +// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1.DataprocMetastore.QueryMetadata]. +message QueryMetadataResponse { + // The manifest URI is link to a JSON instance in Cloud Storage. + // This instance manifests immediately along with QueryMetadataResponse. The + // content of the URI is not retriable until the long-running operation query + // against the metadata finishes. + string result_manifest_uri = 1; +} + +// Error details in public error message for +// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1.DataprocMetastore.QueryMetadata]. +message ErrorDetails { + // Additional structured details about this error. + // + // Keys define the failure items. + // Value describes the exception or details of the item. + map details = 1; +} + +// Request message for +// [DataprocMetastore.MoveTableToDatabase][google.cloud.metastore.v1.DataprocMetastore.MoveTableToDatabase]. +message MoveTableToDatabaseRequest { + // Required. The relative resource name of the metastore service to mutate + // metadata, in the following format: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The name of the table to be moved. + string table_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The name of the database where the table resides. + string db_name = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The name of the database where the table should be moved. + string destination_db_name = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for +// [DataprocMetastore.MoveTableToDatabase][google.cloud.metastore.v1.DataprocMetastore.MoveTableToDatabase]. +message MoveTableToDatabaseResponse {} + +// Request message for +// [DataprocMetastore.AlterMetadataResourceLocation][google.cloud.metastore.v1.DataprocMetastore.AlterMetadataResourceLocation]. +message AlterMetadataResourceLocationRequest { + // Required. The relative resource name of the metastore service to mutate + // metadata, in the following format: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The relative metadata resource name in the following format. + // + // `databases/{database_id}` + // or + // `databases/{database_id}/tables/{table_id}` + // or + // `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + string resource_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The new location URI for the metadata resource. + string location_uri = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for +// [DataprocMetastore.AlterMetadataResourceLocation][google.cloud.metastore.v1.DataprocMetastore.AlterMetadataResourceLocation]. +message AlterMetadataResourceLocationResponse {} diff --git a/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore_federation.proto b/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore_federation.proto new file mode 100644 index 00000000000..dbe25125fe6 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore_federation.proto @@ -0,0 +1,374 @@ +// 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 +// +// 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.metastore.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/metastore/v1/metastore.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/metastore/apiv1/metastorepb;metastorepb"; +option java_multiple_files = true; +option java_outer_classname = "MetastoreFederationProto"; +option java_package = "com.google.cloud.metastore.v1"; + +// Configures and manages metastore federation services. +// Dataproc Metastore Federation Service allows federating a collection of +// backend metastores like BigQuery, Dataplex Lakes, and other Dataproc +// Metastores. The Federation Service exposes a gRPC URL through which metadata +// from the backend metastores are served at query time. +// +// The Dataproc Metastore Federation API defines the following resource model: +// * The service works with a collection of Google Cloud projects. +// * Each project has a collection of available locations. +// * Each location has a collection of federations. +// * Dataproc Metastore Federations are resources with names of the +// form: +// `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. +service DataprocMetastoreFederation { + option (google.api.default_host) = "metastore.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists federations in a project and location. + rpc ListFederations(ListFederationsRequest) + returns (ListFederationsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/federations" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a single federation. + rpc GetFederation(GetFederationRequest) returns (Federation) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/federations/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a metastore federation in a project and location. + rpc CreateFederation(CreateFederationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/federations" + body: "federation" + }; + option (google.api.method_signature) = "parent,federation,federation_id"; + option (google.longrunning.operation_info) = { + response_type: "Federation" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Updates the fields of a federation. + rpc UpdateFederation(UpdateFederationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{federation.name=projects/*/locations/*/federations/*}" + body: "federation" + }; + option (google.api.method_signature) = "federation,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Federation" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Deletes a single federation. + rpc DeleteFederation(DeleteFederationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/federations/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } +} + +// Represents a federation of multiple backend metastores. +message Federation { + option (google.api.resource) = { + type: "metastore.googleapis.com/Federation" + pattern: "projects/{project}/locations/{location}/federations/{federation}" + }; + + // The current state of the federation. + enum State { + // The state of the metastore federation is unknown. + STATE_UNSPECIFIED = 0; + + // The metastore federation is in the process of being created. + CREATING = 1; + + // The metastore federation is running and ready to serve queries. + ACTIVE = 2; + + // The metastore federation is being updated. It remains usable but cannot + // accept additional update requests or be deleted at this time. + UPDATING = 3; + + // The metastore federation is undergoing deletion. It cannot be used. + DELETING = 4; + + // The metastore federation has encountered an error and cannot be used. The + // metastore federation should be deleted. + ERROR = 5; + } + + // Immutable. The relative resource name of the federation, of the + // form: + // projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the metastore federation was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metastore federation was last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-defined labels for the metastore federation. + map labels = 4; + + // Immutable. The Apache Hive metastore version of the federation. All backend + // metastore versions must be compatible with the federation version. + string version = 5 [(google.api.field_behavior) = IMMUTABLE]; + + // A map from `BackendMetastore` rank to `BackendMetastore`s from which the + // federation service serves metadata at query time. The map key represents + // the order in which `BackendMetastore`s should be evaluated to resolve + // database names at query time and should be greater than or equal to zero. A + // `BackendMetastore` with a lower number will be evaluated before a + // `BackendMetastore` with a higher number. + map backend_metastores = 6; + + // Output only. The federation endpoint. + string endpoint_uri = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the federation. + State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current state of the + // metastore federation, if available. + string state_message = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The globally unique resource identifier of the metastore + // federation. + string uid = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents a backend metastore for the federation. +message BackendMetastore { + // The type of the backend metastore. + enum MetastoreType { + // The metastore type is not set. + METASTORE_TYPE_UNSPECIFIED = 0; + + // The backend metastore is BigQuery. + BIGQUERY = 2; + + // The backend metastore is Dataproc Metastore. + DATAPROC_METASTORE = 3; + } + + // The relative resource name of the metastore that is being federated. + // The formats of the relative resource names for the currently supported + // metastores are listed below: + // + // * BigQuery + // * `projects/{project_id}` + // * Dataproc Metastore + // * `projects/{project_id}/locations/{location}/services/{service_id}` + string name = 1; + + // The type of the backend metastore. + MetastoreType metastore_type = 2; +} + +// Request message for ListFederations. +message ListFederationsRequest { + // Required. The relative resource name of the location of metastore + // federations to list, in the following form: + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Federation" + } + ]; + + // Optional. The maximum number of federations to return. The response may + // contain less than the maximum number. If unspecified, no more than 500 + // services are returned. The maximum value is 1000; values above 1000 are + // changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous ListFederationServices + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // ListFederationServices must match the call that provided the + // page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for ListFederations +message ListFederationsResponse { + // The services in the specified location. + repeated Federation federations = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for GetFederation. +message GetFederationRequest { + // Required. The relative resource name of the metastore federation to + // retrieve, in the following form: + // + // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Federation" + } + ]; +} + +// Request message for CreateFederation. +message CreateFederationRequest { + // Required. The relative resource name of the location in which to create a + // federation service, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Federation" + } + ]; + + // Required. The ID of the metastore federation, which is used as the final + // component of the metastore federation's name. + // + // This value must be between 2 and 63 characters long inclusive, begin with a + // letter, end with a letter or number, and consist of alpha-numeric + // ASCII characters or hyphens. + string federation_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Metastore Federation to create. The `name` field is + // ignored. The ID of the created metastore federation must be + // provided in the request's `federation_id` field. + Federation federation = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for UpdateFederation. +message UpdateFederationRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metastore federation resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The metastore federation to update. The server only merges fields + // in the service if they are specified in `update_mask`. + // + // The metastore federation's `name` field is used to identify the + // metastore service to be updated. + Federation federation = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for DeleteFederation. +message DeleteFederationRequest { + // Required. The relative resource name of the metastore federation to delete, + // in the following form: + // + // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Federation" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.alter_metadata_resource_location.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.alter_metadata_resource_location.js new file mode 100644 index 00000000000..1d91860b5ec --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.alter_metadata_resource_location.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(service, resourceName, locationUri) { + // [START metastore_v1_generated_DataprocMetastore_AlterMetadataResourceLocation_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 relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Required. The relative metadata resource name in the following format. + * `databases/{database_id}` + * or + * `databases/{database_id}/tables/{table_id}` + * or + * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + */ + // const resourceName = 'abc123' + /** + * Required. The new location URI for the metadata resource. + */ + // const locationUri = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callAlterMetadataResourceLocation() { + // Construct request + const request = { + service, + resourceName, + locationUri, + }; + + // Run request + const [operation] = await metastoreClient.alterMetadataResourceLocation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callAlterMetadataResourceLocation(); + // [END metastore_v1_generated_DataprocMetastore_AlterMetadataResourceLocation_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-metastore/v1/samples/generated/v1/dataproc_metastore.create_backup.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_backup.js new file mode 100644 index 00000000000..b5125a4e358 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_backup.js @@ -0,0 +1,92 @@ +// 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, backupId, backup) { + // [START metastore_v1_generated_DataprocMetastore_CreateBackup_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 relative resource name of the service in which to create a + * backup of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + */ + // const backupId = 'abc123' + /** + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + */ + // const backup = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateBackup() { + // Construct request + const request = { + parent, + backupId, + backup, + }; + + // Run request + const [operation] = await metastoreClient.createBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateBackup(); + // [END metastore_v1_generated_DataprocMetastore_CreateBackup_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-metastore/v1/samples/generated/v1/dataproc_metastore.create_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_metadata_import.js new file mode 100644 index 00000000000..1ffe0918b16 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_metadata_import.js @@ -0,0 +1,93 @@ +// 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, metadataImportId, metadataImport) { + // [START metastore_v1_generated_DataprocMetastore_CreateMetadataImport_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 relative resource name of the service in which to create a + * metastore import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + */ + // const metadataImportId = 'abc123' + /** + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + */ + // const metadataImport = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateMetadataImport() { + // Construct request + const request = { + parent, + metadataImportId, + metadataImport, + }; + + // Run request + const [operation] = await metastoreClient.createMetadataImport(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateMetadataImport(); + // [END metastore_v1_generated_DataprocMetastore_CreateMetadataImport_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-metastore/v1/samples/generated/v1/dataproc_metastore.create_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_service.js new file mode 100644 index 00000000000..b78b1404bc9 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_service.js @@ -0,0 +1,93 @@ +// 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, serviceId, service) { + // [START metastore_v1_generated_DataprocMetastore_CreateService_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 relative resource name of the location in which to create a + * metastore service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + */ + // const serviceId = 'abc123' + /** + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + */ + // const service = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateService() { + // Construct request + const request = { + parent, + serviceId, + service, + }; + + // Run request + const [operation] = await metastoreClient.createService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateService(); + // [END metastore_v1_generated_DataprocMetastore_CreateService_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-metastore/v1/samples/generated/v1/dataproc_metastore.delete_backup.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_backup.js new file mode 100644 index 00000000000..6dca464ce9f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_backup.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(name) { + // [START metastore_v1_generated_DataprocMetastore_DeleteBackup_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 relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callDeleteBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteBackup(); + // [END metastore_v1_generated_DataprocMetastore_DeleteBackup_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-metastore/v1/samples/generated/v1/dataproc_metastore.delete_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_service.js new file mode 100644 index 00000000000..af62ce30ef0 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_service.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(name) { + // [START metastore_v1_generated_DataprocMetastore_DeleteService_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 relative resource name of the metastore service to delete, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callDeleteService() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteService(); + // [END metastore_v1_generated_DataprocMetastore_DeleteService_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-metastore/v1/samples/generated/v1/dataproc_metastore.export_metadata.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.export_metadata.js new file mode 100644 index 00000000000..7b4a90f37ac --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.export_metadata.js @@ -0,0 +1,88 @@ +// 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(service) { + // [START metastore_v1_generated_DataprocMetastore_ExportMetadata_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. + */ + /** + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + */ + // const destinationGcsFolder = 'abc123' + /** + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + */ + // const databaseDumpType = {} + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callExportMetadata() { + // Construct request + const request = { + service, + }; + + // Run request + const [operation] = await metastoreClient.exportMetadata(request); + const [response] = await operation.promise(); + console.log(response); + } + + callExportMetadata(); + // [END metastore_v1_generated_DataprocMetastore_ExportMetadata_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-metastore/v1/samples/generated/v1/dataproc_metastore.get_backup.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_backup.js new file mode 100644 index 00000000000..9d32738c1b3 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_backup.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 metastore_v1_generated_DataprocMetastore_GetBackup_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 relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getBackup(request); + console.log(response); + } + + callGetBackup(); + // [END metastore_v1_generated_DataprocMetastore_GetBackup_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-metastore/v1/samples/generated/v1/dataproc_metastore.get_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_metadata_import.js new file mode 100644 index 00000000000..95024e88fbb --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_metadata_import.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 metastore_v1_generated_DataprocMetastore_GetMetadataImport_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 relative resource name of the metadata import to retrieve, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetMetadataImport() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getMetadataImport(request); + console.log(response); + } + + callGetMetadataImport(); + // [END metastore_v1_generated_DataprocMetastore_GetMetadataImport_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-metastore/v1/samples/generated/v1/dataproc_metastore.get_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_service.js new file mode 100644 index 00000000000..d3aa046e1d2 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_service.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 metastore_v1_generated_DataprocMetastore_GetService_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 relative resource name of the metastore service to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetService() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getService(request); + console.log(response); + } + + callGetService(); + // [END metastore_v1_generated_DataprocMetastore_GetService_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-metastore/v1/samples/generated/v1/dataproc_metastore.list_backups.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_backups.js new file mode 100644 index 00000000000..e3863fb2b47 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_backups.js @@ -0,0 +1,91 @@ +// 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 metastore_v1_generated_DataprocMetastore_ListBackups_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 relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous + * DataprocMetastore.ListBackups google.cloud.metastore.v1.DataprocMetastore.ListBackups + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListBackups google.cloud.metastore.v1.DataprocMetastore.ListBackups + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListBackups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listBackupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBackups(); + // [END metastore_v1_generated_DataprocMetastore_ListBackups_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-metastore/v1/samples/generated/v1/dataproc_metastore.list_metadata_imports.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_metadata_imports.js new file mode 100644 index 00000000000..dcddf3121f9 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_metadata_imports.js @@ -0,0 +1,91 @@ +// 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 metastore_v1_generated_DataprocMetastore_ListMetadataImports_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 relative resource name of the service whose metadata imports + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous + * DataprocMetastore.ListServices google.cloud.metastore.v1.DataprocMetastore.ListServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListServices google.cloud.metastore.v1.DataprocMetastore.ListServices + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListMetadataImports() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listMetadataImportsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMetadataImports(); + // [END metastore_v1_generated_DataprocMetastore_ListMetadataImports_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-metastore/v1/samples/generated/v1/dataproc_metastore.list_services.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_services.js new file mode 100644 index 00000000000..7d49b03464b --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_services.js @@ -0,0 +1,92 @@ +// 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 metastore_v1_generated_DataprocMetastore_ListServices_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 relative resource name of the location of metastore services + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous + * DataprocMetastore.ListServices google.cloud.metastore.v1.DataprocMetastore.ListServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListServices google.cloud.metastore.v1.DataprocMetastore.ListServices + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListServices() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listServicesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListServices(); + // [END metastore_v1_generated_DataprocMetastore_ListServices_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-metastore/v1/samples/generated/v1/dataproc_metastore.move_table_to_database.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.move_table_to_database.js new file mode 100644 index 00000000000..4f15ad1f664 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.move_table_to_database.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(service, tableName, dbName, destinationDbName) { + // [START metastore_v1_generated_DataprocMetastore_MoveTableToDatabase_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 relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Required. The name of the table to be moved. + */ + // const tableName = 'abc123' + /** + * Required. The name of the database where the table resides. + */ + // const dbName = 'abc123' + /** + * Required. The name of the database where the table should be moved. + */ + // const destinationDbName = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callMoveTableToDatabase() { + // Construct request + const request = { + service, + tableName, + dbName, + destinationDbName, + }; + + // Run request + const [operation] = await metastoreClient.moveTableToDatabase(request); + const [response] = await operation.promise(); + console.log(response); + } + + callMoveTableToDatabase(); + // [END metastore_v1_generated_DataprocMetastore_MoveTableToDatabase_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-metastore/v1/samples/generated/v1/dataproc_metastore.query_metadata.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.query_metadata.js new file mode 100644 index 00000000000..b514ada0518 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.query_metadata.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(service, query) { + // [START metastore_v1_generated_DataprocMetastore_QueryMetadata_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 relative resource name of the metastore service to query + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Required. A read-only SQL query to execute against the metadata database. + * The query cannot change or mutate the data. + */ + // const query = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callQueryMetadata() { + // Construct request + const request = { + service, + query, + }; + + // Run request + const [operation] = await metastoreClient.queryMetadata(request); + const [response] = await operation.promise(); + console.log(response); + } + + callQueryMetadata(); + // [END metastore_v1_generated_DataprocMetastore_QueryMetadata_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-metastore/v1/samples/generated/v1/dataproc_metastore.restore_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.restore_service.js new file mode 100644 index 00000000000..10e3459c45f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.restore_service.js @@ -0,0 +1,88 @@ +// 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(service, backup) { + // [START metastore_v1_generated_DataprocMetastore_RestoreService_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 relative resource name of the metastore service to run + * restore, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const backup = 'abc123' + /** + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + */ + // const restoreType = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callRestoreService() { + // Construct request + const request = { + service, + backup, + }; + + // Run request + const [operation] = await metastoreClient.restoreService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRestoreService(); + // [END metastore_v1_generated_DataprocMetastore_RestoreService_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-metastore/v1/samples/generated/v1/dataproc_metastore.update_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_metadata_import.js new file mode 100644 index 00000000000..4e8c75e9ea5 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_metadata_import.js @@ -0,0 +1,86 @@ +// 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(updateMask, metadataImport) { + // [START metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_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. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + */ + // const metadataImport = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callUpdateMetadataImport() { + // Construct request + const request = { + updateMask, + metadataImport, + }; + + // Run request + const [operation] = await metastoreClient.updateMetadataImport(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateMetadataImport(); + // [END metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_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-metastore/v1/samples/generated/v1/dataproc_metastore.update_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_service.js new file mode 100644 index 00000000000..8ea20cde6f8 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_service.js @@ -0,0 +1,86 @@ +// 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(updateMask, service) { + // [START metastore_v1_generated_DataprocMetastore_UpdateService_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. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + */ + // const service = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callUpdateService() { + // Construct request + const request = { + updateMask, + service, + }; + + // Run request + const [operation] = await metastoreClient.updateService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateService(); + // [END metastore_v1_generated_DataprocMetastore_UpdateService_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-metastore/v1/samples/generated/v1/dataproc_metastore_federation.create_federation.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.create_federation.js new file mode 100644 index 00000000000..6c5a670a8c2 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.create_federation.js @@ -0,0 +1,93 @@ +// 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, federationId, federation) { + // [START metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_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 relative resource name of the location in which to create a + * federation service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + */ + // const federationId = 'abc123' + /** + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + */ + // const federation = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callCreateFederation() { + // Construct request + const request = { + parent, + federationId, + federation, + }; + + // Run request + const [operation] = await metastoreClient.createFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFederation(); + // [END metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_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-metastore/v1/samples/generated/v1/dataproc_metastore_federation.delete_federation.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.delete_federation.js new file mode 100644 index 00000000000..43dd7799202 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.delete_federation.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(name) { + // [START metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_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 relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callDeleteFederation() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFederation(); + // [END metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_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-metastore/v1/samples/generated/v1/dataproc_metastore_federation.get_federation.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.get_federation.js new file mode 100644 index 00000000000..0dad1bb458a --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.get_federation.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 metastore_v1_generated_DataprocMetastoreFederation_GetFederation_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 relative resource name of the metastore federation to + * retrieve, in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callGetFederation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getFederation(request); + console.log(response); + } + + callGetFederation(); + // [END metastore_v1_generated_DataprocMetastoreFederation_GetFederation_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-metastore/v1/samples/generated/v1/dataproc_metastore_federation.list_federations.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.list_federations.js new file mode 100644 index 00000000000..5d4161729e9 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.list_federations.js @@ -0,0 +1,91 @@ +// 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 metastore_v1_generated_DataprocMetastoreFederation_ListFederations_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 relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callListFederations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listFederationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFederations(); + // [END metastore_v1_generated_DataprocMetastoreFederation_ListFederations_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-metastore/v1/samples/generated/v1/dataproc_metastore_federation.update_federation.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.update_federation.js new file mode 100644 index 00000000000..05989a1af86 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.update_federation.js @@ -0,0 +1,86 @@ +// 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(updateMask, federation) { + // [START metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_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. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + */ + // const federation = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callUpdateFederation() { + // Construct request + const request = { + updateMask, + federation, + }; + + // Run request + const [operation] = await metastoreClient.updateFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFederation(); + // [END metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_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-metastore/v1/samples/generated/v1/snippet_metadata_google.cloud.metastore.v1.json b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/snippet_metadata_google.cloud.metastore.v1.json new file mode 100644 index 00000000000..455874f87e7 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/snippet_metadata_google.cloud.metastore.v1.json @@ -0,0 +1,1131 @@ +{ + "clientLibrary": { + "name": "nodejs-metastore", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.metastore.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "metastore_v1_generated_DataprocMetastore_ListServices_async", + "title": "DataprocMetastore listServices Sample", + "origin": "API_DEFINITION", + "description": " Lists services in a project and location.", + "canonical": true, + "file": "dataproc_metastore.list_services.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServices", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListServices", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1.ListServicesResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListServices", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListServices", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_GetService_async", + "title": "DataprocMetastore getService Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a single service.", + "canonical": true, + "file": "dataproc_metastore.get_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetService", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1.Service", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_CreateService_async", + "title": "DataprocMetastore createService Sample", + "origin": "API_DEFINITION", + "description": " Creates a metastore service in a project and location.", + "canonical": true, + "file": "dataproc_metastore.create_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateService", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "service_id", + "type": "TYPE_STRING" + }, + { + "name": "service", + "type": ".google.cloud.metastore.v1.Service" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_UpdateService_async", + "title": "DataprocMetastore updateService Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a single service.", + "canonical": true, + "file": "dataproc_metastore.update_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.UpdateService", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "service", + "type": ".google.cloud.metastore.v1.Service" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "UpdateService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.UpdateService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_DeleteService_async", + "title": "DataprocMetastore deleteService Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single service.", + "canonical": true, + "file": "dataproc_metastore.delete_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.DeleteService", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "DeleteService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.DeleteService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_ListMetadataImports_async", + "title": "DataprocMetastore listMetadataImports Sample", + "origin": "API_DEFINITION", + "description": " Lists imports in a service.", + "canonical": true, + "file": "dataproc_metastore.list_metadata_imports.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMetadataImports", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1.ListMetadataImportsResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListMetadataImports", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_GetMetadataImport_async", + "title": "DataprocMetastore getMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single import.", + "canonical": true, + "file": "dataproc_metastore.get_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetMetadataImport", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetMetadataImport", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1.MetadataImport", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetMetadataImport", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_CreateMetadataImport_async", + "title": "DataprocMetastore createMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Creates a new MetadataImport in a given project and location.", + "canonical": true, + "file": "dataproc_metastore.create_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateMetadataImport", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateMetadataImport", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "metadata_import_id", + "type": "TYPE_STRING" + }, + { + "name": "metadata_import", + "type": ".google.cloud.metastore.v1.MetadataImport" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateMetadataImport", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_async", + "title": "DataprocMetastore updateMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Updates a single import. Only the description field of MetadataImport is supported to be updated.", + "canonical": true, + "file": "dataproc_metastore.update_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateMetadataImport", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.UpdateMetadataImport", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "metadata_import", + "type": ".google.cloud.metastore.v1.MetadataImport" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "UpdateMetadataImport", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.UpdateMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_ExportMetadata_async", + "title": "DataprocMetastore exportMetadata Sample", + "origin": "API_DEFINITION", + "description": " Exports metadata from a service.", + "canonical": true, + "file": "dataproc_metastore.export_metadata.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ExportMetadata", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.ExportMetadata", + "async": true, + "parameters": [ + { + "name": "destination_gcs_folder", + "type": "TYPE_STRING" + }, + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "database_dump_type", + "type": ".google.cloud.metastore.v1.DatabaseDumpSpec.Type" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "ExportMetadata", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.ExportMetadata", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_RestoreService_async", + "title": "DataprocMetastore restoreService Sample", + "origin": "API_DEFINITION", + "description": " Restores a service from a backup.", + "canonical": true, + "file": "dataproc_metastore.restore_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.RestoreService", + "async": true, + "parameters": [ + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": "TYPE_STRING" + }, + { + "name": "restore_type", + "type": ".google.cloud.metastore.v1.Restore.RestoreType" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "RestoreService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.RestoreService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_ListBackups_async", + "title": "DataprocMetastore listBackups Sample", + "origin": "API_DEFINITION", + "description": " Lists backups in a service.", + "canonical": true, + "file": "dataproc_metastore.list_backups.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBackups", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListBackups", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1.ListBackupsResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListBackups", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListBackups", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_GetBackup_async", + "title": "DataprocMetastore getBackup Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single backup.", + "canonical": true, + "file": "dataproc_metastore.get_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBackup", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1.Backup", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetBackup", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_CreateBackup_async", + "title": "DataprocMetastore createBackup Sample", + "origin": "API_DEFINITION", + "description": " Creates a new backup in a given project and location.", + "canonical": true, + "file": "dataproc_metastore.create_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBackup", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateBackup", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "backup_id", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": ".google.cloud.metastore.v1.Backup" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateBackup", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_DeleteBackup_async", + "title": "DataprocMetastore deleteBackup Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single backup.", + "canonical": true, + "file": "dataproc_metastore.delete_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.DeleteBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.DeleteBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_QueryMetadata_async", + "title": "DataprocMetastore queryMetadata Sample", + "origin": "API_DEFINITION", + "description": " Query DPMS metadata.", + "canonical": true, + "file": "dataproc_metastore.query_metadata.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "QueryMetadata", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.QueryMetadata", + "async": true, + "parameters": [ + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "QueryMetadata", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.QueryMetadata", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_MoveTableToDatabase_async", + "title": "DataprocMetastore moveTableToDatabase Sample", + "origin": "API_DEFINITION", + "description": " Move a table to another database.", + "canonical": true, + "file": "dataproc_metastore.move_table_to_database.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "MoveTableToDatabase", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.MoveTableToDatabase", + "async": true, + "parameters": [ + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "table_name", + "type": "TYPE_STRING" + }, + { + "name": "db_name", + "type": "TYPE_STRING" + }, + { + "name": "destination_db_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "MoveTableToDatabase", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.MoveTableToDatabase", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_AlterMetadataResourceLocation_async", + "title": "DataprocMetastore alterMetadataResourceLocation Sample", + "origin": "API_DEFINITION", + "description": " Alter metadata resource location. The metadata resource can be a database, table, or partition. This functionality only updates the parent directory for the respective metadata resource and does not transfer any existing data to the new location.", + "canonical": true, + "file": "dataproc_metastore.alter_metadata_resource_location.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AlterMetadataResourceLocation", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.AlterMetadataResourceLocation", + "async": true, + "parameters": [ + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "resource_name", + "type": "TYPE_STRING" + }, + { + "name": "location_uri", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "AlterMetadataResourceLocation", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.AlterMetadataResourceLocation", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_ListFederations_async", + "title": "DataprocMetastore listFederations Sample", + "origin": "API_DEFINITION", + "description": " Lists federations in a project and location.", + "canonical": true, + "file": "dataproc_metastore_federation.list_federations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFederations", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.ListFederations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1.ListFederationsResponse", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "ListFederations", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.ListFederations", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_GetFederation_async", + "title": "DataprocMetastore getFederation Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a single federation.", + "canonical": true, + "file": "dataproc_metastore_federation.get_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.GetFederation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1.Federation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "GetFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.GetFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_async", + "title": "DataprocMetastore createFederation Sample", + "origin": "API_DEFINITION", + "description": " Creates a metastore federation in a project and location.", + "canonical": true, + "file": "dataproc_metastore_federation.create_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.CreateFederation", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "federation_id", + "type": "TYPE_STRING" + }, + { + "name": "federation", + "type": ".google.cloud.metastore.v1.Federation" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "CreateFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.CreateFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_async", + "title": "DataprocMetastore updateFederation Sample", + "origin": "API_DEFINITION", + "description": " Updates the fields of a federation.", + "canonical": true, + "file": "dataproc_metastore_federation.update_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.UpdateFederation", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "federation", + "type": ".google.cloud.metastore.v1.Federation" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "UpdateFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.UpdateFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_async", + "title": "DataprocMetastore deleteFederation Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single federation.", + "canonical": true, + "file": "dataproc_metastore_federation.delete_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.DeleteFederation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "DeleteFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.DeleteFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1/src/index.ts new file mode 100644 index 00000000000..f51a12e6a33 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/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 DataprocMetastoreClient = v1.DataprocMetastoreClient; +type DataprocMetastoreClient = v1.DataprocMetastoreClient; +const DataprocMetastoreFederationClient = v1.DataprocMetastoreFederationClient; +type DataprocMetastoreFederationClient = v1.DataprocMetastoreFederationClient; +export {v1, DataprocMetastoreClient, DataprocMetastoreFederationClient}; +export default {v1, DataprocMetastoreClient, DataprocMetastoreFederationClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client.ts b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client.ts new file mode 100644 index 00000000000..a15f7a8831c --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client.ts @@ -0,0 +1,3409 @@ +// 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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/dataproc_metastore_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './dataproc_metastore_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Configures and manages metastore services. + * Metastore services are fully managed, highly available, autoscaled, + * autohealing, OSS-native deployments of technical metadata management + * software. Each metastore service exposes a network endpoint through which + * metadata queries are served. Metadata queries can originate from a variety + * of sources, including Apache Hive, Apache Presto, and Apache Spark. + * + * The Dataproc Metastore API defines the following resource model: + * + * * The service works with a collection of Google Cloud projects, named: + * `/projects/*` + * * Each project has a collection of available locations, named: `/locations/*` + * (a location must refer to a Google Cloud `region`) + * * Each location has a collection of services, named: `/services/*` + * * Dataproc Metastore services are resources with names of the form: + * + * `/projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @class + * @memberof v1 + */ +export class DataprocMetastoreClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + dataprocMetastoreStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DataprocMetastoreClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 DataprocMetastoreClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof DataprocMetastoreClient; + 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; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + 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 = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' + ), + federationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/federations/{federation}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + metadataImportPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' + ), + networkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/global/networks/{network}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listServices: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'services'), + listMetadataImports: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metadataImports'), + listBackups: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.Service') as gax.protobuf.Type; + const createServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const updateServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.Service') as gax.protobuf.Type; + const updateServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const deleteServiceResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const createMetadataImportResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.MetadataImport') as gax.protobuf.Type; + const createMetadataImportMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const updateMetadataImportResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.MetadataImport') as gax.protobuf.Type; + const updateMetadataImportMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const exportMetadataResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.MetadataExport') as gax.protobuf.Type; + const exportMetadataMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const restoreServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.Restore') as gax.protobuf.Type; + const restoreServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const createBackupResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.Backup') as gax.protobuf.Type; + const createBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const deleteBackupResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const queryMetadataResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.QueryMetadataResponse') as gax.protobuf.Type; + const queryMetadataMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const moveTableToDatabaseResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.MoveTableToDatabaseResponse') as gax.protobuf.Type; + const moveTableToDatabaseMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const alterMetadataResourceLocationResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.AlterMetadataResourceLocationResponse') as gax.protobuf.Type; + const alterMetadataResourceLocationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createServiceResponse.decode.bind(createServiceResponse), + createServiceMetadata.decode.bind(createServiceMetadata)), + updateService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateServiceResponse.decode.bind(updateServiceResponse), + updateServiceMetadata.decode.bind(updateServiceMetadata)), + deleteService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteServiceResponse.decode.bind(deleteServiceResponse), + deleteServiceMetadata.decode.bind(deleteServiceMetadata)), + createMetadataImport: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createMetadataImportResponse.decode.bind(createMetadataImportResponse), + createMetadataImportMetadata.decode.bind(createMetadataImportMetadata)), + updateMetadataImport: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateMetadataImportResponse.decode.bind(updateMetadataImportResponse), + updateMetadataImportMetadata.decode.bind(updateMetadataImportMetadata)), + exportMetadata: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportMetadataResponse.decode.bind(exportMetadataResponse), + exportMetadataMetadata.decode.bind(exportMetadataMetadata)), + restoreService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + restoreServiceResponse.decode.bind(restoreServiceResponse), + restoreServiceMetadata.decode.bind(restoreServiceMetadata)), + createBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBackupResponse.decode.bind(createBackupResponse), + createBackupMetadata.decode.bind(createBackupMetadata)), + deleteBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteBackupResponse.decode.bind(deleteBackupResponse), + deleteBackupMetadata.decode.bind(deleteBackupMetadata)), + queryMetadata: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + queryMetadataResponse.decode.bind(queryMetadataResponse), + queryMetadataMetadata.decode.bind(queryMetadataMetadata)), + moveTableToDatabase: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + moveTableToDatabaseResponse.decode.bind(moveTableToDatabaseResponse), + moveTableToDatabaseMetadata.decode.bind(moveTableToDatabaseMetadata)), + alterMetadataResourceLocation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + alterMetadataResourceLocationResponse.decode.bind(alterMetadataResourceLocationResponse), + alterMetadataResourceLocationMetadata.decode.bind(alterMetadataResourceLocationMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.metastore.v1.DataprocMetastore', 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.dataprocMetastoreStub) { + return this.dataprocMetastoreStub; + } + + // Put together the "service stub" for + // google.cloud.metastore.v1.DataprocMetastore. + this.dataprocMetastoreStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1.DataprocMetastore') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.metastore.v1.DataprocMetastore, + 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 dataprocMetastoreStubMethods = + ['listServices', 'getService', 'createService', 'updateService', 'deleteService', 'listMetadataImports', 'getMetadataImport', 'createMetadataImport', 'updateMetadataImport', 'exportMetadata', 'restoreService', 'listBackups', 'getBackup', 'createBackup', 'deleteBackup', 'queryMetadata', 'moveTableToDatabase', 'alterMetadataResourceLocation']; + for (const methodName of dataprocMetastoreStubMethods) { + const callPromise = this.dataprocMetastoreStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.dataprocMetastoreStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'metastore.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 'metastore.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 -- + // ------------------- +/** + * Gets the details of a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.metastore.v1.Service|Service}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.get_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_GetService_async + */ + getService( + request?: protos.google.cloud.metastore.v1.IGetServiceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1.IService, + protos.google.cloud.metastore.v1.IGetServiceRequest|undefined, {}|undefined + ]>; + getService( + request: protos.google.cloud.metastore.v1.IGetServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1.IService, + protos.google.cloud.metastore.v1.IGetServiceRequest|null|undefined, + {}|null|undefined>): void; + getService( + request: protos.google.cloud.metastore.v1.IGetServiceRequest, + callback: Callback< + protos.google.cloud.metastore.v1.IService, + protos.google.cloud.metastore.v1.IGetServiceRequest|null|undefined, + {}|null|undefined>): void; + getService( + request?: protos.google.cloud.metastore.v1.IGetServiceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1.IService, + protos.google.cloud.metastore.v1.IGetServiceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1.IService, + protos.google.cloud.metastore.v1.IGetServiceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1.IService, + protos.google.cloud.metastore.v1.IGetServiceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getService(request, options, callback); + } +/** + * Gets details of a single import. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_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 protos.google.cloud.metastore.v1.MetadataImport|MetadataImport}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.get_metadata_import.js + * region_tag:metastore_v1_generated_DataprocMetastore_GetMetadataImport_async + */ + getMetadataImport( + request?: protos.google.cloud.metastore.v1.IGetMetadataImportRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1.IMetadataImport, + protos.google.cloud.metastore.v1.IGetMetadataImportRequest|undefined, {}|undefined + ]>; + getMetadataImport( + request: protos.google.cloud.metastore.v1.IGetMetadataImportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1.IMetadataImport, + protos.google.cloud.metastore.v1.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): void; + getMetadataImport( + request: protos.google.cloud.metastore.v1.IGetMetadataImportRequest, + callback: Callback< + protos.google.cloud.metastore.v1.IMetadataImport, + protos.google.cloud.metastore.v1.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): void; + getMetadataImport( + request?: protos.google.cloud.metastore.v1.IGetMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1.IMetadataImport, + protos.google.cloud.metastore.v1.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1.IMetadataImport, + protos.google.cloud.metastore.v1.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1.IMetadataImport, + protos.google.cloud.metastore.v1.IGetMetadataImportRequest|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.getMetadataImport(request, options, callback); + } +/** + * Gets details of a single backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the backup to retrieve, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_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 protos.google.cloud.metastore.v1.Backup|Backup}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.get_backup.js + * region_tag:metastore_v1_generated_DataprocMetastore_GetBackup_async + */ + getBackup( + request?: protos.google.cloud.metastore.v1.IGetBackupRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1.IBackup, + protos.google.cloud.metastore.v1.IGetBackupRequest|undefined, {}|undefined + ]>; + getBackup( + request: protos.google.cloud.metastore.v1.IGetBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1.IBackup, + protos.google.cloud.metastore.v1.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request: protos.google.cloud.metastore.v1.IGetBackupRequest, + callback: Callback< + protos.google.cloud.metastore.v1.IBackup, + protos.google.cloud.metastore.v1.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request?: protos.google.cloud.metastore.v1.IGetBackupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1.IBackup, + protos.google.cloud.metastore.v1.IGetBackupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1.IBackup, + protos.google.cloud.metastore.v1.IGetBackupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1.IBackup, + protos.google.cloud.metastore.v1.IGetBackupRequest|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.getBackup(request, options, callback); + } + +/** + * Creates a metastore service in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {string} request.serviceId + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param {google.cloud.metastore.v1.Service} request.service + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.create_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_CreateService_async + */ + createService( + request?: protos.google.cloud.metastore.v1.ICreateServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createService( + request: protos.google.cloud.metastore.v1.ICreateServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createService( + request: protos.google.cloud.metastore.v1.ICreateServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createService( + request?: protos.google.cloud.metastore.v1.ICreateServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.create_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_CreateService_async + */ + async checkCreateServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the parameters of a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1.Service} request.service + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.update_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_UpdateService_async + */ + updateService( + request?: protos.google.cloud.metastore.v1.IUpdateServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateService( + request: protos.google.cloud.metastore.v1.IUpdateServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateService( + request: protos.google.cloud.metastore.v1.IUpdateServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateService( + request?: protos.google.cloud.metastore.v1.IUpdateServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service.name': request.service!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.update_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_UpdateService_async + */ + async checkUpdateServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore service to delete, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.delete_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_DeleteService_async + */ + deleteService( + request?: protos.google.cloud.metastore.v1.IDeleteServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteService( + request: protos.google.cloud.metastore.v1.IDeleteServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteService( + request: protos.google.cloud.metastore.v1.IDeleteServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteService( + request?: protos.google.cloud.metastore.v1.IDeleteServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.delete_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_DeleteService_async + */ + async checkDeleteServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new MetadataImport in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} request.metadataImportId + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param {google.cloud.metastore.v1.MetadataImport} request.metadataImport + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.create_metadata_import.js + * region_tag:metastore_v1_generated_DataprocMetastore_CreateMetadataImport_async + */ + createMetadataImport( + request?: protos.google.cloud.metastore.v1.ICreateMetadataImportRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createMetadataImport( + request: protos.google.cloud.metastore.v1.ICreateMetadataImportRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMetadataImport( + request: protos.google.cloud.metastore.v1.ICreateMetadataImportRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMetadataImport( + request?: protos.google.cloud.metastore.v1.ICreateMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createMetadataImport(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createMetadataImport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.create_metadata_import.js + * region_tag:metastore_v1_generated_DataprocMetastore_CreateMetadataImport_async + */ + async checkCreateMetadataImportProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMetadataImport, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates a single import. + * Only the description field of MetadataImport is supported to be updated. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1.MetadataImport} request.metadataImport + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.update_metadata_import.js + * region_tag:metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_async + */ + updateMetadataImport( + request?: protos.google.cloud.metastore.v1.IUpdateMetadataImportRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateMetadataImport( + request: protos.google.cloud.metastore.v1.IUpdateMetadataImportRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMetadataImport( + request: protos.google.cloud.metastore.v1.IUpdateMetadataImportRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMetadataImport( + request?: protos.google.cloud.metastore.v1.IUpdateMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'metadata_import.name': request.metadataImport!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateMetadataImport(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateMetadataImport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.update_metadata_import.js + * region_tag:metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_async + */ + async checkUpdateMetadataImportProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMetadataImport, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Exports metadata from a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.destinationGcsFolder + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * @param {string} request.service + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {google.cloud.metastore.v1.DatabaseDumpSpec.Type} [request.databaseDumpType] + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.export_metadata.js + * region_tag:metastore_v1_generated_DataprocMetastore_ExportMetadata_async + */ + exportMetadata( + request?: protos.google.cloud.metastore.v1.IExportMetadataRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + exportMetadata( + request: protos.google.cloud.metastore.v1.IExportMetadataRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportMetadata( + request: protos.google.cloud.metastore.v1.IExportMetadataRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportMetadata( + request?: protos.google.cloud.metastore.v1.IExportMetadataRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.exportMetadata(request, options, callback); + } +/** + * Check the status of the long running operation returned by `exportMetadata()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.export_metadata.js + * region_tag:metastore_v1_generated_DataprocMetastore_ExportMetadata_async + */ + async checkExportMetadataProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportMetadata, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Restores a service from a backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.service + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} request.backup + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param {google.cloud.metastore.v1.Restore.RestoreType} [request.restoreType] + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.restore_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_RestoreService_async + */ + restoreService( + request?: protos.google.cloud.metastore.v1.IRestoreServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + restoreService( + request: protos.google.cloud.metastore.v1.IRestoreServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreService( + request: protos.google.cloud.metastore.v1.IRestoreServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreService( + request?: protos.google.cloud.metastore.v1.IRestoreServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.restoreService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `restoreService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.restore_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_RestoreService_async + */ + async checkRestoreServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new backup in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service in which to create a + * backup of the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} request.backupId + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param {google.cloud.metastore.v1.Backup} request.backup + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.create_backup.js + * region_tag:metastore_v1_generated_DataprocMetastore_CreateBackup_async + */ + createBackup( + request?: protos.google.cloud.metastore.v1.ICreateBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createBackup( + request: protos.google.cloud.metastore.v1.ICreateBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request: protos.google.cloud.metastore.v1.ICreateBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request?: protos.google.cloud.metastore.v1.ICreateBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.create_backup.js + * region_tag:metastore_v1_generated_DataprocMetastore_CreateBackup_async + */ + async checkCreateBackupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the backup to delete, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.delete_backup.js + * region_tag:metastore_v1_generated_DataprocMetastore_DeleteBackup_async + */ + deleteBackup( + request?: protos.google.cloud.metastore.v1.IDeleteBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteBackup( + request: protos.google.cloud.metastore.v1.IDeleteBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request: protos.google.cloud.metastore.v1.IDeleteBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request?: protos.google.cloud.metastore.v1.IDeleteBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.delete_backup.js + * region_tag:metastore_v1_generated_DataprocMetastore_DeleteBackup_async + */ + async checkDeleteBackupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteBackup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Query DPMS metadata. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.service + * Required. The relative resource name of the metastore service to query + * metadata, in the following format: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} request.query + * Required. A read-only SQL query to execute against the metadata database. + * The query cannot change or mutate the data. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.query_metadata.js + * region_tag:metastore_v1_generated_DataprocMetastore_QueryMetadata_async + */ + queryMetadata( + request?: protos.google.cloud.metastore.v1.IQueryMetadataRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + queryMetadata( + request: protos.google.cloud.metastore.v1.IQueryMetadataRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + queryMetadata( + request: protos.google.cloud.metastore.v1.IQueryMetadataRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + queryMetadata( + request?: protos.google.cloud.metastore.v1.IQueryMetadataRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.queryMetadata(request, options, callback); + } +/** + * Check the status of the long running operation returned by `queryMetadata()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.query_metadata.js + * region_tag:metastore_v1_generated_DataprocMetastore_QueryMetadata_async + */ + async checkQueryMetadataProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.queryMetadata, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Move a table to another database. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.service + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} request.tableName + * Required. The name of the table to be moved. + * @param {string} request.dbName + * Required. The name of the database where the table resides. + * @param {string} request.destinationDbName + * Required. The name of the database where the table should be moved. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.move_table_to_database.js + * region_tag:metastore_v1_generated_DataprocMetastore_MoveTableToDatabase_async + */ + moveTableToDatabase( + request?: protos.google.cloud.metastore.v1.IMoveTableToDatabaseRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + moveTableToDatabase( + request: protos.google.cloud.metastore.v1.IMoveTableToDatabaseRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + moveTableToDatabase( + request: protos.google.cloud.metastore.v1.IMoveTableToDatabaseRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + moveTableToDatabase( + request?: protos.google.cloud.metastore.v1.IMoveTableToDatabaseRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.moveTableToDatabase(request, options, callback); + } +/** + * Check the status of the long running operation returned by `moveTableToDatabase()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.move_table_to_database.js + * region_tag:metastore_v1_generated_DataprocMetastore_MoveTableToDatabase_async + */ + async checkMoveTableToDatabaseProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.moveTableToDatabase, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Alter metadata resource location. The metadata resource can be a database, + * table, or partition. This functionality only updates the parent directory + * for the respective metadata resource and does not transfer any existing + * data to the new location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.service + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} request.resourceName + * Required. The relative metadata resource name in the following format. + * + * `databases/{database_id}` + * or + * `databases/{database_id}/tables/{table_id}` + * or + * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + * @param {string} request.locationUri + * Required. The new location URI for the metadata 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.alter_metadata_resource_location.js + * region_tag:metastore_v1_generated_DataprocMetastore_AlterMetadataResourceLocation_async + */ + alterMetadataResourceLocation( + request?: protos.google.cloud.metastore.v1.IAlterMetadataResourceLocationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + alterMetadataResourceLocation( + request: protos.google.cloud.metastore.v1.IAlterMetadataResourceLocationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + alterMetadataResourceLocation( + request: protos.google.cloud.metastore.v1.IAlterMetadataResourceLocationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + alterMetadataResourceLocation( + request?: protos.google.cloud.metastore.v1.IAlterMetadataResourceLocationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.alterMetadataResourceLocation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `alterMetadataResourceLocation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.alter_metadata_resource_location.js + * region_tag:metastore_v1_generated_DataprocMetastore_AlterMetadataResourceLocation_async + */ + async checkAlterMetadataResourceLocationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.alterMetadataResourceLocation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists services in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1.Service|Service}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listServicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listServices( + request?: protos.google.cloud.metastore.v1.IListServicesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1.IService[], + protos.google.cloud.metastore.v1.IListServicesRequest|null, + protos.google.cloud.metastore.v1.IListServicesResponse + ]>; + listServices( + request: protos.google.cloud.metastore.v1.IListServicesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1.IListServicesRequest, + protos.google.cloud.metastore.v1.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1.IService>): void; + listServices( + request: protos.google.cloud.metastore.v1.IListServicesRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1.IListServicesRequest, + protos.google.cloud.metastore.v1.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1.IService>): void; + listServices( + request?: protos.google.cloud.metastore.v1.IListServicesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1.IListServicesRequest, + protos.google.cloud.metastore.v1.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1.IService>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1.IListServicesRequest, + protos.google.cloud.metastore.v1.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1.IService>): + Promise<[ + protos.google.cloud.metastore.v1.IService[], + protos.google.cloud.metastore.v1.IListServicesRequest|null, + protos.google.cloud.metastore.v1.IListServicesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listServices(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 protos.google.cloud.metastore.v1.Service|Service} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listServicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listServicesStream( + request?: protos.google.cloud.metastore.v1.IListServicesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listServices']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServices.createStream( + this.innerApiCalls.listServices as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listServices`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.metastore.v1.Service|Service}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.list_services.js + * region_tag:metastore_v1_generated_DataprocMetastore_ListServices_async + */ + listServicesAsync( + request?: protos.google.cloud.metastore.v1.IListServicesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listServices']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServices.asyncIterate( + this.innerApiCalls['listServices'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists imports in a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1.MetadataImport|MetadataImport}. + * 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 `listMetadataImportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMetadataImports( + request?: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1.IMetadataImport[], + protos.google.cloud.metastore.v1.IListMetadataImportsRequest|null, + protos.google.cloud.metastore.v1.IListMetadataImportsResponse + ]>; + listMetadataImports( + request: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1.IMetadataImport>): void; + listMetadataImports( + request: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1.IMetadataImport>): void; + listMetadataImports( + request?: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1.IMetadataImport>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1.IMetadataImport>): + Promise<[ + protos.google.cloud.metastore.v1.IMetadataImport[], + protos.google.cloud.metastore.v1.IListMetadataImportsRequest|null, + protos.google.cloud.metastore.v1.IListMetadataImportsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listMetadataImports(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 protos.google.cloud.metastore.v1.MetadataImport|MetadataImport} 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 `listMetadataImportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMetadataImportsStream( + request?: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + 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['listMetadataImports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMetadataImports.createStream( + this.innerApiCalls.listMetadataImports as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMetadataImports`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.metastore.v1.MetadataImport|MetadataImport}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.list_metadata_imports.js + * region_tag:metastore_v1_generated_DataprocMetastore_ListMetadataImports_async + */ + listMetadataImportsAsync( + request?: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + 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['listMetadataImports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMetadataImports.asyncIterate( + this.innerApiCalls['listMetadataImports'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists backups in a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1.Backup|Backup}. + * 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 `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBackups( + request?: protos.google.cloud.metastore.v1.IListBackupsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1.IBackup[], + protos.google.cloud.metastore.v1.IListBackupsRequest|null, + protos.google.cloud.metastore.v1.IListBackupsResponse + ]>; + listBackups( + request: protos.google.cloud.metastore.v1.IListBackupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1.IListBackupsRequest, + protos.google.cloud.metastore.v1.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1.IBackup>): void; + listBackups( + request: protos.google.cloud.metastore.v1.IListBackupsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1.IListBackupsRequest, + protos.google.cloud.metastore.v1.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1.IBackup>): void; + listBackups( + request?: protos.google.cloud.metastore.v1.IListBackupsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1.IListBackupsRequest, + protos.google.cloud.metastore.v1.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1.IBackup>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1.IListBackupsRequest, + protos.google.cloud.metastore.v1.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1.IBackup>): + Promise<[ + protos.google.cloud.metastore.v1.IBackup[], + protos.google.cloud.metastore.v1.IListBackupsRequest|null, + protos.google.cloud.metastore.v1.IListBackupsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listBackups(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 protos.google.cloud.metastore.v1.Backup|Backup} 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 `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBackupsStream( + request?: protos.google.cloud.metastore.v1.IListBackupsRequest, + 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['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.createStream( + this.innerApiCalls.listBackups as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBackups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.metastore.v1.Backup|Backup}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.list_backups.js + * region_tag:metastore_v1_generated_DataprocMetastore_ListBackups_async + */ + listBackupsAsync( + request?: protos.google.cloud.metastore.v1.IListBackupsRequest, + 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['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.asyncIterate( + this.innerApiCalls['listBackups'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,location:string,service:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + service: service, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the service from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the service. + */ + matchServiceFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).service; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified federation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} federation + * @returns {string} Resource name string. + */ + federationPath(project:string,location:string,federation:string) { + return this.pathTemplates.federationPathTemplate.render({ + project: project, + location: location, + federation: federation, + }); + } + + /** + * Parse the project from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).project; + } + + /** + * Parse the location from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).location; + } + + /** + * Parse the federation from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the federation. + */ + matchFederationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).federation; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified metadataImport resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} metadata_import + * @returns {string} Resource name string. + */ + metadataImportPath(project:string,location:string,service:string,metadataImport:string) { + return this.pathTemplates.metadataImportPathTemplate.render({ + project: project, + location: location, + service: service, + metadata_import: metadataImport, + }); + } + + /** + * Parse the project from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; + } + + /** + * Parse the location from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; + } + + /** + * Parse the service from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the service. + */ + matchServiceFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; + } + + /** + * Parse the metadata_import from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the metadata_import. + */ + matchMetadataImportFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; + } + + /** + * Return a fully-qualified network resource name string. + * + * @param {string} project + * @param {string} network + * @returns {string} Resource name string. + */ + networkPath(project:string,network:string) { + return this.pathTemplates.networkPathTemplate.render({ + project: project, + network: network, + }); + } + + /** + * Parse the project from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).project; + } + + /** + * Parse the network from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the network. + */ + matchNetworkFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).network; + } + + /** + * 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 service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * 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.dataprocMetastoreStub && !this._terminated) { + return this.dataprocMetastoreStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client_config.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client_config.json new file mode 100644 index 00000000000..14466cef361 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client_config.json @@ -0,0 +1,128 @@ +{ + "interfaces": { + "google.cloud.metastore.v1.DataprocMetastore": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListServices": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetService": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListMetadataImports": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ExportMetadata": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RestoreService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "QueryMetadata": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "MoveTableToDatabase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "AlterMetadataResourceLocation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client.ts b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client.ts new file mode 100644 index 00000000000..7efef4213fa --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client.ts @@ -0,0 +1,1714 @@ +// 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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/dataproc_metastore_federation_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './dataproc_metastore_federation_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Configures and manages metastore federation services. + * Dataproc Metastore Federation Service allows federating a collection of + * backend metastores like BigQuery, Dataplex Lakes, and other Dataproc + * Metastores. The Federation Service exposes a gRPC URL through which metadata + * from the backend metastores are served at query time. + * + * The Dataproc Metastore Federation API defines the following resource model: + * * The service works with a collection of Google Cloud projects. + * * Each project has a collection of available locations. + * * Each location has a collection of federations. + * * Dataproc Metastore Federations are resources with names of the + * form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @class + * @memberof v1 + */ +export class DataprocMetastoreFederationClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + dataprocMetastoreFederationStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DataprocMetastoreFederationClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 DataprocMetastoreFederationClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof DataprocMetastoreFederationClient; + 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; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + 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 = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' + ), + federationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/federations/{federation}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + metadataImportPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + }; + + // 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 = { + listFederations: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'federations') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createFederationResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.Federation') as gax.protobuf.Type; + const createFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const updateFederationResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.Federation') as gax.protobuf.Type; + const updateFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const deleteFederationResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFederationResponse.decode.bind(createFederationResponse), + createFederationMetadata.decode.bind(createFederationMetadata)), + updateFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFederationResponse.decode.bind(updateFederationResponse), + updateFederationMetadata.decode.bind(updateFederationMetadata)), + deleteFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFederationResponse.decode.bind(deleteFederationResponse), + deleteFederationMetadata.decode.bind(deleteFederationMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.metastore.v1.DataprocMetastoreFederation', 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.dataprocMetastoreFederationStub) { + return this.dataprocMetastoreFederationStub; + } + + // Put together the "service stub" for + // google.cloud.metastore.v1.DataprocMetastoreFederation. + this.dataprocMetastoreFederationStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1.DataprocMetastoreFederation') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.metastore.v1.DataprocMetastoreFederation, + 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 dataprocMetastoreFederationStubMethods = + ['listFederations', 'getFederation', 'createFederation', 'updateFederation', 'deleteFederation']; + for (const methodName of dataprocMetastoreFederationStubMethods) { + const callPromise = this.dataprocMetastoreFederationStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.dataprocMetastoreFederationStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'metastore.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 'metastore.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 -- + // ------------------- +/** + * Gets the details of a single federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore federation to + * retrieve, in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_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 protos.google.cloud.metastore.v1.Federation|Federation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore_federation.get_federation.js + * region_tag:metastore_v1_generated_DataprocMetastoreFederation_GetFederation_async + */ + getFederation( + request?: protos.google.cloud.metastore.v1.IGetFederationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1.IFederation, + protos.google.cloud.metastore.v1.IGetFederationRequest|undefined, {}|undefined + ]>; + getFederation( + request: protos.google.cloud.metastore.v1.IGetFederationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1.IFederation, + protos.google.cloud.metastore.v1.IGetFederationRequest|null|undefined, + {}|null|undefined>): void; + getFederation( + request: protos.google.cloud.metastore.v1.IGetFederationRequest, + callback: Callback< + protos.google.cloud.metastore.v1.IFederation, + protos.google.cloud.metastore.v1.IGetFederationRequest|null|undefined, + {}|null|undefined>): void; + getFederation( + request?: protos.google.cloud.metastore.v1.IGetFederationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1.IFederation, + protos.google.cloud.metastore.v1.IGetFederationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1.IFederation, + protos.google.cloud.metastore.v1.IGetFederationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1.IFederation, + protos.google.cloud.metastore.v1.IGetFederationRequest|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.getFederation(request, options, callback); + } + +/** + * Creates a metastore federation in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location in which to create a + * federation service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {string} request.federationId + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param {google.cloud.metastore.v1.Federation} request.federation + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore_federation.create_federation.js + * region_tag:metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_async + */ + createFederation( + request?: protos.google.cloud.metastore.v1.ICreateFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createFederation( + request: protos.google.cloud.metastore.v1.ICreateFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFederation( + request: protos.google.cloud.metastore.v1.ICreateFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFederation( + request?: protos.google.cloud.metastore.v1.ICreateFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore_federation.create_federation.js + * region_tag:metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_async + */ + async checkCreateFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the fields of a federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1.Federation} request.federation + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore_federation.update_federation.js + * region_tag:metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_async + */ + updateFederation( + request?: protos.google.cloud.metastore.v1.IUpdateFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateFederation( + request: protos.google.cloud.metastore.v1.IUpdateFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFederation( + request: protos.google.cloud.metastore.v1.IUpdateFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFederation( + request?: protos.google.cloud.metastore.v1.IUpdateFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'federation.name': request.federation!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore_federation.update_federation.js + * region_tag:metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_async + */ + async checkUpdateFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore federation to delete, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore_federation.delete_federation.js + * region_tag:metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_async + */ + deleteFederation( + request?: protos.google.cloud.metastore.v1.IDeleteFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteFederation( + request: protos.google.cloud.metastore.v1.IDeleteFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFederation( + request: protos.google.cloud.metastore.v1.IDeleteFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFederation( + request?: protos.google.cloud.metastore.v1.IDeleteFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore_federation.delete_federation.js + * region_tag:metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_async + */ + async checkDeleteFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists federations in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1.Federation|Federation}. + * 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 `listFederationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFederations( + request?: protos.google.cloud.metastore.v1.IListFederationsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1.IFederation[], + protos.google.cloud.metastore.v1.IListFederationsRequest|null, + protos.google.cloud.metastore.v1.IListFederationsResponse + ]>; + listFederations( + request: protos.google.cloud.metastore.v1.IListFederationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1.IListFederationsRequest, + protos.google.cloud.metastore.v1.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1.IFederation>): void; + listFederations( + request: protos.google.cloud.metastore.v1.IListFederationsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1.IListFederationsRequest, + protos.google.cloud.metastore.v1.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1.IFederation>): void; + listFederations( + request?: protos.google.cloud.metastore.v1.IListFederationsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1.IListFederationsRequest, + protos.google.cloud.metastore.v1.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1.IFederation>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1.IListFederationsRequest, + protos.google.cloud.metastore.v1.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1.IFederation>): + Promise<[ + protos.google.cloud.metastore.v1.IFederation[], + protos.google.cloud.metastore.v1.IListFederationsRequest|null, + protos.google.cloud.metastore.v1.IListFederationsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listFederations(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 protos.google.cloud.metastore.v1.Federation|Federation} 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 `listFederationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFederationsStream( + request?: protos.google.cloud.metastore.v1.IListFederationsRequest, + 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['listFederations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFederations.createStream( + this.innerApiCalls.listFederations as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFederations`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.metastore.v1.Federation|Federation}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore_federation.list_federations.js + * region_tag:metastore_v1_generated_DataprocMetastoreFederation_ListFederations_async + */ + listFederationsAsync( + request?: protos.google.cloud.metastore.v1.IListFederationsRequest, + 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['listFederations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFederations.asyncIterate( + this.innerApiCalls['listFederations'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,location:string,service:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + service: service, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the service from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the service. + */ + matchServiceFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).service; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified federation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} federation + * @returns {string} Resource name string. + */ + federationPath(project:string,location:string,federation:string) { + return this.pathTemplates.federationPathTemplate.render({ + project: project, + location: location, + federation: federation, + }); + } + + /** + * Parse the project from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).project; + } + + /** + * Parse the location from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).location; + } + + /** + * Parse the federation from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the federation. + */ + matchFederationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).federation; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified metadataImport resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} metadata_import + * @returns {string} Resource name string. + */ + metadataImportPath(project:string,location:string,service:string,metadataImport:string) { + return this.pathTemplates.metadataImportPathTemplate.render({ + project: project, + location: location, + service: service, + metadata_import: metadataImport, + }); + } + + /** + * Parse the project from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; + } + + /** + * Parse the location from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; + } + + /** + * Parse the service from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the service. + */ + matchServiceFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; + } + + /** + * Parse the metadata_import from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the metadata_import. + */ + matchMetadataImportFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; + } + + /** + * 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 service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * 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.dataprocMetastoreFederationStub && !this._terminated) { + return this.dataprocMetastoreFederationStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client_config.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client_config.json new file mode 100644 index 00000000000..71c66a13e4c --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.metastore.v1.DataprocMetastoreFederation": { + "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": { + "ListFederations": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_proto_list.json new file mode 100644 index 00000000000..76860a15e6b --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/metastore/v1/metastore.proto", + "../../protos/google/cloud/metastore/v1/metastore_federation.proto" +] diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_proto_list.json new file mode 100644 index 00000000000..76860a15e6b --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/metastore/v1/metastore.proto", + "../../protos/google/cloud/metastore/v1/metastore_federation.proto" +] diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..78edaccc411 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/src/v1/gapic_metadata.json @@ -0,0 +1,283 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.metastore.v1", + "libraryPackage": "@google-cloud/dataproc-metastore", + "services": { + "DataprocMetastore": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreClient", + "rpcs": { + "GetService": { + "methods": [ + "getService" + ] + }, + "GetMetadataImport": { + "methods": [ + "getMetadataImport" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "CreateService": { + "methods": [ + "createService" + ] + }, + "UpdateService": { + "methods": [ + "updateService" + ] + }, + "DeleteService": { + "methods": [ + "deleteService" + ] + }, + "CreateMetadataImport": { + "methods": [ + "createMetadataImport" + ] + }, + "UpdateMetadataImport": { + "methods": [ + "updateMetadataImport" + ] + }, + "ExportMetadata": { + "methods": [ + "exportMetadata" + ] + }, + "RestoreService": { + "methods": [ + "restoreService" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "QueryMetadata": { + "methods": [ + "queryMetadata" + ] + }, + "MoveTableToDatabase": { + "methods": [ + "moveTableToDatabase" + ] + }, + "AlterMetadataResourceLocation": { + "methods": [ + "alterMetadataResourceLocation" + ] + }, + "ListServices": { + "methods": [ + "listServices", + "listServicesStream", + "listServicesAsync" + ] + }, + "ListMetadataImports": { + "methods": [ + "listMetadataImports", + "listMetadataImportsStream", + "listMetadataImportsAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DataprocMetastoreClient", + "rpcs": { + "GetService": { + "methods": [ + "getService" + ] + }, + "GetMetadataImport": { + "methods": [ + "getMetadataImport" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "CreateService": { + "methods": [ + "createService" + ] + }, + "UpdateService": { + "methods": [ + "updateService" + ] + }, + "DeleteService": { + "methods": [ + "deleteService" + ] + }, + "CreateMetadataImport": { + "methods": [ + "createMetadataImport" + ] + }, + "UpdateMetadataImport": { + "methods": [ + "updateMetadataImport" + ] + }, + "ExportMetadata": { + "methods": [ + "exportMetadata" + ] + }, + "RestoreService": { + "methods": [ + "restoreService" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "QueryMetadata": { + "methods": [ + "queryMetadata" + ] + }, + "MoveTableToDatabase": { + "methods": [ + "moveTableToDatabase" + ] + }, + "AlterMetadataResourceLocation": { + "methods": [ + "alterMetadataResourceLocation" + ] + }, + "ListServices": { + "methods": [ + "listServices", + "listServicesStream", + "listServicesAsync" + ] + }, + "ListMetadataImports": { + "methods": [ + "listMetadataImports", + "listMetadataImportsStream", + "listMetadataImportsAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + } + } + }, + "DataprocMetastoreFederation": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreFederationClient", + "rpcs": { + "GetFederation": { + "methods": [ + "getFederation" + ] + }, + "CreateFederation": { + "methods": [ + "createFederation" + ] + }, + "UpdateFederation": { + "methods": [ + "updateFederation" + ] + }, + "DeleteFederation": { + "methods": [ + "deleteFederation" + ] + }, + "ListFederations": { + "methods": [ + "listFederations", + "listFederationsStream", + "listFederationsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DataprocMetastoreFederationClient", + "rpcs": { + "GetFederation": { + "methods": [ + "getFederation" + ] + }, + "CreateFederation": { + "methods": [ + "createFederation" + ] + }, + "UpdateFederation": { + "methods": [ + "updateFederation" + ] + }, + "DeleteFederation": { + "methods": [ + "deleteFederation" + ] + }, + "ListFederations": { + "methods": [ + "listFederations", + "listFederationsStream", + "listFederationsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-metastore/v1/src/v1/index.ts new file mode 100644 index 00000000000..74baf047ec9 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/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 {DataprocMetastoreClient} from './dataproc_metastore_client'; +export {DataprocMetastoreFederationClient} from './dataproc_metastore_federation_client'; diff --git a/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..2d137ce8c89 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/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 metastore = require('@google-cloud/dataproc-metastore'); + +function main() { + const dataprocMetastoreClient = new metastore.DataprocMetastoreClient(); + const dataprocMetastoreFederationClient = new metastore.DataprocMetastoreFederationClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..15fe58ac669 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/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 {DataprocMetastoreClient, DataprocMetastoreFederationClient} from '@google-cloud/dataproc-metastore'; + +// check that the client class type name can be used +function doStuffWithDataprocMetastoreClient(client: DataprocMetastoreClient) { + client.close(); +} +function doStuffWithDataprocMetastoreFederationClient(client: DataprocMetastoreFederationClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const dataprocMetastoreClient = new DataprocMetastoreClient(); + doStuffWithDataprocMetastoreClient(dataprocMetastoreClient); + // check that the client instance can be created + const dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + doStuffWithDataprocMetastoreFederationClient(dataprocMetastoreFederationClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1/system-test/install.ts b/owl-bot-staging/google-cloud-metastore/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/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-metastore/v1/test/gapic_dataproc_metastore_federation_v1.ts b/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_federation_v1.ts new file mode 100644 index 00000000000..69f92c3064e --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_federation_v1.ts @@ -0,0 +1,2000 @@ +// 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 dataprocmetastorefederationModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.DataprocMetastoreFederationClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); + await client.initialize(); + assert(client.dataprocMetastoreFederationStub); + }); + + it('has close method for the initialized client', done => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.dataprocMetastoreFederationStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + 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 dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + 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('getFederation', () => { + it('invokes getFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1.Federation() + ); + client.innerApiCalls.getFederation = stubSimpleCall(expectedResponse); + const [response] = await client.getFederation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1.Federation() + ); + client.innerApiCalls.getFederation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFederation( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1.IFederation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFederation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation with closed client', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFederation(request), expectedError); + }); + }); + + describe('createFederation', () => { + it('invokes createFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.createFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateFederation', () => { + it('invokes updateFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteFederation', () => { + it('invokes deleteFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listFederations', () => { + it('invokes listFederations without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + ]; + client.innerApiCalls.listFederations = stubSimpleCall(expectedResponse); + const [response] = await client.listFederations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederations without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + ]; + client.innerApiCalls.listFederations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFederations( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1.IFederation[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederations with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFederations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFederations(request), expectedError); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederationsStream without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + ]; + client.descriptors.page.listFederations.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFederationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1.Federation[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1.Federation) => { + 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.listFederations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); + assert( + (client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFederationsStream with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFederations.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFederationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1.Federation[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1.Federation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); + assert( + (client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFederations without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + ]; + client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1.IFederation[] = []; + const iterable = client.listFederationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFederations with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFederationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1.IFederation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + backup: "backupValue", + }; + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromBackupName', () => { + const result = client.matchServiceFromBackupName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('federation', () => { + const fakePath = "/rendered/path/federation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + federation: "federationValue", + }; + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.federationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.federationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('federationPath', () => { + const result = client.federationPath("projectValue", "locationValue", "federationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.federationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFederationName', () => { + const result = client.matchProjectFromFederationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFederationName', () => { + const result = client.matchLocationFromFederationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFederationFromFederationName', () => { + const result = client.matchFederationFromFederationName(fakePath); + assert.strictEqual(result, "federationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('metadataImport', () => { + const fakePath = "/rendered/path/metadataImport"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + metadata_import: "metadataImportValue", + }; + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.metadataImportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.metadataImportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('metadataImportPath', () => { + const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromMetadataImportName', () => { + const result = client.matchProjectFromMetadataImportName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromMetadataImportName', () => { + const result = client.matchLocationFromMetadataImportName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromMetadataImportName', () => { + const result = client.matchServiceFromMetadataImportName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetadataImportFromMetadataImportName', () => { + const result = client.matchMetadataImportFromMetadataImportName(fakePath); + assert.strictEqual(result, "metadataImportValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + 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('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + }; + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath("projectValue", "locationValue", "serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_v1.ts b/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_v1.ts new file mode 100644 index 00000000000..bd1f6637432 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_v1.ts @@ -0,0 +1,4134 @@ +// 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 dataprocmetastoreModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.DataprocMetastoreClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = dataprocmetastoreModule.v1.DataprocMetastoreClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = dataprocmetastoreModule.v1.DataprocMetastoreClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = dataprocmetastoreModule.v1.DataprocMetastoreClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreStub, undefined); + await client.initialize(); + assert(client.dataprocMetastoreStub); + }); + + it('has close method for the initialized client', done => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.dataprocMetastoreStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + 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 dataprocmetastoreModule.v1.DataprocMetastoreClient({ + 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('getService', () => { + it('invokes getService without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1.Service() + ); + client.innerApiCalls.getService = stubSimpleCall(expectedResponse); + const [response] = await client.getService(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1.Service() + ); + client.innerApiCalls.getService = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getService( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1.IService|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getService = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getService(request), expectedError); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService with closed client', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getService(request), expectedError); + }); + }); + + describe('getMetadataImport', () => { + it('invokes getMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1.MetadataImport() + ); + client.innerApiCalls.getMetadataImport = stubSimpleCall(expectedResponse); + const [response] = await client.getMetadataImport(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1.MetadataImport() + ); + client.innerApiCalls.getMetadataImport = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMetadataImport( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1.IMetadataImport|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMetadataImport = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport with closed client', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getMetadataImport(request), expectedError); + }); + }); + + describe('getBackup', () => { + it('invokes getBackup without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1.Backup() + ); + client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); + const [response] = await client.getBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1.Backup() + ); + client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackup( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1.IBackup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with closed client', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBackup(request), expectedError); + }); + }); + + describe('createService', () => { + it('invokes createService without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createService = stubLongRunningCall(expectedResponse); + const [operation] = await client.createService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createService(request), expectedError); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateService', () => { + it('invokes updateService without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateService = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateService(request), expectedError); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteService', () => { + it('invokes deleteService without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteService = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteService(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createMetadataImport', () => { + it('invokes createMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(expectedResponse); + const [operation] = await client.createMetadataImport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMetadataImport = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMetadataImport( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createMetadataImport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateMetadataImportProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateMetadataImportProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateMetadataImportProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateMetadataImportProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateMetadataImport', () => { + it('invokes updateMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateMetadataImport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMetadataImport = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMetadataImport( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateMetadataImport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateMetadataImportProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateMetadataImportProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateMetadataImportProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateMetadataImportProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('exportMetadata', () => { + it('invokes exportMetadata without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportMetadata = stubLongRunningCall(expectedResponse); + const [operation] = await client.exportMetadata(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportMetadata = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportMetadata( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.exportMetadata(request), expectedError); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.exportMetadata(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkExportMetadataProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkExportMetadataProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportMetadataProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkExportMetadataProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('restoreService', () => { + it('invokes restoreService without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreService = stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.restoreService(request), expectedError); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.restoreService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRestoreServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRestoreServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRestoreServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createBackup', () => { + it('invokes createBackup without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBackup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateBackupProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateBackupProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteBackup', () => { + it('invokes deleteBackup without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteBackup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteBackupProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteBackupProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('queryMetadata', () => { + it('invokes queryMetadata without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.QueryMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.QueryMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.queryMetadata = stubLongRunningCall(expectedResponse); + const [operation] = await client.queryMetadata(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes queryMetadata without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.QueryMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.QueryMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.queryMetadata = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.queryMetadata( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes queryMetadata with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.QueryMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.QueryMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.queryMetadata = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.queryMetadata(request), expectedError); + const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes queryMetadata with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.QueryMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.QueryMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.queryMetadata = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.queryMetadata(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkQueryMetadataProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkQueryMetadataProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkQueryMetadataProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkQueryMetadataProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('moveTableToDatabase', () => { + it('invokes moveTableToDatabase without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.MoveTableToDatabaseRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.MoveTableToDatabaseRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(expectedResponse); + const [operation] = await client.moveTableToDatabase(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveTableToDatabase without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.MoveTableToDatabaseRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.MoveTableToDatabaseRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.moveTableToDatabase = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.moveTableToDatabase( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveTableToDatabase with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.MoveTableToDatabaseRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.MoveTableToDatabaseRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.moveTableToDatabase(request), expectedError); + const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveTableToDatabase with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.MoveTableToDatabaseRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.MoveTableToDatabaseRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.moveTableToDatabase(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkMoveTableToDatabaseProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkMoveTableToDatabaseProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkMoveTableToDatabaseProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkMoveTableToDatabaseProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('alterMetadataResourceLocation', () => { + it('invokes alterMetadataResourceLocation without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.AlterMetadataResourceLocationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.AlterMetadataResourceLocationRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(expectedResponse); + const [operation] = await client.alterMetadataResourceLocation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes alterMetadataResourceLocation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.AlterMetadataResourceLocationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.AlterMetadataResourceLocationRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.alterMetadataResourceLocation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes alterMetadataResourceLocation with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.AlterMetadataResourceLocationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.AlterMetadataResourceLocationRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.alterMetadataResourceLocation(request), expectedError); + const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes alterMetadataResourceLocation with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.AlterMetadataResourceLocationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.AlterMetadataResourceLocationRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.alterMetadataResourceLocation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkAlterMetadataResourceLocationProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkAlterMetadataResourceLocationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkAlterMetadataResourceLocationProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkAlterMetadataResourceLocationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listServices', () => { + it('invokes listServices without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); + const [response] = await client.listServices(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServices without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServices( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1.IService[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServices with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServices = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listServices(request), expectedError); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServicesStream without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + ]; + client.descriptors.page.listServices.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1.Service[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listServices, request)); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listServicesStream with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServices.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1.Service[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listServices, request)); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listServices without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + ]; + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1.IService[] = []; + const iterable = client.listServicesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listServices with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServicesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1.IService[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listMetadataImports', () => { + it('invokes listMetadataImports without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + ]; + client.innerApiCalls.listMetadataImports = stubSimpleCall(expectedResponse); + const [response] = await client.listMetadataImports(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImports without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + ]; + client.innerApiCalls.listMetadataImports = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMetadataImports( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1.IMetadataImport[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImports with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMetadataImports = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMetadataImports(request), expectedError); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImportsStream without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + ]; + client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMetadataImportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1.MetadataImport[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1.MetadataImport) => { + 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.listMetadataImports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); + assert( + (client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listMetadataImportsStream with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMetadataImportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1.MetadataImport[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1.MetadataImport) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); + assert( + (client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMetadataImports without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + ]; + client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1.IMetadataImport[] = []; + const iterable = client.listMetadataImportsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMetadataImports with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMetadataImportsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1.IMetadataImport[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listBackups', () => { + it('invokes listBackups without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listBackups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackups( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1.IBackup[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBackups(request), expectedError); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackupsStream without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + ]; + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1.Backup[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1.Backup) => { + 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.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listBackupsStream with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1.Backup[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBackups without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + ]; + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1.IBackup[] = []; + const iterable = client.listBackupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBackups with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBackupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1.IBackup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + backup: "backupValue", + }; + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromBackupName', () => { + const result = client.matchServiceFromBackupName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('federation', () => { + const fakePath = "/rendered/path/federation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + federation: "federationValue", + }; + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.federationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.federationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('federationPath', () => { + const result = client.federationPath("projectValue", "locationValue", "federationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.federationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFederationName', () => { + const result = client.matchProjectFromFederationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFederationName', () => { + const result = client.matchLocationFromFederationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFederationFromFederationName', () => { + const result = client.matchFederationFromFederationName(fakePath); + assert.strictEqual(result, "federationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('metadataImport', () => { + const fakePath = "/rendered/path/metadataImport"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + metadata_import: "metadataImportValue", + }; + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.metadataImportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.metadataImportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('metadataImportPath', () => { + const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromMetadataImportName', () => { + const result = client.matchProjectFromMetadataImportName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromMetadataImportName', () => { + const result = client.matchLocationFromMetadataImportName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromMetadataImportName', () => { + const result = client.matchServiceFromMetadataImportName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetadataImportFromMetadataImportName', () => { + const result = client.matchMetadataImportFromMetadataImportName(fakePath); + assert.strictEqual(result, "metadataImportValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('network', () => { + const fakePath = "/rendered/path/network"; + const expectedParameters = { + project: "projectValue", + network: "networkValue", + }; + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.networkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.networkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath("projectValue", "networkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNetworkFromNetworkName', () => { + const result = client.matchNetworkFromNetworkName(fakePath); + assert.strictEqual(result, "networkValue"); + assert((client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + 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('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + }; + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath("projectValue", "locationValue", "serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-metastore/v1/tsconfig.json b/owl-bot-staging/google-cloud-metastore/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/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-metastore/v1/webpack.config.js b/owl-bot-staging/google-cloud-metastore/v1/webpack.config.js new file mode 100644 index 00000000000..6fc45cb3d30 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/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: 'DataprocMetastore', + filename: './dataproc-metastore.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-metastore/v1alpha/.eslintignore b/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintrc.json b/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/.gitignore b/owl-bot-staging/google-cloud-metastore/v1alpha/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/.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-metastore/v1alpha/.jsdoc.js b/owl-bot-staging/google-cloud-metastore/v1alpha/.jsdoc.js new file mode 100644 index 00000000000..77430ad8c15 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/.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/dataproc-metastore', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/.mocharc.js b/owl-bot-staging/google-cloud-metastore/v1alpha/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/.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-metastore/v1alpha/.prettierrc.js b/owl-bot-staging/google-cloud-metastore/v1alpha/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/.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-metastore/v1alpha/README.md b/owl-bot-staging/google-cloud-metastore/v1alpha/README.md new file mode 100644 index 00000000000..24afb9017c6 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/README.md @@ -0,0 +1 @@ +Metastore: Nodejs Client diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/package.json b/owl-bot-staging/google-cloud-metastore/v1alpha/package.json new file mode 100644 index 00000000000..e14926927ea --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/package.json @@ -0,0 +1,59 @@ +{ + "name": "@google-cloud/dataproc-metastore", + "version": "0.1.0", + "description": "Metastore client for Node.js", + "repository": "googleapis/nodejs-metastore", + "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 metastore", + "metastore", + "dataproc metastore", + "dataproc metastore federation" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore.proto b/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore.proto new file mode 100644 index 00000000000..e23b043c703 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore.proto @@ -0,0 +1,1681 @@ +// 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 +// +// 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.metastore.v1alpha; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/type/dayofweek.proto"; + +option go_package = "cloud.google.com/go/metastore/apiv1alpha/metastorepb;metastorepb"; +option java_multiple_files = true; +option java_outer_classname = "MetastoreProto"; +option java_package = "com.google.cloud.metastore.v1alpha"; +option php_namespace = "Google\\Cloud\\Metastore\\V1alpha"; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Network" + pattern: "projects/{project}/global/networks/{network}" +}; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Subnetwork" + pattern: "projects/{project}/regions/{region}/subnetworks/{subnetwork}" +}; +option (google.api.resource_definition) = { + type: "dataplex.googleapis.com/Lake" + pattern: "projects/{project}/locations/{location}/lakes/{lake}" +}; + +// Configures and manages metastore services. +// Metastore services are fully managed, highly available, autoscaled, +// autohealing, OSS-native deployments of technical metadata management +// software. Each metastore service exposes a network endpoint through which +// metadata queries are served. Metadata queries can originate from a variety +// of sources, including Apache Hive, Apache Presto, and Apache Spark. +// +// The Dataproc Metastore API defines the following resource model: +// +// * The service works with a collection of Google Cloud projects, named: +// `/projects/*` +// * Each project has a collection of available locations, named: `/locations/*` +// (a location must refer to a Google Cloud `region`) +// * Each location has a collection of services, named: `/services/*` +// * Dataproc Metastore services are resources with names of the form: +// +// `/projects/{project_number}/locations/{location_id}/services/{service_id}`. +service DataprocMetastore { + option (google.api.default_host) = "metastore.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists services in a project and location. + rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/locations/*}/services" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a single service. + rpc GetService(GetServiceRequest) returns (Service) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/locations/*/services/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a metastore service in a project and location. + rpc CreateService(CreateServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha/{parent=projects/*/locations/*}/services" + body: "service" + }; + option (google.api.method_signature) = "parent,service,service_id"; + option (google.longrunning.operation_info) = { + response_type: "Service" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Updates the parameters of a single service. + rpc UpdateService(UpdateServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1alpha/{service.name=projects/*/locations/*/services/*}" + body: "service" + }; + option (google.api.method_signature) = "service,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Service" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Deletes a single service. + rpc DeleteService(DeleteServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1alpha/{name=projects/*/locations/*/services/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Lists imports in a service. + rpc ListMetadataImports(ListMetadataImportsRequest) + returns (ListMetadataImportsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/locations/*/services/*}/metadataImports" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single import. + rpc GetMetadataImport(GetMetadataImportRequest) returns (MetadataImport) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/locations/*/services/*/metadataImports/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new MetadataImport in a given project and location. + rpc CreateMetadataImport(CreateMetadataImportRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha/{parent=projects/*/locations/*/services/*}/metadataImports" + body: "metadata_import" + }; + option (google.api.method_signature) = + "parent,metadata_import,metadata_import_id"; + option (google.longrunning.operation_info) = { + response_type: "MetadataImport" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Updates a single import. + // Only the description field of MetadataImport is supported to be updated. + rpc UpdateMetadataImport(UpdateMetadataImportRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1alpha/{metadata_import.name=projects/*/locations/*/services/*/metadataImports/*}" + body: "metadata_import" + }; + option (google.api.method_signature) = "metadata_import,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "MetadataImport" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Exports metadata from a service. + rpc ExportMetadata(ExportMetadataRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha/{service=projects/*/locations/*/services/*}:exportMetadata" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "MetadataExport" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Restores a service from a backup. + rpc RestoreService(RestoreServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha/{service=projects/*/locations/*/services/*}:restore" + body: "*" + }; + option (google.api.method_signature) = "service,backup"; + option (google.longrunning.operation_info) = { + response_type: "Restore" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Lists backups in a service. + rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/locations/*/services/*}/backups" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single backup. + rpc GetBackup(GetBackupRequest) returns (Backup) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/locations/*/services/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new backup in a given project and location. + rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha/{parent=projects/*/locations/*/services/*}/backups" + body: "backup" + }; + option (google.api.method_signature) = "parent,backup,backup_id"; + option (google.longrunning.operation_info) = { + response_type: "Backup" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Deletes a single backup. + rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1alpha/{name=projects/*/locations/*/services/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Removes the attached IAM policies for a resource + rpc RemoveIamPolicy(RemoveIamPolicyRequest) + returns (RemoveIamPolicyResponse) { + option (google.api.http) = { + post: "/v1alpha/{resource=projects/*/locations/*/services/*/**}:removeIamPolicy" + body: "*" + }; + } + + // Query DPMS metadata. + rpc QueryMetadata(QueryMetadataRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha/{service=projects/*/locations/*/services/*}:queryMetadata" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "QueryMetadataResponse" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Move a table to another database. + rpc MoveTableToDatabase(MoveTableToDatabaseRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha/{service=projects/*/locations/*/services/*}:moveTableToDatabase" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "MoveTableToDatabaseResponse" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Alter metadata resource location. The metadata resource can be a database, + // table, or partition. This functionality only updates the parent directory + // for the respective metadata resource and does not transfer any existing + // data to the new location. + rpc AlterMetadataResourceLocation(AlterMetadataResourceLocationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha/{service=projects/*/locations/*/services/*}:alterLocation" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "AlterMetadataResourceLocationResponse" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } +} + +// A managed metastore service that serves metadata queries. +message Service { + option (google.api.resource) = { + type: "metastore.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/services/{service}" + }; + + // The current state of the metastore service. + enum State { + // The state of the metastore service is unknown. + STATE_UNSPECIFIED = 0; + + // The metastore service is in the process of being created. + CREATING = 1; + + // The metastore service is running and ready to serve queries. + ACTIVE = 2; + + // The metastore service is entering suspension. Its query-serving + // availability may cease unexpectedly. + SUSPENDING = 3; + + // The metastore service is suspended and unable to serve queries. + SUSPENDED = 4; + + // The metastore service is being updated. It remains usable but cannot + // accept additional update requests or be deleted at this time. + UPDATING = 5; + + // The metastore service is undergoing deletion. It cannot be used. + DELETING = 6; + + // The metastore service has encountered an error and cannot be used. The + // metastore service should be deleted. + ERROR = 7; + } + + // Available service tiers. + enum Tier { + // The tier is not set. + TIER_UNSPECIFIED = 0; + + // The developer tier provides limited scalability and no fault tolerance. + // Good for low-cost proof-of-concept. + DEVELOPER = 1; + + // The enterprise tier provides multi-zone high availability, and sufficient + // scalability for enterprise-level Dataproc Metastore workloads. + ENTERPRISE = 3; + } + + // Release channels bundle features of varying levels of stability. Newer + // features may be introduced initially into less stable release channels and + // can be automatically promoted into more stable release channels. + enum ReleaseChannel { + // Release channel is not specified. + RELEASE_CHANNEL_UNSPECIFIED = 0; + + // The `CANARY` release channel contains the newest features, which may be + // unstable and subject to unresolved issues with no known workarounds. + // Services using the `CANARY` release channel are not subject to any SLAs. + CANARY = 1; + + // The `STABLE` release channel contains features that are considered stable + // and have been validated for production use. + STABLE = 2; + } + + // The backend database type for the metastore service. + enum DatabaseType { + // The DATABASE_TYPE is not set. + DATABASE_TYPE_UNSPECIFIED = 0; + + // MySQL is used to persist the metastore data. + MYSQL = 1; + + // Spanner is used to persist the metastore data. + SPANNER = 2; + } + + // Configuration properties specific to the underlying metastore service + // technology (the software that serves metastore queries). + oneof metastore_config { + // Configuration information specific to running Hive metastore + // software as the metastore service. + HiveMetastoreConfig hive_metastore_config = 5; + } + + // Immutable. The relative resource name of the metastore service, in the + // following format: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the metastore service was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metastore service was last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-defined labels for the metastore service. + map labels = 4; + + // Immutable. The relative resource name of the VPC network on which the + // instance can be accessed. It is specified in the following form: + // + // `projects/{project_number}/global/networks/{network_id}`. + string network = 7 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } + ]; + + // Output only. The URI of the endpoint used to access the metastore service. + string endpoint_uri = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The TCP port at which the metastore service is reached. Default: 9083. + int32 port = 9; + + // Output only. The current state of the metastore service. + State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current state of the + // metastore service, if available. + string state_message = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A Cloud Storage URI (starting with `gs://`) that specifies + // where artifacts related to the metastore service are stored. + string artifact_gcs_uri = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The tier of the service. + Tier tier = 13; + + // The setting that defines how metastore metadata should be integrated with + // external services and systems. + MetadataIntegration metadata_integration = 14; + + // The one hour maintenance window of the metastore service. This specifies + // when the service can be restarted for maintenance purposes in UTC time. + // Maintenance window is not needed for services with the SPANNER + // database type. + MaintenanceWindow maintenance_window = 15; + + // Output only. The globally unique resource identifier of the metastore + // service. + string uid = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The metadata management activities of the metastore service. + MetadataManagementActivity metadata_management_activity = 17 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. The release channel of the service. + // If unspecified, defaults to `STABLE`. + ReleaseChannel release_channel = 19 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. Information used to configure the Dataproc Metastore service to + // encrypt customer data at rest. Cannot be updated. + EncryptionConfig encryption_config = 20 + [(google.api.field_behavior) = IMMUTABLE]; + + // The configuration specifying the network settings for the + // Dataproc Metastore service. + NetworkConfig network_config = 21; + + // Immutable. The database type that the Metastore service stores its data. + DatabaseType database_type = 22 [(google.api.field_behavior) = IMMUTABLE]; + + // The configuration specifying telemetry settings for the Dataproc Metastore + // service. If unspecified defaults to `JSON`. + TelemetryConfig telemetry_config = 23; + + // Scaling configuration of the metastore service. + ScalingConfig scaling_config = 24; +} + +// Specifies how metastore metadata should be integrated with external services. +message MetadataIntegration { + // The integration config for the Data Catalog service. + DataCatalogConfig data_catalog_config = 1; + + // The integration config for the Dataplex service. + DataplexConfig dataplex_config = 2; +} + +// Specifies how metastore metadata should be integrated with the Data Catalog +// service. +message DataCatalogConfig { + // Defines whether the metastore metadata should be synced to Data Catalog. + // The default value is to disable syncing metastore metadata to Data Catalog. + bool enabled = 2; +} + +// Specifies how metastore metadata should be integrated with the Dataplex +// service. +message DataplexConfig { + // A reference to the Lake resources that this metastore service is attached + // to. The key is the lake resource name. Example: + // `projects/{project_number}/locations/{location_id}/lakes/{lake_id}`. + map lake_resources = 1; +} + +// Represents a Lake resource +message Lake { + // The Lake resource name. + // Example: + // `projects/{project_number}/locations/{location_id}/lakes/{lake_id}` + string name = 1 [ + (google.api.resource_reference) = { type: "dataplex.googleapis.com/Lake" } + ]; +} + +// Maintenance window. This specifies when Dataproc Metastore +// may perform system maintenance operation to the service. +message MaintenanceWindow { + // The hour of day (0-23) when the window starts. + google.protobuf.Int32Value hour_of_day = 1; + + // The day of week, when the window starts. + google.type.DayOfWeek day_of_week = 2; +} + +// Specifies configuration information specific to running Hive metastore +// software as the metastore service. +message HiveMetastoreConfig { + // Protocols available for serving the metastore service endpoint. + enum EndpointProtocol { + // The protocol is not set. + ENDPOINT_PROTOCOL_UNSPECIFIED = 0; + + // Use the legacy Apache Thrift protocol for the metastore service endpoint. + THRIFT = 1; + + // Use the modernized gRPC protocol for the metastore service endpoint. + GRPC = 2; + } + + // Immutable. The Hive metastore schema version. + string version = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // A mapping of Hive metastore configuration key-value pairs to apply to the + // Hive metastore (configured in `hive-site.xml`). The mappings + // override system defaults (some keys cannot be overridden). These + // overrides are also applied to auxiliary versions and can be further + // customized in the auxiliary version's `AuxiliaryVersionConfig`. + map config_overrides = 2; + + // Information used to configure the Hive metastore service as a service + // principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + // method and specify this field's path + // (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + // while omitting this field from the request's `service`. + KerberosConfig kerberos_config = 3; + + // The protocol to use for the metastore service endpoint. If unspecified, + // defaults to `THRIFT`. + EndpointProtocol endpoint_protocol = 4; + + // A mapping of Hive metastore version to the auxiliary version + // configuration. When specified, a secondary Hive metastore service is + // created along with the primary service. All auxiliary versions must be less + // than the service's primary version. The key is the auxiliary service name + // and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This + // means that the first character must be a lowercase letter, and all the + // following characters must be hyphens, lowercase letters, or digits, except + // the last character, which cannot be a hyphen. + map auxiliary_versions = 5; +} + +// Configuration information for a Kerberos principal. +message KerberosConfig { + // A Kerberos keytab file that can be used to authenticate a service principal + // with a Kerberos Key Distribution Center (KDC). + Secret keytab = 1; + + // A Kerberos principal that exists in the both the keytab the KDC + // to authenticate as. A typical principal is of the form + // `primary/instance@REALM`, but there is no exact format. + string principal = 2; + + // A Cloud Storage URI that specifies the path to a + // krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + // although the file does not need to be named krb5.conf explicitly. + string krb5_config_gcs_uri = 3; +} + +// A securely stored value. +message Secret { + oneof value { + // The relative resource name of a Secret Manager secret version, in the + // following form: + // + // `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. + string cloud_secret = 2; + } +} + +// Encryption settings for the service. +message EncryptionConfig { + // The fully qualified customer provided Cloud KMS key name to use for + // customer data encryption, in the following form: + // + // `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + string kms_key = 1; +} + +// Configuration information for the auxiliary service versions. +message AuxiliaryVersionConfig { + // The Hive metastore version of the auxiliary service. It must be less + // than the primary Hive metastore service's version. + string version = 1; + + // A mapping of Hive metastore configuration key-value pairs to apply to the + // auxiliary Hive metastore (configured in `hive-site.xml`) in addition to + // the primary version's overrides. If keys are present in both the auxiliary + // version's overrides and the primary version's overrides, the value from + // the auxiliary version's overrides takes precedence. + map config_overrides = 2; + + // Output only. The network configuration contains the endpoint URI(s) of the + // auxiliary Hive metastore service. + NetworkConfig network_config = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Network configuration for the Dataproc Metastore service. +message NetworkConfig { + // Contains information of the customer's network configurations. + message Consumer { + oneof vpc_resource { + // Immutable. The subnetwork of the customer project from which an IP + // address is reserved and used as the Dataproc Metastore service's + // endpoint. It is accessible to hosts in the subnet and to all + // hosts in a subnet in the same region and same network. There must + // be at least one IP address available in the subnet's primary range. The + // subnet is specified in the following form: + // + // `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` + string subnetwork = 1 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { + type: "compute.googleapis.com/Subnetwork" + } + ]; + } + + // Output only. The URI of the endpoint used to access the metastore + // service. + string endpoint_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Immutable. The consumer-side network configuration for the Dataproc + // Metastore instance. + repeated Consumer consumers = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Enables custom routes to be imported and exported for the Dataproc + // Metastore service's peered VPC network. + bool custom_routes_enabled = 2; +} + +// Telemetry Configuration for the Dataproc Metastore service. +message TelemetryConfig { + enum LogFormat { + // The LOG_FORMAT is not set. + LOG_FORMAT_UNSPECIFIED = 0; + + // Logging output uses the legacy `textPayload` format. + LEGACY = 1; + + // Logging output uses the `jsonPayload` format. + JSON = 2; + } + + // The output format of the Dataproc Metastore service's logs. + LogFormat log_format = 1; +} + +// The metadata management activities of the metastore service. +message MetadataManagementActivity { + // Output only. The latest metadata exports of the metastore service. + repeated MetadataExport metadata_exports = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The latest restores of the metastore service. + repeated Restore restores = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A metastore resource that imports metadata. +message MetadataImport { + option (google.api.resource) = { + type: "metastore.googleapis.com/MetadataImport" + pattern: "projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}" + }; + + // A specification of the location of and metadata about a database dump from + // a relational database management system. + message DatabaseDump { + // The type of the database. + enum DatabaseType { + // The type of the source database is unknown. + DATABASE_TYPE_UNSPECIFIED = 0; + + // The type of the source database is MySQL. + MYSQL = 1; + } + + // The type of the database. + DatabaseType database_type = 1 [deprecated = true]; + + // A Cloud Storage object or folder URI that specifies the source from which + // to import metadata. It must begin with `gs://`. + string gcs_uri = 2; + + // The name of the source database. + string source_database = 3 [deprecated = true]; + + // Optional. The type of the database dump. If unspecified, defaults to + // `MYSQL`. + DatabaseDumpSpec.Type type = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // The current state of the metadata import. + enum State { + // The state of the metadata import is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata import is running. + RUNNING = 1; + + // The metadata import completed successfully. + SUCCEEDED = 2; + + // The metadata import is being updated. + UPDATING = 3; + + // The metadata import failed, and attempted metadata changes were rolled + // back. + FAILED = 4; + } + + // The metadata to be imported. + oneof metadata { + // Immutable. A database dump from a pre-existing metastore's database. + DatabaseDump database_dump = 6 [(google.api.field_behavior) = IMMUTABLE]; + } + + // Immutable. The relative resource name of the metadata import, of the form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // The description of the metadata import. + string description = 2; + + // Output only. The time when the metadata import was started. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metadata import was last updated. + google.protobuf.Timestamp update_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metadata import finished. + google.protobuf.Timestamp end_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the metadata import. + State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a metadata export operation. +message MetadataExport { + // The current state of the metadata export. + enum State { + // The state of the metadata export is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata export is running. + RUNNING = 1; + + // The metadata export completed successfully. + SUCCEEDED = 2; + + // The metadata export failed. + FAILED = 3; + + // The metadata export is cancelled. + CANCELLED = 4; + } + + oneof destination { + // Output only. A Cloud Storage URI of a folder that metadata are exported + // to, in the form of + // `gs:////`, where + // `` is automatically generated. + string destination_gcs_uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Output only. The time when the export started. + google.protobuf.Timestamp start_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the export ended. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the export. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The type of the database dump. + DatabaseDumpSpec.Type database_dump_type = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a backup resource. +message Backup { + option (google.api.resource) = { + type: "metastore.googleapis.com/Backup" + pattern: "projects/{project}/locations/{location}/services/{service}/backups/{backup}" + }; + + // The current state of the backup. + enum State { + // The state of the backup is unknown. + STATE_UNSPECIFIED = 0; + + // The backup is being created. + CREATING = 1; + + // The backup is being deleted. + DELETING = 2; + + // The backup is active and ready to use. + ACTIVE = 3; + + // The backup failed. + FAILED = 4; + + // The backup is being restored. + RESTORING = 5; + } + + // Immutable. The relative resource name of the backup, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the backup was started. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the backup finished creating. + google.protobuf.Timestamp end_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the backup. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The revision of the service at the time of backup. + Service service_revision = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The description of the backup. + string description = 6; + + // Output only. Services that are restoring from the backup. + repeated string restoring_services = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a metadata restore operation. +message Restore { + // The current state of the restore. + enum State { + // The state of the metadata restore is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata restore is running. + RUNNING = 1; + + // The metadata restore completed successfully. + SUCCEEDED = 2; + + // The metadata restore failed. + FAILED = 3; + + // The metadata restore is cancelled. + CANCELLED = 4; + } + + // The type of restore. If unspecified, defaults to `METADATA_ONLY`. + enum RestoreType { + // The restore type is unknown. + RESTORE_TYPE_UNSPECIFIED = 0; + + // The service's metadata and configuration are restored. + FULL = 1; + + // Only the service's metadata is restored. + METADATA_ONLY = 2; + } + + // Output only. The time when the restore started. + google.protobuf.Timestamp start_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the restore ended. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the restore. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The relative resource name of the metastore service backup to + // restore from, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string backup = 4 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Output only. The type of restore. + RestoreType type = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The restore details containing the revision of the service to + // be restored to, in format of JSON. + string details = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents the scaling configuration of a metastore service. +message ScalingConfig { + // Metastore instance sizes. + enum InstanceSize { + // Unspecified instance size + INSTANCE_SIZE_UNSPECIFIED = 0; + + // Extra small instance size, maps to a scaling factor of 0.1. + EXTRA_SMALL = 1; + + // Small instance size, maps to a scaling factor of 0.5. + SMALL = 2; + + // Medium instance size, maps to a scaling factor of 1.0. + MEDIUM = 3; + + // Large instance size, maps to a scaling factor of 3.0. + LARGE = 4; + + // Extra large instance size, maps to a scaling factor of 6.0. + EXTRA_LARGE = 5; + } + + // Represents either a predetermined instance size or a numeric + // scaling factor. + oneof scaling_model { + // An enum of readable instance sizes, with each instance size mapping to a + // float value (e.g. InstanceSize.EXTRA_SMALL = scaling_factor(0.1)) + InstanceSize instance_size = 1; + + // Scaling factor, increments of 0.1 for values less than 1.0, and + // increments of 1.0 for values greater than 1.0. + float scaling_factor = 2; + } +} + +// Request message for +// [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices]. +message ListServicesRequest { + // Required. The relative resource name of the location of metastore services + // to list, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. The maximum number of services to return. The response may + // contain less than the maximum number. If unspecified, no more than 500 + // services are returned. The maximum value is 1000; values above 1000 are + // changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + // must match the call that provided the page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices]. +message ListServicesResponse { + // The services in the specified location. + repeated Service services = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [DataprocMetastore.GetService][google.cloud.metastore.v1alpha.DataprocMetastore.GetService]. +message GetServiceRequest { + // Required. The relative resource name of the metastore service to retrieve, + // in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; +} + +// Request message for +// [DataprocMetastore.CreateService][google.cloud.metastore.v1alpha.DataprocMetastore.CreateService]. +message CreateServiceRequest { + // Required. The relative resource name of the location in which to create a + // metastore service, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The ID of the metastore service, which is used as the final + // component of the metastore service's name. + // + // This value must be between 2 and 63 characters long inclusive, begin with a + // letter, end with a letter or number, and consist of alpha-numeric + // ASCII characters or hyphens. + string service_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Metastore service to create. The `name` field is + // ignored. The ID of the created metastore service must be provided in + // the request's `service_id` field. + Service service = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.UpdateService][google.cloud.metastore.v1alpha.DataprocMetastore.UpdateService]. +message UpdateServiceRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metastore service resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The metastore service to update. The server only merges fields + // in the service if they are specified in `update_mask`. + // + // The metastore service's `name` field is used to identify the metastore + // service to be updated. + Service service = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.DeleteService][google.cloud.metastore.v1alpha.DataprocMetastore.DeleteService]. +message DeleteServiceRequest { + // Required. The relative resource name of the metastore service to delete, in + // the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1alpha.DataprocMetastore.ListMetadataImports]. +message ListMetadataImportsRequest { + // Required. The relative resource name of the service whose metadata imports + // to list, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/MetadataImport" + } + ]; + + // Optional. The maximum number of imports to return. The response may contain + // less than the maximum number. If unspecified, no more than 500 imports are + // returned. The maximum value is 1000; values above 1000 are changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + // must match the call that provided the page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1alpha.DataprocMetastore.ListMetadataImports]. +message ListMetadataImportsResponse { + // The imports in the specified service. + repeated MetadataImport metadata_imports = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [DataprocMetastore.GetMetadataImport][google.cloud.metastore.v1alpha.DataprocMetastore.GetMetadataImport]. +message GetMetadataImportRequest { + // Required. The relative resource name of the metadata import to retrieve, in + // the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/MetadataImport" + } + ]; +} + +// Request message for +// [DataprocMetastore.CreateMetadataImport][google.cloud.metastore.v1alpha.DataprocMetastore.CreateMetadataImport]. +message CreateMetadataImportRequest { + // Required. The relative resource name of the service in which to create a + // metastore import, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/MetadataImport" + } + ]; + + // Required. The ID of the metadata import, which is used as the final + // component of the metadata import's name. + // + // This value must be between 1 and 64 characters long, begin with a letter, + // end with a letter or number, and consist of alpha-numeric ASCII characters + // or hyphens. + string metadata_import_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The metadata import to create. The `name` field is ignored. The + // ID of the created metadata import must be provided in the request's + // `metadata_import_id` field. + MetadataImport metadata_import = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.UpdateMetadataImport][google.cloud.metastore.v1alpha.DataprocMetastore.UpdateMetadataImport]. +message UpdateMetadataImportRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metadata import resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The metadata import to update. The server only merges fields + // in the import if they are specified in `update_mask`. + // + // The metadata import's `name` field is used to identify the metastore + // import to be updated. + MetadataImport metadata_import = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups]. +message ListBackupsRequest { + // Required. The relative resource name of the service whose backups to + // list, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. The maximum number of backups to return. The response may contain + // less than the maximum number. If unspecified, no more than 500 backups are + // returned. The maximum value is 1000; values above 1000 are changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups] + // must match the call that provided the page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups]. +message ListBackupsResponse { + // The backups of the specified service. + repeated Backup backups = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [DataprocMetastore.GetBackup][google.cloud.metastore.v1alpha.DataprocMetastore.GetBackup]. +message GetBackupRequest { + // Required. The relative resource name of the backup to retrieve, in the + // following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; +} + +// Request message for +// [DataprocMetastore.CreateBackup][google.cloud.metastore.v1alpha.DataprocMetastore.CreateBackup]. +message CreateBackupRequest { + // Required. The relative resource name of the service in which to create a + // backup of the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Backup" + } + ]; + + // Required. The ID of the backup, which is used as the final component of the + // backup's name. + // + // This value must be between 1 and 64 characters long, begin with a letter, + // end with a letter or number, and consist of alpha-numeric ASCII characters + // or hyphens. + string backup_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The backup to create. The `name` field is ignored. The ID of the + // created backup must be provided in the request's `backup_id` field. + Backup backup = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.DeleteBackup][google.cloud.metastore.v1alpha.DataprocMetastore.DeleteBackup]. +message DeleteBackupRequest { + // Required. The relative resource name of the backup to delete, in the + // following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.ExportMetadata][google.cloud.metastore.v1alpha.DataprocMetastore.ExportMetadata]. +message ExportMetadataRequest { + // Required. Destination that metadata is exported to. + oneof destination { + // A Cloud Storage URI of a folder, in the format + // `gs:///`. A sub-folder + // `` containing exported files will be created below it. + string destination_gcs_folder = 2; + } + + // Required. The relative resource name of the metastore service to run + // export, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The type of the database dump. If unspecified, defaults to + // `MYSQL`. + DatabaseDumpSpec.Type database_dump_type = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [DataprocMetastore.Restore][]. +message RestoreServiceRequest { + // Required. The relative resource name of the metastore service to run + // restore, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The relative resource name of the metastore service backup to + // restore from, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string backup = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + Restore.RestoreType restore_type = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents the metadata of a long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the caller has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a + // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + // `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Metadata about the service in a location. +message LocationMetadata { + // A specification of a supported version of the Hive Metastore software. + message HiveMetastoreVersion { + // The semantic version of the Hive Metastore software. + string version = 1; + + // Whether `version` will be chosen by the server if a metastore service is + // created with a `HiveMetastoreConfig` that omits the `version`. + bool is_default = 2; + } + + // The versions of Hive Metastore that can be used when creating a new + // metastore service in this location. The server guarantees that exactly one + // `HiveMetastoreVersion` in the list will set `is_default`. + repeated HiveMetastoreVersion supported_hive_metastore_versions = 1; +} + +// The specification of database dump to import from or export to. +message DatabaseDumpSpec { + // The type of the database dump. + enum Type { + // The type of the database dump is unknown. + TYPE_UNSPECIFIED = 0; + + // Database dump is a MySQL dump file. + MYSQL = 1; + + // Database dump contains Avro files. + AVRO = 2; + } +} + +// Request message for +// [DataprocMetastore.RemoveIamPolicy][google.cloud.metastore.v1alpha.DataprocMetastore.RemoveIamPolicy]. +message RemoveIamPolicyRequest { + // Required. The relative resource name of the dataplane resource to remove + // IAM policy, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` + // or + // `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. + string resource = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "*" } + ]; + + // Optional. Removes IAM policy attached to database or table asynchronously + // when it is set. The default is false. + bool asynchronous = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [DataprocMetastore.RemoveIamPolicy][google.cloud.metastore.v1alpha.DataprocMetastore.RemoveIamPolicy]. +message RemoveIamPolicyResponse { + // True if the policy is successfully removed. + bool success = 1; +} + +// Request message for +// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1alpha.DataprocMetastore.QueryMetadata]. +message QueryMetadataRequest { + // Required. The relative resource name of the metastore service to query + // metadata, in the following format: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Required. A read-only SQL query to execute against the metadata database. + // The query cannot change or mutate the data. + string query = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for +// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1alpha.DataprocMetastore.QueryMetadata]. +message QueryMetadataResponse { + // The manifest URI is link to a JSON instance in Cloud Storage. + // This instance manifests immediately along with QueryMetadataResponse. The + // content of the URI is not retriable until the long-running operation query + // against the metadata finishes. + string result_manifest_uri = 1; +} + +// Error details in public error message for +// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1alpha.DataprocMetastore.QueryMetadata]. +message ErrorDetails { + // Additional structured details about this error. + // + // Keys define the failure items. + // Value describes the exception or details of the item. + map details = 1; +} + +// Request message for +// [DataprocMetastore.MoveTableToDatabase][google.cloud.metastore.v1alpha.DataprocMetastore.MoveTableToDatabase]. +message MoveTableToDatabaseRequest { + // Required. The relative resource name of the metastore service to mutate + // metadata, in the following format: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The name of the table to be moved. + string table_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The name of the database where the table resides. + string db_name = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The name of the database where the table should be moved. + string destination_db_name = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for +// [DataprocMetastore.MoveTableToDatabase][google.cloud.metastore.v1alpha.DataprocMetastore.MoveTableToDatabase]. +message MoveTableToDatabaseResponse {} + +// Request message for +// [DataprocMetastore.AlterMetadataResourceLocation][google.cloud.metastore.v1alpha.DataprocMetastore.AlterMetadataResourceLocation]. +message AlterMetadataResourceLocationRequest { + // Required. The relative resource name of the metastore service to mutate + // metadata, in the following format: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The relative metadata resource name in the following format. + // + // `databases/{database_id}` + // or + // `databases/{database_id}/tables/{table_id}` + // or + // `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + string resource_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The new location URI for the metadata resource. + string location_uri = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for +// [DataprocMetastore.AlterMetadataResourceLocation][google.cloud.metastore.v1alpha.DataprocMetastore.AlterMetadataResourceLocation]. +message AlterMetadataResourceLocationResponse {} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore_federation.proto b/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore_federation.proto new file mode 100644 index 00000000000..bdb1ecb3783 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore_federation.proto @@ -0,0 +1,377 @@ +// 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 +// +// 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.metastore.v1alpha; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/metastore/v1alpha/metastore.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/metastore/apiv1alpha/metastorepb;metastorepb"; +option java_multiple_files = true; +option java_outer_classname = "MetastoreFederationProto"; +option java_package = "com.google.cloud.metastore.v1alpha"; + +// Configures and manages metastore federation services. +// Dataproc Metastore Federation Service allows federating a collection of +// backend metastores like BigQuery, Dataplex Lakes, and other Dataproc +// Metastores. The Federation Service exposes a gRPC URL through which metadata +// from the backend metastores are served at query time. +// +// The Dataproc Metastore Federation API defines the following resource model: +// * The service works with a collection of Google Cloud projects. +// * Each project has a collection of available locations. +// * Each location has a collection of federations. +// * Dataproc Metastore Federations are resources with names of the +// form: +// `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. +service DataprocMetastoreFederation { + option (google.api.default_host) = "metastore.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists federations in a project and location. + rpc ListFederations(ListFederationsRequest) + returns (ListFederationsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/locations/*}/federations" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a single federation. + rpc GetFederation(GetFederationRequest) returns (Federation) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/locations/*/federations/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a metastore federation in a project and location. + rpc CreateFederation(CreateFederationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha/{parent=projects/*/locations/*}/federations" + body: "federation" + }; + option (google.api.method_signature) = "parent,federation,federation_id"; + option (google.longrunning.operation_info) = { + response_type: "Federation" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Updates the fields of a federation. + rpc UpdateFederation(UpdateFederationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1alpha/{federation.name=projects/*/locations/*/federations/*}" + body: "federation" + }; + option (google.api.method_signature) = "federation,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Federation" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Deletes a single federation. + rpc DeleteFederation(DeleteFederationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1alpha/{name=projects/*/locations/*/federations/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } +} + +// Represents a federation of multiple backend metastores. +message Federation { + option (google.api.resource) = { + type: "metastore.googleapis.com/Federation" + pattern: "projects/{project}/locations/{location}/federations/{federation}" + }; + + // The current state of the federation. + enum State { + // The state of the metastore federation is unknown. + STATE_UNSPECIFIED = 0; + + // The metastore federation is in the process of being created. + CREATING = 1; + + // The metastore federation is running and ready to serve queries. + ACTIVE = 2; + + // The metastore federation is being updated. It remains usable but cannot + // accept additional update requests or be deleted at this time. + UPDATING = 3; + + // The metastore federation is undergoing deletion. It cannot be used. + DELETING = 4; + + // The metastore federation has encountered an error and cannot be used. The + // metastore federation should be deleted. + ERROR = 5; + } + + // Immutable. The relative resource name of the federation, of the + // form: + // projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the metastore federation was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metastore federation was last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-defined labels for the metastore federation. + map labels = 4; + + // Immutable. The Apache Hive metastore version of the federation. All backend + // metastore versions must be compatible with the federation version. + string version = 5 [(google.api.field_behavior) = IMMUTABLE]; + + // A map from `BackendMetastore` rank to `BackendMetastore`s from which the + // federation service serves metadata at query time. The map key represents + // the order in which `BackendMetastore`s should be evaluated to resolve + // database names at query time and should be greater than or equal to zero. A + // `BackendMetastore` with a lower number will be evaluated before a + // `BackendMetastore` with a higher number. + map backend_metastores = 6; + + // Output only. The federation endpoint. + string endpoint_uri = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the federation. + State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current state of the + // metastore federation, if available. + string state_message = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The globally unique resource identifier of the metastore + // federation. + string uid = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents a backend metastore for the federation. +message BackendMetastore { + // The type of the backend metastore. + enum MetastoreType { + // The metastore type is not set. + METASTORE_TYPE_UNSPECIFIED = 0; + + // The backend metastore is Dataplex. + DATAPLEX = 1; + + // The backend metastore is BigQuery. + BIGQUERY = 2; + + // The backend metastore is Dataproc Metastore. + DATAPROC_METASTORE = 3; + } + + // The relative resource name of the metastore that is being federated. + // The formats of the relative resource names for the currently supported + // metastores are listed below: + // + // * BigQuery + // * `projects/{project_id}` + // * Dataproc Metastore + // * `projects/{project_id}/locations/{location}/services/{service_id}` + string name = 1; + + // The type of the backend metastore. + MetastoreType metastore_type = 2; +} + +// Request message for ListFederations. +message ListFederationsRequest { + // Required. The relative resource name of the location of metastore + // federations to list, in the following form: + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Federation" + } + ]; + + // Optional. The maximum number of federations to return. The response may + // contain less than the maximum number. If unspecified, no more than 500 + // services are returned. The maximum value is 1000; values above 1000 are + // changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous ListFederationServices + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // ListFederationServices must match the call that provided the + // page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for ListFederations +message ListFederationsResponse { + // The services in the specified location. + repeated Federation federations = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for GetFederation. +message GetFederationRequest { + // Required. The relative resource name of the metastore federation to + // retrieve, in the following form: + // + // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Federation" + } + ]; +} + +// Request message for CreateFederation. +message CreateFederationRequest { + // Required. The relative resource name of the location in which to create a + // federation service, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Federation" + } + ]; + + // Required. The ID of the metastore federation, which is used as the final + // component of the metastore federation's name. + // + // This value must be between 2 and 63 characters long inclusive, begin with a + // letter, end with a letter or number, and consist of alpha-numeric + // ASCII characters or hyphens. + string federation_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Metastore Federation to create. The `name` field is + // ignored. The ID of the created metastore federation must be + // provided in the request's `federation_id` field. + Federation federation = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for UpdateFederation. +message UpdateFederationRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metastore federation resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The metastore federation to update. The server only merges fields + // in the service if they are specified in `update_mask`. + // + // The metastore federation's `name` field is used to identify the + // metastore service to be updated. + Federation federation = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for DeleteFederation. +message DeleteFederationRequest { + // Required. The relative resource name of the metastore federation to delete, + // in the following form: + // + // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Federation" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.alter_metadata_resource_location.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.alter_metadata_resource_location.js new file mode 100644 index 00000000000..edaff4f8c93 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.alter_metadata_resource_location.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(service, resourceName, locationUri) { + // [START metastore_v1alpha_generated_DataprocMetastore_AlterMetadataResourceLocation_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 relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Required. The relative metadata resource name in the following format. + * `databases/{database_id}` + * or + * `databases/{database_id}/tables/{table_id}` + * or + * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + */ + // const resourceName = 'abc123' + /** + * Required. The new location URI for the metadata resource. + */ + // const locationUri = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callAlterMetadataResourceLocation() { + // Construct request + const request = { + service, + resourceName, + locationUri, + }; + + // Run request + const [operation] = await metastoreClient.alterMetadataResourceLocation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callAlterMetadataResourceLocation(); + // [END metastore_v1alpha_generated_DataprocMetastore_AlterMetadataResourceLocation_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_backup.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_backup.js new file mode 100644 index 00000000000..01fc9ff0020 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_backup.js @@ -0,0 +1,92 @@ +// 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, backupId, backup) { + // [START metastore_v1alpha_generated_DataprocMetastore_CreateBackup_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 relative resource name of the service in which to create a + * backup of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + */ + // const backupId = 'abc123' + /** + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + */ + // const backup = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateBackup() { + // Construct request + const request = { + parent, + backupId, + backup, + }; + + // Run request + const [operation] = await metastoreClient.createBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateBackup(); + // [END metastore_v1alpha_generated_DataprocMetastore_CreateBackup_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js new file mode 100644 index 00000000000..5c2dcb559d3 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js @@ -0,0 +1,93 @@ +// 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, metadataImportId, metadataImport) { + // [START metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_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 relative resource name of the service in which to create a + * metastore import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + */ + // const metadataImportId = 'abc123' + /** + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + */ + // const metadataImport = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateMetadataImport() { + // Construct request + const request = { + parent, + metadataImportId, + metadataImport, + }; + + // Run request + const [operation] = await metastoreClient.createMetadataImport(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateMetadataImport(); + // [END metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_service.js new file mode 100644 index 00000000000..88a34fdc55f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_service.js @@ -0,0 +1,93 @@ +// 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, serviceId, service) { + // [START metastore_v1alpha_generated_DataprocMetastore_CreateService_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 relative resource name of the location in which to create a + * metastore service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + */ + // const serviceId = 'abc123' + /** + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + */ + // const service = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateService() { + // Construct request + const request = { + parent, + serviceId, + service, + }; + + // Run request + const [operation] = await metastoreClient.createService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateService(); + // [END metastore_v1alpha_generated_DataprocMetastore_CreateService_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_backup.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_backup.js new file mode 100644 index 00000000000..445c2bc2431 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_backup.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(name) { + // [START metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_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 relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callDeleteBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteBackup(); + // [END metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_service.js new file mode 100644 index 00000000000..05af070f4ed --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_service.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(name) { + // [START metastore_v1alpha_generated_DataprocMetastore_DeleteService_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 relative resource name of the metastore service to delete, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callDeleteService() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteService(); + // [END metastore_v1alpha_generated_DataprocMetastore_DeleteService_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.export_metadata.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.export_metadata.js new file mode 100644 index 00000000000..46f43eb57d9 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.export_metadata.js @@ -0,0 +1,88 @@ +// 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(service) { + // [START metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_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. + */ + /** + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + */ + // const destinationGcsFolder = 'abc123' + /** + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + */ + // const databaseDumpType = {} + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callExportMetadata() { + // Construct request + const request = { + service, + }; + + // Run request + const [operation] = await metastoreClient.exportMetadata(request); + const [response] = await operation.promise(); + console.log(response); + } + + callExportMetadata(); + // [END metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_backup.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_backup.js new file mode 100644 index 00000000000..fcc4667c506 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_backup.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 metastore_v1alpha_generated_DataprocMetastore_GetBackup_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 relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getBackup(request); + console.log(response); + } + + callGetBackup(); + // [END metastore_v1alpha_generated_DataprocMetastore_GetBackup_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js new file mode 100644 index 00000000000..9f7b5e8f8a0 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_metadata_import.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 metastore_v1alpha_generated_DataprocMetastore_GetMetadataImport_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 relative resource name of the metadata import to retrieve, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetMetadataImport() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getMetadataImport(request); + console.log(response); + } + + callGetMetadataImport(); + // [END metastore_v1alpha_generated_DataprocMetastore_GetMetadataImport_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_service.js new file mode 100644 index 00000000000..286eb652440 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_service.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 metastore_v1alpha_generated_DataprocMetastore_GetService_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 relative resource name of the metastore service to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetService() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getService(request); + console.log(response); + } + + callGetService(); + // [END metastore_v1alpha_generated_DataprocMetastore_GetService_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_backups.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_backups.js new file mode 100644 index 00000000000..e4fbe141848 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_backups.js @@ -0,0 +1,91 @@ +// 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 metastore_v1alpha_generated_DataprocMetastore_ListBackups_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 relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous + * DataprocMetastore.ListBackups google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListBackups google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListBackups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listBackupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBackups(); + // [END metastore_v1alpha_generated_DataprocMetastore_ListBackups_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js new file mode 100644 index 00000000000..d51efef9cfa --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js @@ -0,0 +1,91 @@ +// 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 metastore_v1alpha_generated_DataprocMetastore_ListMetadataImports_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 relative resource name of the service whose metadata imports + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous + * DataprocMetastore.ListServices google.cloud.metastore.v1alpha.DataprocMetastore.ListServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListServices google.cloud.metastore.v1alpha.DataprocMetastore.ListServices + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListMetadataImports() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listMetadataImportsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMetadataImports(); + // [END metastore_v1alpha_generated_DataprocMetastore_ListMetadataImports_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_services.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_services.js new file mode 100644 index 00000000000..d02e18afd32 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_services.js @@ -0,0 +1,92 @@ +// 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 metastore_v1alpha_generated_DataprocMetastore_ListServices_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 relative resource name of the location of metastore services + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous + * DataprocMetastore.ListServices google.cloud.metastore.v1alpha.DataprocMetastore.ListServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListServices google.cloud.metastore.v1alpha.DataprocMetastore.ListServices + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListServices() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listServicesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListServices(); + // [END metastore_v1alpha_generated_DataprocMetastore_ListServices_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.move_table_to_database.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.move_table_to_database.js new file mode 100644 index 00000000000..4a47afc91c1 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.move_table_to_database.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(service, tableName, dbName, destinationDbName) { + // [START metastore_v1alpha_generated_DataprocMetastore_MoveTableToDatabase_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 relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Required. The name of the table to be moved. + */ + // const tableName = 'abc123' + /** + * Required. The name of the database where the table resides. + */ + // const dbName = 'abc123' + /** + * Required. The name of the database where the table should be moved. + */ + // const destinationDbName = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callMoveTableToDatabase() { + // Construct request + const request = { + service, + tableName, + dbName, + destinationDbName, + }; + + // Run request + const [operation] = await metastoreClient.moveTableToDatabase(request); + const [response] = await operation.promise(); + console.log(response); + } + + callMoveTableToDatabase(); + // [END metastore_v1alpha_generated_DataprocMetastore_MoveTableToDatabase_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.query_metadata.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.query_metadata.js new file mode 100644 index 00000000000..f44e0884f3c --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.query_metadata.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(service, query) { + // [START metastore_v1alpha_generated_DataprocMetastore_QueryMetadata_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 relative resource name of the metastore service to query + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Required. A read-only SQL query to execute against the metadata database. + * The query cannot change or mutate the data. + */ + // const query = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callQueryMetadata() { + // Construct request + const request = { + service, + query, + }; + + // Run request + const [operation] = await metastoreClient.queryMetadata(request); + const [response] = await operation.promise(); + console.log(response); + } + + callQueryMetadata(); + // [END metastore_v1alpha_generated_DataprocMetastore_QueryMetadata_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.remove_iam_policy.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.remove_iam_policy.js new file mode 100644 index 00000000000..b233a6b57f6 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.remove_iam_policy.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) { + // [START metastore_v1alpha_generated_DataprocMetastore_RemoveIamPolicy_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 relative resource name of the dataplane resource to remove + * IAM policy, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` + * or + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. + */ + // const resource = 'abc123' + /** + * Optional. Removes IAM policy attached to database or table asynchronously + * when it is set. The default is false. + */ + // const asynchronous = true + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callRemoveIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await metastoreClient.removeIamPolicy(request); + console.log(response); + } + + callRemoveIamPolicy(); + // [END metastore_v1alpha_generated_DataprocMetastore_RemoveIamPolicy_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.restore_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.restore_service.js new file mode 100644 index 00000000000..46c59ad1046 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.restore_service.js @@ -0,0 +1,88 @@ +// 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(service, backup) { + // [START metastore_v1alpha_generated_DataprocMetastore_RestoreService_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 relative resource name of the metastore service to run + * restore, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const backup = 'abc123' + /** + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + */ + // const restoreType = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callRestoreService() { + // Construct request + const request = { + service, + backup, + }; + + // Run request + const [operation] = await metastoreClient.restoreService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRestoreService(); + // [END metastore_v1alpha_generated_DataprocMetastore_RestoreService_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js new file mode 100644 index 00000000000..3eb592036d0 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js @@ -0,0 +1,86 @@ +// 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(updateMask, metadataImport) { + // [START metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_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. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + */ + // const metadataImport = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callUpdateMetadataImport() { + // Construct request + const request = { + updateMask, + metadataImport, + }; + + // Run request + const [operation] = await metastoreClient.updateMetadataImport(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateMetadataImport(); + // [END metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_service.js new file mode 100644 index 00000000000..6fa09b2d6f6 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_service.js @@ -0,0 +1,86 @@ +// 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(updateMask, service) { + // [START metastore_v1alpha_generated_DataprocMetastore_UpdateService_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. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + */ + // const service = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callUpdateService() { + // Construct request + const request = { + updateMask, + service, + }; + + // Run request + const [operation] = await metastoreClient.updateService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateService(); + // [END metastore_v1alpha_generated_DataprocMetastore_UpdateService_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js new file mode 100644 index 00000000000..0db971f3b7c --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js @@ -0,0 +1,93 @@ +// 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, federationId, federation) { + // [START metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_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 relative resource name of the location in which to create a + * federation service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + */ + // const federationId = 'abc123' + /** + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + */ + // const federation = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callCreateFederation() { + // Construct request + const request = { + parent, + federationId, + federation, + }; + + // Run request + const [operation] = await metastoreClient.createFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFederation(); + // [END metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js new file mode 100644 index 00000000000..73a47a15bc8 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.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(name) { + // [START metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_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 relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callDeleteFederation() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFederation(); + // [END metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js new file mode 100644 index 00000000000..6b818a7f456 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.get_federation.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 metastore_v1alpha_generated_DataprocMetastoreFederation_GetFederation_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 relative resource name of the metastore federation to + * retrieve, in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callGetFederation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getFederation(request); + console.log(response); + } + + callGetFederation(); + // [END metastore_v1alpha_generated_DataprocMetastoreFederation_GetFederation_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js new file mode 100644 index 00000000000..c1fa26438b8 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js @@ -0,0 +1,91 @@ +// 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 metastore_v1alpha_generated_DataprocMetastoreFederation_ListFederations_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 relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callListFederations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listFederationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFederations(); + // [END metastore_v1alpha_generated_DataprocMetastoreFederation_ListFederations_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js new file mode 100644 index 00000000000..28da7dd4d24 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js @@ -0,0 +1,86 @@ +// 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(updateMask, federation) { + // [START metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_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. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + */ + // const federation = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callUpdateFederation() { + // Construct request + const request = { + updateMask, + federation, + }; + + // Run request + const [operation] = await metastoreClient.updateFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFederation(); + // [END metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_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-metastore/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.metastore.v1alpha.json b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.metastore.v1alpha.json new file mode 100644 index 00000000000..d44e4ba53b9 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.metastore.v1alpha.json @@ -0,0 +1,1175 @@ +{ + "clientLibrary": { + "name": "nodejs-metastore", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.metastore.v1alpha", + "version": "v1alpha" + } + ] + }, + "snippets": [ + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_ListServices_async", + "title": "DataprocMetastore listServices Sample", + "origin": "API_DEFINITION", + "description": " Lists services in a project and location.", + "canonical": true, + "file": "dataproc_metastore.list_services.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServices", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListServices", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1alpha.ListServicesResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListServices", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListServices", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_GetService_async", + "title": "DataprocMetastore getService Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a single service.", + "canonical": true, + "file": "dataproc_metastore.get_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetService", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1alpha.Service", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_CreateService_async", + "title": "DataprocMetastore createService Sample", + "origin": "API_DEFINITION", + "description": " Creates a metastore service in a project and location.", + "canonical": true, + "file": "dataproc_metastore.create_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateService", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "service_id", + "type": "TYPE_STRING" + }, + { + "name": "service", + "type": ".google.cloud.metastore.v1alpha.Service" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_UpdateService_async", + "title": "DataprocMetastore updateService Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a single service.", + "canonical": true, + "file": "dataproc_metastore.update_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.UpdateService", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "service", + "type": ".google.cloud.metastore.v1alpha.Service" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "UpdateService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.UpdateService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_DeleteService_async", + "title": "DataprocMetastore deleteService Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single service.", + "canonical": true, + "file": "dataproc_metastore.delete_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.DeleteService", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "DeleteService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.DeleteService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_ListMetadataImports_async", + "title": "DataprocMetastore listMetadataImports Sample", + "origin": "API_DEFINITION", + "description": " Lists imports in a service.", + "canonical": true, + "file": "dataproc_metastore.list_metadata_imports.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMetadataImports", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListMetadataImports", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1alpha.ListMetadataImportsResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListMetadataImports", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListMetadataImports", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_GetMetadataImport_async", + "title": "DataprocMetastore getMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single import.", + "canonical": true, + "file": "dataproc_metastore.get_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetMetadataImport", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetMetadataImport", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1alpha.MetadataImport", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetMetadataImport", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_async", + "title": "DataprocMetastore createMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Creates a new MetadataImport in a given project and location.", + "canonical": true, + "file": "dataproc_metastore.create_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateMetadataImport", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateMetadataImport", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "metadata_import_id", + "type": "TYPE_STRING" + }, + { + "name": "metadata_import", + "type": ".google.cloud.metastore.v1alpha.MetadataImport" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateMetadataImport", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_async", + "title": "DataprocMetastore updateMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Updates a single import. Only the description field of MetadataImport is supported to be updated.", + "canonical": true, + "file": "dataproc_metastore.update_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateMetadataImport", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.UpdateMetadataImport", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "metadata_import", + "type": ".google.cloud.metastore.v1alpha.MetadataImport" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "UpdateMetadataImport", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.UpdateMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_async", + "title": "DataprocMetastore exportMetadata Sample", + "origin": "API_DEFINITION", + "description": " Exports metadata from a service.", + "canonical": true, + "file": "dataproc_metastore.export_metadata.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ExportMetadata", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ExportMetadata", + "async": true, + "parameters": [ + { + "name": "destination_gcs_folder", + "type": "TYPE_STRING" + }, + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "database_dump_type", + "type": ".google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "ExportMetadata", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ExportMetadata", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_RestoreService_async", + "title": "DataprocMetastore restoreService Sample", + "origin": "API_DEFINITION", + "description": " Restores a service from a backup.", + "canonical": true, + "file": "dataproc_metastore.restore_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.RestoreService", + "async": true, + "parameters": [ + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": "TYPE_STRING" + }, + { + "name": "restore_type", + "type": ".google.cloud.metastore.v1alpha.Restore.RestoreType" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "RestoreService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.RestoreService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_ListBackups_async", + "title": "DataprocMetastore listBackups Sample", + "origin": "API_DEFINITION", + "description": " Lists backups in a service.", + "canonical": true, + "file": "dataproc_metastore.list_backups.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBackups", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1alpha.ListBackupsResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListBackups", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_GetBackup_async", + "title": "DataprocMetastore getBackup Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single backup.", + "canonical": true, + "file": "dataproc_metastore.get_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBackup", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1alpha.Backup", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetBackup", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_CreateBackup_async", + "title": "DataprocMetastore createBackup Sample", + "origin": "API_DEFINITION", + "description": " Creates a new backup in a given project and location.", + "canonical": true, + "file": "dataproc_metastore.create_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBackup", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateBackup", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "backup_id", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": ".google.cloud.metastore.v1alpha.Backup" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateBackup", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_async", + "title": "DataprocMetastore deleteBackup Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single backup.", + "canonical": true, + "file": "dataproc_metastore.delete_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.DeleteBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.DeleteBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_RemoveIamPolicy_async", + "title": "DataprocMetastore removeIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Removes the attached IAM policies for a resource", + "canonical": true, + "file": "dataproc_metastore.remove_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveIamPolicy", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.RemoveIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "asynchronous", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.metastore.v1alpha.RemoveIamPolicyResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "RemoveIamPolicy", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.RemoveIamPolicy", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_QueryMetadata_async", + "title": "DataprocMetastore queryMetadata Sample", + "origin": "API_DEFINITION", + "description": " Query DPMS metadata.", + "canonical": true, + "file": "dataproc_metastore.query_metadata.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "QueryMetadata", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.QueryMetadata", + "async": true, + "parameters": [ + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "QueryMetadata", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.QueryMetadata", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_MoveTableToDatabase_async", + "title": "DataprocMetastore moveTableToDatabase Sample", + "origin": "API_DEFINITION", + "description": " Move a table to another database.", + "canonical": true, + "file": "dataproc_metastore.move_table_to_database.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "MoveTableToDatabase", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.MoveTableToDatabase", + "async": true, + "parameters": [ + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "table_name", + "type": "TYPE_STRING" + }, + { + "name": "db_name", + "type": "TYPE_STRING" + }, + { + "name": "destination_db_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "MoveTableToDatabase", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.MoveTableToDatabase", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_AlterMetadataResourceLocation_async", + "title": "DataprocMetastore alterMetadataResourceLocation Sample", + "origin": "API_DEFINITION", + "description": " Alter metadata resource location. The metadata resource can be a database, table, or partition. This functionality only updates the parent directory for the respective metadata resource and does not transfer any existing data to the new location.", + "canonical": true, + "file": "dataproc_metastore.alter_metadata_resource_location.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AlterMetadataResourceLocation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.AlterMetadataResourceLocation", + "async": true, + "parameters": [ + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "resource_name", + "type": "TYPE_STRING" + }, + { + "name": "location_uri", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "AlterMetadataResourceLocation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.AlterMetadataResourceLocation", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_ListFederations_async", + "title": "DataprocMetastore listFederations Sample", + "origin": "API_DEFINITION", + "description": " Lists federations in a project and location.", + "canonical": true, + "file": "dataproc_metastore_federation.list_federations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFederations", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.ListFederations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1alpha.ListFederationsResponse", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "ListFederations", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.ListFederations", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_GetFederation_async", + "title": "DataprocMetastore getFederation Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a single federation.", + "canonical": true, + "file": "dataproc_metastore_federation.get_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.GetFederation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1alpha.Federation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "GetFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.GetFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_async", + "title": "DataprocMetastore createFederation Sample", + "origin": "API_DEFINITION", + "description": " Creates a metastore federation in a project and location.", + "canonical": true, + "file": "dataproc_metastore_federation.create_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.CreateFederation", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "federation_id", + "type": "TYPE_STRING" + }, + { + "name": "federation", + "type": ".google.cloud.metastore.v1alpha.Federation" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "CreateFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.CreateFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_async", + "title": "DataprocMetastore updateFederation Sample", + "origin": "API_DEFINITION", + "description": " Updates the fields of a federation.", + "canonical": true, + "file": "dataproc_metastore_federation.update_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.UpdateFederation", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "federation", + "type": ".google.cloud.metastore.v1alpha.Federation" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "UpdateFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.UpdateFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_async", + "title": "DataprocMetastore deleteFederation Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single federation.", + "canonical": true, + "file": "dataproc_metastore_federation.delete_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.DeleteFederation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "DeleteFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.DeleteFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/src/index.ts new file mode 100644 index 00000000000..a48e74fca36 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/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 v1alpha from './v1alpha'; +const DataprocMetastoreClient = v1alpha.DataprocMetastoreClient; +type DataprocMetastoreClient = v1alpha.DataprocMetastoreClient; +const DataprocMetastoreFederationClient = v1alpha.DataprocMetastoreFederationClient; +type DataprocMetastoreFederationClient = v1alpha.DataprocMetastoreFederationClient; +export {v1alpha, DataprocMetastoreClient, DataprocMetastoreFederationClient}; +export default {v1alpha, DataprocMetastoreClient, DataprocMetastoreFederationClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client.ts new file mode 100644 index 00000000000..1f48a103e94 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client.ts @@ -0,0 +1,3539 @@ +// 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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1alpha/dataproc_metastore_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './dataproc_metastore_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Configures and manages metastore services. + * Metastore services are fully managed, highly available, autoscaled, + * autohealing, OSS-native deployments of technical metadata management + * software. Each metastore service exposes a network endpoint through which + * metadata queries are served. Metadata queries can originate from a variety + * of sources, including Apache Hive, Apache Presto, and Apache Spark. + * + * The Dataproc Metastore API defines the following resource model: + * + * * The service works with a collection of Google Cloud projects, named: + * `/projects/*` + * * Each project has a collection of available locations, named: `/locations/*` + * (a location must refer to a Google Cloud `region`) + * * Each location has a collection of services, named: `/services/*` + * * Dataproc Metastore services are resources with names of the form: + * + * `/projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @class + * @memberof v1alpha + */ +export class DataprocMetastoreClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + dataprocMetastoreStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DataprocMetastoreClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 DataprocMetastoreClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof DataprocMetastoreClient; + 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; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + 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 = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' + ), + federationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/federations/{federation}' + ), + lakePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/lakes/{lake}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + metadataImportPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' + ), + networkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/global/networks/{network}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listServices: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'services'), + listMetadataImports: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metadataImports'), + listBackups: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.Service') as gax.protobuf.Type; + const createServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const updateServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.Service') as gax.protobuf.Type; + const updateServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const deleteServiceResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const createMetadataImportResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.MetadataImport') as gax.protobuf.Type; + const createMetadataImportMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const updateMetadataImportResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.MetadataImport') as gax.protobuf.Type; + const updateMetadataImportMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const exportMetadataResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.MetadataExport') as gax.protobuf.Type; + const exportMetadataMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const restoreServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.Restore') as gax.protobuf.Type; + const restoreServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const createBackupResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.Backup') as gax.protobuf.Type; + const createBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const deleteBackupResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const queryMetadataResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.QueryMetadataResponse') as gax.protobuf.Type; + const queryMetadataMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const moveTableToDatabaseResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.MoveTableToDatabaseResponse') as gax.protobuf.Type; + const moveTableToDatabaseMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const alterMetadataResourceLocationResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationResponse') as gax.protobuf.Type; + const alterMetadataResourceLocationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createServiceResponse.decode.bind(createServiceResponse), + createServiceMetadata.decode.bind(createServiceMetadata)), + updateService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateServiceResponse.decode.bind(updateServiceResponse), + updateServiceMetadata.decode.bind(updateServiceMetadata)), + deleteService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteServiceResponse.decode.bind(deleteServiceResponse), + deleteServiceMetadata.decode.bind(deleteServiceMetadata)), + createMetadataImport: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createMetadataImportResponse.decode.bind(createMetadataImportResponse), + createMetadataImportMetadata.decode.bind(createMetadataImportMetadata)), + updateMetadataImport: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateMetadataImportResponse.decode.bind(updateMetadataImportResponse), + updateMetadataImportMetadata.decode.bind(updateMetadataImportMetadata)), + exportMetadata: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportMetadataResponse.decode.bind(exportMetadataResponse), + exportMetadataMetadata.decode.bind(exportMetadataMetadata)), + restoreService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + restoreServiceResponse.decode.bind(restoreServiceResponse), + restoreServiceMetadata.decode.bind(restoreServiceMetadata)), + createBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBackupResponse.decode.bind(createBackupResponse), + createBackupMetadata.decode.bind(createBackupMetadata)), + deleteBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteBackupResponse.decode.bind(deleteBackupResponse), + deleteBackupMetadata.decode.bind(deleteBackupMetadata)), + queryMetadata: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + queryMetadataResponse.decode.bind(queryMetadataResponse), + queryMetadataMetadata.decode.bind(queryMetadataMetadata)), + moveTableToDatabase: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + moveTableToDatabaseResponse.decode.bind(moveTableToDatabaseResponse), + moveTableToDatabaseMetadata.decode.bind(moveTableToDatabaseMetadata)), + alterMetadataResourceLocation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + alterMetadataResourceLocationResponse.decode.bind(alterMetadataResourceLocationResponse), + alterMetadataResourceLocationMetadata.decode.bind(alterMetadataResourceLocationMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.metastore.v1alpha.DataprocMetastore', 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.dataprocMetastoreStub) { + return this.dataprocMetastoreStub; + } + + // Put together the "service stub" for + // google.cloud.metastore.v1alpha.DataprocMetastore. + this.dataprocMetastoreStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1alpha.DataprocMetastore') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.metastore.v1alpha.DataprocMetastore, + 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 dataprocMetastoreStubMethods = + ['listServices', 'getService', 'createService', 'updateService', 'deleteService', 'listMetadataImports', 'getMetadataImport', 'createMetadataImport', 'updateMetadataImport', 'exportMetadata', 'restoreService', 'listBackups', 'getBackup', 'createBackup', 'deleteBackup', 'removeIamPolicy', 'queryMetadata', 'moveTableToDatabase', 'alterMetadataResourceLocation']; + for (const methodName of dataprocMetastoreStubMethods) { + const callPromise = this.dataprocMetastoreStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.dataprocMetastoreStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'metastore.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 'metastore.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 -- + // ------------------- +/** + * Gets the details of a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.metastore.v1alpha.Service|Service}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.get_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_GetService_async + */ + getService( + request?: protos.google.cloud.metastore.v1alpha.IGetServiceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1alpha.IService, + protos.google.cloud.metastore.v1alpha.IGetServiceRequest|undefined, {}|undefined + ]>; + getService( + request: protos.google.cloud.metastore.v1alpha.IGetServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IService, + protos.google.cloud.metastore.v1alpha.IGetServiceRequest|null|undefined, + {}|null|undefined>): void; + getService( + request: protos.google.cloud.metastore.v1alpha.IGetServiceRequest, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IService, + protos.google.cloud.metastore.v1alpha.IGetServiceRequest|null|undefined, + {}|null|undefined>): void; + getService( + request?: protos.google.cloud.metastore.v1alpha.IGetServiceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1alpha.IService, + protos.google.cloud.metastore.v1alpha.IGetServiceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1alpha.IService, + protos.google.cloud.metastore.v1alpha.IGetServiceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1alpha.IService, + protos.google.cloud.metastore.v1alpha.IGetServiceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getService(request, options, callback); + } +/** + * Gets details of a single import. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_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 protos.google.cloud.metastore.v1alpha.MetadataImport|MetadataImport}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_GetMetadataImport_async + */ + getMetadataImport( + request?: protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1alpha.IMetadataImport, + protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|undefined, {}|undefined + ]>; + getMetadataImport( + request: protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IMetadataImport, + protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): void; + getMetadataImport( + request: protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IMetadataImport, + protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): void; + getMetadataImport( + request?: protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1alpha.IMetadataImport, + protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1alpha.IMetadataImport, + protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1alpha.IMetadataImport, + protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|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.getMetadataImport(request, options, callback); + } +/** + * Gets details of a single backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the backup to retrieve, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_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 protos.google.cloud.metastore.v1alpha.Backup|Backup}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.get_backup.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_GetBackup_async + */ + getBackup( + request?: protos.google.cloud.metastore.v1alpha.IGetBackupRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1alpha.IBackup, + protos.google.cloud.metastore.v1alpha.IGetBackupRequest|undefined, {}|undefined + ]>; + getBackup( + request: protos.google.cloud.metastore.v1alpha.IGetBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IBackup, + protos.google.cloud.metastore.v1alpha.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request: protos.google.cloud.metastore.v1alpha.IGetBackupRequest, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IBackup, + protos.google.cloud.metastore.v1alpha.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request?: protos.google.cloud.metastore.v1alpha.IGetBackupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1alpha.IBackup, + protos.google.cloud.metastore.v1alpha.IGetBackupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1alpha.IBackup, + protos.google.cloud.metastore.v1alpha.IGetBackupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1alpha.IBackup, + protos.google.cloud.metastore.v1alpha.IGetBackupRequest|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.getBackup(request, options, callback); + } +/** + * Removes the attached IAM policies for a resource + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * Required. The relative resource name of the dataplane resource to remove + * IAM policy, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` + * or + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. + * @param {boolean} [request.asynchronous] + * Optional. Removes IAM policy attached to database or table asynchronously + * when it is set. The default is false. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.metastore.v1alpha.RemoveIamPolicyResponse|RemoveIamPolicyResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.remove_iam_policy.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_RemoveIamPolicy_async + */ + removeIamPolicy( + request?: protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyResponse, + protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest|undefined, {}|undefined + ]>; + removeIamPolicy( + request: protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyResponse, + protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + removeIamPolicy( + request: protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyResponse, + protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + removeIamPolicy( + request?: protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyResponse, + protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyResponse, + protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyResponse, + protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest|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.removeIamPolicy(request, options, callback); + } + +/** + * Creates a metastore service in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {string} request.serviceId + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param {google.cloud.metastore.v1alpha.Service} request.service + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.create_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateService_async + */ + createService( + request?: protos.google.cloud.metastore.v1alpha.ICreateServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createService( + request: protos.google.cloud.metastore.v1alpha.ICreateServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createService( + request: protos.google.cloud.metastore.v1alpha.ICreateServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createService( + request?: protos.google.cloud.metastore.v1alpha.ICreateServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.create_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateService_async + */ + async checkCreateServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the parameters of a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1alpha.Service} request.service + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.update_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_UpdateService_async + */ + updateService( + request?: protos.google.cloud.metastore.v1alpha.IUpdateServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateService( + request: protos.google.cloud.metastore.v1alpha.IUpdateServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateService( + request: protos.google.cloud.metastore.v1alpha.IUpdateServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateService( + request?: protos.google.cloud.metastore.v1alpha.IUpdateServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service.name': request.service!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.update_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_UpdateService_async + */ + async checkUpdateServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore service to delete, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.delete_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_DeleteService_async + */ + deleteService( + request?: protos.google.cloud.metastore.v1alpha.IDeleteServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteService( + request: protos.google.cloud.metastore.v1alpha.IDeleteServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteService( + request: protos.google.cloud.metastore.v1alpha.IDeleteServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteService( + request?: protos.google.cloud.metastore.v1alpha.IDeleteServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.delete_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_DeleteService_async + */ + async checkDeleteServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new MetadataImport in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} request.metadataImportId + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param {google.cloud.metastore.v1alpha.MetadataImport} request.metadataImport + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_async + */ + createMetadataImport( + request?: protos.google.cloud.metastore.v1alpha.ICreateMetadataImportRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createMetadataImport( + request: protos.google.cloud.metastore.v1alpha.ICreateMetadataImportRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMetadataImport( + request: protos.google.cloud.metastore.v1alpha.ICreateMetadataImportRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMetadataImport( + request?: protos.google.cloud.metastore.v1alpha.ICreateMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createMetadataImport(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createMetadataImport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_async + */ + async checkCreateMetadataImportProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMetadataImport, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates a single import. + * Only the description field of MetadataImport is supported to be updated. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1alpha.MetadataImport} request.metadataImport + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_async + */ + updateMetadataImport( + request?: protos.google.cloud.metastore.v1alpha.IUpdateMetadataImportRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateMetadataImport( + request: protos.google.cloud.metastore.v1alpha.IUpdateMetadataImportRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMetadataImport( + request: protos.google.cloud.metastore.v1alpha.IUpdateMetadataImportRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMetadataImport( + request?: protos.google.cloud.metastore.v1alpha.IUpdateMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'metadata_import.name': request.metadataImport!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateMetadataImport(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateMetadataImport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_async + */ + async checkUpdateMetadataImportProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMetadataImport, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Exports metadata from a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.destinationGcsFolder + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * @param {string} request.service + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type} [request.databaseDumpType] + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.export_metadata.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_async + */ + exportMetadata( + request?: protos.google.cloud.metastore.v1alpha.IExportMetadataRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + exportMetadata( + request: protos.google.cloud.metastore.v1alpha.IExportMetadataRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportMetadata( + request: protos.google.cloud.metastore.v1alpha.IExportMetadataRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportMetadata( + request?: protos.google.cloud.metastore.v1alpha.IExportMetadataRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.exportMetadata(request, options, callback); + } +/** + * Check the status of the long running operation returned by `exportMetadata()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.export_metadata.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_async + */ + async checkExportMetadataProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportMetadata, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Restores a service from a backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.service + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} request.backup + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param {google.cloud.metastore.v1alpha.Restore.RestoreType} [request.restoreType] + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.restore_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_RestoreService_async + */ + restoreService( + request?: protos.google.cloud.metastore.v1alpha.IRestoreServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + restoreService( + request: protos.google.cloud.metastore.v1alpha.IRestoreServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreService( + request: protos.google.cloud.metastore.v1alpha.IRestoreServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreService( + request?: protos.google.cloud.metastore.v1alpha.IRestoreServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.restoreService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `restoreService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.restore_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_RestoreService_async + */ + async checkRestoreServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new backup in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service in which to create a + * backup of the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} request.backupId + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param {google.cloud.metastore.v1alpha.Backup} request.backup + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.create_backup.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateBackup_async + */ + createBackup( + request?: protos.google.cloud.metastore.v1alpha.ICreateBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createBackup( + request: protos.google.cloud.metastore.v1alpha.ICreateBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request: protos.google.cloud.metastore.v1alpha.ICreateBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request?: protos.google.cloud.metastore.v1alpha.ICreateBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.create_backup.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateBackup_async + */ + async checkCreateBackupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the backup to delete, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.delete_backup.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_async + */ + deleteBackup( + request?: protos.google.cloud.metastore.v1alpha.IDeleteBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteBackup( + request: protos.google.cloud.metastore.v1alpha.IDeleteBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request: protos.google.cloud.metastore.v1alpha.IDeleteBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request?: protos.google.cloud.metastore.v1alpha.IDeleteBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.delete_backup.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_async + */ + async checkDeleteBackupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteBackup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Query DPMS metadata. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.service + * Required. The relative resource name of the metastore service to query + * metadata, in the following format: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} request.query + * Required. A read-only SQL query to execute against the metadata database. + * The query cannot change or mutate the data. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.query_metadata.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_QueryMetadata_async + */ + queryMetadata( + request?: protos.google.cloud.metastore.v1alpha.IQueryMetadataRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + queryMetadata( + request: protos.google.cloud.metastore.v1alpha.IQueryMetadataRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + queryMetadata( + request: protos.google.cloud.metastore.v1alpha.IQueryMetadataRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + queryMetadata( + request?: protos.google.cloud.metastore.v1alpha.IQueryMetadataRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.queryMetadata(request, options, callback); + } +/** + * Check the status of the long running operation returned by `queryMetadata()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.query_metadata.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_QueryMetadata_async + */ + async checkQueryMetadataProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.queryMetadata, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Move a table to another database. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.service + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} request.tableName + * Required. The name of the table to be moved. + * @param {string} request.dbName + * Required. The name of the database where the table resides. + * @param {string} request.destinationDbName + * Required. The name of the database where the table should be moved. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.move_table_to_database.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_MoveTableToDatabase_async + */ + moveTableToDatabase( + request?: protos.google.cloud.metastore.v1alpha.IMoveTableToDatabaseRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + moveTableToDatabase( + request: protos.google.cloud.metastore.v1alpha.IMoveTableToDatabaseRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + moveTableToDatabase( + request: protos.google.cloud.metastore.v1alpha.IMoveTableToDatabaseRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + moveTableToDatabase( + request?: protos.google.cloud.metastore.v1alpha.IMoveTableToDatabaseRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.moveTableToDatabase(request, options, callback); + } +/** + * Check the status of the long running operation returned by `moveTableToDatabase()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.move_table_to_database.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_MoveTableToDatabase_async + */ + async checkMoveTableToDatabaseProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.moveTableToDatabase, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Alter metadata resource location. The metadata resource can be a database, + * table, or partition. This functionality only updates the parent directory + * for the respective metadata resource and does not transfer any existing + * data to the new location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.service + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} request.resourceName + * Required. The relative metadata resource name in the following format. + * + * `databases/{database_id}` + * or + * `databases/{database_id}/tables/{table_id}` + * or + * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + * @param {string} request.locationUri + * Required. The new location URI for the metadata 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.alter_metadata_resource_location.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_AlterMetadataResourceLocation_async + */ + alterMetadataResourceLocation( + request?: protos.google.cloud.metastore.v1alpha.IAlterMetadataResourceLocationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + alterMetadataResourceLocation( + request: protos.google.cloud.metastore.v1alpha.IAlterMetadataResourceLocationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + alterMetadataResourceLocation( + request: protos.google.cloud.metastore.v1alpha.IAlterMetadataResourceLocationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + alterMetadataResourceLocation( + request?: protos.google.cloud.metastore.v1alpha.IAlterMetadataResourceLocationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.alterMetadataResourceLocation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `alterMetadataResourceLocation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.alter_metadata_resource_location.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_AlterMetadataResourceLocation_async + */ + async checkAlterMetadataResourceLocationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.alterMetadataResourceLocation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists services in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1alpha.Service|Service}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listServicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listServices( + request?: protos.google.cloud.metastore.v1alpha.IListServicesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1alpha.IService[], + protos.google.cloud.metastore.v1alpha.IListServicesRequest|null, + protos.google.cloud.metastore.v1alpha.IListServicesResponse + ]>; + listServices( + request: protos.google.cloud.metastore.v1alpha.IListServicesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListServicesRequest, + protos.google.cloud.metastore.v1alpha.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IService>): void; + listServices( + request: protos.google.cloud.metastore.v1alpha.IListServicesRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListServicesRequest, + protos.google.cloud.metastore.v1alpha.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IService>): void; + listServices( + request?: protos.google.cloud.metastore.v1alpha.IListServicesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListServicesRequest, + protos.google.cloud.metastore.v1alpha.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IService>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListServicesRequest, + protos.google.cloud.metastore.v1alpha.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IService>): + Promise<[ + protos.google.cloud.metastore.v1alpha.IService[], + protos.google.cloud.metastore.v1alpha.IListServicesRequest|null, + protos.google.cloud.metastore.v1alpha.IListServicesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listServices(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 protos.google.cloud.metastore.v1alpha.Service|Service} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listServicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listServicesStream( + request?: protos.google.cloud.metastore.v1alpha.IListServicesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listServices']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServices.createStream( + this.innerApiCalls.listServices as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listServices`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.metastore.v1alpha.Service|Service}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.list_services.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_ListServices_async + */ + listServicesAsync( + request?: protos.google.cloud.metastore.v1alpha.IListServicesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listServices']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServices.asyncIterate( + this.innerApiCalls['listServices'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists imports in a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1alpha.MetadataImport|MetadataImport}. + * 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 `listMetadataImportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMetadataImports( + request?: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1alpha.IMetadataImport[], + protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest|null, + protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse + ]>; + listMetadataImports( + request: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IMetadataImport>): void; + listMetadataImports( + request: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IMetadataImport>): void; + listMetadataImports( + request?: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IMetadataImport>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IMetadataImport>): + Promise<[ + protos.google.cloud.metastore.v1alpha.IMetadataImport[], + protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest|null, + protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listMetadataImports(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 protos.google.cloud.metastore.v1alpha.MetadataImport|MetadataImport} 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 `listMetadataImportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMetadataImportsStream( + request?: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + 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['listMetadataImports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMetadataImports.createStream( + this.innerApiCalls.listMetadataImports as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMetadataImports`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.metastore.v1alpha.MetadataImport|MetadataImport}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_ListMetadataImports_async + */ + listMetadataImportsAsync( + request?: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + 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['listMetadataImports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMetadataImports.asyncIterate( + this.innerApiCalls['listMetadataImports'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists backups in a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1alpha.Backup|Backup}. + * 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 `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBackups( + request?: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1alpha.IBackup[], + protos.google.cloud.metastore.v1alpha.IListBackupsRequest|null, + protos.google.cloud.metastore.v1alpha.IListBackupsResponse + ]>; + listBackups( + request: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + protos.google.cloud.metastore.v1alpha.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IBackup>): void; + listBackups( + request: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + protos.google.cloud.metastore.v1alpha.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IBackup>): void; + listBackups( + request?: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + protos.google.cloud.metastore.v1alpha.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IBackup>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + protos.google.cloud.metastore.v1alpha.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IBackup>): + Promise<[ + protos.google.cloud.metastore.v1alpha.IBackup[], + protos.google.cloud.metastore.v1alpha.IListBackupsRequest|null, + protos.google.cloud.metastore.v1alpha.IListBackupsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listBackups(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 protos.google.cloud.metastore.v1alpha.Backup|Backup} 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 `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBackupsStream( + request?: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + 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['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.createStream( + this.innerApiCalls.listBackups as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBackups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.metastore.v1alpha.Backup|Backup}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.list_backups.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_ListBackups_async + */ + listBackupsAsync( + request?: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + 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['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.asyncIterate( + this.innerApiCalls['listBackups'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,location:string,service:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + service: service, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the service from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the service. + */ + matchServiceFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).service; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified federation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} federation + * @returns {string} Resource name string. + */ + federationPath(project:string,location:string,federation:string) { + return this.pathTemplates.federationPathTemplate.render({ + project: project, + location: location, + federation: federation, + }); + } + + /** + * Parse the project from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).project; + } + + /** + * Parse the location from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).location; + } + + /** + * Parse the federation from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the federation. + */ + matchFederationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).federation; + } + + /** + * Return a fully-qualified lake resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} lake + * @returns {string} Resource name string. + */ + lakePath(project:string,location:string,lake:string) { + return this.pathTemplates.lakePathTemplate.render({ + project: project, + location: location, + lake: lake, + }); + } + + /** + * Parse the project from Lake resource. + * + * @param {string} lakeName + * A fully-qualified path representing Lake resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLakeName(lakeName: string) { + return this.pathTemplates.lakePathTemplate.match(lakeName).project; + } + + /** + * Parse the location from Lake resource. + * + * @param {string} lakeName + * A fully-qualified path representing Lake resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLakeName(lakeName: string) { + return this.pathTemplates.lakePathTemplate.match(lakeName).location; + } + + /** + * Parse the lake from Lake resource. + * + * @param {string} lakeName + * A fully-qualified path representing Lake resource. + * @returns {string} A string representing the lake. + */ + matchLakeFromLakeName(lakeName: string) { + return this.pathTemplates.lakePathTemplate.match(lakeName).lake; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified metadataImport resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} metadata_import + * @returns {string} Resource name string. + */ + metadataImportPath(project:string,location:string,service:string,metadataImport:string) { + return this.pathTemplates.metadataImportPathTemplate.render({ + project: project, + location: location, + service: service, + metadata_import: metadataImport, + }); + } + + /** + * Parse the project from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; + } + + /** + * Parse the location from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; + } + + /** + * Parse the service from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the service. + */ + matchServiceFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; + } + + /** + * Parse the metadata_import from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the metadata_import. + */ + matchMetadataImportFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; + } + + /** + * Return a fully-qualified network resource name string. + * + * @param {string} project + * @param {string} network + * @returns {string} Resource name string. + */ + networkPath(project:string,network:string) { + return this.pathTemplates.networkPathTemplate.render({ + project: project, + network: network, + }); + } + + /** + * Parse the project from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).project; + } + + /** + * Parse the network from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the network. + */ + matchNetworkFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).network; + } + + /** + * 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 service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * 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.dataprocMetastoreStub && !this._terminated) { + return this.dataprocMetastoreStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client_config.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client_config.json new file mode 100644 index 00000000000..961e7da4d36 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client_config.json @@ -0,0 +1,133 @@ +{ + "interfaces": { + "google.cloud.metastore.v1alpha.DataprocMetastore": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListServices": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetService": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListMetadataImports": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ExportMetadata": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RestoreService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RemoveIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "QueryMetadata": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "MoveTableToDatabase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "AlterMetadataResourceLocation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client.ts new file mode 100644 index 00000000000..8a0de346bc0 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client.ts @@ -0,0 +1,1714 @@ +// 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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1alpha/dataproc_metastore_federation_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './dataproc_metastore_federation_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Configures and manages metastore federation services. + * Dataproc Metastore Federation Service allows federating a collection of + * backend metastores like BigQuery, Dataplex Lakes, and other Dataproc + * Metastores. The Federation Service exposes a gRPC URL through which metadata + * from the backend metastores are served at query time. + * + * The Dataproc Metastore Federation API defines the following resource model: + * * The service works with a collection of Google Cloud projects. + * * Each project has a collection of available locations. + * * Each location has a collection of federations. + * * Dataproc Metastore Federations are resources with names of the + * form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @class + * @memberof v1alpha + */ +export class DataprocMetastoreFederationClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + dataprocMetastoreFederationStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DataprocMetastoreFederationClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 DataprocMetastoreFederationClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof DataprocMetastoreFederationClient; + 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; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + 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 = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' + ), + federationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/federations/{federation}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + metadataImportPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + }; + + // 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 = { + listFederations: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'federations') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createFederationResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.Federation') as gax.protobuf.Type; + const createFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const updateFederationResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.Federation') as gax.protobuf.Type; + const updateFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const deleteFederationResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFederationResponse.decode.bind(createFederationResponse), + createFederationMetadata.decode.bind(createFederationMetadata)), + updateFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFederationResponse.decode.bind(updateFederationResponse), + updateFederationMetadata.decode.bind(updateFederationMetadata)), + deleteFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFederationResponse.decode.bind(deleteFederationResponse), + deleteFederationMetadata.decode.bind(deleteFederationMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.metastore.v1alpha.DataprocMetastoreFederation', 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.dataprocMetastoreFederationStub) { + return this.dataprocMetastoreFederationStub; + } + + // Put together the "service stub" for + // google.cloud.metastore.v1alpha.DataprocMetastoreFederation. + this.dataprocMetastoreFederationStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1alpha.DataprocMetastoreFederation') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.metastore.v1alpha.DataprocMetastoreFederation, + 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 dataprocMetastoreFederationStubMethods = + ['listFederations', 'getFederation', 'createFederation', 'updateFederation', 'deleteFederation']; + for (const methodName of dataprocMetastoreFederationStubMethods) { + const callPromise = this.dataprocMetastoreFederationStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.dataprocMetastoreFederationStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'metastore.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 'metastore.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 -- + // ------------------- +/** + * Gets the details of a single federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore federation to + * retrieve, in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_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 protos.google.cloud.metastore.v1alpha.Federation|Federation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js + * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_GetFederation_async + */ + getFederation( + request?: protos.google.cloud.metastore.v1alpha.IGetFederationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1alpha.IFederation, + protos.google.cloud.metastore.v1alpha.IGetFederationRequest|undefined, {}|undefined + ]>; + getFederation( + request: protos.google.cloud.metastore.v1alpha.IGetFederationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IFederation, + protos.google.cloud.metastore.v1alpha.IGetFederationRequest|null|undefined, + {}|null|undefined>): void; + getFederation( + request: protos.google.cloud.metastore.v1alpha.IGetFederationRequest, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IFederation, + protos.google.cloud.metastore.v1alpha.IGetFederationRequest|null|undefined, + {}|null|undefined>): void; + getFederation( + request?: protos.google.cloud.metastore.v1alpha.IGetFederationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1alpha.IFederation, + protos.google.cloud.metastore.v1alpha.IGetFederationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1alpha.IFederation, + protos.google.cloud.metastore.v1alpha.IGetFederationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1alpha.IFederation, + protos.google.cloud.metastore.v1alpha.IGetFederationRequest|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.getFederation(request, options, callback); + } + +/** + * Creates a metastore federation in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location in which to create a + * federation service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {string} request.federationId + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param {google.cloud.metastore.v1alpha.Federation} request.federation + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js + * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_async + */ + createFederation( + request?: protos.google.cloud.metastore.v1alpha.ICreateFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createFederation( + request: protos.google.cloud.metastore.v1alpha.ICreateFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFederation( + request: protos.google.cloud.metastore.v1alpha.ICreateFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFederation( + request?: protos.google.cloud.metastore.v1alpha.ICreateFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js + * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_async + */ + async checkCreateFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the fields of a federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1alpha.Federation} request.federation + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js + * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_async + */ + updateFederation( + request?: protos.google.cloud.metastore.v1alpha.IUpdateFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateFederation( + request: protos.google.cloud.metastore.v1alpha.IUpdateFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFederation( + request: protos.google.cloud.metastore.v1alpha.IUpdateFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFederation( + request?: protos.google.cloud.metastore.v1alpha.IUpdateFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'federation.name': request.federation!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js + * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_async + */ + async checkUpdateFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore federation to delete, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js + * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_async + */ + deleteFederation( + request?: protos.google.cloud.metastore.v1alpha.IDeleteFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteFederation( + request: protos.google.cloud.metastore.v1alpha.IDeleteFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFederation( + request: protos.google.cloud.metastore.v1alpha.IDeleteFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFederation( + request?: protos.google.cloud.metastore.v1alpha.IDeleteFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js + * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_async + */ + async checkDeleteFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists federations in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1alpha.Federation|Federation}. + * 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 `listFederationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFederations( + request?: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1alpha.IFederation[], + protos.google.cloud.metastore.v1alpha.IListFederationsRequest|null, + protos.google.cloud.metastore.v1alpha.IListFederationsResponse + ]>; + listFederations( + request: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + protos.google.cloud.metastore.v1alpha.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IFederation>): void; + listFederations( + request: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + protos.google.cloud.metastore.v1alpha.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IFederation>): void; + listFederations( + request?: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + protos.google.cloud.metastore.v1alpha.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IFederation>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + protos.google.cloud.metastore.v1alpha.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IFederation>): + Promise<[ + protos.google.cloud.metastore.v1alpha.IFederation[], + protos.google.cloud.metastore.v1alpha.IListFederationsRequest|null, + protos.google.cloud.metastore.v1alpha.IListFederationsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listFederations(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 protos.google.cloud.metastore.v1alpha.Federation|Federation} 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 `listFederationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFederationsStream( + request?: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + 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['listFederations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFederations.createStream( + this.innerApiCalls.listFederations as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFederations`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.metastore.v1alpha.Federation|Federation}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js + * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_ListFederations_async + */ + listFederationsAsync( + request?: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + 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['listFederations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFederations.asyncIterate( + this.innerApiCalls['listFederations'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,location:string,service:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + service: service, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the service from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the service. + */ + matchServiceFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).service; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified federation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} federation + * @returns {string} Resource name string. + */ + federationPath(project:string,location:string,federation:string) { + return this.pathTemplates.federationPathTemplate.render({ + project: project, + location: location, + federation: federation, + }); + } + + /** + * Parse the project from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).project; + } + + /** + * Parse the location from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).location; + } + + /** + * Parse the federation from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the federation. + */ + matchFederationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).federation; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified metadataImport resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} metadata_import + * @returns {string} Resource name string. + */ + metadataImportPath(project:string,location:string,service:string,metadataImport:string) { + return this.pathTemplates.metadataImportPathTemplate.render({ + project: project, + location: location, + service: service, + metadata_import: metadataImport, + }); + } + + /** + * Parse the project from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; + } + + /** + * Parse the location from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; + } + + /** + * Parse the service from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the service. + */ + matchServiceFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; + } + + /** + * Parse the metadata_import from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the metadata_import. + */ + matchMetadataImportFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; + } + + /** + * 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 service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * 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.dataprocMetastoreFederationStub && !this._terminated) { + return this.dataprocMetastoreFederationStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client_config.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client_config.json new file mode 100644 index 00000000000..f764c70b10a --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.metastore.v1alpha.DataprocMetastoreFederation": { + "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": { + "ListFederations": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_proto_list.json new file mode 100644 index 00000000000..5aa3fc8ef92 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/metastore/v1alpha/metastore.proto", + "../../protos/google/cloud/metastore/v1alpha/metastore_federation.proto" +] diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_proto_list.json new file mode 100644 index 00000000000..5aa3fc8ef92 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/metastore/v1alpha/metastore.proto", + "../../protos/google/cloud/metastore/v1alpha/metastore_federation.proto" +] diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/gapic_metadata.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/gapic_metadata.json new file mode 100644 index 00000000000..6c32defcc30 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/gapic_metadata.json @@ -0,0 +1,293 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.metastore.v1alpha", + "libraryPackage": "@google-cloud/dataproc-metastore", + "services": { + "DataprocMetastore": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreClient", + "rpcs": { + "GetService": { + "methods": [ + "getService" + ] + }, + "GetMetadataImport": { + "methods": [ + "getMetadataImport" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "RemoveIamPolicy": { + "methods": [ + "removeIamPolicy" + ] + }, + "CreateService": { + "methods": [ + "createService" + ] + }, + "UpdateService": { + "methods": [ + "updateService" + ] + }, + "DeleteService": { + "methods": [ + "deleteService" + ] + }, + "CreateMetadataImport": { + "methods": [ + "createMetadataImport" + ] + }, + "UpdateMetadataImport": { + "methods": [ + "updateMetadataImport" + ] + }, + "ExportMetadata": { + "methods": [ + "exportMetadata" + ] + }, + "RestoreService": { + "methods": [ + "restoreService" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "QueryMetadata": { + "methods": [ + "queryMetadata" + ] + }, + "MoveTableToDatabase": { + "methods": [ + "moveTableToDatabase" + ] + }, + "AlterMetadataResourceLocation": { + "methods": [ + "alterMetadataResourceLocation" + ] + }, + "ListServices": { + "methods": [ + "listServices", + "listServicesStream", + "listServicesAsync" + ] + }, + "ListMetadataImports": { + "methods": [ + "listMetadataImports", + "listMetadataImportsStream", + "listMetadataImportsAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DataprocMetastoreClient", + "rpcs": { + "GetService": { + "methods": [ + "getService" + ] + }, + "GetMetadataImport": { + "methods": [ + "getMetadataImport" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "RemoveIamPolicy": { + "methods": [ + "removeIamPolicy" + ] + }, + "CreateService": { + "methods": [ + "createService" + ] + }, + "UpdateService": { + "methods": [ + "updateService" + ] + }, + "DeleteService": { + "methods": [ + "deleteService" + ] + }, + "CreateMetadataImport": { + "methods": [ + "createMetadataImport" + ] + }, + "UpdateMetadataImport": { + "methods": [ + "updateMetadataImport" + ] + }, + "ExportMetadata": { + "methods": [ + "exportMetadata" + ] + }, + "RestoreService": { + "methods": [ + "restoreService" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "QueryMetadata": { + "methods": [ + "queryMetadata" + ] + }, + "MoveTableToDatabase": { + "methods": [ + "moveTableToDatabase" + ] + }, + "AlterMetadataResourceLocation": { + "methods": [ + "alterMetadataResourceLocation" + ] + }, + "ListServices": { + "methods": [ + "listServices", + "listServicesStream", + "listServicesAsync" + ] + }, + "ListMetadataImports": { + "methods": [ + "listMetadataImports", + "listMetadataImportsStream", + "listMetadataImportsAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + } + } + }, + "DataprocMetastoreFederation": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreFederationClient", + "rpcs": { + "GetFederation": { + "methods": [ + "getFederation" + ] + }, + "CreateFederation": { + "methods": [ + "createFederation" + ] + }, + "UpdateFederation": { + "methods": [ + "updateFederation" + ] + }, + "DeleteFederation": { + "methods": [ + "deleteFederation" + ] + }, + "ListFederations": { + "methods": [ + "listFederations", + "listFederationsStream", + "listFederationsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DataprocMetastoreFederationClient", + "rpcs": { + "GetFederation": { + "methods": [ + "getFederation" + ] + }, + "CreateFederation": { + "methods": [ + "createFederation" + ] + }, + "UpdateFederation": { + "methods": [ + "updateFederation" + ] + }, + "DeleteFederation": { + "methods": [ + "deleteFederation" + ] + }, + "ListFederations": { + "methods": [ + "listFederations", + "listFederationsStream", + "listFederationsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/index.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/index.ts new file mode 100644 index 00000000000..74baf047ec9 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/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 {DataprocMetastoreClient} from './dataproc_metastore_client'; +export {DataprocMetastoreFederationClient} from './dataproc_metastore_federation_client'; diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..2d137ce8c89 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/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 metastore = require('@google-cloud/dataproc-metastore'); + +function main() { + const dataprocMetastoreClient = new metastore.DataprocMetastoreClient(); + const dataprocMetastoreFederationClient = new metastore.DataprocMetastoreFederationClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..15fe58ac669 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/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 {DataprocMetastoreClient, DataprocMetastoreFederationClient} from '@google-cloud/dataproc-metastore'; + +// check that the client class type name can be used +function doStuffWithDataprocMetastoreClient(client: DataprocMetastoreClient) { + client.close(); +} +function doStuffWithDataprocMetastoreFederationClient(client: DataprocMetastoreFederationClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const dataprocMetastoreClient = new DataprocMetastoreClient(); + doStuffWithDataprocMetastoreClient(dataprocMetastoreClient); + // check that the client instance can be created + const dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + doStuffWithDataprocMetastoreFederationClient(dataprocMetastoreFederationClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/install.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/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-metastore/v1alpha/test/gapic_dataproc_metastore_federation_v1alpha.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_federation_v1alpha.ts new file mode 100644 index 00000000000..479f5fdeeff --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_federation_v1alpha.ts @@ -0,0 +1,2000 @@ +// 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 dataprocmetastorefederationModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1alpha.DataprocMetastoreFederationClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); + await client.initialize(); + assert(client.dataprocMetastoreFederationStub); + }); + + it('has close method for the initialized client', done => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.dataprocMetastoreFederationStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + 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 dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + 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('getFederation', () => { + it('invokes getFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.Federation() + ); + client.innerApiCalls.getFederation = stubSimpleCall(expectedResponse); + const [response] = await client.getFederation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.Federation() + ); + client.innerApiCalls.getFederation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFederation( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IFederation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFederation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation with closed client', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFederation(request), expectedError); + }); + }); + + describe('createFederation', () => { + it('invokes createFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.createFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateFederation', () => { + it('invokes updateFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteFederation', () => { + it('invokes deleteFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listFederations', () => { + it('invokes listFederations without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + ]; + client.innerApiCalls.listFederations = stubSimpleCall(expectedResponse); + const [response] = await client.listFederations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederations without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + ]; + client.innerApiCalls.listFederations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFederations( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IFederation[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederations with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFederations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFederations(request), expectedError); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederationsStream without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + ]; + client.descriptors.page.listFederations.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFederationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1alpha.Federation[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Federation) => { + 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.listFederations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); + assert( + (client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFederationsStream with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFederations.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFederationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1alpha.Federation[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Federation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); + assert( + (client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFederations without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + ]; + client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1alpha.IFederation[] = []; + const iterable = client.listFederationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFederations with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFederationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1alpha.IFederation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + backup: "backupValue", + }; + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromBackupName', () => { + const result = client.matchServiceFromBackupName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('federation', () => { + const fakePath = "/rendered/path/federation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + federation: "federationValue", + }; + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.federationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.federationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('federationPath', () => { + const result = client.federationPath("projectValue", "locationValue", "federationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.federationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFederationName', () => { + const result = client.matchProjectFromFederationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFederationName', () => { + const result = client.matchLocationFromFederationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFederationFromFederationName', () => { + const result = client.matchFederationFromFederationName(fakePath); + assert.strictEqual(result, "federationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('metadataImport', () => { + const fakePath = "/rendered/path/metadataImport"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + metadata_import: "metadataImportValue", + }; + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.metadataImportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.metadataImportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('metadataImportPath', () => { + const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromMetadataImportName', () => { + const result = client.matchProjectFromMetadataImportName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromMetadataImportName', () => { + const result = client.matchLocationFromMetadataImportName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromMetadataImportName', () => { + const result = client.matchServiceFromMetadataImportName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetadataImportFromMetadataImportName', () => { + const result = client.matchMetadataImportFromMetadataImportName(fakePath); + assert.strictEqual(result, "metadataImportValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + 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('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + }; + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath("projectValue", "locationValue", "serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_v1alpha.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_v1alpha.ts new file mode 100644 index 00000000000..5eb9c5c1346 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_v1alpha.ts @@ -0,0 +1,4288 @@ +// 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 dataprocmetastoreModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1alpha.DataprocMetastoreClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = dataprocmetastoreModule.v1alpha.DataprocMetastoreClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = dataprocmetastoreModule.v1alpha.DataprocMetastoreClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = dataprocmetastoreModule.v1alpha.DataprocMetastoreClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreStub, undefined); + await client.initialize(); + assert(client.dataprocMetastoreStub); + }); + + it('has close method for the initialized client', done => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.dataprocMetastoreStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + 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 dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + 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('getService', () => { + it('invokes getService without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.Service() + ); + client.innerApiCalls.getService = stubSimpleCall(expectedResponse); + const [response] = await client.getService(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.Service() + ); + client.innerApiCalls.getService = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getService( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IService|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getService = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getService(request), expectedError); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService with closed client', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getService(request), expectedError); + }); + }); + + describe('getMetadataImport', () => { + it('invokes getMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.MetadataImport() + ); + client.innerApiCalls.getMetadataImport = stubSimpleCall(expectedResponse); + const [response] = await client.getMetadataImport(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.MetadataImport() + ); + client.innerApiCalls.getMetadataImport = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMetadataImport( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IMetadataImport|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMetadataImport = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport with closed client', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getMetadataImport(request), expectedError); + }); + }); + + describe('getBackup', () => { + it('invokes getBackup without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.Backup() + ); + client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); + const [response] = await client.getBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.Backup() + ); + client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackup( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IBackup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with closed client', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBackup(request), expectedError); + }); + }); + + describe('removeIamPolicy', () => { + it('invokes removeIamPolicy without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.RemoveIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.RemoveIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.RemoveIamPolicyResponse() + ); + client.innerApiCalls.removeIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.removeIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.removeIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.removeIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes removeIamPolicy without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.RemoveIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.RemoveIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.RemoveIamPolicyResponse() + ); + client.innerApiCalls.removeIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeIamPolicy( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.removeIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.removeIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes removeIamPolicy with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.RemoveIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.RemoveIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.removeIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.removeIamPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.removeIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.removeIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes removeIamPolicy with closed client', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.RemoveIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.RemoveIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.removeIamPolicy(request), expectedError); + }); + }); + + describe('createService', () => { + it('invokes createService without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createService = stubLongRunningCall(expectedResponse); + const [operation] = await client.createService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createService(request), expectedError); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateService', () => { + it('invokes updateService without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateService = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateService(request), expectedError); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteService', () => { + it('invokes deleteService without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteService = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteService(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createMetadataImport', () => { + it('invokes createMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(expectedResponse); + const [operation] = await client.createMetadataImport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMetadataImport = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMetadataImport( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createMetadataImport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateMetadataImportProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateMetadataImportProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateMetadataImportProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateMetadataImportProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateMetadataImport', () => { + it('invokes updateMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateMetadataImport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMetadataImport = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMetadataImport( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateMetadataImport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateMetadataImportProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateMetadataImportProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateMetadataImportProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateMetadataImportProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('exportMetadata', () => { + it('invokes exportMetadata without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportMetadata = stubLongRunningCall(expectedResponse); + const [operation] = await client.exportMetadata(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportMetadata = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportMetadata( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.exportMetadata(request), expectedError); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.exportMetadata(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkExportMetadataProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkExportMetadataProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportMetadataProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkExportMetadataProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('restoreService', () => { + it('invokes restoreService without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreService = stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.restoreService(request), expectedError); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.restoreService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRestoreServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRestoreServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRestoreServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createBackup', () => { + it('invokes createBackup without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBackup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateBackupProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateBackupProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteBackup', () => { + it('invokes deleteBackup without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteBackup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteBackupProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteBackupProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('queryMetadata', () => { + it('invokes queryMetadata without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.QueryMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.QueryMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.queryMetadata = stubLongRunningCall(expectedResponse); + const [operation] = await client.queryMetadata(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes queryMetadata without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.QueryMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.QueryMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.queryMetadata = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.queryMetadata( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes queryMetadata with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.QueryMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.QueryMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.queryMetadata = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.queryMetadata(request), expectedError); + const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes queryMetadata with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.QueryMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.QueryMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.queryMetadata = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.queryMetadata(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkQueryMetadataProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkQueryMetadataProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkQueryMetadataProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkQueryMetadataProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('moveTableToDatabase', () => { + it('invokes moveTableToDatabase without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.MoveTableToDatabaseRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.MoveTableToDatabaseRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(expectedResponse); + const [operation] = await client.moveTableToDatabase(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveTableToDatabase without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.MoveTableToDatabaseRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.MoveTableToDatabaseRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.moveTableToDatabase = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.moveTableToDatabase( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveTableToDatabase with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.MoveTableToDatabaseRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.MoveTableToDatabaseRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.moveTableToDatabase(request), expectedError); + const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveTableToDatabase with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.MoveTableToDatabaseRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.MoveTableToDatabaseRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.moveTableToDatabase(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkMoveTableToDatabaseProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkMoveTableToDatabaseProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkMoveTableToDatabaseProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkMoveTableToDatabaseProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('alterMetadataResourceLocation', () => { + it('invokes alterMetadataResourceLocation without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(expectedResponse); + const [operation] = await client.alterMetadataResourceLocation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes alterMetadataResourceLocation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.alterMetadataResourceLocation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes alterMetadataResourceLocation with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.alterMetadataResourceLocation(request), expectedError); + const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes alterMetadataResourceLocation with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.alterMetadataResourceLocation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkAlterMetadataResourceLocationProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkAlterMetadataResourceLocationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkAlterMetadataResourceLocationProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkAlterMetadataResourceLocationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listServices', () => { + it('invokes listServices without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); + const [response] = await client.listServices(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServices without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServices( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IService[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServices with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServices = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listServices(request), expectedError); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServicesStream without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + ]; + client.descriptors.page.listServices.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1alpha.Service[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listServices, request)); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listServicesStream with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServices.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1alpha.Service[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listServices, request)); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listServices without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + ]; + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1alpha.IService[] = []; + const iterable = client.listServicesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listServices with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServicesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1alpha.IService[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listMetadataImports', () => { + it('invokes listMetadataImports without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + ]; + client.innerApiCalls.listMetadataImports = stubSimpleCall(expectedResponse); + const [response] = await client.listMetadataImports(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImports without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + ]; + client.innerApiCalls.listMetadataImports = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMetadataImports( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IMetadataImport[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImports with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMetadataImports = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMetadataImports(request), expectedError); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImportsStream without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + ]; + client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMetadataImportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1alpha.MetadataImport[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1alpha.MetadataImport) => { + 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.listMetadataImports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); + assert( + (client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listMetadataImportsStream with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMetadataImportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1alpha.MetadataImport[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1alpha.MetadataImport) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); + assert( + (client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMetadataImports without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + ]; + client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1alpha.IMetadataImport[] = []; + const iterable = client.listMetadataImportsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMetadataImports with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMetadataImportsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1alpha.IMetadataImport[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listBackups', () => { + it('invokes listBackups without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listBackups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackups( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IBackup[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBackups(request), expectedError); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackupsStream without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + ]; + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1alpha.Backup[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Backup) => { + 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.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listBackupsStream with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1alpha.Backup[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBackups without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + ]; + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1alpha.IBackup[] = []; + const iterable = client.listBackupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBackups with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBackupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1alpha.IBackup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + backup: "backupValue", + }; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromBackupName', () => { + const result = client.matchServiceFromBackupName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('federation', () => { + const fakePath = "/rendered/path/federation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + federation: "federationValue", + }; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.federationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.federationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('federationPath', () => { + const result = client.federationPath("projectValue", "locationValue", "federationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.federationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFederationName', () => { + const result = client.matchProjectFromFederationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFederationName', () => { + const result = client.matchLocationFromFederationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFederationFromFederationName', () => { + const result = client.matchFederationFromFederationName(fakePath); + assert.strictEqual(result, "federationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('lake', () => { + const fakePath = "/rendered/path/lake"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + lake: "lakeValue", + }; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.lakePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.lakePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('lakePath', () => { + const result = client.lakePath("projectValue", "locationValue", "lakeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.lakePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLakeName', () => { + const result = client.matchProjectFromLakeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.lakePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLakeName', () => { + const result = client.matchLocationFromLakeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.lakePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLakeFromLakeName', () => { + const result = client.matchLakeFromLakeName(fakePath); + assert.strictEqual(result, "lakeValue"); + assert((client.pathTemplates.lakePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('metadataImport', () => { + const fakePath = "/rendered/path/metadataImport"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + metadata_import: "metadataImportValue", + }; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.metadataImportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.metadataImportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('metadataImportPath', () => { + const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromMetadataImportName', () => { + const result = client.matchProjectFromMetadataImportName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromMetadataImportName', () => { + const result = client.matchLocationFromMetadataImportName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromMetadataImportName', () => { + const result = client.matchServiceFromMetadataImportName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetadataImportFromMetadataImportName', () => { + const result = client.matchMetadataImportFromMetadataImportName(fakePath); + assert.strictEqual(result, "metadataImportValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('network', () => { + const fakePath = "/rendered/path/network"; + const expectedParameters = { + project: "projectValue", + network: "networkValue", + }; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.networkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.networkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath("projectValue", "networkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNetworkFromNetworkName', () => { + const result = client.matchNetworkFromNetworkName(fakePath); + assert.strictEqual(result, "networkValue"); + assert((client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + 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('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + }; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath("projectValue", "locationValue", "serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/tsconfig.json b/owl-bot-staging/google-cloud-metastore/v1alpha/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/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-metastore/v1alpha/webpack.config.js b/owl-bot-staging/google-cloud-metastore/v1alpha/webpack.config.js new file mode 100644 index 00000000000..6fc45cb3d30 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/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: 'DataprocMetastore', + filename: './dataproc-metastore.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-metastore/v1beta/.eslintignore b/owl-bot-staging/google-cloud-metastore/v1beta/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/.eslintrc.json b/owl-bot-staging/google-cloud-metastore/v1beta/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/.gitignore b/owl-bot-staging/google-cloud-metastore/v1beta/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/.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-metastore/v1beta/.jsdoc.js b/owl-bot-staging/google-cloud-metastore/v1beta/.jsdoc.js new file mode 100644 index 00000000000..77430ad8c15 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/.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/dataproc-metastore', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/.mocharc.js b/owl-bot-staging/google-cloud-metastore/v1beta/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/.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-metastore/v1beta/.prettierrc.js b/owl-bot-staging/google-cloud-metastore/v1beta/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/.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-metastore/v1beta/README.md b/owl-bot-staging/google-cloud-metastore/v1beta/README.md new file mode 100644 index 00000000000..24afb9017c6 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/README.md @@ -0,0 +1 @@ +Metastore: Nodejs Client diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/package.json b/owl-bot-staging/google-cloud-metastore/v1beta/package.json new file mode 100644 index 00000000000..e14926927ea --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/package.json @@ -0,0 +1,59 @@ +{ + "name": "@google-cloud/dataproc-metastore", + "version": "0.1.0", + "description": "Metastore client for Node.js", + "repository": "googleapis/nodejs-metastore", + "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 metastore", + "metastore", + "dataproc metastore", + "dataproc metastore federation" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore.proto b/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore.proto new file mode 100644 index 00000000000..88718fdf718 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore.proto @@ -0,0 +1,1681 @@ +// 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 +// +// 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.metastore.v1beta; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/type/dayofweek.proto"; + +option go_package = "cloud.google.com/go/metastore/apiv1beta/metastorepb;metastorepb"; +option java_multiple_files = true; +option java_outer_classname = "MetastoreProto"; +option java_package = "com.google.cloud.metastore.v1beta"; +option php_namespace = "Google\\Cloud\\Metastore\\V1beta"; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Network" + pattern: "projects/{project}/global/networks/{network}" +}; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Subnetwork" + pattern: "projects/{project}/regions/{region}/subnetworks/{subnetwork}" +}; +option (google.api.resource_definition) = { + type: "dataplex.googleapis.com/Lake" + pattern: "projects/{project}/locations/{location}/lakes/{lake}" +}; + +// Configures and manages metastore services. +// Metastore services are fully managed, highly available, autoscaled, +// autohealing, OSS-native deployments of technical metadata management +// software. Each metastore service exposes a network endpoint through which +// metadata queries are served. Metadata queries can originate from a variety +// of sources, including Apache Hive, Apache Presto, and Apache Spark. +// +// The Dataproc Metastore API defines the following resource model: +// +// * The service works with a collection of Google Cloud projects, named: +// `/projects/*` +// * Each project has a collection of available locations, named: `/locations/*` +// (a location must refer to a Google Cloud `region`) +// * Each location has a collection of services, named: `/services/*` +// * Dataproc Metastore services are resources with names of the form: +// +// `/projects/{project_number}/locations/{location_id}/services/{service_id}`. +service DataprocMetastore { + option (google.api.default_host) = "metastore.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists services in a project and location. + rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*}/services" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a single service. + rpc GetService(GetServiceRequest) returns (Service) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/services/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a metastore service in a project and location. + rpc CreateService(CreateServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*/locations/*}/services" + body: "service" + }; + option (google.api.method_signature) = "parent,service,service_id"; + option (google.longrunning.operation_info) = { + response_type: "Service" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Updates the parameters of a single service. + rpc UpdateService(UpdateServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta/{service.name=projects/*/locations/*/services/*}" + body: "service" + }; + option (google.api.method_signature) = "service,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Service" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Deletes a single service. + rpc DeleteService(DeleteServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta/{name=projects/*/locations/*/services/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Lists imports in a service. + rpc ListMetadataImports(ListMetadataImportsRequest) + returns (ListMetadataImportsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*/services/*}/metadataImports" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single import. + rpc GetMetadataImport(GetMetadataImportRequest) returns (MetadataImport) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/services/*/metadataImports/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new MetadataImport in a given project and location. + rpc CreateMetadataImport(CreateMetadataImportRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*/locations/*/services/*}/metadataImports" + body: "metadata_import" + }; + option (google.api.method_signature) = + "parent,metadata_import,metadata_import_id"; + option (google.longrunning.operation_info) = { + response_type: "MetadataImport" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Updates a single import. + // Only the description field of MetadataImport is supported to be updated. + rpc UpdateMetadataImport(UpdateMetadataImportRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta/{metadata_import.name=projects/*/locations/*/services/*/metadataImports/*}" + body: "metadata_import" + }; + option (google.api.method_signature) = "metadata_import,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "MetadataImport" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Exports metadata from a service. + rpc ExportMetadata(ExportMetadataRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{service=projects/*/locations/*/services/*}:exportMetadata" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "MetadataExport" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Restores a service from a backup. + rpc RestoreService(RestoreServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{service=projects/*/locations/*/services/*}:restore" + body: "*" + }; + option (google.api.method_signature) = "service,backup"; + option (google.longrunning.operation_info) = { + response_type: "Restore" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Lists backups in a service. + rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*/services/*}/backups" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single backup. + rpc GetBackup(GetBackupRequest) returns (Backup) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/services/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new backup in a given project and location. + rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*/locations/*/services/*}/backups" + body: "backup" + }; + option (google.api.method_signature) = "parent,backup,backup_id"; + option (google.longrunning.operation_info) = { + response_type: "Backup" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Deletes a single backup. + rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta/{name=projects/*/locations/*/services/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Removes the attached IAM policies for a resource + rpc RemoveIamPolicy(RemoveIamPolicyRequest) + returns (RemoveIamPolicyResponse) { + option (google.api.http) = { + post: "/v1beta/{resource=projects/*/locations/*/services/*/**}:removeIamPolicy" + body: "*" + }; + } + + // Query DPMS metadata. + rpc QueryMetadata(QueryMetadataRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{service=projects/*/locations/*/services/*}:queryMetadata" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "QueryMetadataResponse" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Move a table to another database. + rpc MoveTableToDatabase(MoveTableToDatabaseRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{service=projects/*/locations/*/services/*}:moveTableToDatabase" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "MoveTableToDatabaseResponse" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Alter metadata resource location. The metadata resource can be a database, + // table, or partition. This functionality only updates the parent directory + // for the respective metadata resource and does not transfer any existing + // data to the new location. + rpc AlterMetadataResourceLocation(AlterMetadataResourceLocationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{service=projects/*/locations/*/services/*}:alterLocation" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "AlterMetadataResourceLocationResponse" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } +} + +// A managed metastore service that serves metadata queries. +message Service { + option (google.api.resource) = { + type: "metastore.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/services/{service}" + }; + + // The current state of the metastore service. + enum State { + // The state of the metastore service is unknown. + STATE_UNSPECIFIED = 0; + + // The metastore service is in the process of being created. + CREATING = 1; + + // The metastore service is running and ready to serve queries. + ACTIVE = 2; + + // The metastore service is entering suspension. Its query-serving + // availability may cease unexpectedly. + SUSPENDING = 3; + + // The metastore service is suspended and unable to serve queries. + SUSPENDED = 4; + + // The metastore service is being updated. It remains usable but cannot + // accept additional update requests or be deleted at this time. + UPDATING = 5; + + // The metastore service is undergoing deletion. It cannot be used. + DELETING = 6; + + // The metastore service has encountered an error and cannot be used. The + // metastore service should be deleted. + ERROR = 7; + } + + // Available service tiers. + enum Tier { + // The tier is not set. + TIER_UNSPECIFIED = 0; + + // The developer tier provides limited scalability and no fault tolerance. + // Good for low-cost proof-of-concept. + DEVELOPER = 1; + + // The enterprise tier provides multi-zone high availability, and sufficient + // scalability for enterprise-level Dataproc Metastore workloads. + ENTERPRISE = 3; + } + + // Release channels bundle features of varying levels of stability. Newer + // features may be introduced initially into less stable release channels and + // can be automatically promoted into more stable release channels. + enum ReleaseChannel { + // Release channel is not specified. + RELEASE_CHANNEL_UNSPECIFIED = 0; + + // The `CANARY` release channel contains the newest features, which may be + // unstable and subject to unresolved issues with no known workarounds. + // Services using the `CANARY` release channel are not subject to any SLAs. + CANARY = 1; + + // The `STABLE` release channel contains features that are considered stable + // and have been validated for production use. + STABLE = 2; + } + + // The backend database type for the metastore service. + enum DatabaseType { + // The DATABASE_TYPE is not set. + DATABASE_TYPE_UNSPECIFIED = 0; + + // MySQL is used to persist the metastore data. + MYSQL = 1; + + // Spanner is used to persist the metastore data. + SPANNER = 2; + } + + // Configuration properties specific to the underlying metastore service + // technology (the software that serves metastore queries). + oneof metastore_config { + // Configuration information specific to running Hive metastore + // software as the metastore service. + HiveMetastoreConfig hive_metastore_config = 5; + } + + // Immutable. The relative resource name of the metastore service, in the + // following format: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the metastore service was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metastore service was last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-defined labels for the metastore service. + map labels = 4; + + // Immutable. The relative resource name of the VPC network on which the + // instance can be accessed. It is specified in the following form: + // + // `projects/{project_number}/global/networks/{network_id}`. + string network = 7 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } + ]; + + // Output only. The URI of the endpoint used to access the metastore service. + string endpoint_uri = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The TCP port at which the metastore service is reached. Default: 9083. + int32 port = 9; + + // Output only. The current state of the metastore service. + State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current state of the + // metastore service, if available. + string state_message = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A Cloud Storage URI (starting with `gs://`) that specifies + // where artifacts related to the metastore service are stored. + string artifact_gcs_uri = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The tier of the service. + Tier tier = 13; + + // The setting that defines how metastore metadata should be integrated with + // external services and systems. + MetadataIntegration metadata_integration = 14; + + // The one hour maintenance window of the metastore service. This specifies + // when the service can be restarted for maintenance purposes in UTC time. + // Maintenance window is not needed for services with the SPANNER + // database type. + MaintenanceWindow maintenance_window = 15; + + // Output only. The globally unique resource identifier of the metastore + // service. + string uid = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The metadata management activities of the metastore service. + MetadataManagementActivity metadata_management_activity = 17 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. The release channel of the service. + // If unspecified, defaults to `STABLE`. + ReleaseChannel release_channel = 19 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. Information used to configure the Dataproc Metastore service to + // encrypt customer data at rest. Cannot be updated. + EncryptionConfig encryption_config = 20 + [(google.api.field_behavior) = IMMUTABLE]; + + // The configuration specifying the network settings for the + // Dataproc Metastore service. + NetworkConfig network_config = 21; + + // Immutable. The database type that the Metastore service stores its data. + DatabaseType database_type = 22 [(google.api.field_behavior) = IMMUTABLE]; + + // The configuration specifying telemetry settings for the Dataproc Metastore + // service. If unspecified defaults to `JSON`. + TelemetryConfig telemetry_config = 23; + + // Scaling configuration of the metastore service. + ScalingConfig scaling_config = 24; +} + +// Specifies how metastore metadata should be integrated with external services. +message MetadataIntegration { + // The integration config for the Data Catalog service. + DataCatalogConfig data_catalog_config = 1; + + // The integration config for the Dataplex service. + DataplexConfig dataplex_config = 2; +} + +// Specifies how metastore metadata should be integrated with the Data Catalog +// service. +message DataCatalogConfig { + // Defines whether the metastore metadata should be synced to Data Catalog. + // The default value is to disable syncing metastore metadata to Data Catalog. + bool enabled = 2; +} + +// Specifies how metastore metadata should be integrated with the Dataplex +// service. +message DataplexConfig { + // A reference to the Lake resources that this metastore service is attached + // to. The key is the lake resource name. Example: + // `projects/{project_number}/locations/{location_id}/lakes/{lake_id}`. + map lake_resources = 1; +} + +// Represents a Lake resource +message Lake { + // The Lake resource name. + // Example: + // `projects/{project_number}/locations/{location_id}/lakes/{lake_id}` + string name = 1 [ + (google.api.resource_reference) = { type: "dataplex.googleapis.com/Lake" } + ]; +} + +// Maintenance window. This specifies when Dataproc Metastore +// may perform system maintenance operation to the service. +message MaintenanceWindow { + // The hour of day (0-23) when the window starts. + google.protobuf.Int32Value hour_of_day = 1; + + // The day of week, when the window starts. + google.type.DayOfWeek day_of_week = 2; +} + +// Specifies configuration information specific to running Hive metastore +// software as the metastore service. +message HiveMetastoreConfig { + // Protocols available for serving the metastore service endpoint. + enum EndpointProtocol { + // The protocol is not set. + ENDPOINT_PROTOCOL_UNSPECIFIED = 0; + + // Use the legacy Apache Thrift protocol for the metastore service endpoint. + THRIFT = 1; + + // Use the modernized gRPC protocol for the metastore service endpoint. + GRPC = 2; + } + + // Immutable. The Hive metastore schema version. + string version = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // A mapping of Hive metastore configuration key-value pairs to apply to the + // Hive metastore (configured in `hive-site.xml`). The mappings + // override system defaults (some keys cannot be overridden). These + // overrides are also applied to auxiliary versions and can be further + // customized in the auxiliary version's `AuxiliaryVersionConfig`. + map config_overrides = 2; + + // Information used to configure the Hive metastore service as a service + // principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + // method and specify this field's path + // (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + // while omitting this field from the request's `service`. + KerberosConfig kerberos_config = 3; + + // The protocol to use for the metastore service endpoint. If unspecified, + // defaults to `THRIFT`. + EndpointProtocol endpoint_protocol = 4; + + // A mapping of Hive metastore version to the auxiliary version + // configuration. When specified, a secondary Hive metastore service is + // created along with the primary service. All auxiliary versions must be less + // than the service's primary version. The key is the auxiliary service name + // and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This + // means that the first character must be a lowercase letter, and all the + // following characters must be hyphens, lowercase letters, or digits, except + // the last character, which cannot be a hyphen. + map auxiliary_versions = 5; +} + +// Configuration information for a Kerberos principal. +message KerberosConfig { + // A Kerberos keytab file that can be used to authenticate a service principal + // with a Kerberos Key Distribution Center (KDC). + Secret keytab = 1; + + // A Kerberos principal that exists in the both the keytab the KDC + // to authenticate as. A typical principal is of the form + // `primary/instance@REALM`, but there is no exact format. + string principal = 2; + + // A Cloud Storage URI that specifies the path to a + // krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + // although the file does not need to be named krb5.conf explicitly. + string krb5_config_gcs_uri = 3; +} + +// A securely stored value. +message Secret { + oneof value { + // The relative resource name of a Secret Manager secret version, in the + // following form: + // + // `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. + string cloud_secret = 2; + } +} + +// Encryption settings for the service. +message EncryptionConfig { + // The fully qualified customer provided Cloud KMS key name to use for + // customer data encryption, in the following form: + // + // `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + string kms_key = 1; +} + +// Configuration information for the auxiliary service versions. +message AuxiliaryVersionConfig { + // The Hive metastore version of the auxiliary service. It must be less + // than the primary Hive metastore service's version. + string version = 1; + + // A mapping of Hive metastore configuration key-value pairs to apply to the + // auxiliary Hive metastore (configured in `hive-site.xml`) in addition to + // the primary version's overrides. If keys are present in both the auxiliary + // version's overrides and the primary version's overrides, the value from + // the auxiliary version's overrides takes precedence. + map config_overrides = 2; + + // Output only. The network configuration contains the endpoint URI(s) of the + // auxiliary Hive metastore service. + NetworkConfig network_config = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Network configuration for the Dataproc Metastore service. +message NetworkConfig { + // Contains information of the customer's network configurations. + message Consumer { + oneof vpc_resource { + // Immutable. The subnetwork of the customer project from which an IP + // address is reserved and used as the Dataproc Metastore service's + // endpoint. It is accessible to hosts in the subnet and to all + // hosts in a subnet in the same region and same network. There must + // be at least one IP address available in the subnet's primary range. The + // subnet is specified in the following form: + // + // `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` + string subnetwork = 1 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { + type: "compute.googleapis.com/Subnetwork" + } + ]; + } + + // Output only. The URI of the endpoint used to access the metastore + // service. + string endpoint_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Immutable. The consumer-side network configuration for the Dataproc + // Metastore instance. + repeated Consumer consumers = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Enables custom routes to be imported and exported for the Dataproc + // Metastore service's peered VPC network. + bool custom_routes_enabled = 2; +} + +// Telemetry Configuration for the Dataproc Metastore service. +message TelemetryConfig { + enum LogFormat { + // The LOG_FORMAT is not set. + LOG_FORMAT_UNSPECIFIED = 0; + + // Logging output uses the legacy `textPayload` format. + LEGACY = 1; + + // Logging output uses the `jsonPayload` format. + JSON = 2; + } + + // The output format of the Dataproc Metastore service's logs. + LogFormat log_format = 1; +} + +// The metadata management activities of the metastore service. +message MetadataManagementActivity { + // Output only. The latest metadata exports of the metastore service. + repeated MetadataExport metadata_exports = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The latest restores of the metastore service. + repeated Restore restores = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A metastore resource that imports metadata. +message MetadataImport { + option (google.api.resource) = { + type: "metastore.googleapis.com/MetadataImport" + pattern: "projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}" + }; + + // A specification of the location of and metadata about a database dump from + // a relational database management system. + message DatabaseDump { + // The type of the database. + enum DatabaseType { + // The type of the source database is unknown. + DATABASE_TYPE_UNSPECIFIED = 0; + + // The type of the source database is MySQL. + MYSQL = 1; + } + + // The type of the database. + DatabaseType database_type = 1 [deprecated = true]; + + // A Cloud Storage object or folder URI that specifies the source from which + // to import metadata. It must begin with `gs://`. + string gcs_uri = 2; + + // The name of the source database. + string source_database = 3 [deprecated = true]; + + // Optional. The type of the database dump. If unspecified, defaults to + // `MYSQL`. + DatabaseDumpSpec.Type type = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // The current state of the metadata import. + enum State { + // The state of the metadata import is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata import is running. + RUNNING = 1; + + // The metadata import completed successfully. + SUCCEEDED = 2; + + // The metadata import is being updated. + UPDATING = 3; + + // The metadata import failed, and attempted metadata changes were rolled + // back. + FAILED = 4; + } + + // The metadata to be imported. + oneof metadata { + // Immutable. A database dump from a pre-existing metastore's database. + DatabaseDump database_dump = 6 [(google.api.field_behavior) = IMMUTABLE]; + } + + // Immutable. The relative resource name of the metadata import, of the form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // The description of the metadata import. + string description = 2; + + // Output only. The time when the metadata import was started. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metadata import was last updated. + google.protobuf.Timestamp update_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metadata import finished. + google.protobuf.Timestamp end_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the metadata import. + State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a metadata export operation. +message MetadataExport { + // The current state of the metadata export. + enum State { + // The state of the metadata export is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata export is running. + RUNNING = 1; + + // The metadata export completed successfully. + SUCCEEDED = 2; + + // The metadata export failed. + FAILED = 3; + + // The metadata export is cancelled. + CANCELLED = 4; + } + + oneof destination { + // Output only. A Cloud Storage URI of a folder that metadata are exported + // to, in the form of + // `gs:////`, where + // `` is automatically generated. + string destination_gcs_uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Output only. The time when the export started. + google.protobuf.Timestamp start_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the export ended. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the export. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The type of the database dump. + DatabaseDumpSpec.Type database_dump_type = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a backup resource. +message Backup { + option (google.api.resource) = { + type: "metastore.googleapis.com/Backup" + pattern: "projects/{project}/locations/{location}/services/{service}/backups/{backup}" + }; + + // The current state of the backup. + enum State { + // The state of the backup is unknown. + STATE_UNSPECIFIED = 0; + + // The backup is being created. + CREATING = 1; + + // The backup is being deleted. + DELETING = 2; + + // The backup is active and ready to use. + ACTIVE = 3; + + // The backup failed. + FAILED = 4; + + // The backup is being restored. + RESTORING = 5; + } + + // Immutable. The relative resource name of the backup, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the backup was started. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the backup finished creating. + google.protobuf.Timestamp end_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the backup. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The revision of the service at the time of backup. + Service service_revision = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The description of the backup. + string description = 6; + + // Output only. Services that are restoring from the backup. + repeated string restoring_services = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a metadata restore operation. +message Restore { + // The current state of the restore. + enum State { + // The state of the metadata restore is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata restore is running. + RUNNING = 1; + + // The metadata restore completed successfully. + SUCCEEDED = 2; + + // The metadata restore failed. + FAILED = 3; + + // The metadata restore is cancelled. + CANCELLED = 4; + } + + // The type of restore. If unspecified, defaults to `METADATA_ONLY`. + enum RestoreType { + // The restore type is unknown. + RESTORE_TYPE_UNSPECIFIED = 0; + + // The service's metadata and configuration are restored. + FULL = 1; + + // Only the service's metadata is restored. + METADATA_ONLY = 2; + } + + // Output only. The time when the restore started. + google.protobuf.Timestamp start_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the restore ended. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the restore. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The relative resource name of the metastore service backup to + // restore from, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string backup = 4 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Output only. The type of restore. + RestoreType type = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The restore details containing the revision of the service to + // be restored to, in format of JSON. + string details = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents the scaling configuration of a metastore service. +message ScalingConfig { + // Metastore instance sizes. + enum InstanceSize { + // Unspecified instance size + INSTANCE_SIZE_UNSPECIFIED = 0; + + // Extra small instance size, maps to a scaling factor of 0.1. + EXTRA_SMALL = 1; + + // Small instance size, maps to a scaling factor of 0.5. + SMALL = 2; + + // Medium instance size, maps to a scaling factor of 1.0. + MEDIUM = 3; + + // Large instance size, maps to a scaling factor of 3.0. + LARGE = 4; + + // Extra large instance size, maps to a scaling factor of 6.0. + EXTRA_LARGE = 5; + } + + // Represents either a predetermined instance size or a numeric + // scaling factor. + oneof scaling_model { + // An enum of readable instance sizes, with each instance size mapping to a + // float value (e.g. InstanceSize.EXTRA_SMALL = scaling_factor(0.1)) + InstanceSize instance_size = 1; + + // Scaling factor, increments of 0.1 for values less than 1.0, and + // increments of 1.0 for values greater than 1.0. + float scaling_factor = 2; + } +} + +// Request message for +// [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices]. +message ListServicesRequest { + // Required. The relative resource name of the location of metastore services + // to list, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. The maximum number of services to return. The response may + // contain less than the maximum number. If unspecified, no more than 500 + // services are returned. The maximum value is 1000; values above 1000 are + // changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + // must match the call that provided the page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices]. +message ListServicesResponse { + // The services in the specified location. + repeated Service services = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [DataprocMetastore.GetService][google.cloud.metastore.v1beta.DataprocMetastore.GetService]. +message GetServiceRequest { + // Required. The relative resource name of the metastore service to retrieve, + // in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; +} + +// Request message for +// [DataprocMetastore.CreateService][google.cloud.metastore.v1beta.DataprocMetastore.CreateService]. +message CreateServiceRequest { + // Required. The relative resource name of the location in which to create a + // metastore service, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The ID of the metastore service, which is used as the final + // component of the metastore service's name. + // + // This value must be between 2 and 63 characters long inclusive, begin with a + // letter, end with a letter or number, and consist of alpha-numeric + // ASCII characters or hyphens. + string service_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Metastore service to create. The `name` field is + // ignored. The ID of the created metastore service must be provided in + // the request's `service_id` field. + Service service = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.UpdateService][google.cloud.metastore.v1beta.DataprocMetastore.UpdateService]. +message UpdateServiceRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metastore service resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The metastore service to update. The server only merges fields + // in the service if they are specified in `update_mask`. + // + // The metastore service's `name` field is used to identify the metastore + // service to be updated. + Service service = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.DeleteService][google.cloud.metastore.v1beta.DataprocMetastore.DeleteService]. +message DeleteServiceRequest { + // Required. The relative resource name of the metastore service to delete, in + // the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1beta.DataprocMetastore.ListMetadataImports]. +message ListMetadataImportsRequest { + // Required. The relative resource name of the service whose metadata imports + // to list, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/MetadataImport" + } + ]; + + // Optional. The maximum number of imports to return. The response may contain + // less than the maximum number. If unspecified, no more than 500 imports are + // returned. The maximum value is 1000; values above 1000 are changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + // must match the call that provided the page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1beta.DataprocMetastore.ListMetadataImports]. +message ListMetadataImportsResponse { + // The imports in the specified service. + repeated MetadataImport metadata_imports = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [DataprocMetastore.GetMetadataImport][google.cloud.metastore.v1beta.DataprocMetastore.GetMetadataImport]. +message GetMetadataImportRequest { + // Required. The relative resource name of the metadata import to retrieve, in + // the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/MetadataImport" + } + ]; +} + +// Request message for +// [DataprocMetastore.CreateMetadataImport][google.cloud.metastore.v1beta.DataprocMetastore.CreateMetadataImport]. +message CreateMetadataImportRequest { + // Required. The relative resource name of the service in which to create a + // metastore import, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/MetadataImport" + } + ]; + + // Required. The ID of the metadata import, which is used as the final + // component of the metadata import's name. + // + // This value must be between 1 and 64 characters long, begin with a letter, + // end with a letter or number, and consist of alpha-numeric ASCII characters + // or hyphens. + string metadata_import_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The metadata import to create. The `name` field is ignored. The + // ID of the created metadata import must be provided in the request's + // `metadata_import_id` field. + MetadataImport metadata_import = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.UpdateMetadataImport][google.cloud.metastore.v1beta.DataprocMetastore.UpdateMetadataImport]. +message UpdateMetadataImportRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metadata import resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The metadata import to update. The server only merges fields + // in the import if they are specified in `update_mask`. + // + // The metadata import's `name` field is used to identify the metastore + // import to be updated. + MetadataImport metadata_import = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups]. +message ListBackupsRequest { + // Required. The relative resource name of the service whose backups to + // list, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. The maximum number of backups to return. The response may contain + // less than the maximum number. If unspecified, no more than 500 backups are + // returned. The maximum value is 1000; values above 1000 are changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups] + // must match the call that provided the page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups]. +message ListBackupsResponse { + // The backups of the specified service. + repeated Backup backups = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [DataprocMetastore.GetBackup][google.cloud.metastore.v1beta.DataprocMetastore.GetBackup]. +message GetBackupRequest { + // Required. The relative resource name of the backup to retrieve, in the + // following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; +} + +// Request message for +// [DataprocMetastore.CreateBackup][google.cloud.metastore.v1beta.DataprocMetastore.CreateBackup]. +message CreateBackupRequest { + // Required. The relative resource name of the service in which to create a + // backup of the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Backup" + } + ]; + + // Required. The ID of the backup, which is used as the final component of the + // backup's name. + // + // This value must be between 1 and 64 characters long, begin with a letter, + // end with a letter or number, and consist of alpha-numeric ASCII characters + // or hyphens. + string backup_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The backup to create. The `name` field is ignored. The ID of the + // created backup must be provided in the request's `backup_id` field. + Backup backup = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.DeleteBackup][google.cloud.metastore.v1beta.DataprocMetastore.DeleteBackup]. +message DeleteBackupRequest { + // Required. The relative resource name of the backup to delete, in the + // following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.ExportMetadata][google.cloud.metastore.v1beta.DataprocMetastore.ExportMetadata]. +message ExportMetadataRequest { + // Required. Destination that metadata is exported to. + oneof destination { + // A Cloud Storage URI of a folder, in the format + // `gs:///`. A sub-folder + // `` containing exported files will be created below it. + string destination_gcs_folder = 2; + } + + // Required. The relative resource name of the metastore service to run + // export, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The type of the database dump. If unspecified, defaults to + // `MYSQL`. + DatabaseDumpSpec.Type database_dump_type = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [DataprocMetastore.Restore][]. +message RestoreServiceRequest { + // Required. The relative resource name of the metastore service to run + // restore, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The relative resource name of the metastore service backup to + // restore from, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string backup = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + Restore.RestoreType restore_type = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents the metadata of a long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the caller has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a + // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + // `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Metadata about the service in a location. +message LocationMetadata { + // A specification of a supported version of the Hive Metastore software. + message HiveMetastoreVersion { + // The semantic version of the Hive Metastore software. + string version = 1; + + // Whether `version` will be chosen by the server if a metastore service is + // created with a `HiveMetastoreConfig` that omits the `version`. + bool is_default = 2; + } + + // The versions of Hive Metastore that can be used when creating a new + // metastore service in this location. The server guarantees that exactly one + // `HiveMetastoreVersion` in the list will set `is_default`. + repeated HiveMetastoreVersion supported_hive_metastore_versions = 1; +} + +// The specification of database dump to import from or export to. +message DatabaseDumpSpec { + // The type of the database dump. + enum Type { + // The type of the database dump is unknown. + TYPE_UNSPECIFIED = 0; + + // Database dump is a MySQL dump file. + MYSQL = 1; + + // Database dump contains Avro files. + AVRO = 2; + } +} + +// Request message for +// [DataprocMetastore.RemoveIamPolicy][google.cloud.metastore.v1beta.DataprocMetastore.RemoveIamPolicy]. +message RemoveIamPolicyRequest { + // Required. The relative resource name of the dataplane resource to remove + // IAM policy, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` + // or + // `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. + string resource = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "*" } + ]; + + // Optional. Removes IAM policy attached to database or table asynchronously + // when it is set. The default is false. + bool asynchronous = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [DataprocMetastore.RemoveIamPolicy][google.cloud.metastore.v1beta.DataprocMetastore.RemoveIamPolicy]. +message RemoveIamPolicyResponse { + // True if the policy is successfully removed. + bool success = 1; +} + +// Request message for +// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1beta.DataprocMetastore.QueryMetadata]. +message QueryMetadataRequest { + // Required. The relative resource name of the metastore service to query + // metadata, in the following format: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Required. A read-only SQL query to execute against the metadata database. + // The query cannot change or mutate the data. + string query = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for +// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1beta.DataprocMetastore.QueryMetadata]. +message QueryMetadataResponse { + // The manifest URI is link to a JSON instance in Cloud Storage. + // This instance manifests immediately along with QueryMetadataResponse. The + // content of the URI is not retriable until the long-running operation query + // against the metadata finishes. + string result_manifest_uri = 1; +} + +// Error details in public error message for +// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1beta.DataprocMetastore.QueryMetadata]. +message ErrorDetails { + // Additional structured details about this error. + // + // Keys define the failure items. + // Value describes the exception or details of the item. + map details = 1; +} + +// Request message for +// [DataprocMetastore.MoveTableToDatabase][google.cloud.metastore.v1beta.DataprocMetastore.MoveTableToDatabase]. +message MoveTableToDatabaseRequest { + // Required. The relative resource name of the metastore service to mutate + // metadata, in the following format: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The name of the table to be moved. + string table_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The name of the database where the table resides. + string db_name = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The name of the database where the table should be moved. + string destination_db_name = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for +// [DataprocMetastore.MoveTableToDatabase][google.cloud.metastore.v1beta.DataprocMetastore.MoveTableToDatabase]. +message MoveTableToDatabaseResponse {} + +// Request message for +// [DataprocMetastore.AlterMetadataResourceLocation][google.cloud.metastore.v1beta.DataprocMetastore.AlterMetadataResourceLocation]. +message AlterMetadataResourceLocationRequest { + // Required. The relative resource name of the metastore service to mutate + // metadata, in the following format: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The relative metadata resource name in the following format. + // + // `databases/{database_id}` + // or + // `databases/{database_id}/tables/{table_id}` + // or + // `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + string resource_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The new location URI for the metadata resource. + string location_uri = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for +// [DataprocMetastore.AlterMetadataResourceLocation][google.cloud.metastore.v1beta.DataprocMetastore.AlterMetadataResourceLocation]. +message AlterMetadataResourceLocationResponse {} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore_federation.proto b/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore_federation.proto new file mode 100644 index 00000000000..26bc70e7c4b --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore_federation.proto @@ -0,0 +1,377 @@ +// 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 +// +// 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.metastore.v1beta; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/metastore/v1beta/metastore.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/metastore/apiv1beta/metastorepb;metastorepb"; +option java_multiple_files = true; +option java_outer_classname = "MetastoreFederationProto"; +option java_package = "com.google.cloud.metastore.v1beta"; + +// Configures and manages metastore federation services. +// Dataproc Metastore Federation Service allows federating a collection of +// backend metastores like BigQuery, Dataplex Lakes, and other Dataproc +// Metastores. The Federation Service exposes a gRPC URL through which metadata +// from the backend metastores are served at query time. +// +// The Dataproc Metastore Federation API defines the following resource model: +// * The service works with a collection of Google Cloud projects. +// * Each project has a collection of available locations. +// * Each location has a collection of federations. +// * Dataproc Metastore Federations are resources with names of the +// form: +// `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. +service DataprocMetastoreFederation { + option (google.api.default_host) = "metastore.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists federations in a project and location. + rpc ListFederations(ListFederationsRequest) + returns (ListFederationsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*}/federations" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a single federation. + rpc GetFederation(GetFederationRequest) returns (Federation) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/federations/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a metastore federation in a project and location. + rpc CreateFederation(CreateFederationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*/locations/*}/federations" + body: "federation" + }; + option (google.api.method_signature) = "parent,federation,federation_id"; + option (google.longrunning.operation_info) = { + response_type: "Federation" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Updates the fields of a federation. + rpc UpdateFederation(UpdateFederationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta/{federation.name=projects/*/locations/*/federations/*}" + body: "federation" + }; + option (google.api.method_signature) = "federation,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Federation" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Deletes a single federation. + rpc DeleteFederation(DeleteFederationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta/{name=projects/*/locations/*/federations/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } +} + +// Represents a federation of multiple backend metastores. +message Federation { + option (google.api.resource) = { + type: "metastore.googleapis.com/Federation" + pattern: "projects/{project}/locations/{location}/federations/{federation}" + }; + + // The current state of the federation. + enum State { + // The state of the metastore federation is unknown. + STATE_UNSPECIFIED = 0; + + // The metastore federation is in the process of being created. + CREATING = 1; + + // The metastore federation is running and ready to serve queries. + ACTIVE = 2; + + // The metastore federation is being updated. It remains usable but cannot + // accept additional update requests or be deleted at this time. + UPDATING = 3; + + // The metastore federation is undergoing deletion. It cannot be used. + DELETING = 4; + + // The metastore federation has encountered an error and cannot be used. The + // metastore federation should be deleted. + ERROR = 5; + } + + // Immutable. The relative resource name of the federation, of the + // form: + // projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the metastore federation was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metastore federation was last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-defined labels for the metastore federation. + map labels = 4; + + // Immutable. The Apache Hive metastore version of the federation. All backend + // metastore versions must be compatible with the federation version. + string version = 5 [(google.api.field_behavior) = IMMUTABLE]; + + // A map from `BackendMetastore` rank to `BackendMetastore`s from which the + // federation service serves metadata at query time. The map key represents + // the order in which `BackendMetastore`s should be evaluated to resolve + // database names at query time and should be greater than or equal to zero. A + // `BackendMetastore` with a lower number will be evaluated before a + // `BackendMetastore` with a higher number. + map backend_metastores = 6; + + // Output only. The federation endpoint. + string endpoint_uri = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the federation. + State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current state of the + // metastore federation, if available. + string state_message = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The globally unique resource identifier of the metastore + // federation. + string uid = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents a backend metastore for the federation. +message BackendMetastore { + // The type of the backend metastore. + enum MetastoreType { + // The metastore type is not set. + METASTORE_TYPE_UNSPECIFIED = 0; + + // The backend metastore is Dataplex. + DATAPLEX = 1; + + // The backend metastore is BigQuery. + BIGQUERY = 2; + + // The backend metastore is Dataproc Metastore. + DATAPROC_METASTORE = 3; + } + + // The relative resource name of the metastore that is being federated. + // The formats of the relative resource names for the currently supported + // metastores are listed below: + // + // * BigQuery + // * `projects/{project_id}` + // * Dataproc Metastore + // * `projects/{project_id}/locations/{location}/services/{service_id}` + string name = 1; + + // The type of the backend metastore. + MetastoreType metastore_type = 2; +} + +// Request message for ListFederations. +message ListFederationsRequest { + // Required. The relative resource name of the location of metastore + // federations to list, in the following form: + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Federation" + } + ]; + + // Optional. The maximum number of federations to return. The response may + // contain less than the maximum number. If unspecified, no more than 500 + // services are returned. The maximum value is 1000; values above 1000 are + // changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous ListFederationServices + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // ListFederationServices must match the call that provided the + // page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for ListFederations +message ListFederationsResponse { + // The services in the specified location. + repeated Federation federations = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for GetFederation. +message GetFederationRequest { + // Required. The relative resource name of the metastore federation to + // retrieve, in the following form: + // + // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Federation" + } + ]; +} + +// Request message for CreateFederation. +message CreateFederationRequest { + // Required. The relative resource name of the location in which to create a + // federation service, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Federation" + } + ]; + + // Required. The ID of the metastore federation, which is used as the final + // component of the metastore federation's name. + // + // This value must be between 2 and 63 characters long inclusive, begin with a + // letter, end with a letter or number, and consist of alpha-numeric + // ASCII characters or hyphens. + string federation_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Metastore Federation to create. The `name` field is + // ignored. The ID of the created metastore federation must be + // provided in the request's `federation_id` field. + Federation federation = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for UpdateFederation. +message UpdateFederationRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metastore federation resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The metastore federation to update. The server only merges fields + // in the service if they are specified in `update_mask`. + // + // The metastore federation's `name` field is used to identify the + // metastore service to be updated. + Federation federation = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for DeleteFederation. +message DeleteFederationRequest { + // Required. The relative resource name of the metastore federation to delete, + // in the following form: + // + // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Federation" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.alter_metadata_resource_location.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.alter_metadata_resource_location.js new file mode 100644 index 00000000000..38e953d3de0 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.alter_metadata_resource_location.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(service, resourceName, locationUri) { + // [START metastore_v1beta_generated_DataprocMetastore_AlterMetadataResourceLocation_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 relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Required. The relative metadata resource name in the following format. + * `databases/{database_id}` + * or + * `databases/{database_id}/tables/{table_id}` + * or + * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + */ + // const resourceName = 'abc123' + /** + * Required. The new location URI for the metadata resource. + */ + // const locationUri = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callAlterMetadataResourceLocation() { + // Construct request + const request = { + service, + resourceName, + locationUri, + }; + + // Run request + const [operation] = await metastoreClient.alterMetadataResourceLocation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callAlterMetadataResourceLocation(); + // [END metastore_v1beta_generated_DataprocMetastore_AlterMetadataResourceLocation_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_backup.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_backup.js new file mode 100644 index 00000000000..e1b1491a0d3 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_backup.js @@ -0,0 +1,92 @@ +// 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, backupId, backup) { + // [START metastore_v1beta_generated_DataprocMetastore_CreateBackup_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 relative resource name of the service in which to create a + * backup of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + */ + // const backupId = 'abc123' + /** + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + */ + // const backup = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateBackup() { + // Construct request + const request = { + parent, + backupId, + backup, + }; + + // Run request + const [operation] = await metastoreClient.createBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateBackup(); + // [END metastore_v1beta_generated_DataprocMetastore_CreateBackup_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_metadata_import.js new file mode 100644 index 00000000000..f9a950f4592 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_metadata_import.js @@ -0,0 +1,93 @@ +// 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, metadataImportId, metadataImport) { + // [START metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_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 relative resource name of the service in which to create a + * metastore import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + */ + // const metadataImportId = 'abc123' + /** + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + */ + // const metadataImport = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateMetadataImport() { + // Construct request + const request = { + parent, + metadataImportId, + metadataImport, + }; + + // Run request + const [operation] = await metastoreClient.createMetadataImport(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateMetadataImport(); + // [END metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_service.js new file mode 100644 index 00000000000..0c1b2062b33 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_service.js @@ -0,0 +1,93 @@ +// 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, serviceId, service) { + // [START metastore_v1beta_generated_DataprocMetastore_CreateService_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 relative resource name of the location in which to create a + * metastore service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + */ + // const serviceId = 'abc123' + /** + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + */ + // const service = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateService() { + // Construct request + const request = { + parent, + serviceId, + service, + }; + + // Run request + const [operation] = await metastoreClient.createService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateService(); + // [END metastore_v1beta_generated_DataprocMetastore_CreateService_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_backup.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_backup.js new file mode 100644 index 00000000000..0196cd3b504 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_backup.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(name) { + // [START metastore_v1beta_generated_DataprocMetastore_DeleteBackup_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 relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callDeleteBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteBackup(); + // [END metastore_v1beta_generated_DataprocMetastore_DeleteBackup_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_service.js new file mode 100644 index 00000000000..12ddd0e4aed --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_service.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(name) { + // [START metastore_v1beta_generated_DataprocMetastore_DeleteService_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 relative resource name of the metastore service to delete, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callDeleteService() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteService(); + // [END metastore_v1beta_generated_DataprocMetastore_DeleteService_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.export_metadata.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.export_metadata.js new file mode 100644 index 00000000000..e9238cc82a6 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.export_metadata.js @@ -0,0 +1,88 @@ +// 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(service) { + // [START metastore_v1beta_generated_DataprocMetastore_ExportMetadata_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. + */ + /** + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + */ + // const destinationGcsFolder = 'abc123' + /** + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + */ + // const databaseDumpType = {} + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callExportMetadata() { + // Construct request + const request = { + service, + }; + + // Run request + const [operation] = await metastoreClient.exportMetadata(request); + const [response] = await operation.promise(); + console.log(response); + } + + callExportMetadata(); + // [END metastore_v1beta_generated_DataprocMetastore_ExportMetadata_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_backup.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_backup.js new file mode 100644 index 00000000000..32b40425fb1 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_backup.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 metastore_v1beta_generated_DataprocMetastore_GetBackup_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 relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getBackup(request); + console.log(response); + } + + callGetBackup(); + // [END metastore_v1beta_generated_DataprocMetastore_GetBackup_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_metadata_import.js new file mode 100644 index 00000000000..5b1a4f1dab0 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_metadata_import.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 metastore_v1beta_generated_DataprocMetastore_GetMetadataImport_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 relative resource name of the metadata import to retrieve, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetMetadataImport() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getMetadataImport(request); + console.log(response); + } + + callGetMetadataImport(); + // [END metastore_v1beta_generated_DataprocMetastore_GetMetadataImport_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_service.js new file mode 100644 index 00000000000..29d9d24a065 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_service.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 metastore_v1beta_generated_DataprocMetastore_GetService_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 relative resource name of the metastore service to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetService() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getService(request); + console.log(response); + } + + callGetService(); + // [END metastore_v1beta_generated_DataprocMetastore_GetService_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_backups.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_backups.js new file mode 100644 index 00000000000..4b16fd343db --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_backups.js @@ -0,0 +1,91 @@ +// 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 metastore_v1beta_generated_DataprocMetastore_ListBackups_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 relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous + * DataprocMetastore.ListBackups google.cloud.metastore.v1beta.DataprocMetastore.ListBackups + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListBackups google.cloud.metastore.v1beta.DataprocMetastore.ListBackups + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListBackups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listBackupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBackups(); + // [END metastore_v1beta_generated_DataprocMetastore_ListBackups_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js new file mode 100644 index 00000000000..77aab9b6734 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js @@ -0,0 +1,91 @@ +// 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 metastore_v1beta_generated_DataprocMetastore_ListMetadataImports_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 relative resource name of the service whose metadata imports + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous + * DataprocMetastore.ListServices google.cloud.metastore.v1beta.DataprocMetastore.ListServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListServices google.cloud.metastore.v1beta.DataprocMetastore.ListServices + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListMetadataImports() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listMetadataImportsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMetadataImports(); + // [END metastore_v1beta_generated_DataprocMetastore_ListMetadataImports_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_services.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_services.js new file mode 100644 index 00000000000..82da40a0bf7 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_services.js @@ -0,0 +1,92 @@ +// 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 metastore_v1beta_generated_DataprocMetastore_ListServices_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 relative resource name of the location of metastore services + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous + * DataprocMetastore.ListServices google.cloud.metastore.v1beta.DataprocMetastore.ListServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListServices google.cloud.metastore.v1beta.DataprocMetastore.ListServices + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListServices() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listServicesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListServices(); + // [END metastore_v1beta_generated_DataprocMetastore_ListServices_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.move_table_to_database.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.move_table_to_database.js new file mode 100644 index 00000000000..87c44d71349 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.move_table_to_database.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(service, tableName, dbName, destinationDbName) { + // [START metastore_v1beta_generated_DataprocMetastore_MoveTableToDatabase_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 relative resource name of the metastore service to mutate + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Required. The name of the table to be moved. + */ + // const tableName = 'abc123' + /** + * Required. The name of the database where the table resides. + */ + // const dbName = 'abc123' + /** + * Required. The name of the database where the table should be moved. + */ + // const destinationDbName = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callMoveTableToDatabase() { + // Construct request + const request = { + service, + tableName, + dbName, + destinationDbName, + }; + + // Run request + const [operation] = await metastoreClient.moveTableToDatabase(request); + const [response] = await operation.promise(); + console.log(response); + } + + callMoveTableToDatabase(); + // [END metastore_v1beta_generated_DataprocMetastore_MoveTableToDatabase_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.query_metadata.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.query_metadata.js new file mode 100644 index 00000000000..58c230ba3a8 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.query_metadata.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(service, query) { + // [START metastore_v1beta_generated_DataprocMetastore_QueryMetadata_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 relative resource name of the metastore service to query + * metadata, in the following format: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Required. A read-only SQL query to execute against the metadata database. + * The query cannot change or mutate the data. + */ + // const query = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callQueryMetadata() { + // Construct request + const request = { + service, + query, + }; + + // Run request + const [operation] = await metastoreClient.queryMetadata(request); + const [response] = await operation.promise(); + console.log(response); + } + + callQueryMetadata(); + // [END metastore_v1beta_generated_DataprocMetastore_QueryMetadata_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.remove_iam_policy.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.remove_iam_policy.js new file mode 100644 index 00000000000..a41e69f7ca2 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.remove_iam_policy.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) { + // [START metastore_v1beta_generated_DataprocMetastore_RemoveIamPolicy_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 relative resource name of the dataplane resource to remove + * IAM policy, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` + * or + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. + */ + // const resource = 'abc123' + /** + * Optional. Removes IAM policy attached to database or table asynchronously + * when it is set. The default is false. + */ + // const asynchronous = true + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callRemoveIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await metastoreClient.removeIamPolicy(request); + console.log(response); + } + + callRemoveIamPolicy(); + // [END metastore_v1beta_generated_DataprocMetastore_RemoveIamPolicy_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.restore_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.restore_service.js new file mode 100644 index 00000000000..a136f331f7d --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.restore_service.js @@ -0,0 +1,88 @@ +// 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(service, backup) { + // [START metastore_v1beta_generated_DataprocMetastore_RestoreService_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 relative resource name of the metastore service to run + * restore, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const backup = 'abc123' + /** + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + */ + // const restoreType = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callRestoreService() { + // Construct request + const request = { + service, + backup, + }; + + // Run request + const [operation] = await metastoreClient.restoreService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRestoreService(); + // [END metastore_v1beta_generated_DataprocMetastore_RestoreService_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_metadata_import.js new file mode 100644 index 00000000000..444f7592572 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_metadata_import.js @@ -0,0 +1,86 @@ +// 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(updateMask, metadataImport) { + // [START metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_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. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + */ + // const metadataImport = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callUpdateMetadataImport() { + // Construct request + const request = { + updateMask, + metadataImport, + }; + + // Run request + const [operation] = await metastoreClient.updateMetadataImport(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateMetadataImport(); + // [END metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_service.js new file mode 100644 index 00000000000..425e2be3d1e --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_service.js @@ -0,0 +1,86 @@ +// 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(updateMask, service) { + // [START metastore_v1beta_generated_DataprocMetastore_UpdateService_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. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + */ + // const service = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callUpdateService() { + // Construct request + const request = { + updateMask, + service, + }; + + // Run request + const [operation] = await metastoreClient.updateService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateService(); + // [END metastore_v1beta_generated_DataprocMetastore_UpdateService_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.create_federation.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.create_federation.js new file mode 100644 index 00000000000..62c079f2fc9 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.create_federation.js @@ -0,0 +1,93 @@ +// 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, federationId, federation) { + // [START metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_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 relative resource name of the location in which to create a + * federation service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + */ + // const federationId = 'abc123' + /** + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + */ + // const federation = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callCreateFederation() { + // Construct request + const request = { + parent, + federationId, + federation, + }; + + // Run request + const [operation] = await metastoreClient.createFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFederation(); + // [END metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js new file mode 100644 index 00000000000..34a48faaaaf --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.delete_federation.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(name) { + // [START metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_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 relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callDeleteFederation() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFederation(); + // [END metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.get_federation.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.get_federation.js new file mode 100644 index 00000000000..307b17c5520 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.get_federation.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 metastore_v1beta_generated_DataprocMetastoreFederation_GetFederation_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 relative resource name of the metastore federation to + * retrieve, in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callGetFederation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getFederation(request); + console.log(response); + } + + callGetFederation(); + // [END metastore_v1beta_generated_DataprocMetastoreFederation_GetFederation_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.list_federations.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.list_federations.js new file mode 100644 index 00000000000..3bea1d7fa6f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.list_federations.js @@ -0,0 +1,91 @@ +// 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 metastore_v1beta_generated_DataprocMetastoreFederation_ListFederations_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 relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callListFederations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listFederationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFederations(); + // [END metastore_v1beta_generated_DataprocMetastoreFederation_ListFederations_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.update_federation.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.update_federation.js new file mode 100644 index 00000000000..7f5e7c4e1bb --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.update_federation.js @@ -0,0 +1,86 @@ +// 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(updateMask, federation) { + // [START metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_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. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + */ + // const federation = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callUpdateFederation() { + // Construct request + const request = { + updateMask, + federation, + }; + + // Run request + const [operation] = await metastoreClient.updateFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFederation(); + // [END metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_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-metastore/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.metastore.v1beta.json b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.metastore.v1beta.json new file mode 100644 index 00000000000..efc6983feb1 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.metastore.v1beta.json @@ -0,0 +1,1175 @@ +{ + "clientLibrary": { + "name": "nodejs-metastore", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.metastore.v1beta", + "version": "v1beta" + } + ] + }, + "snippets": [ + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_ListServices_async", + "title": "DataprocMetastore listServices Sample", + "origin": "API_DEFINITION", + "description": " Lists services in a project and location.", + "canonical": true, + "file": "dataproc_metastore.list_services.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServices", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListServices", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1beta.ListServicesResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListServices", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListServices", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_GetService_async", + "title": "DataprocMetastore getService Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a single service.", + "canonical": true, + "file": "dataproc_metastore.get_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetService", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1beta.Service", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_CreateService_async", + "title": "DataprocMetastore createService Sample", + "origin": "API_DEFINITION", + "description": " Creates a metastore service in a project and location.", + "canonical": true, + "file": "dataproc_metastore.create_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateService", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "service_id", + "type": "TYPE_STRING" + }, + { + "name": "service", + "type": ".google.cloud.metastore.v1beta.Service" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_UpdateService_async", + "title": "DataprocMetastore updateService Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a single service.", + "canonical": true, + "file": "dataproc_metastore.update_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.UpdateService", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "service", + "type": ".google.cloud.metastore.v1beta.Service" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "UpdateService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.UpdateService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_DeleteService_async", + "title": "DataprocMetastore deleteService Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single service.", + "canonical": true, + "file": "dataproc_metastore.delete_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.DeleteService", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "DeleteService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.DeleteService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_ListMetadataImports_async", + "title": "DataprocMetastore listMetadataImports Sample", + "origin": "API_DEFINITION", + "description": " Lists imports in a service.", + "canonical": true, + "file": "dataproc_metastore.list_metadata_imports.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMetadataImports", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListMetadataImports", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1beta.ListMetadataImportsResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListMetadataImports", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListMetadataImports", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_GetMetadataImport_async", + "title": "DataprocMetastore getMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single import.", + "canonical": true, + "file": "dataproc_metastore.get_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetMetadataImport", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetMetadataImport", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1beta.MetadataImport", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetMetadataImport", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_async", + "title": "DataprocMetastore createMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Creates a new MetadataImport in a given project and location.", + "canonical": true, + "file": "dataproc_metastore.create_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateMetadataImport", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateMetadataImport", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "metadata_import_id", + "type": "TYPE_STRING" + }, + { + "name": "metadata_import", + "type": ".google.cloud.metastore.v1beta.MetadataImport" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateMetadataImport", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_async", + "title": "DataprocMetastore updateMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Updates a single import. Only the description field of MetadataImport is supported to be updated.", + "canonical": true, + "file": "dataproc_metastore.update_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateMetadataImport", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.UpdateMetadataImport", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "metadata_import", + "type": ".google.cloud.metastore.v1beta.MetadataImport" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "UpdateMetadataImport", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.UpdateMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_ExportMetadata_async", + "title": "DataprocMetastore exportMetadata Sample", + "origin": "API_DEFINITION", + "description": " Exports metadata from a service.", + "canonical": true, + "file": "dataproc_metastore.export_metadata.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ExportMetadata", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ExportMetadata", + "async": true, + "parameters": [ + { + "name": "destination_gcs_folder", + "type": "TYPE_STRING" + }, + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "database_dump_type", + "type": ".google.cloud.metastore.v1beta.DatabaseDumpSpec.Type" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "ExportMetadata", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ExportMetadata", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_RestoreService_async", + "title": "DataprocMetastore restoreService Sample", + "origin": "API_DEFINITION", + "description": " Restores a service from a backup.", + "canonical": true, + "file": "dataproc_metastore.restore_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.RestoreService", + "async": true, + "parameters": [ + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": "TYPE_STRING" + }, + { + "name": "restore_type", + "type": ".google.cloud.metastore.v1beta.Restore.RestoreType" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "RestoreService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.RestoreService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_ListBackups_async", + "title": "DataprocMetastore listBackups Sample", + "origin": "API_DEFINITION", + "description": " Lists backups in a service.", + "canonical": true, + "file": "dataproc_metastore.list_backups.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBackups", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListBackups", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1beta.ListBackupsResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListBackups", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListBackups", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_GetBackup_async", + "title": "DataprocMetastore getBackup Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single backup.", + "canonical": true, + "file": "dataproc_metastore.get_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBackup", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1beta.Backup", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetBackup", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_CreateBackup_async", + "title": "DataprocMetastore createBackup Sample", + "origin": "API_DEFINITION", + "description": " Creates a new backup in a given project and location.", + "canonical": true, + "file": "dataproc_metastore.create_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBackup", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateBackup", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "backup_id", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": ".google.cloud.metastore.v1beta.Backup" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateBackup", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_DeleteBackup_async", + "title": "DataprocMetastore deleteBackup Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single backup.", + "canonical": true, + "file": "dataproc_metastore.delete_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.DeleteBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.DeleteBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_RemoveIamPolicy_async", + "title": "DataprocMetastore removeIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Removes the attached IAM policies for a resource", + "canonical": true, + "file": "dataproc_metastore.remove_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveIamPolicy", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.RemoveIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "asynchronous", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.metastore.v1beta.RemoveIamPolicyResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "RemoveIamPolicy", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.RemoveIamPolicy", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_QueryMetadata_async", + "title": "DataprocMetastore queryMetadata Sample", + "origin": "API_DEFINITION", + "description": " Query DPMS metadata.", + "canonical": true, + "file": "dataproc_metastore.query_metadata.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "QueryMetadata", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.QueryMetadata", + "async": true, + "parameters": [ + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "QueryMetadata", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.QueryMetadata", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_MoveTableToDatabase_async", + "title": "DataprocMetastore moveTableToDatabase Sample", + "origin": "API_DEFINITION", + "description": " Move a table to another database.", + "canonical": true, + "file": "dataproc_metastore.move_table_to_database.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "MoveTableToDatabase", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.MoveTableToDatabase", + "async": true, + "parameters": [ + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "table_name", + "type": "TYPE_STRING" + }, + { + "name": "db_name", + "type": "TYPE_STRING" + }, + { + "name": "destination_db_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "MoveTableToDatabase", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.MoveTableToDatabase", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_AlterMetadataResourceLocation_async", + "title": "DataprocMetastore alterMetadataResourceLocation Sample", + "origin": "API_DEFINITION", + "description": " Alter metadata resource location. The metadata resource can be a database, table, or partition. This functionality only updates the parent directory for the respective metadata resource and does not transfer any existing data to the new location.", + "canonical": true, + "file": "dataproc_metastore.alter_metadata_resource_location.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AlterMetadataResourceLocation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.AlterMetadataResourceLocation", + "async": true, + "parameters": [ + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "resource_name", + "type": "TYPE_STRING" + }, + { + "name": "location_uri", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "AlterMetadataResourceLocation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.AlterMetadataResourceLocation", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_ListFederations_async", + "title": "DataprocMetastore listFederations Sample", + "origin": "API_DEFINITION", + "description": " Lists federations in a project and location.", + "canonical": true, + "file": "dataproc_metastore_federation.list_federations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFederations", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.ListFederations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1beta.ListFederationsResponse", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "ListFederations", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.ListFederations", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_GetFederation_async", + "title": "DataprocMetastore getFederation Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a single federation.", + "canonical": true, + "file": "dataproc_metastore_federation.get_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.GetFederation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1beta.Federation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "GetFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.GetFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_async", + "title": "DataprocMetastore createFederation Sample", + "origin": "API_DEFINITION", + "description": " Creates a metastore federation in a project and location.", + "canonical": true, + "file": "dataproc_metastore_federation.create_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.CreateFederation", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "federation_id", + "type": "TYPE_STRING" + }, + { + "name": "federation", + "type": ".google.cloud.metastore.v1beta.Federation" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "CreateFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.CreateFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_async", + "title": "DataprocMetastore updateFederation Sample", + "origin": "API_DEFINITION", + "description": " Updates the fields of a federation.", + "canonical": true, + "file": "dataproc_metastore_federation.update_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.UpdateFederation", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "federation", + "type": ".google.cloud.metastore.v1beta.Federation" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "UpdateFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.UpdateFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_async", + "title": "DataprocMetastore deleteFederation Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single federation.", + "canonical": true, + "file": "dataproc_metastore_federation.delete_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.DeleteFederation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "DeleteFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.DeleteFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1beta/src/index.ts new file mode 100644 index 00000000000..e31d0dee438 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/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 v1beta from './v1beta'; +const DataprocMetastoreClient = v1beta.DataprocMetastoreClient; +type DataprocMetastoreClient = v1beta.DataprocMetastoreClient; +const DataprocMetastoreFederationClient = v1beta.DataprocMetastoreFederationClient; +type DataprocMetastoreFederationClient = v1beta.DataprocMetastoreFederationClient; +export {v1beta, DataprocMetastoreClient, DataprocMetastoreFederationClient}; +export default {v1beta, DataprocMetastoreClient, DataprocMetastoreFederationClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client.ts b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client.ts new file mode 100644 index 00000000000..777f3bcf8f6 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client.ts @@ -0,0 +1,3539 @@ +// 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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta/dataproc_metastore_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './dataproc_metastore_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Configures and manages metastore services. + * Metastore services are fully managed, highly available, autoscaled, + * autohealing, OSS-native deployments of technical metadata management + * software. Each metastore service exposes a network endpoint through which + * metadata queries are served. Metadata queries can originate from a variety + * of sources, including Apache Hive, Apache Presto, and Apache Spark. + * + * The Dataproc Metastore API defines the following resource model: + * + * * The service works with a collection of Google Cloud projects, named: + * `/projects/*` + * * Each project has a collection of available locations, named: `/locations/*` + * (a location must refer to a Google Cloud `region`) + * * Each location has a collection of services, named: `/services/*` + * * Dataproc Metastore services are resources with names of the form: + * + * `/projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @class + * @memberof v1beta + */ +export class DataprocMetastoreClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + dataprocMetastoreStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DataprocMetastoreClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 DataprocMetastoreClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof DataprocMetastoreClient; + 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; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + 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 = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' + ), + federationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/federations/{federation}' + ), + lakePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/lakes/{lake}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + metadataImportPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' + ), + networkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/global/networks/{network}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listServices: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'services'), + listMetadataImports: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metadataImports'), + listBackups: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.Service') as gax.protobuf.Type; + const createServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const updateServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.Service') as gax.protobuf.Type; + const updateServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const deleteServiceResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const createMetadataImportResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.MetadataImport') as gax.protobuf.Type; + const createMetadataImportMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const updateMetadataImportResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.MetadataImport') as gax.protobuf.Type; + const updateMetadataImportMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const exportMetadataResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.MetadataExport') as gax.protobuf.Type; + const exportMetadataMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const restoreServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.Restore') as gax.protobuf.Type; + const restoreServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const createBackupResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.Backup') as gax.protobuf.Type; + const createBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const deleteBackupResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const queryMetadataResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.QueryMetadataResponse') as gax.protobuf.Type; + const queryMetadataMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const moveTableToDatabaseResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.MoveTableToDatabaseResponse') as gax.protobuf.Type; + const moveTableToDatabaseMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const alterMetadataResourceLocationResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.AlterMetadataResourceLocationResponse') as gax.protobuf.Type; + const alterMetadataResourceLocationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createServiceResponse.decode.bind(createServiceResponse), + createServiceMetadata.decode.bind(createServiceMetadata)), + updateService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateServiceResponse.decode.bind(updateServiceResponse), + updateServiceMetadata.decode.bind(updateServiceMetadata)), + deleteService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteServiceResponse.decode.bind(deleteServiceResponse), + deleteServiceMetadata.decode.bind(deleteServiceMetadata)), + createMetadataImport: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createMetadataImportResponse.decode.bind(createMetadataImportResponse), + createMetadataImportMetadata.decode.bind(createMetadataImportMetadata)), + updateMetadataImport: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateMetadataImportResponse.decode.bind(updateMetadataImportResponse), + updateMetadataImportMetadata.decode.bind(updateMetadataImportMetadata)), + exportMetadata: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportMetadataResponse.decode.bind(exportMetadataResponse), + exportMetadataMetadata.decode.bind(exportMetadataMetadata)), + restoreService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + restoreServiceResponse.decode.bind(restoreServiceResponse), + restoreServiceMetadata.decode.bind(restoreServiceMetadata)), + createBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBackupResponse.decode.bind(createBackupResponse), + createBackupMetadata.decode.bind(createBackupMetadata)), + deleteBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteBackupResponse.decode.bind(deleteBackupResponse), + deleteBackupMetadata.decode.bind(deleteBackupMetadata)), + queryMetadata: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + queryMetadataResponse.decode.bind(queryMetadataResponse), + queryMetadataMetadata.decode.bind(queryMetadataMetadata)), + moveTableToDatabase: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + moveTableToDatabaseResponse.decode.bind(moveTableToDatabaseResponse), + moveTableToDatabaseMetadata.decode.bind(moveTableToDatabaseMetadata)), + alterMetadataResourceLocation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + alterMetadataResourceLocationResponse.decode.bind(alterMetadataResourceLocationResponse), + alterMetadataResourceLocationMetadata.decode.bind(alterMetadataResourceLocationMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.metastore.v1beta.DataprocMetastore', 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.dataprocMetastoreStub) { + return this.dataprocMetastoreStub; + } + + // Put together the "service stub" for + // google.cloud.metastore.v1beta.DataprocMetastore. + this.dataprocMetastoreStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1beta.DataprocMetastore') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.metastore.v1beta.DataprocMetastore, + 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 dataprocMetastoreStubMethods = + ['listServices', 'getService', 'createService', 'updateService', 'deleteService', 'listMetadataImports', 'getMetadataImport', 'createMetadataImport', 'updateMetadataImport', 'exportMetadata', 'restoreService', 'listBackups', 'getBackup', 'createBackup', 'deleteBackup', 'removeIamPolicy', 'queryMetadata', 'moveTableToDatabase', 'alterMetadataResourceLocation']; + for (const methodName of dataprocMetastoreStubMethods) { + const callPromise = this.dataprocMetastoreStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.dataprocMetastoreStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'metastore.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 'metastore.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 -- + // ------------------- +/** + * Gets the details of a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.metastore.v1beta.Service|Service}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.get_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_GetService_async + */ + getService( + request?: protos.google.cloud.metastore.v1beta.IGetServiceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1beta.IService, + protos.google.cloud.metastore.v1beta.IGetServiceRequest|undefined, {}|undefined + ]>; + getService( + request: protos.google.cloud.metastore.v1beta.IGetServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1beta.IService, + protos.google.cloud.metastore.v1beta.IGetServiceRequest|null|undefined, + {}|null|undefined>): void; + getService( + request: protos.google.cloud.metastore.v1beta.IGetServiceRequest, + callback: Callback< + protos.google.cloud.metastore.v1beta.IService, + protos.google.cloud.metastore.v1beta.IGetServiceRequest|null|undefined, + {}|null|undefined>): void; + getService( + request?: protos.google.cloud.metastore.v1beta.IGetServiceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1beta.IService, + protos.google.cloud.metastore.v1beta.IGetServiceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1beta.IService, + protos.google.cloud.metastore.v1beta.IGetServiceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1beta.IService, + protos.google.cloud.metastore.v1beta.IGetServiceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getService(request, options, callback); + } +/** + * Gets details of a single import. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_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 protos.google.cloud.metastore.v1beta.MetadataImport|MetadataImport}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.get_metadata_import.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_GetMetadataImport_async + */ + getMetadataImport( + request?: protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1beta.IMetadataImport, + protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|undefined, {}|undefined + ]>; + getMetadataImport( + request: protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1beta.IMetadataImport, + protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): void; + getMetadataImport( + request: protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest, + callback: Callback< + protos.google.cloud.metastore.v1beta.IMetadataImport, + protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): void; + getMetadataImport( + request?: protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1beta.IMetadataImport, + protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1beta.IMetadataImport, + protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1beta.IMetadataImport, + protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|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.getMetadataImport(request, options, callback); + } +/** + * Gets details of a single backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the backup to retrieve, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_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 protos.google.cloud.metastore.v1beta.Backup|Backup}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.get_backup.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_GetBackup_async + */ + getBackup( + request?: protos.google.cloud.metastore.v1beta.IGetBackupRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1beta.IBackup, + protos.google.cloud.metastore.v1beta.IGetBackupRequest|undefined, {}|undefined + ]>; + getBackup( + request: protos.google.cloud.metastore.v1beta.IGetBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1beta.IBackup, + protos.google.cloud.metastore.v1beta.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request: protos.google.cloud.metastore.v1beta.IGetBackupRequest, + callback: Callback< + protos.google.cloud.metastore.v1beta.IBackup, + protos.google.cloud.metastore.v1beta.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request?: protos.google.cloud.metastore.v1beta.IGetBackupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1beta.IBackup, + protos.google.cloud.metastore.v1beta.IGetBackupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1beta.IBackup, + protos.google.cloud.metastore.v1beta.IGetBackupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1beta.IBackup, + protos.google.cloud.metastore.v1beta.IGetBackupRequest|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.getBackup(request, options, callback); + } +/** + * Removes the attached IAM policies for a resource + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * Required. The relative resource name of the dataplane resource to remove + * IAM policy, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` + * or + * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. + * @param {boolean} [request.asynchronous] + * Optional. Removes IAM policy attached to database or table asynchronously + * when it is set. The default is false. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.metastore.v1beta.RemoveIamPolicyResponse|RemoveIamPolicyResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.remove_iam_policy.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_RemoveIamPolicy_async + */ + removeIamPolicy( + request?: protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1beta.IRemoveIamPolicyResponse, + protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest|undefined, {}|undefined + ]>; + removeIamPolicy( + request: protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1beta.IRemoveIamPolicyResponse, + protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + removeIamPolicy( + request: protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest, + callback: Callback< + protos.google.cloud.metastore.v1beta.IRemoveIamPolicyResponse, + protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + removeIamPolicy( + request?: protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1beta.IRemoveIamPolicyResponse, + protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1beta.IRemoveIamPolicyResponse, + protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1beta.IRemoveIamPolicyResponse, + protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest|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.removeIamPolicy(request, options, callback); + } + +/** + * Creates a metastore service in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {string} request.serviceId + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param {google.cloud.metastore.v1beta.Service} request.service + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.create_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateService_async + */ + createService( + request?: protos.google.cloud.metastore.v1beta.ICreateServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createService( + request: protos.google.cloud.metastore.v1beta.ICreateServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createService( + request: protos.google.cloud.metastore.v1beta.ICreateServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createService( + request?: protos.google.cloud.metastore.v1beta.ICreateServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.create_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateService_async + */ + async checkCreateServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the parameters of a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1beta.Service} request.service + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.update_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_UpdateService_async + */ + updateService( + request?: protos.google.cloud.metastore.v1beta.IUpdateServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateService( + request: protos.google.cloud.metastore.v1beta.IUpdateServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateService( + request: protos.google.cloud.metastore.v1beta.IUpdateServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateService( + request?: protos.google.cloud.metastore.v1beta.IUpdateServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service.name': request.service!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.update_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_UpdateService_async + */ + async checkUpdateServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore service to delete, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.delete_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_DeleteService_async + */ + deleteService( + request?: protos.google.cloud.metastore.v1beta.IDeleteServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteService( + request: protos.google.cloud.metastore.v1beta.IDeleteServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteService( + request: protos.google.cloud.metastore.v1beta.IDeleteServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteService( + request?: protos.google.cloud.metastore.v1beta.IDeleteServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.delete_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_DeleteService_async + */ + async checkDeleteServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new MetadataImport in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} request.metadataImportId + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param {google.cloud.metastore.v1beta.MetadataImport} request.metadataImport + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.create_metadata_import.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_async + */ + createMetadataImport( + request?: protos.google.cloud.metastore.v1beta.ICreateMetadataImportRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createMetadataImport( + request: protos.google.cloud.metastore.v1beta.ICreateMetadataImportRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMetadataImport( + request: protos.google.cloud.metastore.v1beta.ICreateMetadataImportRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMetadataImport( + request?: protos.google.cloud.metastore.v1beta.ICreateMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createMetadataImport(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createMetadataImport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.create_metadata_import.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_async + */ + async checkCreateMetadataImportProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMetadataImport, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates a single import. + * Only the description field of MetadataImport is supported to be updated. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1beta.MetadataImport} request.metadataImport + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.update_metadata_import.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_async + */ + updateMetadataImport( + request?: protos.google.cloud.metastore.v1beta.IUpdateMetadataImportRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateMetadataImport( + request: protos.google.cloud.metastore.v1beta.IUpdateMetadataImportRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMetadataImport( + request: protos.google.cloud.metastore.v1beta.IUpdateMetadataImportRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMetadataImport( + request?: protos.google.cloud.metastore.v1beta.IUpdateMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'metadata_import.name': request.metadataImport!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateMetadataImport(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateMetadataImport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.update_metadata_import.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_async + */ + async checkUpdateMetadataImportProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMetadataImport, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Exports metadata from a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.destinationGcsFolder + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * @param {string} request.service + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {google.cloud.metastore.v1beta.DatabaseDumpSpec.Type} [request.databaseDumpType] + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.export_metadata.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_ExportMetadata_async + */ + exportMetadata( + request?: protos.google.cloud.metastore.v1beta.IExportMetadataRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + exportMetadata( + request: protos.google.cloud.metastore.v1beta.IExportMetadataRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportMetadata( + request: protos.google.cloud.metastore.v1beta.IExportMetadataRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportMetadata( + request?: protos.google.cloud.metastore.v1beta.IExportMetadataRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.exportMetadata(request, options, callback); + } +/** + * Check the status of the long running operation returned by `exportMetadata()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.export_metadata.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_ExportMetadata_async + */ + async checkExportMetadataProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportMetadata, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Restores a service from a backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.service + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} request.backup + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param {google.cloud.metastore.v1beta.Restore.RestoreType} [request.restoreType] + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.restore_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_RestoreService_async + */ + restoreService( + request?: protos.google.cloud.metastore.v1beta.IRestoreServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + restoreService( + request: protos.google.cloud.metastore.v1beta.IRestoreServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreService( + request: protos.google.cloud.metastore.v1beta.IRestoreServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreService( + request?: protos.google.cloud.metastore.v1beta.IRestoreServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.restoreService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `restoreService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.restore_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_RestoreService_async + */ + async checkRestoreServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new backup in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service in which to create a + * backup of the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} request.backupId + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param {google.cloud.metastore.v1beta.Backup} request.backup + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.create_backup.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateBackup_async + */ + createBackup( + request?: protos.google.cloud.metastore.v1beta.ICreateBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createBackup( + request: protos.google.cloud.metastore.v1beta.ICreateBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request: protos.google.cloud.metastore.v1beta.ICreateBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request?: protos.google.cloud.metastore.v1beta.ICreateBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.create_backup.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateBackup_async + */ + async checkCreateBackupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the backup to delete, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.delete_backup.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_DeleteBackup_async + */ + deleteBackup( + request?: protos.google.cloud.metastore.v1beta.IDeleteBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteBackup( + request: protos.google.cloud.metastore.v1beta.IDeleteBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request: protos.google.cloud.metastore.v1beta.IDeleteBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request?: protos.google.cloud.metastore.v1beta.IDeleteBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.delete_backup.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_DeleteBackup_async + */ + async checkDeleteBackupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteBackup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Query DPMS metadata. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.service + * Required. The relative resource name of the metastore service to query + * metadata, in the following format: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} request.query + * Required. A read-only SQL query to execute against the metadata database. + * The query cannot change or mutate the data. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.query_metadata.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_QueryMetadata_async + */ + queryMetadata( + request?: protos.google.cloud.metastore.v1beta.IQueryMetadataRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + queryMetadata( + request: protos.google.cloud.metastore.v1beta.IQueryMetadataRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + queryMetadata( + request: protos.google.cloud.metastore.v1beta.IQueryMetadataRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + queryMetadata( + request?: protos.google.cloud.metastore.v1beta.IQueryMetadataRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.queryMetadata(request, options, callback); + } +/** + * Check the status of the long running operation returned by `queryMetadata()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.query_metadata.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_QueryMetadata_async + */ + async checkQueryMetadataProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.queryMetadata, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Move a table to another database. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.service + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} request.tableName + * Required. The name of the table to be moved. + * @param {string} request.dbName + * Required. The name of the database where the table resides. + * @param {string} request.destinationDbName + * Required. The name of the database where the table should be moved. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.move_table_to_database.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_MoveTableToDatabase_async + */ + moveTableToDatabase( + request?: protos.google.cloud.metastore.v1beta.IMoveTableToDatabaseRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + moveTableToDatabase( + request: protos.google.cloud.metastore.v1beta.IMoveTableToDatabaseRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + moveTableToDatabase( + request: protos.google.cloud.metastore.v1beta.IMoveTableToDatabaseRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + moveTableToDatabase( + request?: protos.google.cloud.metastore.v1beta.IMoveTableToDatabaseRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.moveTableToDatabase(request, options, callback); + } +/** + * Check the status of the long running operation returned by `moveTableToDatabase()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.move_table_to_database.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_MoveTableToDatabase_async + */ + async checkMoveTableToDatabaseProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.moveTableToDatabase, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Alter metadata resource location. The metadata resource can be a database, + * table, or partition. This functionality only updates the parent directory + * for the respective metadata resource and does not transfer any existing + * data to the new location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.service + * Required. The relative resource name of the metastore service to mutate + * metadata, in the following format: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} request.resourceName + * Required. The relative metadata resource name in the following format. + * + * `databases/{database_id}` + * or + * `databases/{database_id}/tables/{table_id}` + * or + * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` + * @param {string} request.locationUri + * Required. The new location URI for the metadata 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.alter_metadata_resource_location.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_AlterMetadataResourceLocation_async + */ + alterMetadataResourceLocation( + request?: protos.google.cloud.metastore.v1beta.IAlterMetadataResourceLocationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + alterMetadataResourceLocation( + request: protos.google.cloud.metastore.v1beta.IAlterMetadataResourceLocationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + alterMetadataResourceLocation( + request: protos.google.cloud.metastore.v1beta.IAlterMetadataResourceLocationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + alterMetadataResourceLocation( + request?: protos.google.cloud.metastore.v1beta.IAlterMetadataResourceLocationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.alterMetadataResourceLocation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `alterMetadataResourceLocation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.alter_metadata_resource_location.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_AlterMetadataResourceLocation_async + */ + async checkAlterMetadataResourceLocationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.alterMetadataResourceLocation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists services in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1beta.Service|Service}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listServicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listServices( + request?: protos.google.cloud.metastore.v1beta.IListServicesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1beta.IService[], + protos.google.cloud.metastore.v1beta.IListServicesRequest|null, + protos.google.cloud.metastore.v1beta.IListServicesResponse + ]>; + listServices( + request: protos.google.cloud.metastore.v1beta.IListServicesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListServicesRequest, + protos.google.cloud.metastore.v1beta.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IService>): void; + listServices( + request: protos.google.cloud.metastore.v1beta.IListServicesRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListServicesRequest, + protos.google.cloud.metastore.v1beta.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IService>): void; + listServices( + request?: protos.google.cloud.metastore.v1beta.IListServicesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1beta.IListServicesRequest, + protos.google.cloud.metastore.v1beta.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IService>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListServicesRequest, + protos.google.cloud.metastore.v1beta.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IService>): + Promise<[ + protos.google.cloud.metastore.v1beta.IService[], + protos.google.cloud.metastore.v1beta.IListServicesRequest|null, + protos.google.cloud.metastore.v1beta.IListServicesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listServices(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 protos.google.cloud.metastore.v1beta.Service|Service} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listServicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listServicesStream( + request?: protos.google.cloud.metastore.v1beta.IListServicesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listServices']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServices.createStream( + this.innerApiCalls.listServices as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listServices`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.metastore.v1beta.Service|Service}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.list_services.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_ListServices_async + */ + listServicesAsync( + request?: protos.google.cloud.metastore.v1beta.IListServicesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listServices']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServices.asyncIterate( + this.innerApiCalls['listServices'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists imports in a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1beta.MetadataImport|MetadataImport}. + * 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 `listMetadataImportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMetadataImports( + request?: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1beta.IMetadataImport[], + protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest|null, + protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse + ]>; + listMetadataImports( + request: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IMetadataImport>): void; + listMetadataImports( + request: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IMetadataImport>): void; + listMetadataImports( + request?: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IMetadataImport>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IMetadataImport>): + Promise<[ + protos.google.cloud.metastore.v1beta.IMetadataImport[], + protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest|null, + protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listMetadataImports(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 protos.google.cloud.metastore.v1beta.MetadataImport|MetadataImport} 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 `listMetadataImportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMetadataImportsStream( + request?: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + 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['listMetadataImports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMetadataImports.createStream( + this.innerApiCalls.listMetadataImports as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMetadataImports`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.metastore.v1beta.MetadataImport|MetadataImport}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_ListMetadataImports_async + */ + listMetadataImportsAsync( + request?: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + 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['listMetadataImports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMetadataImports.asyncIterate( + this.innerApiCalls['listMetadataImports'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists backups in a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1beta.Backup|Backup}. + * 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 `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBackups( + request?: protos.google.cloud.metastore.v1beta.IListBackupsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1beta.IBackup[], + protos.google.cloud.metastore.v1beta.IListBackupsRequest|null, + protos.google.cloud.metastore.v1beta.IListBackupsResponse + ]>; + listBackups( + request: protos.google.cloud.metastore.v1beta.IListBackupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListBackupsRequest, + protos.google.cloud.metastore.v1beta.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IBackup>): void; + listBackups( + request: protos.google.cloud.metastore.v1beta.IListBackupsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListBackupsRequest, + protos.google.cloud.metastore.v1beta.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IBackup>): void; + listBackups( + request?: protos.google.cloud.metastore.v1beta.IListBackupsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1beta.IListBackupsRequest, + protos.google.cloud.metastore.v1beta.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IBackup>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListBackupsRequest, + protos.google.cloud.metastore.v1beta.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IBackup>): + Promise<[ + protos.google.cloud.metastore.v1beta.IBackup[], + protos.google.cloud.metastore.v1beta.IListBackupsRequest|null, + protos.google.cloud.metastore.v1beta.IListBackupsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listBackups(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 protos.google.cloud.metastore.v1beta.Backup|Backup} 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 `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBackupsStream( + request?: protos.google.cloud.metastore.v1beta.IListBackupsRequest, + 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['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.createStream( + this.innerApiCalls.listBackups as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBackups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.metastore.v1beta.Backup|Backup}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.list_backups.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_ListBackups_async + */ + listBackupsAsync( + request?: protos.google.cloud.metastore.v1beta.IListBackupsRequest, + 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['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.asyncIterate( + this.innerApiCalls['listBackups'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,location:string,service:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + service: service, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the service from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the service. + */ + matchServiceFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).service; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified federation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} federation + * @returns {string} Resource name string. + */ + federationPath(project:string,location:string,federation:string) { + return this.pathTemplates.federationPathTemplate.render({ + project: project, + location: location, + federation: federation, + }); + } + + /** + * Parse the project from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).project; + } + + /** + * Parse the location from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).location; + } + + /** + * Parse the federation from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the federation. + */ + matchFederationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).federation; + } + + /** + * Return a fully-qualified lake resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} lake + * @returns {string} Resource name string. + */ + lakePath(project:string,location:string,lake:string) { + return this.pathTemplates.lakePathTemplate.render({ + project: project, + location: location, + lake: lake, + }); + } + + /** + * Parse the project from Lake resource. + * + * @param {string} lakeName + * A fully-qualified path representing Lake resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLakeName(lakeName: string) { + return this.pathTemplates.lakePathTemplate.match(lakeName).project; + } + + /** + * Parse the location from Lake resource. + * + * @param {string} lakeName + * A fully-qualified path representing Lake resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLakeName(lakeName: string) { + return this.pathTemplates.lakePathTemplate.match(lakeName).location; + } + + /** + * Parse the lake from Lake resource. + * + * @param {string} lakeName + * A fully-qualified path representing Lake resource. + * @returns {string} A string representing the lake. + */ + matchLakeFromLakeName(lakeName: string) { + return this.pathTemplates.lakePathTemplate.match(lakeName).lake; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified metadataImport resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} metadata_import + * @returns {string} Resource name string. + */ + metadataImportPath(project:string,location:string,service:string,metadataImport:string) { + return this.pathTemplates.metadataImportPathTemplate.render({ + project: project, + location: location, + service: service, + metadata_import: metadataImport, + }); + } + + /** + * Parse the project from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; + } + + /** + * Parse the location from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; + } + + /** + * Parse the service from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the service. + */ + matchServiceFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; + } + + /** + * Parse the metadata_import from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the metadata_import. + */ + matchMetadataImportFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; + } + + /** + * Return a fully-qualified network resource name string. + * + * @param {string} project + * @param {string} network + * @returns {string} Resource name string. + */ + networkPath(project:string,network:string) { + return this.pathTemplates.networkPathTemplate.render({ + project: project, + network: network, + }); + } + + /** + * Parse the project from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).project; + } + + /** + * Parse the network from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the network. + */ + matchNetworkFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).network; + } + + /** + * 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 service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * 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.dataprocMetastoreStub && !this._terminated) { + return this.dataprocMetastoreStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client_config.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client_config.json new file mode 100644 index 00000000000..fd4e34e7f36 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client_config.json @@ -0,0 +1,133 @@ +{ + "interfaces": { + "google.cloud.metastore.v1beta.DataprocMetastore": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListServices": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetService": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListMetadataImports": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ExportMetadata": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RestoreService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RemoveIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "QueryMetadata": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "MoveTableToDatabase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "AlterMetadataResourceLocation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client.ts b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client.ts new file mode 100644 index 00000000000..54f736af14d --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client.ts @@ -0,0 +1,1714 @@ +// 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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta/dataproc_metastore_federation_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './dataproc_metastore_federation_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Configures and manages metastore federation services. + * Dataproc Metastore Federation Service allows federating a collection of + * backend metastores like BigQuery, Dataplex Lakes, and other Dataproc + * Metastores. The Federation Service exposes a gRPC URL through which metadata + * from the backend metastores are served at query time. + * + * The Dataproc Metastore Federation API defines the following resource model: + * * The service works with a collection of Google Cloud projects. + * * Each project has a collection of available locations. + * * Each location has a collection of federations. + * * Dataproc Metastore Federations are resources with names of the + * form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @class + * @memberof v1beta + */ +export class DataprocMetastoreFederationClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + dataprocMetastoreFederationStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DataprocMetastoreFederationClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 DataprocMetastoreFederationClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof DataprocMetastoreFederationClient; + 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; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + 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 = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' + ), + federationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/federations/{federation}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + metadataImportPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + }; + + // 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 = { + listFederations: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'federations') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createFederationResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.Federation') as gax.protobuf.Type; + const createFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const updateFederationResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.Federation') as gax.protobuf.Type; + const updateFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const deleteFederationResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFederationResponse.decode.bind(createFederationResponse), + createFederationMetadata.decode.bind(createFederationMetadata)), + updateFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFederationResponse.decode.bind(updateFederationResponse), + updateFederationMetadata.decode.bind(updateFederationMetadata)), + deleteFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFederationResponse.decode.bind(deleteFederationResponse), + deleteFederationMetadata.decode.bind(deleteFederationMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.metastore.v1beta.DataprocMetastoreFederation', 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.dataprocMetastoreFederationStub) { + return this.dataprocMetastoreFederationStub; + } + + // Put together the "service stub" for + // google.cloud.metastore.v1beta.DataprocMetastoreFederation. + this.dataprocMetastoreFederationStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1beta.DataprocMetastoreFederation') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.metastore.v1beta.DataprocMetastoreFederation, + 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 dataprocMetastoreFederationStubMethods = + ['listFederations', 'getFederation', 'createFederation', 'updateFederation', 'deleteFederation']; + for (const methodName of dataprocMetastoreFederationStubMethods) { + const callPromise = this.dataprocMetastoreFederationStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.dataprocMetastoreFederationStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'metastore.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 'metastore.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 -- + // ------------------- +/** + * Gets the details of a single federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore federation to + * retrieve, in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_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 protos.google.cloud.metastore.v1beta.Federation|Federation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore_federation.get_federation.js + * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_GetFederation_async + */ + getFederation( + request?: protos.google.cloud.metastore.v1beta.IGetFederationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1beta.IFederation, + protos.google.cloud.metastore.v1beta.IGetFederationRequest|undefined, {}|undefined + ]>; + getFederation( + request: protos.google.cloud.metastore.v1beta.IGetFederationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1beta.IFederation, + protos.google.cloud.metastore.v1beta.IGetFederationRequest|null|undefined, + {}|null|undefined>): void; + getFederation( + request: protos.google.cloud.metastore.v1beta.IGetFederationRequest, + callback: Callback< + protos.google.cloud.metastore.v1beta.IFederation, + protos.google.cloud.metastore.v1beta.IGetFederationRequest|null|undefined, + {}|null|undefined>): void; + getFederation( + request?: protos.google.cloud.metastore.v1beta.IGetFederationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1beta.IFederation, + protos.google.cloud.metastore.v1beta.IGetFederationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1beta.IFederation, + protos.google.cloud.metastore.v1beta.IGetFederationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1beta.IFederation, + protos.google.cloud.metastore.v1beta.IGetFederationRequest|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.getFederation(request, options, callback); + } + +/** + * Creates a metastore federation in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location in which to create a + * federation service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {string} request.federationId + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param {google.cloud.metastore.v1beta.Federation} request.federation + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore_federation.create_federation.js + * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_async + */ + createFederation( + request?: protos.google.cloud.metastore.v1beta.ICreateFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createFederation( + request: protos.google.cloud.metastore.v1beta.ICreateFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFederation( + request: protos.google.cloud.metastore.v1beta.ICreateFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFederation( + request?: protos.google.cloud.metastore.v1beta.ICreateFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore_federation.create_federation.js + * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_async + */ + async checkCreateFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the fields of a federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1beta.Federation} request.federation + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore_federation.update_federation.js + * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_async + */ + updateFederation( + request?: protos.google.cloud.metastore.v1beta.IUpdateFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateFederation( + request: protos.google.cloud.metastore.v1beta.IUpdateFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFederation( + request: protos.google.cloud.metastore.v1beta.IUpdateFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFederation( + request?: protos.google.cloud.metastore.v1beta.IUpdateFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'federation.name': request.federation!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore_federation.update_federation.js + * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_async + */ + async checkUpdateFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore federation to delete, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js + * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_async + */ + deleteFederation( + request?: protos.google.cloud.metastore.v1beta.IDeleteFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteFederation( + request: protos.google.cloud.metastore.v1beta.IDeleteFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFederation( + request: protos.google.cloud.metastore.v1beta.IDeleteFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFederation( + request?: protos.google.cloud.metastore.v1beta.IDeleteFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js + * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_async + */ + async checkDeleteFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists federations in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1beta.Federation|Federation}. + * 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 `listFederationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFederations( + request?: protos.google.cloud.metastore.v1beta.IListFederationsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1beta.IFederation[], + protos.google.cloud.metastore.v1beta.IListFederationsRequest|null, + protos.google.cloud.metastore.v1beta.IListFederationsResponse + ]>; + listFederations( + request: protos.google.cloud.metastore.v1beta.IListFederationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListFederationsRequest, + protos.google.cloud.metastore.v1beta.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IFederation>): void; + listFederations( + request: protos.google.cloud.metastore.v1beta.IListFederationsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListFederationsRequest, + protos.google.cloud.metastore.v1beta.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IFederation>): void; + listFederations( + request?: protos.google.cloud.metastore.v1beta.IListFederationsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1beta.IListFederationsRequest, + protos.google.cloud.metastore.v1beta.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IFederation>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListFederationsRequest, + protos.google.cloud.metastore.v1beta.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IFederation>): + Promise<[ + protos.google.cloud.metastore.v1beta.IFederation[], + protos.google.cloud.metastore.v1beta.IListFederationsRequest|null, + protos.google.cloud.metastore.v1beta.IListFederationsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listFederations(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 protos.google.cloud.metastore.v1beta.Federation|Federation} 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 `listFederationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFederationsStream( + request?: protos.google.cloud.metastore.v1beta.IListFederationsRequest, + 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['listFederations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFederations.createStream( + this.innerApiCalls.listFederations as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFederations`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore + * federations to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.metastore.v1beta.Federation|Federation}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore_federation.list_federations.js + * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_ListFederations_async + */ + listFederationsAsync( + request?: protos.google.cloud.metastore.v1beta.IListFederationsRequest, + 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['listFederations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFederations.asyncIterate( + this.innerApiCalls['listFederations'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,location:string,service:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + service: service, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the service from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the service. + */ + matchServiceFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).service; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified federation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} federation + * @returns {string} Resource name string. + */ + federationPath(project:string,location:string,federation:string) { + return this.pathTemplates.federationPathTemplate.render({ + project: project, + location: location, + federation: federation, + }); + } + + /** + * Parse the project from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).project; + } + + /** + * Parse the location from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).location; + } + + /** + * Parse the federation from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the federation. + */ + matchFederationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).federation; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified metadataImport resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} metadata_import + * @returns {string} Resource name string. + */ + metadataImportPath(project:string,location:string,service:string,metadataImport:string) { + return this.pathTemplates.metadataImportPathTemplate.render({ + project: project, + location: location, + service: service, + metadata_import: metadataImport, + }); + } + + /** + * Parse the project from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; + } + + /** + * Parse the location from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; + } + + /** + * Parse the service from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the service. + */ + matchServiceFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; + } + + /** + * Parse the metadata_import from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the metadata_import. + */ + matchMetadataImportFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; + } + + /** + * 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 service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * 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.dataprocMetastoreFederationStub && !this._terminated) { + return this.dataprocMetastoreFederationStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client_config.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client_config.json new file mode 100644 index 00000000000..e6e1944d917 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.metastore.v1beta.DataprocMetastoreFederation": { + "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": { + "ListFederations": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_proto_list.json new file mode 100644 index 00000000000..aaeb52eb5c3 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/metastore/v1beta/metastore.proto", + "../../protos/google/cloud/metastore/v1beta/metastore_federation.proto" +] diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_proto_list.json new file mode 100644 index 00000000000..aaeb52eb5c3 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/metastore/v1beta/metastore.proto", + "../../protos/google/cloud/metastore/v1beta/metastore_federation.proto" +] diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/gapic_metadata.json new file mode 100644 index 00000000000..7d471236061 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/gapic_metadata.json @@ -0,0 +1,293 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.metastore.v1beta", + "libraryPackage": "@google-cloud/dataproc-metastore", + "services": { + "DataprocMetastore": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreClient", + "rpcs": { + "GetService": { + "methods": [ + "getService" + ] + }, + "GetMetadataImport": { + "methods": [ + "getMetadataImport" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "RemoveIamPolicy": { + "methods": [ + "removeIamPolicy" + ] + }, + "CreateService": { + "methods": [ + "createService" + ] + }, + "UpdateService": { + "methods": [ + "updateService" + ] + }, + "DeleteService": { + "methods": [ + "deleteService" + ] + }, + "CreateMetadataImport": { + "methods": [ + "createMetadataImport" + ] + }, + "UpdateMetadataImport": { + "methods": [ + "updateMetadataImport" + ] + }, + "ExportMetadata": { + "methods": [ + "exportMetadata" + ] + }, + "RestoreService": { + "methods": [ + "restoreService" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "QueryMetadata": { + "methods": [ + "queryMetadata" + ] + }, + "MoveTableToDatabase": { + "methods": [ + "moveTableToDatabase" + ] + }, + "AlterMetadataResourceLocation": { + "methods": [ + "alterMetadataResourceLocation" + ] + }, + "ListServices": { + "methods": [ + "listServices", + "listServicesStream", + "listServicesAsync" + ] + }, + "ListMetadataImports": { + "methods": [ + "listMetadataImports", + "listMetadataImportsStream", + "listMetadataImportsAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DataprocMetastoreClient", + "rpcs": { + "GetService": { + "methods": [ + "getService" + ] + }, + "GetMetadataImport": { + "methods": [ + "getMetadataImport" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "RemoveIamPolicy": { + "methods": [ + "removeIamPolicy" + ] + }, + "CreateService": { + "methods": [ + "createService" + ] + }, + "UpdateService": { + "methods": [ + "updateService" + ] + }, + "DeleteService": { + "methods": [ + "deleteService" + ] + }, + "CreateMetadataImport": { + "methods": [ + "createMetadataImport" + ] + }, + "UpdateMetadataImport": { + "methods": [ + "updateMetadataImport" + ] + }, + "ExportMetadata": { + "methods": [ + "exportMetadata" + ] + }, + "RestoreService": { + "methods": [ + "restoreService" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "QueryMetadata": { + "methods": [ + "queryMetadata" + ] + }, + "MoveTableToDatabase": { + "methods": [ + "moveTableToDatabase" + ] + }, + "AlterMetadataResourceLocation": { + "methods": [ + "alterMetadataResourceLocation" + ] + }, + "ListServices": { + "methods": [ + "listServices", + "listServicesStream", + "listServicesAsync" + ] + }, + "ListMetadataImports": { + "methods": [ + "listMetadataImports", + "listMetadataImportsStream", + "listMetadataImportsAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + } + } + }, + "DataprocMetastoreFederation": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreFederationClient", + "rpcs": { + "GetFederation": { + "methods": [ + "getFederation" + ] + }, + "CreateFederation": { + "methods": [ + "createFederation" + ] + }, + "UpdateFederation": { + "methods": [ + "updateFederation" + ] + }, + "DeleteFederation": { + "methods": [ + "deleteFederation" + ] + }, + "ListFederations": { + "methods": [ + "listFederations", + "listFederationsStream", + "listFederationsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DataprocMetastoreFederationClient", + "rpcs": { + "GetFederation": { + "methods": [ + "getFederation" + ] + }, + "CreateFederation": { + "methods": [ + "createFederation" + ] + }, + "UpdateFederation": { + "methods": [ + "updateFederation" + ] + }, + "DeleteFederation": { + "methods": [ + "deleteFederation" + ] + }, + "ListFederations": { + "methods": [ + "listFederations", + "listFederationsStream", + "listFederationsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/index.ts b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/index.ts new file mode 100644 index 00000000000..74baf047ec9 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/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 {DataprocMetastoreClient} from './dataproc_metastore_client'; +export {DataprocMetastoreFederationClient} from './dataproc_metastore_federation_client'; diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..2d137ce8c89 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/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 metastore = require('@google-cloud/dataproc-metastore'); + +function main() { + const dataprocMetastoreClient = new metastore.DataprocMetastoreClient(); + const dataprocMetastoreFederationClient = new metastore.DataprocMetastoreFederationClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..15fe58ac669 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/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 {DataprocMetastoreClient, DataprocMetastoreFederationClient} from '@google-cloud/dataproc-metastore'; + +// check that the client class type name can be used +function doStuffWithDataprocMetastoreClient(client: DataprocMetastoreClient) { + client.close(); +} +function doStuffWithDataprocMetastoreFederationClient(client: DataprocMetastoreFederationClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const dataprocMetastoreClient = new DataprocMetastoreClient(); + doStuffWithDataprocMetastoreClient(dataprocMetastoreClient); + // check that the client instance can be created + const dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + doStuffWithDataprocMetastoreFederationClient(dataprocMetastoreFederationClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/system-test/install.ts b/owl-bot-staging/google-cloud-metastore/v1beta/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/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-metastore/v1beta/test/gapic_dataproc_metastore_federation_v1beta.ts b/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_federation_v1beta.ts new file mode 100644 index 00000000000..c5d952f69ad --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_federation_v1beta.ts @@ -0,0 +1,2000 @@ +// 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 dataprocmetastorefederationModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta.DataprocMetastoreFederationClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); + await client.initialize(); + assert(client.dataprocMetastoreFederationStub); + }); + + it('has close method for the initialized client', done => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.dataprocMetastoreFederationStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + 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 dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + 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('getFederation', () => { + it('invokes getFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.Federation() + ); + client.innerApiCalls.getFederation = stubSimpleCall(expectedResponse); + const [response] = await client.getFederation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.Federation() + ); + client.innerApiCalls.getFederation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFederation( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IFederation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFederation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation with closed client', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFederation(request), expectedError); + }); + }); + + describe('createFederation', () => { + it('invokes createFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.createFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateFederation', () => { + it('invokes updateFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteFederation', () => { + it('invokes deleteFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listFederations', () => { + it('invokes listFederations without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + ]; + client.innerApiCalls.listFederations = stubSimpleCall(expectedResponse); + const [response] = await client.listFederations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederations without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + ]; + client.innerApiCalls.listFederations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFederations( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IFederation[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederations with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFederations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFederations(request), expectedError); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederationsStream without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + ]; + client.descriptors.page.listFederations.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFederationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1beta.Federation[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1beta.Federation) => { + 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.listFederations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); + assert( + (client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFederationsStream with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFederations.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFederationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1beta.Federation[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1beta.Federation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); + assert( + (client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFederations without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + ]; + client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1beta.IFederation[] = []; + const iterable = client.listFederationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFederations with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFederationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1beta.IFederation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + backup: "backupValue", + }; + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromBackupName', () => { + const result = client.matchServiceFromBackupName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('federation', () => { + const fakePath = "/rendered/path/federation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + federation: "federationValue", + }; + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.federationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.federationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('federationPath', () => { + const result = client.federationPath("projectValue", "locationValue", "federationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.federationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFederationName', () => { + const result = client.matchProjectFromFederationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFederationName', () => { + const result = client.matchLocationFromFederationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFederationFromFederationName', () => { + const result = client.matchFederationFromFederationName(fakePath); + assert.strictEqual(result, "federationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('metadataImport', () => { + const fakePath = "/rendered/path/metadataImport"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + metadata_import: "metadataImportValue", + }; + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.metadataImportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.metadataImportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('metadataImportPath', () => { + const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromMetadataImportName', () => { + const result = client.matchProjectFromMetadataImportName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromMetadataImportName', () => { + const result = client.matchLocationFromMetadataImportName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromMetadataImportName', () => { + const result = client.matchServiceFromMetadataImportName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetadataImportFromMetadataImportName', () => { + const result = client.matchMetadataImportFromMetadataImportName(fakePath); + assert.strictEqual(result, "metadataImportValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + 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('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + }; + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath("projectValue", "locationValue", "serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_v1beta.ts b/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_v1beta.ts new file mode 100644 index 00000000000..5256e743c03 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_v1beta.ts @@ -0,0 +1,4288 @@ +// 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 dataprocmetastoreModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta.DataprocMetastoreClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = dataprocmetastoreModule.v1beta.DataprocMetastoreClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = dataprocmetastoreModule.v1beta.DataprocMetastoreClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = dataprocmetastoreModule.v1beta.DataprocMetastoreClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreStub, undefined); + await client.initialize(); + assert(client.dataprocMetastoreStub); + }); + + it('has close method for the initialized client', done => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.dataprocMetastoreStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + 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 dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + 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('getService', () => { + it('invokes getService without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.Service() + ); + client.innerApiCalls.getService = stubSimpleCall(expectedResponse); + const [response] = await client.getService(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.Service() + ); + client.innerApiCalls.getService = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getService( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IService|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getService = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getService(request), expectedError); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService with closed client', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getService(request), expectedError); + }); + }); + + describe('getMetadataImport', () => { + it('invokes getMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.MetadataImport() + ); + client.innerApiCalls.getMetadataImport = stubSimpleCall(expectedResponse); + const [response] = await client.getMetadataImport(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.MetadataImport() + ); + client.innerApiCalls.getMetadataImport = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMetadataImport( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IMetadataImport|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMetadataImport = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport with closed client', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getMetadataImport(request), expectedError); + }); + }); + + describe('getBackup', () => { + it('invokes getBackup without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.Backup() + ); + client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); + const [response] = await client.getBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.Backup() + ); + client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackup( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IBackup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with closed client', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBackup(request), expectedError); + }); + }); + + describe('removeIamPolicy', () => { + it('invokes removeIamPolicy without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.RemoveIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.RemoveIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.RemoveIamPolicyResponse() + ); + client.innerApiCalls.removeIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.removeIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.removeIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.removeIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes removeIamPolicy without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.RemoveIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.RemoveIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.RemoveIamPolicyResponse() + ); + client.innerApiCalls.removeIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeIamPolicy( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IRemoveIamPolicyResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.removeIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.removeIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes removeIamPolicy with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.RemoveIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.RemoveIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.removeIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.removeIamPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.removeIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.removeIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes removeIamPolicy with closed client', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.RemoveIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.RemoveIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.removeIamPolicy(request), expectedError); + }); + }); + + describe('createService', () => { + it('invokes createService without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createService = stubLongRunningCall(expectedResponse); + const [operation] = await client.createService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createService(request), expectedError); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateService', () => { + it('invokes updateService without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateService = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateService(request), expectedError); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteService', () => { + it('invokes deleteService without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteService = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteService(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createMetadataImport', () => { + it('invokes createMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(expectedResponse); + const [operation] = await client.createMetadataImport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMetadataImport = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMetadataImport( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createMetadataImport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateMetadataImportProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateMetadataImportProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateMetadataImportProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateMetadataImportProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateMetadataImport', () => { + it('invokes updateMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateMetadataImport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMetadataImport = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMetadataImport( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateMetadataImport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateMetadataImportProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateMetadataImportProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateMetadataImportProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateMetadataImportProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('exportMetadata', () => { + it('invokes exportMetadata without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportMetadata = stubLongRunningCall(expectedResponse); + const [operation] = await client.exportMetadata(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportMetadata = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportMetadata( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.exportMetadata(request), expectedError); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.exportMetadata(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkExportMetadataProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkExportMetadataProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportMetadataProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkExportMetadataProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('restoreService', () => { + it('invokes restoreService without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreService = stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.restoreService(request), expectedError); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.restoreService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRestoreServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRestoreServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRestoreServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createBackup', () => { + it('invokes createBackup without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBackup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateBackupProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateBackupProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteBackup', () => { + it('invokes deleteBackup without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteBackup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteBackupProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteBackupProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('queryMetadata', () => { + it('invokes queryMetadata without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.QueryMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.QueryMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.queryMetadata = stubLongRunningCall(expectedResponse); + const [operation] = await client.queryMetadata(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes queryMetadata without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.QueryMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.QueryMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.queryMetadata = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.queryMetadata( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes queryMetadata with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.QueryMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.QueryMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.queryMetadata = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.queryMetadata(request), expectedError); + const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes queryMetadata with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.QueryMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.QueryMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.queryMetadata = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.queryMetadata(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkQueryMetadataProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkQueryMetadataProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkQueryMetadataProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkQueryMetadataProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('moveTableToDatabase', () => { + it('invokes moveTableToDatabase without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.MoveTableToDatabaseRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.MoveTableToDatabaseRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(expectedResponse); + const [operation] = await client.moveTableToDatabase(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveTableToDatabase without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.MoveTableToDatabaseRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.MoveTableToDatabaseRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.moveTableToDatabase = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.moveTableToDatabase( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveTableToDatabase with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.MoveTableToDatabaseRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.MoveTableToDatabaseRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.moveTableToDatabase(request), expectedError); + const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveTableToDatabase with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.MoveTableToDatabaseRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.MoveTableToDatabaseRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.moveTableToDatabase(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkMoveTableToDatabaseProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkMoveTableToDatabaseProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkMoveTableToDatabaseProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkMoveTableToDatabaseProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('alterMetadataResourceLocation', () => { + it('invokes alterMetadataResourceLocation without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.AlterMetadataResourceLocationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.AlterMetadataResourceLocationRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(expectedResponse); + const [operation] = await client.alterMetadataResourceLocation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes alterMetadataResourceLocation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.AlterMetadataResourceLocationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.AlterMetadataResourceLocationRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.alterMetadataResourceLocation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes alterMetadataResourceLocation with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.AlterMetadataResourceLocationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.AlterMetadataResourceLocationRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.alterMetadataResourceLocation(request), expectedError); + const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes alterMetadataResourceLocation with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.AlterMetadataResourceLocationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.AlterMetadataResourceLocationRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.alterMetadataResourceLocation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkAlterMetadataResourceLocationProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkAlterMetadataResourceLocationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkAlterMetadataResourceLocationProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkAlterMetadataResourceLocationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listServices', () => { + it('invokes listServices without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); + const [response] = await client.listServices(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServices without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServices( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IService[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServices with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServices = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listServices(request), expectedError); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServicesStream without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + ]; + client.descriptors.page.listServices.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1beta.Service[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1beta.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listServices, request)); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listServicesStream with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServices.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1beta.Service[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1beta.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listServices, request)); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listServices without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + ]; + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1beta.IService[] = []; + const iterable = client.listServicesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listServices with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServicesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1beta.IService[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listMetadataImports', () => { + it('invokes listMetadataImports without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + ]; + client.innerApiCalls.listMetadataImports = stubSimpleCall(expectedResponse); + const [response] = await client.listMetadataImports(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImports without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + ]; + client.innerApiCalls.listMetadataImports = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMetadataImports( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IMetadataImport[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImports with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMetadataImports = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMetadataImports(request), expectedError); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImportsStream without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + ]; + client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMetadataImportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1beta.MetadataImport[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1beta.MetadataImport) => { + 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.listMetadataImports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); + assert( + (client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listMetadataImportsStream with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMetadataImportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1beta.MetadataImport[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1beta.MetadataImport) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); + assert( + (client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMetadataImports without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + ]; + client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1beta.IMetadataImport[] = []; + const iterable = client.listMetadataImportsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMetadataImports with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMetadataImportsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1beta.IMetadataImport[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listBackups', () => { + it('invokes listBackups without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listBackups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackups( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IBackup[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBackups(request), expectedError); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackupsStream without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + ]; + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1beta.Backup[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1beta.Backup) => { + 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.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listBackupsStream with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1beta.Backup[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1beta.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBackups without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + ]; + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1beta.IBackup[] = []; + const iterable = client.listBackupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBackups with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBackupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1beta.IBackup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + backup: "backupValue", + }; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromBackupName', () => { + const result = client.matchServiceFromBackupName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('federation', () => { + const fakePath = "/rendered/path/federation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + federation: "federationValue", + }; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.federationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.federationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('federationPath', () => { + const result = client.federationPath("projectValue", "locationValue", "federationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.federationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFederationName', () => { + const result = client.matchProjectFromFederationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFederationName', () => { + const result = client.matchLocationFromFederationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFederationFromFederationName', () => { + const result = client.matchFederationFromFederationName(fakePath); + assert.strictEqual(result, "federationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('lake', () => { + const fakePath = "/rendered/path/lake"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + lake: "lakeValue", + }; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.lakePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.lakePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('lakePath', () => { + const result = client.lakePath("projectValue", "locationValue", "lakeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.lakePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLakeName', () => { + const result = client.matchProjectFromLakeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.lakePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLakeName', () => { + const result = client.matchLocationFromLakeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.lakePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLakeFromLakeName', () => { + const result = client.matchLakeFromLakeName(fakePath); + assert.strictEqual(result, "lakeValue"); + assert((client.pathTemplates.lakePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('metadataImport', () => { + const fakePath = "/rendered/path/metadataImport"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + metadata_import: "metadataImportValue", + }; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.metadataImportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.metadataImportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('metadataImportPath', () => { + const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromMetadataImportName', () => { + const result = client.matchProjectFromMetadataImportName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromMetadataImportName', () => { + const result = client.matchLocationFromMetadataImportName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromMetadataImportName', () => { + const result = client.matchServiceFromMetadataImportName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetadataImportFromMetadataImportName', () => { + const result = client.matchMetadataImportFromMetadataImportName(fakePath); + assert.strictEqual(result, "metadataImportValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('network', () => { + const fakePath = "/rendered/path/network"; + const expectedParameters = { + project: "projectValue", + network: "networkValue", + }; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.networkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.networkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath("projectValue", "networkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNetworkFromNetworkName', () => { + const result = client.matchNetworkFromNetworkName(fakePath); + assert.strictEqual(result, "networkValue"); + assert((client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + 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('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + }; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath("projectValue", "locationValue", "serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/tsconfig.json b/owl-bot-staging/google-cloud-metastore/v1beta/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/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-metastore/v1beta/webpack.config.js b/owl-bot-staging/google-cloud-metastore/v1beta/webpack.config.js new file mode 100644 index 00000000000..6fc45cb3d30 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/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: 'DataprocMetastore', + filename: './dataproc-metastore.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-migrationcenter/v1/.eslintignore b/owl-bot-staging/google-cloud-migrationcenter/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/.eslintrc.json b/owl-bot-staging/google-cloud-migrationcenter/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/.gitignore b/owl-bot-staging/google-cloud-migrationcenter/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/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-migrationcenter/v1/.jsdoc.js b/owl-bot-staging/google-cloud-migrationcenter/v1/.jsdoc.js new file mode 100644 index 00000000000..f1b6cfef310 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/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/migrationcenter', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/.mocharc.js b/owl-bot-staging/google-cloud-migrationcenter/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/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-migrationcenter/v1/.prettierrc.js b/owl-bot-staging/google-cloud-migrationcenter/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/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-migrationcenter/v1/README.md b/owl-bot-staging/google-cloud-migrationcenter/v1/README.md new file mode 100644 index 00000000000..5b938c183dd --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/README.md @@ -0,0 +1 @@ +Migrationcenter: Nodejs Client diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/package.json b/owl-bot-staging/google-cloud-migrationcenter/v1/package.json new file mode 100644 index 00000000000..9385a298f55 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/migrationcenter", + "version": "0.1.0", + "description": "Migrationcenter client for Node.js", + "repository": "googleapis/nodejs-migrationcenter", + "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 migrationcenter", + "migrationcenter", + "migration center" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/protos/google/cloud/migrationcenter/v1/migrationcenter.proto b/owl-bot-staging/google-cloud-migrationcenter/v1/protos/google/cloud/migrationcenter/v1/migrationcenter.proto new file mode 100644 index 00000000000..cc9df8da065 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/protos/google/cloud/migrationcenter/v1/migrationcenter.proto @@ -0,0 +1,4005 @@ +// 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 +// +// 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.migrationcenter.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/date.proto"; +import "google/type/money.proto"; + +option csharp_namespace = "Google.Cloud.MigrationCenter.V1"; +option go_package = "cloud.google.com/go/migrationcenter/apiv1/migrationcenterpb;migrationcenterpb"; +option java_multiple_files = true; +option java_outer_classname = "MigrationCenterProto"; +option java_package = "com.google.cloud.migrationcenter.v1"; +option php_namespace = "Google\\Cloud\\MigrationCenter\\V1"; +option ruby_package = "Google::Cloud::MigrationCenter::V1"; + +// Service describing handlers for resources. +service MigrationCenter { + option (google.api.default_host) = "migrationcenter.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists all the assets in a given project and location. + rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/assets" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of an asset. + rpc GetAsset(GetAssetRequest) returns (Asset) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/assets/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the parameters of an asset. + rpc UpdateAsset(UpdateAssetRequest) returns (Asset) { + option (google.api.http) = { + patch: "/v1/{asset.name=projects/*/locations/*/assets/*}" + body: "asset" + }; + option (google.api.method_signature) = "asset,update_mask"; + } + + // Updates the parameters of a list of assets. + rpc BatchUpdateAssets(BatchUpdateAssetsRequest) + returns (BatchUpdateAssetsResponse) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/assets:batchUpdate" + body: "*" + }; + option (google.api.method_signature) = "parent,requests"; + } + + // Deletes an asset. + rpc DeleteAsset(DeleteAssetRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/assets/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes list of Assets. + rpc BatchDeleteAssets(BatchDeleteAssetsRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/assets:batchDelete" + body: "*" + }; + option (google.api.method_signature) = "parent,names"; + } + + // Reports a set of frames. + rpc ReportAssetFrames(ReportAssetFramesRequest) + returns (ReportAssetFramesResponse) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/assets:reportAssetFrames" + body: "frames" + }; + } + + // Aggregates the requested fields based on provided function. + rpc AggregateAssetsValues(AggregateAssetsValuesRequest) + returns (AggregateAssetsValuesResponse) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/assets:aggregateValues" + body: "*" + }; + } + + // Creates an import job. + rpc CreateImportJob(CreateImportJobRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/importJobs" + body: "import_job" + }; + option (google.api.method_signature) = "parent,import_job,import_job_id"; + option (google.longrunning.operation_info) = { + response_type: "ImportJob" + metadata_type: "OperationMetadata" + }; + } + + // Lists all import jobs. + rpc ListImportJobs(ListImportJobsRequest) returns (ListImportJobsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/importJobs" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of an import job. + rpc GetImportJob(GetImportJobRequest) returns (ImportJob) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/importJobs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes an import job. + rpc DeleteImportJob(DeleteImportJobRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/importJobs/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Updates an import job. + rpc UpdateImportJob(UpdateImportJobRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{import_job.name=projects/*/locations/*/importJobs/*}" + body: "import_job" + }; + option (google.api.method_signature) = "import_job,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "ImportJob" + metadata_type: "OperationMetadata" + }; + } + + // Validates an import job. + rpc ValidateImportJob(ValidateImportJobRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/importJobs/*}:validate" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Runs an import job. + rpc RunImportJob(RunImportJobRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/importJobs/*}:run" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Gets an import data file. + rpc GetImportDataFile(GetImportDataFileRequest) returns (ImportDataFile) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/importJobs/*/importDataFiles/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List import data files. + rpc ListImportDataFiles(ListImportDataFilesRequest) + returns (ListImportDataFilesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/importJobs/*}/importDataFiles" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates an import data file. + rpc CreateImportDataFile(CreateImportDataFileRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/importJobs/*}/importDataFiles" + body: "import_data_file" + }; + option (google.api.method_signature) = + "parent,import_data_file,import_data_file_id"; + option (google.longrunning.operation_info) = { + response_type: "ImportDataFile" + metadata_type: "OperationMetadata" + }; + } + + // Delete an import data file. + rpc DeleteImportDataFile(DeleteImportDataFileRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/importJobs/*/importDataFiles/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Lists all groups in a given project and location. + rpc ListGroups(ListGroupsRequest) returns (ListGroupsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/groups" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a group. + rpc GetGroup(GetGroupRequest) returns (Group) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/groups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new group in a given project and location. + rpc CreateGroup(CreateGroupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/groups" + body: "group" + }; + option (google.api.method_signature) = "parent,group,group_id"; + option (google.longrunning.operation_info) = { + response_type: "Group" + metadata_type: "OperationMetadata" + }; + } + + // Updates the parameters of a group. + rpc UpdateGroup(UpdateGroupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{group.name=projects/*/locations/*/groups/*}" + body: "group" + }; + option (google.api.method_signature) = "group,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Group" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a group. + rpc DeleteGroup(DeleteGroupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/groups/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Adds assets to a group. + rpc AddAssetsToGroup(AddAssetsToGroupRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{group=projects/*/locations/*/groups/*}:addAssets" + body: "*" + }; + option (google.api.method_signature) = "group"; + option (google.longrunning.operation_info) = { + response_type: "Group" + metadata_type: "OperationMetadata" + }; + } + + // Removes assets from a group. + rpc RemoveAssetsFromGroup(RemoveAssetsFromGroupRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{group=projects/*/locations/*/groups/*}:removeAssets" + body: "*" + }; + option (google.api.method_signature) = "group"; + option (google.longrunning.operation_info) = { + response_type: "Group" + metadata_type: "OperationMetadata" + }; + } + + // Lists all error frames in a given source and location. + rpc ListErrorFrames(ListErrorFramesRequest) + returns (ListErrorFramesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/sources/*}/errorFrames" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of an error frame. + rpc GetErrorFrame(GetErrorFrameRequest) returns (ErrorFrame) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/sources/*/errorFrames/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all the sources in a given project and location. + rpc ListSources(ListSourcesRequest) returns (ListSourcesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/sources" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a source. + rpc GetSource(GetSourceRequest) returns (Source) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/sources/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new source in a given project and location. + rpc CreateSource(CreateSourceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/sources" + body: "source" + }; + option (google.api.method_signature) = "parent,source,source_id"; + option (google.longrunning.operation_info) = { + response_type: "Source" + metadata_type: "OperationMetadata" + }; + } + + // Updates the parameters of a source. + rpc UpdateSource(UpdateSourceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{source.name=projects/*/locations/*/sources/*}" + body: "source" + }; + option (google.api.method_signature) = "source,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Source" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a source. + rpc DeleteSource(DeleteSourceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/sources/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Lists all the preference sets in a given project and location. + rpc ListPreferenceSets(ListPreferenceSetsRequest) + returns (ListPreferenceSetsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/preferenceSets" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a preference set. + rpc GetPreferenceSet(GetPreferenceSetRequest) returns (PreferenceSet) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/preferenceSets/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new preference set in a given project and location. + rpc CreatePreferenceSet(CreatePreferenceSetRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/preferenceSets" + body: "preference_set" + }; + option (google.api.method_signature) = + "parent,preference_set,preference_set_id"; + option (google.longrunning.operation_info) = { + response_type: "PreferenceSet" + metadata_type: "OperationMetadata" + }; + } + + // Updates the parameters of a preference set. + rpc UpdatePreferenceSet(UpdatePreferenceSetRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{preference_set.name=projects/*/locations/*/preferenceSets/*}" + body: "preference_set" + }; + option (google.api.method_signature) = "preference_set,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "PreferenceSet" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a preference set. + rpc DeletePreferenceSet(DeletePreferenceSetRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/preferenceSets/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Gets the details of regional settings. + rpc GetSettings(GetSettingsRequest) returns (Settings) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/settings}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the regional-level project settings. + rpc UpdateSettings(UpdateSettingsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{settings.name=projects/*/locations/*/settings}" + body: "settings" + }; + option (google.api.method_signature) = "settings,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Settings" + metadata_type: "OperationMetadata" + }; + } + + // Creates a report configuration. + rpc CreateReportConfig(CreateReportConfigRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/reportConfigs" + body: "report_config" + }; + option (google.api.method_signature) = + "parent,report_config,report_config_id"; + option (google.longrunning.operation_info) = { + response_type: "ReportConfig" + metadata_type: "OperationMetadata" + }; + } + + // Gets details of a single ReportConfig. + rpc GetReportConfig(GetReportConfigRequest) returns (ReportConfig) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/reportConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists ReportConfigs in a given project and location. + rpc ListReportConfigs(ListReportConfigsRequest) + returns (ListReportConfigsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/reportConfigs" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a ReportConfig. + rpc DeleteReportConfig(DeleteReportConfigRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/reportConfigs/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Creates a report. + rpc CreateReport(CreateReportRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/reportConfigs/*}/reports" + body: "report" + }; + option (google.api.method_signature) = "parent,report,report_id"; + option (google.longrunning.operation_info) = { + response_type: "Report" + metadata_type: "OperationMetadata" + }; + } + + // Gets details of a single Report. + rpc GetReport(GetReportRequest) returns (Report) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/reportConfigs/*/reports/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists Reports in a given ReportConfig. + rpc ListReports(ListReportsRequest) returns (ListReportsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/reportConfigs/*}/reports" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a Report. + rpc DeleteReport(DeleteReportRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/reportConfigs/*/reports/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } +} + +// An asset represents a resource in your environment. Asset types include +// virtual machines and databases. +message Asset { + option (google.api.resource) = { + type: "migrationcenter.googleapis.com/Asset" + pattern: "projects/{project}/locations/{location}/assets/{asset}" + }; + + // Output only. The full name of the asset. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when the asset was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when the asset was last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels as key value pairs. + map labels = 4; + + // Generic asset attributes. + map attributes = 5; + + // The internal information of an asset. Only one field can be specified + // with different attributes based on the type of the asset. + oneof AssetDetails { + // Output only. Asset information specific for virtual and physical + // machines. + MachineDetails machine_details = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Output only. The list of insights associated with the asset. + InsightList insight_list = 20 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Performance data for the asset. + AssetPerformanceData performance_data = 21 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The list of sources contributing to the asset. + repeated string sources = 22 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Source" + } + ]; + + // Output only. The list of groups that the asset is assigned to. + repeated string assigned_groups = 23 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Group" + } + ]; +} + +// The preferences that apply to all assets in a given context. +message PreferenceSet { + option (google.api.resource) = { + type: "migrationcenter.googleapis.com/PreferenceSet" + pattern: "projects/{project}/locations/{location}/preferenceSets/{preference_set}" + }; + + // Output only. Name of the preference set. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when the preference set was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when the preference set was last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-friendly display name. Maximum length is 63 characters. + string display_name = 4; + + // A description of the preference set. + string description = 5; + + // A set of preferences that applies to all virtual machines in the context. + VirtualMachinePreferences virtual_machine_preferences = 6; +} + +// A resource that represents the background job that imports asset frames. +message ImportJob { + option (google.api.resource) = { + type: "migrationcenter.googleapis.com/ImportJob" + pattern: "projects/{project}/locations/{location}/importJobs/{import_job}" + }; + + // Enumerates possible states of an import job. + enum ImportJobState { + // Default value. + IMPORT_JOB_STATE_UNSPECIFIED = 0; + + // The import job is pending. + IMPORT_JOB_STATE_PENDING = 1; + + // The processing of the import job is ongoing. + IMPORT_JOB_STATE_RUNNING = 2; + + // The import job processing has completed. + IMPORT_JOB_STATE_COMPLETED = 3; + + // The import job failed to be processed. + IMPORT_JOB_STATE_FAILED = 4; + + // The import job is being validated. + IMPORT_JOB_STATE_VALIDATING = 5; + + // The import job contains blocking errors. + IMPORT_JOB_STATE_FAILED_VALIDATION = 6; + + // The validation of the job completed with no blocking errors. + IMPORT_JOB_STATE_READY = 7; + } + + // Output only. The full name of the import job. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-friendly display name. Maximum length is 63 characters. + string display_name = 2; + + // Output only. The timestamp when the import job was created. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when the import job was last updated. + google.protobuf.Timestamp update_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when the import job was completed. + google.protobuf.Timestamp complete_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The state of the import job. + ImportJobState state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels as key value pairs. + map labels = 7; + + // Required. Reference to a source. + string asset_source = 8 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Source" + } + ]; + + // Holds the various report types of an import job. + oneof report { + // Output only. The report with the validation results of the import job. + ValidationReport validation_report = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The report with the results of running the import job. + ExecutionReport execution_report = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; + } +} + +// A resource that represents a payload file in an import job. +message ImportDataFile { + option (google.api.resource) = { + type: "migrationcenter.googleapis.com/ImportDataFile" + pattern: "projects/{project}/locations/{location}/importJobs/{import_job}/importDataFiles/{import_data_file}" + }; + + // Enumerates possible states of an import data file. + enum State { + // Default value. + STATE_UNSPECIFIED = 0; + + // The data file is being created. + CREATING = 1; + + // The data file completed initialization. + ACTIVE = 2; + } + + // Output only. The name of the file. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-friendly display name. Maximum length is 63 characters. + string display_name = 6; + + // Required. The payload format. + ImportJobFormat format = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The timestamp when the file was created. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The state of the import data file. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + oneof file_info { + // Information about a file that is uploaded to a storage service. + UploadFileInfo upload_file_info = 5; + } +} + +// A resource that represents an asset group. +// The purpose of an asset group is to bundle a set of assets that have +// something in common, while allowing users to add annotations to the group. +// An asset can belong to multiple groups. +message Group { + option (google.api.resource) = { + type: "migrationcenter.googleapis.com/Group" + pattern: "projects/{project}/locations/{location}/groups/{group}" + }; + + // Output only. The name of the group. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when the group was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when the group was last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels as key value pairs. + map labels = 4; + + // User-friendly display name. + string display_name = 5; + + // The description of the resource. + string description = 6; +} + +// Message representing a frame which failed to be processed due to an error. +message ErrorFrame { + option (google.api.resource) = { + type: "migrationcenter.googleapis.com/ErrorFrame" + pattern: "projects/{project}/locations/{location}/sources/{source}/errorFrames/{error_frame}" + }; + + // Output only. The identifier of the ErrorFrame. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. All the violations that were detected for the frame. + repeated FrameViolationEntry violations = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The frame that was originally reported. + AssetFrame original_frame = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Frame ingestion time. + google.protobuf.Timestamp ingestion_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Source represents an object from which asset information is +// streamed to Migration Center. +message Source { + option (google.api.resource) = { + type: "migrationcenter.googleapis.com/Source" + pattern: "projects/{project}/locations/{location}/sources/{source}" + }; + + enum SourceType { + // Unspecified + SOURCE_TYPE_UNKNOWN = 0; + + // Manually uploaded file (e.g. CSV) + SOURCE_TYPE_UPLOAD = 1; + + // Guest-level info + SOURCE_TYPE_GUEST_OS_SCAN = 2; + + // Inventory-level scan + SOURCE_TYPE_INVENTORY_SCAN = 3; + + // Third-party owned sources. + SOURCE_TYPE_CUSTOM = 4; + } + + // Enumerates possible states of a source. + enum State { + // Unspecified. + STATE_UNSPECIFIED = 0; + + // The source is active and ready to be used. + ACTIVE = 1; + + // In the process of being deleted. + DELETING = 2; + + // Source is in an invalid state. Asset frames reported to it will be + // ignored. + INVALID = 3; + } + + // Output only. The full name of the source. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when the source was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when the source was last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-friendly display name. + string display_name = 4; + + // Free-text description. + string description = 5; + + // Data source type. + SourceType type = 6; + + // The information confidence of the source. + // The higher the value, the higher the confidence. + int32 priority = 7; + + // If `true`, the source is managed by other service(s). + bool managed = 8; + + // Output only. Number of frames that are still being processed. + int32 pending_frame_count = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The number of frames that were reported by the source and + // contained errors. + int32 error_frame_count = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The state of the source. + State state = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The groups and associated preference sets on which +// we can generate reports. +message ReportConfig { + option (google.api.resource) = { + type: "migrationcenter.googleapis.com/ReportConfig" + pattern: "projects/{project}/locations/{location}/reportConfigs/{report_config}" + }; + + // Represents a combination of a group with a preference set. + message GroupPreferenceSetAssignment { + // Required. Name of the group. + string group = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Group" + } + ]; + + // Required. Name of the Preference Set. + string preference_set = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/PreferenceSet" + } + ]; + } + + // Output only. Name of resource. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when the resource was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when the resource was last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-friendly display name. Maximum length is 63 characters. + string display_name = 4; + + // Free-text description. + string description = 5; + + // Required. Collection of combinations of groups and preference sets. + repeated GroupPreferenceSetAssignment group_preferenceset_assignments = 6 + [(google.api.field_behavior) = REQUIRED]; +} + +// Report represents a point-in-time rendering of the ReportConfig results. +message Report { + option (google.api.resource) = { + type: "migrationcenter.googleapis.com/Report" + pattern: "projects/{project}/locations/{location}/reportConfigs/{report_config}/reports/{report}" + }; + + // Report type. + enum Type { + // Default Report type. + TYPE_UNSPECIFIED = 0; + + // Total cost of ownership Report type. + TOTAL_COST_OF_OWNERSHIP = 1; + } + + // Report creation state. + enum State { + // Default Report creation state. + STATE_UNSPECIFIED = 0; + + // Creating Report. + PENDING = 1; + + // Successfully created Report. + SUCCEEDED = 2; + + // Failed to create Report. + FAILED = 3; + } + + // Output only. Name of resource. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Creation timestamp. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update timestamp. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-friendly display name. Maximum length is 63 characters. + string display_name = 4; + + // Free-text description. + string description = 5; + + // Report type. + Type type = 6; + + // Report creation state. + State state = 7; + + // Output only. Summary view of the Report. + ReportSummary summary = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have been cancelled successfully + // have [Operation.error][] value with a + // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + // `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Message for requesting a list of assets. +message ListAssetsRequest { + // Required. Parent value for `ListAssetsRequest`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/Asset" + } + ]; + + // Requested page size. Server may return fewer items than requested. + // If unspecified, server will pick an appropriate default. + int32 page_size = 2; + + // A token identifying a page of results the server should return. + string page_token = 3; + + // Filtering results. + string filter = 4; + + // Field to sort by. See https://google.aip.dev/132#ordering for more details. + string order_by = 5; + + // View of the assets. Defaults to BASIC. + AssetView view = 6; +} + +// Response message for listing assets. +message ListAssetsResponse { + // A list of assets. + repeated Asset assets = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Message for getting a Asset. +message GetAssetRequest { + // Required. Name of the resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Asset" + } + ]; + + // View of the assets. Defaults to BASIC. + AssetView view = 2; +} + +// A request to update an asset. +message UpdateAssetRequest { + // Required. Field mask is used to specify the fields to be overwritten in the + // `Asset` resource by the update. + // The values specified in the `update_mask` field are relative to the + // resource, not the full request. + // A field will be overwritten if it is in the mask. + // A single * value in the mask lets you to overwrite all fields. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The resource being updated. + Asset asset = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to update a list of assets. +message BatchUpdateAssetsRequest { + // Required. Parent value for batch asset update. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/Asset" + } + ]; + + // Required. The request message specifying the resources to update. + // A maximum of 1000 assets can be modified in a batch. + repeated UpdateAssetRequest requests = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Response for updating a list of assets. +message BatchUpdateAssetsResponse { + // Update asset content. + // The content only includes values after field mask being applied. + repeated Asset assets = 1; +} + +// A request to delete an asset. +message DeleteAssetRequest { + // Required. Name of the resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Asset" + } + ]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to delete a list of asset. +message BatchDeleteAssetsRequest { + // Required. Parent value for batch asset delete. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/Asset" + } + ]; + + // Required. The IDs of the assets to delete. + // A maximum of 1000 assets can be deleted in a batch. + // Format: projects/{project}/locations/{location}/assets/{name}. + repeated string names = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Asset" + } + ]; + + // Optional. When this value is set to `true` the request is a no-op for + // non-existing assets. See https://google.aip.dev/135#delete-if-existing for + // additional details. Default value is `false`. + bool allow_missing = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to report a set of asset frames. +message ReportAssetFramesRequest { + // Required. Parent of the resource. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Collection of frames data. + Frames frames = 2; + + // Required. Reference to a source. + string source = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Source" + } + ]; +} + +// A response to a call to `ReportAssetFrame`. +message ReportAssetFramesResponse {} + +// A request to aggregate one or more values. +message AggregateAssetsValuesRequest { + // Required. Parent value for `AggregateAssetsValuesRequest`. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Array of aggregations to perform. + // Up to 25 aggregations can be defined. + repeated Aggregation aggregations = 2; + + // The aggregation will be performed on assets that match the provided filter. + string filter = 3; +} + +// A response to a request to aggregated assets values. +message AggregateAssetsValuesResponse { + // The aggregation results. + repeated AggregationResult results = 1; +} + +// A request to create an import job. +message CreateImportJobRequest { + // Required. Value for parent. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/ImportJob" + } + ]; + + // Required. ID of the import job. + string import_job_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The resource being created. + ImportJob import_job = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to list import jobs. +message ListImportJobsRequest { + // Required. Parent value for `ListImportJobsRequest`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/ImportJob" + } + ]; + + // Requested page size. Server may return fewer items than requested. + // If unspecified, server will pick an appropriate default. + int32 page_size = 2; + + // A token identifying a page of results the server should return. + string page_token = 3; + + // Filtering results. + string filter = 4; + + // Field to sort by. See https://google.aip.dev/132#ordering for more details. + string order_by = 5; + + // Optional. The level of details of each import job. + // Default value is BASIC. + ImportJobView view = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// A response for listing import jobs. +message ListImportJobsResponse { + // The list of import jobs. + repeated ImportJob import_jobs = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// A request to get an import job. +message GetImportJobRequest { + // Required. Name of the resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/ImportJob" + } + ]; + + // Optional. The level of details of the import job. + // Default value is FULL. + ImportJobView view = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to delete an import job. +message DeleteImportJobRequest { + // Required. Name of the resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/ImportJob" + } + ]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set to `true`, any `ImportDataFiles` of this job will also be + // deleted If set to `false`, the request only works if the job has no data + // files. + bool force = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to update an import job. +message UpdateImportJobRequest { + // Required. Field mask is used to specify the fields to be overwritten in the + // `Asset` resource by the update. + // The values specified in the `update_mask` field are relative to the + // resource, not the full request. + // A field will be overwritten if it is in the mask. + // A single * value in the mask lets you to overwrite all fields. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The resource being updated + ImportJob import_job = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to validate an import job. +message ValidateImportJobRequest { + // Required. The name of the import job to validate. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/ImportJob" + } + ]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to run an import job. +message RunImportJobRequest { + // Required. The name of the import job to run. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/ImportJob" + } + ]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to get an import data file. +message GetImportDataFileRequest { + // Required. Name of the ImportDataFile. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/ImportDataFile" + } + ]; +} + +// A request to list import data files of an import job. +message ListImportDataFilesRequest { + // Required. Name of the parent of the `ImportDataFiles` resource. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/ImportDataFile" + } + ]; + + // The maximum number of data files to return. The service may return + // fewer than this value. If unspecified, at most 500 data files 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 `ListImportDataFiles` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListImportDataFiles` + // must match the call that provided the page token. + string page_token = 3; + + // Filtering results. + string filter = 4; + + // Field to sort by. See https://google.aip.dev/132#ordering for more details. + string order_by = 5; +} + +// Response for listing payload files of an import job. +message ListImportDataFilesResponse { + // The list of import data files. + repeated ImportDataFile import_data_files = 1; + + // A token that can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// A request to create an `ImportDataFile` resource. +message CreateImportDataFileRequest { + // Required. Name of the parent of the ImportDataFile. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/ImportDataFile" + } + ]; + + // Required. The ID of the new data file. + string import_data_file_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The resource being created. + ImportDataFile import_data_file = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to delete an `ImportDataFile` resource. +message DeleteImportDataFileRequest { + // Required. Name of the ImportDataFile to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/ImportDataFile" + } + ]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to list groups. +message ListGroupsRequest { + // Required. Parent value for `ListGroupsRequest`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/Group" + } + ]; + + // Requested page size. Server may return fewer items than requested. + // If unspecified, server will pick an appropriate default. + int32 page_size = 2; + + // A token identifying a page of results the server should return. + string page_token = 3; + + // Filtering results. + string filter = 4; + + // Field to sort by. See https://google.aip.dev/132#ordering for more details. + string order_by = 5; +} + +// A response for listing groups. +message ListGroupsResponse { + // The list of Group + repeated Group groups = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// A request to get a group. +message GetGroupRequest { + // Required. Name of the resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Group" + } + ]; +} + +// A request to create a group. +message CreateGroupRequest { + // Required. Value for parent. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/Group" + } + ]; + + // Required. User specified ID for the group. It will become the last + // component of the group name. The ID must be unique within the project, must + // conform with RFC-1034, is restricted to lower-cased letters, and has a + // maximum length of 63 characters. The ID must match the regular expression: + // `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. + string group_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The group resource being created. + Group group = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to update a group. +message UpdateGroupRequest { + // Required. Field mask is used to specify the fields to be overwritten in the + // `Group` resource by the update. + // The values specified in the `update_mask` are relative to the resource, not + // the full request. A field will be overwritten if it is in the mask. + // A single * value in the mask lets you to overwrite all fields. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The group resource being updated. + Group group = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to delete a group. +message DeleteGroupRequest { + // Required. Name of the group resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Group" + } + ]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to add assets to a group. +message AddAssetsToGroupRequest { + // Required. Group reference. + string group = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Group" + } + ]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. List of assets to be added. + // The maximum number of assets that can be added in a single request is + // 1000. + AssetList assets = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. When this value is set to `false` and one of the given assets is + // already an existing member of the group, the operation fails with an + // `Already Exists` error. When set to `true` this situation is silently + // ignored by the server. + // + // Default value is `false`. + bool allow_existing = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to remove assets from a group. +message RemoveAssetsFromGroupRequest { + // Required. Group reference. + string group = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Group" + } + ]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. List of assets to be removed. + // The maximum number of assets that can be removed in a single request is + // 1000. + AssetList assets = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. When this value is set to `false` and one of the given assets is + // not an existing member of the group, the operation fails with a `Not Found` + // error. When set to `true` this situation is silently ignored by the server. + // + // Default value is `false`. + bool allow_missing = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to list error frames for a source. +message ListErrorFramesRequest { + // Required. Parent value (the source) for `ListErrorFramesRequest`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/ErrorFrame" + } + ]; + + // Requested page size. Server may return fewer items than requested. + // If unspecified, server will pick an appropriate default. + int32 page_size = 2; + + // A token identifying a page of results the server should return. + string page_token = 3; + + // Optional. An optional view mode to control the level of details of each + // error frame. The default is a BASIC frame view. + ErrorFrameView view = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// A response for listing error frames. +message ListErrorFramesResponse { + // The list of error frames. + repeated ErrorFrame error_frames = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +message GetErrorFrameRequest { + // Required. The name of the frame to retrieve. + // Format: + // projects/{project}/locations/{location}/sources/{source}/errorFrames/{error_frame} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/ErrorFrame" + } + ]; + + // Optional. An optional view mode to control the level of details for the + // frame. The default is a basic frame view. + ErrorFrameView view = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request for a list of sources. +message ListSourcesRequest { + // Required. Parent value for `ListSourcesRequest`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/Source" + } + ]; + + // Requested page size. The server may return fewer items than requested. + // If unspecified, the server will pick an appropriate default value. + int32 page_size = 2; + + // A token identifying a page of results that the server should return. + string page_token = 3; + + // Filtering results. + string filter = 4; + + // Field to sort by. See https://google.aip.dev/132#ordering for more details. + string order_by = 5; +} + +// Response message for listing sources. +message ListSourcesResponse { + // The list of sources. + repeated Source sources = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// A request to get a source. +message GetSourceRequest { + // Required. Name of the resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Source" + } + ]; +} + +// A request to create a source. +message CreateSourceRequest { + // Required. Value for parent. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/Source" + } + ]; + + // Required. User specified ID for the source. It will become the last + // component of the source name. The ID must be unique within the project, + // must conform with RFC-1034, is restricted to lower-cased letters, and has a + // maximum length of 63 characters. The ID must match the regular expression: + // `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. + string source_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The resource being created. + Source source = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to update a source. +message UpdateSourceRequest { + // Required. Field mask is used to specify the fields to be overwritten in the + // `Source` resource by the update. + // The values specified in the `update_mask` field are relative to the + // resource, not the full request. + // A field will be overwritten if it is in the mask. + // A single * value in the mask lets you to overwrite all fields. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The resource being updated + Source source = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to delete a source. +message DeleteSourceRequest { + // Required. Name of the resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Source" + } + ]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for listing preference sets. +message ListPreferenceSetsRequest { + // Required. Parent value for `ListPreferenceSetsRequest`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/PreferenceSet" + } + ]; + + // Requested page size. Server may return fewer items than requested. + // If unspecified, at most 500 preference sets will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // A token identifying a page of results the server should return. + string page_token = 3; + + // Field to sort by. See https://google.aip.dev/132#ordering for more details. + string order_by = 5; +} + +// Response message for listing preference sets. +message ListPreferenceSetsResponse { + // The list of PreferenceSets + repeated PreferenceSet preference_sets = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// A request to get a preference set. +message GetPreferenceSetRequest { + // Required. Name of the resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/PreferenceSet" + } + ]; +} + +// A request to create a preference set. +message CreatePreferenceSetRequest { + // Required. Value for parent. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/PreferenceSet" + } + ]; + + // Required. User specified ID for the preference set. It will become the last + // component of the preference set name. The ID must be unique within the + // project, must conform with RFC-1034, is restricted to lower-cased letters, + // and has a maximum length of 63 characters. The ID must match the regular + // expression + // `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. + string preference_set_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The preference set resource being created. + PreferenceSet preference_set = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to update a preference set. +message UpdatePreferenceSetRequest { + // Required. Field mask is used to specify the fields to be overwritten in the + // `PreferenceSet` resource by the update. + // The values specified in the `update_mask` field are relative to the + // resource, not the full request. + // A field will be overwritten if it is in the mask. + // A single * value in the mask lets you to overwrite all fields. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The preference set resource being updated. + PreferenceSet preference_set = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to delete a preference set. +message DeletePreferenceSetRequest { + // Required. Name of the group resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/PreferenceSet" + } + ]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to get the settings. +message GetSettingsRequest { + // Required. Name of the resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Settings" + } + ]; +} + +// A request to update the settings. +message UpdateSettingsRequest { + // Required. Field mask is used to specify the fields to be overwritten in the + // `Settings` resource by the update. + // The values specified in the `update_mask` field are relative to the + // resource, not the full request. + // A field will be overwritten if it is in the mask. + // A single * value in the mask lets you to overwrite all fields. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The project settings resource being updated. + Settings settings = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to create a `ReportConfig` resource. +message CreateReportConfigRequest { + // Required. Value for parent. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/ReportConfig" + } + ]; + + // Required. User specified ID for the report config. It will become the last + // component of the report config name. The ID must be unique within the + // project, must conform with RFC-1034, is restricted to lower-cased letters, + // and has a maximum length of 63 characters. The ID must match the regular + // expression: [a-z]([a-z0-9-]{0,61}[a-z0-9])?. + string report_config_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The report config set resource being created. + ReportConfig report_config = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to delete a ReportConfig. +message DeleteReportConfigRequest { + // Required. Name of the resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/ReportConfig" + } + ]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set to `true`, any child `Reports` of this entity will also be + // deleted. If set to `false`, the request only works if the resource has no + // children. + bool force = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to get a Report. +message GetReportRequest { + // Required. Name of the resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Report" + } + ]; + + // Determines what information to retrieve for the Report. + ReportView view = 6; +} + +// A request for a list of Reports. +message ListReportsRequest { + // Required. Parent value for `ListReportsRequest`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/Report" + } + ]; + + // Requested page size. The server may return fewer items than requested. + // If unspecified, the server will pick an appropriate default value. + int32 page_size = 2; + + // A token identifying a page of results that the server should return. + string page_token = 3; + + // Filtering results. + string filter = 4; + + // Field to sort by. See https://google.aip.dev/132#ordering for more details. + string order_by = 5; + + // Determines what information to retrieve for each Report. + ReportView view = 6; +} + +// Response message for listing Reports. +message ListReportsResponse { + // The list of Reports. + repeated Report reports = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// A request to delete a Report. +message DeleteReportRequest { + // Required. Name of the resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Report" + } + ]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to get a `ReportConfig` resource. +message GetReportConfigRequest { + // Required. Name of the resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/ReportConfig" + } + ]; +} + +// A request to get a list of `ReportConfig` resources. +message ListReportConfigsRequest { + // Required. Parent value for `ListReportConfigsRequest`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/ReportConfig" + } + ]; + + // Requested page size. Server may return fewer items than requested. + // If unspecified, server will pick an appropriate default. + int32 page_size = 2; + + // A token identifying a page of results the server should return. + string page_token = 3; + + // Filtering results. + string filter = 4; + + // Field to sort by. See https://google.aip.dev/132#ordering for more details. + string order_by = 5; +} + +// Response message for listing report configs. +message ListReportConfigsResponse { + // A list of report configs. + repeated ReportConfig report_configs = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Message for creating a Report. +message CreateReportRequest { + // Required. Value for parent. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "migrationcenter.googleapis.com/Report" + } + ]; + + // Required. User specified id for the report. It will become the last + // component of the report name. The id must be unique within the project, + // must conform with RFC-1034, is restricted to lower-cased letters, and has a + // maximum length of 63 characters. The id must match the regular expression: + // [a-z]([a-z0-9-]{0,61}[a-z0-9])?. + string report_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The report resource being created. + Report report = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Collection of frame data. +message Frames { + // A repeated field of asset data. + repeated AssetFrame frames_data = 1; +} + +// Contains data reported from an inventory source on an asset. +message AssetFrame { + // The internal data of the frame is a oneof field depending on the type + // of asset information in the frame. + oneof FrameData { + // Asset information specific for virtual machines. + MachineDetails machine_details = 1; + } + + // The time the data was reported. + google.protobuf.Timestamp report_time = 10; + + // Labels as key value pairs. + map labels = 11; + + // Generic asset attributes. + map attributes = 12; + + // Asset performance data samples. + repeated PerformanceSample performance_samples = 13; + + // Optional. Trace token is optionally provided to assist with debugging and + // traceability. + string trace_token = 14 [(google.api.field_behavior) = OPTIONAL]; +} + +// Details of a machine. +message MachineDetails { + // Machine power state. + enum PowerState { + // Power state is unknown. + POWER_STATE_UNSPECIFIED = 0; + + // The machine is preparing to enter the ACTIVE state. An instance may enter + // the PENDING state when it launches for the first time, or when it is + // started after being in the SUSPENDED state. + PENDING = 1; + + // The machine is active. + ACTIVE = 2; + + // The machine is being turned off. + SUSPENDING = 3; + + // The machine is off. + SUSPENDED = 4; + + // The machine is being deleted from the hosting platform. + DELETING = 5; + + // The machine is deleted from the hosting platform. + DELETED = 6; + } + + // Machine unique identifier. + string uuid = 1; + + // Machine name. + string machine_name = 2; + + // Machine creation time. + google.protobuf.Timestamp create_time = 3; + + // Number of CPU cores in the machine. Must be non-negative. + int32 core_count = 4; + + // The amount of memory in the machine. Must be non-negative. + int32 memory_mb = 5; + + // Power state of the machine. + PowerState power_state = 6; + + // Architecture details (vendor, CPU architecture). + MachineArchitectureDetails architecture = 7; + + // Guest OS information. + GuestOsDetails guest_os = 8; + + // Network details. + MachineNetworkDetails network = 9; + + // Disk details. + MachineDiskDetails disks = 10; + + // Platform specific information. + PlatformDetails platform = 11; +} + +// Details of the machine architecture. +message MachineArchitectureDetails { + // Firmware type. + enum FirmwareType { + // Unspecified or unknown. + FIRMWARE_TYPE_UNSPECIFIED = 0; + + // BIOS firmware. + BIOS = 1; + + // EFI firmware. + EFI = 2; + } + + // CPU hyper-threading support. + enum CpuHyperThreading { + // Unspecified or unknown. + CPU_HYPER_THREADING_UNSPECIFIED = 0; + + // Hyper-threading is disabled. + DISABLED = 1; + + // Hyper-threading is enabled. + ENABLED = 2; + } + + // CPU architecture, e.g., "x64-based PC", "x86_64", "i686" etc. + string cpu_architecture = 1; + + // CPU name, e.g., "Intel Xeon E5-2690", "AMD EPYC 7571" etc. + string cpu_name = 2; + + // Hardware vendor. + string vendor = 3; + + // Number of CPU threads allocated to the machine. + int32 cpu_thread_count = 4; + + // Number of processor sockets allocated to the machine. + int32 cpu_socket_count = 5; + + // BIOS Details. + BiosDetails bios = 6; + + // Firmware type. + FirmwareType firmware_type = 7; + + // CPU hyper-threading support. + CpuHyperThreading hyperthreading = 8; +} + +// Details about the BIOS. +message BiosDetails { + // BIOS name. + string bios_name = 1; + + // BIOS ID. + string id = 2; + + // BIOS manufacturer. + string manufacturer = 3; + + // BIOS version. + string version = 4; + + // BIOS release date. + google.type.Date release_date = 5; + + // SMBIOS UUID. + string smbios_uuid = 6; +} + +// Details of network adapters and settings. +message MachineNetworkDetails { + // The primary IP address of the machine. + string primary_ip_address = 1; + + // The public IP address of the machine. + string public_ip_address = 2; + + // MAC address of the machine. + // This property is used to uniqly identify the machine. + string primary_mac_address = 3; + + // List of network adapters. + NetworkAdapterList adapters = 4; +} + +// List of network adapters. +message NetworkAdapterList { + // Network adapter entries. + repeated NetworkAdapterDetails entries = 1; +} + +// Details of network adapter. +message NetworkAdapterDetails { + // Network adapter type (e.g. VMXNET3). + string adapter_type = 1; + + // MAC address. + string mac_address = 2; + + // NetworkAddressList + NetworkAddressList addresses = 3; +} + +// List of allocated/assigned network addresses. +message NetworkAddressList { + // Network address entries. + repeated NetworkAddress entries = 1; +} + +// Details of network address. +message NetworkAddress { + // Network address assignment. + enum AddressAssignment { + // Unknown (default value). + ADDRESS_ASSIGNMENT_UNSPECIFIED = 0; + + // Staticly assigned IP. + ADDRESS_ASSIGNMENT_STATIC = 1; + + // Dynamically assigned IP (DHCP). + ADDRESS_ASSIGNMENT_DHCP = 2; + } + + // Assigned or configured IP Address. + string ip_address = 1; + + // Subnet mask. + string subnet_mask = 2; + + // Broadcast address. + string bcast = 3; + + // Fully qualified domain name. + string fqdn = 4; + + // Whether DHCP is used to assign addresses. + AddressAssignment assignment = 5; +} + +// Details of machine disks. +message MachineDiskDetails { + // Disk total Capacity. + int64 total_capacity_bytes = 1; + + // Total disk free space. + int64 total_free_bytes = 2; + + // List of disks. + DiskEntryList disks = 3; +} + +// VM disks. +message DiskEntryList { + // Disk entries. + repeated DiskEntry entries = 1; +} + +// Single disk entry. +message DiskEntry { + // Disks interface type. + enum InterfaceType { + // Interface type unknown or unspecified. + INTERFACE_TYPE_UNSPECIFIED = 0; + + // IDE interface type. + IDE = 1; + + // SATA interface type. + SATA = 2; + + // SAS interface type. + SAS = 3; + + // SCSI interface type. + SCSI = 4; + + // NVME interface type. + NVME = 5; + + // FC interface type. + FC = 6; + + // iSCSI interface type. + ISCSI = 7; + } + + // Disk capacity. + int64 capacity_bytes = 1; + + // Disk free space. + int64 free_bytes = 2; + + // Disk label. + string disk_label = 3; + + // Disk label type (e.g. BIOS/GPT) + string disk_label_type = 4; + + // Disks interface type. + InterfaceType interface_type = 5; + + // Partition layout. + DiskPartitionList partitions = 6; + + // Disk hardware address (e.g. 0:1 for SCSI). + string hw_address = 7; + + // Additional details for specific platforms. + oneof platform_specific { + // VMware disk details. + VmwareDiskConfig vmware = 20; + } +} + +// Disk partition list. +message DiskPartitionList { + // Partition entries. + repeated DiskPartition entries = 1; +} + +// Disk Partition details. +message DiskPartition { + // Partition type. + string type = 1; + + // Partition file system. + string file_system = 2; + + // Mount pount (Linux/Windows) or drive letter (Windows). + string mount_point = 3; + + // Partition capacity. + int64 capacity_bytes = 4; + + // Partition free space. + int64 free_bytes = 5; + + // Partition UUID. + string uuid = 6; + + // Sub-partitions. + DiskPartitionList sub_partitions = 7; +} + +// VMware disk config details. +message VmwareDiskConfig { + // VMDK backing type possible values. + enum BackingType { + // Default value. + BACKING_TYPE_UNSPECIFIED = 0; + + // Flat v1. + BACKING_TYPE_FLAT_V1 = 1; + + // Flat v2. + BACKING_TYPE_FLAT_V2 = 2; + + // Persistent memory, also known as Non-Volatile Memory (NVM). + BACKING_TYPE_PMEM = 3; + + // Raw Disk Memory v1. + BACKING_TYPE_RDM_V1 = 4; + + // Raw Disk Memory v2. + BACKING_TYPE_RDM_V2 = 5; + + // SEsparse is a snapshot format introduced in vSphere 5.5 for large disks. + BACKING_TYPE_SESPARSE = 6; + + // SEsparse v1. + BACKING_TYPE_SESPARSE_V1 = 7; + + // SEsparse v1. + BACKING_TYPE_SESPARSE_V2 = 8; + } + + // VMDK disk mode. + enum VmdkMode { + // VMDK disk mode unspecified or unknown. + VMDK_MODE_UNSPECIFIED = 0; + + // Dependent disk mode. + DEPENDENT = 1; + + // Independent - Persistent disk mode. + INDEPENDENT_PERSISTENT = 2; + + // Independent - Nonpersistent disk mode. + INDEPENDENT_NONPERSISTENT = 3; + } + + // RDM compatibility mode. + enum RdmCompatibility { + // Compatibility mode unspecified or unknown. + RDM_COMPATIBILITY_UNSPECIFIED = 0; + + // Physical compatibility mode. + PHYSICAL_COMPATIBILITY = 1; + + // Virtual compatibility mode. + VIRTUAL_COMPATIBILITY = 2; + } + + // VMDK backing type. + BackingType backing_type = 1; + + // Is VMDK shared with other VMs. + bool shared = 2; + + // VMDK disk mode. + VmdkMode vmdk_mode = 3; + + // RDM compatibility mode. + RdmCompatibility rdm_compatibility = 4; +} + +// Information from Guest-level collections. +message GuestOsDetails { + // The name of the operating system. + string os_name = 1; + + // What family the OS belong to, if known. + OperatingSystemFamily family = 2; + + // The version of the operating system. + string version = 3; + + // OS and app configuration. + GuestConfigDetails config = 4; + + // Runtime information. + GuestRuntimeDetails runtime = 5; +} + +// Guest OS config information. +message GuestConfigDetails { + // Security-Enhanced Linux (SELinux) mode. + enum SeLinuxMode { + // SELinux mode unknown or unspecified. + SE_LINUX_MODE_UNSPECIFIED = 0; + + // SELinux is disabled. + SE_LINUX_MODE_DISABLED = 1; + + // SELinux permissive mode. + SE_LINUX_MODE_PERMISSIVE = 2; + + // SELinux enforcing mode. + SE_LINUX_MODE_ENFORCING = 3; + } + + // OS issue (typically /etc/issue in Linux). + string issue = 1; + + // Mount list (Linux fstab). + FstabEntryList fstab = 2; + + // Hosts file (/etc/hosts). + HostsEntryList hosts = 3; + + // NFS exports. + NfsExportList nfs_exports = 4; + + // Security-Enhanced Linux (SELinux) mode. + SeLinuxMode selinux_mode = 5; +} + +// Fstab content. +message FstabEntryList { + // Fstab entries. + repeated FstabEntry entries = 1; +} + +// Single fstab entry. +message FstabEntry { + // The block special device or remote filesystem to be mounted. + string spec = 1; + + // The mount point for the filesystem. + string file = 2; + + // The type of the filesystem. + string vfstype = 3; + + // Mount options associated with the filesystem. + string mntops = 4; + + // Used by dump to determine which filesystems need to be dumped. + int32 freq = 5; + + // Used by the fsck(8) program to determine the order in which filesystem + // checks are done at reboot time. + int32 passno = 6; +} + +// Hosts content. +message HostsEntryList { + // Hosts entries. + repeated HostsEntry entries = 1; +} + +// Single /etc/hosts entry. +message HostsEntry { + // IP (raw, IPv4/6 agnostic). + string ip = 1; + + // List of host names / aliases. + repeated string host_names = 2; +} + +// NFS exports. +message NfsExportList { + // NFS export entries. + repeated NfsExport entries = 1; +} + +// NFS export. +message NfsExport { + // The directory being exported. + string export_directory = 1; + + // The hosts or networks to which the export is being shared. + repeated string hosts = 2; +} + +// Guest OS runtime information. +message GuestRuntimeDetails { + // Running background services. + RunningServiceList services = 1; + + // Running processes. + RunningProcessList processes = 2; + + // Runtime network information (connections, ports). + RuntimeNetworkInfo network = 3; + + // Last time the OS was booted. + google.protobuf.Timestamp last_boot_time = 4; + + // Domain, e.g. c.stratozone-development.internal. + string domain = 5; + + // Machine name. + string machine_name = 6; + + // Installed applications information. + GuestInstalledApplicationList installed_apps = 7; + + // Open files information. + OpenFileList open_file_list = 8; +} + +// List of running guest OS services. +message RunningServiceList { + // Running service entries. + repeated RunningService entries = 1; +} + +// Guest OS running service details. +message RunningService { + // Service state (OS-agnostic). + enum State { + // Service state unspecified. + STATE_UNSPECIFIED = 0; + + // Service is active. + ACTIVE = 1; + + // Service is paused. + PAUSED = 2; + + // Service is stopped. + STOPPED = 3; + } + + // Service start mode (OS-agnostic). + enum StartMode { + // Start mode unspecified. + START_MODE_UNSPECIFIED = 0; + + // The service is a device driver started by the system loader. + BOOT = 1; + + // The service is a device driver started by the IOInitSystem function. + SYSTEM = 2; + + // The service is started by the operating system, at system start-up + AUTO = 3; + + // The service is started only manually, by a user. + MANUAL = 4; + + // The service is disabled. + DISABLED = 5; + } + + // Service name. + string service_name = 1; + + // Service state (OS-agnostic). + State state = 2; + + // Service start mode (OS-agnostic). + StartMode start_mode = 3; + + // Service binary path. + string exe_path = 4; + + // Service command line. + string cmdline = 5; + + // Service pid. + int64 pid = 6; +} + +// List of running guest OS processes. +message RunningProcessList { + // Running process entries. + repeated RunningProcess entries = 1; +} + +// Guest OS running process details. +message RunningProcess { + // Process ID. + int64 pid = 1; + + // Process binary path. + string exe_path = 2; + + // Process full command line. + string cmdline = 3; + + // User running the process. + string user = 4; + + // Process extended attributes. + map attributes = 100; +} + +// Runtime networking information. +message RuntimeNetworkInfo { + // Time of the last network scan. + google.protobuf.Timestamp scan_time = 1; + + // Network connections. + NetworkConnectionList connections = 2; +} + +// Network connection list. +message NetworkConnectionList { + // Network connection entries. + repeated NetworkConnection entries = 1; +} + +message NetworkConnection { + // Network connection state. + enum State { + // Connection state is unknown or unspecified. + STATE_UNSPECIFIED = 0; + + // The connection is being opened. + OPENING = 1; + + // The connection is open. + OPEN = 2; + + // Listening for incoming connections. + LISTEN = 3; + + // The connection is being closed. + CLOSING = 4; + + // The connection is closed. + CLOSED = 5; + } + + // Connection protocol (e.g. TCP/UDP). + string protocol = 1; + + // Local IP address. + string local_ip_address = 2; + + // Local port. + int32 local_port = 3; + + // Remote IP address. + string remote_ip_address = 4; + + // Remote port. + int32 remote_port = 5; + + // Network connection state. + State state = 6; + + // Process ID. + int64 pid = 7; + + // Process or service name. + string process_name = 8; +} + +// Guest installed application list. +message GuestInstalledApplicationList { + // Application entries. + repeated GuestInstalledApplication entries = 1; +} + +// Guest installed application information. +message GuestInstalledApplication { + // Installed application name. + string application_name = 1; + + // Installed application vendor. + string vendor = 2; + + // The time when the application was installed. + google.protobuf.Timestamp install_time = 3; + + // Source path. + string path = 4; + + // Installed application version. + string version = 5; +} + +// Open file list. +message OpenFileList { + // Open file details entries. + repeated OpenFileDetails entries = 1; +} + +// Open file Information. +message OpenFileDetails { + // Opened file command. + string command = 1; + + // Opened file user. + string user = 2; + + // Opened file file type. + string file_type = 3; + + // Opened file file path. + string file_path = 4; +} + +// Information about the platform. +message PlatformDetails { + oneof vendor_details { + // VMware specific details. + VmwarePlatformDetails vmware_details = 1; + + // AWS EC2 specific details. + AwsEc2PlatformDetails aws_ec2_details = 2; + + // Azure VM specific details. + AzureVmPlatformDetails azure_vm_details = 3; + + // Generic platform details. + GenericPlatformDetails generic_details = 4; + + // Physical machines platform details. + PhysicalPlatformDetails physical_details = 5; + } +} + +// VMware specific details. +message VmwarePlatformDetails { + // vCenter version. + string vcenter_version = 1; + + // ESX version. + string esx_version = 2; + + // VMware os enum - + // https://vdc-repo.vmware.com/vmwb-repository/dcr-public/da47f910-60ac-438b-8b9b-6122f4d14524/16b7274a-bf8b-4b4c-a05e-746f2aa93c8c/doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html. + string osid = 3; + + // Folder name in vCenter where asset resides. + string vcenter_folder = 4; + + // vCenter URI used in collection. + string vcenter_uri = 5; + + // vCenter VM ID. + string vcenter_vm_id = 6; +} + +// AWS EC2 specific details. +message AwsEc2PlatformDetails { + // AWS platform's machine type label. + string machine_type_label = 1; + + // The location of the machine in the AWS format. + string location = 2; +} + +// Azure VM specific details. +message AzureVmPlatformDetails { + // Azure platform's machine type label. + string machine_type_label = 1; + + // The location of the machine in the Azure format. + string location = 2; + + // Azure platform's provisioning state. + string provisioning_state = 3; +} + +// Generic platform details. +message GenericPlatformDetails { + // Free text representation of the machine location. + // The format of this field should not be relied on. Different VMs in the same + // location may have different string values for this field. + string location = 1; +} + +// Platform specific details for Physical Machines. +message PhysicalPlatformDetails { + // Free text representation of the machine location. + // The format of this field should not be relied on. Different machines in the + // same location may have different string values for this field. + string location = 1; +} + +// Memory usage sample. +message MemoryUsageSample { + // Percentage of system memory utilized. Must be in the interval [0, 100]. + float utilized_percentage = 1; +} + +// CPU usage sample. +message CpuUsageSample { + // Percentage of total CPU capacity utilized. Must be in the interval [0, + // 100]. On most systems can be calculated using 100 - idle percentage. + float utilized_percentage = 1; +} + +// Network usage sample. Values are across all network interfaces. +message NetworkUsageSample { + // Average network ingress in B/s sampled over a short window. + // Must be non-negative. + float average_ingress_bps = 1; + + // Average network egress in B/s sampled over a short window. + // Must be non-negative. + float average_egress_bps = 2; +} + +// Disk usage sample. Values are across all disks. +message DiskUsageSample { + // Average IOPS sampled over a short window. Must be non-negative. + float average_iops = 1; +} + +// Performance data sample. +message PerformanceSample { + // Time the sample was collected. + google.protobuf.Timestamp sample_time = 1; + + // Memory usage sample. + MemoryUsageSample memory = 2; + + // CPU usage sample. + CpuUsageSample cpu = 3; + + // Network usage sample. + NetworkUsageSample network = 4; + + // Disk usage sample. + DiskUsageSample disk = 5; +} + +// Performance data for an asset. +message AssetPerformanceData { + // Daily resource usage aggregations. + // Contains all of the data available for an asset, up to the last 420 days. + // Aggregations are sorted from oldest to most recent. + repeated DailyResourceUsageAggregation daily_resource_usage_aggregations = 1; +} + +// Usage data aggregation for a single day. +message DailyResourceUsageAggregation { + // Statistical aggregation of samples for a single resource usage. + message Stats { + // Average usage value. + float average = 1; + + // Median usage value. + float median = 2; + + // 95th percentile usage value. + float nintey_fifth_percentile = 3; + + // Peak usage value. + float peak = 4; + } + + // Statistical aggregation of CPU usage. + message CPU { + // CPU utilization percentage. + Stats utilization_percentage = 1; + } + + // Statistical aggregation of memory usage. + message Memory { + // Memory utilization percentage. + Stats utilization_percentage = 1; + } + + // Statistical aggregation of network usage. + message Network { + // Network ingress in B/s. + Stats ingress_bps = 1; + + // Network egress in B/s. + Stats egress_bps = 2; + } + + // Statistical aggregation of disk usage. + message Disk { + // Disk I/O operations per second. + Stats iops = 1; + } + + // Aggregation date. Day boundaries are at midnight UTC. + google.type.Date date = 1; + + // CPU usage. + CPU cpu = 2; + + // Memory usage. + Memory memory = 3; + + // Network usage. + Network network = 4; + + // Disk usage. + Disk disk = 5; +} + +// Message containing insights list. +message InsightList { + // Output only. Insights of the list. + repeated Insight insights = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Update timestamp. + google.protobuf.Timestamp update_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// An insight about an asset. +message Insight { + oneof insight { + // Output only. An insight about potential migrations for an asset. + MigrationInsight migration_insight = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + } +} + +// An insight about potential migrations for an asset. +message MigrationInsight { + // Output only. Description of how well the asset this insight is associated + // with fits the proposed migration. + FitDescriptor fit = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A target for the migration. + oneof migration_target { + // Output only. A Google Compute Engine target. + ComputeEngineMigrationTarget compute_engine_target = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + } +} + +// Compute engine migration target. +message ComputeEngineMigrationTarget { + // Description of the suggested shape for the migration target. + ComputeEngineShapeDescriptor shape = 1; +} + +// Describes the fit level of an asset for migration to a specific target. +message FitDescriptor { + // Fit level. + enum FitLevel { + // Not enough information. + FIT_LEVEL_UNSPECIFIED = 0; + + // Fit. + FIT = 1; + + // No Fit. + NO_FIT = 2; + + // Fit with effort. + REQUIRES_EFFORT = 3; + } + + // Fit level. + FitLevel fit_level = 1; +} + +// Compute Engine target shape descriptor. +message ComputeEngineShapeDescriptor { + // Memory in mebibytes. + int32 memory_mb = 1; + + // Number of physical cores. + int32 physical_core_count = 2; + + // Number of logical cores. + int32 logical_core_count = 3; + + // Compute Engine machine series. + string series = 4; + + // Compute Engine machine type. + string machine_type = 5; +} + +// Message describing an aggregation. The message includes the aggregation type, +// parameters, and the field on which to perform the aggregation. +message Aggregation { + // Object count. + message Count {} + + // Sum of field values. + message Sum {} + + // Histogram of bucketed assets counts by field value. + message Histogram { + // Lower bounds of buckets. + // The response will contain `n+1` buckets for `n` bounds. + // The first bucket will count all assets for which the field value is + // smaller than the first bound. + // Subsequent buckets will count assets for which the field value is + // greater or equal to a lower bound and smaller than the next one. + // The last bucket will count assets for which the field value is greater or + // equal to the final lower bound. + // You can define up to 20 lower bounds. + repeated double lower_bounds = 1; + } + + // Frequency distribution of all field values. + message Frequency {} + + // The name of the field on which to aggregate. + string field = 1; + + oneof aggregation_function { + // Count the number of matching objects. + Count count = 2; + + // Sum over a numeric field. + Sum sum = 3; + + // Creates a bucketed histogram of field values. + Histogram histogram = 4; + + // Creates a frequency distribution of all field values. + Frequency frequency = 5; + } +} + +// Message describing a result of an aggregation. +message AggregationResult { + // The result of a count aggregation. + message Count { + int64 value = 1; + } + + // The result of a sum aggregation. + message Sum { + double value = 1; + } + + // The result of a bucketed histogram aggregation. + message Histogram { + // A histogram bucket with a lower and upper bound, and a count of items + // with a field value between those bounds. + // The lower bound is inclusive and the upper bound is exclusive. + // Lower bound may be -infinity and upper bound may be infinity. + message Bucket { + // Lower bound - inclusive. + double lower_bound = 1; + + // Upper bound - exclusive. + double upper_bound = 2; + + // Count of items in the bucket. + int64 count = 3; + } + + // Buckets in the histogram. + // There will be `n+1` buckets matching `n` lower bounds in the request. + // The first bucket will be from -infinity to the first bound. + // Subsequent buckets will be between one bound and the next. + // The final bucket will be from the final bound to infinity. + repeated Bucket buckets = 1; + } + + // The result of a frequency distribution aggregation. + message Frequency { + map values = 1; + } + + string field = 1; + + oneof result { + Count count = 2; + + Sum sum = 3; + + Histogram histogram = 4; + + Frequency frequency = 5; + } +} + +// A resource that aggregates the validation errors found in an import job file. +message FileValidationReport { + // The name of the file. + string file_name = 1; + + // Partial list of rows that encountered validation error. + repeated ImportRowError row_errors = 2; + + // Flag indicating that processing was aborted due to maximum number of + // errors. + bool partial_report = 3; + + // List of file level errors. + repeated ImportError file_errors = 4; +} + +// A resource that aggregates errors across import job files. +message ValidationReport { + // List of errors found in files. + repeated FileValidationReport file_validations = 1; + + // List of job level errors. + repeated ImportError job_errors = 2; +} + +// A resource that reports result of the import job execution. +message ExecutionReport { + // Total number of asset frames reported for the import job. + int32 frames_reported = 1; + + // Validation errors encountered during the execution of the import job. + ValidationReport execution_errors = 2; + + // Total number of rows in the import job. + int32 total_rows_count = 3; +} + +// A resource that reports the errors encountered while processing an +// import job. +message ImportError { + // Enumerate possible error severity. + enum Severity { + SEVERITY_UNSPECIFIED = 0; + + ERROR = 1; + + WARNING = 2; + + INFO = 3; + } + + // The error information. + string error_details = 1; + + // The severity of the error. + Severity severity = 2; +} + +// A resource that reports the import job errors at row level. +message ImportRowError { + // The row number where the error was detected. + int32 row_number = 1 [deprecated = true]; + + // The name of the VM in the row. + string vm_name = 2; + + // The VM UUID. + string vm_uuid = 3; + + // The list of errors detected in the row. + repeated ImportError errors = 4; +} + +// A resource that contains a URI to which a data file can be uploaded. +message UploadFileInfo { + // Output only. Upload URI for the file. + string signed_uri = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The headers that were used to sign the URI. + map headers = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Expiration time of the upload URI. + google.protobuf.Timestamp uri_expiration_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Lists the asset IDs of all assets. +message AssetList { + // Required. A list of asset IDs + repeated string asset_ids = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/Asset" + } + ]; +} + +// A resource that contains a single violation of a reported `AssetFrame` +// resource. +message FrameViolationEntry { + // The field of the original frame where the violation occurred. + string field = 1; + + // A message describing the violation. + string violation = 2; +} + +// VirtualMachinePreferences enables you to create sets of assumptions, for +// example, a geographical location and pricing track, for your migrated virtual +// machines. The set of preferences influence recommendations for migrating +// virtual machine assets. +message VirtualMachinePreferences { + // Region preferences for assets using this preference set. + // If you are unsure which value to set, the migration service API region is + // often a good value to start with. + RegionPreferences region_preferences = 3; + + // Commitment plan to consider when calculating costs for virtual machine + // insights and recommendations. + // If you are unsure which value to set, a 3 year commitment plan is often a + // good value to start with. + CommitmentPlan commitment_plan = 4; + + // Sizing optimization strategy specifies the preferred strategy used when + // extrapolating usage data to calculate insights and recommendations for a + // virtual machine. + // If you are unsure which value to set, a moderate sizing optimization + // strategy is often a good value to start with. + SizingOptimizationStrategy sizing_optimization_strategy = 5; + + // Compute Engine preferences concern insights and recommendations for Compute + // Engine target. + ComputeEnginePreferences compute_engine_preferences = 6; +} + +// The user preferences relating to Compute Engine target platform. +message ComputeEnginePreferences { + // Preferences concerning the machine types to consider on Compute Engine. + MachinePreferences machine_preferences = 2; + + // License type to consider when calculating costs for virtual machine + // insights and recommendations. If unspecified, costs are calculated + // based on the default licensing plan. + LicenseType license_type = 3; +} + +// The type of machines to consider when calculating virtual machine migration +// insights and recommendations. +// Not all machine types are available in all zones and regions. +message MachinePreferences { + // Compute Engine machine series to consider for insights and recommendations. + // If empty, no restriction is applied on the machine series. + repeated MachineSeries allowed_machine_series = 1; +} + +// A Compute Engine machine series. +message MachineSeries { + // Code to identify a Compute Engine machine series. Consult + // https://cloud.google.com/compute/docs/machine-resource#machine_type_comparison + // for more details on the available series. + string code = 1; +} + +// The user preferences relating to target regions. +message RegionPreferences { + // A list of preferred regions, + // ordered by the most preferred region first. + // Set only valid Google Cloud region names. + // See https://cloud.google.com/compute/docs/regions-zones + // for available regions. + repeated string preferred_regions = 1; +} + +// Describes the Migration Center settings related to the project. +message Settings { + option (google.api.resource) = { + type: "migrationcenter.googleapis.com/Settings" + pattern: "projects/{project}/locations/{location}/settings" + }; + + // Output only. The name of the resource. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The preference set used by default for a project. + string preference_set = 2 [(google.api.resource_reference) = { + type: "migrationcenter.googleapis.com/PreferenceSet" + }]; +} + +// Describes the Summary view of a Report, which contains aggregated values +// for all the groups and preference sets included in this Report. +message ReportSummary { + // Describes a collection of data points rendered as a Chart. + message ChartData { + // Describes a single data point in the Chart. + message DataPoint { + // The X-axis label for this data point. + string label = 1; + + // The Y-axis value for this data point. + double value = 2; + } + + // Each data point in the chart is represented as a name-value pair + // with the name being the x-axis label, and the value being the y-axis + // value. + repeated DataPoint data_points = 1; + } + + // Utilization Chart is a specific type of visualization which displays + // a metric classified into "Used" and "Free" buckets. + message UtilizationChartData { + // Aggregate value which falls into the "Used" bucket. + int64 used = 1; + + // Aggregate value which falls into the "Free" bucket. + int64 free = 2; + } + + // A Histogram Chart shows a distribution of values into buckets, showing + // a count of values which fall into a bucket. + message HistogramChartData { + // A histogram bucket with a lower and upper bound, and a count of items + // with a field value between those bounds. + // The lower bound is inclusive and the upper bound is exclusive. + // Lower bound may be -infinity and upper bound may be infinity. + message Bucket { + // Lower bound - inclusive. + int64 lower_bound = 1; + + // Upper bound - exclusive. + int64 upper_bound = 2; + + // Count of items in the bucket. + int64 count = 3; + } + + // Buckets in the histogram. + // There will be `n+1` buckets matching `n` lower bounds in the request. + // The first bucket will be from -infinity to the first bound. + // Subsequent buckets will be between one bound and the next. + // The final bucket will be from the final bound to infinity. + repeated Bucket buckets = 1; + } + + // Aggregate statistics for a collection of assets. + message AssetAggregateStats { + // Sum of the memory in bytes of all the assets in this collection. + int64 total_memory_bytes = 1; + + // Sum of persistent storage in bytes of all the assets in this collection. + int64 total_storage_bytes = 2; + + // Sum of the CPU core count of all the assets in this collection. + int64 total_cores = 3; + + // Count of the number of unique assets in this collection. + int64 total_assets = 4; + + // Total memory split into Used/Free buckets. + UtilizationChartData memory_utilization_chart = 5; + + // Total memory split into Used/Free buckets. + UtilizationChartData storage_utilization_chart = 6; + + // Count of assets grouped by Operating System families. + ChartData operating_system = 7; + + // Histogram showing a distribution of CPU core counts. + HistogramChartData core_count_histogram = 8; + + // Histogram showing a distribution of memory sizes. + HistogramChartData memory_bytes_histogram = 9; + + // Histogram showing a distribution of memory sizes. + HistogramChartData storage_bytes_histogram = 10; + } + + // Represents a data point tracking the count of assets allocated for a + // specific Machine Series. + message MachineSeriesAllocation { + // The Machine Series (e.g. "E2", "N2") + MachineSeries machine_series = 1; + + // Count of assets allocated to this machine series. + int64 allocated_asset_count = 2; + } + + // A set of findings that applies to assets destined for Compute Engine. + message ComputeEngineFinding { + // Set of regions in which the assets were allocated. + repeated string allocated_regions = 1; + + // Count of assets which were allocated. + int64 allocated_asset_count = 2; + + // Distribution of assets based on the Machine Series. + repeated MachineSeriesAllocation machine_series_allocations = 3; + + // Set of disk types allocated to assets. + repeated PersistentDiskType allocated_disk_types = 4; + } + + // Summary Findings for a specific Group/PreferenceSet combination. + message GroupPreferenceSetFinding { + // Display Name of the Preference Set + string display_name = 1; + + // Description for the Preference Set. + string description = 2; + + // A set of preferences that applies to all machines in the context. + VirtualMachinePreferences machine_preferences = 3; + + // Total monthly cost for this preference set. + google.type.Money monthly_cost_total = 4; + + // Compute monthly cost for this preference set. + google.type.Money monthly_cost_compute = 5; + + // Licensing monthly cost for this preference set. + google.type.Money monthly_cost_os_license = 6; + + // Network Egress monthly cost for this preference set. + google.type.Money monthly_cost_network_egress = 7; + + // Storage monthly cost for this preference set. + google.type.Money monthly_cost_storage = 8; + + // Miscellaneous monthly cost for this preference set. + google.type.Money monthly_cost_other = 9; + + // A set of findings that applies to Compute Engine machines in the input. + ComputeEngineFinding compute_engine_finding = 10; + } + + // Summary Findings for a specific Group. + message GroupFinding { + // Display Name for the Group. + string display_name = 1; + + // Description for the Group. + string description = 2; + + // Summary statistics for all the assets in this group. + AssetAggregateStats asset_aggregate_stats = 3; + + // Count of the number of assets in this group which are also included + // in another group within the same report. + int64 overlapping_asset_count = 4; + + // Findings for each of the PreferenceSets for this group. + repeated GroupPreferenceSetFinding preference_set_findings = 5; + } + + // Aggregate statistics for all the assets across all the groups. + AssetAggregateStats all_assets_stats = 1; + + // Findings for each Group included in this report. + repeated GroupFinding group_findings = 2; +} + +// Specifies the types of asset views that provide complete or partial details +// of an asset. +enum AssetView { + // The asset view is not specified. The API displays the basic view by + // default. + ASSET_VIEW_UNSPECIFIED = 0; + + // The asset view includes only basic metadata of the asset. + ASSET_VIEW_BASIC = 1; + + // The asset view includes all the metadata of an asset and performance data. + ASSET_VIEW_FULL = 2; +} + +// Known categories of operating systems. +enum OperatingSystemFamily { + OS_FAMILY_UNKNOWN = 0; + + // Microsoft Windows Server and Desktop. + OS_FAMILY_WINDOWS = 1; + + // Various Linux flavors. + OS_FAMILY_LINUX = 2; + + // Non-Linux Unix flavors. + OS_FAMILY_UNIX = 3; +} + +// Specifies the data formats supported by Migration Center. +enum ImportJobFormat { + // Default value. + IMPORT_JOB_FORMAT_UNSPECIFIED = 0; + + // RVTools format (XLSX). + IMPORT_JOB_FORMAT_RVTOOLS_XLSX = 1; + + // RVTools format (CSV). + IMPORT_JOB_FORMAT_RVTOOLS_CSV = 2; + + // CSV format exported from AWS using the + // [AWS collection + // script][https://github.com/GoogleCloudPlatform/aws-to-stratozone-export]. + IMPORT_JOB_FORMAT_EXPORTED_AWS_CSV = 4; + + // CSV format exported from Azure using the + // [Azure collection + // script][https://github.com/GoogleCloudPlatform/azure-to-stratozone-export]. + IMPORT_JOB_FORMAT_EXPORTED_AZURE_CSV = 5; + + // CSV format created manually and following the StratoZone format. For more + // information, see [Manually create and upload data + // tables][https://cloud.google.com/migrate/stratozone/docs/import-data-portal]. + IMPORT_JOB_FORMAT_STRATOZONE_CSV = 6; +} + +// Specifies the types of import job views that provide complete or partial +// details of an import job. +enum ImportJobView { + // The import job view is not specified. The API displays the basic view by + // default. + IMPORT_JOB_VIEW_UNSPECIFIED = 0; + + // The import job view includes basic metadata of an import job. + // This view does not include payload information. + IMPORT_JOB_VIEW_BASIC = 1; + + // The import job view includes all metadata of an import job. + IMPORT_JOB_VIEW_FULL = 2; +} + +// ErrorFrameView can be specified in ErrorFrames List and Get requests to +// control the level of details that is returned for the original frame. +enum ErrorFrameView { + // Value is unset. The system will fallback to the default value. + ERROR_FRAME_VIEW_UNSPECIFIED = 0; + + // Include basic frame data, but not the full contents. + ERROR_FRAME_VIEW_BASIC = 1; + + // Include everything. + ERROR_FRAME_VIEW_FULL = 2; +} + +// The persistent disk (PD) types of Compute Engine virtual machines. +enum PersistentDiskType { + // Unspecified (default value). + // Selecting this value allows the system to use any disk type according + // to reported usage. This a good value to start with. + PERSISTENT_DISK_TYPE_UNSPECIFIED = 0; + + // Standard HDD Persistent Disk. + PERSISTENT_DISK_TYPE_STANDARD = 1; + + // Balanced Persistent Disk. + PERSISTENT_DISK_TYPE_BALANCED = 2; + + // SSD Persistent Disk. + PERSISTENT_DISK_TYPE_SSD = 3; +} + +// The License type for premium images (RHEL, RHEL for SAP, SLES, SLES for SAP, +// Windows Server). +enum LicenseType { + // Unspecified (default value). + LICENSE_TYPE_UNSPECIFIED = 0; + + // Default Google Cloud licensing plan. Licensing is charged per usage. + // This a good value to start with. + LICENSE_TYPE_DEFAULT = 1; + + // Bring-your-own-license (BYOL) plan. User provides the OS license. + LICENSE_TYPE_BRING_YOUR_OWN_LICENSE = 2; +} + +// The sizing optimization strategy preferences of a virtual machine. This +// strategy, in addition to actual usage data of the virtual machine, can help +// determine the recommended shape on the target platform. +enum SizingOptimizationStrategy { + // Unspecified (default value). + SIZING_OPTIMIZATION_STRATEGY_UNSPECIFIED = 0; + + // No optimization applied. Virtual machine sizing matches as closely as + // possible the machine shape on the source site, not considering any actual + // performance data. + SIZING_OPTIMIZATION_STRATEGY_SAME_AS_SOURCE = 1; + + // Virtual machine sizing will match the reported usage and shape, with some + // slack. This a good value to start with. + SIZING_OPTIMIZATION_STRATEGY_MODERATE = 2; + + // Virtual machine sizing will match the reported usage, with little slack. + // Using this option can help reduce costs. + SIZING_OPTIMIZATION_STRATEGY_AGGRESSIVE = 3; +} + +// The plan of commitments for VM resource-based committed use discount (CUD). +enum CommitmentPlan { + // Unspecified commitment plan. + COMMITMENT_PLAN_UNSPECIFIED = 0; + + // No commitment plan. + COMMITMENT_PLAN_NONE = 1; + + // 1 year commitment. + COMMITMENT_PLAN_ONE_YEAR = 2; + + // 3 years commitment. + COMMITMENT_PLAN_THREE_YEARS = 3; +} + +// Specifies the types of views that provide complete or partial details +// of a Report. +enum ReportView { + // The report view is not specified. The API displays the basic view by + // default. + REPORT_VIEW_UNSPECIFIED = 0; + + // The report view includes only basic metadata of the Report. Useful for + // list views. + REPORT_VIEW_BASIC = 1; + + // The report view includes all the metadata of the Report. Useful for + // preview. + REPORT_VIEW_FULL = 2; + + // The report view includes the standard metadata of an report. Useful for + // detail view. + REPORT_VIEW_STANDARD = 3; +} diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.add_assets_to_group.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.add_assets_to_group.js new file mode 100644 index 00000000000..6d6f38dff5c --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.add_assets_to_group.js @@ -0,0 +1,91 @@ +// 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(group, assets) { + // [START migrationcenter_v1_generated_MigrationCenter_AddAssetsToGroup_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. Group reference. + */ + // const group = 'abc123' + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + /** + * Required. List of assets to be added. + * The maximum number of assets that can be added in a single request is + * 1000. + */ + // const assets = {} + /** + * Optional. When this value is set to `false` and one of the given assets is + * already an existing member of the group, the operation fails with an + * `Already Exists` error. When set to `true` this situation is silently + * ignored by the server. + * Default value is `false`. + */ + // const allowExisting = true + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callAddAssetsToGroup() { + // Construct request + const request = { + group, + assets, + }; + + // Run request + const [operation] = await migrationcenterClient.addAssetsToGroup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callAddAssetsToGroup(); + // [END migrationcenter_v1_generated_MigrationCenter_AddAssetsToGroup_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-migrationcenter/v1/samples/generated/v1/migration_center.aggregate_assets_values.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.aggregate_assets_values.js new file mode 100644 index 00000000000..79d01f9f78b --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.aggregate_assets_values.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(parent) { + // [START migrationcenter_v1_generated_MigrationCenter_AggregateAssetsValues_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. Parent value for `AggregateAssetsValuesRequest`. + */ + // const parent = 'abc123' + /** + * Array of aggregations to perform. + * Up to 25 aggregations can be defined. + */ + // const aggregations = [1,2,3,4] + /** + * The aggregation will be performed on assets that match the provided filter. + */ + // const filter = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callAggregateAssetsValues() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await migrationcenterClient.aggregateAssetsValues(request); + console.log(response); + } + + callAggregateAssetsValues(); + // [END migrationcenter_v1_generated_MigrationCenter_AggregateAssetsValues_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-migrationcenter/v1/samples/generated/v1/migration_center.batch_delete_assets.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.batch_delete_assets.js new file mode 100644 index 00000000000..90d06123302 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.batch_delete_assets.js @@ -0,0 +1,74 @@ +// 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, names) { + // [START migrationcenter_v1_generated_MigrationCenter_BatchDeleteAssets_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. Parent value for batch asset delete. + */ + // const parent = 'abc123' + /** + * Required. The IDs of the assets to delete. + * A maximum of 1000 assets can be deleted in a batch. + * Format: projects/{project}/locations/{location}/assets/{name}. + */ + // const names = ['abc','def'] + /** + * Optional. When this value is set to `true` the request is a no-op for + * non-existing assets. See https://google.aip.dev/135#delete-if-existing for + * additional details. Default value is `false`. + */ + // const allowMissing = true + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callBatchDeleteAssets() { + // Construct request + const request = { + parent, + names, + }; + + // Run request + const response = await migrationcenterClient.batchDeleteAssets(request); + console.log(response); + } + + callBatchDeleteAssets(); + // [END migrationcenter_v1_generated_MigrationCenter_BatchDeleteAssets_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-migrationcenter/v1/samples/generated/v1/migration_center.batch_update_assets.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.batch_update_assets.js new file mode 100644 index 00000000000..9989849c2c2 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.batch_update_assets.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, requests) { + // [START migrationcenter_v1_generated_MigrationCenter_BatchUpdateAssets_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. Parent value for batch asset update. + */ + // const parent = 'abc123' + /** + * Required. The request message specifying the resources to update. + * A maximum of 1000 assets can be modified in a batch. + */ + // const requests = [1,2,3,4] + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callBatchUpdateAssets() { + // Construct request + const request = { + parent, + requests, + }; + + // Run request + const response = await migrationcenterClient.batchUpdateAssets(request); + console.log(response); + } + + callBatchUpdateAssets(); + // [END migrationcenter_v1_generated_MigrationCenter_BatchUpdateAssets_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-migrationcenter/v1/samples/generated/v1/migration_center.create_group.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_group.js new file mode 100644 index 00000000000..0b5c90400c9 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_group.js @@ -0,0 +1,90 @@ +// 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, groupId, group) { + // [START migrationcenter_v1_generated_MigrationCenter_CreateGroup_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. Value for parent. + */ + // const parent = 'abc123' + /** + * Required. User specified ID for the group. It will become the last + * component of the group name. The ID must be unique within the project, must + * conform with RFC-1034, is restricted to lower-cased letters, and has a + * maximum length of 63 characters. The ID must match the regular expression: + * `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. + */ + // const groupId = 'abc123' + /** + * Required. The group resource being created. + */ + // const group = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callCreateGroup() { + // Construct request + const request = { + parent, + groupId, + group, + }; + + // Run request + const [operation] = await migrationcenterClient.createGroup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateGroup(); + // [END migrationcenter_v1_generated_MigrationCenter_CreateGroup_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-migrationcenter/v1/samples/generated/v1/migration_center.create_import_data_file.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_import_data_file.js new file mode 100644 index 00000000000..695050601ef --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_import_data_file.js @@ -0,0 +1,86 @@ +// 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, importDataFileId, importDataFile) { + // [START migrationcenter_v1_generated_MigrationCenter_CreateImportDataFile_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 parent of the ImportDataFile. + */ + // const parent = 'abc123' + /** + * Required. The ID of the new data file. + */ + // const importDataFileId = 'abc123' + /** + * Required. The resource being created. + */ + // const importDataFile = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callCreateImportDataFile() { + // Construct request + const request = { + parent, + importDataFileId, + importDataFile, + }; + + // Run request + const [operation] = await migrationcenterClient.createImportDataFile(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateImportDataFile(); + // [END migrationcenter_v1_generated_MigrationCenter_CreateImportDataFile_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-migrationcenter/v1/samples/generated/v1/migration_center.create_import_job.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_import_job.js new file mode 100644 index 00000000000..247fb6d627a --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_import_job.js @@ -0,0 +1,86 @@ +// 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, importJobId, importJob) { + // [START migrationcenter_v1_generated_MigrationCenter_CreateImportJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Value for parent. + */ + // const parent = 'abc123' + /** + * Required. ID of the import job. + */ + // const importJobId = 'abc123' + /** + * Required. The resource being created. + */ + // const importJob = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callCreateImportJob() { + // Construct request + const request = { + parent, + importJobId, + importJob, + }; + + // Run request + const [operation] = await migrationcenterClient.createImportJob(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateImportJob(); + // [END migrationcenter_v1_generated_MigrationCenter_CreateImportJob_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-migrationcenter/v1/samples/generated/v1/migration_center.create_preference_set.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_preference_set.js new file mode 100644 index 00000000000..420acdb1105 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_preference_set.js @@ -0,0 +1,91 @@ +// 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, preferenceSetId, preferenceSet) { + // [START migrationcenter_v1_generated_MigrationCenter_CreatePreferenceSet_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. Value for parent. + */ + // const parent = 'abc123' + /** + * Required. User specified ID for the preference set. It will become the last + * component of the preference set name. The ID must be unique within the + * project, must conform with RFC-1034, is restricted to lower-cased letters, + * and has a maximum length of 63 characters. The ID must match the regular + * expression + * `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. + */ + // const preferenceSetId = 'abc123' + /** + * Required. The preference set resource being created. + */ + // const preferenceSet = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callCreatePreferenceSet() { + // Construct request + const request = { + parent, + preferenceSetId, + preferenceSet, + }; + + // Run request + const [operation] = await migrationcenterClient.createPreferenceSet(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreatePreferenceSet(); + // [END migrationcenter_v1_generated_MigrationCenter_CreatePreferenceSet_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-migrationcenter/v1/samples/generated/v1/migration_center.create_report.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_report.js new file mode 100644 index 00000000000..a479c8924d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_report.js @@ -0,0 +1,90 @@ +// 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, reportId, report) { + // [START migrationcenter_v1_generated_MigrationCenter_CreateReport_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. Value for parent. + */ + // const parent = 'abc123' + /** + * Required. User specified id for the report. It will become the last + * component of the report name. The id must be unique within the project, + * must conform with RFC-1034, is restricted to lower-cased letters, and has a + * maximum length of 63 characters. The id must match the regular expression: + * [a-z]([a-z0-9-]{0,61}[a-z0-9])?. + */ + // const reportId = 'abc123' + /** + * Required. The report resource being created. + */ + // const report = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callCreateReport() { + // Construct request + const request = { + parent, + reportId, + report, + }; + + // Run request + const [operation] = await migrationcenterClient.createReport(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateReport(); + // [END migrationcenter_v1_generated_MigrationCenter_CreateReport_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-migrationcenter/v1/samples/generated/v1/migration_center.create_report_config.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_report_config.js new file mode 100644 index 00000000000..e1fcf0284b1 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_report_config.js @@ -0,0 +1,90 @@ +// 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, reportConfigId, reportConfig) { + // [START migrationcenter_v1_generated_MigrationCenter_CreateReportConfig_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. Value for parent. + */ + // const parent = 'abc123' + /** + * Required. User specified ID for the report config. It will become the last + * component of the report config name. The ID must be unique within the + * project, must conform with RFC-1034, is restricted to lower-cased letters, + * and has a maximum length of 63 characters. The ID must match the regular + * expression: [a-z]([a-z0-9-]{0,61}[a-z0-9])?. + */ + // const reportConfigId = 'abc123' + /** + * Required. The report config set resource being created. + */ + // const reportConfig = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callCreateReportConfig() { + // Construct request + const request = { + parent, + reportConfigId, + reportConfig, + }; + + // Run request + const [operation] = await migrationcenterClient.createReportConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateReportConfig(); + // [END migrationcenter_v1_generated_MigrationCenter_CreateReportConfig_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-migrationcenter/v1/samples/generated/v1/migration_center.create_source.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_source.js new file mode 100644 index 00000000000..f30cf115eaa --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_source.js @@ -0,0 +1,90 @@ +// 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, sourceId, source) { + // [START migrationcenter_v1_generated_MigrationCenter_CreateSource_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. Value for parent. + */ + // const parent = 'abc123' + /** + * Required. User specified ID for the source. It will become the last + * component of the source name. The ID must be unique within the project, + * must conform with RFC-1034, is restricted to lower-cased letters, and has a + * maximum length of 63 characters. The ID must match the regular expression: + * `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. + */ + // const sourceId = 'abc123' + /** + * Required. The resource being created. + */ + // const source = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callCreateSource() { + // Construct request + const request = { + parent, + sourceId, + source, + }; + + // Run request + const [operation] = await migrationcenterClient.createSource(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateSource(); + // [END migrationcenter_v1_generated_MigrationCenter_CreateSource_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-migrationcenter/v1/samples/generated/v1/migration_center.delete_asset.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_asset.js new file mode 100644 index 00000000000..de097c8327c --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_asset.js @@ -0,0 +1,75 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_DeleteAsset_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 resource. + */ + // const name = 'abc123' + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callDeleteAsset() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await migrationcenterClient.deleteAsset(request); + console.log(response); + } + + callDeleteAsset(); + // [END migrationcenter_v1_generated_MigrationCenter_DeleteAsset_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-migrationcenter/v1/samples/generated/v1/migration_center.delete_group.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_group.js new file mode 100644 index 00000000000..9c79154d440 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_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(name) { + // [START migrationcenter_v1_generated_MigrationCenter_DeleteGroup_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 group resource. + */ + // const name = 'abc123' + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callDeleteGroup() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await migrationcenterClient.deleteGroup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteGroup(); + // [END migrationcenter_v1_generated_MigrationCenter_DeleteGroup_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-migrationcenter/v1/samples/generated/v1/migration_center.delete_import_data_file.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_import_data_file.js new file mode 100644 index 00000000000..902114e5fcd --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_import_data_file.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(name) { + // [START migrationcenter_v1_generated_MigrationCenter_DeleteImportDataFile_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 ImportDataFile to delete. + */ + // const name = 'abc123' + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callDeleteImportDataFile() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await migrationcenterClient.deleteImportDataFile(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteImportDataFile(); + // [END migrationcenter_v1_generated_MigrationCenter_DeleteImportDataFile_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-migrationcenter/v1/samples/generated/v1/migration_center.delete_import_job.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_import_job.js new file mode 100644 index 00000000000..88747c5bcbf --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_import_job.js @@ -0,0 +1,82 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_DeleteImportJob_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 resource. + */ + // const name = 'abc123' + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + /** + * Optional. If set to `true`, any `ImportDataFiles` of this job will also be + * deleted If set to `false`, the request only works if the job has no data + * files. + */ + // const force = true + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callDeleteImportJob() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await migrationcenterClient.deleteImportJob(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteImportJob(); + // [END migrationcenter_v1_generated_MigrationCenter_DeleteImportJob_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-migrationcenter/v1/samples/generated/v1/migration_center.delete_preference_set.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_preference_set.js new file mode 100644 index 00000000000..89e8c93eb10 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_preference_set.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(name) { + // [START migrationcenter_v1_generated_MigrationCenter_DeletePreferenceSet_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 group resource. + */ + // const name = 'abc123' + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callDeletePreferenceSet() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await migrationcenterClient.deletePreferenceSet(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeletePreferenceSet(); + // [END migrationcenter_v1_generated_MigrationCenter_DeletePreferenceSet_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-migrationcenter/v1/samples/generated/v1/migration_center.delete_report.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_report.js new file mode 100644 index 00000000000..3633b153353 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_report.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(name) { + // [START migrationcenter_v1_generated_MigrationCenter_DeleteReport_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 resource. + */ + // const name = 'abc123' + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callDeleteReport() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await migrationcenterClient.deleteReport(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteReport(); + // [END migrationcenter_v1_generated_MigrationCenter_DeleteReport_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-migrationcenter/v1/samples/generated/v1/migration_center.delete_report_config.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_report_config.js new file mode 100644 index 00000000000..0d8b5064510 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_report_config.js @@ -0,0 +1,82 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_DeleteReportConfig_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 resource. + */ + // const name = 'abc123' + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + /** + * Optional. If set to `true`, any child `Reports` of this entity will also be + * deleted. If set to `false`, the request only works if the resource has no + * children. + */ + // const force = true + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callDeleteReportConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await migrationcenterClient.deleteReportConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteReportConfig(); + // [END migrationcenter_v1_generated_MigrationCenter_DeleteReportConfig_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-migrationcenter/v1/samples/generated/v1/migration_center.delete_source.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_source.js new file mode 100644 index 00000000000..256f5f9f835 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_source.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(name) { + // [START migrationcenter_v1_generated_MigrationCenter_DeleteSource_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 resource. + */ + // const name = 'abc123' + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callDeleteSource() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await migrationcenterClient.deleteSource(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteSource(); + // [END migrationcenter_v1_generated_MigrationCenter_DeleteSource_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-migrationcenter/v1/samples/generated/v1/migration_center.get_asset.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_asset.js new file mode 100644 index 00000000000..685695d8ba5 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_asset.js @@ -0,0 +1,65 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_GetAsset_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 resource. + */ + // const name = 'abc123' + /** + * View of the assets. Defaults to BASIC. + */ + // const view = {} + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callGetAsset() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await migrationcenterClient.getAsset(request); + console.log(response); + } + + callGetAsset(); + // [END migrationcenter_v1_generated_MigrationCenter_GetAsset_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-migrationcenter/v1/samples/generated/v1/migration_center.get_error_frame.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_error_frame.js new file mode 100644 index 00000000000..16b728fd650 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_error_frame.js @@ -0,0 +1,68 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_GetErrorFrame_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the frame to retrieve. + * Format: + * projects/{project}/locations/{location}/sources/{source}/errorFrames/{error_frame} + */ + // const name = 'abc123' + /** + * Optional. An optional view mode to control the level of details for the + * frame. The default is a basic frame view. + */ + // const view = {} + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callGetErrorFrame() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await migrationcenterClient.getErrorFrame(request); + console.log(response); + } + + callGetErrorFrame(); + // [END migrationcenter_v1_generated_MigrationCenter_GetErrorFrame_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-migrationcenter/v1/samples/generated/v1/migration_center.get_group.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_group.js new file mode 100644 index 00000000000..dac01d54448 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_group.js @@ -0,0 +1,61 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_GetGroup_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 resource. + */ + // const name = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callGetGroup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await migrationcenterClient.getGroup(request); + console.log(response); + } + + callGetGroup(); + // [END migrationcenter_v1_generated_MigrationCenter_GetGroup_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-migrationcenter/v1/samples/generated/v1/migration_center.get_import_data_file.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_import_data_file.js new file mode 100644 index 00000000000..376ac86d3b8 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_import_data_file.js @@ -0,0 +1,61 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_GetImportDataFile_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 ImportDataFile. + */ + // const name = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callGetImportDataFile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await migrationcenterClient.getImportDataFile(request); + console.log(response); + } + + callGetImportDataFile(); + // [END migrationcenter_v1_generated_MigrationCenter_GetImportDataFile_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-migrationcenter/v1/samples/generated/v1/migration_center.get_import_job.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_import_job.js new file mode 100644 index 00000000000..c699e4c26f2 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_import_job.js @@ -0,0 +1,66 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_GetImportJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the resource. + */ + // const name = 'abc123' + /** + * Optional. The level of details of the import job. + * Default value is FULL. + */ + // const view = {} + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callGetImportJob() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await migrationcenterClient.getImportJob(request); + console.log(response); + } + + callGetImportJob(); + // [END migrationcenter_v1_generated_MigrationCenter_GetImportJob_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-migrationcenter/v1/samples/generated/v1/migration_center.get_preference_set.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_preference_set.js new file mode 100644 index 00000000000..4ef5fe4cdb2 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_preference_set.js @@ -0,0 +1,61 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_GetPreferenceSet_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 resource. + */ + // const name = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callGetPreferenceSet() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await migrationcenterClient.getPreferenceSet(request); + console.log(response); + } + + callGetPreferenceSet(); + // [END migrationcenter_v1_generated_MigrationCenter_GetPreferenceSet_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-migrationcenter/v1/samples/generated/v1/migration_center.get_report.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_report.js new file mode 100644 index 00000000000..b2372181acd --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_report.js @@ -0,0 +1,65 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_GetReport_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 resource. + */ + // const name = 'abc123' + /** + * Determines what information to retrieve for the Report. + */ + // const view = {} + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callGetReport() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await migrationcenterClient.getReport(request); + console.log(response); + } + + callGetReport(); + // [END migrationcenter_v1_generated_MigrationCenter_GetReport_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-migrationcenter/v1/samples/generated/v1/migration_center.get_report_config.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_report_config.js new file mode 100644 index 00000000000..f3fe98ba3b7 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_report_config.js @@ -0,0 +1,61 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_GetReportConfig_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 resource. + */ + // const name = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callGetReportConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await migrationcenterClient.getReportConfig(request); + console.log(response); + } + + callGetReportConfig(); + // [END migrationcenter_v1_generated_MigrationCenter_GetReportConfig_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-migrationcenter/v1/samples/generated/v1/migration_center.get_settings.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_settings.js new file mode 100644 index 00000000000..03ac7f9df43 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_settings.js @@ -0,0 +1,61 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_GetSettings_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 resource. + */ + // const name = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callGetSettings() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await migrationcenterClient.getSettings(request); + console.log(response); + } + + callGetSettings(); + // [END migrationcenter_v1_generated_MigrationCenter_GetSettings_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-migrationcenter/v1/samples/generated/v1/migration_center.get_source.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_source.js new file mode 100644 index 00000000000..e7a0f0e633b --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_source.js @@ -0,0 +1,61 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_GetSource_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 resource. + */ + // const name = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callGetSource() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await migrationcenterClient.getSource(request); + console.log(response); + } + + callGetSource(); + // [END migrationcenter_v1_generated_MigrationCenter_GetSource_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-migrationcenter/v1/samples/generated/v1/migration_center.list_assets.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_assets.js new file mode 100644 index 00000000000..64d61a8f049 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_assets.js @@ -0,0 +1,84 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_ListAssets_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. Parent value for `ListAssetsRequest`. + */ + // const parent = 'abc123' + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * A token identifying a page of results the server should return. + */ + // const pageToken = 'abc123' + /** + * Filtering results. + */ + // const filter = 'abc123' + /** + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + */ + // const orderBy = 'abc123' + /** + * View of the assets. Defaults to BASIC. + */ + // const view = {} + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callListAssets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await migrationcenterClient.listAssetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAssets(); + // [END migrationcenter_v1_generated_MigrationCenter_ListAssets_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-migrationcenter/v1/samples/generated/v1/migration_center.list_error_frames.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_error_frames.js new file mode 100644 index 00000000000..98aa716d979 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_error_frames.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(parent) { + // [START migrationcenter_v1_generated_MigrationCenter_ListErrorFrames_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. Parent value (the source) for `ListErrorFramesRequest`. + */ + // const parent = 'abc123' + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * A token identifying a page of results the server should return. + */ + // const pageToken = 'abc123' + /** + * Optional. An optional view mode to control the level of details of each + * error frame. The default is a BASIC frame view. + */ + // const view = {} + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callListErrorFrames() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await migrationcenterClient.listErrorFramesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListErrorFrames(); + // [END migrationcenter_v1_generated_MigrationCenter_ListErrorFrames_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-migrationcenter/v1/samples/generated/v1/migration_center.list_groups.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_groups.js new file mode 100644 index 00000000000..8cc19c32d4b --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_groups.js @@ -0,0 +1,80 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_ListGroups_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. Parent value for `ListGroupsRequest`. + */ + // const parent = 'abc123' + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * A token identifying a page of results the server should return. + */ + // const pageToken = 'abc123' + /** + * Filtering results. + */ + // const filter = 'abc123' + /** + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + */ + // const orderBy = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callListGroups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await migrationcenterClient.listGroupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListGroups(); + // [END migrationcenter_v1_generated_MigrationCenter_ListGroups_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-migrationcenter/v1/samples/generated/v1/migration_center.list_import_data_files.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_import_data_files.js new file mode 100644 index 00000000000..7b4f1818fbd --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_import_data_files.js @@ -0,0 +1,85 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_ListImportDataFiles_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 parent of the `ImportDataFiles` resource. + */ + // const parent = 'abc123' + /** + * The maximum number of data files to return. The service may return + * fewer than this value. If unspecified, at most 500 data files 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 `ListImportDataFiles` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListImportDataFiles` + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Filtering results. + */ + // const filter = 'abc123' + /** + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + */ + // const orderBy = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callListImportDataFiles() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await migrationcenterClient.listImportDataFilesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListImportDataFiles(); + // [END migrationcenter_v1_generated_MigrationCenter_ListImportDataFiles_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-migrationcenter/v1/samples/generated/v1/migration_center.list_import_jobs.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_import_jobs.js new file mode 100644 index 00000000000..4e4759abf66 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_import_jobs.js @@ -0,0 +1,85 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_ListImportJobs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Parent value for `ListImportJobsRequest`. + */ + // const parent = 'abc123' + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * A token identifying a page of results the server should return. + */ + // const pageToken = 'abc123' + /** + * Filtering results. + */ + // const filter = 'abc123' + /** + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + */ + // const orderBy = 'abc123' + /** + * Optional. The level of details of each import job. + * Default value is BASIC. + */ + // const view = {} + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callListImportJobs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await migrationcenterClient.listImportJobsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListImportJobs(); + // [END migrationcenter_v1_generated_MigrationCenter_ListImportJobs_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-migrationcenter/v1/samples/generated/v1/migration_center.list_preference_sets.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_preference_sets.js new file mode 100644 index 00000000000..76101cc5817 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_preference_sets.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(parent) { + // [START migrationcenter_v1_generated_MigrationCenter_ListPreferenceSets_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. Parent value for `ListPreferenceSetsRequest`. + */ + // const parent = 'abc123' + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, at most 500 preference sets will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * A token identifying a page of results the server should return. + */ + // const pageToken = 'abc123' + /** + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + */ + // const orderBy = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callListPreferenceSets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await migrationcenterClient.listPreferenceSetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListPreferenceSets(); + // [END migrationcenter_v1_generated_MigrationCenter_ListPreferenceSets_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-migrationcenter/v1/samples/generated/v1/migration_center.list_report_configs.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_report_configs.js new file mode 100644 index 00000000000..dbe28a0bd57 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_report_configs.js @@ -0,0 +1,80 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_ListReportConfigs_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. Parent value for `ListReportConfigsRequest`. + */ + // const parent = 'abc123' + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * A token identifying a page of results the server should return. + */ + // const pageToken = 'abc123' + /** + * Filtering results. + */ + // const filter = 'abc123' + /** + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + */ + // const orderBy = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callListReportConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await migrationcenterClient.listReportConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListReportConfigs(); + // [END migrationcenter_v1_generated_MigrationCenter_ListReportConfigs_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-migrationcenter/v1/samples/generated/v1/migration_center.list_reports.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_reports.js new file mode 100644 index 00000000000..8b28e027bb5 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_reports.js @@ -0,0 +1,84 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_ListReports_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. Parent value for `ListReportsRequest`. + */ + // const parent = 'abc123' + /** + * Requested page size. The server may return fewer items than requested. + * If unspecified, the server will pick an appropriate default value. + */ + // const pageSize = 1234 + /** + * A token identifying a page of results that the server should return. + */ + // const pageToken = 'abc123' + /** + * Filtering results. + */ + // const filter = 'abc123' + /** + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + */ + // const orderBy = 'abc123' + /** + * Determines what information to retrieve for each Report. + */ + // const view = {} + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callListReports() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await migrationcenterClient.listReportsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListReports(); + // [END migrationcenter_v1_generated_MigrationCenter_ListReports_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-migrationcenter/v1/samples/generated/v1/migration_center.list_sources.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_sources.js new file mode 100644 index 00000000000..3267e4da451 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_sources.js @@ -0,0 +1,80 @@ +// 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 migrationcenter_v1_generated_MigrationCenter_ListSources_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. Parent value for `ListSourcesRequest`. + */ + // const parent = 'abc123' + /** + * Requested page size. The server may return fewer items than requested. + * If unspecified, the server will pick an appropriate default value. + */ + // const pageSize = 1234 + /** + * A token identifying a page of results that the server should return. + */ + // const pageToken = 'abc123' + /** + * Filtering results. + */ + // const filter = 'abc123' + /** + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + */ + // const orderBy = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callListSources() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await migrationcenterClient.listSourcesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSources(); + // [END migrationcenter_v1_generated_MigrationCenter_ListSources_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-migrationcenter/v1/samples/generated/v1/migration_center.remove_assets_from_group.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.remove_assets_from_group.js new file mode 100644 index 00000000000..50188b16260 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.remove_assets_from_group.js @@ -0,0 +1,90 @@ +// 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(group, assets) { + // [START migrationcenter_v1_generated_MigrationCenter_RemoveAssetsFromGroup_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. Group reference. + */ + // const group = 'abc123' + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + /** + * Required. List of assets to be removed. + * The maximum number of assets that can be removed in a single request is + * 1000. + */ + // const assets = {} + /** + * Optional. When this value is set to `false` and one of the given assets is + * not an existing member of the group, the operation fails with a `Not Found` + * error. When set to `true` this situation is silently ignored by the server. + * Default value is `false`. + */ + // const allowMissing = true + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callRemoveAssetsFromGroup() { + // Construct request + const request = { + group, + assets, + }; + + // Run request + const [operation] = await migrationcenterClient.removeAssetsFromGroup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRemoveAssetsFromGroup(); + // [END migrationcenter_v1_generated_MigrationCenter_RemoveAssetsFromGroup_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-migrationcenter/v1/samples/generated/v1/migration_center.report_asset_frames.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.report_asset_frames.js new file mode 100644 index 00000000000..1a23e61d7e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.report_asset_frames.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(parent, source) { + // [START migrationcenter_v1_generated_MigrationCenter_ReportAssetFrames_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. Parent of the resource. + */ + // const parent = 'abc123' + /** + * Collection of frames data. + */ + // const frames = {} + /** + * Required. Reference to a source. + */ + // const source = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callReportAssetFrames() { + // Construct request + const request = { + parent, + source, + }; + + // Run request + const response = await migrationcenterClient.reportAssetFrames(request); + console.log(response); + } + + callReportAssetFrames(); + // [END migrationcenter_v1_generated_MigrationCenter_ReportAssetFrames_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-migrationcenter/v1/samples/generated/v1/migration_center.run_import_job.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.run_import_job.js new file mode 100644 index 00000000000..d83b215ec73 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.run_import_job.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(name) { + // [START migrationcenter_v1_generated_MigrationCenter_RunImportJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the import job to run. + */ + // const name = 'abc123' + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callRunImportJob() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await migrationcenterClient.runImportJob(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRunImportJob(); + // [END migrationcenter_v1_generated_MigrationCenter_RunImportJob_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-migrationcenter/v1/samples/generated/v1/migration_center.update_asset.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_asset.js new file mode 100644 index 00000000000..9c440d5b5d3 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_asset.js @@ -0,0 +1,85 @@ +// 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(updateMask, asset) { + // [START migrationcenter_v1_generated_MigrationCenter_UpdateAsset_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. Field mask is used to specify the fields to be overwritten in the + * `Asset` resource by the update. + * The values specified in the `update_mask` field are relative to the + * resource, not the full request. + * A field will be overwritten if it is in the mask. + * A single * value in the mask lets you to overwrite all fields. + */ + // const updateMask = {} + /** + * Required. The resource being updated. + */ + // const asset = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callUpdateAsset() { + // Construct request + const request = { + updateMask, + asset, + }; + + // Run request + const response = await migrationcenterClient.updateAsset(request); + console.log(response); + } + + callUpdateAsset(); + // [END migrationcenter_v1_generated_MigrationCenter_UpdateAsset_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-migrationcenter/v1/samples/generated/v1/migration_center.update_group.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_group.js new file mode 100644 index 00000000000..47977d57c2c --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_group.js @@ -0,0 +1,85 @@ +// 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(updateMask, group) { + // [START migrationcenter_v1_generated_MigrationCenter_UpdateGroup_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. Field mask is used to specify the fields to be overwritten in the + * `Group` resource by the update. + * The values specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * A single * value in the mask lets you to overwrite all fields. + */ + // const updateMask = {} + /** + * Required. The group resource being updated. + */ + // const group = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callUpdateGroup() { + // Construct request + const request = { + updateMask, + group, + }; + + // Run request + const [operation] = await migrationcenterClient.updateGroup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateGroup(); + // [END migrationcenter_v1_generated_MigrationCenter_UpdateGroup_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-migrationcenter/v1/samples/generated/v1/migration_center.update_import_job.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_import_job.js new file mode 100644 index 00000000000..2557f14131c --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_import_job.js @@ -0,0 +1,86 @@ +// 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(updateMask, importJob) { + // [START migrationcenter_v1_generated_MigrationCenter_UpdateImportJob_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. Field mask is used to specify the fields to be overwritten in the + * `Asset` resource by the update. + * The values specified in the `update_mask` field are relative to the + * resource, not the full request. + * A field will be overwritten if it is in the mask. + * A single * value in the mask lets you to overwrite all fields. + */ + // const updateMask = {} + /** + * Required. The resource being updated + */ + // const importJob = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callUpdateImportJob() { + // Construct request + const request = { + updateMask, + importJob, + }; + + // Run request + const [operation] = await migrationcenterClient.updateImportJob(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateImportJob(); + // [END migrationcenter_v1_generated_MigrationCenter_UpdateImportJob_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-migrationcenter/v1/samples/generated/v1/migration_center.update_preference_set.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_preference_set.js new file mode 100644 index 00000000000..c86caa43c1b --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_preference_set.js @@ -0,0 +1,86 @@ +// 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(updateMask, preferenceSet) { + // [START migrationcenter_v1_generated_MigrationCenter_UpdatePreferenceSet_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. Field mask is used to specify the fields to be overwritten in the + * `PreferenceSet` resource by the update. + * The values specified in the `update_mask` field are relative to the + * resource, not the full request. + * A field will be overwritten if it is in the mask. + * A single * value in the mask lets you to overwrite all fields. + */ + // const updateMask = {} + /** + * Required. The preference set resource being updated. + */ + // const preferenceSet = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callUpdatePreferenceSet() { + // Construct request + const request = { + updateMask, + preferenceSet, + }; + + // Run request + const [operation] = await migrationcenterClient.updatePreferenceSet(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdatePreferenceSet(); + // [END migrationcenter_v1_generated_MigrationCenter_UpdatePreferenceSet_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-migrationcenter/v1/samples/generated/v1/migration_center.update_settings.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_settings.js new file mode 100644 index 00000000000..695a6e09fd9 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_settings.js @@ -0,0 +1,86 @@ +// 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(updateMask, settings) { + // [START migrationcenter_v1_generated_MigrationCenter_UpdateSettings_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. Field mask is used to specify the fields to be overwritten in the + * `Settings` resource by the update. + * The values specified in the `update_mask` field are relative to the + * resource, not the full request. + * A field will be overwritten if it is in the mask. + * A single * value in the mask lets you to overwrite all fields. + */ + // const updateMask = {} + /** + * Required. The project settings resource being updated. + */ + // const settings = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callUpdateSettings() { + // Construct request + const request = { + updateMask, + settings, + }; + + // Run request + const [operation] = await migrationcenterClient.updateSettings(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateSettings(); + // [END migrationcenter_v1_generated_MigrationCenter_UpdateSettings_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-migrationcenter/v1/samples/generated/v1/migration_center.update_source.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_source.js new file mode 100644 index 00000000000..18705108a5d --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_source.js @@ -0,0 +1,86 @@ +// 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(updateMask, source) { + // [START migrationcenter_v1_generated_MigrationCenter_UpdateSource_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. Field mask is used to specify the fields to be overwritten in the + * `Source` resource by the update. + * The values specified in the `update_mask` field are relative to the + * resource, not the full request. + * A field will be overwritten if it is in the mask. + * A single * value in the mask lets you to overwrite all fields. + */ + // const updateMask = {} + /** + * Required. The resource being updated + */ + // const source = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callUpdateSource() { + // Construct request + const request = { + updateMask, + source, + }; + + // Run request + const [operation] = await migrationcenterClient.updateSource(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateSource(); + // [END migrationcenter_v1_generated_MigrationCenter_UpdateSource_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-migrationcenter/v1/samples/generated/v1/migration_center.validate_import_job.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.validate_import_job.js new file mode 100644 index 00000000000..2b8f730b5e6 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.validate_import_job.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(name) { + // [START migrationcenter_v1_generated_MigrationCenter_ValidateImportJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the import job to validate. + */ + // const name = 'abc123' + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Migrationcenter library + const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; + + // Instantiates a client + const migrationcenterClient = new MigrationCenterClient(); + + async function callValidateImportJob() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await migrationcenterClient.validateImportJob(request); + const [response] = await operation.promise(); + console.log(response); + } + + callValidateImportJob(); + // [END migrationcenter_v1_generated_MigrationCenter_ValidateImportJob_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-migrationcenter/v1/samples/generated/v1/snippet_metadata_google.cloud.migrationcenter.v1.json b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/snippet_metadata_google.cloud.migrationcenter.v1.json new file mode 100644 index 00000000000..75fc84ee26d --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/snippet_metadata_google.cloud.migrationcenter.v1.json @@ -0,0 +1,2331 @@ +{ + "clientLibrary": { + "name": "nodejs-migrationcenter", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.migrationcenter.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListAssets_async", + "title": "MigrationCenter listAssets Sample", + "origin": "API_DEFINITION", + "description": " Lists all the assets in a given project and location.", + "canonical": true, + "file": "migration_center.list_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAssets", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.migrationcenter.v1.AssetView" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.ListAssetsResponse", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "ListAssets", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListAssets", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetAsset_async", + "title": "MigrationCenter getAsset Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of an asset.", + "canonical": true, + "file": "migration_center.get_asset.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAsset", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetAsset", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.migrationcenter.v1.AssetView" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.Asset", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "GetAsset", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetAsset", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_UpdateAsset_async", + "title": "MigrationCenter updateAsset Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of an asset.", + "canonical": true, + "file": "migration_center.update_asset.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAsset", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateAsset", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "asset", + "type": ".google.cloud.migrationcenter.v1.Asset" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.Asset", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "UpdateAsset", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateAsset", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_BatchUpdateAssets_async", + "title": "MigrationCenter batchUpdateAssets Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a list of assets.", + "canonical": true, + "file": "migration_center.batch_update_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchUpdateAssets", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.BatchUpdateAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "requests", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.BatchUpdateAssetsResponse", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "BatchUpdateAssets", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.BatchUpdateAssets", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_DeleteAsset_async", + "title": "MigrationCenter deleteAsset Sample", + "origin": "API_DEFINITION", + "description": " Deletes an asset.", + "canonical": true, + "file": "migration_center.delete_asset.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAsset", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteAsset", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "DeleteAsset", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteAsset", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_BatchDeleteAssets_async", + "title": "MigrationCenter batchDeleteAssets Sample", + "origin": "API_DEFINITION", + "description": " Deletes list of Assets.", + "canonical": true, + "file": "migration_center.batch_delete_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchDeleteAssets", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.BatchDeleteAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "names", + "type": "TYPE_STRING[]" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "BatchDeleteAssets", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.BatchDeleteAssets", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_ReportAssetFrames_async", + "title": "MigrationCenter reportAssetFrames Sample", + "origin": "API_DEFINITION", + "description": " Reports a set of frames.", + "canonical": true, + "file": "migration_center.report_asset_frames.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReportAssetFrames", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ReportAssetFrames", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "frames", + "type": ".google.cloud.migrationcenter.v1.Frames" + }, + { + "name": "source", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.ReportAssetFramesResponse", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "ReportAssetFrames", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ReportAssetFrames", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_AggregateAssetsValues_async", + "title": "MigrationCenter aggregateAssetsValues Sample", + "origin": "API_DEFINITION", + "description": " Aggregates the requested fields based on provided function.", + "canonical": true, + "file": "migration_center.aggregate_assets_values.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AggregateAssetsValues", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.AggregateAssetsValues", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "aggregations", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.AggregateAssetsValuesResponse", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "AggregateAssetsValues", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.AggregateAssetsValues", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_CreateImportJob_async", + "title": "MigrationCenter createImportJob Sample", + "origin": "API_DEFINITION", + "description": " Creates an import job.", + "canonical": true, + "file": "migration_center.create_import_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateImportJob", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateImportJob", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "import_job_id", + "type": "TYPE_STRING" + }, + { + "name": "import_job", + "type": ".google.cloud.migrationcenter.v1.ImportJob" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "CreateImportJob", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateImportJob", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListImportJobs_async", + "title": "MigrationCenter listImportJobs Sample", + "origin": "API_DEFINITION", + "description": " Lists all import jobs.", + "canonical": true, + "file": "migration_center.list_import_jobs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListImportJobs", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListImportJobs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.migrationcenter.v1.ImportJobView" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.ListImportJobsResponse", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "ListImportJobs", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListImportJobs", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetImportJob_async", + "title": "MigrationCenter getImportJob Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of an import job.", + "canonical": true, + "file": "migration_center.get_import_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetImportJob", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetImportJob", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.migrationcenter.v1.ImportJobView" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.ImportJob", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "GetImportJob", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetImportJob", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_DeleteImportJob_async", + "title": "MigrationCenter deleteImportJob Sample", + "origin": "API_DEFINITION", + "description": " Deletes an import job.", + "canonical": true, + "file": "migration_center.delete_import_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteImportJob", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteImportJob", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "DeleteImportJob", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteImportJob", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_UpdateImportJob_async", + "title": "MigrationCenter updateImportJob Sample", + "origin": "API_DEFINITION", + "description": " Updates an import job.", + "canonical": true, + "file": "migration_center.update_import_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateImportJob", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateImportJob", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "import_job", + "type": ".google.cloud.migrationcenter.v1.ImportJob" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "UpdateImportJob", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateImportJob", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_ValidateImportJob_async", + "title": "MigrationCenter validateImportJob Sample", + "origin": "API_DEFINITION", + "description": " Validates an import job.", + "canonical": true, + "file": "migration_center.validate_import_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ValidateImportJob", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ValidateImportJob", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "ValidateImportJob", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ValidateImportJob", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_RunImportJob_async", + "title": "MigrationCenter runImportJob Sample", + "origin": "API_DEFINITION", + "description": " Runs an import job.", + "canonical": true, + "file": "migration_center.run_import_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RunImportJob", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.RunImportJob", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "RunImportJob", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.RunImportJob", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetImportDataFile_async", + "title": "MigrationCenter getImportDataFile Sample", + "origin": "API_DEFINITION", + "description": " Gets an import data file.", + "canonical": true, + "file": "migration_center.get_import_data_file.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetImportDataFile", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetImportDataFile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.ImportDataFile", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "GetImportDataFile", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetImportDataFile", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListImportDataFiles_async", + "title": "MigrationCenter listImportDataFiles Sample", + "origin": "API_DEFINITION", + "description": " List import data files.", + "canonical": true, + "file": "migration_center.list_import_data_files.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListImportDataFiles", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListImportDataFiles", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.ListImportDataFilesResponse", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "ListImportDataFiles", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListImportDataFiles", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_CreateImportDataFile_async", + "title": "MigrationCenter createImportDataFile Sample", + "origin": "API_DEFINITION", + "description": " Creates an import data file.", + "canonical": true, + "file": "migration_center.create_import_data_file.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateImportDataFile", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateImportDataFile", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "import_data_file_id", + "type": "TYPE_STRING" + }, + { + "name": "import_data_file", + "type": ".google.cloud.migrationcenter.v1.ImportDataFile" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "CreateImportDataFile", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateImportDataFile", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_DeleteImportDataFile_async", + "title": "MigrationCenter deleteImportDataFile Sample", + "origin": "API_DEFINITION", + "description": " Delete an import data file.", + "canonical": true, + "file": "migration_center.delete_import_data_file.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteImportDataFile", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteImportDataFile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "DeleteImportDataFile", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteImportDataFile", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListGroups_async", + "title": "MigrationCenter listGroups Sample", + "origin": "API_DEFINITION", + "description": " Lists all groups in a given project and location.", + "canonical": true, + "file": "migration_center.list_groups.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListGroups", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListGroups", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.ListGroupsResponse", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "ListGroups", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListGroups", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetGroup_async", + "title": "MigrationCenter getGroup Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a group.", + "canonical": true, + "file": "migration_center.get_group.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetGroup", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetGroup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.Group", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "GetGroup", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetGroup", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_CreateGroup_async", + "title": "MigrationCenter createGroup Sample", + "origin": "API_DEFINITION", + "description": " Creates a new group in a given project and location.", + "canonical": true, + "file": "migration_center.create_group.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateGroup", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateGroup", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "group_id", + "type": "TYPE_STRING" + }, + { + "name": "group", + "type": ".google.cloud.migrationcenter.v1.Group" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "CreateGroup", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateGroup", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_UpdateGroup_async", + "title": "MigrationCenter updateGroup Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a group.", + "canonical": true, + "file": "migration_center.update_group.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateGroup", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateGroup", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "group", + "type": ".google.cloud.migrationcenter.v1.Group" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "UpdateGroup", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateGroup", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_DeleteGroup_async", + "title": "MigrationCenter deleteGroup Sample", + "origin": "API_DEFINITION", + "description": " Deletes a group.", + "canonical": true, + "file": "migration_center.delete_group.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteGroup", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteGroup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "DeleteGroup", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteGroup", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_AddAssetsToGroup_async", + "title": "MigrationCenter addAssetsToGroup Sample", + "origin": "API_DEFINITION", + "description": " Adds assets to a group.", + "canonical": true, + "file": "migration_center.add_assets_to_group.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddAssetsToGroup", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.AddAssetsToGroup", + "async": true, + "parameters": [ + { + "name": "group", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "assets", + "type": ".google.cloud.migrationcenter.v1.AssetList" + }, + { + "name": "allow_existing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "AddAssetsToGroup", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.AddAssetsToGroup", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_RemoveAssetsFromGroup_async", + "title": "MigrationCenter removeAssetsFromGroup Sample", + "origin": "API_DEFINITION", + "description": " Removes assets from a group.", + "canonical": true, + "file": "migration_center.remove_assets_from_group.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveAssetsFromGroup", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.RemoveAssetsFromGroup", + "async": true, + "parameters": [ + { + "name": "group", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "assets", + "type": ".google.cloud.migrationcenter.v1.AssetList" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "RemoveAssetsFromGroup", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.RemoveAssetsFromGroup", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListErrorFrames_async", + "title": "MigrationCenter listErrorFrames Sample", + "origin": "API_DEFINITION", + "description": " Lists all error frames in a given source and location.", + "canonical": true, + "file": "migration_center.list_error_frames.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListErrorFrames", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListErrorFrames", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.migrationcenter.v1.ErrorFrameView" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.ListErrorFramesResponse", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "ListErrorFrames", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListErrorFrames", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetErrorFrame_async", + "title": "MigrationCenter getErrorFrame Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of an error frame.", + "canonical": true, + "file": "migration_center.get_error_frame.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetErrorFrame", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetErrorFrame", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.migrationcenter.v1.ErrorFrameView" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.ErrorFrame", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "GetErrorFrame", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetErrorFrame", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListSources_async", + "title": "MigrationCenter listSources Sample", + "origin": "API_DEFINITION", + "description": " Lists all the sources in a given project and location.", + "canonical": true, + "file": "migration_center.list_sources.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSources", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListSources", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.ListSourcesResponse", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "ListSources", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListSources", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetSource_async", + "title": "MigrationCenter getSource Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a source.", + "canonical": true, + "file": "migration_center.get_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSource", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetSource", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.Source", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "GetSource", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetSource", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_CreateSource_async", + "title": "MigrationCenter createSource Sample", + "origin": "API_DEFINITION", + "description": " Creates a new source in a given project and location.", + "canonical": true, + "file": "migration_center.create_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSource", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateSource", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "source_id", + "type": "TYPE_STRING" + }, + { + "name": "source", + "type": ".google.cloud.migrationcenter.v1.Source" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "CreateSource", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateSource", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_UpdateSource_async", + "title": "MigrationCenter updateSource Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a source.", + "canonical": true, + "file": "migration_center.update_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSource", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateSource", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "source", + "type": ".google.cloud.migrationcenter.v1.Source" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "UpdateSource", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateSource", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_DeleteSource_async", + "title": "MigrationCenter deleteSource Sample", + "origin": "API_DEFINITION", + "description": " Deletes a source.", + "canonical": true, + "file": "migration_center.delete_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSource", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteSource", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "DeleteSource", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteSource", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListPreferenceSets_async", + "title": "MigrationCenter listPreferenceSets Sample", + "origin": "API_DEFINITION", + "description": " Lists all the preference sets in a given project and location.", + "canonical": true, + "file": "migration_center.list_preference_sets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListPreferenceSets", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListPreferenceSets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.ListPreferenceSetsResponse", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "ListPreferenceSets", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListPreferenceSets", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetPreferenceSet_async", + "title": "MigrationCenter getPreferenceSet Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a preference set.", + "canonical": true, + "file": "migration_center.get_preference_set.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetPreferenceSet", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetPreferenceSet", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.PreferenceSet", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "GetPreferenceSet", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetPreferenceSet", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_CreatePreferenceSet_async", + "title": "MigrationCenter createPreferenceSet Sample", + "origin": "API_DEFINITION", + "description": " Creates a new preference set in a given project and location.", + "canonical": true, + "file": "migration_center.create_preference_set.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreatePreferenceSet", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreatePreferenceSet", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "preference_set_id", + "type": "TYPE_STRING" + }, + { + "name": "preference_set", + "type": ".google.cloud.migrationcenter.v1.PreferenceSet" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "CreatePreferenceSet", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreatePreferenceSet", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_UpdatePreferenceSet_async", + "title": "MigrationCenter updatePreferenceSet Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a preference set.", + "canonical": true, + "file": "migration_center.update_preference_set.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdatePreferenceSet", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdatePreferenceSet", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "preference_set", + "type": ".google.cloud.migrationcenter.v1.PreferenceSet" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "UpdatePreferenceSet", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdatePreferenceSet", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_DeletePreferenceSet_async", + "title": "MigrationCenter deletePreferenceSet Sample", + "origin": "API_DEFINITION", + "description": " Deletes a preference set.", + "canonical": true, + "file": "migration_center.delete_preference_set.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeletePreferenceSet", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeletePreferenceSet", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "DeletePreferenceSet", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeletePreferenceSet", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetSettings_async", + "title": "MigrationCenter getSettings Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of regional settings.", + "canonical": true, + "file": "migration_center.get_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSettings", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.Settings", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "GetSettings", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetSettings", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_UpdateSettings_async", + "title": "MigrationCenter updateSettings Sample", + "origin": "API_DEFINITION", + "description": " Updates the regional-level project settings.", + "canonical": true, + "file": "migration_center.update_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSettings", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateSettings", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "settings", + "type": ".google.cloud.migrationcenter.v1.Settings" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "UpdateSettings", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateSettings", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_CreateReportConfig_async", + "title": "MigrationCenter createReportConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a report configuration.", + "canonical": true, + "file": "migration_center.create_report_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateReportConfig", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateReportConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "report_config_id", + "type": "TYPE_STRING" + }, + { + "name": "report_config", + "type": ".google.cloud.migrationcenter.v1.ReportConfig" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "CreateReportConfig", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateReportConfig", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetReportConfig_async", + "title": "MigrationCenter getReportConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single ReportConfig.", + "canonical": true, + "file": "migration_center.get_report_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetReportConfig", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetReportConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.ReportConfig", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "GetReportConfig", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetReportConfig", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListReportConfigs_async", + "title": "MigrationCenter listReportConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists ReportConfigs in a given project and location.", + "canonical": true, + "file": "migration_center.list_report_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListReportConfigs", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListReportConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.ListReportConfigsResponse", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "ListReportConfigs", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListReportConfigs", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_DeleteReportConfig_async", + "title": "MigrationCenter deleteReportConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes a ReportConfig.", + "canonical": true, + "file": "migration_center.delete_report_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteReportConfig", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteReportConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "DeleteReportConfig", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteReportConfig", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_CreateReport_async", + "title": "MigrationCenter createReport Sample", + "origin": "API_DEFINITION", + "description": " Creates a report.", + "canonical": true, + "file": "migration_center.create_report.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateReport", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateReport", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "report_id", + "type": "TYPE_STRING" + }, + { + "name": "report", + "type": ".google.cloud.migrationcenter.v1.Report" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "CreateReport", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateReport", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetReport_async", + "title": "MigrationCenter getReport Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single Report.", + "canonical": true, + "file": "migration_center.get_report.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetReport", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetReport", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.migrationcenter.v1.ReportView" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.Report", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "GetReport", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetReport", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListReports_async", + "title": "MigrationCenter listReports Sample", + "origin": "API_DEFINITION", + "description": " Lists Reports in a given ReportConfig.", + "canonical": true, + "file": "migration_center.list_reports.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListReports", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListReports", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.migrationcenter.v1.ReportView" + } + ], + "resultType": ".google.cloud.migrationcenter.v1.ListReportsResponse", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "ListReports", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListReports", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + }, + { + "regionTag": "migrationcenter_v1_generated_MigrationCenter_DeleteReport_async", + "title": "MigrationCenter deleteReport Sample", + "origin": "API_DEFINITION", + "description": " Deletes a Report.", + "canonical": true, + "file": "migration_center.delete_report.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteReport", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteReport", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "MigrationCenterClient", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" + }, + "method": { + "shortName": "DeleteReport", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteReport", + "service": { + "shortName": "MigrationCenter", + "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/src/index.ts b/owl-bot-staging/google-cloud-migrationcenter/v1/src/index.ts new file mode 100644 index 00000000000..a300b552d6d --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/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 v1 from './v1'; +const MigrationCenterClient = v1.MigrationCenterClient; +type MigrationCenterClient = v1.MigrationCenterClient; +export {v1, MigrationCenterClient}; +export default {v1, MigrationCenterClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..495ff3d70b9 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/gapic_metadata.json @@ -0,0 +1,539 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.migrationcenter.v1", + "libraryPackage": "@google-cloud/migrationcenter", + "services": { + "MigrationCenter": { + "clients": { + "grpc": { + "libraryClient": "MigrationCenterClient", + "rpcs": { + "GetAsset": { + "methods": [ + "getAsset" + ] + }, + "UpdateAsset": { + "methods": [ + "updateAsset" + ] + }, + "BatchUpdateAssets": { + "methods": [ + "batchUpdateAssets" + ] + }, + "DeleteAsset": { + "methods": [ + "deleteAsset" + ] + }, + "BatchDeleteAssets": { + "methods": [ + "batchDeleteAssets" + ] + }, + "ReportAssetFrames": { + "methods": [ + "reportAssetFrames" + ] + }, + "AggregateAssetsValues": { + "methods": [ + "aggregateAssetsValues" + ] + }, + "GetImportJob": { + "methods": [ + "getImportJob" + ] + }, + "GetImportDataFile": { + "methods": [ + "getImportDataFile" + ] + }, + "GetGroup": { + "methods": [ + "getGroup" + ] + }, + "GetErrorFrame": { + "methods": [ + "getErrorFrame" + ] + }, + "GetSource": { + "methods": [ + "getSource" + ] + }, + "GetPreferenceSet": { + "methods": [ + "getPreferenceSet" + ] + }, + "GetSettings": { + "methods": [ + "getSettings" + ] + }, + "GetReportConfig": { + "methods": [ + "getReportConfig" + ] + }, + "GetReport": { + "methods": [ + "getReport" + ] + }, + "CreateImportJob": { + "methods": [ + "createImportJob" + ] + }, + "DeleteImportJob": { + "methods": [ + "deleteImportJob" + ] + }, + "UpdateImportJob": { + "methods": [ + "updateImportJob" + ] + }, + "ValidateImportJob": { + "methods": [ + "validateImportJob" + ] + }, + "RunImportJob": { + "methods": [ + "runImportJob" + ] + }, + "CreateImportDataFile": { + "methods": [ + "createImportDataFile" + ] + }, + "DeleteImportDataFile": { + "methods": [ + "deleteImportDataFile" + ] + }, + "CreateGroup": { + "methods": [ + "createGroup" + ] + }, + "UpdateGroup": { + "methods": [ + "updateGroup" + ] + }, + "DeleteGroup": { + "methods": [ + "deleteGroup" + ] + }, + "AddAssetsToGroup": { + "methods": [ + "addAssetsToGroup" + ] + }, + "RemoveAssetsFromGroup": { + "methods": [ + "removeAssetsFromGroup" + ] + }, + "CreateSource": { + "methods": [ + "createSource" + ] + }, + "UpdateSource": { + "methods": [ + "updateSource" + ] + }, + "DeleteSource": { + "methods": [ + "deleteSource" + ] + }, + "CreatePreferenceSet": { + "methods": [ + "createPreferenceSet" + ] + }, + "UpdatePreferenceSet": { + "methods": [ + "updatePreferenceSet" + ] + }, + "DeletePreferenceSet": { + "methods": [ + "deletePreferenceSet" + ] + }, + "UpdateSettings": { + "methods": [ + "updateSettings" + ] + }, + "CreateReportConfig": { + "methods": [ + "createReportConfig" + ] + }, + "DeleteReportConfig": { + "methods": [ + "deleteReportConfig" + ] + }, + "CreateReport": { + "methods": [ + "createReport" + ] + }, + "DeleteReport": { + "methods": [ + "deleteReport" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "ListImportJobs": { + "methods": [ + "listImportJobs", + "listImportJobsStream", + "listImportJobsAsync" + ] + }, + "ListImportDataFiles": { + "methods": [ + "listImportDataFiles", + "listImportDataFilesStream", + "listImportDataFilesAsync" + ] + }, + "ListGroups": { + "methods": [ + "listGroups", + "listGroupsStream", + "listGroupsAsync" + ] + }, + "ListErrorFrames": { + "methods": [ + "listErrorFrames", + "listErrorFramesStream", + "listErrorFramesAsync" + ] + }, + "ListSources": { + "methods": [ + "listSources", + "listSourcesStream", + "listSourcesAsync" + ] + }, + "ListPreferenceSets": { + "methods": [ + "listPreferenceSets", + "listPreferenceSetsStream", + "listPreferenceSetsAsync" + ] + }, + "ListReportConfigs": { + "methods": [ + "listReportConfigs", + "listReportConfigsStream", + "listReportConfigsAsync" + ] + }, + "ListReports": { + "methods": [ + "listReports", + "listReportsStream", + "listReportsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "MigrationCenterClient", + "rpcs": { + "GetAsset": { + "methods": [ + "getAsset" + ] + }, + "UpdateAsset": { + "methods": [ + "updateAsset" + ] + }, + "BatchUpdateAssets": { + "methods": [ + "batchUpdateAssets" + ] + }, + "DeleteAsset": { + "methods": [ + "deleteAsset" + ] + }, + "BatchDeleteAssets": { + "methods": [ + "batchDeleteAssets" + ] + }, + "ReportAssetFrames": { + "methods": [ + "reportAssetFrames" + ] + }, + "AggregateAssetsValues": { + "methods": [ + "aggregateAssetsValues" + ] + }, + "GetImportJob": { + "methods": [ + "getImportJob" + ] + }, + "GetImportDataFile": { + "methods": [ + "getImportDataFile" + ] + }, + "GetGroup": { + "methods": [ + "getGroup" + ] + }, + "GetErrorFrame": { + "methods": [ + "getErrorFrame" + ] + }, + "GetSource": { + "methods": [ + "getSource" + ] + }, + "GetPreferenceSet": { + "methods": [ + "getPreferenceSet" + ] + }, + "GetSettings": { + "methods": [ + "getSettings" + ] + }, + "GetReportConfig": { + "methods": [ + "getReportConfig" + ] + }, + "GetReport": { + "methods": [ + "getReport" + ] + }, + "CreateImportJob": { + "methods": [ + "createImportJob" + ] + }, + "DeleteImportJob": { + "methods": [ + "deleteImportJob" + ] + }, + "UpdateImportJob": { + "methods": [ + "updateImportJob" + ] + }, + "ValidateImportJob": { + "methods": [ + "validateImportJob" + ] + }, + "RunImportJob": { + "methods": [ + "runImportJob" + ] + }, + "CreateImportDataFile": { + "methods": [ + "createImportDataFile" + ] + }, + "DeleteImportDataFile": { + "methods": [ + "deleteImportDataFile" + ] + }, + "CreateGroup": { + "methods": [ + "createGroup" + ] + }, + "UpdateGroup": { + "methods": [ + "updateGroup" + ] + }, + "DeleteGroup": { + "methods": [ + "deleteGroup" + ] + }, + "AddAssetsToGroup": { + "methods": [ + "addAssetsToGroup" + ] + }, + "RemoveAssetsFromGroup": { + "methods": [ + "removeAssetsFromGroup" + ] + }, + "CreateSource": { + "methods": [ + "createSource" + ] + }, + "UpdateSource": { + "methods": [ + "updateSource" + ] + }, + "DeleteSource": { + "methods": [ + "deleteSource" + ] + }, + "CreatePreferenceSet": { + "methods": [ + "createPreferenceSet" + ] + }, + "UpdatePreferenceSet": { + "methods": [ + "updatePreferenceSet" + ] + }, + "DeletePreferenceSet": { + "methods": [ + "deletePreferenceSet" + ] + }, + "UpdateSettings": { + "methods": [ + "updateSettings" + ] + }, + "CreateReportConfig": { + "methods": [ + "createReportConfig" + ] + }, + "DeleteReportConfig": { + "methods": [ + "deleteReportConfig" + ] + }, + "CreateReport": { + "methods": [ + "createReport" + ] + }, + "DeleteReport": { + "methods": [ + "deleteReport" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "ListImportJobs": { + "methods": [ + "listImportJobs", + "listImportJobsStream", + "listImportJobsAsync" + ] + }, + "ListImportDataFiles": { + "methods": [ + "listImportDataFiles", + "listImportDataFilesStream", + "listImportDataFilesAsync" + ] + }, + "ListGroups": { + "methods": [ + "listGroups", + "listGroupsStream", + "listGroupsAsync" + ] + }, + "ListErrorFrames": { + "methods": [ + "listErrorFrames", + "listErrorFramesStream", + "listErrorFramesAsync" + ] + }, + "ListSources": { + "methods": [ + "listSources", + "listSourcesStream", + "listSourcesAsync" + ] + }, + "ListPreferenceSets": { + "methods": [ + "listPreferenceSets", + "listPreferenceSetsStream", + "listPreferenceSetsAsync" + ] + }, + "ListReportConfigs": { + "methods": [ + "listReportConfigs", + "listReportConfigsStream", + "listReportConfigsAsync" + ] + }, + "ListReports": { + "methods": [ + "listReports", + "listReportsStream", + "listReportsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/index.ts new file mode 100644 index 00000000000..5d0aac892c2 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/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 {MigrationCenterClient} from './migration_center_client'; diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_client.ts b/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_client.ts new file mode 100644 index 00000000000..e5c7d4758a6 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_client.ts @@ -0,0 +1,6782 @@ +// 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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/migration_center_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './migration_center_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service describing handlers for resources. + * @class + * @memberof v1 + */ +export class MigrationCenterClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + migrationCenterStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of MigrationCenterClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 MigrationCenterClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof MigrationCenterClient; + 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + 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 = { + assetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/assets/{asset}' + ), + errorFramePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sources/{source}/errorFrames/{error_frame}' + ), + groupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/groups/{group}' + ), + importDataFilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/importJobs/{import_job}/importDataFiles/{import_data_file}' + ), + importJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/importJobs/{import_job}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + preferenceSetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/preferenceSets/{preference_set}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + reportPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/reportConfigs/{report_config}/reports/{report}' + ), + reportConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/reportConfigs/{report_config}' + ), + settingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/settings' + ), + sourcePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sources/{source}' + ), + }; + + // 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 = { + listAssets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'assets'), + listImportJobs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'importJobs'), + listImportDataFiles: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'importDataFiles'), + listGroups: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groups'), + listErrorFrames: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'errorFrames'), + listSources: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sources'), + listPreferenceSets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'preferenceSets'), + listReportConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'reportConfigs'), + listReports: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'reports') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createImportJobResponse = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.ImportJob') as gax.protobuf.Type; + const createImportJobMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const deleteImportJobResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteImportJobMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const updateImportJobResponse = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.ImportJob') as gax.protobuf.Type; + const updateImportJobMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const validateImportJobResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const validateImportJobMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const runImportJobResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const runImportJobMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const createImportDataFileResponse = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.ImportDataFile') as gax.protobuf.Type; + const createImportDataFileMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const deleteImportDataFileResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteImportDataFileMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const createGroupResponse = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.Group') as gax.protobuf.Type; + const createGroupMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const updateGroupResponse = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.Group') as gax.protobuf.Type; + const updateGroupMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const deleteGroupResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteGroupMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const addAssetsToGroupResponse = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.Group') as gax.protobuf.Type; + const addAssetsToGroupMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const removeAssetsFromGroupResponse = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.Group') as gax.protobuf.Type; + const removeAssetsFromGroupMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const createSourceResponse = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.Source') as gax.protobuf.Type; + const createSourceMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const updateSourceResponse = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.Source') as gax.protobuf.Type; + const updateSourceMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const deleteSourceResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteSourceMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const createPreferenceSetResponse = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.PreferenceSet') as gax.protobuf.Type; + const createPreferenceSetMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const updatePreferenceSetResponse = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.PreferenceSet') as gax.protobuf.Type; + const updatePreferenceSetMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const deletePreferenceSetResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deletePreferenceSetMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const updateSettingsResponse = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.Settings') as gax.protobuf.Type; + const updateSettingsMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const createReportConfigResponse = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.ReportConfig') as gax.protobuf.Type; + const createReportConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const deleteReportConfigResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteReportConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const createReportResponse = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.Report') as gax.protobuf.Type; + const createReportMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + const deleteReportResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteReportMetadata = protoFilesRoot.lookup( + '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createImportJob: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createImportJobResponse.decode.bind(createImportJobResponse), + createImportJobMetadata.decode.bind(createImportJobMetadata)), + deleteImportJob: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteImportJobResponse.decode.bind(deleteImportJobResponse), + deleteImportJobMetadata.decode.bind(deleteImportJobMetadata)), + updateImportJob: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateImportJobResponse.decode.bind(updateImportJobResponse), + updateImportJobMetadata.decode.bind(updateImportJobMetadata)), + validateImportJob: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + validateImportJobResponse.decode.bind(validateImportJobResponse), + validateImportJobMetadata.decode.bind(validateImportJobMetadata)), + runImportJob: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + runImportJobResponse.decode.bind(runImportJobResponse), + runImportJobMetadata.decode.bind(runImportJobMetadata)), + createImportDataFile: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createImportDataFileResponse.decode.bind(createImportDataFileResponse), + createImportDataFileMetadata.decode.bind(createImportDataFileMetadata)), + deleteImportDataFile: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteImportDataFileResponse.decode.bind(deleteImportDataFileResponse), + deleteImportDataFileMetadata.decode.bind(deleteImportDataFileMetadata)), + createGroup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createGroupResponse.decode.bind(createGroupResponse), + createGroupMetadata.decode.bind(createGroupMetadata)), + updateGroup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateGroupResponse.decode.bind(updateGroupResponse), + updateGroupMetadata.decode.bind(updateGroupMetadata)), + deleteGroup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteGroupResponse.decode.bind(deleteGroupResponse), + deleteGroupMetadata.decode.bind(deleteGroupMetadata)), + addAssetsToGroup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + addAssetsToGroupResponse.decode.bind(addAssetsToGroupResponse), + addAssetsToGroupMetadata.decode.bind(addAssetsToGroupMetadata)), + removeAssetsFromGroup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + removeAssetsFromGroupResponse.decode.bind(removeAssetsFromGroupResponse), + removeAssetsFromGroupMetadata.decode.bind(removeAssetsFromGroupMetadata)), + createSource: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createSourceResponse.decode.bind(createSourceResponse), + createSourceMetadata.decode.bind(createSourceMetadata)), + updateSource: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateSourceResponse.decode.bind(updateSourceResponse), + updateSourceMetadata.decode.bind(updateSourceMetadata)), + deleteSource: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteSourceResponse.decode.bind(deleteSourceResponse), + deleteSourceMetadata.decode.bind(deleteSourceMetadata)), + createPreferenceSet: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createPreferenceSetResponse.decode.bind(createPreferenceSetResponse), + createPreferenceSetMetadata.decode.bind(createPreferenceSetMetadata)), + updatePreferenceSet: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updatePreferenceSetResponse.decode.bind(updatePreferenceSetResponse), + updatePreferenceSetMetadata.decode.bind(updatePreferenceSetMetadata)), + deletePreferenceSet: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deletePreferenceSetResponse.decode.bind(deletePreferenceSetResponse), + deletePreferenceSetMetadata.decode.bind(deletePreferenceSetMetadata)), + updateSettings: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateSettingsResponse.decode.bind(updateSettingsResponse), + updateSettingsMetadata.decode.bind(updateSettingsMetadata)), + createReportConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createReportConfigResponse.decode.bind(createReportConfigResponse), + createReportConfigMetadata.decode.bind(createReportConfigMetadata)), + deleteReportConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteReportConfigResponse.decode.bind(deleteReportConfigResponse), + deleteReportConfigMetadata.decode.bind(deleteReportConfigMetadata)), + createReport: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createReportResponse.decode.bind(createReportResponse), + createReportMetadata.decode.bind(createReportMetadata)), + deleteReport: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteReportResponse.decode.bind(deleteReportResponse), + deleteReportMetadata.decode.bind(deleteReportMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.migrationcenter.v1.MigrationCenter', 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.migrationCenterStub) { + return this.migrationCenterStub; + } + + // Put together the "service stub" for + // google.cloud.migrationcenter.v1.MigrationCenter. + this.migrationCenterStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.migrationcenter.v1.MigrationCenter') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.migrationcenter.v1.MigrationCenter, + 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 migrationCenterStubMethods = + ['listAssets', 'getAsset', 'updateAsset', 'batchUpdateAssets', 'deleteAsset', 'batchDeleteAssets', 'reportAssetFrames', 'aggregateAssetsValues', 'createImportJob', 'listImportJobs', 'getImportJob', 'deleteImportJob', 'updateImportJob', 'validateImportJob', 'runImportJob', 'getImportDataFile', 'listImportDataFiles', 'createImportDataFile', 'deleteImportDataFile', 'listGroups', 'getGroup', 'createGroup', 'updateGroup', 'deleteGroup', 'addAssetsToGroup', 'removeAssetsFromGroup', 'listErrorFrames', 'getErrorFrame', 'listSources', 'getSource', 'createSource', 'updateSource', 'deleteSource', 'listPreferenceSets', 'getPreferenceSet', 'createPreferenceSet', 'updatePreferenceSet', 'deletePreferenceSet', 'getSettings', 'updateSettings', 'createReportConfig', 'getReportConfig', 'listReportConfigs', 'deleteReportConfig', 'createReport', 'getReport', 'listReports', 'deleteReport']; + for (const methodName of migrationCenterStubMethods) { + const callPromise = this.migrationCenterStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.migrationCenterStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'migrationcenter.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 'migrationcenter.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 -- + // ------------------- +/** + * Gets the details of an asset. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @param {google.cloud.migrationcenter.v1.AssetView} request.view + * View of the assets. Defaults to BASIC. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.Asset|Asset}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.get_asset.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_GetAsset_async + */ + getAsset( + request?: protos.google.cloud.migrationcenter.v1.IGetAssetRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IAsset, + protos.google.cloud.migrationcenter.v1.IGetAssetRequest|undefined, {}|undefined + ]>; + getAsset( + request: protos.google.cloud.migrationcenter.v1.IGetAssetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IAsset, + protos.google.cloud.migrationcenter.v1.IGetAssetRequest|null|undefined, + {}|null|undefined>): void; + getAsset( + request: protos.google.cloud.migrationcenter.v1.IGetAssetRequest, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IAsset, + protos.google.cloud.migrationcenter.v1.IGetAssetRequest|null|undefined, + {}|null|undefined>): void; + getAsset( + request?: protos.google.cloud.migrationcenter.v1.IGetAssetRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.migrationcenter.v1.IAsset, + protos.google.cloud.migrationcenter.v1.IGetAssetRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.migrationcenter.v1.IAsset, + protos.google.cloud.migrationcenter.v1.IGetAssetRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IAsset, + protos.google.cloud.migrationcenter.v1.IGetAssetRequest|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.getAsset(request, options, callback); + } +/** + * Updates the parameters of an asset. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `Asset` resource by the update. + * The values specified in the `update_mask` field are relative to the + * resource, not the full request. + * A field will be overwritten if it is in the mask. + * A single * value in the mask lets you to overwrite all fields. + * @param {google.cloud.migrationcenter.v1.Asset} request.asset + * Required. The resource being updated. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.Asset|Asset}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.update_asset.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateAsset_async + */ + updateAsset( + request?: protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IAsset, + protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest|undefined, {}|undefined + ]>; + updateAsset( + request: protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IAsset, + protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest|null|undefined, + {}|null|undefined>): void; + updateAsset( + request: protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IAsset, + protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest|null|undefined, + {}|null|undefined>): void; + updateAsset( + request?: protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.migrationcenter.v1.IAsset, + protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.migrationcenter.v1.IAsset, + protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IAsset, + protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest|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({ + 'asset.name': request.asset!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateAsset(request, options, callback); + } +/** + * Updates the parameters of a list of assets. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for batch asset update. + * @param {number[]} request.requests + * Required. The request message specifying the resources to update. + * A maximum of 1000 assets can be modified in a batch. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.BatchUpdateAssetsResponse|BatchUpdateAssetsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.batch_update_assets.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_BatchUpdateAssets_async + */ + batchUpdateAssets( + request?: protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsResponse, + protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest|undefined, {}|undefined + ]>; + batchUpdateAssets( + request: protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsResponse, + protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest|null|undefined, + {}|null|undefined>): void; + batchUpdateAssets( + request: protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsResponse, + protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest|null|undefined, + {}|null|undefined>): void; + batchUpdateAssets( + request?: protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsResponse, + protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsResponse, + protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsResponse, + protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest|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.batchUpdateAssets(request, options, callback); + } +/** + * Deletes an asset. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.delete_asset.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteAsset_async + */ + deleteAsset( + request?: protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest|undefined, {}|undefined + ]>; + deleteAsset( + request: protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest|null|undefined, + {}|null|undefined>): void; + deleteAsset( + request: protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest|null|undefined, + {}|null|undefined>): void; + deleteAsset( + request?: protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest|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.deleteAsset(request, options, callback); + } +/** + * Deletes list of Assets. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for batch asset delete. + * @param {string[]} request.names + * Required. The IDs of the assets to delete. + * A maximum of 1000 assets can be deleted in a batch. + * Format: projects/{project}/locations/{location}/assets/{name}. + * @param {boolean} [request.allowMissing] + * Optional. When this value is set to `true` the request is a no-op for + * non-existing assets. See https://google.aip.dev/135#delete-if-existing for + * additional details. Default value is `false`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.batch_delete_assets.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_BatchDeleteAssets_async + */ + batchDeleteAssets( + request?: protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest|undefined, {}|undefined + ]>; + batchDeleteAssets( + request: protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest|null|undefined, + {}|null|undefined>): void; + batchDeleteAssets( + request: protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest|null|undefined, + {}|null|undefined>): void; + batchDeleteAssets( + request?: protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest|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.batchDeleteAssets(request, options, callback); + } +/** + * Reports a set of frames. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent of the resource. + * @param {google.cloud.migrationcenter.v1.Frames} request.frames + * Collection of frames data. + * @param {string} request.source + * Required. Reference to a source. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.ReportAssetFramesResponse|ReportAssetFramesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.report_asset_frames.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_ReportAssetFrames_async + */ + reportAssetFrames( + request?: protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IReportAssetFramesResponse, + protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest|undefined, {}|undefined + ]>; + reportAssetFrames( + request: protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IReportAssetFramesResponse, + protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest|null|undefined, + {}|null|undefined>): void; + reportAssetFrames( + request: protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IReportAssetFramesResponse, + protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest|null|undefined, + {}|null|undefined>): void; + reportAssetFrames( + request?: protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.migrationcenter.v1.IReportAssetFramesResponse, + protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.migrationcenter.v1.IReportAssetFramesResponse, + protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IReportAssetFramesResponse, + protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest|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.reportAssetFrames(request, options, callback); + } +/** + * Aggregates the requested fields based on provided function. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for `AggregateAssetsValuesRequest`. + * @param {number[]} request.aggregations + * Array of aggregations to perform. + * Up to 25 aggregations can be defined. + * @param {string} request.filter + * The aggregation will be performed on assets that match the provided filter. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.AggregateAssetsValuesResponse|AggregateAssetsValuesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.aggregate_assets_values.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_AggregateAssetsValues_async + */ + aggregateAssetsValues( + request?: protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesResponse, + protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest|undefined, {}|undefined + ]>; + aggregateAssetsValues( + request: protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesResponse, + protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest|null|undefined, + {}|null|undefined>): void; + aggregateAssetsValues( + request: protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesResponse, + protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest|null|undefined, + {}|null|undefined>): void; + aggregateAssetsValues( + request?: protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesResponse, + protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesResponse, + protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesResponse, + protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest|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.aggregateAssetsValues(request, options, callback); + } +/** + * Gets the details of an import job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @param {google.cloud.migrationcenter.v1.ImportJobView} [request.view] + * Optional. The level of details of the import job. + * Default value is FULL. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.ImportJob|ImportJob}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.get_import_job.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_GetImportJob_async + */ + getImportJob( + request?: protos.google.cloud.migrationcenter.v1.IGetImportJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IImportJob, + protos.google.cloud.migrationcenter.v1.IGetImportJobRequest|undefined, {}|undefined + ]>; + getImportJob( + request: protos.google.cloud.migrationcenter.v1.IGetImportJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IImportJob, + protos.google.cloud.migrationcenter.v1.IGetImportJobRequest|null|undefined, + {}|null|undefined>): void; + getImportJob( + request: protos.google.cloud.migrationcenter.v1.IGetImportJobRequest, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IImportJob, + protos.google.cloud.migrationcenter.v1.IGetImportJobRequest|null|undefined, + {}|null|undefined>): void; + getImportJob( + request?: protos.google.cloud.migrationcenter.v1.IGetImportJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.migrationcenter.v1.IImportJob, + protos.google.cloud.migrationcenter.v1.IGetImportJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.migrationcenter.v1.IImportJob, + protos.google.cloud.migrationcenter.v1.IGetImportJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IImportJob, + protos.google.cloud.migrationcenter.v1.IGetImportJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getImportJob(request, options, callback); + } +/** + * Gets an import data file. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the ImportDataFile. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.ImportDataFile|ImportDataFile}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.get_import_data_file.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_GetImportDataFile_async + */ + getImportDataFile( + request?: protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IImportDataFile, + protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest|undefined, {}|undefined + ]>; + getImportDataFile( + request: protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IImportDataFile, + protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest|null|undefined, + {}|null|undefined>): void; + getImportDataFile( + request: protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IImportDataFile, + protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest|null|undefined, + {}|null|undefined>): void; + getImportDataFile( + request?: protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.migrationcenter.v1.IImportDataFile, + protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.migrationcenter.v1.IImportDataFile, + protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IImportDataFile, + protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest|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.getImportDataFile(request, options, callback); + } +/** + * Gets the details of a group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the 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 protos.google.cloud.migrationcenter.v1.Group|Group}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.get_group.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_GetGroup_async + */ + getGroup( + request?: protos.google.cloud.migrationcenter.v1.IGetGroupRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IGroup, + protos.google.cloud.migrationcenter.v1.IGetGroupRequest|undefined, {}|undefined + ]>; + getGroup( + request: protos.google.cloud.migrationcenter.v1.IGetGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IGroup, + protos.google.cloud.migrationcenter.v1.IGetGroupRequest|null|undefined, + {}|null|undefined>): void; + getGroup( + request: protos.google.cloud.migrationcenter.v1.IGetGroupRequest, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IGroup, + protos.google.cloud.migrationcenter.v1.IGetGroupRequest|null|undefined, + {}|null|undefined>): void; + getGroup( + request?: protos.google.cloud.migrationcenter.v1.IGetGroupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.migrationcenter.v1.IGroup, + protos.google.cloud.migrationcenter.v1.IGetGroupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.migrationcenter.v1.IGroup, + protos.google.cloud.migrationcenter.v1.IGetGroupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IGroup, + protos.google.cloud.migrationcenter.v1.IGetGroupRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getGroup(request, options, callback); + } +/** + * Gets the details of an error frame. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the frame to retrieve. + * Format: + * projects/{project}/locations/{location}/sources/{source}/errorFrames/{error_frame} + * @param {google.cloud.migrationcenter.v1.ErrorFrameView} [request.view] + * Optional. An optional view mode to control the level of details for the + * frame. The default is a basic frame view. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.ErrorFrame|ErrorFrame}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.get_error_frame.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_GetErrorFrame_async + */ + getErrorFrame( + request?: protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IErrorFrame, + protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest|undefined, {}|undefined + ]>; + getErrorFrame( + request: protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IErrorFrame, + protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest|null|undefined, + {}|null|undefined>): void; + getErrorFrame( + request: protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IErrorFrame, + protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest|null|undefined, + {}|null|undefined>): void; + getErrorFrame( + request?: protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.migrationcenter.v1.IErrorFrame, + protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.migrationcenter.v1.IErrorFrame, + protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IErrorFrame, + protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest|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.getErrorFrame(request, options, callback); + } +/** + * Gets the details of a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the 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 protos.google.cloud.migrationcenter.v1.Source|Source}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.get_source.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_GetSource_async + */ + getSource( + request?: protos.google.cloud.migrationcenter.v1.IGetSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.ISource, + protos.google.cloud.migrationcenter.v1.IGetSourceRequest|undefined, {}|undefined + ]>; + getSource( + request: protos.google.cloud.migrationcenter.v1.IGetSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.migrationcenter.v1.ISource, + protos.google.cloud.migrationcenter.v1.IGetSourceRequest|null|undefined, + {}|null|undefined>): void; + getSource( + request: protos.google.cloud.migrationcenter.v1.IGetSourceRequest, + callback: Callback< + protos.google.cloud.migrationcenter.v1.ISource, + protos.google.cloud.migrationcenter.v1.IGetSourceRequest|null|undefined, + {}|null|undefined>): void; + getSource( + request?: protos.google.cloud.migrationcenter.v1.IGetSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.migrationcenter.v1.ISource, + protos.google.cloud.migrationcenter.v1.IGetSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.migrationcenter.v1.ISource, + protos.google.cloud.migrationcenter.v1.IGetSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.migrationcenter.v1.ISource, + protos.google.cloud.migrationcenter.v1.IGetSourceRequest|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.getSource(request, options, callback); + } +/** + * Gets the details of a preference set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the 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 protos.google.cloud.migrationcenter.v1.PreferenceSet|PreferenceSet}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.get_preference_set.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_GetPreferenceSet_async + */ + getPreferenceSet( + request?: protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IPreferenceSet, + protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest|undefined, {}|undefined + ]>; + getPreferenceSet( + request: protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IPreferenceSet, + protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest|null|undefined, + {}|null|undefined>): void; + getPreferenceSet( + request: protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IPreferenceSet, + protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest|null|undefined, + {}|null|undefined>): void; + getPreferenceSet( + request?: protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.migrationcenter.v1.IPreferenceSet, + protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.migrationcenter.v1.IPreferenceSet, + protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IPreferenceSet, + protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest|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.getPreferenceSet(request, options, callback); + } +/** + * Gets the details of regional settings. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the 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 protos.google.cloud.migrationcenter.v1.Settings|Settings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.get_settings.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_GetSettings_async + */ + getSettings( + request?: protos.google.cloud.migrationcenter.v1.IGetSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.ISettings, + protos.google.cloud.migrationcenter.v1.IGetSettingsRequest|undefined, {}|undefined + ]>; + getSettings( + request: protos.google.cloud.migrationcenter.v1.IGetSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.migrationcenter.v1.ISettings, + protos.google.cloud.migrationcenter.v1.IGetSettingsRequest|null|undefined, + {}|null|undefined>): void; + getSettings( + request: protos.google.cloud.migrationcenter.v1.IGetSettingsRequest, + callback: Callback< + protos.google.cloud.migrationcenter.v1.ISettings, + protos.google.cloud.migrationcenter.v1.IGetSettingsRequest|null|undefined, + {}|null|undefined>): void; + getSettings( + request?: protos.google.cloud.migrationcenter.v1.IGetSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.migrationcenter.v1.ISettings, + protos.google.cloud.migrationcenter.v1.IGetSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.migrationcenter.v1.ISettings, + protos.google.cloud.migrationcenter.v1.IGetSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.migrationcenter.v1.ISettings, + protos.google.cloud.migrationcenter.v1.IGetSettingsRequest|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.getSettings(request, options, callback); + } +/** + * Gets details of a single ReportConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the 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 protos.google.cloud.migrationcenter.v1.ReportConfig|ReportConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.get_report_config.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_GetReportConfig_async + */ + getReportConfig( + request?: protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IReportConfig, + protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest|undefined, {}|undefined + ]>; + getReportConfig( + request: protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IReportConfig, + protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest|null|undefined, + {}|null|undefined>): void; + getReportConfig( + request: protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IReportConfig, + protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest|null|undefined, + {}|null|undefined>): void; + getReportConfig( + request?: protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.migrationcenter.v1.IReportConfig, + protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.migrationcenter.v1.IReportConfig, + protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IReportConfig, + protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest|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.getReportConfig(request, options, callback); + } +/** + * Gets details of a single Report. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @param {google.cloud.migrationcenter.v1.ReportView} request.view + * Determines what information to retrieve for the Report. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.Report|Report}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.get_report.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_GetReport_async + */ + getReport( + request?: protos.google.cloud.migrationcenter.v1.IGetReportRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IReport, + protos.google.cloud.migrationcenter.v1.IGetReportRequest|undefined, {}|undefined + ]>; + getReport( + request: protos.google.cloud.migrationcenter.v1.IGetReportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IReport, + protos.google.cloud.migrationcenter.v1.IGetReportRequest|null|undefined, + {}|null|undefined>): void; + getReport( + request: protos.google.cloud.migrationcenter.v1.IGetReportRequest, + callback: Callback< + protos.google.cloud.migrationcenter.v1.IReport, + protos.google.cloud.migrationcenter.v1.IGetReportRequest|null|undefined, + {}|null|undefined>): void; + getReport( + request?: protos.google.cloud.migrationcenter.v1.IGetReportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.migrationcenter.v1.IReport, + protos.google.cloud.migrationcenter.v1.IGetReportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.migrationcenter.v1.IReport, + protos.google.cloud.migrationcenter.v1.IGetReportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IReport, + protos.google.cloud.migrationcenter.v1.IGetReportRequest|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.getReport(request, options, callback); + } + +/** + * Creates an import job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.importJobId + * Required. ID of the import job. + * @param {google.cloud.migrationcenter.v1.ImportJob} request.importJob + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.create_import_job.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateImportJob_async + */ + createImportJob( + request?: protos.google.cloud.migrationcenter.v1.ICreateImportJobRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createImportJob( + request: protos.google.cloud.migrationcenter.v1.ICreateImportJobRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createImportJob( + request: protos.google.cloud.migrationcenter.v1.ICreateImportJobRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createImportJob( + request?: protos.google.cloud.migrationcenter.v1.ICreateImportJobRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createImportJob(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createImportJob()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.create_import_job.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateImportJob_async + */ + async checkCreateImportJobProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createImportJob, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes an import job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.force] + * Optional. If set to `true`, any `ImportDataFiles` of this job will also be + * deleted If set to `false`, the request only works if the job has no data + * files. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.delete_import_job.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteImportJob_async + */ + deleteImportJob( + request?: protos.google.cloud.migrationcenter.v1.IDeleteImportJobRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteImportJob( + request: protos.google.cloud.migrationcenter.v1.IDeleteImportJobRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteImportJob( + request: protos.google.cloud.migrationcenter.v1.IDeleteImportJobRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteImportJob( + request?: protos.google.cloud.migrationcenter.v1.IDeleteImportJobRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteImportJob(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteImportJob()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.delete_import_job.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteImportJob_async + */ + async checkDeleteImportJobProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteImportJob, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an import job. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `Asset` resource by the update. + * The values specified in the `update_mask` field are relative to the + * resource, not the full request. + * A field will be overwritten if it is in the mask. + * A single * value in the mask lets you to overwrite all fields. + * @param {google.cloud.migrationcenter.v1.ImportJob} request.importJob + * Required. The resource being updated + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.update_import_job.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateImportJob_async + */ + updateImportJob( + request?: protos.google.cloud.migrationcenter.v1.IUpdateImportJobRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateImportJob( + request: protos.google.cloud.migrationcenter.v1.IUpdateImportJobRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateImportJob( + request: protos.google.cloud.migrationcenter.v1.IUpdateImportJobRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateImportJob( + request?: protos.google.cloud.migrationcenter.v1.IUpdateImportJobRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'import_job.name': request.importJob!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateImportJob(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateImportJob()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.update_import_job.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateImportJob_async + */ + async checkUpdateImportJobProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateImportJob, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Validates an import job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the import job to validate. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.validate_import_job.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_ValidateImportJob_async + */ + validateImportJob( + request?: protos.google.cloud.migrationcenter.v1.IValidateImportJobRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + validateImportJob( + request: protos.google.cloud.migrationcenter.v1.IValidateImportJobRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + validateImportJob( + request: protos.google.cloud.migrationcenter.v1.IValidateImportJobRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + validateImportJob( + request?: protos.google.cloud.migrationcenter.v1.IValidateImportJobRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.validateImportJob(request, options, callback); + } +/** + * Check the status of the long running operation returned by `validateImportJob()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.validate_import_job.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_ValidateImportJob_async + */ + async checkValidateImportJobProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.validateImportJob, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Runs an import job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the import job to run. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.run_import_job.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_RunImportJob_async + */ + runImportJob( + request?: protos.google.cloud.migrationcenter.v1.IRunImportJobRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + runImportJob( + request: protos.google.cloud.migrationcenter.v1.IRunImportJobRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runImportJob( + request: protos.google.cloud.migrationcenter.v1.IRunImportJobRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runImportJob( + request?: protos.google.cloud.migrationcenter.v1.IRunImportJobRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.runImportJob(request, options, callback); + } +/** + * Check the status of the long running operation returned by `runImportJob()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.run_import_job.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_RunImportJob_async + */ + async checkRunImportJobProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runImportJob, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates an import data file. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the parent of the ImportDataFile. + * @param {string} request.importDataFileId + * Required. The ID of the new data file. + * @param {google.cloud.migrationcenter.v1.ImportDataFile} request.importDataFile + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.create_import_data_file.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateImportDataFile_async + */ + createImportDataFile( + request?: protos.google.cloud.migrationcenter.v1.ICreateImportDataFileRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createImportDataFile( + request: protos.google.cloud.migrationcenter.v1.ICreateImportDataFileRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createImportDataFile( + request: protos.google.cloud.migrationcenter.v1.ICreateImportDataFileRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createImportDataFile( + request?: protos.google.cloud.migrationcenter.v1.ICreateImportDataFileRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createImportDataFile(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createImportDataFile()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.create_import_data_file.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateImportDataFile_async + */ + async checkCreateImportDataFileProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createImportDataFile, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Delete an import data file. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the ImportDataFile to delete. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.delete_import_data_file.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteImportDataFile_async + */ + deleteImportDataFile( + request?: protos.google.cloud.migrationcenter.v1.IDeleteImportDataFileRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteImportDataFile( + request: protos.google.cloud.migrationcenter.v1.IDeleteImportDataFileRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteImportDataFile( + request: protos.google.cloud.migrationcenter.v1.IDeleteImportDataFileRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteImportDataFile( + request?: protos.google.cloud.migrationcenter.v1.IDeleteImportDataFileRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteImportDataFile(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteImportDataFile()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.delete_import_data_file.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteImportDataFile_async + */ + async checkDeleteImportDataFileProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteImportDataFile, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new group in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.groupId + * Required. User specified ID for the group. It will become the last + * component of the group name. The ID must be unique within the project, must + * conform with RFC-1034, is restricted to lower-cased letters, and has a + * maximum length of 63 characters. The ID must match the regular expression: + * `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. + * @param {google.cloud.migrationcenter.v1.Group} request.group + * Required. The group resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.create_group.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateGroup_async + */ + createGroup( + request?: protos.google.cloud.migrationcenter.v1.ICreateGroupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createGroup( + request: protos.google.cloud.migrationcenter.v1.ICreateGroupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createGroup( + request: protos.google.cloud.migrationcenter.v1.ICreateGroupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createGroup( + request?: protos.google.cloud.migrationcenter.v1.ICreateGroupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createGroup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createGroup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.create_group.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateGroup_async + */ + async checkCreateGroupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createGroup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the parameters of a group. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `Group` resource by the update. + * The values specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * A single * value in the mask lets you to overwrite all fields. + * @param {google.cloud.migrationcenter.v1.Group} request.group + * Required. The group resource being updated. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.update_group.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateGroup_async + */ + updateGroup( + request?: protos.google.cloud.migrationcenter.v1.IUpdateGroupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateGroup( + request: protos.google.cloud.migrationcenter.v1.IUpdateGroupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateGroup( + request: protos.google.cloud.migrationcenter.v1.IUpdateGroupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateGroup( + request?: protos.google.cloud.migrationcenter.v1.IUpdateGroupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'group.name': request.group!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateGroup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateGroup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.update_group.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateGroup_async + */ + async checkUpdateGroupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateGroup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the group resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.delete_group.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteGroup_async + */ + deleteGroup( + request?: protos.google.cloud.migrationcenter.v1.IDeleteGroupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteGroup( + request: protos.google.cloud.migrationcenter.v1.IDeleteGroupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteGroup( + request: protos.google.cloud.migrationcenter.v1.IDeleteGroupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteGroup( + request?: protos.google.cloud.migrationcenter.v1.IDeleteGroupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteGroup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteGroup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.delete_group.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteGroup_async + */ + async checkDeleteGroupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteGroup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Adds assets to a group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.group + * Required. Group reference. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {google.cloud.migrationcenter.v1.AssetList} request.assets + * Required. List of assets to be added. + * The maximum number of assets that can be added in a single request is + * 1000. + * @param {boolean} [request.allowExisting] + * Optional. When this value is set to `false` and one of the given assets is + * already an existing member of the group, the operation fails with an + * `Already Exists` error. When set to `true` this situation is silently + * ignored by the server. + * + * Default value is `false`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.add_assets_to_group.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_AddAssetsToGroup_async + */ + addAssetsToGroup( + request?: protos.google.cloud.migrationcenter.v1.IAddAssetsToGroupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + addAssetsToGroup( + request: protos.google.cloud.migrationcenter.v1.IAddAssetsToGroupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + addAssetsToGroup( + request: protos.google.cloud.migrationcenter.v1.IAddAssetsToGroupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + addAssetsToGroup( + request?: protos.google.cloud.migrationcenter.v1.IAddAssetsToGroupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'group': request.group ?? '', + }); + this.initialize(); + return this.innerApiCalls.addAssetsToGroup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `addAssetsToGroup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.add_assets_to_group.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_AddAssetsToGroup_async + */ + async checkAddAssetsToGroupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.addAssetsToGroup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Removes assets from a group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.group + * Required. Group reference. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {google.cloud.migrationcenter.v1.AssetList} request.assets + * Required. List of assets to be removed. + * The maximum number of assets that can be removed in a single request is + * 1000. + * @param {boolean} [request.allowMissing] + * Optional. When this value is set to `false` and one of the given assets is + * not an existing member of the group, the operation fails with a `Not Found` + * error. When set to `true` this situation is silently ignored by the server. + * + * Default value is `false`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.remove_assets_from_group.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_RemoveAssetsFromGroup_async + */ + removeAssetsFromGroup( + request?: protos.google.cloud.migrationcenter.v1.IRemoveAssetsFromGroupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + removeAssetsFromGroup( + request: protos.google.cloud.migrationcenter.v1.IRemoveAssetsFromGroupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + removeAssetsFromGroup( + request: protos.google.cloud.migrationcenter.v1.IRemoveAssetsFromGroupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + removeAssetsFromGroup( + request?: protos.google.cloud.migrationcenter.v1.IRemoveAssetsFromGroupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'group': request.group ?? '', + }); + this.initialize(); + return this.innerApiCalls.removeAssetsFromGroup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `removeAssetsFromGroup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.remove_assets_from_group.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_RemoveAssetsFromGroup_async + */ + async checkRemoveAssetsFromGroupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.removeAssetsFromGroup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new source in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.sourceId + * Required. User specified ID for the source. It will become the last + * component of the source name. The ID must be unique within the project, + * must conform with RFC-1034, is restricted to lower-cased letters, and has a + * maximum length of 63 characters. The ID must match the regular expression: + * `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. + * @param {google.cloud.migrationcenter.v1.Source} request.source + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.create_source.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateSource_async + */ + createSource( + request?: protos.google.cloud.migrationcenter.v1.ICreateSourceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createSource( + request: protos.google.cloud.migrationcenter.v1.ICreateSourceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createSource( + request: protos.google.cloud.migrationcenter.v1.ICreateSourceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createSource( + request?: protos.google.cloud.migrationcenter.v1.ICreateSourceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createSource(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createSource()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.create_source.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateSource_async + */ + async checkCreateSourceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createSource, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the parameters of a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `Source` resource by the update. + * The values specified in the `update_mask` field are relative to the + * resource, not the full request. + * A field will be overwritten if it is in the mask. + * A single * value in the mask lets you to overwrite all fields. + * @param {google.cloud.migrationcenter.v1.Source} request.source + * Required. The resource being updated + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.update_source.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateSource_async + */ + updateSource( + request?: protos.google.cloud.migrationcenter.v1.IUpdateSourceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateSource( + request: protos.google.cloud.migrationcenter.v1.IUpdateSourceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateSource( + request: protos.google.cloud.migrationcenter.v1.IUpdateSourceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateSource( + request?: protos.google.cloud.migrationcenter.v1.IUpdateSourceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'source.name': request.source!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSource(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateSource()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.update_source.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateSource_async + */ + async checkUpdateSourceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateSource, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.delete_source.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteSource_async + */ + deleteSource( + request?: protos.google.cloud.migrationcenter.v1.IDeleteSourceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteSource( + request: protos.google.cloud.migrationcenter.v1.IDeleteSourceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteSource( + request: protos.google.cloud.migrationcenter.v1.IDeleteSourceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteSource( + request?: protos.google.cloud.migrationcenter.v1.IDeleteSourceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteSource(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteSource()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.delete_source.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteSource_async + */ + async checkDeleteSourceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteSource, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new preference set in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.preferenceSetId + * Required. User specified ID for the preference set. It will become the last + * component of the preference set name. The ID must be unique within the + * project, must conform with RFC-1034, is restricted to lower-cased letters, + * and has a maximum length of 63 characters. The ID must match the regular + * expression + * `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. + * @param {google.cloud.migrationcenter.v1.PreferenceSet} request.preferenceSet + * Required. The preference set resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.create_preference_set.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_CreatePreferenceSet_async + */ + createPreferenceSet( + request?: protos.google.cloud.migrationcenter.v1.ICreatePreferenceSetRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createPreferenceSet( + request: protos.google.cloud.migrationcenter.v1.ICreatePreferenceSetRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createPreferenceSet( + request: protos.google.cloud.migrationcenter.v1.ICreatePreferenceSetRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createPreferenceSet( + request?: protos.google.cloud.migrationcenter.v1.ICreatePreferenceSetRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createPreferenceSet(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createPreferenceSet()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.create_preference_set.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_CreatePreferenceSet_async + */ + async checkCreatePreferenceSetProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createPreferenceSet, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the parameters of a preference set. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `PreferenceSet` resource by the update. + * The values specified in the `update_mask` field are relative to the + * resource, not the full request. + * A field will be overwritten if it is in the mask. + * A single * value in the mask lets you to overwrite all fields. + * @param {google.cloud.migrationcenter.v1.PreferenceSet} request.preferenceSet + * Required. The preference set resource being updated. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.update_preference_set.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdatePreferenceSet_async + */ + updatePreferenceSet( + request?: protos.google.cloud.migrationcenter.v1.IUpdatePreferenceSetRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updatePreferenceSet( + request: protos.google.cloud.migrationcenter.v1.IUpdatePreferenceSetRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updatePreferenceSet( + request: protos.google.cloud.migrationcenter.v1.IUpdatePreferenceSetRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updatePreferenceSet( + request?: protos.google.cloud.migrationcenter.v1.IUpdatePreferenceSetRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'preference_set.name': request.preferenceSet!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updatePreferenceSet(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updatePreferenceSet()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.update_preference_set.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdatePreferenceSet_async + */ + async checkUpdatePreferenceSetProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updatePreferenceSet, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a preference set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the group resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.delete_preference_set.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_DeletePreferenceSet_async + */ + deletePreferenceSet( + request?: protos.google.cloud.migrationcenter.v1.IDeletePreferenceSetRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deletePreferenceSet( + request: protos.google.cloud.migrationcenter.v1.IDeletePreferenceSetRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deletePreferenceSet( + request: protos.google.cloud.migrationcenter.v1.IDeletePreferenceSetRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deletePreferenceSet( + request?: protos.google.cloud.migrationcenter.v1.IDeletePreferenceSetRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deletePreferenceSet(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deletePreferenceSet()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.delete_preference_set.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_DeletePreferenceSet_async + */ + async checkDeletePreferenceSetProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePreferenceSet, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the regional-level project settings. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `Settings` resource by the update. + * The values specified in the `update_mask` field are relative to the + * resource, not the full request. + * A field will be overwritten if it is in the mask. + * A single * value in the mask lets you to overwrite all fields. + * @param {google.cloud.migrationcenter.v1.Settings} request.settings + * Required. The project settings resource being updated. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.update_settings.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateSettings_async + */ + updateSettings( + request?: protos.google.cloud.migrationcenter.v1.IUpdateSettingsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateSettings( + request: protos.google.cloud.migrationcenter.v1.IUpdateSettingsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateSettings( + request: protos.google.cloud.migrationcenter.v1.IUpdateSettingsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateSettings( + request?: protos.google.cloud.migrationcenter.v1.IUpdateSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'settings.name': request.settings!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSettings(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateSettings()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.update_settings.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateSettings_async + */ + async checkUpdateSettingsProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateSettings, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a report configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.reportConfigId + * Required. User specified ID for the report config. It will become the last + * component of the report config name. The ID must be unique within the + * project, must conform with RFC-1034, is restricted to lower-cased letters, + * and has a maximum length of 63 characters. The ID must match the regular + * expression: [a-z]([a-z0-9-]{0,61}[a-z0-9])?. + * @param {google.cloud.migrationcenter.v1.ReportConfig} request.reportConfig + * Required. The report config set resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.create_report_config.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateReportConfig_async + */ + createReportConfig( + request?: protos.google.cloud.migrationcenter.v1.ICreateReportConfigRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createReportConfig( + request: protos.google.cloud.migrationcenter.v1.ICreateReportConfigRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createReportConfig( + request: protos.google.cloud.migrationcenter.v1.ICreateReportConfigRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createReportConfig( + request?: protos.google.cloud.migrationcenter.v1.ICreateReportConfigRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createReportConfig(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createReportConfig()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.create_report_config.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateReportConfig_async + */ + async checkCreateReportConfigProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createReportConfig, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a ReportConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.force] + * Optional. If set to `true`, any child `Reports` of this entity will also be + * deleted. If set to `false`, the request only works if the resource has no + * children. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.delete_report_config.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteReportConfig_async + */ + deleteReportConfig( + request?: protos.google.cloud.migrationcenter.v1.IDeleteReportConfigRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteReportConfig( + request: protos.google.cloud.migrationcenter.v1.IDeleteReportConfigRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteReportConfig( + request: protos.google.cloud.migrationcenter.v1.IDeleteReportConfigRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteReportConfig( + request?: protos.google.cloud.migrationcenter.v1.IDeleteReportConfigRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteReportConfig(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteReportConfig()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.delete_report_config.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteReportConfig_async + */ + async checkDeleteReportConfigProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteReportConfig, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a report. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.reportId + * Required. User specified id for the report. It will become the last + * component of the report name. The id must be unique within the project, + * must conform with RFC-1034, is restricted to lower-cased letters, and has a + * maximum length of 63 characters. The id must match the regular expression: + * [a-z]([a-z0-9-]{0,61}[a-z0-9])?. + * @param {google.cloud.migrationcenter.v1.Report} request.report + * Required. The report resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.create_report.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateReport_async + */ + createReport( + request?: protos.google.cloud.migrationcenter.v1.ICreateReportRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createReport( + request: protos.google.cloud.migrationcenter.v1.ICreateReportRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createReport( + request: protos.google.cloud.migrationcenter.v1.ICreateReportRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createReport( + request?: protos.google.cloud.migrationcenter.v1.ICreateReportRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createReport(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createReport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.create_report.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateReport_async + */ + async checkCreateReportProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createReport, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a Report. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.delete_report.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteReport_async + */ + deleteReport( + request?: protos.google.cloud.migrationcenter.v1.IDeleteReportRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteReport( + request: protos.google.cloud.migrationcenter.v1.IDeleteReportRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteReport( + request: protos.google.cloud.migrationcenter.v1.IDeleteReportRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteReport( + request?: protos.google.cloud.migrationcenter.v1.IDeleteReportRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteReport(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteReport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.delete_report.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteReport_async + */ + async checkDeleteReportProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteReport, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists all the assets in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for `ListAssetsRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {google.cloud.migrationcenter.v1.AssetView} request.view + * View of the assets. Defaults to BASIC. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.Asset|Asset}. + * 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 `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAssets( + request?: protos.google.cloud.migrationcenter.v1.IListAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IAsset[], + protos.google.cloud.migrationcenter.v1.IListAssetsRequest|null, + protos.google.cloud.migrationcenter.v1.IListAssetsResponse + ]>; + listAssets( + request: protos.google.cloud.migrationcenter.v1.IListAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListAssetsRequest, + protos.google.cloud.migrationcenter.v1.IListAssetsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IAsset>): void; + listAssets( + request: protos.google.cloud.migrationcenter.v1.IListAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListAssetsRequest, + protos.google.cloud.migrationcenter.v1.IListAssetsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IAsset>): void; + listAssets( + request?: protos.google.cloud.migrationcenter.v1.IListAssetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListAssetsRequest, + protos.google.cloud.migrationcenter.v1.IListAssetsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IAsset>, + callback?: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListAssetsRequest, + protos.google.cloud.migrationcenter.v1.IListAssetsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IAsset>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IAsset[], + protos.google.cloud.migrationcenter.v1.IListAssetsRequest|null, + protos.google.cloud.migrationcenter.v1.IListAssetsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listAssets(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. Parent value for `ListAssetsRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {google.cloud.migrationcenter.v1.AssetView} request.view + * View of the assets. Defaults to BASIC. + * @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 protos.google.cloud.migrationcenter.v1.Asset|Asset} 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 `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAssetsStream( + request?: protos.google.cloud.migrationcenter.v1.IListAssetsRequest, + 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['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.createStream( + this.innerApiCalls.listAssets as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAssets`, 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. Parent value for `ListAssetsRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {google.cloud.migrationcenter.v1.AssetView} request.view + * View of the assets. Defaults to BASIC. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.migrationcenter.v1.Asset|Asset}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.list_assets.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_ListAssets_async + */ + listAssetsAsync( + request?: protos.google.cloud.migrationcenter.v1.IListAssetsRequest, + 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['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.asyncIterate( + this.innerApiCalls['listAssets'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all import jobs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for `ListImportJobsRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {google.cloud.migrationcenter.v1.ImportJobView} [request.view] + * Optional. The level of details of each import job. + * Default value is BASIC. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.ImportJob|ImportJob}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listImportJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listImportJobs( + request?: protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IImportJob[], + protos.google.cloud.migrationcenter.v1.IListImportJobsRequest|null, + protos.google.cloud.migrationcenter.v1.IListImportJobsResponse + ]>; + listImportJobs( + request: protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, + protos.google.cloud.migrationcenter.v1.IListImportJobsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IImportJob>): void; + listImportJobs( + request: protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, + protos.google.cloud.migrationcenter.v1.IListImportJobsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IImportJob>): void; + listImportJobs( + request?: protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, + protos.google.cloud.migrationcenter.v1.IListImportJobsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IImportJob>, + callback?: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, + protos.google.cloud.migrationcenter.v1.IListImportJobsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IImportJob>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IImportJob[], + protos.google.cloud.migrationcenter.v1.IListImportJobsRequest|null, + protos.google.cloud.migrationcenter.v1.IListImportJobsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listImportJobs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for `ListImportJobsRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {google.cloud.migrationcenter.v1.ImportJobView} [request.view] + * Optional. The level of details of each import job. + * Default value is BASIC. + * @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 protos.google.cloud.migrationcenter.v1.ImportJob|ImportJob} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listImportJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listImportJobsStream( + request?: protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listImportJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listImportJobs.createStream( + this.innerApiCalls.listImportJobs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listImportJobs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for `ListImportJobsRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {google.cloud.migrationcenter.v1.ImportJobView} [request.view] + * Optional. The level of details of each import job. + * Default value is BASIC. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.migrationcenter.v1.ImportJob|ImportJob}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.list_import_jobs.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_ListImportJobs_async + */ + listImportJobsAsync( + request?: protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listImportJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listImportJobs.asyncIterate( + this.innerApiCalls['listImportJobs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * List import data files. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the parent of the `ImportDataFiles` resource. + * @param {number} request.pageSize + * The maximum number of data files to return. The service may return + * fewer than this value. If unspecified, at most 500 data files 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 `ListImportDataFiles` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListImportDataFiles` + * must match the call that provided the page token. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.ImportDataFile|ImportDataFile}. + * 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 `listImportDataFilesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listImportDataFiles( + request?: protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IImportDataFile[], + protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest|null, + protos.google.cloud.migrationcenter.v1.IListImportDataFilesResponse + ]>; + listImportDataFiles( + request: protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, + protos.google.cloud.migrationcenter.v1.IListImportDataFilesResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IImportDataFile>): void; + listImportDataFiles( + request: protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, + protos.google.cloud.migrationcenter.v1.IListImportDataFilesResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IImportDataFile>): void; + listImportDataFiles( + request?: protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, + protos.google.cloud.migrationcenter.v1.IListImportDataFilesResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IImportDataFile>, + callback?: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, + protos.google.cloud.migrationcenter.v1.IListImportDataFilesResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IImportDataFile>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IImportDataFile[], + protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest|null, + protos.google.cloud.migrationcenter.v1.IListImportDataFilesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listImportDataFiles(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. Name of the parent of the `ImportDataFiles` resource. + * @param {number} request.pageSize + * The maximum number of data files to return. The service may return + * fewer than this value. If unspecified, at most 500 data files 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 `ListImportDataFiles` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListImportDataFiles` + * must match the call that provided the page token. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @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 protos.google.cloud.migrationcenter.v1.ImportDataFile|ImportDataFile} 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 `listImportDataFilesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listImportDataFilesStream( + request?: protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, + 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['listImportDataFiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listImportDataFiles.createStream( + this.innerApiCalls.listImportDataFiles as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listImportDataFiles`, 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. Name of the parent of the `ImportDataFiles` resource. + * @param {number} request.pageSize + * The maximum number of data files to return. The service may return + * fewer than this value. If unspecified, at most 500 data files 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 `ListImportDataFiles` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListImportDataFiles` + * must match the call that provided the page token. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.migrationcenter.v1.ImportDataFile|ImportDataFile}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.list_import_data_files.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_ListImportDataFiles_async + */ + listImportDataFilesAsync( + request?: protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, + 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['listImportDataFiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listImportDataFiles.asyncIterate( + this.innerApiCalls['listImportDataFiles'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all groups in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for `ListGroupsRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.Group|Group}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listGroupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listGroups( + request?: protos.google.cloud.migrationcenter.v1.IListGroupsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IGroup[], + protos.google.cloud.migrationcenter.v1.IListGroupsRequest|null, + protos.google.cloud.migrationcenter.v1.IListGroupsResponse + ]>; + listGroups( + request: protos.google.cloud.migrationcenter.v1.IListGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListGroupsRequest, + protos.google.cloud.migrationcenter.v1.IListGroupsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IGroup>): void; + listGroups( + request: protos.google.cloud.migrationcenter.v1.IListGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListGroupsRequest, + protos.google.cloud.migrationcenter.v1.IListGroupsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IGroup>): void; + listGroups( + request?: protos.google.cloud.migrationcenter.v1.IListGroupsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListGroupsRequest, + protos.google.cloud.migrationcenter.v1.IListGroupsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IGroup>, + callback?: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListGroupsRequest, + protos.google.cloud.migrationcenter.v1.IListGroupsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IGroup>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IGroup[], + protos.google.cloud.migrationcenter.v1.IListGroupsRequest|null, + protos.google.cloud.migrationcenter.v1.IListGroupsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listGroups(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for `ListGroupsRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @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 protos.google.cloud.migrationcenter.v1.Group|Group} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listGroupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listGroupsStream( + request?: protos.google.cloud.migrationcenter.v1.IListGroupsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listGroups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listGroups.createStream( + this.innerApiCalls.listGroups as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listGroups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for `ListGroupsRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.migrationcenter.v1.Group|Group}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.list_groups.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_ListGroups_async + */ + listGroupsAsync( + request?: protos.google.cloud.migrationcenter.v1.IListGroupsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listGroups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listGroups.asyncIterate( + this.innerApiCalls['listGroups'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all error frames in a given source and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value (the source) for `ListErrorFramesRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {google.cloud.migrationcenter.v1.ErrorFrameView} [request.view] + * Optional. An optional view mode to control the level of details of each + * error frame. The default is a BASIC frame view. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.ErrorFrame|ErrorFrame}. + * 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 `listErrorFramesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listErrorFrames( + request?: protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IErrorFrame[], + protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest|null, + protos.google.cloud.migrationcenter.v1.IListErrorFramesResponse + ]>; + listErrorFrames( + request: protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, + protos.google.cloud.migrationcenter.v1.IListErrorFramesResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IErrorFrame>): void; + listErrorFrames( + request: protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, + protos.google.cloud.migrationcenter.v1.IListErrorFramesResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IErrorFrame>): void; + listErrorFrames( + request?: protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, + protos.google.cloud.migrationcenter.v1.IListErrorFramesResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IErrorFrame>, + callback?: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, + protos.google.cloud.migrationcenter.v1.IListErrorFramesResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IErrorFrame>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IErrorFrame[], + protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest|null, + protos.google.cloud.migrationcenter.v1.IListErrorFramesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listErrorFrames(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. Parent value (the source) for `ListErrorFramesRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {google.cloud.migrationcenter.v1.ErrorFrameView} [request.view] + * Optional. An optional view mode to control the level of details of each + * error frame. The default is a BASIC frame view. + * @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 protos.google.cloud.migrationcenter.v1.ErrorFrame|ErrorFrame} 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 `listErrorFramesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listErrorFramesStream( + request?: protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, + 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['listErrorFrames']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listErrorFrames.createStream( + this.innerApiCalls.listErrorFrames as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listErrorFrames`, 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. Parent value (the source) for `ListErrorFramesRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {google.cloud.migrationcenter.v1.ErrorFrameView} [request.view] + * Optional. An optional view mode to control the level of details of each + * error frame. The default is a BASIC frame view. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.migrationcenter.v1.ErrorFrame|ErrorFrame}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.list_error_frames.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_ListErrorFrames_async + */ + listErrorFramesAsync( + request?: protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, + 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['listErrorFrames']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listErrorFrames.asyncIterate( + this.innerApiCalls['listErrorFrames'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all the sources in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for `ListSourcesRequest`. + * @param {number} request.pageSize + * Requested page size. The server may return fewer items than requested. + * If unspecified, the server will pick an appropriate default value. + * @param {string} request.pageToken + * A token identifying a page of results that the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.Source|Source}. + * 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 `listSourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listSources( + request?: protos.google.cloud.migrationcenter.v1.IListSourcesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.ISource[], + protos.google.cloud.migrationcenter.v1.IListSourcesRequest|null, + protos.google.cloud.migrationcenter.v1.IListSourcesResponse + ]>; + listSources( + request: protos.google.cloud.migrationcenter.v1.IListSourcesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListSourcesRequest, + protos.google.cloud.migrationcenter.v1.IListSourcesResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.ISource>): void; + listSources( + request: protos.google.cloud.migrationcenter.v1.IListSourcesRequest, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListSourcesRequest, + protos.google.cloud.migrationcenter.v1.IListSourcesResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.ISource>): void; + listSources( + request?: protos.google.cloud.migrationcenter.v1.IListSourcesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListSourcesRequest, + protos.google.cloud.migrationcenter.v1.IListSourcesResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.ISource>, + callback?: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListSourcesRequest, + protos.google.cloud.migrationcenter.v1.IListSourcesResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.ISource>): + Promise<[ + protos.google.cloud.migrationcenter.v1.ISource[], + protos.google.cloud.migrationcenter.v1.IListSourcesRequest|null, + protos.google.cloud.migrationcenter.v1.IListSourcesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listSources(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. Parent value for `ListSourcesRequest`. + * @param {number} request.pageSize + * Requested page size. The server may return fewer items than requested. + * If unspecified, the server will pick an appropriate default value. + * @param {string} request.pageToken + * A token identifying a page of results that the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @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 protos.google.cloud.migrationcenter.v1.Source|Source} 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 `listSourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listSourcesStream( + request?: protos.google.cloud.migrationcenter.v1.IListSourcesRequest, + 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['listSources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSources.createStream( + this.innerApiCalls.listSources as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSources`, 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. Parent value for `ListSourcesRequest`. + * @param {number} request.pageSize + * Requested page size. The server may return fewer items than requested. + * If unspecified, the server will pick an appropriate default value. + * @param {string} request.pageToken + * A token identifying a page of results that the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.migrationcenter.v1.Source|Source}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.list_sources.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_ListSources_async + */ + listSourcesAsync( + request?: protos.google.cloud.migrationcenter.v1.IListSourcesRequest, + 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['listSources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSources.asyncIterate( + this.innerApiCalls['listSources'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all the preference sets in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for `ListPreferenceSetsRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, at most 500 preference sets will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.PreferenceSet|PreferenceSet}. + * 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 `listPreferenceSetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listPreferenceSets( + request?: protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IPreferenceSet[], + protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest|null, + protos.google.cloud.migrationcenter.v1.IListPreferenceSetsResponse + ]>; + listPreferenceSets( + request: protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, + protos.google.cloud.migrationcenter.v1.IListPreferenceSetsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IPreferenceSet>): void; + listPreferenceSets( + request: protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, + protos.google.cloud.migrationcenter.v1.IListPreferenceSetsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IPreferenceSet>): void; + listPreferenceSets( + request?: protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, + protos.google.cloud.migrationcenter.v1.IListPreferenceSetsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IPreferenceSet>, + callback?: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, + protos.google.cloud.migrationcenter.v1.IListPreferenceSetsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IPreferenceSet>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IPreferenceSet[], + protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest|null, + protos.google.cloud.migrationcenter.v1.IListPreferenceSetsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listPreferenceSets(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. Parent value for `ListPreferenceSetsRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, at most 500 preference sets will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @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 protos.google.cloud.migrationcenter.v1.PreferenceSet|PreferenceSet} 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 `listPreferenceSetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listPreferenceSetsStream( + request?: protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, + 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['listPreferenceSets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPreferenceSets.createStream( + this.innerApiCalls.listPreferenceSets as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listPreferenceSets`, 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. Parent value for `ListPreferenceSetsRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, at most 500 preference sets will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.migrationcenter.v1.PreferenceSet|PreferenceSet}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.list_preference_sets.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_ListPreferenceSets_async + */ + listPreferenceSetsAsync( + request?: protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, + 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['listPreferenceSets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPreferenceSets.asyncIterate( + this.innerApiCalls['listPreferenceSets'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists ReportConfigs in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for `ListReportConfigsRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.ReportConfig|ReportConfig}. + * 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 `listReportConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listReportConfigs( + request?: protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IReportConfig[], + protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest|null, + protos.google.cloud.migrationcenter.v1.IListReportConfigsResponse + ]>; + listReportConfigs( + request: protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, + protos.google.cloud.migrationcenter.v1.IListReportConfigsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IReportConfig>): void; + listReportConfigs( + request: protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, + protos.google.cloud.migrationcenter.v1.IListReportConfigsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IReportConfig>): void; + listReportConfigs( + request?: protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, + protos.google.cloud.migrationcenter.v1.IListReportConfigsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IReportConfig>, + callback?: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, + protos.google.cloud.migrationcenter.v1.IListReportConfigsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IReportConfig>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IReportConfig[], + protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest|null, + protos.google.cloud.migrationcenter.v1.IListReportConfigsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listReportConfigs(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. Parent value for `ListReportConfigsRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @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 protos.google.cloud.migrationcenter.v1.ReportConfig|ReportConfig} 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 `listReportConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listReportConfigsStream( + request?: protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, + 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['listReportConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listReportConfigs.createStream( + this.innerApiCalls.listReportConfigs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listReportConfigs`, 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. Parent value for `ListReportConfigsRequest`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.migrationcenter.v1.ReportConfig|ReportConfig}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.list_report_configs.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_ListReportConfigs_async + */ + listReportConfigsAsync( + request?: protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, + 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['listReportConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listReportConfigs.asyncIterate( + this.innerApiCalls['listReportConfigs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists Reports in a given ReportConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for `ListReportsRequest`. + * @param {number} request.pageSize + * Requested page size. The server may return fewer items than requested. + * If unspecified, the server will pick an appropriate default value. + * @param {string} request.pageToken + * A token identifying a page of results that the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {google.cloud.migrationcenter.v1.ReportView} request.view + * Determines what information to retrieve for each Report. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.Report|Report}. + * 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 `listReportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listReports( + request?: protos.google.cloud.migrationcenter.v1.IListReportsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.migrationcenter.v1.IReport[], + protos.google.cloud.migrationcenter.v1.IListReportsRequest|null, + protos.google.cloud.migrationcenter.v1.IListReportsResponse + ]>; + listReports( + request: protos.google.cloud.migrationcenter.v1.IListReportsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListReportsRequest, + protos.google.cloud.migrationcenter.v1.IListReportsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IReport>): void; + listReports( + request: protos.google.cloud.migrationcenter.v1.IListReportsRequest, + callback: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListReportsRequest, + protos.google.cloud.migrationcenter.v1.IListReportsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IReport>): void; + listReports( + request?: protos.google.cloud.migrationcenter.v1.IListReportsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListReportsRequest, + protos.google.cloud.migrationcenter.v1.IListReportsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IReport>, + callback?: PaginationCallback< + protos.google.cloud.migrationcenter.v1.IListReportsRequest, + protos.google.cloud.migrationcenter.v1.IListReportsResponse|null|undefined, + protos.google.cloud.migrationcenter.v1.IReport>): + Promise<[ + protos.google.cloud.migrationcenter.v1.IReport[], + protos.google.cloud.migrationcenter.v1.IListReportsRequest|null, + protos.google.cloud.migrationcenter.v1.IListReportsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listReports(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. Parent value for `ListReportsRequest`. + * @param {number} request.pageSize + * Requested page size. The server may return fewer items than requested. + * If unspecified, the server will pick an appropriate default value. + * @param {string} request.pageToken + * A token identifying a page of results that the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {google.cloud.migrationcenter.v1.ReportView} request.view + * Determines what information to retrieve for each Report. + * @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 protos.google.cloud.migrationcenter.v1.Report|Report} 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 `listReportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listReportsStream( + request?: protos.google.cloud.migrationcenter.v1.IListReportsRequest, + 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['listReports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listReports.createStream( + this.innerApiCalls.listReports as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listReports`, 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. Parent value for `ListReportsRequest`. + * @param {number} request.pageSize + * Requested page size. The server may return fewer items than requested. + * If unspecified, the server will pick an appropriate default value. + * @param {string} request.pageToken + * A token identifying a page of results that the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {google.cloud.migrationcenter.v1.ReportView} request.view + * Determines what information to retrieve for each Report. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.migrationcenter.v1.Report|Report}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/migration_center.list_reports.js + * region_tag:migrationcenter_v1_generated_MigrationCenter_ListReports_async + */ + listReportsAsync( + request?: protos.google.cloud.migrationcenter.v1.IListReportsRequest, + 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['listReports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listReports.asyncIterate( + this.innerApiCalls['listReports'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified asset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} asset + * @returns {string} Resource name string. + */ + assetPath(project:string,location:string,asset:string) { + return this.pathTemplates.assetPathTemplate.render({ + project: project, + location: location, + asset: asset, + }); + } + + /** + * Parse the project from Asset resource. + * + * @param {string} assetName + * A fully-qualified path representing Asset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAssetName(assetName: string) { + return this.pathTemplates.assetPathTemplate.match(assetName).project; + } + + /** + * Parse the location from Asset resource. + * + * @param {string} assetName + * A fully-qualified path representing Asset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAssetName(assetName: string) { + return this.pathTemplates.assetPathTemplate.match(assetName).location; + } + + /** + * Parse the asset from Asset resource. + * + * @param {string} assetName + * A fully-qualified path representing Asset resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromAssetName(assetName: string) { + return this.pathTemplates.assetPathTemplate.match(assetName).asset; + } + + /** + * Return a fully-qualified errorFrame resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} source + * @param {string} error_frame + * @returns {string} Resource name string. + */ + errorFramePath(project:string,location:string,source:string,errorFrame:string) { + return this.pathTemplates.errorFramePathTemplate.render({ + project: project, + location: location, + source: source, + error_frame: errorFrame, + }); + } + + /** + * Parse the project from ErrorFrame resource. + * + * @param {string} errorFrameName + * A fully-qualified path representing ErrorFrame resource. + * @returns {string} A string representing the project. + */ + matchProjectFromErrorFrameName(errorFrameName: string) { + return this.pathTemplates.errorFramePathTemplate.match(errorFrameName).project; + } + + /** + * Parse the location from ErrorFrame resource. + * + * @param {string} errorFrameName + * A fully-qualified path representing ErrorFrame resource. + * @returns {string} A string representing the location. + */ + matchLocationFromErrorFrameName(errorFrameName: string) { + return this.pathTemplates.errorFramePathTemplate.match(errorFrameName).location; + } + + /** + * Parse the source from ErrorFrame resource. + * + * @param {string} errorFrameName + * A fully-qualified path representing ErrorFrame resource. + * @returns {string} A string representing the source. + */ + matchSourceFromErrorFrameName(errorFrameName: string) { + return this.pathTemplates.errorFramePathTemplate.match(errorFrameName).source; + } + + /** + * Parse the error_frame from ErrorFrame resource. + * + * @param {string} errorFrameName + * A fully-qualified path representing ErrorFrame resource. + * @returns {string} A string representing the error_frame. + */ + matchErrorFrameFromErrorFrameName(errorFrameName: string) { + return this.pathTemplates.errorFramePathTemplate.match(errorFrameName).error_frame; + } + + /** + * Return a fully-qualified group resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} group + * @returns {string} Resource name string. + */ + groupPath(project:string,location:string,group:string) { + return this.pathTemplates.groupPathTemplate.render({ + project: project, + location: location, + group: group, + }); + } + + /** + * Parse the project from Group resource. + * + * @param {string} groupName + * A fully-qualified path representing Group resource. + * @returns {string} A string representing the project. + */ + matchProjectFromGroupName(groupName: string) { + return this.pathTemplates.groupPathTemplate.match(groupName).project; + } + + /** + * Parse the location from Group resource. + * + * @param {string} groupName + * A fully-qualified path representing Group resource. + * @returns {string} A string representing the location. + */ + matchLocationFromGroupName(groupName: string) { + return this.pathTemplates.groupPathTemplate.match(groupName).location; + } + + /** + * Parse the group from Group resource. + * + * @param {string} groupName + * A fully-qualified path representing Group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromGroupName(groupName: string) { + return this.pathTemplates.groupPathTemplate.match(groupName).group; + } + + /** + * Return a fully-qualified importDataFile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} import_job + * @param {string} import_data_file + * @returns {string} Resource name string. + */ + importDataFilePath(project:string,location:string,importJob:string,importDataFile:string) { + return this.pathTemplates.importDataFilePathTemplate.render({ + project: project, + location: location, + import_job: importJob, + import_data_file: importDataFile, + }); + } + + /** + * Parse the project from ImportDataFile resource. + * + * @param {string} importDataFileName + * A fully-qualified path representing ImportDataFile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromImportDataFileName(importDataFileName: string) { + return this.pathTemplates.importDataFilePathTemplate.match(importDataFileName).project; + } + + /** + * Parse the location from ImportDataFile resource. + * + * @param {string} importDataFileName + * A fully-qualified path representing ImportDataFile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromImportDataFileName(importDataFileName: string) { + return this.pathTemplates.importDataFilePathTemplate.match(importDataFileName).location; + } + + /** + * Parse the import_job from ImportDataFile resource. + * + * @param {string} importDataFileName + * A fully-qualified path representing ImportDataFile resource. + * @returns {string} A string representing the import_job. + */ + matchImportJobFromImportDataFileName(importDataFileName: string) { + return this.pathTemplates.importDataFilePathTemplate.match(importDataFileName).import_job; + } + + /** + * Parse the import_data_file from ImportDataFile resource. + * + * @param {string} importDataFileName + * A fully-qualified path representing ImportDataFile resource. + * @returns {string} A string representing the import_data_file. + */ + matchImportDataFileFromImportDataFileName(importDataFileName: string) { + return this.pathTemplates.importDataFilePathTemplate.match(importDataFileName).import_data_file; + } + + /** + * Return a fully-qualified importJob resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} import_job + * @returns {string} Resource name string. + */ + importJobPath(project:string,location:string,importJob:string) { + return this.pathTemplates.importJobPathTemplate.render({ + project: project, + location: location, + import_job: importJob, + }); + } + + /** + * Parse the project from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the project. + */ + matchProjectFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).project; + } + + /** + * Parse the location from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the location. + */ + matchLocationFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).location; + } + + /** + * Parse the import_job from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the import_job. + */ + matchImportJobFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName).import_job; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified preferenceSet resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} preference_set + * @returns {string} Resource name string. + */ + preferenceSetPath(project:string,location:string,preferenceSet:string) { + return this.pathTemplates.preferenceSetPathTemplate.render({ + project: project, + location: location, + preference_set: preferenceSet, + }); + } + + /** + * Parse the project from PreferenceSet resource. + * + * @param {string} preferenceSetName + * A fully-qualified path representing PreferenceSet resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPreferenceSetName(preferenceSetName: string) { + return this.pathTemplates.preferenceSetPathTemplate.match(preferenceSetName).project; + } + + /** + * Parse the location from PreferenceSet resource. + * + * @param {string} preferenceSetName + * A fully-qualified path representing PreferenceSet resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPreferenceSetName(preferenceSetName: string) { + return this.pathTemplates.preferenceSetPathTemplate.match(preferenceSetName).location; + } + + /** + * Parse the preference_set from PreferenceSet resource. + * + * @param {string} preferenceSetName + * A fully-qualified path representing PreferenceSet resource. + * @returns {string} A string representing the preference_set. + */ + matchPreferenceSetFromPreferenceSetName(preferenceSetName: string) { + return this.pathTemplates.preferenceSetPathTemplate.match(preferenceSetName).preference_set; + } + + /** + * 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 report resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} report_config + * @param {string} report + * @returns {string} Resource name string. + */ + reportPath(project:string,location:string,reportConfig:string,report:string) { + return this.pathTemplates.reportPathTemplate.render({ + project: project, + location: location, + report_config: reportConfig, + report: report, + }); + } + + /** + * Parse the project from Report resource. + * + * @param {string} reportName + * A fully-qualified path representing Report resource. + * @returns {string} A string representing the project. + */ + matchProjectFromReportName(reportName: string) { + return this.pathTemplates.reportPathTemplate.match(reportName).project; + } + + /** + * Parse the location from Report resource. + * + * @param {string} reportName + * A fully-qualified path representing Report resource. + * @returns {string} A string representing the location. + */ + matchLocationFromReportName(reportName: string) { + return this.pathTemplates.reportPathTemplate.match(reportName).location; + } + + /** + * Parse the report_config from Report resource. + * + * @param {string} reportName + * A fully-qualified path representing Report resource. + * @returns {string} A string representing the report_config. + */ + matchReportConfigFromReportName(reportName: string) { + return this.pathTemplates.reportPathTemplate.match(reportName).report_config; + } + + /** + * Parse the report from Report resource. + * + * @param {string} reportName + * A fully-qualified path representing Report resource. + * @returns {string} A string representing the report. + */ + matchReportFromReportName(reportName: string) { + return this.pathTemplates.reportPathTemplate.match(reportName).report; + } + + /** + * Return a fully-qualified reportConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} report_config + * @returns {string} Resource name string. + */ + reportConfigPath(project:string,location:string,reportConfig:string) { + return this.pathTemplates.reportConfigPathTemplate.render({ + project: project, + location: location, + report_config: reportConfig, + }); + } + + /** + * Parse the project from ReportConfig resource. + * + * @param {string} reportConfigName + * A fully-qualified path representing ReportConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromReportConfigName(reportConfigName: string) { + return this.pathTemplates.reportConfigPathTemplate.match(reportConfigName).project; + } + + /** + * Parse the location from ReportConfig resource. + * + * @param {string} reportConfigName + * A fully-qualified path representing ReportConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromReportConfigName(reportConfigName: string) { + return this.pathTemplates.reportConfigPathTemplate.match(reportConfigName).location; + } + + /** + * Parse the report_config from ReportConfig resource. + * + * @param {string} reportConfigName + * A fully-qualified path representing ReportConfig resource. + * @returns {string} A string representing the report_config. + */ + matchReportConfigFromReportConfigName(reportConfigName: string) { + return this.pathTemplates.reportConfigPathTemplate.match(reportConfigName).report_config; + } + + /** + * Return a fully-qualified settings resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + settingsPath(project:string,location:string) { + return this.pathTemplates.settingsPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Settings resource. + * + * @param {string} settingsName + * A fully-qualified path representing Settings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSettingsName(settingsName: string) { + return this.pathTemplates.settingsPathTemplate.match(settingsName).project; + } + + /** + * Parse the location from Settings resource. + * + * @param {string} settingsName + * A fully-qualified path representing Settings resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSettingsName(settingsName: string) { + return this.pathTemplates.settingsPathTemplate.match(settingsName).location; + } + + /** + * Return a fully-qualified source resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} source + * @returns {string} Resource name string. + */ + sourcePath(project:string,location:string,source:string) { + return this.pathTemplates.sourcePathTemplate.render({ + project: project, + location: location, + source: source, + }); + } + + /** + * Parse the project from Source resource. + * + * @param {string} sourceName + * A fully-qualified path representing Source resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSourceName(sourceName: string) { + return this.pathTemplates.sourcePathTemplate.match(sourceName).project; + } + + /** + * Parse the location from Source resource. + * + * @param {string} sourceName + * A fully-qualified path representing Source resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSourceName(sourceName: string) { + return this.pathTemplates.sourcePathTemplate.match(sourceName).location; + } + + /** + * Parse the source from Source resource. + * + * @param {string} sourceName + * A fully-qualified path representing Source resource. + * @returns {string} A string representing the source. + */ + matchSourceFromSourceName(sourceName: string) { + return this.pathTemplates.sourcePathTemplate.match(sourceName).source; + } + + /** + * 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.migrationCenterStub && !this._terminated) { + return this.migrationCenterStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_client_config.json b/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_client_config.json new file mode 100644 index 00000000000..bfe0532b5d2 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_client_config.json @@ -0,0 +1,266 @@ +{ + "interfaces": { + "google.cloud.migrationcenter.v1.MigrationCenter": { + "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": { + "ListAssets": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAsset": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateAsset": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchUpdateAssets": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteAsset": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchDeleteAssets": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ReportAssetFrames": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AggregateAssetsValues": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateImportJob": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListImportJobs": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetImportJob": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteImportJob": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateImportJob": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ValidateImportJob": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RunImportJob": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetImportDataFile": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListImportDataFiles": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateImportDataFile": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteImportDataFile": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListGroups": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetGroup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateGroup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateGroup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteGroup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AddAssetsToGroup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RemoveAssetsFromGroup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListErrorFrames": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetErrorFrame": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListSources": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetSource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateSource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteSource": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListPreferenceSets": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetPreferenceSet": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreatePreferenceSet": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdatePreferenceSet": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeletePreferenceSet": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetSettings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSettings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateReportConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetReportConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListReportConfigs": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteReportConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateReport": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetReport": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListReports": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteReport": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_proto_list.json b/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_proto_list.json new file mode 100644 index 00000000000..fe313474b10 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/migrationcenter/v1/migrationcenter.proto" +] diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-migrationcenter/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..ccaaf8f06d7 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/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 migrationcenter = require('@google-cloud/migrationcenter'); + +function main() { + const migrationCenterClient = new migrationcenter.MigrationCenterClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-migrationcenter/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..eddee14f908 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/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 {MigrationCenterClient} from '@google-cloud/migrationcenter'; + +// check that the client class type name can be used +function doStuffWithMigrationCenterClient(client: MigrationCenterClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const migrationCenterClient = new MigrationCenterClient(); + doStuffWithMigrationCenterClient(migrationCenterClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/system-test/install.ts b/owl-bot-staging/google-cloud-migrationcenter/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/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-migrationcenter/v1/test/gapic_migration_center_v1.ts b/owl-bot-staging/google-cloud-migrationcenter/v1/test/gapic_migration_center_v1.ts new file mode 100644 index 00000000000..ed30550ccb4 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/v1/test/gapic_migration_center_v1.ts @@ -0,0 +1,8680 @@ +// 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 migrationcenterModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.MigrationCenterClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = migrationcenterModule.v1.MigrationCenterClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = migrationcenterModule.v1.MigrationCenterClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = migrationcenterModule.v1.MigrationCenterClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new migrationcenterModule.v1.MigrationCenterClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.migrationCenterStub, undefined); + await client.initialize(); + assert(client.migrationCenterStub); + }); + + it('has close method for the initialized client', done => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.migrationCenterStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.migrationCenterStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new migrationcenterModule.v1.MigrationCenterClient({ + 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 migrationcenterModule.v1.MigrationCenterClient({ + 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('getAsset', () => { + it('invokes getAsset without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetAssetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetAssetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.Asset() + ); + client.innerApiCalls.getAsset = stubSimpleCall(expectedResponse); + const [response] = await client.getAsset(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAsset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAsset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAsset without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetAssetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetAssetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.Asset() + ); + client.innerApiCalls.getAsset = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAsset( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IAsset|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAsset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAsset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAsset with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetAssetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetAssetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAsset = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAsset(request), expectedError); + const actualRequest = (client.innerApiCalls.getAsset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAsset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAsset with closed client', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetAssetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetAssetRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAsset(request), expectedError); + }); + }); + + describe('updateAsset', () => { + it('invokes updateAsset without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateAssetRequest() + ); + request.asset ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateAssetRequest', ['asset', 'name']); + request.asset.name = defaultValue1; + const expectedHeaderRequestParams = `asset.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.Asset() + ); + client.innerApiCalls.updateAsset = stubSimpleCall(expectedResponse); + const [response] = await client.updateAsset(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAsset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAsset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAsset without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateAssetRequest() + ); + request.asset ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateAssetRequest', ['asset', 'name']); + request.asset.name = defaultValue1; + const expectedHeaderRequestParams = `asset.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.Asset() + ); + client.innerApiCalls.updateAsset = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAsset( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IAsset|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAsset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAsset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAsset with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateAssetRequest() + ); + request.asset ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateAssetRequest', ['asset', 'name']); + request.asset.name = defaultValue1; + const expectedHeaderRequestParams = `asset.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAsset = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateAsset(request), expectedError); + const actualRequest = (client.innerApiCalls.updateAsset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAsset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAsset with closed client', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateAssetRequest() + ); + request.asset ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateAssetRequest', ['asset', 'name']); + request.asset.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateAsset(request), expectedError); + }); + }); + + describe('batchUpdateAssets', () => { + it('invokes batchUpdateAssets without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.BatchUpdateAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.BatchUpdateAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.BatchUpdateAssetsResponse() + ); + client.innerApiCalls.batchUpdateAssets = stubSimpleCall(expectedResponse); + const [response] = await client.batchUpdateAssets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchUpdateAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateAssets without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.BatchUpdateAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.BatchUpdateAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.BatchUpdateAssetsResponse() + ); + client.innerApiCalls.batchUpdateAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchUpdateAssets( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchUpdateAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateAssets with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.BatchUpdateAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.BatchUpdateAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.batchUpdateAssets(request), expectedError); + const actualRequest = (client.innerApiCalls.batchUpdateAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateAssets with closed client', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.BatchUpdateAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.BatchUpdateAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.batchUpdateAssets(request), expectedError); + }); + }); + + describe('deleteAsset', () => { + it('invokes deleteAsset without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteAssetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteAssetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAsset = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAsset(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAsset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAsset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAsset without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteAssetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteAssetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAsset = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAsset( + 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.deleteAsset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAsset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAsset with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteAssetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteAssetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAsset = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAsset(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteAsset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAsset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAsset with closed client', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteAssetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteAssetRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteAsset(request), expectedError); + }); + }); + + describe('batchDeleteAssets', () => { + it('invokes batchDeleteAssets without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.BatchDeleteAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.BatchDeleteAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.batchDeleteAssets = stubSimpleCall(expectedResponse); + const [response] = await client.batchDeleteAssets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchDeleteAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteAssets without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.BatchDeleteAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.BatchDeleteAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.batchDeleteAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchDeleteAssets( + 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.batchDeleteAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteAssets with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.BatchDeleteAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.BatchDeleteAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.batchDeleteAssets(request), expectedError); + const actualRequest = (client.innerApiCalls.batchDeleteAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteAssets with closed client', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.BatchDeleteAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.BatchDeleteAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.batchDeleteAssets(request), expectedError); + }); + }); + + describe('reportAssetFrames', () => { + it('invokes reportAssetFrames without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ReportAssetFramesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ReportAssetFramesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ReportAssetFramesResponse() + ); + client.innerApiCalls.reportAssetFrames = stubSimpleCall(expectedResponse); + const [response] = await client.reportAssetFrames(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.reportAssetFrames as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reportAssetFrames as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reportAssetFrames without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ReportAssetFramesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ReportAssetFramesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ReportAssetFramesResponse() + ); + client.innerApiCalls.reportAssetFrames = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reportAssetFrames( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IReportAssetFramesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.reportAssetFrames as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reportAssetFrames as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reportAssetFrames with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ReportAssetFramesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ReportAssetFramesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reportAssetFrames = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.reportAssetFrames(request), expectedError); + const actualRequest = (client.innerApiCalls.reportAssetFrames as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reportAssetFrames as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reportAssetFrames with closed client', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ReportAssetFramesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ReportAssetFramesRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.reportAssetFrames(request), expectedError); + }); + }); + + describe('aggregateAssetsValues', () => { + it('invokes aggregateAssetsValues without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.AggregateAssetsValuesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.AggregateAssetsValuesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.AggregateAssetsValuesResponse() + ); + client.innerApiCalls.aggregateAssetsValues = stubSimpleCall(expectedResponse); + const [response] = await client.aggregateAssetsValues(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.aggregateAssetsValues as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.aggregateAssetsValues as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes aggregateAssetsValues without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.AggregateAssetsValuesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.AggregateAssetsValuesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.AggregateAssetsValuesResponse() + ); + client.innerApiCalls.aggregateAssetsValues = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.aggregateAssetsValues( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.aggregateAssetsValues as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.aggregateAssetsValues as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes aggregateAssetsValues with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.AggregateAssetsValuesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.AggregateAssetsValuesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.aggregateAssetsValues = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.aggregateAssetsValues(request), expectedError); + const actualRequest = (client.innerApiCalls.aggregateAssetsValues as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.aggregateAssetsValues as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes aggregateAssetsValues with closed client', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.AggregateAssetsValuesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.AggregateAssetsValuesRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.aggregateAssetsValues(request), expectedError); + }); + }); + + describe('getImportJob', () => { + it('invokes getImportJob without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ImportJob() + ); + client.innerApiCalls.getImportJob = stubSimpleCall(expectedResponse); + const [response] = await client.getImportJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getImportJob without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ImportJob() + ); + client.innerApiCalls.getImportJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getImportJob( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IImportJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getImportJob with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getImportJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getImportJob(request), expectedError); + const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getImportJob with closed client', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getImportJob(request), expectedError); + }); + }); + + describe('getImportDataFile', () => { + it('invokes getImportDataFile without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetImportDataFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetImportDataFileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ImportDataFile() + ); + client.innerApiCalls.getImportDataFile = stubSimpleCall(expectedResponse); + const [response] = await client.getImportDataFile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getImportDataFile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getImportDataFile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getImportDataFile without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetImportDataFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetImportDataFileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ImportDataFile() + ); + client.innerApiCalls.getImportDataFile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getImportDataFile( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IImportDataFile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getImportDataFile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getImportDataFile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getImportDataFile with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetImportDataFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetImportDataFileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getImportDataFile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getImportDataFile(request), expectedError); + const actualRequest = (client.innerApiCalls.getImportDataFile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getImportDataFile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getImportDataFile with closed client', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetImportDataFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetImportDataFileRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getImportDataFile(request), expectedError); + }); + }); + + describe('getGroup', () => { + it('invokes getGroup without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.Group() + ); + client.innerApiCalls.getGroup = stubSimpleCall(expectedResponse); + const [response] = await client.getGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGroup without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.Group() + ); + client.innerApiCalls.getGroup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGroup( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IGroup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGroup with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getGroup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getGroup(request), expectedError); + const actualRequest = (client.innerApiCalls.getGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGroup with closed client', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetGroupRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getGroup(request), expectedError); + }); + }); + + describe('getErrorFrame', () => { + it('invokes getErrorFrame without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetErrorFrameRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetErrorFrameRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ErrorFrame() + ); + client.innerApiCalls.getErrorFrame = stubSimpleCall(expectedResponse); + const [response] = await client.getErrorFrame(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getErrorFrame as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getErrorFrame as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getErrorFrame without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetErrorFrameRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetErrorFrameRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ErrorFrame() + ); + client.innerApiCalls.getErrorFrame = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getErrorFrame( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IErrorFrame|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getErrorFrame as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getErrorFrame as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getErrorFrame with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetErrorFrameRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetErrorFrameRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getErrorFrame = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getErrorFrame(request), expectedError); + const actualRequest = (client.innerApiCalls.getErrorFrame as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getErrorFrame as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getErrorFrame with closed client', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetErrorFrameRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetErrorFrameRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getErrorFrame(request), expectedError); + }); + }); + + describe('getSource', () => { + it('invokes getSource without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetSourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.Source() + ); + client.innerApiCalls.getSource = stubSimpleCall(expectedResponse); + const [response] = await client.getSource(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSource without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetSourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.Source() + ); + client.innerApiCalls.getSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSource( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSource with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetSourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSource(request), expectedError); + const actualRequest = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSource with closed client', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetSourceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSource(request), expectedError); + }); + }); + + describe('getPreferenceSet', () => { + it('invokes getPreferenceSet without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetPreferenceSetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetPreferenceSetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.PreferenceSet() + ); + client.innerApiCalls.getPreferenceSet = stubSimpleCall(expectedResponse); + const [response] = await client.getPreferenceSet(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPreferenceSet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPreferenceSet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPreferenceSet without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetPreferenceSetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetPreferenceSetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.PreferenceSet() + ); + client.innerApiCalls.getPreferenceSet = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getPreferenceSet( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IPreferenceSet|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPreferenceSet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPreferenceSet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPreferenceSet with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetPreferenceSetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetPreferenceSetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getPreferenceSet = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getPreferenceSet(request), expectedError); + const actualRequest = (client.innerApiCalls.getPreferenceSet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPreferenceSet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPreferenceSet with closed client', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetPreferenceSetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetPreferenceSetRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getPreferenceSet(request), expectedError); + }); + }); + + describe('getSettings', () => { + it('invokes getSettings without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.Settings() + ); + client.innerApiCalls.getSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSettings without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.Settings() + ); + client.innerApiCalls.getSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSettings( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.ISettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSettings with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSettings with closed client', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSettings(request), expectedError); + }); + }); + + describe('getReportConfig', () => { + it('invokes getReportConfig without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetReportConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetReportConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ReportConfig() + ); + client.innerApiCalls.getReportConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getReportConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getReportConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getReportConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getReportConfig without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetReportConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetReportConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ReportConfig() + ); + client.innerApiCalls.getReportConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getReportConfig( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IReportConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getReportConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getReportConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getReportConfig with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetReportConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetReportConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getReportConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getReportConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.getReportConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getReportConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getReportConfig with closed client', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetReportConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetReportConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getReportConfig(request), expectedError); + }); + }); + + describe('getReport', () => { + it('invokes getReport without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetReportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetReportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.Report() + ); + client.innerApiCalls.getReport = stubSimpleCall(expectedResponse); + const [response] = await client.getReport(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getReport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getReport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getReport without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetReportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetReportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.Report() + ); + client.innerApiCalls.getReport = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getReport( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IReport|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getReport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getReport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getReport with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetReportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetReportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getReport = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getReport(request), expectedError); + const actualRequest = (client.innerApiCalls.getReport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getReport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getReport with closed client', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.GetReportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetReportRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getReport(request), expectedError); + }); + }); + + describe('createImportJob', () => { + it('invokes createImportJob without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateImportJobRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createImportJob = stubLongRunningCall(expectedResponse); + const [operation] = await client.createImportJob(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createImportJob without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateImportJobRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createImportJob = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createImportJob( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createImportJob with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateImportJobRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createImportJob = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createImportJob(request), expectedError); + const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createImportJob with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateImportJobRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createImportJob = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createImportJob(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateImportJobProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateImportJobProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateImportJobProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateImportJobProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteImportJob', () => { + it('invokes deleteImportJob without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteImportJob = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteImportJob(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteImportJob without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteImportJob = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteImportJob( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteImportJob with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteImportJob = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteImportJob(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteImportJob with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteImportJob = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteImportJob(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteImportJobProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteImportJobProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteImportJobProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteImportJobProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateImportJob', () => { + it('invokes updateImportJob without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateImportJobRequest() + ); + request.importJob ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateImportJobRequest', ['importJob', 'name']); + request.importJob.name = defaultValue1; + const expectedHeaderRequestParams = `import_job.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateImportJob = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateImportJob(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateImportJob without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateImportJobRequest() + ); + request.importJob ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateImportJobRequest', ['importJob', 'name']); + request.importJob.name = defaultValue1; + const expectedHeaderRequestParams = `import_job.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateImportJob = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateImportJob( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateImportJob with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateImportJobRequest() + ); + request.importJob ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateImportJobRequest', ['importJob', 'name']); + request.importJob.name = defaultValue1; + const expectedHeaderRequestParams = `import_job.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateImportJob = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateImportJob(request), expectedError); + const actualRequest = (client.innerApiCalls.updateImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateImportJob with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateImportJobRequest() + ); + request.importJob ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateImportJobRequest', ['importJob', 'name']); + request.importJob.name = defaultValue1; + const expectedHeaderRequestParams = `import_job.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateImportJob = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateImportJob(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateImportJobProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateImportJobProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateImportJobProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateImportJobProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('validateImportJob', () => { + it('invokes validateImportJob without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ValidateImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ValidateImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.validateImportJob = stubLongRunningCall(expectedResponse); + const [operation] = await client.validateImportJob(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.validateImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.validateImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes validateImportJob without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ValidateImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ValidateImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.validateImportJob = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.validateImportJob( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.validateImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.validateImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes validateImportJob with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ValidateImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ValidateImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.validateImportJob = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.validateImportJob(request), expectedError); + const actualRequest = (client.innerApiCalls.validateImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.validateImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes validateImportJob with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ValidateImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ValidateImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.validateImportJob = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.validateImportJob(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.validateImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.validateImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkValidateImportJobProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkValidateImportJobProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkValidateImportJobProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkValidateImportJobProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('runImportJob', () => { + it('invokes runImportJob without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.RunImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.RunImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.runImportJob = stubLongRunningCall(expectedResponse); + const [operation] = await client.runImportJob(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.runImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runImportJob without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.RunImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.RunImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.runImportJob = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.runImportJob( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.runImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runImportJob with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.RunImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.RunImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runImportJob = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.runImportJob(request), expectedError); + const actualRequest = (client.innerApiCalls.runImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runImportJob with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.RunImportJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.RunImportJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runImportJob = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.runImportJob(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.runImportJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runImportJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRunImportJobProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRunImportJobProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRunImportJobProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRunImportJobProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createImportDataFile', () => { + it('invokes createImportDataFile without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateImportDataFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateImportDataFileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createImportDataFile = stubLongRunningCall(expectedResponse); + const [operation] = await client.createImportDataFile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createImportDataFile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createImportDataFile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createImportDataFile without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateImportDataFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateImportDataFileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createImportDataFile = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createImportDataFile( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createImportDataFile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createImportDataFile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createImportDataFile with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateImportDataFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateImportDataFileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createImportDataFile = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createImportDataFile(request), expectedError); + const actualRequest = (client.innerApiCalls.createImportDataFile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createImportDataFile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createImportDataFile with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateImportDataFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateImportDataFileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createImportDataFile = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createImportDataFile(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createImportDataFile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createImportDataFile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateImportDataFileProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateImportDataFileProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateImportDataFileProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateImportDataFileProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteImportDataFile', () => { + it('invokes deleteImportDataFile without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteImportDataFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteImportDataFileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteImportDataFile = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteImportDataFile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteImportDataFile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteImportDataFile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteImportDataFile without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteImportDataFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteImportDataFileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteImportDataFile = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteImportDataFile( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteImportDataFile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteImportDataFile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteImportDataFile with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteImportDataFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteImportDataFileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteImportDataFile = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteImportDataFile(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteImportDataFile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteImportDataFile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteImportDataFile with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteImportDataFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteImportDataFileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteImportDataFile = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteImportDataFile(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteImportDataFile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteImportDataFile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteImportDataFileProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteImportDataFileProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteImportDataFileProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteImportDataFileProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createGroup', () => { + it('invokes createGroup without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateGroupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createGroup = stubLongRunningCall(expectedResponse); + const [operation] = await client.createGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createGroup without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateGroupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createGroup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createGroup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createGroup with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateGroupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGroup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createGroup(request), expectedError); + const actualRequest = (client.innerApiCalls.createGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createGroup with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateGroupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGroup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateGroupProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateGroupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateGroupProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateGroupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateGroup', () => { + it('invokes updateGroup without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateGroupRequest() + ); + request.group ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateGroupRequest', ['group', 'name']); + request.group.name = defaultValue1; + const expectedHeaderRequestParams = `group.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateGroup = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateGroup without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateGroupRequest() + ); + request.group ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateGroupRequest', ['group', 'name']); + request.group.name = defaultValue1; + const expectedHeaderRequestParams = `group.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateGroup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateGroup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateGroup with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateGroupRequest() + ); + request.group ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateGroupRequest', ['group', 'name']); + request.group.name = defaultValue1; + const expectedHeaderRequestParams = `group.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateGroup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateGroup(request), expectedError); + const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateGroup with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateGroupRequest() + ); + request.group ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateGroupRequest', ['group', 'name']); + request.group.name = defaultValue1; + const expectedHeaderRequestParams = `group.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateGroup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateGroupProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateGroupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateGroupProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateGroupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteGroup', () => { + it('invokes deleteGroup without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteGroup = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteGroup without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteGroup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteGroup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteGroup with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGroup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteGroup(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteGroup with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGroup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteGroupProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteGroupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteGroupProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteGroupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('addAssetsToGroup', () => { + it('invokes addAssetsToGroup without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.AddAssetsToGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.AddAssetsToGroupRequest', ['group']); + request.group = defaultValue1; + const expectedHeaderRequestParams = `group=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.addAssetsToGroup = stubLongRunningCall(expectedResponse); + const [operation] = await client.addAssetsToGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.addAssetsToGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.addAssetsToGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addAssetsToGroup without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.AddAssetsToGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.AddAssetsToGroupRequest', ['group']); + request.group = defaultValue1; + const expectedHeaderRequestParams = `group=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.addAssetsToGroup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addAssetsToGroup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.addAssetsToGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.addAssetsToGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addAssetsToGroup with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.AddAssetsToGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.AddAssetsToGroupRequest', ['group']); + request.group = defaultValue1; + const expectedHeaderRequestParams = `group=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addAssetsToGroup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.addAssetsToGroup(request), expectedError); + const actualRequest = (client.innerApiCalls.addAssetsToGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.addAssetsToGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addAssetsToGroup with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.AddAssetsToGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.AddAssetsToGroupRequest', ['group']); + request.group = defaultValue1; + const expectedHeaderRequestParams = `group=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addAssetsToGroup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.addAssetsToGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.addAssetsToGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.addAssetsToGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkAddAssetsToGroupProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkAddAssetsToGroupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkAddAssetsToGroupProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkAddAssetsToGroupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('removeAssetsFromGroup', () => { + it('invokes removeAssetsFromGroup without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.RemoveAssetsFromGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.RemoveAssetsFromGroupRequest', ['group']); + request.group = defaultValue1; + const expectedHeaderRequestParams = `group=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.removeAssetsFromGroup = stubLongRunningCall(expectedResponse); + const [operation] = await client.removeAssetsFromGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.removeAssetsFromGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.removeAssetsFromGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes removeAssetsFromGroup without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.RemoveAssetsFromGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.RemoveAssetsFromGroupRequest', ['group']); + request.group = defaultValue1; + const expectedHeaderRequestParams = `group=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.removeAssetsFromGroup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeAssetsFromGroup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.removeAssetsFromGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.removeAssetsFromGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes removeAssetsFromGroup with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.RemoveAssetsFromGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.RemoveAssetsFromGroupRequest', ['group']); + request.group = defaultValue1; + const expectedHeaderRequestParams = `group=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.removeAssetsFromGroup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.removeAssetsFromGroup(request), expectedError); + const actualRequest = (client.innerApiCalls.removeAssetsFromGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.removeAssetsFromGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes removeAssetsFromGroup with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.RemoveAssetsFromGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.RemoveAssetsFromGroupRequest', ['group']); + request.group = defaultValue1; + const expectedHeaderRequestParams = `group=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.removeAssetsFromGroup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.removeAssetsFromGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.removeAssetsFromGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.removeAssetsFromGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRemoveAssetsFromGroupProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRemoveAssetsFromGroupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRemoveAssetsFromGroupProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRemoveAssetsFromGroupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createSource', () => { + it('invokes createSource without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateSourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createSource = stubLongRunningCall(expectedResponse); + const [operation] = await client.createSource(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSource without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateSourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createSource = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSource( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSource with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateSourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSource = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createSource(request), expectedError); + const actualRequest = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSource with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateSourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSource = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createSource(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateSourceProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateSourceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateSourceProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateSourceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateSource', () => { + it('invokes updateSource without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateSourceRequest() + ); + request.source ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateSourceRequest', ['source', 'name']); + request.source.name = defaultValue1; + const expectedHeaderRequestParams = `source.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateSource = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSource(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSource without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateSourceRequest() + ); + request.source ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateSourceRequest', ['source', 'name']); + request.source.name = defaultValue1; + const expectedHeaderRequestParams = `source.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateSource = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSource( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSource with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateSourceRequest() + ); + request.source ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateSourceRequest', ['source', 'name']); + request.source.name = defaultValue1; + const expectedHeaderRequestParams = `source.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSource = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateSource(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSource with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateSourceRequest() + ); + request.source ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateSourceRequest', ['source', 'name']); + request.source.name = defaultValue1; + const expectedHeaderRequestParams = `source.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSource = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateSource(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateSourceProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateSourceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateSourceProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateSourceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteSource', () => { + it('invokes deleteSource without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteSourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteSource = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSource(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSource without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteSourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteSource = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSource( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSource with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteSourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSource = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteSource(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSource with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteSourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSource = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteSource(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteSourceProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteSourceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteSourceProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteSourceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createPreferenceSet', () => { + it('invokes createPreferenceSet without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreatePreferenceSetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreatePreferenceSetRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createPreferenceSet = stubLongRunningCall(expectedResponse); + const [operation] = await client.createPreferenceSet(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createPreferenceSet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPreferenceSet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPreferenceSet without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreatePreferenceSetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreatePreferenceSetRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createPreferenceSet = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createPreferenceSet( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createPreferenceSet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPreferenceSet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPreferenceSet with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreatePreferenceSetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreatePreferenceSetRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPreferenceSet = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createPreferenceSet(request), expectedError); + const actualRequest = (client.innerApiCalls.createPreferenceSet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPreferenceSet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPreferenceSet with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreatePreferenceSetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreatePreferenceSetRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPreferenceSet = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createPreferenceSet(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createPreferenceSet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPreferenceSet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreatePreferenceSetProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreatePreferenceSetProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreatePreferenceSetProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreatePreferenceSetProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updatePreferenceSet', () => { + it('invokes updatePreferenceSet without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdatePreferenceSetRequest() + ); + request.preferenceSet ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdatePreferenceSetRequest', ['preferenceSet', 'name']); + request.preferenceSet.name = defaultValue1; + const expectedHeaderRequestParams = `preference_set.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updatePreferenceSet = stubLongRunningCall(expectedResponse); + const [operation] = await client.updatePreferenceSet(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updatePreferenceSet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updatePreferenceSet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updatePreferenceSet without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdatePreferenceSetRequest() + ); + request.preferenceSet ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdatePreferenceSetRequest', ['preferenceSet', 'name']); + request.preferenceSet.name = defaultValue1; + const expectedHeaderRequestParams = `preference_set.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updatePreferenceSet = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updatePreferenceSet( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updatePreferenceSet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updatePreferenceSet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updatePreferenceSet with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdatePreferenceSetRequest() + ); + request.preferenceSet ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdatePreferenceSetRequest', ['preferenceSet', 'name']); + request.preferenceSet.name = defaultValue1; + const expectedHeaderRequestParams = `preference_set.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updatePreferenceSet = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updatePreferenceSet(request), expectedError); + const actualRequest = (client.innerApiCalls.updatePreferenceSet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updatePreferenceSet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updatePreferenceSet with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdatePreferenceSetRequest() + ); + request.preferenceSet ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdatePreferenceSetRequest', ['preferenceSet', 'name']); + request.preferenceSet.name = defaultValue1; + const expectedHeaderRequestParams = `preference_set.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updatePreferenceSet = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updatePreferenceSet(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updatePreferenceSet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updatePreferenceSet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdatePreferenceSetProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdatePreferenceSetProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdatePreferenceSetProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdatePreferenceSetProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deletePreferenceSet', () => { + it('invokes deletePreferenceSet without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeletePreferenceSetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeletePreferenceSetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deletePreferenceSet = stubLongRunningCall(expectedResponse); + const [operation] = await client.deletePreferenceSet(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePreferenceSet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePreferenceSet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePreferenceSet without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeletePreferenceSetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeletePreferenceSetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deletePreferenceSet = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deletePreferenceSet( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePreferenceSet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePreferenceSet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePreferenceSet with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeletePreferenceSetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeletePreferenceSetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePreferenceSet = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deletePreferenceSet(request), expectedError); + const actualRequest = (client.innerApiCalls.deletePreferenceSet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePreferenceSet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePreferenceSet with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeletePreferenceSetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeletePreferenceSetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePreferenceSet = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deletePreferenceSet(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deletePreferenceSet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePreferenceSet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeletePreferenceSetProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeletePreferenceSetProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeletePreferenceSetProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeletePreferenceSetProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateSettings', () => { + it('invokes updateSettings without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateSettingsRequest() + ); + request.settings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateSettingsRequest', ['settings', 'name']); + request.settings.name = defaultValue1; + const expectedHeaderRequestParams = `settings.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateSettings = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSettings(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSettings without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateSettingsRequest() + ); + request.settings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateSettingsRequest', ['settings', 'name']); + request.settings.name = defaultValue1; + const expectedHeaderRequestParams = `settings.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateSettings = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSettings( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSettings with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateSettingsRequest() + ); + request.settings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateSettingsRequest', ['settings', 'name']); + request.settings.name = defaultValue1; + const expectedHeaderRequestParams = `settings.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSettings = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSettings with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.UpdateSettingsRequest() + ); + request.settings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateSettingsRequest', ['settings', 'name']); + request.settings.name = defaultValue1; + const expectedHeaderRequestParams = `settings.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSettings = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateSettings(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateSettingsProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateSettingsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateSettingsProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateSettingsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createReportConfig', () => { + it('invokes createReportConfig without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateReportConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateReportConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createReportConfig = stubLongRunningCall(expectedResponse); + const [operation] = await client.createReportConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createReportConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createReportConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createReportConfig without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateReportConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateReportConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createReportConfig = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createReportConfig( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createReportConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createReportConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createReportConfig with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateReportConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateReportConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createReportConfig = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createReportConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.createReportConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createReportConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createReportConfig with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateReportConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateReportConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createReportConfig = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createReportConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createReportConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createReportConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateReportConfigProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateReportConfigProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateReportConfigProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateReportConfigProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteReportConfig', () => { + it('invokes deleteReportConfig without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteReportConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteReportConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteReportConfig = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteReportConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteReportConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteReportConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteReportConfig without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteReportConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteReportConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteReportConfig = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteReportConfig( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteReportConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteReportConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteReportConfig with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteReportConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteReportConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteReportConfig = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteReportConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteReportConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteReportConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteReportConfig with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteReportConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteReportConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteReportConfig = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteReportConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteReportConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteReportConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteReportConfigProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteReportConfigProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteReportConfigProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteReportConfigProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createReport', () => { + it('invokes createReport without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateReportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateReportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createReport = stubLongRunningCall(expectedResponse); + const [operation] = await client.createReport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createReport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createReport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createReport without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateReportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateReportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createReport = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createReport( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createReport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createReport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createReport with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateReportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateReportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createReport = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createReport(request), expectedError); + const actualRequest = (client.innerApiCalls.createReport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createReport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createReport with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.CreateReportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateReportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createReport = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createReport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createReport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createReport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateReportProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateReportProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateReportProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateReportProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteReport', () => { + it('invokes deleteReport without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteReportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteReportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteReport = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteReport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteReport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteReport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteReport without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteReportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteReportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteReport = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteReport( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteReport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteReport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteReport with call error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteReportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteReportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteReport = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteReport(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteReport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteReport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteReport with LRO error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.DeleteReportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteReportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteReport = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteReport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteReport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteReport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteReportProgress without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteReportProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteReportProgress with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteReportProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listAssets', () => { + it('invokes listAssets without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), + ]; + client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); + const [response] = await client.listAssets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssets without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), + ]; + client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAssets( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IAsset[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssets with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAssets(request), expectedError); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssetsStream without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), + ]; + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.Asset[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.Asset) => { + 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.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAssetsStream with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.Asset[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.Asset) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAssets without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), + ]; + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.migrationcenter.v1.IAsset[] = []; + const iterable = client.listAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAssets with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.migrationcenter.v1.IAsset[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listImportJobs', () => { + it('invokes listImportJobs without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListImportJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), + ]; + client.innerApiCalls.listImportJobs = stubSimpleCall(expectedResponse); + const [response] = await client.listImportJobs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listImportJobs without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListImportJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), + ]; + client.innerApiCalls.listImportJobs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listImportJobs( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IImportJob[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listImportJobs with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListImportJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listImportJobs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listImportJobs(request), expectedError); + const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listImportJobsStream without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListImportJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), + ]; + client.descriptors.page.listImportJobs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listImportJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.ImportJob[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.ImportJob) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listImportJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listImportJobs, request)); + assert( + (client.descriptors.page.listImportJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listImportJobsStream with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListImportJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listImportJobs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listImportJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.ImportJob[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.ImportJob) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listImportJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listImportJobs, request)); + assert( + (client.descriptors.page.listImportJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listImportJobs without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListImportJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), + ]; + client.descriptors.page.listImportJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.migrationcenter.v1.IImportJob[] = []; + const iterable = client.listImportJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listImportJobs with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListImportJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listImportJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listImportJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.migrationcenter.v1.IImportJob[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listImportDataFiles', () => { + it('invokes listImportDataFiles without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListImportDataFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportDataFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), + ]; + client.innerApiCalls.listImportDataFiles = stubSimpleCall(expectedResponse); + const [response] = await client.listImportDataFiles(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listImportDataFiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listImportDataFiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listImportDataFiles without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListImportDataFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportDataFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), + ]; + client.innerApiCalls.listImportDataFiles = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listImportDataFiles( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IImportDataFile[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listImportDataFiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listImportDataFiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listImportDataFiles with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListImportDataFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportDataFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listImportDataFiles = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listImportDataFiles(request), expectedError); + const actualRequest = (client.innerApiCalls.listImportDataFiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listImportDataFiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listImportDataFilesStream without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListImportDataFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportDataFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), + ]; + client.descriptors.page.listImportDataFiles.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listImportDataFilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.ImportDataFile[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.ImportDataFile) => { + 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.listImportDataFiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listImportDataFiles, request)); + assert( + (client.descriptors.page.listImportDataFiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listImportDataFilesStream with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListImportDataFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportDataFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listImportDataFiles.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listImportDataFilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.ImportDataFile[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.ImportDataFile) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listImportDataFiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listImportDataFiles, request)); + assert( + (client.descriptors.page.listImportDataFiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listImportDataFiles without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListImportDataFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportDataFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), + ]; + client.descriptors.page.listImportDataFiles.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.migrationcenter.v1.IImportDataFile[] = []; + const iterable = client.listImportDataFilesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listImportDataFiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listImportDataFiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listImportDataFiles with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListImportDataFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportDataFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listImportDataFiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listImportDataFilesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.migrationcenter.v1.IImportDataFile[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listImportDataFiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listImportDataFiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listGroups', () => { + it('invokes listGroups without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListGroupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListGroupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), + ]; + client.innerApiCalls.listGroups = stubSimpleCall(expectedResponse); + const [response] = await client.listGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listGroups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listGroups without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListGroupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListGroupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), + ]; + client.innerApiCalls.listGroups = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listGroups( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IGroup[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listGroups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listGroups with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListGroupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListGroupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listGroups = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listGroups(request), expectedError); + const actualRequest = (client.innerApiCalls.listGroups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listGroupsStream without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListGroupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListGroupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), + ]; + client.descriptors.page.listGroups.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.Group[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.Group) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listGroups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listGroups, request)); + assert( + (client.descriptors.page.listGroups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listGroupsStream with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListGroupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListGroupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGroups.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.Group[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.Group) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listGroups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listGroups, request)); + assert( + (client.descriptors.page.listGroups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listGroups without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListGroupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListGroupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), + ]; + client.descriptors.page.listGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.migrationcenter.v1.IGroup[] = []; + const iterable = client.listGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listGroups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listGroups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listGroups with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListGroupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListGroupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.migrationcenter.v1.IGroup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listGroups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listGroups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listErrorFrames', () => { + it('invokes listErrorFrames without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListErrorFramesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListErrorFramesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), + ]; + client.innerApiCalls.listErrorFrames = stubSimpleCall(expectedResponse); + const [response] = await client.listErrorFrames(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listErrorFrames as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listErrorFrames as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listErrorFrames without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListErrorFramesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListErrorFramesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), + ]; + client.innerApiCalls.listErrorFrames = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listErrorFrames( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IErrorFrame[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listErrorFrames as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listErrorFrames as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listErrorFrames with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListErrorFramesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListErrorFramesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listErrorFrames = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listErrorFrames(request), expectedError); + const actualRequest = (client.innerApiCalls.listErrorFrames as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listErrorFrames as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listErrorFramesStream without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListErrorFramesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListErrorFramesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), + ]; + client.descriptors.page.listErrorFrames.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listErrorFramesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.ErrorFrame[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.ErrorFrame) => { + 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.listErrorFrames.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listErrorFrames, request)); + assert( + (client.descriptors.page.listErrorFrames.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listErrorFramesStream with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListErrorFramesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListErrorFramesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listErrorFrames.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listErrorFramesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.ErrorFrame[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.ErrorFrame) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listErrorFrames.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listErrorFrames, request)); + assert( + (client.descriptors.page.listErrorFrames.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listErrorFrames without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListErrorFramesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListErrorFramesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), + ]; + client.descriptors.page.listErrorFrames.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.migrationcenter.v1.IErrorFrame[] = []; + const iterable = client.listErrorFramesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listErrorFrames.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listErrorFrames.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listErrorFrames with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListErrorFramesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListErrorFramesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listErrorFrames.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listErrorFramesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.migrationcenter.v1.IErrorFrame[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listErrorFrames.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listErrorFrames.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listSources', () => { + it('invokes listSources without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), + ]; + client.innerApiCalls.listSources = stubSimpleCall(expectedResponse); + const [response] = await client.listSources(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSources without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), + ]; + client.innerApiCalls.listSources = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSources( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.ISource[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSources with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSources = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSources(request), expectedError); + const actualRequest = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSourcesStream without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), + ]; + client.descriptors.page.listSources.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.Source[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.Source) => { + 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.listSources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSources, request)); + assert( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listSourcesStream with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSources.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.Source[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.Source) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSources, request)); + assert( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSources without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), + ]; + client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.migrationcenter.v1.ISource[] = []; + const iterable = client.listSourcesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSources with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSourcesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.migrationcenter.v1.ISource[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listPreferenceSets', () => { + it('invokes listPreferenceSets without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), + ]; + client.innerApiCalls.listPreferenceSets = stubSimpleCall(expectedResponse); + const [response] = await client.listPreferenceSets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPreferenceSets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPreferenceSets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPreferenceSets without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), + ]; + client.innerApiCalls.listPreferenceSets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPreferenceSets( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IPreferenceSet[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPreferenceSets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPreferenceSets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPreferenceSets with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPreferenceSets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listPreferenceSets(request), expectedError); + const actualRequest = (client.innerApiCalls.listPreferenceSets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPreferenceSets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPreferenceSetsStream without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), + ]; + client.descriptors.page.listPreferenceSets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listPreferenceSetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.PreferenceSet[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.PreferenceSet) => { + 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.listPreferenceSets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPreferenceSets, request)); + assert( + (client.descriptors.page.listPreferenceSets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listPreferenceSetsStream with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPreferenceSets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listPreferenceSetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.PreferenceSet[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.PreferenceSet) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listPreferenceSets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPreferenceSets, request)); + assert( + (client.descriptors.page.listPreferenceSets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPreferenceSets without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), + ]; + client.descriptors.page.listPreferenceSets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.migrationcenter.v1.IPreferenceSet[] = []; + const iterable = client.listPreferenceSetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listPreferenceSets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPreferenceSets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPreferenceSets with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPreferenceSets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPreferenceSetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.migrationcenter.v1.IPreferenceSet[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listPreferenceSets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPreferenceSets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listReportConfigs', () => { + it('invokes listReportConfigs without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListReportConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), + ]; + client.innerApiCalls.listReportConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listReportConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listReportConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listReportConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listReportConfigs without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListReportConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), + ]; + client.innerApiCalls.listReportConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listReportConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IReportConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listReportConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listReportConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listReportConfigs with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListReportConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listReportConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listReportConfigs(request), expectedError); + const actualRequest = (client.innerApiCalls.listReportConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listReportConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listReportConfigsStream without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListReportConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), + ]; + client.descriptors.page.listReportConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listReportConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.ReportConfig[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.ReportConfig) => { + 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.listReportConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listReportConfigs, request)); + assert( + (client.descriptors.page.listReportConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listReportConfigsStream with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListReportConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listReportConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listReportConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.ReportConfig[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.ReportConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listReportConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listReportConfigs, request)); + assert( + (client.descriptors.page.listReportConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listReportConfigs without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListReportConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), + ]; + client.descriptors.page.listReportConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.migrationcenter.v1.IReportConfig[] = []; + const iterable = client.listReportConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listReportConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listReportConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listReportConfigs with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListReportConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listReportConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listReportConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.migrationcenter.v1.IReportConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listReportConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listReportConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listReports', () => { + it('invokes listReports without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListReportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), + ]; + client.innerApiCalls.listReports = stubSimpleCall(expectedResponse); + const [response] = await client.listReports(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listReports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listReports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listReports without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListReportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), + ]; + client.innerApiCalls.listReports = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listReports( + request, + (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IReport[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listReports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listReports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listReports with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListReportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listReports = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listReports(request), expectedError); + const actualRequest = (client.innerApiCalls.listReports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listReports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listReportsStream without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListReportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), + ]; + client.descriptors.page.listReports.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listReportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.Report[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.Report) => { + 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.listReports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listReports, request)); + assert( + (client.descriptors.page.listReports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listReportsStream with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListReportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listReports.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listReportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.migrationcenter.v1.Report[] = []; + stream.on('data', (response: protos.google.cloud.migrationcenter.v1.Report) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listReports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listReports, request)); + assert( + (client.descriptors.page.listReports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listReports without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListReportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), + generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), + ]; + client.descriptors.page.listReports.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.migrationcenter.v1.IReport[] = []; + const iterable = client.listReportsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listReports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listReports.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listReports with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.migrationcenter.v1.ListReportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listReports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listReportsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.migrationcenter.v1.IReport[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listReports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listReports.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('asset', () => { + const fakePath = "/rendered/path/asset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + asset: "assetValue", + }; + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.assetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.assetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('assetPath', () => { + const result = client.assetPath("projectValue", "locationValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.assetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAssetName', () => { + const result = client.matchProjectFromAssetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAssetName', () => { + const result = client.matchLocationFromAssetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromAssetName', () => { + const result = client.matchAssetFromAssetName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('errorFrame', () => { + const fakePath = "/rendered/path/errorFrame"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + source: "sourceValue", + error_frame: "errorFrameValue", + }; + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.errorFramePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.errorFramePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('errorFramePath', () => { + const result = client.errorFramePath("projectValue", "locationValue", "sourceValue", "errorFrameValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.errorFramePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromErrorFrameName', () => { + const result = client.matchProjectFromErrorFrameName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.errorFramePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromErrorFrameName', () => { + const result = client.matchLocationFromErrorFrameName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.errorFramePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromErrorFrameName', () => { + const result = client.matchSourceFromErrorFrameName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.errorFramePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchErrorFrameFromErrorFrameName', () => { + const result = client.matchErrorFrameFromErrorFrameName(fakePath); + assert.strictEqual(result, "errorFrameValue"); + assert((client.pathTemplates.errorFramePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('group', () => { + const fakePath = "/rendered/path/group"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + group: "groupValue", + }; + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.groupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.groupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('groupPath', () => { + const result = client.groupPath("projectValue", "locationValue", "groupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.groupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromGroupName', () => { + const result = client.matchProjectFromGroupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.groupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromGroupName', () => { + const result = client.matchLocationFromGroupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.groupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchGroupFromGroupName', () => { + const result = client.matchGroupFromGroupName(fakePath); + assert.strictEqual(result, "groupValue"); + assert((client.pathTemplates.groupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('importDataFile', () => { + const fakePath = "/rendered/path/importDataFile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + import_job: "importJobValue", + import_data_file: "importDataFileValue", + }; + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.importDataFilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.importDataFilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('importDataFilePath', () => { + const result = client.importDataFilePath("projectValue", "locationValue", "importJobValue", "importDataFileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.importDataFilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromImportDataFileName', () => { + const result = client.matchProjectFromImportDataFileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.importDataFilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromImportDataFileName', () => { + const result = client.matchLocationFromImportDataFileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.importDataFilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchImportJobFromImportDataFileName', () => { + const result = client.matchImportJobFromImportDataFileName(fakePath); + assert.strictEqual(result, "importJobValue"); + assert((client.pathTemplates.importDataFilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchImportDataFileFromImportDataFileName', () => { + const result = client.matchImportDataFileFromImportDataFileName(fakePath); + assert.strictEqual(result, "importDataFileValue"); + assert((client.pathTemplates.importDataFilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('importJob', () => { + const fakePath = "/rendered/path/importJob"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + import_job: "importJobValue", + }; + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.importJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.importJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('importJobPath', () => { + const result = client.importJobPath("projectValue", "locationValue", "importJobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.importJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromImportJobName', () => { + const result = client.matchProjectFromImportJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromImportJobName', () => { + const result = client.matchLocationFromImportJobName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchImportJobFromImportJobName', () => { + const result = client.matchImportJobFromImportJobName(fakePath); + assert.strictEqual(result, "importJobValue"); + assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('preferenceSet', () => { + const fakePath = "/rendered/path/preferenceSet"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + preference_set: "preferenceSetValue", + }; + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.preferenceSetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.preferenceSetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('preferenceSetPath', () => { + const result = client.preferenceSetPath("projectValue", "locationValue", "preferenceSetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.preferenceSetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromPreferenceSetName', () => { + const result = client.matchProjectFromPreferenceSetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.preferenceSetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromPreferenceSetName', () => { + const result = client.matchLocationFromPreferenceSetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.preferenceSetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchPreferenceSetFromPreferenceSetName', () => { + const result = client.matchPreferenceSetFromPreferenceSetName(fakePath); + assert.strictEqual(result, "preferenceSetValue"); + assert((client.pathTemplates.preferenceSetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new migrationcenterModule.v1.MigrationCenterClient({ + 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('report', () => { + const fakePath = "/rendered/path/report"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + report_config: "reportConfigValue", + report: "reportValue", + }; + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.reportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.reportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('reportPath', () => { + const result = client.reportPath("projectValue", "locationValue", "reportConfigValue", "reportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.reportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromReportName', () => { + const result = client.matchProjectFromReportName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.reportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromReportName', () => { + const result = client.matchLocationFromReportName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.reportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchReportConfigFromReportName', () => { + const result = client.matchReportConfigFromReportName(fakePath); + assert.strictEqual(result, "reportConfigValue"); + assert((client.pathTemplates.reportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchReportFromReportName', () => { + const result = client.matchReportFromReportName(fakePath); + assert.strictEqual(result, "reportValue"); + assert((client.pathTemplates.reportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('reportConfig', () => { + const fakePath = "/rendered/path/reportConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + report_config: "reportConfigValue", + }; + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.reportConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.reportConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('reportConfigPath', () => { + const result = client.reportConfigPath("projectValue", "locationValue", "reportConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.reportConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromReportConfigName', () => { + const result = client.matchProjectFromReportConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.reportConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromReportConfigName', () => { + const result = client.matchLocationFromReportConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.reportConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchReportConfigFromReportConfigName', () => { + const result = client.matchReportConfigFromReportConfigName(fakePath); + assert.strictEqual(result, "reportConfigValue"); + assert((client.pathTemplates.reportConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('settings', () => { + const fakePath = "/rendered/path/settings"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.settingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.settingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('settingsPath', () => { + const result = client.settingsPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.settingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSettingsName', () => { + const result = client.matchProjectFromSettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.settingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromSettingsName', () => { + const result = client.matchLocationFromSettingsName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.settingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('source', () => { + const fakePath = "/rendered/path/source"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + source: "sourceValue", + }; + const client = new migrationcenterModule.v1.MigrationCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sourcePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sourcePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sourcePath', () => { + const result = client.sourcePath("projectValue", "locationValue", "sourceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sourcePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSourceName', () => { + const result = client.matchProjectFromSourceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.sourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromSourceName', () => { + const result = client.matchLocationFromSourceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.sourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromSourceName', () => { + const result = client.matchSourceFromSourceName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.sourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/tsconfig.json b/owl-bot-staging/google-cloud-migrationcenter/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/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-migrationcenter/v1/webpack.config.js b/owl-bot-staging/google-cloud-migrationcenter/v1/webpack.config.js new file mode 100644 index 00000000000..f1e62781a30 --- /dev/null +++ b/owl-bot-staging/google-cloud-migrationcenter/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: 'MigrationCenter', + filename: './migration-center.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-networkconnectivity/v1/.eslintignore b/owl-bot-staging/google-cloud-networkconnectivity/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/.eslintrc.json b/owl-bot-staging/google-cloud-networkconnectivity/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/.gitignore b/owl-bot-staging/google-cloud-networkconnectivity/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/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-networkconnectivity/v1/.jsdoc.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/.jsdoc.js new file mode 100644 index 00000000000..37865cfe2ea --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/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/network-connectivity', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/.mocharc.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/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-networkconnectivity/v1/.prettierrc.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/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-networkconnectivity/v1/README.md b/owl-bot-staging/google-cloud-networkconnectivity/v1/README.md new file mode 100644 index 00000000000..086026da9e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/README.md @@ -0,0 +1 @@ +Networkconnectivity: Nodejs Client diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/package.json b/owl-bot-staging/google-cloud-networkconnectivity/v1/package.json new file mode 100644 index 00000000000..3944e98cf57 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/network-connectivity", + "version": "0.1.0", + "description": "Networkconnectivity client for Node.js", + "repository": "googleapis/nodejs-networkconnectivity", + "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 networkconnectivity", + "networkconnectivity", + "hub service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/protos/google/cloud/networkconnectivity/v1/common.proto b/owl-bot-staging/google-cloud-networkconnectivity/v1/protos/google/cloud/networkconnectivity/v1/common.proto new file mode 100644 index 00000000000..89253048935 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/protos/google/cloud/networkconnectivity/v1/common.proto @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.networkconnectivity.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1"; +option go_package = "cloud.google.com/go/networkconnectivity/apiv1/networkconnectivitypb;networkconnectivitypb"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.cloud.networkconnectivity.v1"; +option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1"; +option ruby_package = "Google::Cloud::NetworkConnectivity::V1"; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/InterconnectAttachment" + pattern: "projects/{project}/regions/{region}/interconnectAttachments/{resource_id}" +}; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Network" + pattern: "projects/{project}/global/networks/{resource_id}" +}; + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have been cancelled successfully + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/protos/google/cloud/networkconnectivity/v1/hub.proto b/owl-bot-staging/google-cloud-networkconnectivity/v1/protos/google/cloud/networkconnectivity/v1/hub.proto new file mode 100644 index 00000000000..eef97978f3d --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/protos/google/cloud/networkconnectivity/v1/hub.proto @@ -0,0 +1,694 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.networkconnectivity.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1"; +option go_package = "cloud.google.com/go/networkconnectivity/apiv1/networkconnectivitypb;networkconnectivitypb"; +option java_multiple_files = true; +option java_outer_classname = "HubProto"; +option java_package = "com.google.cloud.networkconnectivity.v1"; +option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1"; +option ruby_package = "Google::Cloud::NetworkConnectivity::V1"; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/VpnTunnel" + pattern: "projects/{project}/regions/{region}/vpnTunnels/{resource_id}" +}; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Instance" + pattern: "projects/{project}/zones/{zone}/instances/{instance}" +}; + +// Network Connectivity Center is a hub-and-spoke abstraction for network +// connectivity management in Google Cloud. It reduces operational complexity +// through a simple, centralized connectivity management model. +service HubService { + option (google.api.default_host) = "networkconnectivity.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists the Network Connectivity Center hubs associated with a given project. + rpc ListHubs(ListHubsRequest) returns (ListHubsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/global}/hubs" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details about a Network Connectivity Center hub. + rpc GetHub(GetHubRequest) returns (Hub) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/global/hubs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new Network Connectivity Center hub in the specified project. + rpc CreateHub(CreateHubRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/global}/hubs" + body: "hub" + }; + option (google.api.method_signature) = "parent,hub,hub_id"; + option (google.longrunning.operation_info) = { + response_type: "Hub" + metadata_type: "OperationMetadata" + }; + } + + // Updates the description and/or labels of a Network Connectivity Center + // hub. + rpc UpdateHub(UpdateHubRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{hub.name=projects/*/locations/global/hubs/*}" + body: "hub" + }; + option (google.api.method_signature) = "hub,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Hub" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a Network Connectivity Center hub. + rpc DeleteHub(DeleteHubRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/global/hubs/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Lists the Network Connectivity Center spokes in a specified project and + // location. + rpc ListSpokes(ListSpokesRequest) returns (ListSpokesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/spokes" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details about a Network Connectivity Center spoke. + rpc GetSpoke(GetSpokeRequest) returns (Spoke) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/spokes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a Network Connectivity Center spoke. + rpc CreateSpoke(CreateSpokeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/spokes" + body: "spoke" + }; + option (google.api.method_signature) = "parent,spoke,spoke_id"; + option (google.longrunning.operation_info) = { + response_type: "Spoke" + metadata_type: "OperationMetadata" + }; + } + + // Updates the parameters of a Network Connectivity Center spoke. + rpc UpdateSpoke(UpdateSpokeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{spoke.name=projects/*/locations/*/spokes/*}" + body: "spoke" + }; + option (google.api.method_signature) = "spoke,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Spoke" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a Network Connectivity Center spoke. + rpc DeleteSpoke(DeleteSpokeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/spokes/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } +} + +// Supported features for a location +enum LocationFeature { + // No publicly supported feature in this location + LOCATION_FEATURE_UNSPECIFIED = 0; + + // Site-to-cloud spokes are supported in this location + SITE_TO_CLOUD_SPOKES = 1; + + // Site-to-site spokes are supported in this location + SITE_TO_SITE_SPOKES = 2; +} + +// The State enum represents the lifecycle stage of a Network Connectivity +// Center resource. +enum State { + // No state information available + STATE_UNSPECIFIED = 0; + + // The resource's create operation is in progress + CREATING = 1; + + // The resource is active + ACTIVE = 2; + + // The resource's Delete operation is in progress + DELETING = 3; + + // The resource's Update operation is in progress + UPDATING = 6; +} + +// A Network Connectivity Center hub is a collection of spokes. A single hub +// can contain spokes from multiple regions. However, if any of a hub's spokes +// use the data transfer feature, the resources associated with those spokes +// must all reside in the same VPC network. Spokes that do not use data +// transfer can be associated with any VPC network in your project. +message Hub { + option (google.api.resource) = { + type: "networkconnectivity.googleapis.com/Hub" + pattern: "projects/{project}/locations/global/hubs/{hub}" + }; + + // Immutable. The name of the hub. Hub names must be unique. They use the + // following form: + // `projects/{project_number}/locations/global/hubs/{hub_id}` + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time the hub was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the hub was last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional labels in key:value format. For more information about labels, see + // [Requirements for + // labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements). + map labels = 4; + + // An optional description of the hub. + string description = 5; + + // Output only. The Google-generated UUID for the hub. This value is unique + // across all hub resources. If a hub is deleted and another with the same + // name is created, the new hub is assigned a different unique_id. + string unique_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current lifecycle state of this hub. + State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The VPC networks associated with this hub's spokes. + // + // This field is read-only. Network Connectivity Center automatically + // populates it based on the set of spokes attached to the hub. + repeated RoutingVPC routing_vpcs = 10; +} + +// RoutingVPC contains information about the VPC networks associated +// with the spokes of a Network Connectivity Center hub. +message RoutingVPC { + // The URI of the VPC network. + string uri = 1 [ + (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } + ]; + + // Output only. If true, indicates that this VPC network is currently + // associated with spokes that use the data transfer feature (spokes where the + // site_to_site_data_transfer field is set to true). If you create new spokes + // that use data transfer, they must be associated with this VPC network. At + // most, one VPC network will have this field set to true. + bool required_for_new_site_to_site_data_transfer_spokes = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A Network Connectivity Center spoke represents a connection between your +// Google Cloud network resources and a non-Google-Cloud network. +// +// When you create a spoke, you associate it with a hub. You must also identify +// a value for exactly one of the following fields: +// +// * linked_vpn_tunnels +// * linked_interconnect_attachments +// * linked_router_appliance_instances +message Spoke { + option (google.api.resource) = { + type: "networkconnectivity.googleapis.com/Spoke" + pattern: "projects/{project}/locations/{location}/spokes/{spoke}" + }; + + // Immutable. The name of the spoke. Spoke names must be unique. They use the + // following form: + // `projects/{project_number}/locations/{region}/spokes/{spoke_id}` + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time the spoke was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the spoke was last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional labels in key:value format. For more information about labels, see + // [Requirements for + // labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements). + map labels = 4; + + // An optional description of the spoke. + string description = 5; + + // Immutable. The name of the hub that this spoke is attached to. + string hub = 6 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Hub" + } + ]; + + // VPN tunnels that are associated with the spoke. + LinkedVpnTunnels linked_vpn_tunnels = 17; + + // VLAN attachments that are associated with the spoke. + LinkedInterconnectAttachments linked_interconnect_attachments = 18; + + // Router appliance instances that are associated with the spoke. + LinkedRouterApplianceInstances linked_router_appliance_instances = 19; + + // Output only. The Google-generated UUID for the spoke. This value is unique + // across all spoke resources. If a spoke is deleted and another with the same + // name is created, the new spoke is assigned a different unique_id. + string unique_id = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current lifecycle state of this spoke. + State state = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request for +// [HubService.ListHubs][google.cloud.networkconnectivity.v1.HubService.ListHubs] +// method. +message ListHubsRequest { + // Required. The parent resource's name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of results per page that should be returned. + int32 page_size = 2; + + // The page token. + string page_token = 3; + + // An expression that filters the results listed in the response. + string filter = 4; + + // Sort the results by a certain order. + string order_by = 5; +} + +// Response for +// [HubService.ListHubs][google.cloud.networkconnectivity.v1.HubService.ListHubs] +// method. +message ListHubsResponse { + // The requested hubs. + repeated Hub hubs = 1; + + // The next pagination token in the List response. It should be used as + // page_token for the following request. An empty value means no more result. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request for +// [HubService.GetHub][google.cloud.networkconnectivity.v1.HubService.GetHub] +// method. +message GetHubRequest { + // Required. The name of the hub resource to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Hub" + } + ]; +} + +// Request for +// [HubService.CreateHub][google.cloud.networkconnectivity.v1.HubService.CreateHub] +// method. +message CreateHubRequest { + // Required. The parent resource. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. A unique identifier for the hub. + string hub_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The initial values for a new hub. + Hub hub = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A unique request ID (optional). If you specify this ID, you can + // use it in cases when you need to retry your request. When you need to + // retry, this ID lets the server know that it can ignore the request if it + // has already been completed. The server guarantees that for at least 60 + // minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check to see whether the original operation + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly creating duplicate commitments. + // + // The request ID must be a valid UUID, with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for +// [HubService.UpdateHub][google.cloud.networkconnectivity.v1.HubService.UpdateHub] +// method. +message UpdateHubRequest { + // Optional. In the case of an update to an existing hub, field mask is used + // to specify the fields to be overwritten. The fields specified in the + // update_mask are relative to the resource, not the full request. A field is + // overwritten if it is in the mask. If the user does not provide a mask, then + // all fields are overwritten. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Required. The state that the hub should be in after the update. + Hub hub = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A unique request ID (optional). If you specify this ID, you can + // use it in cases when you need to retry your request. When you need to + // retry, this ID lets the server know that it can ignore the request if it + // has already been completed. The server guarantees that for at least 60 + // minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check to see whether the original operation + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly creating duplicate commitments. + // + // The request ID must be a valid UUID, with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request for +// [HubService.DeleteHub][google.cloud.networkconnectivity.v1.HubService.DeleteHub]. +message DeleteHubRequest { + // Required. The name of the hub to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Hub" + } + ]; + + // Optional. A unique request ID (optional). If you specify this ID, you can + // use it in cases when you need to retry your request. When you need to + // retry, this ID lets the server know that it can ignore the request if it + // has already been completed. The server guarantees that for at least 60 + // minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check to see whether the original operation + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly creating duplicate commitments. + // + // The request ID must be a valid UUID, with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request for +// [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes]. +message ListSpokesRequest { + // Required. The parent resource. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of results per page that should be returned. + int32 page_size = 2; + + // The page token. + string page_token = 3; + + // An expression that filters the results listed in the response. + string filter = 4; + + // Sort the results by a certain order. + string order_by = 5; +} + +// The response for +// [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes]. +message ListSpokesResponse { + // The requested spokes. + repeated Spoke spokes = 1; + + // The next pagination token in the List response. It should be used as + // page_token for the following request. An empty value means no more result. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// The request for +// [HubService.GetSpoke][google.cloud.networkconnectivity.v1.HubService.GetSpoke]. +message GetSpokeRequest { + // Required. The name of the spoke resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Spoke" + } + ]; +} + +// The request for +// [HubService.CreateSpoke][google.cloud.networkconnectivity.v1.HubService.CreateSpoke]. +message CreateSpokeRequest { + // Required. The parent resource. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Unique id for the spoke to create. + string spoke_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The initial values for a new spoke. + Spoke spoke = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A unique request ID (optional). If you specify this ID, you can + // use it in cases when you need to retry your request. When you need to + // retry, this ID lets the server know that it can ignore the request if it + // has already been completed. The server guarantees that for at least 60 + // minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check to see whether the original operation + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly creating duplicate commitments. + // + // The request ID must be a valid UUID, with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for +// [HubService.UpdateSpoke][google.cloud.networkconnectivity.v1.HubService.UpdateSpoke] +// method. +message UpdateSpokeRequest { + // Optional. In the case of an update to an existing spoke, field mask is used + // to specify the fields to be overwritten. The fields specified in the + // update_mask are relative to the resource, not the full request. A field is + // overwritten if it is in the mask. If the user does not provide a mask, then + // all fields are overwritten. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Required. The state that the spoke should be in after the update. + Spoke spoke = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A unique request ID (optional). If you specify this ID, you can + // use it in cases when you need to retry your request. When you need to + // retry, this ID lets the server know that it can ignore the request if it + // has already been completed. The server guarantees that for at least 60 + // minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check to see whether the original operation + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly creating duplicate commitments. + // + // The request ID must be a valid UUID, with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request for +// [HubService.DeleteSpoke][google.cloud.networkconnectivity.v1.HubService.DeleteSpoke]. +message DeleteSpokeRequest { + // Required. The name of the spoke to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Spoke" + } + ]; + + // Optional. A unique request ID (optional). If you specify this ID, you can + // use it in cases when you need to retry your request. When you need to + // retry, this ID lets the server know that it can ignore the request if it + // has already been completed. The server guarantees that for at least 60 + // minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check to see whether the original operation + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly creating duplicate commitments. + // + // The request ID must be a valid UUID, with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A collection of Cloud VPN tunnel resources. These resources should be +// redundant HA VPN tunnels that all advertise the same prefixes to Google +// Cloud. Alternatively, in a passive/active configuration, all tunnels +// should be capable of advertising the same prefixes. +message LinkedVpnTunnels { + // The URIs of linked VPN tunnel resources. + repeated string uris = 1 [(google.api.resource_reference) = { + type: "compute.googleapis.com/VpnTunnel" + }]; + + // A value that controls whether site-to-site data transfer is enabled for + // these resources. Data transfer is available only in [supported + // locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations). + bool site_to_site_data_transfer = 2; + + // Output only. The VPC network where these VPN tunnels are located. + string vpc_network = 3 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } + ]; +} + +// A collection of VLAN attachment resources. These resources should +// be redundant attachments that all advertise the same prefixes to Google +// Cloud. Alternatively, in active/passive configurations, all attachments +// should be capable of advertising the same prefixes. +message LinkedInterconnectAttachments { + // The URIs of linked interconnect attachment resources + repeated string uris = 1 [(google.api.resource_reference) = { + type: "compute.googleapis.com/InterconnectAttachment" + }]; + + // A value that controls whether site-to-site data transfer is enabled for + // these resources. Data transfer is available only in [supported + // locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations). + bool site_to_site_data_transfer = 2; + + // Output only. The VPC network where these VLAN attachments are located. + string vpc_network = 3 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } + ]; +} + +// A collection of router appliance instances. If you configure multiple router +// appliance instances to receive data from the same set of sites outside of +// Google Cloud, we recommend that you associate those instances with the same +// spoke. +message LinkedRouterApplianceInstances { + // The list of router appliance instances. + repeated RouterApplianceInstance instances = 1; + + // A value that controls whether site-to-site data transfer is enabled for + // these resources. Data transfer is available only in [supported + // locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations). + bool site_to_site_data_transfer = 2; + + // Output only. The VPC network where these router appliance instances are + // located. + string vpc_network = 3 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } + ]; +} + +// A router appliance instance is a Compute Engine virtual machine (VM) instance +// that acts as a BGP speaker. A router appliance instance is specified by the +// URI of the VM and the internal IP address of one of the VM's network +// interfaces. +message RouterApplianceInstance { + // The URI of the VM. + string virtual_machine = 1 [(google.api.resource_reference) = { + type: "compute.googleapis.com/Instance" + }]; + + // The IP address on the VM to use for peering. + string ip_address = 3; +} + +// Metadata about locations +message LocationMetadata { + // List of supported features + repeated LocationFeature location_features = 1; +} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.create_hub.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.create_hub.js new file mode 100644 index 00000000000..5386f809b62 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.create_hub.js @@ -0,0 +1,87 @@ +// 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, hubId, hub) { + // [START networkconnectivity_v1_generated_HubService_CreateHub_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 parent resource. + */ + // const parent = 'abc123' + /** + * Required. A unique identifier for the hub. + */ + // const hubId = 'abc123' + /** + * Required. The initial values for a new hub. + */ + // const hub = {} + /** + * Optional. A unique request ID (optional). If you specify this ID, you can + * use it in cases when you need to retry your request. When you need to + * retry, this ID lets the server know that it can ignore the request if it + * has already been completed. The server guarantees that for at least 60 + * minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly creating duplicate commitments. + * The request ID must be a valid UUID, with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callCreateHub() { + // Construct request + const request = { + parent, + hubId, + hub, + }; + + // Run request + const [operation] = await networkconnectivityClient.createHub(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateHub(); + // [END networkconnectivity_v1_generated_HubService_CreateHub_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-networkconnectivity/v1/samples/generated/v1/hub_service.create_spoke.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.create_spoke.js new file mode 100644 index 00000000000..8838c551a7d --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.create_spoke.js @@ -0,0 +1,87 @@ +// 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, spokeId, spoke) { + // [START networkconnectivity_v1_generated_HubService_CreateSpoke_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 parent resource. + */ + // const parent = 'abc123' + /** + * Required. Unique id for the spoke to create. + */ + // const spokeId = 'abc123' + /** + * Required. The initial values for a new spoke. + */ + // const spoke = {} + /** + * Optional. A unique request ID (optional). If you specify this ID, you can + * use it in cases when you need to retry your request. When you need to + * retry, this ID lets the server know that it can ignore the request if it + * has already been completed. The server guarantees that for at least 60 + * minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly creating duplicate commitments. + * The request ID must be a valid UUID, with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callCreateSpoke() { + // Construct request + const request = { + parent, + spokeId, + spoke, + }; + + // Run request + const [operation] = await networkconnectivityClient.createSpoke(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateSpoke(); + // [END networkconnectivity_v1_generated_HubService_CreateSpoke_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-networkconnectivity/v1/samples/generated/v1/hub_service.delete_hub.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.delete_hub.js new file mode 100644 index 00000000000..380e2478bb1 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.delete_hub.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(name) { + // [START networkconnectivity_v1_generated_HubService_DeleteHub_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the hub to delete. + */ + // const name = 'abc123' + /** + * Optional. A unique request ID (optional). If you specify this ID, you can + * use it in cases when you need to retry your request. When you need to + * retry, this ID lets the server know that it can ignore the request if it + * has already been completed. The server guarantees that for at least 60 + * minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly creating duplicate commitments. + * The request ID must be a valid UUID, with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callDeleteHub() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networkconnectivityClient.deleteHub(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteHub(); + // [END networkconnectivity_v1_generated_HubService_DeleteHub_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-networkconnectivity/v1/samples/generated/v1/hub_service.delete_spoke.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.delete_spoke.js new file mode 100644 index 00000000000..290cda0f1c6 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.delete_spoke.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(name) { + // [START networkconnectivity_v1_generated_HubService_DeleteSpoke_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the spoke to delete. + */ + // const name = 'abc123' + /** + * Optional. A unique request ID (optional). If you specify this ID, you can + * use it in cases when you need to retry your request. When you need to + * retry, this ID lets the server know that it can ignore the request if it + * has already been completed. The server guarantees that for at least 60 + * minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly creating duplicate commitments. + * The request ID must be a valid UUID, with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callDeleteSpoke() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networkconnectivityClient.deleteSpoke(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteSpoke(); + // [END networkconnectivity_v1_generated_HubService_DeleteSpoke_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-networkconnectivity/v1/samples/generated/v1/hub_service.get_hub.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.get_hub.js new file mode 100644 index 00000000000..257b256eda5 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.get_hub.js @@ -0,0 +1,61 @@ +// 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 networkconnectivity_v1_generated_HubService_GetHub_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the hub resource to get. + */ + // const name = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callGetHub() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await networkconnectivityClient.getHub(request); + console.log(response); + } + + callGetHub(); + // [END networkconnectivity_v1_generated_HubService_GetHub_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-networkconnectivity/v1/samples/generated/v1/hub_service.get_spoke.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.get_spoke.js new file mode 100644 index 00000000000..6a19cf40cba --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.get_spoke.js @@ -0,0 +1,61 @@ +// 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 networkconnectivity_v1_generated_HubService_GetSpoke_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the spoke resource. + */ + // const name = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callGetSpoke() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await networkconnectivityClient.getSpoke(request); + console.log(response); + } + + callGetSpoke(); + // [END networkconnectivity_v1_generated_HubService_GetSpoke_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-networkconnectivity/v1/samples/generated/v1/hub_service.list_hubs.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.list_hubs.js new file mode 100644 index 00000000000..8aeb997799c --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.list_hubs.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 networkconnectivity_v1_generated_HubService_ListHubs_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 parent resource's name. + */ + // const parent = 'abc123' + /** + * The maximum number of results per page that should be returned. + */ + // const pageSize = 1234 + /** + * The page token. + */ + // const pageToken = 'abc123' + /** + * An expression that filters the results listed in the response. + */ + // const filter = 'abc123' + /** + * Sort the results by a certain order. + */ + // const orderBy = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callListHubs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await networkconnectivityClient.listHubsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListHubs(); + // [END networkconnectivity_v1_generated_HubService_ListHubs_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-networkconnectivity/v1/samples/generated/v1/hub_service.list_spokes.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.list_spokes.js new file mode 100644 index 00000000000..4f40de8c227 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.list_spokes.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 networkconnectivity_v1_generated_HubService_ListSpokes_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 parent resource. + */ + // const parent = 'abc123' + /** + * The maximum number of results per page that should be returned. + */ + // const pageSize = 1234 + /** + * The page token. + */ + // const pageToken = 'abc123' + /** + * An expression that filters the results listed in the response. + */ + // const filter = 'abc123' + /** + * Sort the results by a certain order. + */ + // const orderBy = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callListSpokes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await networkconnectivityClient.listSpokesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSpokes(); + // [END networkconnectivity_v1_generated_HubService_ListSpokes_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-networkconnectivity/v1/samples/generated/v1/hub_service.update_hub.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.update_hub.js new file mode 100644 index 00000000000..9f5b0dbbed6 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.update_hub.js @@ -0,0 +1,85 @@ +// 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(hub) { + // [START networkconnectivity_v1_generated_HubService_UpdateHub_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. + */ + /** + * Optional. In the case of an update to an existing hub, field mask is used + * to specify the fields to be overwritten. The fields specified in the + * update_mask are relative to the resource, not the full request. A field is + * overwritten if it is in the mask. If the user does not provide a mask, then + * all fields are overwritten. + */ + // const updateMask = {} + /** + * Required. The state that the hub should be in after the update. + */ + // const hub = {} + /** + * Optional. A unique request ID (optional). If you specify this ID, you can + * use it in cases when you need to retry your request. When you need to + * retry, this ID lets the server know that it can ignore the request if it + * has already been completed. The server guarantees that for at least 60 + * minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly creating duplicate commitments. + * The request ID must be a valid UUID, with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callUpdateHub() { + // Construct request + const request = { + hub, + }; + + // Run request + const [operation] = await networkconnectivityClient.updateHub(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateHub(); + // [END networkconnectivity_v1_generated_HubService_UpdateHub_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-networkconnectivity/v1/samples/generated/v1/hub_service.update_spoke.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.update_spoke.js new file mode 100644 index 00000000000..af05ba517c3 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.update_spoke.js @@ -0,0 +1,85 @@ +// 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(spoke) { + // [START networkconnectivity_v1_generated_HubService_UpdateSpoke_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. + */ + /** + * Optional. In the case of an update to an existing spoke, field mask is used + * to specify the fields to be overwritten. The fields specified in the + * update_mask are relative to the resource, not the full request. A field is + * overwritten if it is in the mask. If the user does not provide a mask, then + * all fields are overwritten. + */ + // const updateMask = {} + /** + * Required. The state that the spoke should be in after the update. + */ + // const spoke = {} + /** + * Optional. A unique request ID (optional). If you specify this ID, you can + * use it in cases when you need to retry your request. When you need to + * retry, this ID lets the server know that it can ignore the request if it + * has already been completed. The server guarantees that for at least 60 + * minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly creating duplicate commitments. + * The request ID must be a valid UUID, with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callUpdateSpoke() { + // Construct request + const request = { + spoke, + }; + + // Run request + const [operation] = await networkconnectivityClient.updateSpoke(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateSpoke(); + // [END networkconnectivity_v1_generated_HubService_UpdateSpoke_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-networkconnectivity/v1/samples/generated/v1/snippet_metadata_google.cloud.networkconnectivity.v1.json b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/snippet_metadata_google.cloud.networkconnectivity.v1.json new file mode 100644 index 00000000000..5f6649ebfe6 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/snippet_metadata_google.cloud.networkconnectivity.v1.json @@ -0,0 +1,495 @@ +{ + "clientLibrary": { + "name": "nodejs-networkconnectivity", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.networkconnectivity.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "networkconnectivity_v1_generated_HubService_ListHubs_async", + "title": "HubService listHubs Sample", + "origin": "API_DEFINITION", + "description": " Lists the Network Connectivity Center hubs associated with a given project.", + "canonical": true, + "file": "hub_service.list_hubs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListHubs", + "fullName": "google.cloud.networkconnectivity.v1.HubService.ListHubs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkconnectivity.v1.ListHubsResponse", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "ListHubs", + "fullName": "google.cloud.networkconnectivity.v1.HubService.ListHubs", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_GetHub_async", + "title": "HubService getHub Sample", + "origin": "API_DEFINITION", + "description": " Gets details about a Network Connectivity Center hub.", + "canonical": true, + "file": "hub_service.get_hub.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetHub", + "fullName": "google.cloud.networkconnectivity.v1.HubService.GetHub", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkconnectivity.v1.Hub", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "GetHub", + "fullName": "google.cloud.networkconnectivity.v1.HubService.GetHub", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_CreateHub_async", + "title": "HubService createHub Sample", + "origin": "API_DEFINITION", + "description": " Creates a new Network Connectivity Center hub in the specified project.", + "canonical": true, + "file": "hub_service.create_hub.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateHub", + "fullName": "google.cloud.networkconnectivity.v1.HubService.CreateHub", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "hub_id", + "type": "TYPE_STRING" + }, + { + "name": "hub", + "type": ".google.cloud.networkconnectivity.v1.Hub" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "CreateHub", + "fullName": "google.cloud.networkconnectivity.v1.HubService.CreateHub", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_UpdateHub_async", + "title": "HubService updateHub Sample", + "origin": "API_DEFINITION", + "description": " Updates the description and/or labels of a Network Connectivity Center hub.", + "canonical": true, + "file": "hub_service.update_hub.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateHub", + "fullName": "google.cloud.networkconnectivity.v1.HubService.UpdateHub", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "hub", + "type": ".google.cloud.networkconnectivity.v1.Hub" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "UpdateHub", + "fullName": "google.cloud.networkconnectivity.v1.HubService.UpdateHub", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_DeleteHub_async", + "title": "HubService deleteHub Sample", + "origin": "API_DEFINITION", + "description": " Deletes a Network Connectivity Center hub.", + "canonical": true, + "file": "hub_service.delete_hub.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteHub", + "fullName": "google.cloud.networkconnectivity.v1.HubService.DeleteHub", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "DeleteHub", + "fullName": "google.cloud.networkconnectivity.v1.HubService.DeleteHub", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_ListSpokes_async", + "title": "HubService listSpokes Sample", + "origin": "API_DEFINITION", + "description": " Lists the Network Connectivity Center spokes in a specified project and location.", + "canonical": true, + "file": "hub_service.list_spokes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSpokes", + "fullName": "google.cloud.networkconnectivity.v1.HubService.ListSpokes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkconnectivity.v1.ListSpokesResponse", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "ListSpokes", + "fullName": "google.cloud.networkconnectivity.v1.HubService.ListSpokes", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_GetSpoke_async", + "title": "HubService getSpoke Sample", + "origin": "API_DEFINITION", + "description": " Gets details about a Network Connectivity Center spoke.", + "canonical": true, + "file": "hub_service.get_spoke.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSpoke", + "fullName": "google.cloud.networkconnectivity.v1.HubService.GetSpoke", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkconnectivity.v1.Spoke", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "GetSpoke", + "fullName": "google.cloud.networkconnectivity.v1.HubService.GetSpoke", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_CreateSpoke_async", + "title": "HubService createSpoke Sample", + "origin": "API_DEFINITION", + "description": " Creates a Network Connectivity Center spoke.", + "canonical": true, + "file": "hub_service.create_spoke.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSpoke", + "fullName": "google.cloud.networkconnectivity.v1.HubService.CreateSpoke", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "spoke_id", + "type": "TYPE_STRING" + }, + { + "name": "spoke", + "type": ".google.cloud.networkconnectivity.v1.Spoke" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "CreateSpoke", + "fullName": "google.cloud.networkconnectivity.v1.HubService.CreateSpoke", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_UpdateSpoke_async", + "title": "HubService updateSpoke Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a Network Connectivity Center spoke.", + "canonical": true, + "file": "hub_service.update_spoke.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSpoke", + "fullName": "google.cloud.networkconnectivity.v1.HubService.UpdateSpoke", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "spoke", + "type": ".google.cloud.networkconnectivity.v1.Spoke" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "UpdateSpoke", + "fullName": "google.cloud.networkconnectivity.v1.HubService.UpdateSpoke", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_DeleteSpoke_async", + "title": "HubService deleteSpoke Sample", + "origin": "API_DEFINITION", + "description": " Deletes a Network Connectivity Center spoke.", + "canonical": true, + "file": "hub_service.delete_spoke.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSpoke", + "fullName": "google.cloud.networkconnectivity.v1.HubService.DeleteSpoke", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "DeleteSpoke", + "fullName": "google.cloud.networkconnectivity.v1.HubService.DeleteSpoke", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/src/index.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1/src/index.ts new file mode 100644 index 00000000000..5da8f8a5f72 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/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 v1 from './v1'; +const HubServiceClient = v1.HubServiceClient; +type HubServiceClient = v1.HubServiceClient; +export {v1, HubServiceClient}; +export default {v1, HubServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..3e4f0fedf40 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/gapic_metadata.json @@ -0,0 +1,131 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.networkconnectivity.v1", + "libraryPackage": "@google-cloud/network-connectivity", + "services": { + "HubService": { + "clients": { + "grpc": { + "libraryClient": "HubServiceClient", + "rpcs": { + "GetHub": { + "methods": [ + "getHub" + ] + }, + "GetSpoke": { + "methods": [ + "getSpoke" + ] + }, + "CreateHub": { + "methods": [ + "createHub" + ] + }, + "UpdateHub": { + "methods": [ + "updateHub" + ] + }, + "DeleteHub": { + "methods": [ + "deleteHub" + ] + }, + "CreateSpoke": { + "methods": [ + "createSpoke" + ] + }, + "UpdateSpoke": { + "methods": [ + "updateSpoke" + ] + }, + "DeleteSpoke": { + "methods": [ + "deleteSpoke" + ] + }, + "ListHubs": { + "methods": [ + "listHubs", + "listHubsStream", + "listHubsAsync" + ] + }, + "ListSpokes": { + "methods": [ + "listSpokes", + "listSpokesStream", + "listSpokesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "HubServiceClient", + "rpcs": { + "GetHub": { + "methods": [ + "getHub" + ] + }, + "GetSpoke": { + "methods": [ + "getSpoke" + ] + }, + "CreateHub": { + "methods": [ + "createHub" + ] + }, + "UpdateHub": { + "methods": [ + "updateHub" + ] + }, + "DeleteHub": { + "methods": [ + "deleteHub" + ] + }, + "CreateSpoke": { + "methods": [ + "createSpoke" + ] + }, + "UpdateSpoke": { + "methods": [ + "updateSpoke" + ] + }, + "DeleteSpoke": { + "methods": [ + "deleteSpoke" + ] + }, + "ListHubs": { + "methods": [ + "listHubs", + "listHubsStream", + "listHubsAsync" + ] + }, + "ListSpokes": { + "methods": [ + "listSpokes", + "listSpokesStream", + "listSpokesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_client.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_client.ts new file mode 100644 index 00000000000..4e693bbfd8e --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_client.ts @@ -0,0 +1,2277 @@ +// 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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/hub_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './hub_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Network Connectivity Center is a hub-and-spoke abstraction for network + * connectivity management in Google Cloud. It reduces operational complexity + * through a simple, centralized connectivity management model. + * @class + * @memberof v1 + */ +export class HubServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + hubServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of HubServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 HubServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof HubServiceClient; + 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; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + 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 = { + hubPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/global/hubs/{hub}' + ), + instancePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/zones/{zone}/instances/{instance}' + ), + interconnectAttachmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/interconnectAttachments/{resource_id}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + networkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/global/networks/{resource_id}' + ), + spokePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/spokes/{spoke}' + ), + vpnTunnelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/vpnTunnels/{resource_id}' + ), + }; + + // 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 = { + listHubs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'hubs'), + listSpokes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spokes') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/global/hubs/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/spokes/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/global/hubs/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/spokes/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/global/hubs/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/spokes/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createHubResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.Hub') as gax.protobuf.Type; + const createHubMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; + const updateHubResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.Hub') as gax.protobuf.Type; + const updateHubMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; + const deleteHubResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteHubMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; + const createSpokeResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.Spoke') as gax.protobuf.Type; + const createSpokeMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; + const updateSpokeResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.Spoke') as gax.protobuf.Type; + const updateSpokeMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; + const deleteSpokeResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteSpokeMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createHub: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createHubResponse.decode.bind(createHubResponse), + createHubMetadata.decode.bind(createHubMetadata)), + updateHub: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateHubResponse.decode.bind(updateHubResponse), + updateHubMetadata.decode.bind(updateHubMetadata)), + deleteHub: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteHubResponse.decode.bind(deleteHubResponse), + deleteHubMetadata.decode.bind(deleteHubMetadata)), + createSpoke: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createSpokeResponse.decode.bind(createSpokeResponse), + createSpokeMetadata.decode.bind(createSpokeMetadata)), + updateSpoke: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateSpokeResponse.decode.bind(updateSpokeResponse), + updateSpokeMetadata.decode.bind(updateSpokeMetadata)), + deleteSpoke: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteSpokeResponse.decode.bind(deleteSpokeResponse), + deleteSpokeMetadata.decode.bind(deleteSpokeMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.networkconnectivity.v1.HubService', 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.hubServiceStub) { + return this.hubServiceStub; + } + + // Put together the "service stub" for + // google.cloud.networkconnectivity.v1.HubService. + this.hubServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.networkconnectivity.v1.HubService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networkconnectivity.v1.HubService, + 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 hubServiceStubMethods = + ['listHubs', 'getHub', 'createHub', 'updateHub', 'deleteHub', 'listSpokes', 'getSpoke', 'createSpoke', 'updateSpoke', 'deleteSpoke']; + for (const methodName of hubServiceStubMethods) { + const callPromise = this.hubServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.hubServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'networkconnectivity.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 'networkconnectivity.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 -- + // ------------------- +/** + * Gets details about a Network Connectivity Center hub. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the hub resource to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.networkconnectivity.v1.Hub|Hub}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/hub_service.get_hub.js + * region_tag:networkconnectivity_v1_generated_HubService_GetHub_async + */ + getHub( + request?: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IGetHubRequest|undefined, {}|undefined + ]>; + getHub( + request: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IGetHubRequest|null|undefined, + {}|null|undefined>): void; + getHub( + request: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, + callback: Callback< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IGetHubRequest|null|undefined, + {}|null|undefined>): void; + getHub( + request?: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IGetHubRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IGetHubRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IGetHubRequest|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.getHub(request, options, callback); + } +/** + * Gets details about a Network Connectivity Center spoke. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spoke 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 protos.google.cloud.networkconnectivity.v1.Spoke|Spoke}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/hub_service.get_spoke.js + * region_tag:networkconnectivity_v1_generated_HubService_GetSpoke_async + */ + getSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|undefined, {}|undefined + ]>; + getSpoke( + request: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|null|undefined, + {}|null|undefined>): void; + getSpoke( + request: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, + callback: Callback< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|null|undefined, + {}|null|undefined>): void; + getSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|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.getSpoke(request, options, callback); + } + +/** + * Creates a new Network Connectivity Center hub in the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource. + * @param {string} request.hubId + * Required. A unique identifier for the hub. + * @param {google.cloud.networkconnectivity.v1.Hub} request.hub + * Required. The initial values for a new hub. + * @param {string} [request.requestId] + * Optional. A unique request ID (optional). If you specify this ID, you can + * use it in cases when you need to retry your request. When you need to + * retry, this ID lets the server know that it can ignore the request if it + * has already been completed. The server guarantees that for at least 60 + * minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly creating duplicate commitments. + * + * The request ID must be a valid UUID, with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/hub_service.create_hub.js + * region_tag:networkconnectivity_v1_generated_HubService_CreateHub_async + */ + createHub( + request?: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createHub( + request: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createHub( + request: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createHub( + request?: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createHub(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createHub()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/hub_service.create_hub.js + * region_tag:networkconnectivity_v1_generated_HubService_CreateHub_async + */ + async checkCreateHubProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createHub, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the description and/or labels of a Network Connectivity Center + * hub. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. In the case of an update to an existing hub, field mask is used + * to specify the fields to be overwritten. The fields specified in the + * update_mask are relative to the resource, not the full request. A field is + * overwritten if it is in the mask. If the user does not provide a mask, then + * all fields are overwritten. + * @param {google.cloud.networkconnectivity.v1.Hub} request.hub + * Required. The state that the hub should be in after the update. + * @param {string} [request.requestId] + * Optional. A unique request ID (optional). If you specify this ID, you can + * use it in cases when you need to retry your request. When you need to + * retry, this ID lets the server know that it can ignore the request if it + * has already been completed. The server guarantees that for at least 60 + * minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly creating duplicate commitments. + * + * The request ID must be a valid UUID, with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/hub_service.update_hub.js + * region_tag:networkconnectivity_v1_generated_HubService_UpdateHub_async + */ + updateHub( + request?: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateHub( + request: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateHub( + request: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateHub( + request?: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'hub.name': request.hub!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateHub(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateHub()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/hub_service.update_hub.js + * region_tag:networkconnectivity_v1_generated_HubService_UpdateHub_async + */ + async checkUpdateHubProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateHub, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a Network Connectivity Center hub. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the hub to delete. + * @param {string} [request.requestId] + * Optional. A unique request ID (optional). If you specify this ID, you can + * use it in cases when you need to retry your request. When you need to + * retry, this ID lets the server know that it can ignore the request if it + * has already been completed. The server guarantees that for at least 60 + * minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly creating duplicate commitments. + * + * The request ID must be a valid UUID, with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/hub_service.delete_hub.js + * region_tag:networkconnectivity_v1_generated_HubService_DeleteHub_async + */ + deleteHub( + request?: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteHub( + request: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteHub( + request: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteHub( + request?: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteHub(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteHub()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/hub_service.delete_hub.js + * region_tag:networkconnectivity_v1_generated_HubService_DeleteHub_async + */ + async checkDeleteHubProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteHub, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a Network Connectivity Center spoke. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource. + * @param {string} request.spokeId + * Required. Unique id for the spoke to create. + * @param {google.cloud.networkconnectivity.v1.Spoke} request.spoke + * Required. The initial values for a new spoke. + * @param {string} [request.requestId] + * Optional. A unique request ID (optional). If you specify this ID, you can + * use it in cases when you need to retry your request. When you need to + * retry, this ID lets the server know that it can ignore the request if it + * has already been completed. The server guarantees that for at least 60 + * minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly creating duplicate commitments. + * + * The request ID must be a valid UUID, with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/hub_service.create_spoke.js + * region_tag:networkconnectivity_v1_generated_HubService_CreateSpoke_async + */ + createSpoke( + request?: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createSpoke( + request: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createSpoke( + request: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createSpoke( + request?: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createSpoke(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createSpoke()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/hub_service.create_spoke.js + * region_tag:networkconnectivity_v1_generated_HubService_CreateSpoke_async + */ + async checkCreateSpokeProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createSpoke, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the parameters of a Network Connectivity Center spoke. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. In the case of an update to an existing spoke, field mask is used + * to specify the fields to be overwritten. The fields specified in the + * update_mask are relative to the resource, not the full request. A field is + * overwritten if it is in the mask. If the user does not provide a mask, then + * all fields are overwritten. + * @param {google.cloud.networkconnectivity.v1.Spoke} request.spoke + * Required. The state that the spoke should be in after the update. + * @param {string} [request.requestId] + * Optional. A unique request ID (optional). If you specify this ID, you can + * use it in cases when you need to retry your request. When you need to + * retry, this ID lets the server know that it can ignore the request if it + * has already been completed. The server guarantees that for at least 60 + * minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly creating duplicate commitments. + * + * The request ID must be a valid UUID, with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/hub_service.update_spoke.js + * region_tag:networkconnectivity_v1_generated_HubService_UpdateSpoke_async + */ + updateSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateSpoke( + request: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateSpoke( + request: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'spoke.name': request.spoke!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSpoke(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateSpoke()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/hub_service.update_spoke.js + * region_tag:networkconnectivity_v1_generated_HubService_UpdateSpoke_async + */ + async checkUpdateSpokeProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateSpoke, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a Network Connectivity Center spoke. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spoke to delete. + * @param {string} [request.requestId] + * Optional. A unique request ID (optional). If you specify this ID, you can + * use it in cases when you need to retry your request. When you need to + * retry, this ID lets the server know that it can ignore the request if it + * has already been completed. The server guarantees that for at least 60 + * minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly creating duplicate commitments. + * + * The request ID must be a valid UUID, with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/hub_service.delete_spoke.js + * region_tag:networkconnectivity_v1_generated_HubService_DeleteSpoke_async + */ + deleteSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteSpoke( + request: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteSpoke( + request: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteSpoke(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteSpoke()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/hub_service.delete_spoke.js + * region_tag:networkconnectivity_v1_generated_HubService_DeleteSpoke_async + */ + async checkDeleteSpokeProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteSpoke, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists the Network Connectivity Center hubs associated with a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource's name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * An expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.networkconnectivity.v1.Hub|Hub}. + * 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 `listHubsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listHubs( + request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkconnectivity.v1.IHub[], + protos.google.cloud.networkconnectivity.v1.IListHubsRequest|null, + protos.google.cloud.networkconnectivity.v1.IListHubsResponse + ]>; + listHubs( + request: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + protos.google.cloud.networkconnectivity.v1.IListHubsResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1.IHub>): void; + listHubs( + request: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + protos.google.cloud.networkconnectivity.v1.IListHubsResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1.IHub>): void; + listHubs( + request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + protos.google.cloud.networkconnectivity.v1.IListHubsResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1.IHub>, + callback?: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + protos.google.cloud.networkconnectivity.v1.IListHubsResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1.IHub>): + Promise<[ + protos.google.cloud.networkconnectivity.v1.IHub[], + protos.google.cloud.networkconnectivity.v1.IListHubsRequest|null, + protos.google.cloud.networkconnectivity.v1.IListHubsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listHubs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource's name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * An expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @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 protos.google.cloud.networkconnectivity.v1.Hub|Hub} 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 `listHubsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listHubsStream( + request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + 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['listHubs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listHubs.createStream( + this.innerApiCalls.listHubs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listHubs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource's name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * An expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.networkconnectivity.v1.Hub|Hub}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/hub_service.list_hubs.js + * region_tag:networkconnectivity_v1_generated_HubService_ListHubs_async + */ + listHubsAsync( + request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + 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['listHubs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listHubs.asyncIterate( + this.innerApiCalls['listHubs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists the Network Connectivity Center spokes in a specified project and + * location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * An expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.networkconnectivity.v1.Spoke|Spoke}. + * 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 `listSpokesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listSpokes( + request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkconnectivity.v1.ISpoke[], + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest|null, + protos.google.cloud.networkconnectivity.v1.IListSpokesResponse + ]>; + listSpokes( + request: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + protos.google.cloud.networkconnectivity.v1.IListSpokesResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1.ISpoke>): void; + listSpokes( + request: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + protos.google.cloud.networkconnectivity.v1.IListSpokesResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1.ISpoke>): void; + listSpokes( + request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + protos.google.cloud.networkconnectivity.v1.IListSpokesResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1.ISpoke>, + callback?: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + protos.google.cloud.networkconnectivity.v1.IListSpokesResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1.ISpoke>): + Promise<[ + protos.google.cloud.networkconnectivity.v1.ISpoke[], + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest|null, + protos.google.cloud.networkconnectivity.v1.IListSpokesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listSpokes(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * An expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @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 protos.google.cloud.networkconnectivity.v1.Spoke|Spoke} 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 `listSpokesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listSpokesStream( + request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + 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['listSpokes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSpokes.createStream( + this.innerApiCalls.listSpokes as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSpokes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * An expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.networkconnectivity.v1.Spoke|Spoke}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/hub_service.list_spokes.js + * region_tag:networkconnectivity_v1_generated_HubService_ListSpokes_async + */ + listSpokesAsync( + request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + 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['listSpokes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSpokes.asyncIterate( + this.innerApiCalls['listSpokes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified hub resource name string. + * + * @param {string} project + * @param {string} hub + * @returns {string} Resource name string. + */ + hubPath(project:string,hub:string) { + return this.pathTemplates.hubPathTemplate.render({ + project: project, + hub: hub, + }); + } + + /** + * Parse the project from Hub resource. + * + * @param {string} hubName + * A fully-qualified path representing Hub resource. + * @returns {string} A string representing the project. + */ + matchProjectFromHubName(hubName: string) { + return this.pathTemplates.hubPathTemplate.match(hubName).project; + } + + /** + * Parse the hub from Hub resource. + * + * @param {string} hubName + * A fully-qualified path representing Hub resource. + * @returns {string} A string representing the hub. + */ + matchHubFromHubName(hubName: string) { + return this.pathTemplates.hubPathTemplate.match(hubName).hub; + } + + /** + * Return a fully-qualified instance resource name string. + * + * @param {string} project + * @param {string} zone + * @param {string} instance + * @returns {string} Resource name string. + */ + instancePath(project:string,zone:string,instance:string) { + return this.pathTemplates.instancePathTemplate.render({ + project: project, + zone: zone, + instance: instance, + }); + } + + /** + * Parse the project from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).project; + } + + /** + * Parse the zone from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the zone. + */ + matchZoneFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).zone; + } + + /** + * Parse the instance from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).instance; + } + + /** + * Return a fully-qualified interconnectAttachment resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} resource_id + * @returns {string} Resource name string. + */ + interconnectAttachmentPath(project:string,region:string,resourceId:string) { + return this.pathTemplates.interconnectAttachmentPathTemplate.render({ + project: project, + region: region, + resource_id: resourceId, + }); + } + + /** + * Parse the project from InterconnectAttachment resource. + * + * @param {string} interconnectAttachmentName + * A fully-qualified path representing InterconnectAttachment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInterconnectAttachmentName(interconnectAttachmentName: string) { + return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).project; + } + + /** + * Parse the region from InterconnectAttachment resource. + * + * @param {string} interconnectAttachmentName + * A fully-qualified path representing InterconnectAttachment resource. + * @returns {string} A string representing the region. + */ + matchRegionFromInterconnectAttachmentName(interconnectAttachmentName: string) { + return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).region; + } + + /** + * Parse the resource_id from InterconnectAttachment resource. + * + * @param {string} interconnectAttachmentName + * A fully-qualified path representing InterconnectAttachment resource. + * @returns {string} A string representing the resource_id. + */ + matchResourceIdFromInterconnectAttachmentName(interconnectAttachmentName: string) { + return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).resource_id; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified network resource name string. + * + * @param {string} project + * @param {string} resource_id + * @returns {string} Resource name string. + */ + networkPath(project:string,resourceId:string) { + return this.pathTemplates.networkPathTemplate.render({ + project: project, + resource_id: resourceId, + }); + } + + /** + * Parse the project from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).project; + } + + /** + * Parse the resource_id from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the resource_id. + */ + matchResourceIdFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).resource_id; + } + + /** + * Return a fully-qualified spoke resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} spoke + * @returns {string} Resource name string. + */ + spokePath(project:string,location:string,spoke:string) { + return this.pathTemplates.spokePathTemplate.render({ + project: project, + location: location, + spoke: spoke, + }); + } + + /** + * Parse the project from Spoke resource. + * + * @param {string} spokeName + * A fully-qualified path representing Spoke resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSpokeName(spokeName: string) { + return this.pathTemplates.spokePathTemplate.match(spokeName).project; + } + + /** + * Parse the location from Spoke resource. + * + * @param {string} spokeName + * A fully-qualified path representing Spoke resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSpokeName(spokeName: string) { + return this.pathTemplates.spokePathTemplate.match(spokeName).location; + } + + /** + * Parse the spoke from Spoke resource. + * + * @param {string} spokeName + * A fully-qualified path representing Spoke resource. + * @returns {string} A string representing the spoke. + */ + matchSpokeFromSpokeName(spokeName: string) { + return this.pathTemplates.spokePathTemplate.match(spokeName).spoke; + } + + /** + * Return a fully-qualified vpnTunnel resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} resource_id + * @returns {string} Resource name string. + */ + vpnTunnelPath(project:string,region:string,resourceId:string) { + return this.pathTemplates.vpnTunnelPathTemplate.render({ + project: project, + region: region, + resource_id: resourceId, + }); + } + + /** + * Parse the project from VpnTunnel resource. + * + * @param {string} vpnTunnelName + * A fully-qualified path representing VpnTunnel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVpnTunnelName(vpnTunnelName: string) { + return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).project; + } + + /** + * Parse the region from VpnTunnel resource. + * + * @param {string} vpnTunnelName + * A fully-qualified path representing VpnTunnel resource. + * @returns {string} A string representing the region. + */ + matchRegionFromVpnTunnelName(vpnTunnelName: string) { + return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).region; + } + + /** + * Parse the resource_id from VpnTunnel resource. + * + * @param {string} vpnTunnelName + * A fully-qualified path representing VpnTunnel resource. + * @returns {string} A string representing the resource_id. + */ + matchResourceIdFromVpnTunnelName(vpnTunnelName: string) { + return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).resource_id; + } + + /** + * 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.hubServiceStub && !this._terminated) { + return this.hubServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_client_config.json b/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_client_config.json new file mode 100644 index 00000000000..068f769fc14 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_client_config.json @@ -0,0 +1,88 @@ +{ + "interfaces": { + "google.cloud.networkconnectivity.v1.HubService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListHubs": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetHub": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateHub": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateHub": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteHub": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListSpokes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_proto_list.json b/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_proto_list.json new file mode 100644 index 00000000000..ebe50faf7cb --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/networkconnectivity/v1/common.proto", + "../../protos/google/cloud/networkconnectivity/v1/hub.proto" +] diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/index.ts new file mode 100644 index 00000000000..937a411a485 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/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 {HubServiceClient} from './hub_service_client'; diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..d3cd46d0a96 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/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 networkconnectivity = require('@google-cloud/network-connectivity'); + +function main() { + const hubServiceClient = new networkconnectivity.HubServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..ae4d979ece8 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/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 {HubServiceClient} from '@google-cloud/network-connectivity'; + +// check that the client class type name can be used +function doStuffWithHubServiceClient(client: HubServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const hubServiceClient = new HubServiceClient(); + doStuffWithHubServiceClient(hubServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/install.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/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-networkconnectivity/v1/test/gapic_hub_service_v1.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1/test/gapic_hub_service_v1.ts new file mode 100644 index 00000000000..eef24f583fe --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1/test/gapic_hub_service_v1.ts @@ -0,0 +1,2849 @@ +// 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 hubserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.HubServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = hubserviceModule.v1.HubServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = hubserviceModule.v1.HubServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = hubserviceModule.v1.HubServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new hubserviceModule.v1.HubServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new hubserviceModule.v1.HubServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.hubServiceStub, undefined); + await client.initialize(); + assert(client.hubServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.hubServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.hubServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new hubserviceModule.v1.HubServiceClient({ + 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 hubserviceModule.v1.HubServiceClient({ + 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('getHub', () => { + it('invokes getHub without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.GetHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.GetHubRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Hub() + ); + client.innerApiCalls.getHub = stubSimpleCall(expectedResponse); + const [response] = await client.getHub(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getHub without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.GetHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.GetHubRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Hub() + ); + client.innerApiCalls.getHub = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getHub( + request, + (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1.IHub|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getHub with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.GetHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.GetHubRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getHub = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getHub(request), expectedError); + const actualRequest = (client.innerApiCalls.getHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getHub with closed client', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.GetHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.GetHubRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getHub(request), expectedError); + }); + }); + + describe('getSpoke', () => { + it('invokes getSpoke without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.GetSpokeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Spoke() + ); + client.innerApiCalls.getSpoke = stubSimpleCall(expectedResponse); + const [response] = await client.getSpoke(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSpoke without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.GetSpokeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Spoke() + ); + client.innerApiCalls.getSpoke = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSpoke( + request, + (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1.ISpoke|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSpoke with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.GetSpokeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSpoke = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSpoke(request), expectedError); + const actualRequest = (client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSpoke with closed client', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.GetSpokeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSpoke(request), expectedError); + }); + }); + + describe('createHub', () => { + it('invokes createHub without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.CreateHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.CreateHubRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createHub = stubLongRunningCall(expectedResponse); + const [operation] = await client.createHub(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createHub without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.CreateHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.CreateHubRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createHub = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createHub( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createHub with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.CreateHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.CreateHubRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createHub = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createHub(request), expectedError); + const actualRequest = (client.innerApiCalls.createHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createHub with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.CreateHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.CreateHubRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createHub = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createHub(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateHubProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateHubProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateHubProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateHubProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateHub', () => { + it('invokes updateHub without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest() + ); + request.hub ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.UpdateHubRequest', ['hub', 'name']); + request.hub.name = defaultValue1; + const expectedHeaderRequestParams = `hub.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateHub = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateHub(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateHub without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest() + ); + request.hub ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.UpdateHubRequest', ['hub', 'name']); + request.hub.name = defaultValue1; + const expectedHeaderRequestParams = `hub.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateHub = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateHub( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateHub with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest() + ); + request.hub ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.UpdateHubRequest', ['hub', 'name']); + request.hub.name = defaultValue1; + const expectedHeaderRequestParams = `hub.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateHub = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateHub(request), expectedError); + const actualRequest = (client.innerApiCalls.updateHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateHub with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest() + ); + request.hub ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.UpdateHubRequest', ['hub', 'name']); + request.hub.name = defaultValue1; + const expectedHeaderRequestParams = `hub.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateHub = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateHub(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateHubProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateHubProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateHubProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateHubProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteHub', () => { + it('invokes deleteHub without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.DeleteHubRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteHub = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteHub(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteHub without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.DeleteHubRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteHub = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteHub( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteHub with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.DeleteHubRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteHub = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteHub(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteHub with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.DeleteHubRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteHub = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteHub(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteHubProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteHubProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteHubProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteHubProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createSpoke', () => { + it('invokes createSpoke without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.CreateSpokeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createSpoke = stubLongRunningCall(expectedResponse); + const [operation] = await client.createSpoke(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSpoke without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.CreateSpokeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createSpoke = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSpoke( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSpoke with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.CreateSpokeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSpoke = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createSpoke(request), expectedError); + const actualRequest = (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSpoke with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.CreateSpokeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSpoke = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createSpoke(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateSpokeProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateSpokeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateSpokeProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateSpokeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateSpoke', () => { + it('invokes updateSpoke without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest() + ); + request.spoke ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.UpdateSpokeRequest', ['spoke', 'name']); + request.spoke.name = defaultValue1; + const expectedHeaderRequestParams = `spoke.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateSpoke = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSpoke(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSpoke without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest() + ); + request.spoke ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.UpdateSpokeRequest', ['spoke', 'name']); + request.spoke.name = defaultValue1; + const expectedHeaderRequestParams = `spoke.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateSpoke = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSpoke( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSpoke with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest() + ); + request.spoke ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.UpdateSpokeRequest', ['spoke', 'name']); + request.spoke.name = defaultValue1; + const expectedHeaderRequestParams = `spoke.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSpoke = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateSpoke(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSpoke with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest() + ); + request.spoke ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.UpdateSpokeRequest', ['spoke', 'name']); + request.spoke.name = defaultValue1; + const expectedHeaderRequestParams = `spoke.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSpoke = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateSpoke(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateSpokeProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateSpokeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateSpokeProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateSpokeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteSpoke', () => { + it('invokes deleteSpoke without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.DeleteSpokeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteSpoke = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSpoke(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSpoke without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.DeleteSpokeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteSpoke = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSpoke( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSpoke with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.DeleteSpokeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSpoke = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteSpoke(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSpoke with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.DeleteSpokeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSpoke = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteSpoke(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteSpokeProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteSpokeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteSpokeProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteSpokeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listHubs', () => { + it('invokes listHubs without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListHubsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + ]; + client.innerApiCalls.listHubs = stubSimpleCall(expectedResponse); + const [response] = await client.listHubs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listHubs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listHubs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listHubs without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListHubsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + ]; + client.innerApiCalls.listHubs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listHubs( + request, + (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1.IHub[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listHubs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listHubs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listHubs with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListHubsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listHubs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listHubs(request), expectedError); + const actualRequest = (client.innerApiCalls.listHubs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listHubs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listHubsStream without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListHubsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + ]; + client.descriptors.page.listHubs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listHubsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1.Hub[] = []; + stream.on('data', (response: protos.google.cloud.networkconnectivity.v1.Hub) => { + 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.listHubs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listHubs, request)); + assert( + (client.descriptors.page.listHubs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listHubsStream with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListHubsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listHubs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listHubsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1.Hub[] = []; + stream.on('data', (response: protos.google.cloud.networkconnectivity.v1.Hub) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listHubs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listHubs, request)); + assert( + (client.descriptors.page.listHubs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listHubs without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListHubsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + ]; + client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networkconnectivity.v1.IHub[] = []; + const iterable = client.listHubsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listHubs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listHubs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listHubs with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListHubsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listHubsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networkconnectivity.v1.IHub[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listHubs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listHubs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listSpokes', () => { + it('invokes listSpokes without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListSpokesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + ]; + client.innerApiCalls.listSpokes = stubSimpleCall(expectedResponse); + const [response] = await client.listSpokes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSpokes without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListSpokesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + ]; + client.innerApiCalls.listSpokes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSpokes( + request, + (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1.ISpoke[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSpokes with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListSpokesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSpokes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSpokes(request), expectedError); + const actualRequest = (client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSpokesStream without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListSpokesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + ]; + client.descriptors.page.listSpokes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSpokesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1.Spoke[] = []; + stream.on('data', (response: protos.google.cloud.networkconnectivity.v1.Spoke) => { + 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.listSpokes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSpokes, request)); + assert( + (client.descriptors.page.listSpokes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listSpokesStream with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListSpokesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSpokes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSpokesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1.Spoke[] = []; + stream.on('data', (response: protos.google.cloud.networkconnectivity.v1.Spoke) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSpokes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSpokes, request)); + assert( + (client.descriptors.page.listSpokes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSpokes without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListSpokesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + ]; + client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networkconnectivity.v1.ISpoke[] = []; + const iterable = client.listSpokesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSpokes with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListSpokesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSpokesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networkconnectivity.v1.ISpoke[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('hub', () => { + const fakePath = "/rendered/path/hub"; + const expectedParameters = { + project: "projectValue", + hub: "hubValue", + }; + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.hubPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.hubPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('hubPath', () => { + const result = client.hubPath("projectValue", "hubValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.hubPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromHubName', () => { + const result = client.matchProjectFromHubName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.hubPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchHubFromHubName', () => { + const result = client.matchHubFromHubName(fakePath); + assert.strictEqual(result, "hubValue"); + assert((client.pathTemplates.hubPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('instance', () => { + const fakePath = "/rendered/path/instance"; + const expectedParameters = { + project: "projectValue", + zone: "zoneValue", + instance: "instanceValue", + }; + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.instancePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath("projectValue", "zoneValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchZoneFromInstanceName', () => { + const result = client.matchZoneFromInstanceName(fakePath); + assert.strictEqual(result, "zoneValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('interconnectAttachment', () => { + const fakePath = "/rendered/path/interconnectAttachment"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + resource_id: "resourceIdValue", + }; + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.interconnectAttachmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interconnectAttachmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interconnectAttachmentPath', () => { + const result = client.interconnectAttachmentPath("projectValue", "regionValue", "resourceIdValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.interconnectAttachmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInterconnectAttachmentName', () => { + const result = client.matchProjectFromInterconnectAttachmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromInterconnectAttachmentName', () => { + const result = client.matchRegionFromInterconnectAttachmentName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchResourceIdFromInterconnectAttachmentName', () => { + const result = client.matchResourceIdFromInterconnectAttachmentName(fakePath); + assert.strictEqual(result, "resourceIdValue"); + assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('network', () => { + const fakePath = "/rendered/path/network"; + const expectedParameters = { + project: "projectValue", + resource_id: "resourceIdValue", + }; + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.networkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.networkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath("projectValue", "resourceIdValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchResourceIdFromNetworkName', () => { + const result = client.matchResourceIdFromNetworkName(fakePath); + assert.strictEqual(result, "resourceIdValue"); + assert((client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('spoke', () => { + const fakePath = "/rendered/path/spoke"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + spoke: "spokeValue", + }; + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.spokePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.spokePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('spokePath', () => { + const result = client.spokePath("projectValue", "locationValue", "spokeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.spokePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSpokeName', () => { + const result = client.matchProjectFromSpokeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.spokePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromSpokeName', () => { + const result = client.matchLocationFromSpokeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.spokePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSpokeFromSpokeName', () => { + const result = client.matchSpokeFromSpokeName(fakePath); + assert.strictEqual(result, "spokeValue"); + assert((client.pathTemplates.spokePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('vpnTunnel', () => { + const fakePath = "/rendered/path/vpnTunnel"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + resource_id: "resourceIdValue", + }; + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.vpnTunnelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.vpnTunnelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('vpnTunnelPath', () => { + const result = client.vpnTunnelPath("projectValue", "regionValue", "resourceIdValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.vpnTunnelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromVpnTunnelName', () => { + const result = client.matchProjectFromVpnTunnelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromVpnTunnelName', () => { + const result = client.matchRegionFromVpnTunnelName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchResourceIdFromVpnTunnelName', () => { + const result = client.matchResourceIdFromVpnTunnelName(fakePath); + assert.strictEqual(result, "resourceIdValue"); + assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/tsconfig.json b/owl-bot-staging/google-cloud-networkconnectivity/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/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-networkconnectivity/v1/webpack.config.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/webpack.config.js new file mode 100644 index 00000000000..2412b4e375c --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/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: 'HubService', + filename: './hub-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-networkconnectivity/v1alpha1/.eslintignore b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.eslintrc.json b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.gitignore b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.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-networkconnectivity/v1alpha1/.jsdoc.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.jsdoc.js new file mode 100644 index 00000000000..37865cfe2ea --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.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/network-connectivity', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.mocharc.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.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-networkconnectivity/v1alpha1/.prettierrc.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.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-networkconnectivity/v1alpha1/README.md b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/README.md new file mode 100644 index 00000000000..086026da9e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/README.md @@ -0,0 +1 @@ +Networkconnectivity: Nodejs Client diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/package.json b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/package.json new file mode 100644 index 00000000000..3944e98cf57 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/network-connectivity", + "version": "0.1.0", + "description": "Networkconnectivity client for Node.js", + "repository": "googleapis/nodejs-networkconnectivity", + "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 networkconnectivity", + "networkconnectivity", + "hub service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/common.proto b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/common.proto new file mode 100644 index 00000000000..1ef4b4714da --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/common.proto @@ -0,0 +1,55 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.networkconnectivity.v1alpha1; + +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1Alpha1"; +option go_package = "cloud.google.com/go/networkconnectivity/apiv1alpha1/networkconnectivitypb;networkconnectivitypb"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.cloud.networkconnectivity.v1alpha1"; +option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1alpha1"; +option ruby_package = "Google::Cloud::NetworkConnectivity::V1alpha1"; + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/hub.proto b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/hub.proto new file mode 100644 index 00000000000..72875cfb66e --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/hub.proto @@ -0,0 +1,551 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.networkconnectivity.v1alpha1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1Alpha1"; +option go_package = "cloud.google.com/go/networkconnectivity/apiv1alpha1/networkconnectivitypb;networkconnectivitypb"; +option java_multiple_files = true; +option java_outer_classname = "HubProto"; +option java_package = "com.google.cloud.networkconnectivity.v1alpha1"; +option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1alpha1"; +option ruby_package = "Google::Cloud::NetworkConnectivity::V1alpha1"; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/VpnTunnel" + pattern: "projects/{project}/regions/{region}/vpnTunnels/{resource_id}" +}; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/InterconnectAttachment" + pattern: "projects/{project}/regions/{region}/interconnectAttachments/{resource_id}" +}; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Instance" + pattern: "projects/{project}/zones/{zone}/instances/{instance}" +}; + +// Network Connectivity Center is a hub-and-spoke abstraction for +// network connectivity management in Google Cloud. It reduces +// operational complexity through a simple, centralized connectivity management +// model. +service HubService { + option (google.api.default_host) = "networkconnectivity.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists Hubs in a given project and location. + rpc ListHubs(ListHubsRequest) returns (ListHubsResponse) { + option (google.api.http) = { + get: "/v1alpha1/{parent=projects/*/locations/global}/hubs" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single Hub. + rpc GetHub(GetHubRequest) returns (Hub) { + option (google.api.http) = { + get: "/v1alpha1/{name=projects/*/locations/global/hubs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new Hub in a given project and location. + rpc CreateHub(CreateHubRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha1/{parent=projects/*/locations/global}/hubs" + body: "hub" + }; + option (google.api.method_signature) = "parent,hub,hub_id"; + option (google.longrunning.operation_info) = { + response_type: "Hub" + metadata_type: "OperationMetadata" + }; + } + + // Updates the parameters of a single Hub. + rpc UpdateHub(UpdateHubRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1alpha1/{hub.name=projects/*/locations/global/hubs/*}" + body: "hub" + }; + option (google.api.method_signature) = "hub,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Hub" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a single Hub. + rpc DeleteHub(DeleteHubRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1alpha1/{name=projects/*/locations/global/hubs/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Lists Spokes in a given project and location. + rpc ListSpokes(ListSpokesRequest) returns (ListSpokesResponse) { + option (google.api.http) = { + get: "/v1alpha1/{parent=projects/*/locations/*}/spokes" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single Spoke. + rpc GetSpoke(GetSpokeRequest) returns (Spoke) { + option (google.api.http) = { + get: "/v1alpha1/{name=projects/*/locations/*/spokes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new Spoke in a given project and location. + rpc CreateSpoke(CreateSpokeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha1/{parent=projects/*/locations/*}/spokes" + body: "spoke" + }; + option (google.api.method_signature) = "parent,spoke,spoke_id"; + option (google.longrunning.operation_info) = { + response_type: "Spoke" + metadata_type: "OperationMetadata" + }; + } + + // Updates the parameters of a single Spoke. + rpc UpdateSpoke(UpdateSpokeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1alpha1/{spoke.name=projects/*/locations/*/spokes/*}" + body: "spoke" + }; + option (google.api.method_signature) = "spoke,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Spoke" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a single Spoke. + rpc DeleteSpoke(DeleteSpokeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1alpha1/{name=projects/*/locations/*/spokes/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } +} + +// Network Connectivity Center is a hub-and-spoke abstraction for +// network connectivity management in Google Cloud. It reduces +// operational complexity through a simple, centralized connectivity management +// model. Following is the resource message of a hub. +message Hub { + option (google.api.resource) = { + type: "networkconnectivity.googleapis.com/Hub" + pattern: "projects/{project}/locations/global/hubs/{hub}" + }; + + // Immutable. The name of a Hub resource. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Time when the Hub was created. + google.protobuf.Timestamp create_time = 2; + + // Time when the Hub was updated. + google.protobuf.Timestamp update_time = 3; + + // User-defined labels. + map labels = 4; + + // Short description of the hub resource. + string description = 5; + + // Output only. A list of the URIs of all attached spokes + repeated string spokes = 6 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Spoke" + } + ]; + + // Output only. Google-generated UUID for this resource. This is unique across all Hub + // resources. If a Hub resource is deleted and another with the same name is + // created, it gets a different unique_id. + string unique_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current lifecycle state of this Hub. + State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A Spoke is an abstraction of a network attachment being attached +// to a Hub. A Spoke can be underlying a VPN tunnel, a +// VLAN (interconnect) attachment, a Router appliance, etc. +message Spoke { + option (google.api.resource) = { + type: "networkconnectivity.googleapis.com/Spoke" + pattern: "projects/{project}/locations/{location}/spokes/{spoke}" + }; + + // Immutable. The name of a Spoke resource. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // The time when the Spoke was created. + google.protobuf.Timestamp create_time = 2; + + // The time when the Spoke was updated. + google.protobuf.Timestamp update_time = 3; + + // User-defined labels. + map labels = 4; + + // Short description of the spoke resource + string description = 5; + + // The resource URL of the hub resource that the spoke is attached to + string hub = 6 [(google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Hub" + }]; + + // The URIs of linked VPN tunnel resources + repeated string linked_vpn_tunnels = 12 [(google.api.resource_reference) = { + type: "compute.googleapis.com/VpnTunnel" + }]; + + // The URIs of linked interconnect attachment resources + repeated string linked_interconnect_attachments = 13 [(google.api.resource_reference) = { + type: "compute.googleapis.com/InterconnectAttachment" + }]; + + // The URIs of linked Router appliance resources + repeated RouterApplianceInstance linked_router_appliance_instances = 14; + + // Output only. Google-generated UUID for this resource. This is unique across all Spoke + // resources. If a Spoke resource is deleted and another with the same name is + // created, it gets a different unique_id. + string unique_id = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current lifecycle state of this Hub. + State state = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request for [HubService.ListHubs][google.cloud.networkconnectivity.v1alpha1.HubService.ListHubs] method. +message ListHubsRequest { + // Required. The parent resource's name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of results per page that should be returned. + int32 page_size = 2; + + // The page token. + string page_token = 3; + + // A filter expression that filters the results listed in the response. + string filter = 4; + + // Sort the results by a certain order. + string order_by = 5; +} + +// Response for [HubService.ListHubs][google.cloud.networkconnectivity.v1alpha1.HubService.ListHubs] method. +message ListHubsResponse { + // Hubs to be returned. + repeated Hub hubs = 1; + + // The next pagination token in the List response. It should be used as + // page_token for the following request. An empty value means no more result. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request for [HubService.GetHub][google.cloud.networkconnectivity.v1alpha1.HubService.GetHub] method. +message GetHubRequest { + // Required. Name of the Hub resource to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Hub" + } + ]; +} + +// Request for [HubService.CreateHub][google.cloud.networkconnectivity.v1alpha1.HubService.CreateHub] method. +message CreateHubRequest { + // Required. The parent resource's name of the Hub. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Unique id for the Hub to create. + string hub_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Initial values for a new Hub. + Hub hub = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for [HubService.UpdateHub][google.cloud.networkconnectivity.v1alpha1.HubService.UpdateHub] method. +message UpdateHubRequest { + // Optional. Field mask is used to specify the fields to be overwritten in the + // Hub resource by the update. + // The fields specified in the update_mask are relative to the resource, not + // the full request. A field will be overwritten if it is in the mask. If the + // user does not provide a mask then all fields will be overwritten. + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The state that the Hub should be in after the update. + Hub hub = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request for [HubService.DeleteHub][google.cloud.networkconnectivity.v1alpha1.HubService.DeleteHub]. +message DeleteHubRequest { + // Required. The name of the Hub to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Hub" + } + ]; + + // Optional. An optional request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request for [HubService.ListSpokes][google.cloud.networkconnectivity.v1alpha1.HubService.ListSpokes]. +message ListSpokesRequest { + // Required. The parent's resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of results per page that should be returned. + int32 page_size = 2; + + // The page token. + string page_token = 3; + + // A filter expression that filters the results listed in the response. + string filter = 4; + + // Sort the results by a certain order. + string order_by = 5; +} + +// The response for [HubService.ListSpokes][google.cloud.networkconnectivity.v1alpha1.HubService.ListSpokes]. +message ListSpokesResponse { + // Spokes to be returned. + repeated Spoke spokes = 1; + + // The next pagination token in the List response. It should be used as + // page_token for the following request. An empty value means no more result. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// The request for [HubService.GetSpoke][google.cloud.networkconnectivity.v1alpha1.HubService.GetSpoke]. +message GetSpokeRequest { + // Required. The name of Spoke resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Spoke" + } + ]; +} + +// The request for [HubService.CreateSpoke][google.cloud.networkconnectivity.v1alpha1.HubService.CreateSpoke]. +message CreateSpokeRequest { + // Required. The parent's resource name of the Spoke. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Unique id for the Spoke to create. + string spoke_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Initial values for a new Hub. + Spoke spoke = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for [HubService.UpdateSpoke][google.cloud.networkconnectivity.v1alpha1.HubService.UpdateSpoke] method. +message UpdateSpokeRequest { + // Optional. Field mask is used to specify the fields to be overwritten in the + // Spoke resource by the update. + // The fields specified in the update_mask are relative to the resource, not + // the full request. A field will be overwritten if it is in the mask. If the + // user does not provide a mask then all fields will be overwritten. + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The state that the Spoke should be in after the update. + Spoke spoke = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request for [HubService.DeleteSpoke][google.cloud.networkconnectivity.v1alpha1.HubService.DeleteSpoke]. +message DeleteSpokeRequest { + // Required. The name of the Spoke to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Spoke" + } + ]; + + // Optional. An optional request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// RouterAppliance represents a Router appliance which is specified by a VM URI +// and a NIC address. +message RouterApplianceInstance { + // The URI of the virtual machine resource + string virtual_machine = 1 [(google.api.resource_reference) = { + type: "compute.googleapis.com/Instance" + }]; + + // The IP address of the network interface to use for peering. + string ip_address = 3; + + string network_interface = 2 [deprecated = true]; +} + +// The State enum represents the lifecycle of a Network Connectivity Center +// resource. +enum State { + // No state information available + STATE_UNSPECIFIED = 0; + + // The resource's create operation is in progress + CREATING = 1; + + // The resource is active + ACTIVE = 2; + + // The resource's Delete operation is in progress + DELETING = 3; +} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.create_hub.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.create_hub.js new file mode 100644 index 00000000000..c8b5d34acc1 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.create_hub.js @@ -0,0 +1,85 @@ +// 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, hub) { + // [START networkconnectivity_v1alpha1_generated_HubService_CreateHub_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 parent resource's name of the Hub. + */ + // const parent = 'abc123' + /** + * Optional. Unique id for the Hub to create. + */ + // const hubId = 'abc123' + /** + * Required. Initial values for a new Hub. + */ + // const hub = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callCreateHub() { + // Construct request + const request = { + parent, + hub, + }; + + // Run request + const [operation] = await networkconnectivityClient.createHub(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateHub(); + // [END networkconnectivity_v1alpha1_generated_HubService_CreateHub_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.create_spoke.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.create_spoke.js new file mode 100644 index 00000000000..343d50b558f --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.create_spoke.js @@ -0,0 +1,85 @@ +// 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, spoke) { + // [START networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_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 parent's resource name of the Spoke. + */ + // const parent = 'abc123' + /** + * Optional. Unique id for the Spoke to create. + */ + // const spokeId = 'abc123' + /** + * Required. Initial values for a new Hub. + */ + // const spoke = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callCreateSpoke() { + // Construct request + const request = { + parent, + spoke, + }; + + // Run request + const [operation] = await networkconnectivityClient.createSpoke(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateSpoke(); + // [END networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.delete_hub.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.delete_hub.js new file mode 100644 index 00000000000..93c03c92be0 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.delete_hub.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(name) { + // [START networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Hub to delete. + */ + // const name = 'abc123' + /** + * Optional. An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callDeleteHub() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networkconnectivityClient.deleteHub(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteHub(); + // [END networkconnectivity_v1alpha1_generated_HubService_DeleteHub_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.delete_spoke.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.delete_spoke.js new file mode 100644 index 00000000000..cca64f13b62 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.delete_spoke.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(name) { + // [START networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Spoke to delete. + */ + // const name = 'abc123' + /** + * Optional. An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callDeleteSpoke() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networkconnectivityClient.deleteSpoke(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteSpoke(); + // [END networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.get_hub.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.get_hub.js new file mode 100644 index 00000000000..9e6f1b3936f --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.get_hub.js @@ -0,0 +1,61 @@ +// 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 networkconnectivity_v1alpha1_generated_HubService_GetHub_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 Hub resource to get. + */ + // const name = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callGetHub() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await networkconnectivityClient.getHub(request); + console.log(response); + } + + callGetHub(); + // [END networkconnectivity_v1alpha1_generated_HubService_GetHub_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.get_spoke.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.get_spoke.js new file mode 100644 index 00000000000..bb562af924c --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.get_spoke.js @@ -0,0 +1,61 @@ +// 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 networkconnectivity_v1alpha1_generated_HubService_GetSpoke_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of Spoke resource. + */ + // const name = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callGetSpoke() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await networkconnectivityClient.getSpoke(request); + console.log(response); + } + + callGetSpoke(); + // [END networkconnectivity_v1alpha1_generated_HubService_GetSpoke_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.list_hubs.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.list_hubs.js new file mode 100644 index 00000000000..0d356f939a3 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.list_hubs.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 networkconnectivity_v1alpha1_generated_HubService_ListHubs_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 parent resource's name. + */ + // const parent = 'abc123' + /** + * The maximum number of results per page that should be returned. + */ + // const pageSize = 1234 + /** + * The page token. + */ + // const pageToken = 'abc123' + /** + * A filter expression that filters the results listed in the response. + */ + // const filter = 'abc123' + /** + * Sort the results by a certain order. + */ + // const orderBy = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callListHubs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await networkconnectivityClient.listHubsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListHubs(); + // [END networkconnectivity_v1alpha1_generated_HubService_ListHubs_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.list_spokes.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.list_spokes.js new file mode 100644 index 00000000000..4cb6315bb83 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.list_spokes.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 networkconnectivity_v1alpha1_generated_HubService_ListSpokes_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 parent's resource name. + */ + // const parent = 'abc123' + /** + * The maximum number of results per page that should be returned. + */ + // const pageSize = 1234 + /** + * The page token. + */ + // const pageToken = 'abc123' + /** + * A filter expression that filters the results listed in the response. + */ + // const filter = 'abc123' + /** + * Sort the results by a certain order. + */ + // const orderBy = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callListSpokes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await networkconnectivityClient.listSpokesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSpokes(); + // [END networkconnectivity_v1alpha1_generated_HubService_ListSpokes_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.update_hub.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.update_hub.js new file mode 100644 index 00000000000..cced7221ab6 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.update_hub.js @@ -0,0 +1,84 @@ +// 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(hub) { + // [START networkconnectivity_v1alpha1_generated_HubService_UpdateHub_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. + */ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Hub resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + */ + // const updateMask = {} + /** + * Required. The state that the Hub should be in after the update. + */ + // const hub = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callUpdateHub() { + // Construct request + const request = { + hub, + }; + + // Run request + const [operation] = await networkconnectivityClient.updateHub(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateHub(); + // [END networkconnectivity_v1alpha1_generated_HubService_UpdateHub_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.update_spoke.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.update_spoke.js new file mode 100644 index 00000000000..bbd35a85eea --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.update_spoke.js @@ -0,0 +1,84 @@ +// 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(spoke) { + // [START networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_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. + */ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Spoke resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + */ + // const updateMask = {} + /** + * Required. The state that the Spoke should be in after the update. + */ + // const spoke = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callUpdateSpoke() { + // Construct request + const request = { + spoke, + }; + + // Run request + const [operation] = await networkconnectivityClient.updateSpoke(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateSpoke(); + // [END networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/snippet_metadata_google.cloud.networkconnectivity.v1alpha1.json b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/snippet_metadata_google.cloud.networkconnectivity.v1alpha1.json new file mode 100644 index 00000000000..9aa3324b1dd --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/snippet_metadata_google.cloud.networkconnectivity.v1alpha1.json @@ -0,0 +1,495 @@ +{ + "clientLibrary": { + "name": "nodejs-networkconnectivity", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.networkconnectivity.v1alpha1", + "version": "v1alpha1" + } + ] + }, + "snippets": [ + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_ListHubs_async", + "title": "HubService listHubs Sample", + "origin": "API_DEFINITION", + "description": " Lists Hubs in a given project and location.", + "canonical": true, + "file": "hub_service.list_hubs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListHubs", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.ListHubs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkconnectivity.v1alpha1.ListHubsResponse", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "ListHubs", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.ListHubs", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_GetHub_async", + "title": "HubService getHub Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single Hub.", + "canonical": true, + "file": "hub_service.get_hub.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetHub", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.GetHub", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkconnectivity.v1alpha1.Hub", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "GetHub", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.GetHub", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_CreateHub_async", + "title": "HubService createHub Sample", + "origin": "API_DEFINITION", + "description": " Creates a new Hub in a given project and location.", + "canonical": true, + "file": "hub_service.create_hub.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateHub", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.CreateHub", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "hub_id", + "type": "TYPE_STRING" + }, + { + "name": "hub", + "type": ".google.cloud.networkconnectivity.v1alpha1.Hub" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "CreateHub", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.CreateHub", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_UpdateHub_async", + "title": "HubService updateHub Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a single Hub.", + "canonical": true, + "file": "hub_service.update_hub.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateHub", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.UpdateHub", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "hub", + "type": ".google.cloud.networkconnectivity.v1alpha1.Hub" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "UpdateHub", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.UpdateHub", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async", + "title": "HubService deleteHub Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single Hub.", + "canonical": true, + "file": "hub_service.delete_hub.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteHub", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.DeleteHub", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "DeleteHub", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.DeleteHub", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_ListSpokes_async", + "title": "HubService listSpokes Sample", + "origin": "API_DEFINITION", + "description": " Lists Spokes in a given project and location.", + "canonical": true, + "file": "hub_service.list_spokes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSpokes", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.ListSpokes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkconnectivity.v1alpha1.ListSpokesResponse", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "ListSpokes", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.ListSpokes", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_GetSpoke_async", + "title": "HubService getSpoke Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single Spoke.", + "canonical": true, + "file": "hub_service.get_spoke.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSpoke", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.GetSpoke", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkconnectivity.v1alpha1.Spoke", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "GetSpoke", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.GetSpoke", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_async", + "title": "HubService createSpoke Sample", + "origin": "API_DEFINITION", + "description": " Creates a new Spoke in a given project and location.", + "canonical": true, + "file": "hub_service.create_spoke.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSpoke", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.CreateSpoke", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "spoke_id", + "type": "TYPE_STRING" + }, + { + "name": "spoke", + "type": ".google.cloud.networkconnectivity.v1alpha1.Spoke" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "CreateSpoke", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.CreateSpoke", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_async", + "title": "HubService updateSpoke Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a single Spoke.", + "canonical": true, + "file": "hub_service.update_spoke.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSpoke", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.UpdateSpoke", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "spoke", + "type": ".google.cloud.networkconnectivity.v1alpha1.Spoke" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "UpdateSpoke", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.UpdateSpoke", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async", + "title": "HubService deleteSpoke Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single Spoke.", + "canonical": true, + "file": "hub_service.delete_spoke.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSpoke", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.DeleteSpoke", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "DeleteSpoke", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.DeleteSpoke", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/index.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/index.ts new file mode 100644 index 00000000000..e31f63613d0 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/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 v1alpha1 from './v1alpha1'; +const HubServiceClient = v1alpha1.HubServiceClient; +type HubServiceClient = v1alpha1.HubServiceClient; +export {v1alpha1, HubServiceClient}; +export default {v1alpha1, HubServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/gapic_metadata.json b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/gapic_metadata.json new file mode 100644 index 00000000000..c9dd97f35eb --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/gapic_metadata.json @@ -0,0 +1,131 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.networkconnectivity.v1alpha1", + "libraryPackage": "@google-cloud/network-connectivity", + "services": { + "HubService": { + "clients": { + "grpc": { + "libraryClient": "HubServiceClient", + "rpcs": { + "GetHub": { + "methods": [ + "getHub" + ] + }, + "GetSpoke": { + "methods": [ + "getSpoke" + ] + }, + "CreateHub": { + "methods": [ + "createHub" + ] + }, + "UpdateHub": { + "methods": [ + "updateHub" + ] + }, + "DeleteHub": { + "methods": [ + "deleteHub" + ] + }, + "CreateSpoke": { + "methods": [ + "createSpoke" + ] + }, + "UpdateSpoke": { + "methods": [ + "updateSpoke" + ] + }, + "DeleteSpoke": { + "methods": [ + "deleteSpoke" + ] + }, + "ListHubs": { + "methods": [ + "listHubs", + "listHubsStream", + "listHubsAsync" + ] + }, + "ListSpokes": { + "methods": [ + "listSpokes", + "listSpokesStream", + "listSpokesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "HubServiceClient", + "rpcs": { + "GetHub": { + "methods": [ + "getHub" + ] + }, + "GetSpoke": { + "methods": [ + "getSpoke" + ] + }, + "CreateHub": { + "methods": [ + "createHub" + ] + }, + "UpdateHub": { + "methods": [ + "updateHub" + ] + }, + "DeleteHub": { + "methods": [ + "deleteHub" + ] + }, + "CreateSpoke": { + "methods": [ + "createSpoke" + ] + }, + "UpdateSpoke": { + "methods": [ + "updateSpoke" + ] + }, + "DeleteSpoke": { + "methods": [ + "deleteSpoke" + ] + }, + "ListHubs": { + "methods": [ + "listHubs", + "listHubsStream", + "listHubsAsync" + ] + }, + "ListSpokes": { + "methods": [ + "listSpokes", + "listSpokesStream", + "listSpokesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_client.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_client.ts new file mode 100644 index 00000000000..99a2070f087 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_client.ts @@ -0,0 +1,1829 @@ +// 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, GrpcClientOptions, LROperation, 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/v1alpha1/hub_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './hub_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Network Connectivity Center is a hub-and-spoke abstraction for + * network connectivity management in Google Cloud. It reduces + * operational complexity through a simple, centralized connectivity management + * model. + * @class + * @memberof v1alpha1 + */ +export class HubServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + hubServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of HubServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 HubServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof HubServiceClient; + 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 { + 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 = { + hubPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/global/hubs/{hub}' + ), + instancePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/zones/{zone}/instances/{instance}' + ), + interconnectAttachmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/interconnectAttachments/{resource_id}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + spokePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/spokes/{spoke}' + ), + vpnTunnelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/vpnTunnels/{resource_id}' + ), + }; + + // 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 = { + listHubs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'hubs'), + listSpokes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spokes') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha1/{resource=projects/*/locations/global/hubs/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha1/{resource=projects/*/locations/*/spokes/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha1/{resource=projects/*/locations/global/hubs/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/spokes/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha1/{resource=projects/*/locations/global/hubs/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/spokes/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createHubResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.Hub') as gax.protobuf.Type; + const createHubMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const updateHubResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.Hub') as gax.protobuf.Type; + const updateHubMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const deleteHubResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteHubMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const createSpokeResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.Spoke') as gax.protobuf.Type; + const createSpokeMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const updateSpokeResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.Spoke') as gax.protobuf.Type; + const updateSpokeMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const deleteSpokeResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteSpokeMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createHub: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createHubResponse.decode.bind(createHubResponse), + createHubMetadata.decode.bind(createHubMetadata)), + updateHub: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateHubResponse.decode.bind(updateHubResponse), + updateHubMetadata.decode.bind(updateHubMetadata)), + deleteHub: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteHubResponse.decode.bind(deleteHubResponse), + deleteHubMetadata.decode.bind(deleteHubMetadata)), + createSpoke: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createSpokeResponse.decode.bind(createSpokeResponse), + createSpokeMetadata.decode.bind(createSpokeMetadata)), + updateSpoke: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateSpokeResponse.decode.bind(updateSpokeResponse), + updateSpokeMetadata.decode.bind(updateSpokeMetadata)), + deleteSpoke: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteSpokeResponse.decode.bind(deleteSpokeResponse), + deleteSpokeMetadata.decode.bind(deleteSpokeMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.networkconnectivity.v1alpha1.HubService', 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.hubServiceStub) { + return this.hubServiceStub; + } + + // Put together the "service stub" for + // google.cloud.networkconnectivity.v1alpha1.HubService. + this.hubServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.networkconnectivity.v1alpha1.HubService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networkconnectivity.v1alpha1.HubService, + 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 hubServiceStubMethods = + ['listHubs', 'getHub', 'createHub', 'updateHub', 'deleteHub', 'listSpokes', 'getSpoke', 'createSpoke', 'updateSpoke', 'deleteSpoke']; + for (const methodName of hubServiceStubMethods) { + const callPromise = this.hubServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.hubServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'networkconnectivity.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 'networkconnectivity.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 -- + // ------------------- +/** + * Gets details of a single Hub. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the Hub resource to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.networkconnectivity.v1alpha1.Hub|Hub}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha1/hub_service.get_hub.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_GetHub_async + */ + getHub( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkconnectivity.v1alpha1.IHub, + protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|undefined, {}|undefined + ]>; + getHub( + request: protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networkconnectivity.v1alpha1.IHub, + protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|null|undefined, + {}|null|undefined>): void; + getHub( + request: protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, + callback: Callback< + protos.google.cloud.networkconnectivity.v1alpha1.IHub, + protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|null|undefined, + {}|null|undefined>): void; + getHub( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.networkconnectivity.v1alpha1.IHub, + protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.networkconnectivity.v1alpha1.IHub, + protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.networkconnectivity.v1alpha1.IHub, + protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|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.getHub(request, options, callback); + } +/** + * Gets details of a single Spoke. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of Spoke 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 protos.google.cloud.networkconnectivity.v1alpha1.Spoke|Spoke}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha1/hub_service.get_spoke.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_GetSpoke_async + */ + getSpoke( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, + protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|undefined, {}|undefined + ]>; + getSpoke( + request: protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, + protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|null|undefined, + {}|null|undefined>): void; + getSpoke( + request: protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest, + callback: Callback< + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, + protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|null|undefined, + {}|null|undefined>): void; + getSpoke( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, + protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, + protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, + protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|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.getSpoke(request, options, callback); + } + +/** + * Creates a new Hub in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource's name of the Hub. + * @param {string} [request.hubId] + * Optional. Unique id for the Hub to create. + * @param {google.cloud.networkconnectivity.v1alpha1.Hub} request.hub + * Required. Initial values for a new Hub. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha1/hub_service.create_hub.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_CreateHub_async + */ + createHub( + request?: protos.google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createHub( + request: protos.google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createHub( + request: protos.google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createHub( + request?: protos.google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createHub(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createHub()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha1/hub_service.create_hub.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_CreateHub_async + */ + async checkCreateHubProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createHub, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the parameters of a single Hub. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * Hub resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networkconnectivity.v1alpha1.Hub} request.hub + * Required. The state that the Hub should be in after the update. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha1/hub_service.update_hub.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_UpdateHub_async + */ + updateHub( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateHub( + request: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateHub( + request: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateHub( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'hub.name': request.hub!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateHub(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateHub()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha1/hub_service.update_hub.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_UpdateHub_async + */ + async checkUpdateHubProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateHub, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single Hub. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Hub to delete. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha1/hub_service.delete_hub.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async + */ + deleteHub( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteHubRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteHub( + request: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteHubRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteHub( + request: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteHubRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteHub( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteHubRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteHub(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteHub()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha1/hub_service.delete_hub.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async + */ + async checkDeleteHubProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteHub, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new Spoke in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent's resource name of the Spoke. + * @param {string} [request.spokeId] + * Optional. Unique id for the Spoke to create. + * @param {google.cloud.networkconnectivity.v1alpha1.Spoke} request.spoke + * Required. Initial values for a new Hub. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha1/hub_service.create_spoke.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_async + */ + createSpoke( + request?: protos.google.cloud.networkconnectivity.v1alpha1.ICreateSpokeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createSpoke( + request: protos.google.cloud.networkconnectivity.v1alpha1.ICreateSpokeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createSpoke( + request: protos.google.cloud.networkconnectivity.v1alpha1.ICreateSpokeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createSpoke( + request?: protos.google.cloud.networkconnectivity.v1alpha1.ICreateSpokeRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createSpoke(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createSpoke()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha1/hub_service.create_spoke.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_async + */ + async checkCreateSpokeProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createSpoke, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the parameters of a single Spoke. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * Spoke resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networkconnectivity.v1alpha1.Spoke} request.spoke + * Required. The state that the Spoke should be in after the update. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha1/hub_service.update_spoke.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_async + */ + updateSpoke( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateSpokeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateSpoke( + request: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateSpokeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateSpoke( + request: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateSpokeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateSpoke( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateSpokeRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'spoke.name': request.spoke!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSpoke(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateSpoke()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha1/hub_service.update_spoke.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_async + */ + async checkUpdateSpokeProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateSpoke, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single Spoke. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Spoke to delete. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha1/hub_service.delete_spoke.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async + */ + deleteSpoke( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteSpokeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteSpoke( + request: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteSpokeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteSpoke( + request: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteSpokeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteSpoke( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteSpokeRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteSpoke(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteSpoke()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha1/hub_service.delete_spoke.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async + */ + async checkDeleteSpokeProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteSpoke, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists Hubs in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource's name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * A filter expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.networkconnectivity.v1alpha1.Hub|Hub}. + * 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 `listHubsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listHubs( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkconnectivity.v1alpha1.IHub[], + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest|null, + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse + ]>; + listHubs( + request: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1alpha1.IHub>): void; + listHubs( + request: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1alpha1.IHub>): void; + listHubs( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1alpha1.IHub>, + callback?: PaginationCallback< + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1alpha1.IHub>): + Promise<[ + protos.google.cloud.networkconnectivity.v1alpha1.IHub[], + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest|null, + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listHubs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource's name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * A filter expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @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 protos.google.cloud.networkconnectivity.v1alpha1.Hub|Hub} 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 `listHubsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listHubsStream( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + 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['listHubs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listHubs.createStream( + this.innerApiCalls.listHubs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listHubs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource's name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * A filter expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.networkconnectivity.v1alpha1.Hub|Hub}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha1/hub_service.list_hubs.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_ListHubs_async + */ + listHubsAsync( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + 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['listHubs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listHubs.asyncIterate( + this.innerApiCalls['listHubs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists Spokes in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent's resource name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * A filter expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.networkconnectivity.v1alpha1.Spoke|Spoke}. + * 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 `listSpokesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listSpokes( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[], + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest|null, + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse + ]>; + listSpokes( + request: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke>): void; + listSpokes( + request: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke>): void; + listSpokes( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke>, + callback?: PaginationCallback< + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke>): + Promise<[ + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[], + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest|null, + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listSpokes(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent's resource name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * A filter expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @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 protos.google.cloud.networkconnectivity.v1alpha1.Spoke|Spoke} 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 `listSpokesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listSpokesStream( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + 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['listSpokes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSpokes.createStream( + this.innerApiCalls.listSpokes as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSpokes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent's resource name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * A filter expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.networkconnectivity.v1alpha1.Spoke|Spoke}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha1/hub_service.list_spokes.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_ListSpokes_async + */ + listSpokesAsync( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + 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['listSpokes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSpokes.asyncIterate( + this.innerApiCalls['listSpokes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified hub resource name string. + * + * @param {string} project + * @param {string} hub + * @returns {string} Resource name string. + */ + hubPath(project:string,hub:string) { + return this.pathTemplates.hubPathTemplate.render({ + project: project, + hub: hub, + }); + } + + /** + * Parse the project from Hub resource. + * + * @param {string} hubName + * A fully-qualified path representing Hub resource. + * @returns {string} A string representing the project. + */ + matchProjectFromHubName(hubName: string) { + return this.pathTemplates.hubPathTemplate.match(hubName).project; + } + + /** + * Parse the hub from Hub resource. + * + * @param {string} hubName + * A fully-qualified path representing Hub resource. + * @returns {string} A string representing the hub. + */ + matchHubFromHubName(hubName: string) { + return this.pathTemplates.hubPathTemplate.match(hubName).hub; + } + + /** + * Return a fully-qualified instance resource name string. + * + * @param {string} project + * @param {string} zone + * @param {string} instance + * @returns {string} Resource name string. + */ + instancePath(project:string,zone:string,instance:string) { + return this.pathTemplates.instancePathTemplate.render({ + project: project, + zone: zone, + instance: instance, + }); + } + + /** + * Parse the project from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).project; + } + + /** + * Parse the zone from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the zone. + */ + matchZoneFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).zone; + } + + /** + * Parse the instance from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).instance; + } + + /** + * Return a fully-qualified interconnectAttachment resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} resource_id + * @returns {string} Resource name string. + */ + interconnectAttachmentPath(project:string,region:string,resourceId:string) { + return this.pathTemplates.interconnectAttachmentPathTemplate.render({ + project: project, + region: region, + resource_id: resourceId, + }); + } + + /** + * Parse the project from InterconnectAttachment resource. + * + * @param {string} interconnectAttachmentName + * A fully-qualified path representing InterconnectAttachment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInterconnectAttachmentName(interconnectAttachmentName: string) { + return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).project; + } + + /** + * Parse the region from InterconnectAttachment resource. + * + * @param {string} interconnectAttachmentName + * A fully-qualified path representing InterconnectAttachment resource. + * @returns {string} A string representing the region. + */ + matchRegionFromInterconnectAttachmentName(interconnectAttachmentName: string) { + return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).region; + } + + /** + * Parse the resource_id from InterconnectAttachment resource. + * + * @param {string} interconnectAttachmentName + * A fully-qualified path representing InterconnectAttachment resource. + * @returns {string} A string representing the resource_id. + */ + matchResourceIdFromInterconnectAttachmentName(interconnectAttachmentName: string) { + return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).resource_id; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified spoke resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} spoke + * @returns {string} Resource name string. + */ + spokePath(project:string,location:string,spoke:string) { + return this.pathTemplates.spokePathTemplate.render({ + project: project, + location: location, + spoke: spoke, + }); + } + + /** + * Parse the project from Spoke resource. + * + * @param {string} spokeName + * A fully-qualified path representing Spoke resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSpokeName(spokeName: string) { + return this.pathTemplates.spokePathTemplate.match(spokeName).project; + } + + /** + * Parse the location from Spoke resource. + * + * @param {string} spokeName + * A fully-qualified path representing Spoke resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSpokeName(spokeName: string) { + return this.pathTemplates.spokePathTemplate.match(spokeName).location; + } + + /** + * Parse the spoke from Spoke resource. + * + * @param {string} spokeName + * A fully-qualified path representing Spoke resource. + * @returns {string} A string representing the spoke. + */ + matchSpokeFromSpokeName(spokeName: string) { + return this.pathTemplates.spokePathTemplate.match(spokeName).spoke; + } + + /** + * Return a fully-qualified vpnTunnel resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} resource_id + * @returns {string} Resource name string. + */ + vpnTunnelPath(project:string,region:string,resourceId:string) { + return this.pathTemplates.vpnTunnelPathTemplate.render({ + project: project, + region: region, + resource_id: resourceId, + }); + } + + /** + * Parse the project from VpnTunnel resource. + * + * @param {string} vpnTunnelName + * A fully-qualified path representing VpnTunnel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVpnTunnelName(vpnTunnelName: string) { + return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).project; + } + + /** + * Parse the region from VpnTunnel resource. + * + * @param {string} vpnTunnelName + * A fully-qualified path representing VpnTunnel resource. + * @returns {string} A string representing the region. + */ + matchRegionFromVpnTunnelName(vpnTunnelName: string) { + return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).region; + } + + /** + * Parse the resource_id from VpnTunnel resource. + * + * @param {string} vpnTunnelName + * A fully-qualified path representing VpnTunnel resource. + * @returns {string} A string representing the resource_id. + */ + matchResourceIdFromVpnTunnelName(vpnTunnelName: string) { + return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).resource_id; + } + + /** + * 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.hubServiceStub && !this._terminated) { + return this.hubServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_client_config.json b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_client_config.json new file mode 100644 index 00000000000..ac38b3fb814 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_client_config.json @@ -0,0 +1,88 @@ +{ + "interfaces": { + "google.cloud.networkconnectivity.v1alpha1.HubService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListHubs": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetHub": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateHub": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateHub": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteHub": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListSpokes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_proto_list.json b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_proto_list.json new file mode 100644 index 00000000000..af2e83266ef --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/networkconnectivity/v1alpha1/common.proto", + "../../protos/google/cloud/networkconnectivity/v1alpha1/hub.proto" +] diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/index.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/index.ts new file mode 100644 index 00000000000..937a411a485 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/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 {HubServiceClient} from './hub_service_client'; diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..d3cd46d0a96 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/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 networkconnectivity = require('@google-cloud/network-connectivity'); + +function main() { + const hubServiceClient = new networkconnectivity.HubServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..ae4d979ece8 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/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 {HubServiceClient} from '@google-cloud/network-connectivity'; + +// check that the client class type name can be used +function doStuffWithHubServiceClient(client: HubServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const hubServiceClient = new HubServiceClient(); + doStuffWithHubServiceClient(hubServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/install.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/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-networkconnectivity/v1alpha1/test/gapic_hub_service_v1alpha1.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/test/gapic_hub_service_v1alpha1.ts new file mode 100644 index 00000000000..7f17fc9d099 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/test/gapic_hub_service_v1alpha1.ts @@ -0,0 +1,2114 @@ +// 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 hubserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1alpha1.HubServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = hubserviceModule.v1alpha1.HubServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = hubserviceModule.v1alpha1.HubServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = hubserviceModule.v1alpha1.HubServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.hubServiceStub, undefined); + await client.initialize(); + assert(client.hubServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.hubServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.hubServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + 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 hubserviceModule.v1alpha1.HubServiceClient({ + 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('getHub', () => { + it('invokes getHub without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.GetHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.GetHubRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.Hub() + ); + client.innerApiCalls.getHub = stubSimpleCall(expectedResponse); + const [response] = await client.getHub(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getHub without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.GetHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.GetHubRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.Hub() + ); + client.innerApiCalls.getHub = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getHub( + request, + (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1alpha1.IHub|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getHub with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.GetHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.GetHubRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getHub = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getHub(request), expectedError); + const actualRequest = (client.innerApiCalls.getHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getHub with closed client', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.GetHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.GetHubRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getHub(request), expectedError); + }); + }); + + describe('getSpoke', () => { + it('invokes getSpoke without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.Spoke() + ); + client.innerApiCalls.getSpoke = stubSimpleCall(expectedResponse); + const [response] = await client.getSpoke(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSpoke without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.Spoke() + ); + client.innerApiCalls.getSpoke = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSpoke( + request, + (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSpoke with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSpoke = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSpoke(request), expectedError); + const actualRequest = (client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSpoke with closed client', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSpoke(request), expectedError); + }); + }); + + describe('createHub', () => { + it('invokes createHub without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createHub = stubLongRunningCall(expectedResponse); + const [operation] = await client.createHub(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createHub without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createHub = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createHub( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createHub with call error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createHub = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createHub(request), expectedError); + const actualRequest = (client.innerApiCalls.createHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createHub with LRO error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createHub = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createHub(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateHubProgress without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateHubProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateHubProgress with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateHubProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateHub', () => { + it('invokes updateHub without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest() + ); + request.hub ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest', ['hub', 'name']); + request.hub.name = defaultValue1; + const expectedHeaderRequestParams = `hub.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateHub = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateHub(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateHub without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest() + ); + request.hub ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest', ['hub', 'name']); + request.hub.name = defaultValue1; + const expectedHeaderRequestParams = `hub.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateHub = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateHub( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateHub with call error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest() + ); + request.hub ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest', ['hub', 'name']); + request.hub.name = defaultValue1; + const expectedHeaderRequestParams = `hub.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateHub = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateHub(request), expectedError); + const actualRequest = (client.innerApiCalls.updateHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateHub with LRO error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest() + ); + request.hub ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest', ['hub', 'name']); + request.hub.name = defaultValue1; + const expectedHeaderRequestParams = `hub.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateHub = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateHub(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateHubProgress without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateHubProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateHubProgress with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateHubProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteHub', () => { + it('invokes deleteHub without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteHub = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteHub(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteHub without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteHub = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteHub( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteHub with call error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteHub = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteHub(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteHub with LRO error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteHub = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteHub(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteHubProgress without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteHubProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteHubProgress with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteHubProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createSpoke', () => { + it('invokes createSpoke without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createSpoke = stubLongRunningCall(expectedResponse); + const [operation] = await client.createSpoke(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSpoke without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createSpoke = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSpoke( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSpoke with call error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSpoke = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createSpoke(request), expectedError); + const actualRequest = (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSpoke with LRO error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSpoke = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createSpoke(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateSpokeProgress without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateSpokeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateSpokeProgress with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateSpokeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateSpoke', () => { + it('invokes updateSpoke without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest() + ); + request.spoke ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest', ['spoke', 'name']); + request.spoke.name = defaultValue1; + const expectedHeaderRequestParams = `spoke.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateSpoke = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSpoke(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSpoke without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest() + ); + request.spoke ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest', ['spoke', 'name']); + request.spoke.name = defaultValue1; + const expectedHeaderRequestParams = `spoke.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateSpoke = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSpoke( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSpoke with call error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest() + ); + request.spoke ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest', ['spoke', 'name']); + request.spoke.name = defaultValue1; + const expectedHeaderRequestParams = `spoke.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSpoke = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateSpoke(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSpoke with LRO error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest() + ); + request.spoke ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest', ['spoke', 'name']); + request.spoke.name = defaultValue1; + const expectedHeaderRequestParams = `spoke.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSpoke = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateSpoke(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateSpokeProgress without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateSpokeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateSpokeProgress with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateSpokeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteSpoke', () => { + it('invokes deleteSpoke without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteSpoke = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSpoke(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSpoke without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteSpoke = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSpoke( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSpoke with call error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSpoke = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteSpoke(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSpoke with LRO error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSpoke = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteSpoke(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteSpokeProgress without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteSpokeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteSpokeProgress with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteSpokeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listHubs', () => { + it('invokes listHubs without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + ]; + client.innerApiCalls.listHubs = stubSimpleCall(expectedResponse); + const [response] = await client.listHubs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listHubs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listHubs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listHubs without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + ]; + client.innerApiCalls.listHubs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listHubs( + request, + (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1alpha1.IHub[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listHubs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listHubs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listHubs with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listHubs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listHubs(request), expectedError); + const actualRequest = (client.innerApiCalls.listHubs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listHubs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listHubsStream without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + ]; + client.descriptors.page.listHubs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listHubsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1alpha1.Hub[] = []; + stream.on('data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Hub) => { + 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.listHubs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listHubs, request)); + assert( + (client.descriptors.page.listHubs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listHubsStream with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listHubs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listHubsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1alpha1.Hub[] = []; + stream.on('data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Hub) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listHubs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listHubs, request)); + assert( + (client.descriptors.page.listHubs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listHubs without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + ]; + client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networkconnectivity.v1alpha1.IHub[] = []; + const iterable = client.listHubsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listHubs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listHubs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listHubs with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listHubsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networkconnectivity.v1alpha1.IHub[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listHubs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listHubs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listSpokes', () => { + it('invokes listSpokes without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + ]; + client.innerApiCalls.listSpokes = stubSimpleCall(expectedResponse); + const [response] = await client.listSpokes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSpokes without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + ]; + client.innerApiCalls.listSpokes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSpokes( + request, + (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSpokes with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSpokes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSpokes(request), expectedError); + const actualRequest = (client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSpokesStream without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + ]; + client.descriptors.page.listSpokes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSpokesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1alpha1.Spoke[] = []; + stream.on('data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Spoke) => { + 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.listSpokes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSpokes, request)); + assert( + (client.descriptors.page.listSpokes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listSpokesStream with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSpokes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSpokesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1alpha1.Spoke[] = []; + stream.on('data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Spoke) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSpokes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSpokes, request)); + assert( + (client.descriptors.page.listSpokes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSpokes without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + ]; + client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[] = []; + const iterable = client.listSpokesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSpokes with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSpokesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('hub', () => { + const fakePath = "/rendered/path/hub"; + const expectedParameters = { + project: "projectValue", + hub: "hubValue", + }; + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.hubPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.hubPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('hubPath', () => { + const result = client.hubPath("projectValue", "hubValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.hubPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromHubName', () => { + const result = client.matchProjectFromHubName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.hubPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchHubFromHubName', () => { + const result = client.matchHubFromHubName(fakePath); + assert.strictEqual(result, "hubValue"); + assert((client.pathTemplates.hubPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('instance', () => { + const fakePath = "/rendered/path/instance"; + const expectedParameters = { + project: "projectValue", + zone: "zoneValue", + instance: "instanceValue", + }; + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.instancePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath("projectValue", "zoneValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchZoneFromInstanceName', () => { + const result = client.matchZoneFromInstanceName(fakePath); + assert.strictEqual(result, "zoneValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('interconnectAttachment', () => { + const fakePath = "/rendered/path/interconnectAttachment"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + resource_id: "resourceIdValue", + }; + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.interconnectAttachmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interconnectAttachmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interconnectAttachmentPath', () => { + const result = client.interconnectAttachmentPath("projectValue", "regionValue", "resourceIdValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.interconnectAttachmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInterconnectAttachmentName', () => { + const result = client.matchProjectFromInterconnectAttachmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromInterconnectAttachmentName', () => { + const result = client.matchRegionFromInterconnectAttachmentName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchResourceIdFromInterconnectAttachmentName', () => { + const result = client.matchResourceIdFromInterconnectAttachmentName(fakePath); + assert.strictEqual(result, "resourceIdValue"); + assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('spoke', () => { + const fakePath = "/rendered/path/spoke"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + spoke: "spokeValue", + }; + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.spokePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.spokePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('spokePath', () => { + const result = client.spokePath("projectValue", "locationValue", "spokeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.spokePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSpokeName', () => { + const result = client.matchProjectFromSpokeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.spokePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromSpokeName', () => { + const result = client.matchLocationFromSpokeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.spokePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSpokeFromSpokeName', () => { + const result = client.matchSpokeFromSpokeName(fakePath); + assert.strictEqual(result, "spokeValue"); + assert((client.pathTemplates.spokePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('vpnTunnel', () => { + const fakePath = "/rendered/path/vpnTunnel"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + resource_id: "resourceIdValue", + }; + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.vpnTunnelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.vpnTunnelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('vpnTunnelPath', () => { + const result = client.vpnTunnelPath("projectValue", "regionValue", "resourceIdValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.vpnTunnelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromVpnTunnelName', () => { + const result = client.matchProjectFromVpnTunnelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromVpnTunnelName', () => { + const result = client.matchRegionFromVpnTunnelName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchResourceIdFromVpnTunnelName', () => { + const result = client.matchResourceIdFromVpnTunnelName(fakePath); + assert.strictEqual(result, "resourceIdValue"); + assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/tsconfig.json b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/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-networkconnectivity/v1alpha1/webpack.config.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/webpack.config.js new file mode 100644 index 00000000000..2412b4e375c --- /dev/null +++ b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/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: 'HubService', + filename: './hub-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-networkmanagement/v1/.eslintignore b/owl-bot-staging/google-cloud-networkmanagement/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/.eslintrc.json b/owl-bot-staging/google-cloud-networkmanagement/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/.gitignore b/owl-bot-staging/google-cloud-networkmanagement/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1/.jsdoc.js b/owl-bot-staging/google-cloud-networkmanagement/v1/.jsdoc.js new file mode 100644 index 00000000000..d081790c646 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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/network-management', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/.mocharc.js b/owl-bot-staging/google-cloud-networkmanagement/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1/.prettierrc.js b/owl-bot-staging/google-cloud-networkmanagement/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1/README.md b/owl-bot-staging/google-cloud-networkmanagement/v1/README.md new file mode 100644 index 00000000000..90c3778ad46 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/README.md @@ -0,0 +1 @@ +Networkmanagement: Nodejs Client diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/package.json b/owl-bot-staging/google-cloud-networkmanagement/v1/package.json new file mode 100644 index 00000000000..70e771ee9ed --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/network-management", + "version": "0.1.0", + "description": "Networkmanagement client for Node.js", + "repository": "googleapis/nodejs-networkmanagement", + "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 networkmanagement", + "networkmanagement", + "reachability service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/connectivity_test.proto b/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/connectivity_test.proto new file mode 100644 index 00000000000..7bbdef65d38 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/connectivity_test.proto @@ -0,0 +1,405 @@ +// 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 +// +// 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.networkmanagement.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/networkmanagement/v1/trace.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.NetworkManagement.V1"; +option go_package = "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb;networkmanagementpb"; +option java_multiple_files = true; +option java_outer_classname = "TestOuterClass"; +option java_package = "com.google.cloud.networkmanagement.v1"; +option php_namespace = "Google\\Cloud\\NetworkManagement\\V1"; +option ruby_package = "Google::Cloud::NetworkManagement::V1"; + +// A Connectivity Test for a network reachability analysis. +message ConnectivityTest { + option (google.api.resource) = { + type: "networkmanagement.googleapis.com/ConnectivityTest" + pattern: "projects/{project}/locations/global/connectivityTests/{test}" + }; + + // Required. Unique name of the resource using the form: + // `projects/{project_id}/locations/global/connectivityTests/{test}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // The user-supplied description of the Connectivity Test. + // Maximum of 512 characters. + string description = 2; + + // Required. Source specification of the Connectivity Test. + // + // You can use a combination of source IP address, virtual machine + // (VM) instance, or Compute Engine network to uniquely identify + // the source location. + // + // Examples: + // If the source IP address is an internal IP address within a Google Cloud + // Virtual Private Cloud (VPC) network, then you must also specify the VPC + // network. Otherwise, specify the VM instance, which already contains its + // internal IP address and VPC network information. + // + // If the source of the test is within an on-premises network, then you must + // provide the destination VPC network. + // + // If the source endpoint is a Compute Engine VM instance with multiple + // network interfaces, the instance itself is not sufficient to identify the + // endpoint. So, you must also specify the source IP address or VPC network. + // + // A reachability analysis proceeds even if the source location is + // ambiguous. However, the test result may include endpoints that you don't + // intend to test. + Endpoint source = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Destination specification of the Connectivity Test. + // + // You can use a combination of destination IP address, Compute Engine + // VM instance, or VPC network to uniquely identify the destination + // location. + // + // Even if the destination IP address is not unique, the source IP + // location is unique. Usually, the analysis can infer the destination + // endpoint from route information. + // + // If the destination you specify is a VM instance and the instance has + // multiple network interfaces, then you must also specify either + // a destination IP address or VPC network to identify the destination + // interface. + // + // A reachability analysis proceeds even if the destination location is + // ambiguous. However, the result can include endpoints that you don't + // intend to test. + Endpoint destination = 4 [(google.api.field_behavior) = REQUIRED]; + + // IP Protocol of the test. When not provided, "TCP" is assumed. + string protocol = 5; + + // Other projects that may be relevant for reachability analysis. + // This is applicable to scenarios where a test can cross project boundaries. + repeated string related_projects = 6; + + // Output only. The display name of a Connectivity Test. + string display_name = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Resource labels to represent user-provided metadata. + map labels = 8; + + // Output only. The time the test was created. + google.protobuf.Timestamp create_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the test's configuration was updated. + google.protobuf.Timestamp update_time = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The reachability details of this test from the latest run. + // The details are updated when creating a new test, updating an + // existing test, or triggering a one-time rerun of an existing test. + ReachabilityDetails reachability_details = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The probing details of this test from the latest run, present + // for applicable tests only. The details are updated when creating a new + // test, updating an existing test, or triggering a one-time rerun of an + // existing test. + ProbingDetails probing_details = 14 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Source or destination of the Connectivity Test. +message Endpoint { + // The type definition of an endpoint's network. Use one of the + // following choices: + enum NetworkType { + // Default type if unspecified. + NETWORK_TYPE_UNSPECIFIED = 0; + + // A network hosted within Google Cloud. + // To receive more detailed output, specify the URI for the source or + // destination network. + GCP_NETWORK = 1; + + // A network hosted outside of Google Cloud. + // This can be an on-premises network, or a network hosted by another cloud + // provider. + NON_GCP_NETWORK = 2; + } + + // Type of the target of a forwarding rule. + enum ForwardingRuleTarget { + // Forwarding rule target is unknown. + FORWARDING_RULE_TARGET_UNSPECIFIED = 0; + + // Compute Engine instance for protocol forwarding. + INSTANCE = 1; + + // Load Balancer. The specific type can be found from [load_balancer_type] + // [google.cloud.networkmanagement.v1.Endpoint.load_balancer_type]. + LOAD_BALANCER = 2; + + // Classic Cloud VPN Gateway. + VPN_GATEWAY = 3; + + // Forwarding Rule is a Private Service Connect endpoint. + PSC = 4; + } + + // Wrapper for Cloud Function attributes. + message CloudFunctionEndpoint { + // A [Cloud Function](https://cloud.google.com/functions) name. + string uri = 1; + } + + // Wrapper for the App Engine service version attributes. + message AppEngineVersionEndpoint { + // An [App Engine](https://cloud.google.com/appengine) [service + // version](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions) + // name. + string uri = 1; + } + + // Wrapper for Cloud Run revision attributes. + message CloudRunRevisionEndpoint { + // A [Cloud Run](https://cloud.google.com/run) + // [revision](https://cloud.google.com/run/docs/reference/rest/v1/namespaces.revisions/get) + // URI. The format is: + // projects/{project}/locations/{location}/revisions/{revision} + string uri = 1; + } + + // The IP address of the endpoint, which can be an external or internal IP. + // An IPv6 address is only allowed when the test's destination is a + // [global load balancer + // VIP](https://cloud.google.com/load-balancing/docs/load-balancing-overview). + string ip_address = 1; + + // The IP protocol port of the endpoint. + // Only applicable when protocol is TCP or UDP. + int32 port = 2; + + // A Compute Engine instance URI. + string instance = 3; + + // A forwarding rule and its corresponding IP address represent the frontend + // configuration of a Google Cloud load balancer. Forwarding rules are also + // used for protocol forwarding, Private Service Connect and other network + // services to provide forwarding information in the control plane. Format: + // projects/{project}/global/forwardingRules/{id} or + // projects/{project}/regions/{region}/forwardingRules/{id} + string forwarding_rule = 13; + + // Output only. Specifies the type of the target of the forwarding rule. + optional ForwardingRuleTarget forwarding_rule_target = 14 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. ID of the load balancer the forwarding rule points to. Empty + // for forwarding rules not related to load balancers. + optional string load_balancer_id = 15 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Type of the load balancer the forwarding rule points to. + optional LoadBalancerType load_balancer_type = 16 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A cluster URI for [Google Kubernetes Engine + // master](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-architecture). + string gke_master_cluster = 7; + + // A [Cloud SQL](https://cloud.google.com/sql) instance URI. + string cloud_sql_instance = 8; + + // A [Cloud Function](https://cloud.google.com/functions). + CloudFunctionEndpoint cloud_function = 10; + + // An [App Engine](https://cloud.google.com/appengine) [service + // version](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions). + AppEngineVersionEndpoint app_engine_version = 11; + + // A [Cloud Run](https://cloud.google.com/run) + // [revision](https://cloud.google.com/run/docs/reference/rest/v1/namespaces.revisions/get) + CloudRunRevisionEndpoint cloud_run_revision = 12; + + // A Compute Engine network URI. + string network = 4; + + // Type of the network where the endpoint is located. + // Applicable only to source endpoint, as destination network type can be + // inferred from the source. + NetworkType network_type = 5; + + // Project ID where the endpoint is located. + // The Project ID can be derived from the URI if you provide a VM instance or + // network URI. + // The following are two cases where you must provide the project ID: + // 1. Only the IP address is specified, and the IP address is within a Google + // Cloud project. + // 2. When you are using Shared VPC and the IP address that you provide is + // from the service project. In this case, the network that the IP address + // resides in is defined in the host project. + string project_id = 6; +} + +// Results of the configuration analysis from the last run of the test. +message ReachabilityDetails { + // The overall result of the test's configuration analysis. + enum Result { + // No result was specified. + RESULT_UNSPECIFIED = 0; + + // Possible scenarios are: + // + // * The configuration analysis determined that a packet originating from + // the source is expected to reach the destination. + // * The analysis didn't complete because the user lacks permission for + // some of the resources in the trace. However, at the time the user's + // permission became insufficient, the trace had been successful so far. + REACHABLE = 1; + + // A packet originating from the source is expected to be dropped before + // reaching the destination. + UNREACHABLE = 2; + + // The source and destination endpoints do not uniquely identify + // the test location in the network, and the reachability result contains + // multiple traces. For some traces, a packet could be delivered, and for + // others, it would not be. + AMBIGUOUS = 4; + + // The configuration analysis did not complete. Possible reasons are: + // + // * A permissions error occurred--for example, the user might not have + // read permission for all of the resources named in the test. + // * An internal error occurred. + // * The analyzer received an invalid or unsupported argument or was unable + // to identify a known endpoint. + UNDETERMINED = 5; + } + + // The overall result of the test's configuration analysis. + Result result = 1; + + // The time of the configuration analysis. + google.protobuf.Timestamp verify_time = 2; + + // The details of a failure or a cancellation of reachability analysis. + google.rpc.Status error = 3; + + // Result may contain a list of traces if a test has multiple possible + // paths in the network, such as when destination endpoint is a load balancer + // with multiple backends. + repeated Trace traces = 5; +} + +// Latency percentile rank and value. +message LatencyPercentile { + // Percentage of samples this data point applies to. + int32 percent = 1; + + // percent-th percentile of latency observed, in microseconds. + // Fraction of percent/100 of samples have latency lower or + // equal to the value of this field. + int64 latency_micros = 2; +} + +// Describes measured latency distribution. +message LatencyDistribution { + // Representative latency percentiles. + repeated LatencyPercentile latency_percentiles = 1; +} + +// Results of active probing from the last run of the test. +message ProbingDetails { + // Overall probing result of the test. + enum ProbingResult { + // No result was specified. + PROBING_RESULT_UNSPECIFIED = 0; + + // At least 95% of packets reached the destination. + REACHABLE = 1; + + // No packets reached the destination. + UNREACHABLE = 2; + + // Less than 95% of packets reached the destination. + REACHABILITY_INCONSISTENT = 3; + + // Reachability could not be determined. Possible reasons are: + // * The user lacks permission to access some of the network resources + // required to run the test. + // * No valid source endpoint could be derived from the request. + // * An internal error occurred. + UNDETERMINED = 4; + } + + // Abort cause types. + enum ProbingAbortCause { + // No reason was specified. + PROBING_ABORT_CAUSE_UNSPECIFIED = 0; + + // The user lacks permission to access some of the + // network resources required to run the test. + PERMISSION_DENIED = 1; + + // No valid source endpoint could be derived from the request. + NO_SOURCE_LOCATION = 2; + } + + // Representation of a network edge location as per + // https://cloud.google.com/vpc/docs/edge-locations. + message EdgeLocation { + // Name of the metropolitan area. + string metropolitan_area = 1; + } + + // The overall result of active probing. + ProbingResult result = 1; + + // The time that reachability was assessed through active probing. + google.protobuf.Timestamp verify_time = 2; + + // Details about an internal failure or the cancellation of active probing. + google.rpc.Status error = 3; + + // The reason probing was aborted. + ProbingAbortCause abort_cause = 4; + + // Number of probes sent. + int32 sent_probe_count = 5; + + // Number of probes that reached the destination. + int32 successful_probe_count = 6; + + // The source and destination endpoints derived from the test input and used + // for active probing. + EndpointInfo endpoint_info = 7; + + // Latency as measured by active probing in one direction: + // from the source to the destination endpoint. + LatencyDistribution probing_latency = 8; + + // The EdgeLocation from which a packet destined for/originating from the + // internet will egress/ingress the Google network. + // This will only be populated for a connectivity test which has an internet + // destination/source address. + // The absence of this field *must not* be used as an indication that the + // destination/source is part of the Google network. + EdgeLocation destination_egress_location = 9; +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/reachability.proto b/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/reachability.proto new file mode 100644 index 00000000000..d81fe4f5779 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/reachability.proto @@ -0,0 +1,274 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.networkmanagement.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/networkmanagement/v1/connectivity_test.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.NetworkManagement.V1"; +option go_package = "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb;networkmanagementpb"; +option java_multiple_files = true; +option java_outer_classname = "ReachabilityServiceProto"; +option java_package = "com.google.cloud.networkmanagement.v1"; +option php_namespace = "Google\\Cloud\\NetworkManagement\\V1"; +option ruby_package = "Google::Cloud::NetworkManagement::V1"; + +// The Reachability service in Google Cloud Network Management API + +// The Reachability service in the Google Cloud Network Management API provides +// services that analyze the reachability within a single Google Virtual Private +// Cloud (VPC) network, between peered VPC networks, between VPC and on-premises +// networks, or between VPC networks and internet hosts. A reachability analysis +// is based on Google Cloud network configurations. +// +// You can use the analysis results to verify these configurations and +// to troubleshoot connectivity issues. +service ReachabilityService { + option (google.api.default_host) = "networkmanagement.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists all Connectivity Tests owned by a project. + rpc ListConnectivityTests(ListConnectivityTestsRequest) returns (ListConnectivityTestsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/global}/connectivityTests" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a specific Connectivity Test. + rpc GetConnectivityTest(GetConnectivityTestRequest) returns (ConnectivityTest) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/global/connectivityTests/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new Connectivity Test. + // After you create a test, the reachability analysis is performed as part + // of the long running operation, which completes when the analysis completes. + // + // If the endpoint specifications in `ConnectivityTest` are invalid + // (for example, containing non-existent resources in the network, or you + // don't have read permissions to the network configurations of listed + // projects), then the reachability result returns a value of `UNKNOWN`. + // + // If the endpoint specifications in `ConnectivityTest` are + // incomplete, the reachability result returns a value of + // AMBIGUOUS. For more information, + // see the Connectivity Test documentation. + rpc CreateConnectivityTest(CreateConnectivityTestRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/global}/connectivityTests" + body: "resource" + }; + option (google.api.method_signature) = "parent,test_id,resource"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.networkmanagement.v1.ConnectivityTest" + metadata_type: "OperationMetadata" + }; + } + + // Updates the configuration of an existing `ConnectivityTest`. + // After you update a test, the reachability analysis is performed as part + // of the long running operation, which completes when the analysis completes. + // The Reachability state in the test resource is updated with the new result. + // + // If the endpoint specifications in `ConnectivityTest` are invalid + // (for example, they contain non-existent resources in the network, or the + // user does not have read permissions to the network configurations of + // listed projects), then the reachability result returns a value of + // UNKNOWN. + // + // If the endpoint specifications in `ConnectivityTest` are incomplete, the + // reachability result returns a value of `AMBIGUOUS`. See the documentation + // in `ConnectivityTest` for for more details. + rpc UpdateConnectivityTest(UpdateConnectivityTestRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{resource.name=projects/*/locations/global/connectivityTests/*}" + body: "resource" + }; + option (google.api.method_signature) = "update_mask,resource"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.networkmanagement.v1.ConnectivityTest" + metadata_type: "OperationMetadata" + }; + } + + // Rerun an existing `ConnectivityTest`. + // After the user triggers the rerun, the reachability analysis is performed + // as part of the long running operation, which completes when the analysis + // completes. + // + // Even though the test configuration remains the same, the reachability + // result may change due to underlying network configuration changes. + // + // If the endpoint specifications in `ConnectivityTest` become invalid (for + // example, specified resources are deleted in the network, or you lost + // read permissions to the network configurations of listed projects), then + // the reachability result returns a value of `UNKNOWN`. + rpc RerunConnectivityTest(RerunConnectivityTestRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/global/connectivityTests/*}:rerun" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.networkmanagement.v1.ConnectivityTest" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a specific `ConnectivityTest`. + rpc DeleteConnectivityTest(DeleteConnectivityTestRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/global/connectivityTests/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } +} + +// Request for the `ListConnectivityTests` method. +message ListConnectivityTestsRequest { + // Required. The parent resource of the Connectivity Tests: + // `projects/{project_id}/locations/global` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Number of `ConnectivityTests` to return. + int32 page_size = 2; + + // Page token from an earlier query, as returned in `next_page_token`. + string page_token = 3; + + // Lists the `ConnectivityTests` that match the filter expression. A filter + // expression filters the resources listed in the response. The expression + // must be of the form ` ` where operators: `<`, `>`, + // `<=`, + // `>=`, + // `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is + // roughly synonymous with equality). can refer to a proto or JSON + // field, or a synthetic field. Field names can be camelCase or snake_case. + // + // Examples: + // - Filter by name: + // name = "projects/proj-1/locations/global/connectivityTests/test-1 + // + // - Filter by labels: + // - Resources that have a key called `foo` + // labels.foo:* + // - Resources that have a key called `foo` whose value is `bar` + // labels.foo = bar + string filter = 4; + + // Field to use to sort the list. + string order_by = 5; +} + +// Response for the `ListConnectivityTests` method. +message ListConnectivityTestsResponse { + // List of Connectivity Tests. + repeated ConnectivityTest resources = 1; + + // Page token to fetch the next set of Connectivity Tests. + string next_page_token = 2; + + // Locations that could not be reached (when querying all locations with `-`). + repeated string unreachable = 3; +} + +// Request for the `GetConnectivityTest` method. +message GetConnectivityTestRequest { + // Required. `ConnectivityTest` resource name using the form: + // `projects/{project_id}/locations/global/connectivityTests/{test_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `CreateConnectivityTest` method. +message CreateConnectivityTestRequest { + // Required. The parent resource of the Connectivity Test to create: + // `projects/{project_id}/locations/global` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The logical name of the Connectivity Test in your project + // with the following restrictions: + // + // * Must contain only lowercase letters, numbers, and hyphens. + // * Must start with a letter. + // * Must be between 1-40 characters. + // * Must end with a number or a letter. + // * Must be unique within the customer project + string test_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A `ConnectivityTest` resource + ConnectivityTest resource = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `UpdateConnectivityTest` method. +message UpdateConnectivityTestRequest { + // Required. Mask of fields to update. At least one path must be supplied in + // this field. + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Only fields specified in update_mask are updated. + ConnectivityTest resource = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `DeleteConnectivityTest` method. +message DeleteConnectivityTestRequest { + // Required. Connectivity Test resource name using the form: + // `projects/{project_id}/locations/global/connectivityTests/{test_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `RerunConnectivityTest` method. +message RerunConnectivityTestRequest { + // Required. Connectivity Test resource name using the form: + // `projects/{project_id}/locations/global/connectivityTests/{test_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Metadata describing an [Operation][google.longrunning.Operation] +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation finished running. + google.protobuf.Timestamp end_time = 2; + + // Target of the operation - for example + // projects/project-1/locations/global/connectivityTests/test-1 + string target = 3; + + // Name of the verb executed by the operation. + string verb = 4; + + // Human-readable status of the operation, if any. + string status_detail = 5; + + // Specifies if cancellation was requested for the operation. + bool cancel_requested = 6; + + // API version. + string api_version = 7; +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/trace.proto b/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/trace.proto new file mode 100644 index 00000000000..3316f6f097e --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/trace.proto @@ -0,0 +1,1241 @@ +// 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 +// +// 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.networkmanagement.v1; + +option csharp_namespace = "Google.Cloud.NetworkManagement.V1"; +option go_package = "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb;networkmanagementpb"; +option java_multiple_files = true; +option java_outer_classname = "TraceProto"; +option java_package = "com.google.cloud.networkmanagement.v1"; +option php_namespace = "Google\\Cloud\\NetworkManagement\\V1"; +option ruby_package = "Google::Cloud::NetworkManagement::V1"; + +// Trace represents one simulated packet forwarding path. +// +// * Each trace contains multiple ordered steps. +// * Each step is in a particular state with associated configuration. +// * State is categorized as final or non-final states. +// * Each final state has a reason associated. +// * Each trace must end with a final state (the last step). +// ``` +// |---------------------Trace----------------------| +// Step1(State) Step2(State) --- StepN(State(final)) +// ``` +message Trace { + // Derived from the source and destination endpoints definition specified by + // user request, and validated by the data plane model. + // If there are multiple traces starting from different source locations, then + // the endpoint_info may be different between traces. + EndpointInfo endpoint_info = 1; + + // A trace of a test contains multiple steps from the initial state to the + // final state (delivered, dropped, forwarded, or aborted). + // + // The steps are ordered by the processing sequence within the simulated + // network state machine. It is critical to preserve the order of the steps + // and avoid reordering or sorting them. + repeated Step steps = 2; +} + +// A simulated forwarding path is composed of multiple steps. +// Each step has a well-defined state and an associated configuration. +message Step { + // Type of states that are defined in the network state machine. + // Each step in the packet trace is in a specific state. + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // Initial state: packet originating from a Compute Engine instance. + // An InstanceInfo is populated with starting instance information. + START_FROM_INSTANCE = 1; + + // Initial state: packet originating from the internet. + // The endpoint information is populated. + START_FROM_INTERNET = 2; + + // Initial state: packet originating from a Google service. Some Google + // services, such as health check probers or Identity Aware Proxy use + // special routes, outside VPC routing configuration to reach Compute Engine + // Instances. + START_FROM_GOOGLE_SERVICE = 27; + + // Initial state: packet originating from a VPC or on-premises network + // with internal source IP. + // If the source is a VPC network visible to the user, a NetworkInfo + // is populated with details of the network. + START_FROM_PRIVATE_NETWORK = 3; + + // Initial state: packet originating from a Google Kubernetes Engine cluster + // master. A GKEMasterInfo is populated with starting instance information. + START_FROM_GKE_MASTER = 21; + + // Initial state: packet originating from a Cloud SQL instance. + // A CloudSQLInstanceInfo is populated with starting instance information. + START_FROM_CLOUD_SQL_INSTANCE = 22; + + // Initial state: packet originating from a Cloud Function. + // A CloudFunctionInfo is populated with starting function information. + START_FROM_CLOUD_FUNCTION = 23; + + // Initial state: packet originating from an App Engine service version. + // An AppEngineVersionInfo is populated with starting version information. + START_FROM_APP_ENGINE_VERSION = 25; + + // Initial state: packet originating from a Cloud Run revision. + // A CloudRunRevisionInfo is populated with starting revision information. + START_FROM_CLOUD_RUN_REVISION = 26; + + // Config checking state: verify ingress firewall rule. + APPLY_INGRESS_FIREWALL_RULE = 4; + + // Config checking state: verify egress firewall rule. + APPLY_EGRESS_FIREWALL_RULE = 5; + + // Config checking state: verify route. + APPLY_ROUTE = 6; + + // Config checking state: match forwarding rule. + APPLY_FORWARDING_RULE = 7; + + // Config checking state: packet sent or received under foreign IP + // address and allowed. + SPOOFING_APPROVED = 8; + + // Forwarding state: arriving at a Compute Engine instance. + ARRIVE_AT_INSTANCE = 9; + + // Forwarding state: arriving at a Compute Engine internal load balancer. + ARRIVE_AT_INTERNAL_LOAD_BALANCER = 10; + + // Forwarding state: arriving at a Compute Engine external load balancer. + ARRIVE_AT_EXTERNAL_LOAD_BALANCER = 11; + + // Forwarding state: arriving at a Cloud VPN gateway. + ARRIVE_AT_VPN_GATEWAY = 12; + + // Forwarding state: arriving at a Cloud VPN tunnel. + ARRIVE_AT_VPN_TUNNEL = 13; + + // Forwarding state: arriving at a VPC connector. + ARRIVE_AT_VPC_CONNECTOR = 24; + + // Transition state: packet header translated. + NAT = 14; + + // Transition state: original connection is terminated and a new proxied + // connection is initiated. + PROXY_CONNECTION = 15; + + // Final state: packet could be delivered. + DELIVER = 16; + + // Final state: packet could be dropped. + DROP = 17; + + // Final state: packet could be forwarded to a network with an unknown + // configuration. + FORWARD = 18; + + // Final state: analysis is aborted. + ABORT = 19; + + // Special state: viewer of the test result does not have permission to + // see the configuration in this step. + VIEWER_PERMISSION_MISSING = 20; + } + + // A description of the step. Usually this is a summary of the state. + string description = 1; + + // Each step is in one of the pre-defined states. + State state = 2; + + // This is a step that leads to the final state Drop. + bool causes_drop = 3; + + // Project ID that contains the configuration this step is validating. + string project_id = 4; + + // Configuration or metadata associated with each step. + // The configuration is filtered based on viewer's permission. If a viewer + // has no permission to view the configuration in this step, for non-final + // states a special state is populated (VIEWER_PERMISSION_MISSING), and for + // final state the configuration is cleared. + oneof step_info { + // Display information of a Compute Engine instance. + InstanceInfo instance = 5; + + // Display information of a Compute Engine firewall rule. + FirewallInfo firewall = 6; + + // Display information of a Compute Engine route. + RouteInfo route = 7; + + // Display information of the source and destination under analysis. + // The endpoint information in an intermediate state may differ with the + // initial input, as it might be modified by state like NAT, + // or Connection Proxy. + EndpointInfo endpoint = 8; + + // Display information of a Google service + GoogleServiceInfo google_service = 24; + + // Display information of a Compute Engine forwarding rule. + ForwardingRuleInfo forwarding_rule = 9; + + // Display information of a Compute Engine VPN gateway. + VpnGatewayInfo vpn_gateway = 10; + + // Display information of a Compute Engine VPN tunnel. + VpnTunnelInfo vpn_tunnel = 11; + + // Display information of a VPC connector. + VpcConnectorInfo vpc_connector = 21; + + // Display information of the final state "deliver" and reason. + DeliverInfo deliver = 12; + + // Display information of the final state "forward" and reason. + ForwardInfo forward = 13; + + // Display information of the final state "abort" and reason. + AbortInfo abort = 14; + + // Display information of the final state "drop" and reason. + DropInfo drop = 15; + + // Display information of the load balancers. + LoadBalancerInfo load_balancer = 16; + + // Display information of a Google Cloud network. + NetworkInfo network = 17; + + // Display information of a Google Kubernetes Engine cluster master. + GKEMasterInfo gke_master = 18; + + // Display information of a Cloud SQL instance. + CloudSQLInstanceInfo cloud_sql_instance = 19; + + // Display information of a Cloud Function. + CloudFunctionInfo cloud_function = 20; + + // Display information of an App Engine service version. + AppEngineVersionInfo app_engine_version = 22; + + // Display information of a Cloud Run revision. + CloudRunRevisionInfo cloud_run_revision = 23; + } +} + +// For display only. Metadata associated with a Compute Engine instance. +message InstanceInfo { + // Name of a Compute Engine instance. + string display_name = 1; + + // URI of a Compute Engine instance. + string uri = 2; + + // Name of the network interface of a Compute Engine instance. + string interface = 3; + + // URI of a Compute Engine network. + string network_uri = 4; + + // Internal IP address of the network interface. + string internal_ip = 5; + + // External IP address of the network interface. + string external_ip = 6; + + // Network tags configured on the instance. + repeated string network_tags = 7; + + // Service account authorized for the instance. + string service_account = 8 [deprecated = true]; +} + +// For display only. Metadata associated with a Compute Engine network. +message NetworkInfo { + // Name of a Compute Engine network. + string display_name = 1; + + // URI of a Compute Engine network. + string uri = 2; + + // The IP range that matches the test. + string matched_ip_range = 4; +} + +// For display only. Metadata associated with a VPC firewall rule, an implied +// VPC firewall rule, or a hierarchical firewall policy rule. +message FirewallInfo { + // The firewall rule's type. + enum FirewallRuleType { + // Unspecified type. + FIREWALL_RULE_TYPE_UNSPECIFIED = 0; + + // Hierarchical firewall policy rule. For details, see + // [Hierarchical firewall policies + // overview](https://cloud.google.com/vpc/docs/firewall-policies). + HIERARCHICAL_FIREWALL_POLICY_RULE = 1; + + // VPC firewall rule. For details, see + // [VPC firewall rules + // overview](https://cloud.google.com/vpc/docs/firewalls). + VPC_FIREWALL_RULE = 2; + + // Implied VPC firewall rule. For details, see + // [Implied + // rules](https://cloud.google.com/vpc/docs/firewalls#default_firewall_rules). + IMPLIED_VPC_FIREWALL_RULE = 3; + + // Implicit firewall rules that are managed by serverless VPC access to + // allow ingress access. They are not visible in the Google Cloud console. + // For details, see [VPC connector's implicit + // rules](https://cloud.google.com/functions/docs/networking/connecting-vpc#restrict-access). + SERVERLESS_VPC_ACCESS_MANAGED_FIREWALL_RULE = 4; + + // Global network firewall policy rule. + // For details, see [Network firewall + // policies](https://cloud.google.com/vpc/docs/network-firewall-policies). + NETWORK_FIREWALL_POLICY_RULE = 5; + + // Regional network firewall policy rule. + // For details, see [Regional network firewall + // policies](https://cloud.google.com/firewall/docs/regional-firewall-policies). + NETWORK_REGIONAL_FIREWALL_POLICY_RULE = 6; + } + + // The display name of the VPC firewall rule. This field is not applicable + // to hierarchical firewall policy rules. + string display_name = 1; + + // The URI of the VPC firewall rule. This field is not applicable to + // implied firewall rules or hierarchical firewall policy rules. + string uri = 2; + + // Possible values: INGRESS, EGRESS + string direction = 3; + + // Possible values: ALLOW, DENY + string action = 4; + + // The priority of the firewall rule. + int32 priority = 5; + + // The URI of the VPC network that the firewall rule is associated with. + // This field is not applicable to hierarchical firewall policy rules. + string network_uri = 6; + + // The target tags defined by the VPC firewall rule. This field is not + // applicable to hierarchical firewall policy rules. + repeated string target_tags = 7; + + // The target service accounts specified by the firewall rule. + repeated string target_service_accounts = 8; + + // The hierarchical firewall policy that this rule is associated with. + // This field is not applicable to VPC firewall rules. + string policy = 9; + + // The firewall rule's type. + FirewallRuleType firewall_rule_type = 10; +} + +// For display only. Metadata associated with a Compute Engine route. +message RouteInfo { + // Type of route: + enum RouteType { + // Unspecified type. Default value. + ROUTE_TYPE_UNSPECIFIED = 0; + + // Route is a subnet route automatically created by the system. + SUBNET = 1; + + // Static route created by the user, including the default route to the + // internet. + STATIC = 2; + + // Dynamic route exchanged between BGP peers. + DYNAMIC = 3; + + // A subnet route received from peering network. + PEERING_SUBNET = 4; + + // A static route received from peering network. + PEERING_STATIC = 5; + + // A dynamic route received from peering network. + PEERING_DYNAMIC = 6; + + // Policy based route. + POLICY_BASED = 7; + } + + // Type of next hop: + enum NextHopType { + // Unspecified type. Default value. + NEXT_HOP_TYPE_UNSPECIFIED = 0; + + // Next hop is an IP address. + NEXT_HOP_IP = 1; + + // Next hop is a Compute Engine instance. + NEXT_HOP_INSTANCE = 2; + + // Next hop is a VPC network gateway. + NEXT_HOP_NETWORK = 3; + + // Next hop is a peering VPC. + NEXT_HOP_PEERING = 4; + + // Next hop is an interconnect. + NEXT_HOP_INTERCONNECT = 5; + + // Next hop is a VPN tunnel. + NEXT_HOP_VPN_TUNNEL = 6; + + // Next hop is a VPN gateway. This scenario only happens when tracing + // connectivity from an on-premises network to Google Cloud through a VPN. + // The analysis simulates a packet departing from the on-premises network + // through a VPN tunnel and arriving at a Cloud VPN gateway. + NEXT_HOP_VPN_GATEWAY = 7; + + // Next hop is an internet gateway. + NEXT_HOP_INTERNET_GATEWAY = 8; + + // Next hop is blackhole; that is, the next hop either does not exist or is + // not running. + NEXT_HOP_BLACKHOLE = 9; + + // Next hop is the forwarding rule of an Internal Load Balancer. + NEXT_HOP_ILB = 10; + + // Next hop is a + // [router appliance + // instance](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/ra-overview). + NEXT_HOP_ROUTER_APPLIANCE = 11; + + // Next hop is an NCC hub. + NEXT_HOP_NCC_HUB = 12; + } + + // Indicates where routes are applicable. + enum RouteScope { + // Unspecified scope. Default value. + ROUTE_SCOPE_UNSPECIFIED = 0; + + // Route is applicable to packets in Network. + NETWORK = 1; + + // Route is applicable to packets using NCC Hub's routing table. + NCC_HUB = 2; + } + + // Type of route. + RouteType route_type = 8; + + // Type of next hop. + NextHopType next_hop_type = 9; + + // Indicates where route is applicable. + RouteScope route_scope = 14; + + // Name of a route. + string display_name = 1; + + // URI of a route. + // Dynamic, peering static and peering dynamic routes do not have an URI. + // Advertised route from Google Cloud VPC to on-premises network also does + // not have an URI. + string uri = 2; + + // Destination IP range of the route. + string dest_ip_range = 3; + + // Next hop of the route. + string next_hop = 4; + + // URI of a Compute Engine network. NETWORK routes only. + string network_uri = 5; + + // Priority of the route. + int32 priority = 6; + + // Instance tags of the route. + repeated string instance_tags = 7; + + // Source IP address range of the route. Policy based routes only. + string src_ip_range = 10; + + // Destination port ranges of the route. Policy based routes only. + repeated string dest_port_ranges = 11; + + // Source port ranges of the route. Policy based routes only. + repeated string src_port_ranges = 12; + + // Protocols of the route. Policy based routes only. + repeated string protocols = 13; + + // URI of a NCC Hub. NCC_HUB routes only. + optional string ncc_hub_uri = 15; + + // URI of a NCC Spoke. NCC_HUB routes only. + optional string ncc_spoke_uri = 16; +} + +// For display only. Details of a Google Service sending packets to a +// VPC network. Although the source IP might be a publicly routable address, +// some Google Services use special routes within Google production +// infrastructure to reach Compute Engine Instances. +// https://cloud.google.com/vpc/docs/routes#special_return_paths +message GoogleServiceInfo { + // Recognized type of a Google Service. + enum GoogleServiceType { + // Unspecified Google Service. Includes most of Google APIs and services. + GOOGLE_SERVICE_TYPE_UNSPECIFIED = 0; + + // Identity aware proxy. + // https://cloud.google.com/iap/docs/using-tcp-forwarding + IAP = 1; + + // One of two services sharing IP ranges: + // * Load Balancer proxy + // * Centralized Health Check prober + // https://cloud.google.com/load-balancing/docs/firewall-rules + GFE_PROXY_OR_HEALTH_CHECK_PROBER = 2; + + // Connectivity from Cloud DNS to forwarding targets or alternate name + // servers that use private routing. + // https://cloud.google.com/dns/docs/zones/forwarding-zones#firewall-rules + // https://cloud.google.com/dns/docs/policies#firewall-rules + CLOUD_DNS = 3; + } + + // Source IP address. + string source_ip = 1; + + // Recognized type of a Google Service. + GoogleServiceType google_service_type = 2; +} + +// For display only. Metadata associated with a Compute Engine forwarding rule. +message ForwardingRuleInfo { + // Name of a Compute Engine forwarding rule. + string display_name = 1; + + // URI of a Compute Engine forwarding rule. + string uri = 2; + + // Protocol defined in the forwarding rule that matches the test. + string matched_protocol = 3; + + // Port range defined in the forwarding rule that matches the test. + string matched_port_range = 6; + + // VIP of the forwarding rule. + string vip = 4; + + // Target type of the forwarding rule. + string target = 5; + + // Network URI. Only valid for Internal Load Balancer. + string network_uri = 7; +} + +// For display only. Metadata associated with a load balancer. +message LoadBalancerInfo { + // The type definition for a load balancer: + enum LoadBalancerType { + // Type is unspecified. + LOAD_BALANCER_TYPE_UNSPECIFIED = 0; + + // Internal TCP/UDP load balancer. + INTERNAL_TCP_UDP = 1; + + // Network TCP/UDP load balancer. + NETWORK_TCP_UDP = 2; + + // HTTP(S) proxy load balancer. + HTTP_PROXY = 3; + + // TCP proxy load balancer. + TCP_PROXY = 4; + + // SSL proxy load balancer. + SSL_PROXY = 5; + } + + // The type definition for a load balancer backend configuration: + enum BackendType { + // Type is unspecified. + BACKEND_TYPE_UNSPECIFIED = 0; + + // Backend Service as the load balancer's backend. + BACKEND_SERVICE = 1; + + // Target Pool as the load balancer's backend. + TARGET_POOL = 2; + + // Target Instance as the load balancer's backend. + TARGET_INSTANCE = 3; + } + + // Type of the load balancer. + LoadBalancerType load_balancer_type = 1; + + // URI of the health check for the load balancer. + string health_check_uri = 2; + + // Information for the loadbalancer backends. + repeated LoadBalancerBackend backends = 3; + + // Type of load balancer's backend configuration. + BackendType backend_type = 4; + + // Backend configuration URI. + string backend_uri = 5; +} + +// For display only. Metadata associated with a specific load balancer backend. +message LoadBalancerBackend { + // State of a health check firewall configuration: + enum HealthCheckFirewallState { + // State is unspecified. Default state if not populated. + HEALTH_CHECK_FIREWALL_STATE_UNSPECIFIED = 0; + + // There are configured firewall rules to allow health check probes to the + // backend. + CONFIGURED = 1; + + // There are firewall rules configured to allow partial health check ranges + // or block all health check ranges. + // If a health check probe is sent from denied IP ranges, + // the health check to the backend will fail. Then, the backend will be + // marked unhealthy and will not receive traffic sent to the load balancer. + MISCONFIGURED = 2; + } + + // Name of a Compute Engine instance or network endpoint. + string display_name = 1; + + // URI of a Compute Engine instance or network endpoint. + string uri = 2; + + // State of the health check firewall configuration. + HealthCheckFirewallState health_check_firewall_state = 3; + + // A list of firewall rule URIs allowing probes from health check IP ranges. + repeated string health_check_allowing_firewall_rules = 4; + + // A list of firewall rule URIs blocking probes from health check IP ranges. + repeated string health_check_blocking_firewall_rules = 5; +} + +// For display only. Metadata associated with a Compute Engine VPN gateway. +message VpnGatewayInfo { + // Name of a VPN gateway. + string display_name = 1; + + // URI of a VPN gateway. + string uri = 2; + + // URI of a Compute Engine network where the VPN gateway is configured. + string network_uri = 3; + + // IP address of the VPN gateway. + string ip_address = 4; + + // A VPN tunnel that is associated with this VPN gateway. + // There may be multiple VPN tunnels configured on a VPN gateway, and only + // the one relevant to the test is displayed. + string vpn_tunnel_uri = 5; + + // Name of a Google Cloud region where this VPN gateway is configured. + string region = 6; +} + +// For display only. Metadata associated with a Compute Engine VPN tunnel. +message VpnTunnelInfo { + // Types of VPN routing policy. For details, refer to [Networks and Tunnel + // routing](https://cloud.google.com/network-connectivity/docs/vpn/concepts/choosing-networks-routing/). + enum RoutingType { + // Unspecified type. Default value. + ROUTING_TYPE_UNSPECIFIED = 0; + + // Route based VPN. + ROUTE_BASED = 1; + + // Policy based routing. + POLICY_BASED = 2; + + // Dynamic (BGP) routing. + DYNAMIC = 3; + } + + // Name of a VPN tunnel. + string display_name = 1; + + // URI of a VPN tunnel. + string uri = 2; + + // URI of the VPN gateway at local end of the tunnel. + string source_gateway = 3; + + // URI of a VPN gateway at remote end of the tunnel. + string remote_gateway = 4; + + // Remote VPN gateway's IP address. + string remote_gateway_ip = 5; + + // Local VPN gateway's IP address. + string source_gateway_ip = 6; + + // URI of a Compute Engine network where the VPN tunnel is configured. + string network_uri = 7; + + // Name of a Google Cloud region where this VPN tunnel is configured. + string region = 8; + + // Type of the routing policy. + RoutingType routing_type = 9; +} + +// For display only. The specification of the endpoints for the test. +// EndpointInfo is derived from source and destination Endpoint and validated +// by the backend data plane model. +message EndpointInfo { + // Source IP address. + string source_ip = 1; + + // Destination IP address. + string destination_ip = 2; + + // IP protocol in string format, for example: "TCP", "UDP", "ICMP". + string protocol = 3; + + // Source port. Only valid when protocol is TCP or UDP. + int32 source_port = 4; + + // Destination port. Only valid when protocol is TCP or UDP. + int32 destination_port = 5; + + // URI of the network where this packet originates from. + string source_network_uri = 6; + + // URI of the network where this packet is sent to. + string destination_network_uri = 7; + + // URI of the source telemetry agent this packet originates from. + string source_agent_uri = 8; +} + +// Details of the final state "deliver" and associated resource. +message DeliverInfo { + // Deliver target types: + enum Target { + // Target not specified. + TARGET_UNSPECIFIED = 0; + + // Target is a Compute Engine instance. + INSTANCE = 1; + + // Target is the internet. + INTERNET = 2; + + // Target is a Google API. + GOOGLE_API = 3; + + // Target is a Google Kubernetes Engine cluster master. + GKE_MASTER = 4; + + // Target is a Cloud SQL instance. + CLOUD_SQL_INSTANCE = 5; + + // Target is a published service that uses [Private Service + // Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-services). + PSC_PUBLISHED_SERVICE = 6; + + // Target is all Google APIs that use [Private Service + // Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-apis). + PSC_GOOGLE_API = 7; + + // Target is a VPC-SC that uses [Private Service + // Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-apis). + PSC_VPC_SC = 8; + + // Target is a serverless network endpoint group. + SERVERLESS_NEG = 9; + } + + // Target type where the packet is delivered to. + Target target = 1; + + // URI of the resource that the packet is delivered to. + string resource_uri = 2; +} + +// Details of the final state "forward" and associated resource. +message ForwardInfo { + // Forward target types. + enum Target { + // Target not specified. + TARGET_UNSPECIFIED = 0; + + // Forwarded to a VPC peering network. + PEERING_VPC = 1; + + // Forwarded to a Cloud VPN gateway. + VPN_GATEWAY = 2; + + // Forwarded to a Cloud Interconnect connection. + INTERCONNECT = 3; + + // Forwarded to a Google Kubernetes Engine Container cluster master. + GKE_MASTER = 4; + + // Forwarded to the next hop of a custom route imported from a peering VPC. + IMPORTED_CUSTOM_ROUTE_NEXT_HOP = 5; + + // Forwarded to a Cloud SQL instance. + CLOUD_SQL_INSTANCE = 6; + + // Forwarded to a VPC network in another project. + ANOTHER_PROJECT = 7; + + // Forwarded to an NCC Hub. + NCC_HUB = 8; + } + + // Target type where this packet is forwarded to. + Target target = 1; + + // URI of the resource that the packet is forwarded to. + string resource_uri = 2; +} + +// Details of the final state "abort" and associated resource. +message AbortInfo { + // Abort cause types: + enum Cause { + // Cause is unspecified. + CAUSE_UNSPECIFIED = 0; + + // Aborted due to unknown network. + // The reachability analysis cannot proceed because the user does not have + // access to the host project's network configurations, including firewall + // rules and routes. This happens when the project is a service project and + // the endpoints being traced are in the host project's network. + UNKNOWN_NETWORK = 1; + + // Aborted because the IP address(es) are unknown. + UNKNOWN_IP = 2; + + // Aborted because no project information can be derived from the test + // input. + UNKNOWN_PROJECT = 3; + + // Aborted because the user lacks the permission to access all or part of + // the network configurations required to run the test. + PERMISSION_DENIED = 4; + + // Aborted because no valid source endpoint is derived from the input test + // request. + NO_SOURCE_LOCATION = 5; + + // Aborted because the source and/or destination endpoint specified in + // the test are invalid. The possible reasons that an endpoint is + // invalid include: malformed IP address; nonexistent instance or + // network URI; IP address not in the range of specified network URI; and + // instance not owning the network interface in the specified network. + INVALID_ARGUMENT = 6; + + // Aborted because traffic is sent from a public IP to an instance without + // an external IP. + NO_EXTERNAL_IP = 7; + + // Aborted because none of the traces matches destination information + // specified in the input test request. + UNINTENDED_DESTINATION = 8; + + // Aborted because the number of steps in the trace exceeding a certain + // limit which may be caused by routing loop. + TRACE_TOO_LONG = 9; + + // Aborted due to internal server error. + INTERNAL_ERROR = 10; + + // Aborted because the source endpoint could not be found. + SOURCE_ENDPOINT_NOT_FOUND = 11; + + // Aborted because the source network does not match the source endpoint. + MISMATCHED_SOURCE_NETWORK = 12; + + // Aborted because the destination endpoint could not be found. + DESTINATION_ENDPOINT_NOT_FOUND = 13; + + // Aborted because the destination network does not match the destination + // endpoint. + MISMATCHED_DESTINATION_NETWORK = 14; + + // Aborted because the test scenario is not supported. + UNSUPPORTED = 15; + + // Aborted because the source and destination resources have no common IP + // version. + MISMATCHED_IP_VERSION = 16; + + // Aborted because the connection between the control plane and the node of + // the source cluster is initiated by the node and managed by the + // Konnectivity proxy. + GKE_KONNECTIVITY_PROXY_UNSUPPORTED = 17; + + // Aborted because expected resource configuration was missing. + RESOURCE_CONFIG_NOT_FOUND = 18; + + // Aborted because a PSC endpoint selection for the Google-managed service + // is ambiguous (several PSC endpoints satisfy test input). + GOOGLE_MANAGED_SERVICE_AMBIGUOUS_PSC_ENDPOINT = 19; + + // Aborted because tests with a PSC-based Cloud SQL instance as a source are + // not supported. + SOURCE_PSC_CLOUD_SQL_UNSUPPORTED = 20; + + // Aborted because tests with a forwarding rule as a source are not + // supported. + SOURCE_FORWARDING_RULE_UNSUPPORTED = 21; + } + + // Causes that the analysis is aborted. + Cause cause = 1; + + // URI of the resource that caused the abort. + string resource_uri = 2; + + // List of project IDs that the user has specified in the request but does + // not have permission to access network configs. Analysis is aborted in this + // case with the PERMISSION_DENIED cause. + repeated string projects_missing_permission = 3; +} + +// Details of the final state "drop" and associated resource. +message DropInfo { + // Drop cause types: + enum Cause { + // Cause is unspecified. + CAUSE_UNSPECIFIED = 0; + + // Destination external address cannot be resolved to a known target. If + // the address is used in a Google Cloud project, provide the project ID + // as test input. + UNKNOWN_EXTERNAL_ADDRESS = 1; + + // A Compute Engine instance can only send or receive a packet with a + // foreign IP address if ip_forward is enabled. + FOREIGN_IP_DISALLOWED = 2; + + // Dropped due to a firewall rule, unless allowed due to connection + // tracking. + FIREWALL_RULE = 3; + + // Dropped due to no routes. + NO_ROUTE = 4; + + // Dropped due to invalid route. Route's next hop is a blackhole. + ROUTE_BLACKHOLE = 5; + + // Packet is sent to a wrong (unintended) network. Example: you trace a + // packet from VM1:Network1 to VM2:Network2, however, the route configured + // in Network1 sends the packet destined for VM2's IP addresss to Network3. + ROUTE_WRONG_NETWORK = 6; + + // Packet with internal destination address sent to the internet gateway. + PRIVATE_TRAFFIC_TO_INTERNET = 7; + + // Instance with only an internal IP address tries to access Google API and + // services, but private Google access is not enabled. + PRIVATE_GOOGLE_ACCESS_DISALLOWED = 8; + + // Instance with only an internal IP address tries to access external hosts, + // but Cloud NAT is not enabled in the subnet, unless special configurations + // on a VM allow this connection. + NO_EXTERNAL_ADDRESS = 9; + + // Destination internal address cannot be resolved to a known target. If + // this is a shared VPC scenario, verify if the service project ID is + // provided as test input. Otherwise, verify if the IP address is being + // used in the project. + UNKNOWN_INTERNAL_ADDRESS = 10; + + // Forwarding rule's protocol and ports do not match the packet header. + FORWARDING_RULE_MISMATCH = 11; + + // Packet could be dropped because it was sent from a different region + // to a regional forwarding without global access. + FORWARDING_RULE_REGION_MISMATCH = 25; + + // Forwarding rule does not have backends configured. + FORWARDING_RULE_NO_INSTANCES = 12; + + // Firewalls block the health check probes to the backends and cause + // the backends to be unavailable for traffic from the load balancer. + // For more details, see [Health check firewall + // rules](https://cloud.google.com/load-balancing/docs/health-checks#firewall_rules). + FIREWALL_BLOCKING_LOAD_BALANCER_BACKEND_HEALTH_CHECK = 13; + + // Packet is sent from or to a Compute Engine instance that is not in a + // running state. + INSTANCE_NOT_RUNNING = 14; + + // Packet sent from or to a GKE cluster that is not in running state. + GKE_CLUSTER_NOT_RUNNING = 27; + + // Packet sent from or to a Cloud SQL instance that is not in running state. + CLOUD_SQL_INSTANCE_NOT_RUNNING = 28; + + // The type of traffic is blocked and the user cannot configure a firewall + // rule to enable it. See [Always blocked + // traffic](https://cloud.google.com/vpc/docs/firewalls#blockedtraffic) for + // more details. + TRAFFIC_TYPE_BLOCKED = 15; + + // Access to Google Kubernetes Engine cluster master's endpoint is not + // authorized. See [Access to the cluster + // endpoints](https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters#access_to_the_cluster_endpoints) + // for more details. + GKE_MASTER_UNAUTHORIZED_ACCESS = 16; + + // Access to the Cloud SQL instance endpoint is not authorized. + // See [Authorizing with authorized + // networks](https://cloud.google.com/sql/docs/mysql/authorize-networks) for + // more details. + CLOUD_SQL_INSTANCE_UNAUTHORIZED_ACCESS = 17; + + // Packet was dropped inside Google Kubernetes Engine Service. + DROPPED_INSIDE_GKE_SERVICE = 18; + + // Packet was dropped inside Cloud SQL Service. + DROPPED_INSIDE_CLOUD_SQL_SERVICE = 19; + + // Packet was dropped because there is no peering between the originating + // network and the Google Managed Services Network. + GOOGLE_MANAGED_SERVICE_NO_PEERING = 20; + + // Packet was dropped because the Google-managed service uses Private + // Service Connect (PSC), but the PSC endpoint is not found in the project. + GOOGLE_MANAGED_SERVICE_NO_PSC_ENDPOINT = 38; + + // Packet was dropped because the GKE cluster uses Private Service Connect + // (PSC), but the PSC endpoint is not found in the project. + GKE_PSC_ENDPOINT_MISSING = 36; + + // Packet was dropped because the Cloud SQL instance has neither a private + // nor a public IP address. + CLOUD_SQL_INSTANCE_NO_IP_ADDRESS = 21; + + // Packet was dropped because a GKE cluster private endpoint is + // unreachable from a region different from the cluster's region. + GKE_CONTROL_PLANE_REGION_MISMATCH = 30; + + // Packet sent from a public GKE cluster control plane to a private + // IP address. + PUBLIC_GKE_CONTROL_PLANE_TO_PRIVATE_DESTINATION = 31; + + // Packet was dropped because there is no route from a GKE cluster + // control plane to a destination network. + GKE_CONTROL_PLANE_NO_ROUTE = 32; + + // Packet sent from a Cloud SQL instance to an external IP address is not + // allowed. The Cloud SQL instance is not configured to send packets to + // external IP addresses. + CLOUD_SQL_INSTANCE_NOT_CONFIGURED_FOR_EXTERNAL_TRAFFIC = 33; + + // Packet sent from a Cloud SQL instance with only a public IP address to a + // private IP address. + PUBLIC_CLOUD_SQL_INSTANCE_TO_PRIVATE_DESTINATION = 34; + + // Packet was dropped because there is no route from a Cloud SQL + // instance to a destination network. + CLOUD_SQL_INSTANCE_NO_ROUTE = 35; + + // Packet could be dropped because the Cloud Function is not in an active + // status. + CLOUD_FUNCTION_NOT_ACTIVE = 22; + + // Packet could be dropped because no VPC connector is set. + VPC_CONNECTOR_NOT_SET = 23; + + // Packet could be dropped because the VPC connector is not in a running + // state. + VPC_CONNECTOR_NOT_RUNNING = 24; + + // The Private Service Connect endpoint is in a project that is not approved + // to connect to the service. + PSC_CONNECTION_NOT_ACCEPTED = 26; + + // Packet sent from a Cloud Run revision that is not ready. + CLOUD_RUN_REVISION_NOT_READY = 29; + + // Packet was dropped inside Private Service Connect service producer. + DROPPED_INSIDE_PSC_SERVICE_PRODUCER = 37; + + // Packet sent to a load balancer, which requires a proxy-only subnet and + // the subnet is not found. + LOAD_BALANCER_HAS_NO_PROXY_SUBNET = 39; + } + + // Cause that the packet is dropped. + Cause cause = 1; + + // URI of the resource that caused the drop. + string resource_uri = 2; +} + +// For display only. Metadata associated with a Google Kubernetes Engine (GKE) +// cluster master. +message GKEMasterInfo { + // URI of a GKE cluster. + string cluster_uri = 2; + + // URI of a GKE cluster network. + string cluster_network_uri = 4; + + // Internal IP address of a GKE cluster master. + string internal_ip = 5; + + // External IP address of a GKE cluster master. + string external_ip = 6; +} + +// For display only. Metadata associated with a Cloud SQL instance. +message CloudSQLInstanceInfo { + // Name of a Cloud SQL instance. + string display_name = 1; + + // URI of a Cloud SQL instance. + string uri = 2; + + // URI of a Cloud SQL instance network or empty string if the instance does + // not have one. + string network_uri = 4; + + // Internal IP address of a Cloud SQL instance. + string internal_ip = 5; + + // External IP address of a Cloud SQL instance. + string external_ip = 6; + + // Region in which the Cloud SQL instance is running. + string region = 7; +} + +// For display only. Metadata associated with a Cloud Function. +message CloudFunctionInfo { + // Name of a Cloud Function. + string display_name = 1; + + // URI of a Cloud Function. + string uri = 2; + + // Location in which the Cloud Function is deployed. + string location = 3; + + // Latest successfully deployed version id of the Cloud Function. + int64 version_id = 4; +} + +// For display only. Metadata associated with a Cloud Run revision. +message CloudRunRevisionInfo { + // Name of a Cloud Run revision. + string display_name = 1; + + // URI of a Cloud Run revision. + string uri = 2; + + // Location in which this revision is deployed. + string location = 4; + + // URI of Cloud Run service this revision belongs to. + string service_uri = 5; +} + +// For display only. Metadata associated with an App Engine version. +message AppEngineVersionInfo { + // Name of an App Engine version. + string display_name = 1; + + // URI of an App Engine version. + string uri = 2; + + // Runtime of the App Engine version. + string runtime = 3; + + // App Engine execution environment for a version. + string environment = 4; +} + +// For display only. Metadata associated with a VPC connector. +message VpcConnectorInfo { + // Name of a VPC connector. + string display_name = 1; + + // URI of a VPC connector. + string uri = 2; + + // Location in which the VPC connector is deployed. + string location = 3; +} + +// Type of a load balancer. For more information, see [Summary of Google Cloud +// load +// balancers](https://cloud.google.com/load-balancing/docs/load-balancing-overview#summary-of-google-cloud-load-balancers). +enum LoadBalancerType { + // Forwarding rule points to a different target than a load balancer or a + // load balancer type is unknown. + LOAD_BALANCER_TYPE_UNSPECIFIED = 0; + + // Global external HTTP(S) load balancer. + HTTPS_ADVANCED_LOAD_BALANCER = 1; + + // Global external HTTP(S) load balancer (classic) + HTTPS_LOAD_BALANCER = 2; + + // Regional external HTTP(S) load balancer. + REGIONAL_HTTPS_LOAD_BALANCER = 3; + + // Internal HTTP(S) load balancer. + INTERNAL_HTTPS_LOAD_BALANCER = 4; + + // External SSL proxy load balancer. + SSL_PROXY_LOAD_BALANCER = 5; + + // External TCP proxy load balancer. + TCP_PROXY_LOAD_BALANCER = 6; + + // Internal regional TCP proxy load balancer. + INTERNAL_TCP_PROXY_LOAD_BALANCER = 7; + + // External TCP/UDP Network load balancer. + NETWORK_LOAD_BALANCER = 8; + + // Target-pool based external TCP/UDP Network load balancer. + LEGACY_NETWORK_LOAD_BALANCER = 9; + + // Internal TCP/UDP load balancer. + TCP_UDP_INTERNAL_LOAD_BALANCER = 10; +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.create_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.create_connectivity_test.js new file mode 100644 index 00000000000..17dab06845f --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.create_connectivity_test.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, testId, resource) { + // [START networkmanagement_v1_generated_ReachabilityService_CreateConnectivityTest_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 parent resource of the Connectivity Test to create: + * `projects/{project_id}/locations/global` + */ + // const parent = 'abc123' + /** + * Required. The logical name of the Connectivity Test in your project + * with the following restrictions: + * * Must contain only lowercase letters, numbers, and hyphens. + * * Must start with a letter. + * * Must be between 1-40 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project + */ + // const testId = 'abc123' + /** + * Required. A `ConnectivityTest` resource + */ + // const resource = {} + + // Imports the Networkmanagement library + const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1; + + // Instantiates a client + const networkmanagementClient = new ReachabilityServiceClient(); + + async function callCreateConnectivityTest() { + // Construct request + const request = { + parent, + testId, + resource, + }; + + // Run request + const [operation] = await networkmanagementClient.createConnectivityTest(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateConnectivityTest(); + // [END networkmanagement_v1_generated_ReachabilityService_CreateConnectivityTest_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-networkmanagement/v1/samples/generated/v1/reachability_service.delete_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.delete_connectivity_test.js new file mode 100644 index 00000000000..3e016d5a2b8 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.delete_connectivity_test.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 networkmanagement_v1_generated_ReachabilityService_DeleteConnectivityTest_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. Connectivity Test resource name using the form: + * `projects/{project_id}/locations/global/connectivityTests/{test_id}` + */ + // const name = 'abc123' + + // Imports the Networkmanagement library + const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1; + + // Instantiates a client + const networkmanagementClient = new ReachabilityServiceClient(); + + async function callDeleteConnectivityTest() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networkmanagementClient.deleteConnectivityTest(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteConnectivityTest(); + // [END networkmanagement_v1_generated_ReachabilityService_DeleteConnectivityTest_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-networkmanagement/v1/samples/generated/v1/reachability_service.get_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.get_connectivity_test.js new file mode 100644 index 00000000000..91750c65cff --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.get_connectivity_test.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 networkmanagement_v1_generated_ReachabilityService_GetConnectivityTest_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. `ConnectivityTest` resource name using the form: + * `projects/{project_id}/locations/global/connectivityTests/{test_id}` + */ + // const name = 'abc123' + + // Imports the Networkmanagement library + const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1; + + // Instantiates a client + const networkmanagementClient = new ReachabilityServiceClient(); + + async function callGetConnectivityTest() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await networkmanagementClient.getConnectivityTest(request); + console.log(response); + } + + callGetConnectivityTest(); + // [END networkmanagement_v1_generated_ReachabilityService_GetConnectivityTest_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-networkmanagement/v1/samples/generated/v1/reachability_service.list_connectivity_tests.js b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.list_connectivity_tests.js new file mode 100644 index 00000000000..aac206ec275 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.list_connectivity_tests.js @@ -0,0 +1,95 @@ +// 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 networkmanagement_v1_generated_ReachabilityService_ListConnectivityTests_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 parent resource of the Connectivity Tests: + * `projects/{project_id}/locations/global` + */ + // const parent = 'abc123' + /** + * Number of `ConnectivityTests` to return. + */ + // const pageSize = 1234 + /** + * Page token from an earlier query, as returned in `next_page_token`. + */ + // const pageToken = 'abc123' + /** + * Lists the `ConnectivityTests` that match the filter expression. A filter + * expression filters the resources listed in the response. The expression + * must be of the form ` ` where operators: `<`, `>`, + * `<=`, + * `>=`, + * `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is + * roughly synonymous with equality). can refer to a proto or JSON + * field, or a synthetic field. Field names can be camelCase or snake_case. + * Examples: + * - Filter by name: + * name = "projects/proj-1/locations/global/connectivityTests/test-1 + * - Filter by labels: + * - Resources that have a key called `foo` + * labels.foo:* + * - Resources that have a key called `foo` whose value is `bar` + * labels.foo = bar + */ + // const filter = 'abc123' + /** + * Field to use to sort the list. + */ + // const orderBy = 'abc123' + + // Imports the Networkmanagement library + const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1; + + // Instantiates a client + const networkmanagementClient = new ReachabilityServiceClient(); + + async function callListConnectivityTests() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await networkmanagementClient.listConnectivityTestsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConnectivityTests(); + // [END networkmanagement_v1_generated_ReachabilityService_ListConnectivityTests_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-networkmanagement/v1/samples/generated/v1/reachability_service.rerun_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.rerun_connectivity_test.js new file mode 100644 index 00000000000..545e38ee534 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.rerun_connectivity_test.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 networkmanagement_v1_generated_ReachabilityService_RerunConnectivityTest_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. Connectivity Test resource name using the form: + * `projects/{project_id}/locations/global/connectivityTests/{test_id}` + */ + // const name = 'abc123' + + // Imports the Networkmanagement library + const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1; + + // Instantiates a client + const networkmanagementClient = new ReachabilityServiceClient(); + + async function callRerunConnectivityTest() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networkmanagementClient.rerunConnectivityTest(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRerunConnectivityTest(); + // [END networkmanagement_v1_generated_ReachabilityService_RerunConnectivityTest_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-networkmanagement/v1/samples/generated/v1/reachability_service.update_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.update_connectivity_test.js new file mode 100644 index 00000000000..64cf6c04985 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.update_connectivity_test.js @@ -0,0 +1,68 @@ +// 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(updateMask, resource) { + // [START networkmanagement_v1_generated_ReachabilityService_UpdateConnectivityTest_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. Mask of fields to update. At least one path must be supplied in + * this field. + */ + // const updateMask = {} + /** + * Required. Only fields specified in update_mask are updated. + */ + // const resource = {} + + // Imports the Networkmanagement library + const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1; + + // Instantiates a client + const networkmanagementClient = new ReachabilityServiceClient(); + + async function callUpdateConnectivityTest() { + // Construct request + const request = { + updateMask, + resource, + }; + + // Run request + const [operation] = await networkmanagementClient.updateConnectivityTest(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateConnectivityTest(); + // [END networkmanagement_v1_generated_ReachabilityService_UpdateConnectivityTest_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-networkmanagement/v1/samples/generated/v1/snippet_metadata_google.cloud.networkmanagement.v1.json b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/snippet_metadata_google.cloud.networkmanagement.v1.json new file mode 100644 index 00000000000..d8e86fe41a8 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/snippet_metadata_google.cloud.networkmanagement.v1.json @@ -0,0 +1,283 @@ +{ + "clientLibrary": { + "name": "nodejs-networkmanagement", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.networkmanagement.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "networkmanagement_v1_generated_ReachabilityService_ListConnectivityTests_async", + "title": "ReachabilityService listConnectivityTests Sample", + "origin": "API_DEFINITION", + "description": " Lists all Connectivity Tests owned by a project.", + "canonical": true, + "file": "reachability_service.list_connectivity_tests.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConnectivityTests", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.ListConnectivityTests", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkmanagement.v1.ListConnectivityTestsResponse", + "client": { + "shortName": "ReachabilityServiceClient", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityServiceClient" + }, + "method": { + "shortName": "ListConnectivityTests", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.ListConnectivityTests", + "service": { + "shortName": "ReachabilityService", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService" + } + } + } + }, + { + "regionTag": "networkmanagement_v1_generated_ReachabilityService_GetConnectivityTest_async", + "title": "ReachabilityService getConnectivityTest Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a specific Connectivity Test.", + "canonical": true, + "file": "reachability_service.get_connectivity_test.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.GetConnectivityTest", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkmanagement.v1.ConnectivityTest", + "client": { + "shortName": "ReachabilityServiceClient", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityServiceClient" + }, + "method": { + "shortName": "GetConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.GetConnectivityTest", + "service": { + "shortName": "ReachabilityService", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService" + } + } + } + }, + { + "regionTag": "networkmanagement_v1_generated_ReachabilityService_CreateConnectivityTest_async", + "title": "ReachabilityService createConnectivityTest Sample", + "origin": "API_DEFINITION", + "description": " Creates a new Connectivity Test. After you create a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. If the endpoint specifications in `ConnectivityTest` are invalid (for example, containing non-existent resources in the network, or you don't have read permissions to the network configurations of listed projects), then the reachability result returns a value of `UNKNOWN`. If the endpoint specifications in `ConnectivityTest` are incomplete, the reachability result returns a value of AMBIGUOUS. For more information, see the Connectivity Test documentation.", + "canonical": true, + "file": "reachability_service.create_connectivity_test.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.CreateConnectivityTest", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "test_id", + "type": "TYPE_STRING" + }, + { + "name": "resource", + "type": ".google.cloud.networkmanagement.v1.ConnectivityTest" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ReachabilityServiceClient", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityServiceClient" + }, + "method": { + "shortName": "CreateConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.CreateConnectivityTest", + "service": { + "shortName": "ReachabilityService", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService" + } + } + } + }, + { + "regionTag": "networkmanagement_v1_generated_ReachabilityService_UpdateConnectivityTest_async", + "title": "ReachabilityService updateConnectivityTest Sample", + "origin": "API_DEFINITION", + "description": " Updates the configuration of an existing `ConnectivityTest`. After you update a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. The Reachability state in the test resource is updated with the new result. If the endpoint specifications in `ConnectivityTest` are invalid (for example, they contain non-existent resources in the network, or the user does not have read permissions to the network configurations of listed projects), then the reachability result returns a value of UNKNOWN. If the endpoint specifications in `ConnectivityTest` are incomplete, the reachability result returns a value of `AMBIGUOUS`. See the documentation in `ConnectivityTest` for for more details.", + "canonical": true, + "file": "reachability_service.update_connectivity_test.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.UpdateConnectivityTest", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "resource", + "type": ".google.cloud.networkmanagement.v1.ConnectivityTest" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ReachabilityServiceClient", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityServiceClient" + }, + "method": { + "shortName": "UpdateConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.UpdateConnectivityTest", + "service": { + "shortName": "ReachabilityService", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService" + } + } + } + }, + { + "regionTag": "networkmanagement_v1_generated_ReachabilityService_RerunConnectivityTest_async", + "title": "ReachabilityService rerunConnectivityTest Sample", + "origin": "API_DEFINITION", + "description": " Rerun an existing `ConnectivityTest`. After the user triggers the rerun, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. Even though the test configuration remains the same, the reachability result may change due to underlying network configuration changes. If the endpoint specifications in `ConnectivityTest` become invalid (for example, specified resources are deleted in the network, or you lost read permissions to the network configurations of listed projects), then the reachability result returns a value of `UNKNOWN`.", + "canonical": true, + "file": "reachability_service.rerun_connectivity_test.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RerunConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.RerunConnectivityTest", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ReachabilityServiceClient", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityServiceClient" + }, + "method": { + "shortName": "RerunConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.RerunConnectivityTest", + "service": { + "shortName": "ReachabilityService", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService" + } + } + } + }, + { + "regionTag": "networkmanagement_v1_generated_ReachabilityService_DeleteConnectivityTest_async", + "title": "ReachabilityService deleteConnectivityTest Sample", + "origin": "API_DEFINITION", + "description": " Deletes a specific `ConnectivityTest`.", + "canonical": true, + "file": "reachability_service.delete_connectivity_test.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.DeleteConnectivityTest", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ReachabilityServiceClient", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityServiceClient" + }, + "method": { + "shortName": "DeleteConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.DeleteConnectivityTest", + "service": { + "shortName": "ReachabilityService", + "fullName": "google.cloud.networkmanagement.v1.ReachabilityService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/src/index.ts b/owl-bot-staging/google-cloud-networkmanagement/v1/src/index.ts new file mode 100644 index 00000000000..16039802135 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/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 v1 from './v1'; +const ReachabilityServiceClient = v1.ReachabilityServiceClient; +type ReachabilityServiceClient = v1.ReachabilityServiceClient; +export {v1, ReachabilityServiceClient}; +export default {v1, ReachabilityServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..0a5d92ed4df --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/gapic_metadata.json @@ -0,0 +1,87 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.networkmanagement.v1", + "libraryPackage": "@google-cloud/network-management", + "services": { + "ReachabilityService": { + "clients": { + "grpc": { + "libraryClient": "ReachabilityServiceClient", + "rpcs": { + "GetConnectivityTest": { + "methods": [ + "getConnectivityTest" + ] + }, + "CreateConnectivityTest": { + "methods": [ + "createConnectivityTest" + ] + }, + "UpdateConnectivityTest": { + "methods": [ + "updateConnectivityTest" + ] + }, + "RerunConnectivityTest": { + "methods": [ + "rerunConnectivityTest" + ] + }, + "DeleteConnectivityTest": { + "methods": [ + "deleteConnectivityTest" + ] + }, + "ListConnectivityTests": { + "methods": [ + "listConnectivityTests", + "listConnectivityTestsStream", + "listConnectivityTestsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ReachabilityServiceClient", + "rpcs": { + "GetConnectivityTest": { + "methods": [ + "getConnectivityTest" + ] + }, + "CreateConnectivityTest": { + "methods": [ + "createConnectivityTest" + ] + }, + "UpdateConnectivityTest": { + "methods": [ + "updateConnectivityTest" + ] + }, + "RerunConnectivityTest": { + "methods": [ + "rerunConnectivityTest" + ] + }, + "DeleteConnectivityTest": { + "methods": [ + "deleteConnectivityTest" + ] + }, + "ListConnectivityTests": { + "methods": [ + "listConnectivityTests", + "listConnectivityTestsStream", + "listConnectivityTestsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/index.ts new file mode 100644 index 00000000000..ffe401de1fe --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/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 {ReachabilityServiceClient} from './reachability_service_client'; diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_client.ts b/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_client.ts new file mode 100644 index 00000000000..1322b3afc58 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_client.ts @@ -0,0 +1,1139 @@ +// 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, GrpcClientOptions, LROperation, 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/reachability_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './reachability_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The Reachability service in the Google Cloud Network Management API provides + * services that analyze the reachability within a single Google Virtual Private + * Cloud (VPC) network, between peered VPC networks, between VPC and on-premises + * networks, or between VPC networks and internet hosts. A reachability analysis + * is based on Google Cloud network configurations. + * + * You can use the analysis results to verify these configurations and + * to troubleshoot connectivity issues. + * @class + * @memberof v1 + */ +export class ReachabilityServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + reachabilityServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ReachabilityServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 ReachabilityServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ReachabilityServiceClient; + 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 { + 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 = { + connectivityTestPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/global/connectivityTests/{test}' + ), + }; + + // 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 = { + listConnectivityTests: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/global/connectivityTests/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/global/connectivityTests/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/global/connectivityTests/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/global/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/global}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createConnectivityTestResponse = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1.ConnectivityTest') as gax.protobuf.Type; + const createConnectivityTestMetadata = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1.OperationMetadata') as gax.protobuf.Type; + const updateConnectivityTestResponse = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1.ConnectivityTest') as gax.protobuf.Type; + const updateConnectivityTestMetadata = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1.OperationMetadata') as gax.protobuf.Type; + const rerunConnectivityTestResponse = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1.ConnectivityTest') as gax.protobuf.Type; + const rerunConnectivityTestMetadata = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1.OperationMetadata') as gax.protobuf.Type; + const deleteConnectivityTestResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteConnectivityTestMetadata = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createConnectivityTest: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createConnectivityTestResponse.decode.bind(createConnectivityTestResponse), + createConnectivityTestMetadata.decode.bind(createConnectivityTestMetadata)), + updateConnectivityTest: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateConnectivityTestResponse.decode.bind(updateConnectivityTestResponse), + updateConnectivityTestMetadata.decode.bind(updateConnectivityTestMetadata)), + rerunConnectivityTest: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + rerunConnectivityTestResponse.decode.bind(rerunConnectivityTestResponse), + rerunConnectivityTestMetadata.decode.bind(rerunConnectivityTestMetadata)), + deleteConnectivityTest: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteConnectivityTestResponse.decode.bind(deleteConnectivityTestResponse), + deleteConnectivityTestMetadata.decode.bind(deleteConnectivityTestMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.networkmanagement.v1.ReachabilityService', 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.reachabilityServiceStub) { + return this.reachabilityServiceStub; + } + + // Put together the "service stub" for + // google.cloud.networkmanagement.v1.ReachabilityService. + this.reachabilityServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.networkmanagement.v1.ReachabilityService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networkmanagement.v1.ReachabilityService, + 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 reachabilityServiceStubMethods = + ['listConnectivityTests', 'getConnectivityTest', 'createConnectivityTest', 'updateConnectivityTest', 'rerunConnectivityTest', 'deleteConnectivityTest']; + for (const methodName of reachabilityServiceStubMethods) { + const callPromise = this.reachabilityServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.reachabilityServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'networkmanagement.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 'networkmanagement.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 -- + // ------------------- +/** + * Gets the details of a specific Connectivity Test. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. `ConnectivityTest` resource name using the form: + * `projects/{project_id}/locations/global/connectivityTests/{test_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 protos.google.cloud.networkmanagement.v1.ConnectivityTest|ConnectivityTest}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/reachability_service.get_connectivity_test.js + * region_tag:networkmanagement_v1_generated_ReachabilityService_GetConnectivityTest_async + */ + getConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkmanagement.v1.IConnectivityTest, + protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest|undefined, {}|undefined + ]>; + getConnectivityTest( + request: protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networkmanagement.v1.IConnectivityTest, + protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest|null|undefined, + {}|null|undefined>): void; + getConnectivityTest( + request: protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest, + callback: Callback< + protos.google.cloud.networkmanagement.v1.IConnectivityTest, + protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest|null|undefined, + {}|null|undefined>): void; + getConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.networkmanagement.v1.IConnectivityTest, + protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.networkmanagement.v1.IConnectivityTest, + protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.networkmanagement.v1.IConnectivityTest, + protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest|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.getConnectivityTest(request, options, callback); + } + +/** + * Creates a new Connectivity Test. + * After you create a test, the reachability analysis is performed as part + * of the long running operation, which completes when the analysis completes. + * + * If the endpoint specifications in `ConnectivityTest` are invalid + * (for example, containing non-existent resources in the network, or you + * don't have read permissions to the network configurations of listed + * projects), then the reachability result returns a value of `UNKNOWN`. + * + * If the endpoint specifications in `ConnectivityTest` are + * incomplete, the reachability result returns a value of + * AMBIGUOUS. For more information, + * see the Connectivity Test documentation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the Connectivity Test to create: + * `projects/{project_id}/locations/global` + * @param {string} request.testId + * Required. The logical name of the Connectivity Test in your project + * with the following restrictions: + * + * * Must contain only lowercase letters, numbers, and hyphens. + * * Must start with a letter. + * * Must be between 1-40 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project + * @param {google.cloud.networkmanagement.v1.ConnectivityTest} request.resource + * Required. A `ConnectivityTest` 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/reachability_service.create_connectivity_test.js + * region_tag:networkmanagement_v1_generated_ReachabilityService_CreateConnectivityTest_async + */ + createConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1.ICreateConnectivityTestRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createConnectivityTest( + request: protos.google.cloud.networkmanagement.v1.ICreateConnectivityTestRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConnectivityTest( + request: protos.google.cloud.networkmanagement.v1.ICreateConnectivityTestRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1.ICreateConnectivityTestRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createConnectivityTest(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createConnectivityTest()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/reachability_service.create_connectivity_test.js + * region_tag:networkmanagement_v1_generated_ReachabilityService_CreateConnectivityTest_async + */ + async checkCreateConnectivityTestProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConnectivityTest, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the configuration of an existing `ConnectivityTest`. + * After you update a test, the reachability analysis is performed as part + * of the long running operation, which completes when the analysis completes. + * The Reachability state in the test resource is updated with the new result. + * + * If the endpoint specifications in `ConnectivityTest` are invalid + * (for example, they contain non-existent resources in the network, or the + * user does not have read permissions to the network configurations of + * listed projects), then the reachability result returns a value of + * UNKNOWN. + * + * If the endpoint specifications in `ConnectivityTest` are incomplete, the + * reachability result returns a value of `AMBIGUOUS`. See the documentation + * in `ConnectivityTest` for for more details. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. At least one path must be supplied in + * this field. + * @param {google.cloud.networkmanagement.v1.ConnectivityTest} request.resource + * Required. Only fields specified in update_mask are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/reachability_service.update_connectivity_test.js + * region_tag:networkmanagement_v1_generated_ReachabilityService_UpdateConnectivityTest_async + */ + updateConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1.IUpdateConnectivityTestRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateConnectivityTest( + request: protos.google.cloud.networkmanagement.v1.IUpdateConnectivityTestRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateConnectivityTest( + request: protos.google.cloud.networkmanagement.v1.IUpdateConnectivityTestRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1.IUpdateConnectivityTestRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource.name': request.resource!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateConnectivityTest(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateConnectivityTest()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/reachability_service.update_connectivity_test.js + * region_tag:networkmanagement_v1_generated_ReachabilityService_UpdateConnectivityTest_async + */ + async checkUpdateConnectivityTestProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateConnectivityTest, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Rerun an existing `ConnectivityTest`. + * After the user triggers the rerun, the reachability analysis is performed + * as part of the long running operation, which completes when the analysis + * completes. + * + * Even though the test configuration remains the same, the reachability + * result may change due to underlying network configuration changes. + * + * If the endpoint specifications in `ConnectivityTest` become invalid (for + * example, specified resources are deleted in the network, or you lost + * read permissions to the network configurations of listed projects), then + * the reachability result returns a value of `UNKNOWN`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Connectivity Test resource name using the form: + * `projects/{project_id}/locations/global/connectivityTests/{test_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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/reachability_service.rerun_connectivity_test.js + * region_tag:networkmanagement_v1_generated_ReachabilityService_RerunConnectivityTest_async + */ + rerunConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1.IRerunConnectivityTestRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + rerunConnectivityTest( + request: protos.google.cloud.networkmanagement.v1.IRerunConnectivityTestRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + rerunConnectivityTest( + request: protos.google.cloud.networkmanagement.v1.IRerunConnectivityTestRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + rerunConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1.IRerunConnectivityTestRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.rerunConnectivityTest(request, options, callback); + } +/** + * Check the status of the long running operation returned by `rerunConnectivityTest()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/reachability_service.rerun_connectivity_test.js + * region_tag:networkmanagement_v1_generated_ReachabilityService_RerunConnectivityTest_async + */ + async checkRerunConnectivityTestProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.rerunConnectivityTest, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a specific `ConnectivityTest`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Connectivity Test resource name using the form: + * `projects/{project_id}/locations/global/connectivityTests/{test_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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/reachability_service.delete_connectivity_test.js + * region_tag:networkmanagement_v1_generated_ReachabilityService_DeleteConnectivityTest_async + */ + deleteConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1.IDeleteConnectivityTestRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteConnectivityTest( + request: protos.google.cloud.networkmanagement.v1.IDeleteConnectivityTestRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConnectivityTest( + request: protos.google.cloud.networkmanagement.v1.IDeleteConnectivityTestRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1.IDeleteConnectivityTestRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteConnectivityTest(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteConnectivityTest()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/reachability_service.delete_connectivity_test.js + * region_tag:networkmanagement_v1_generated_ReachabilityService_DeleteConnectivityTest_async + */ + async checkDeleteConnectivityTestProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConnectivityTest, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists all Connectivity Tests owned by a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the Connectivity Tests: + * `projects/{project_id}/locations/global` + * @param {number} request.pageSize + * Number of `ConnectivityTests` to return. + * @param {string} request.pageToken + * Page token from an earlier query, as returned in `next_page_token`. + * @param {string} request.filter + * Lists the `ConnectivityTests` that match the filter expression. A filter + * expression filters the resources listed in the response. The expression + * must be of the form ` ` where operators: `<`, `>`, + * `<=`, + * `>=`, + * `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is + * roughly synonymous with equality). can refer to a proto or JSON + * field, or a synthetic field. Field names can be camelCase or snake_case. + * + * Examples: + * - Filter by name: + * name = "projects/proj-1/locations/global/connectivityTests/test-1 + * + * - Filter by labels: + * - Resources that have a key called `foo` + * labels.foo:* + * - Resources that have a key called `foo` whose value is `bar` + * labels.foo = bar + * @param {string} request.orderBy + * Field to use to sort the list. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.networkmanagement.v1.ConnectivityTest|ConnectivityTest}. + * 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 `listConnectivityTestsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listConnectivityTests( + request?: protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkmanagement.v1.IConnectivityTest[], + protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest|null, + protos.google.cloud.networkmanagement.v1.IListConnectivityTestsResponse + ]>; + listConnectivityTests( + request: protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, + protos.google.cloud.networkmanagement.v1.IListConnectivityTestsResponse|null|undefined, + protos.google.cloud.networkmanagement.v1.IConnectivityTest>): void; + listConnectivityTests( + request: protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, + callback: PaginationCallback< + protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, + protos.google.cloud.networkmanagement.v1.IListConnectivityTestsResponse|null|undefined, + protos.google.cloud.networkmanagement.v1.IConnectivityTest>): void; + listConnectivityTests( + request?: protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, + protos.google.cloud.networkmanagement.v1.IListConnectivityTestsResponse|null|undefined, + protos.google.cloud.networkmanagement.v1.IConnectivityTest>, + callback?: PaginationCallback< + protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, + protos.google.cloud.networkmanagement.v1.IListConnectivityTestsResponse|null|undefined, + protos.google.cloud.networkmanagement.v1.IConnectivityTest>): + Promise<[ + protos.google.cloud.networkmanagement.v1.IConnectivityTest[], + protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest|null, + protos.google.cloud.networkmanagement.v1.IListConnectivityTestsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listConnectivityTests(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the Connectivity Tests: + * `projects/{project_id}/locations/global` + * @param {number} request.pageSize + * Number of `ConnectivityTests` to return. + * @param {string} request.pageToken + * Page token from an earlier query, as returned in `next_page_token`. + * @param {string} request.filter + * Lists the `ConnectivityTests` that match the filter expression. A filter + * expression filters the resources listed in the response. The expression + * must be of the form ` ` where operators: `<`, `>`, + * `<=`, + * `>=`, + * `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is + * roughly synonymous with equality). can refer to a proto or JSON + * field, or a synthetic field. Field names can be camelCase or snake_case. + * + * Examples: + * - Filter by name: + * name = "projects/proj-1/locations/global/connectivityTests/test-1 + * + * - Filter by labels: + * - Resources that have a key called `foo` + * labels.foo:* + * - Resources that have a key called `foo` whose value is `bar` + * labels.foo = bar + * @param {string} request.orderBy + * Field to use to sort the list. + * @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 protos.google.cloud.networkmanagement.v1.ConnectivityTest|ConnectivityTest} 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 `listConnectivityTestsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listConnectivityTestsStream( + request?: protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, + 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['listConnectivityTests']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConnectivityTests.createStream( + this.innerApiCalls.listConnectivityTests as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listConnectivityTests`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the Connectivity Tests: + * `projects/{project_id}/locations/global` + * @param {number} request.pageSize + * Number of `ConnectivityTests` to return. + * @param {string} request.pageToken + * Page token from an earlier query, as returned in `next_page_token`. + * @param {string} request.filter + * Lists the `ConnectivityTests` that match the filter expression. A filter + * expression filters the resources listed in the response. The expression + * must be of the form ` ` where operators: `<`, `>`, + * `<=`, + * `>=`, + * `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is + * roughly synonymous with equality). can refer to a proto or JSON + * field, or a synthetic field. Field names can be camelCase or snake_case. + * + * Examples: + * - Filter by name: + * name = "projects/proj-1/locations/global/connectivityTests/test-1 + * + * - Filter by labels: + * - Resources that have a key called `foo` + * labels.foo:* + * - Resources that have a key called `foo` whose value is `bar` + * labels.foo = bar + * @param {string} request.orderBy + * Field to use to sort the list. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.networkmanagement.v1.ConnectivityTest|ConnectivityTest}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/reachability_service.list_connectivity_tests.js + * region_tag:networkmanagement_v1_generated_ReachabilityService_ListConnectivityTests_async + */ + listConnectivityTestsAsync( + request?: protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, + 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['listConnectivityTests']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConnectivityTests.asyncIterate( + this.innerApiCalls['listConnectivityTests'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified connectivityTest resource name string. + * + * @param {string} project + * @param {string} test + * @returns {string} Resource name string. + */ + connectivityTestPath(project:string,test:string) { + return this.pathTemplates.connectivityTestPathTemplate.render({ + project: project, + test: test, + }); + } + + /** + * Parse the project from ConnectivityTest resource. + * + * @param {string} connectivityTestName + * A fully-qualified path representing ConnectivityTest resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConnectivityTestName(connectivityTestName: string) { + return this.pathTemplates.connectivityTestPathTemplate.match(connectivityTestName).project; + } + + /** + * Parse the test from ConnectivityTest resource. + * + * @param {string} connectivityTestName + * A fully-qualified path representing ConnectivityTest resource. + * @returns {string} A string representing the test. + */ + matchTestFromConnectivityTestName(connectivityTestName: string) { + return this.pathTemplates.connectivityTestPathTemplate.match(connectivityTestName).test; + } + + /** + * 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.reachabilityServiceStub && !this._terminated) { + return this.reachabilityServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_client_config.json b/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_client_config.json new file mode 100644 index 00000000000..6fcdab96cf2 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_client_config.json @@ -0,0 +1,56 @@ +{ + "interfaces": { + "google.cloud.networkmanagement.v1.ReachabilityService": { + "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": { + "ListConnectivityTests": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetConnectivityTest": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateConnectivityTest": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateConnectivityTest": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RerunConnectivityTest": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteConnectivityTest": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_proto_list.json b/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_proto_list.json new file mode 100644 index 00000000000..d84c76feae1 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/networkmanagement/v1/connectivity_test.proto", + "../../protos/google/cloud/networkmanagement/v1/reachability.proto", + "../../protos/google/cloud/networkmanagement/v1/trace.proto" +] diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-networkmanagement/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..fd277b9a109 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/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 networkmanagement = require('@google-cloud/network-management'); + +function main() { + const reachabilityServiceClient = new networkmanagement.ReachabilityServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-networkmanagement/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..1a6b5c88dd3 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/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 {ReachabilityServiceClient} from '@google-cloud/network-management'; + +// check that the client class type name can be used +function doStuffWithReachabilityServiceClient(client: ReachabilityServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const reachabilityServiceClient = new ReachabilityServiceClient(); + doStuffWithReachabilityServiceClient(reachabilityServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/system-test/install.ts b/owl-bot-staging/google-cloud-networkmanagement/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1/test/gapic_reachability_service_v1.ts b/owl-bot-staging/google-cloud-networkmanagement/v1/test/gapic_reachability_service_v1.ts new file mode 100644 index 00000000000..21f2f364e80 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1/test/gapic_reachability_service_v1.ts @@ -0,0 +1,1227 @@ +// 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 reachabilityserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.ReachabilityServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = reachabilityserviceModule.v1.ReachabilityServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = reachabilityserviceModule.v1.ReachabilityServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = reachabilityserviceModule.v1.ReachabilityServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.reachabilityServiceStub, undefined); + await client.initialize(); + assert(client.reachabilityServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.reachabilityServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.reachabilityServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + 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 reachabilityserviceModule.v1.ReachabilityServiceClient({ + 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('getConnectivityTest', () => { + it('invokes getConnectivityTest without error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.GetConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.GetConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.ConnectivityTest() + ); + client.innerApiCalls.getConnectivityTest = stubSimpleCall(expectedResponse); + const [response] = await client.getConnectivityTest(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectivityTest without error using callback', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.GetConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.GetConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.ConnectivityTest() + ); + client.innerApiCalls.getConnectivityTest = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConnectivityTest( + request, + (err?: Error|null, result?: protos.google.cloud.networkmanagement.v1.IConnectivityTest|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectivityTest with error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.GetConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.GetConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConnectivityTest = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConnectivityTest(request), expectedError); + const actualRequest = (client.innerApiCalls.getConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectivityTest with closed client', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.GetConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.GetConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getConnectivityTest(request), expectedError); + }); + }); + + describe('createConnectivityTest', () => { + it('invokes createConnectivityTest without error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.CreateConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.CreateConnectivityTestRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConnectivityTest = stubLongRunningCall(expectedResponse); + const [operation] = await client.createConnectivityTest(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnectivityTest without error using callback', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.CreateConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.CreateConnectivityTestRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConnectivityTest = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConnectivityTest( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnectivityTest with call error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.CreateConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.CreateConnectivityTestRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConnectivityTest = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createConnectivityTest(request), expectedError); + const actualRequest = (client.innerApiCalls.createConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnectivityTest with LRO error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.CreateConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.CreateConnectivityTestRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConnectivityTest = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createConnectivityTest(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateConnectivityTestProgress without error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateConnectivityTestProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateConnectivityTestProgress with error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateConnectivityTestProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateConnectivityTest', () => { + it('invokes updateConnectivityTest without error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.UpdateConnectivityTestRequest() + ); + request.resource ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.UpdateConnectivityTestRequest', ['resource', 'name']); + request.resource.name = defaultValue1; + const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateConnectivityTest = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateConnectivityTest(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnectivityTest without error using callback', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.UpdateConnectivityTestRequest() + ); + request.resource ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.UpdateConnectivityTestRequest', ['resource', 'name']); + request.resource.name = defaultValue1; + const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateConnectivityTest = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateConnectivityTest( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnectivityTest with call error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.UpdateConnectivityTestRequest() + ); + request.resource ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.UpdateConnectivityTestRequest', ['resource', 'name']); + request.resource.name = defaultValue1; + const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConnectivityTest = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateConnectivityTest(request), expectedError); + const actualRequest = (client.innerApiCalls.updateConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnectivityTest with LRO error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.UpdateConnectivityTestRequest() + ); + request.resource ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.UpdateConnectivityTestRequest', ['resource', 'name']); + request.resource.name = defaultValue1; + const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConnectivityTest = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateConnectivityTest(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateConnectivityTestProgress without error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateConnectivityTestProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateConnectivityTestProgress with error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateConnectivityTestProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('rerunConnectivityTest', () => { + it('invokes rerunConnectivityTest without error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.RerunConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.RerunConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.rerunConnectivityTest = stubLongRunningCall(expectedResponse); + const [operation] = await client.rerunConnectivityTest(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rerunConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rerunConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rerunConnectivityTest without error using callback', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.RerunConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.RerunConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.rerunConnectivityTest = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rerunConnectivityTest( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rerunConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rerunConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rerunConnectivityTest with call error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.RerunConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.RerunConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rerunConnectivityTest = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.rerunConnectivityTest(request), expectedError); + const actualRequest = (client.innerApiCalls.rerunConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rerunConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rerunConnectivityTest with LRO error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.RerunConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.RerunConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rerunConnectivityTest = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.rerunConnectivityTest(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.rerunConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rerunConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRerunConnectivityTestProgress without error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRerunConnectivityTestProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRerunConnectivityTestProgress with error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRerunConnectivityTestProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteConnectivityTest', () => { + it('invokes deleteConnectivityTest without error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.DeleteConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.DeleteConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConnectivityTest = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteConnectivityTest(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnectivityTest without error using callback', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.DeleteConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.DeleteConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConnectivityTest = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteConnectivityTest( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnectivityTest with call error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.DeleteConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.DeleteConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConnectivityTest = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteConnectivityTest(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnectivityTest with LRO error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.DeleteConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.DeleteConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConnectivityTest = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteConnectivityTest(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteConnectivityTestProgress without error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteConnectivityTestProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteConnectivityTestProgress with error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteConnectivityTestProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listConnectivityTests', () => { + it('invokes listConnectivityTests without error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), + generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), + generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), + ]; + client.innerApiCalls.listConnectivityTests = stubSimpleCall(expectedResponse); + const [response] = await client.listConnectivityTests(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConnectivityTests as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnectivityTests as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnectivityTests without error using callback', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), + generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), + generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), + ]; + client.innerApiCalls.listConnectivityTests = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConnectivityTests( + request, + (err?: Error|null, result?: protos.google.cloud.networkmanagement.v1.IConnectivityTest[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConnectivityTests as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnectivityTests as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnectivityTests with error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConnectivityTests = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConnectivityTests(request), expectedError); + const actualRequest = (client.innerApiCalls.listConnectivityTests as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnectivityTests as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnectivityTestsStream without error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), + generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), + generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), + ]; + client.descriptors.page.listConnectivityTests.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listConnectivityTestsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkmanagement.v1.ConnectivityTest[] = []; + stream.on('data', (response: protos.google.cloud.networkmanagement.v1.ConnectivityTest) => { + 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.listConnectivityTests.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConnectivityTests, request)); + assert( + (client.descriptors.page.listConnectivityTests.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listConnectivityTestsStream with error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConnectivityTests.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listConnectivityTestsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkmanagement.v1.ConnectivityTest[] = []; + stream.on('data', (response: protos.google.cloud.networkmanagement.v1.ConnectivityTest) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listConnectivityTests.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConnectivityTests, request)); + assert( + (client.descriptors.page.listConnectivityTests.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConnectivityTests without error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), + generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), + generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), + ]; + client.descriptors.page.listConnectivityTests.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networkmanagement.v1.IConnectivityTest[] = []; + const iterable = client.listConnectivityTestsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listConnectivityTests.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConnectivityTests.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConnectivityTests with error', async () => { + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConnectivityTests.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConnectivityTestsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networkmanagement.v1.IConnectivityTest[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listConnectivityTests.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConnectivityTests.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('connectivityTest', () => { + const fakePath = "/rendered/path/connectivityTest"; + const expectedParameters = { + project: "projectValue", + test: "testValue", + }; + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.connectivityTestPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.connectivityTestPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('connectivityTestPath', () => { + const result = client.connectivityTestPath("projectValue", "testValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.connectivityTestPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConnectivityTestName', () => { + const result = client.matchProjectFromConnectivityTestName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.connectivityTestPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTestFromConnectivityTestName', () => { + const result = client.matchTestFromConnectivityTestName(fakePath); + assert.strictEqual(result, "testValue"); + assert((client.pathTemplates.connectivityTestPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/tsconfig.json b/owl-bot-staging/google-cloud-networkmanagement/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1/webpack.config.js b/owl-bot-staging/google-cloud-networkmanagement/v1/webpack.config.js new file mode 100644 index 00000000000..d975be0ab73 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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: 'ReachabilityService', + filename: './reachability-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-networkmanagement/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.gitignore b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.jsdoc.js new file mode 100644 index 00000000000..d081790c646 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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/network-management', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1beta1/README.md b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/README.md new file mode 100644 index 00000000000..90c3778ad46 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/README.md @@ -0,0 +1 @@ +Networkmanagement: Nodejs Client diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/package.json b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/package.json new file mode 100644 index 00000000000..70e771ee9ed --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/network-management", + "version": "0.1.0", + "description": "Networkmanagement client for Node.js", + "repository": "googleapis/nodejs-networkmanagement", + "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 networkmanagement", + "networkmanagement", + "reachability service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/connectivity_test.proto b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/connectivity_test.proto new file mode 100644 index 00000000000..b565eb34597 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/connectivity_test.proto @@ -0,0 +1,405 @@ +// 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 +// +// 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.networkmanagement.v1beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/networkmanagement/v1beta1/trace.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.NetworkManagement.V1Beta1"; +option go_package = "cloud.google.com/go/networkmanagement/apiv1beta1/networkmanagementpb;networkmanagementpb"; +option java_multiple_files = true; +option java_outer_classname = "TestOuterClass"; +option java_package = "com.google.cloud.networkmanagement.v1beta1"; +option php_namespace = "Google\\Cloud\\NetworkManagement\\V1beta1"; +option ruby_package = "Google::Cloud::NetworkManagement::V1beta1"; + +// A Connectivity Test for a network reachability analysis. +message ConnectivityTest { + option (google.api.resource) = { + type: "networkmanagement.googleapis.com/ConnectivityTest" + pattern: "projects/{project}/locations/global/connectivityTests/{test}" + }; + + // Required. Unique name of the resource using the form: + // `projects/{project_id}/locations/global/connectivityTests/{test}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // The user-supplied description of the Connectivity Test. + // Maximum of 512 characters. + string description = 2; + + // Required. Source specification of the Connectivity Test. + // + // You can use a combination of source IP address, virtual machine + // (VM) instance, or Compute Engine network to uniquely identify + // the source location. + // + // Examples: + // If the source IP address is an internal IP address within a Google Cloud + // Virtual Private Cloud (VPC) network, then you must also specify the VPC + // network. Otherwise, specify the VM instance, which already contains its + // internal IP address and VPC network information. + // + // If the source of the test is within an on-premises network, then you must + // provide the destination VPC network. + // + // If the source endpoint is a Compute Engine VM instance with multiple + // network interfaces, the instance itself is not sufficient to identify the + // endpoint. So, you must also specify the source IP address or VPC network. + // + // A reachability analysis proceeds even if the source location is + // ambiguous. However, the test result may include endpoints that you don't + // intend to test. + Endpoint source = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Destination specification of the Connectivity Test. + // + // You can use a combination of destination IP address, Compute Engine + // VM instance, or VPC network to uniquely identify the destination + // location. + // + // Even if the destination IP address is not unique, the source IP + // location is unique. Usually, the analysis can infer the destination + // endpoint from route information. + // + // If the destination you specify is a VM instance and the instance has + // multiple network interfaces, then you must also specify either + // a destination IP address or VPC network to identify the destination + // interface. + // + // A reachability analysis proceeds even if the destination location is + // ambiguous. However, the result can include endpoints that you don't + // intend to test. + Endpoint destination = 4 [(google.api.field_behavior) = REQUIRED]; + + // IP Protocol of the test. When not provided, "TCP" is assumed. + string protocol = 5; + + // Other projects that may be relevant for reachability analysis. + // This is applicable to scenarios where a test can cross project boundaries. + repeated string related_projects = 6; + + // Output only. The display name of a Connectivity Test. + string display_name = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Resource labels to represent user-provided metadata. + map labels = 8; + + // Output only. The time the test was created. + google.protobuf.Timestamp create_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the test's configuration was updated. + google.protobuf.Timestamp update_time = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The reachability details of this test from the latest run. + // The details are updated when creating a new test, updating an + // existing test, or triggering a one-time rerun of an existing test. + ReachabilityDetails reachability_details = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The probing details of this test from the latest run, present + // for applicable tests only. The details are updated when creating a new + // test, updating an existing test, or triggering a one-time rerun of an + // existing test. + ProbingDetails probing_details = 14 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Source or destination of the Connectivity Test. +message Endpoint { + // The type definition of an endpoint's network. Use one of the + // following choices: + enum NetworkType { + // Default type if unspecified. + NETWORK_TYPE_UNSPECIFIED = 0; + + // A network hosted within Google Cloud. + // To receive more detailed output, specify the URI for the source or + // destination network. + GCP_NETWORK = 1; + + // A network hosted outside of Google Cloud. + // This can be an on-premises network, or a network hosted by another cloud + // provider. + NON_GCP_NETWORK = 2; + } + + // Type of the target of a forwarding rule. + enum ForwardingRuleTarget { + // Forwarding rule target is unknown. + FORWARDING_RULE_TARGET_UNSPECIFIED = 0; + + // Compute Engine instance for protocol forwarding. + INSTANCE = 1; + + // Load Balancer. The specific type can be found from [load_balancer_type] + // [google.cloud.networkmanagement.v1beta1.Endpoint.load_balancer_type]. + LOAD_BALANCER = 2; + + // Classic Cloud VPN Gateway. + VPN_GATEWAY = 3; + + // Forwarding Rule is a Private Service Connect endpoint. + PSC = 4; + } + + // Wrapper for Cloud Function attributes. + message CloudFunctionEndpoint { + // A [Cloud Function](https://cloud.google.com/functions) name. + string uri = 1; + } + + // Wrapper for the App Engine service version attributes. + message AppEngineVersionEndpoint { + // An [App Engine](https://cloud.google.com/appengine) [service + // version](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions) + // name. + string uri = 1; + } + + // Wrapper for Cloud Run revision attributes. + message CloudRunRevisionEndpoint { + // A [Cloud Run](https://cloud.google.com/run) + // [revision](https://cloud.google.com/run/docs/reference/rest/v1/namespaces.revisions/get) + // URI. The format is: + // projects/{project}/locations/{location}/revisions/{revision} + string uri = 1; + } + + // The IP address of the endpoint, which can be an external or internal IP. + // An IPv6 address is only allowed when the test's destination is a + // [global load balancer + // VIP](https://cloud.google.com/load-balancing/docs/load-balancing-overview). + string ip_address = 1; + + // The IP protocol port of the endpoint. + // Only applicable when protocol is TCP or UDP. + int32 port = 2; + + // A Compute Engine instance URI. + string instance = 3; + + // A forwarding rule and its corresponding IP address represent the frontend + // configuration of a Google Cloud load balancer. Forwarding rules are also + // used for protocol forwarding, Private Service Connect and other network + // services to provide forwarding information in the control plane. Format: + // projects/{project}/global/forwardingRules/{id} or + // projects/{project}/regions/{region}/forwardingRules/{id} + string forwarding_rule = 13; + + // Output only. Specifies the type of the target of the forwarding rule. + optional ForwardingRuleTarget forwarding_rule_target = 14 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. ID of the load balancer the forwarding rule points to. Empty + // for forwarding rules not related to load balancers. + optional string load_balancer_id = 15 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Type of the load balancer the forwarding rule points to. + optional LoadBalancerType load_balancer_type = 16 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A cluster URI for [Google Kubernetes Engine + // master](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-architecture). + string gke_master_cluster = 7; + + // A [Cloud SQL](https://cloud.google.com/sql) instance URI. + string cloud_sql_instance = 8; + + // A [Cloud Function](https://cloud.google.com/functions). + CloudFunctionEndpoint cloud_function = 10; + + // An [App Engine](https://cloud.google.com/appengine) [service + // version](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions). + AppEngineVersionEndpoint app_engine_version = 11; + + // A [Cloud Run](https://cloud.google.com/run) + // [revision](https://cloud.google.com/run/docs/reference/rest/v1/namespaces.revisions/get) + CloudRunRevisionEndpoint cloud_run_revision = 12; + + // A Compute Engine network URI. + string network = 4; + + // Type of the network where the endpoint is located. + // Applicable only to source endpoint, as destination network type can be + // inferred from the source. + NetworkType network_type = 5; + + // Project ID where the endpoint is located. + // The Project ID can be derived from the URI if you provide a VM instance or + // network URI. + // The following are two cases where you must provide the project ID: + // 1. Only the IP address is specified, and the IP address is within a Google + // Cloud project. + // 2. When you are using Shared VPC and the IP address that you provide is + // from the service project. In this case, the network that the IP address + // resides in is defined in the host project. + string project_id = 6; +} + +// Results of the configuration analysis from the last run of the test. +message ReachabilityDetails { + // The overall result of the test's configuration analysis. + enum Result { + // No result was specified. + RESULT_UNSPECIFIED = 0; + + // Possible scenarios are: + // + // * The configuration analysis determined that a packet originating from + // the source is expected to reach the destination. + // * The analysis didn't complete because the user lacks permission for + // some of the resources in the trace. However, at the time the user's + // permission became insufficient, the trace had been successful so far. + REACHABLE = 1; + + // A packet originating from the source is expected to be dropped before + // reaching the destination. + UNREACHABLE = 2; + + // The source and destination endpoints do not uniquely identify + // the test location in the network, and the reachability result contains + // multiple traces. For some traces, a packet could be delivered, and for + // others, it would not be. + AMBIGUOUS = 4; + + // The configuration analysis did not complete. Possible reasons are: + // + // * A permissions error occurred--for example, the user might not have + // read permission for all of the resources named in the test. + // * An internal error occurred. + // * The analyzer received an invalid or unsupported argument or was unable + // to identify a known endpoint. + UNDETERMINED = 5; + } + + // The overall result of the test's configuration analysis. + Result result = 1; + + // The time of the configuration analysis. + google.protobuf.Timestamp verify_time = 2; + + // The details of a failure or a cancellation of reachability analysis. + google.rpc.Status error = 3; + + // Result may contain a list of traces if a test has multiple possible + // paths in the network, such as when destination endpoint is a load balancer + // with multiple backends. + repeated Trace traces = 5; +} + +// Latency percentile rank and value. +message LatencyPercentile { + // Percentage of samples this data point applies to. + int32 percent = 1; + + // percent-th percentile of latency observed, in microseconds. + // Fraction of percent/100 of samples have latency lower or + // equal to the value of this field. + int64 latency_micros = 2; +} + +// Describes measured latency distribution. +message LatencyDistribution { + // Representative latency percentiles. + repeated LatencyPercentile latency_percentiles = 1; +} + +// Results of active probing from the last run of the test. +message ProbingDetails { + // Overall probing result of the test. + enum ProbingResult { + // No result was specified. + PROBING_RESULT_UNSPECIFIED = 0; + + // At least 95% of packets reached the destination. + REACHABLE = 1; + + // No packets reached the destination. + UNREACHABLE = 2; + + // Less than 95% of packets reached the destination. + REACHABILITY_INCONSISTENT = 3; + + // Reachability could not be determined. Possible reasons are: + // * The user lacks permission to access some of the network resources + // required to run the test. + // * No valid source endpoint could be derived from the request. + // * An internal error occurred. + UNDETERMINED = 4; + } + + // Abort cause types. + enum ProbingAbortCause { + // No reason was specified. + PROBING_ABORT_CAUSE_UNSPECIFIED = 0; + + // The user lacks permission to access some of the + // network resources required to run the test. + PERMISSION_DENIED = 1; + + // No valid source endpoint could be derived from the request. + NO_SOURCE_LOCATION = 2; + } + + // Representation of a network edge location as per + // https://cloud.google.com/vpc/docs/edge-locations. + message EdgeLocation { + // Name of the metropolitan area. + string metropolitan_area = 1; + } + + // The overall result of active probing. + ProbingResult result = 1; + + // The time that reachability was assessed through active probing. + google.protobuf.Timestamp verify_time = 2; + + // Details about an internal failure or the cancellation of active probing. + google.rpc.Status error = 3; + + // The reason probing was aborted. + ProbingAbortCause abort_cause = 4; + + // Number of probes sent. + int32 sent_probe_count = 5; + + // Number of probes that reached the destination. + int32 successful_probe_count = 6; + + // The source and destination endpoints derived from the test input and used + // for active probing. + EndpointInfo endpoint_info = 7; + + // Latency as measured by active probing in one direction: + // from the source to the destination endpoint. + LatencyDistribution probing_latency = 8; + + // The EdgeLocation from which a packet destined for/originating from the + // internet will egress/ingress the Google network. + // This will only be populated for a connectivity test which has an internet + // destination/source address. + // The absence of this field *must not* be used as an indication that the + // destination/source is part of the Google network. + EdgeLocation destination_egress_location = 9; +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/reachability.proto b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/reachability.proto new file mode 100644 index 00000000000..6c642e51e46 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/reachability.proto @@ -0,0 +1,269 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.networkmanagement.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/networkmanagement/v1beta1/connectivity_test.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.NetworkManagement.V1Beta1"; +option go_package = "cloud.google.com/go/networkmanagement/apiv1beta1/networkmanagementpb;networkmanagementpb"; +option java_multiple_files = true; +option java_outer_classname = "ReachabilityServiceProto"; +option java_package = "com.google.cloud.networkmanagement.v1beta1"; +option php_namespace = "Google\\Cloud\\NetworkManagement\\V1beta1"; +option ruby_package = "Google::Cloud::NetworkManagement::V1beta1"; + +// The Reachability service in Google Cloud Network Management API + +// The Reachability service in the Google Cloud Network Management API provides +// services that analyze the reachability within a single Google Virtual Private +// Cloud (VPC) network, between peered VPC networks, between VPC and on-premises +// networks, or between VPC networks and internet hosts. A reachability analysis +// is based on Google Cloud network configurations. +// +// You can use the analysis results to verify these configurations and +// to troubleshoot connectivity issues. +service ReachabilityService { + option (google.api.default_host) = "networkmanagement.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists all Connectivity Tests owned by a project. + rpc ListConnectivityTests(ListConnectivityTestsRequest) returns (ListConnectivityTestsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/locations/global}/connectivityTests" + }; + } + + // Gets the details of a specific Connectivity Test. + rpc GetConnectivityTest(GetConnectivityTestRequest) returns (ConnectivityTest) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/global/connectivityTests/*}" + }; + } + + // Creates a new Connectivity Test. + // After you create a test, the reachability analysis is performed as part + // of the long running operation, which completes when the analysis completes. + // + // If the endpoint specifications in `ConnectivityTest` are invalid + // (for example, containing non-existent resources in the network, or you + // don't have read permissions to the network configurations of listed + // projects), then the reachability result returns a value of `UNKNOWN`. + // + // If the endpoint specifications in `ConnectivityTest` are + // incomplete, the reachability result returns a value of + // AMBIGUOUS. For more information, + // see the Connectivity Test documentation. + rpc CreateConnectivityTest(CreateConnectivityTestRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/global}/connectivityTests" + body: "resource" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.networkmanagement.v1beta1.ConnectivityTest" + metadata_type: "OperationMetadata" + }; + } + + // Updates the configuration of an existing `ConnectivityTest`. + // After you update a test, the reachability analysis is performed as part + // of the long running operation, which completes when the analysis completes. + // The Reachability state in the test resource is updated with the new result. + // + // If the endpoint specifications in `ConnectivityTest` are invalid + // (for example, they contain non-existent resources in the network, or the + // user does not have read permissions to the network configurations of + // listed projects), then the reachability result returns a value of + // UNKNOWN. + // + // If the endpoint specifications in `ConnectivityTest` are incomplete, the + // reachability result returns a value of `AMBIGUOUS`. See the documentation + // in `ConnectivityTest` for for more details. + rpc UpdateConnectivityTest(UpdateConnectivityTestRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta1/{resource.name=projects/*/locations/global/connectivityTests/*}" + body: "resource" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.networkmanagement.v1beta1.ConnectivityTest" + metadata_type: "OperationMetadata" + }; + } + + // Rerun an existing `ConnectivityTest`. + // After the user triggers the rerun, the reachability analysis is performed + // as part of the long running operation, which completes when the analysis + // completes. + // + // Even though the test configuration remains the same, the reachability + // result may change due to underlying network configuration changes. + // + // If the endpoint specifications in `ConnectivityTest` become invalid (for + // example, specified resources are deleted in the network, or you lost + // read permissions to the network configurations of listed projects), then + // the reachability result returns a value of `UNKNOWN`. + rpc RerunConnectivityTest(RerunConnectivityTestRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/global/connectivityTests/*}:rerun" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.networkmanagement.v1beta1.ConnectivityTest" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a specific `ConnectivityTest`. + rpc DeleteConnectivityTest(DeleteConnectivityTestRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta1/{name=projects/*/locations/global/connectivityTests/*}" + }; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } +} + +// Request for the `ListConnectivityTests` method. +message ListConnectivityTestsRequest { + // Required. The parent resource of the Connectivity Tests: + // `projects/{project_id}/locations/global` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Number of `ConnectivityTests` to return. + int32 page_size = 2; + + // Page token from an earlier query, as returned in `next_page_token`. + string page_token = 3; + + // Lists the `ConnectivityTests` that match the filter expression. A filter + // expression filters the resources listed in the response. The expression + // must be of the form ` ` where operators: `<`, `>`, + // `<=`, + // `>=`, + // `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is + // roughly synonymous with equality). can refer to a proto or JSON + // field, or a synthetic field. Field names can be camelCase or snake_case. + // + // Examples: + // - Filter by name: + // name = "projects/proj-1/locations/global/connectivityTests/test-1 + // + // - Filter by labels: + // - Resources that have a key called `foo` + // labels.foo:* + // - Resources that have a key called `foo` whose value is `bar` + // labels.foo = bar + string filter = 4; + + // Field to use to sort the list. + string order_by = 5; +} + +// Response for the `ListConnectivityTests` method. +message ListConnectivityTestsResponse { + // List of Connectivity Tests. + repeated ConnectivityTest resources = 1; + + // Page token to fetch the next set of Connectivity Tests. + string next_page_token = 2; + + // Locations that could not be reached (when querying all locations with `-`). + repeated string unreachable = 3; +} + +// Request for the `GetConnectivityTest` method. +message GetConnectivityTestRequest { + // Required. `ConnectivityTest` resource name using the form: + // `projects/{project_id}/locations/global/connectivityTests/{test_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `CreateConnectivityTest` method. +message CreateConnectivityTestRequest { + // Required. The parent resource of the Connectivity Test to create: + // `projects/{project_id}/locations/global` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The logical name of the Connectivity Test in your project + // with the following restrictions: + // + // * Must contain only lowercase letters, numbers, and hyphens. + // * Must start with a letter. + // * Must be between 1-40 characters. + // * Must end with a number or a letter. + // * Must be unique within the customer project + string test_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A `ConnectivityTest` resource + ConnectivityTest resource = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `UpdateConnectivityTest` method. +message UpdateConnectivityTestRequest { + // Required. Mask of fields to update. At least one path must be supplied in + // this field. + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Only fields specified in update_mask are updated. + ConnectivityTest resource = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `DeleteConnectivityTest` method. +message DeleteConnectivityTestRequest { + // Required. Connectivity Test resource name using the form: + // `projects/{project_id}/locations/global/connectivityTests/{test_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `RerunConnectivityTest` method. +message RerunConnectivityTestRequest { + // Required. Connectivity Test resource name using the form: + // `projects/{project_id}/locations/global/connectivityTests/{test_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Metadata describing an [Operation][google.longrunning.Operation] +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation finished running. + google.protobuf.Timestamp end_time = 2; + + // Target of the operation - for example + // projects/project-1/locations/global/connectivityTests/test-1 + string target = 3; + + // Name of the verb executed by the operation. + string verb = 4; + + // Human-readable status of the operation, if any. + string status_detail = 5; + + // Specifies if cancellation was requested for the operation. + bool cancel_requested = 6; + + // API version. + string api_version = 7; +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/trace.proto b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/trace.proto new file mode 100644 index 00000000000..ebc53ba0d09 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/trace.proto @@ -0,0 +1,1241 @@ +// 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 +// +// 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.networkmanagement.v1beta1; + +option csharp_namespace = "Google.Cloud.NetworkManagement.V1Beta1"; +option go_package = "cloud.google.com/go/networkmanagement/apiv1beta1/networkmanagementpb;networkmanagementpb"; +option java_multiple_files = true; +option java_outer_classname = "TraceProto"; +option java_package = "com.google.cloud.networkmanagement.v1beta1"; +option php_namespace = "Google\\Cloud\\NetworkManagement\\V1beta1"; +option ruby_package = "Google::Cloud::NetworkManagement::V1beta1"; + +// Trace represents one simulated packet forwarding path. +// +// * Each trace contains multiple ordered steps. +// * Each step is in a particular state with associated configuration. +// * State is categorized as final or non-final states. +// * Each final state has a reason associated. +// * Each trace must end with a final state (the last step). +// ``` +// |---------------------Trace----------------------| +// Step1(State) Step2(State) --- StepN(State(final)) +// ``` +message Trace { + // Derived from the source and destination endpoints definition specified by + // user request, and validated by the data plane model. + // If there are multiple traces starting from different source locations, then + // the endpoint_info may be different between traces. + EndpointInfo endpoint_info = 1; + + // A trace of a test contains multiple steps from the initial state to the + // final state (delivered, dropped, forwarded, or aborted). + // + // The steps are ordered by the processing sequence within the simulated + // network state machine. It is critical to preserve the order of the steps + // and avoid reordering or sorting them. + repeated Step steps = 2; +} + +// A simulated forwarding path is composed of multiple steps. +// Each step has a well-defined state and an associated configuration. +message Step { + // Type of states that are defined in the network state machine. + // Each step in the packet trace is in a specific state. + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // Initial state: packet originating from a Compute Engine instance. + // An InstanceInfo is populated with starting instance information. + START_FROM_INSTANCE = 1; + + // Initial state: packet originating from the internet. + // The endpoint information is populated. + START_FROM_INTERNET = 2; + + // Initial state: packet originating from a Google service. Some Google + // services, such as health check probers or Identity Aware Proxy use + // special routes, outside VPC routing configuration to reach Compute Engine + // Instances. + START_FROM_GOOGLE_SERVICE = 27; + + // Initial state: packet originating from a VPC or on-premises network + // with internal source IP. + // If the source is a VPC network visible to the user, a NetworkInfo + // is populated with details of the network. + START_FROM_PRIVATE_NETWORK = 3; + + // Initial state: packet originating from a Google Kubernetes Engine cluster + // master. A GKEMasterInfo is populated with starting instance information. + START_FROM_GKE_MASTER = 21; + + // Initial state: packet originating from a Cloud SQL instance. + // A CloudSQLInstanceInfo is populated with starting instance information. + START_FROM_CLOUD_SQL_INSTANCE = 22; + + // Initial state: packet originating from a Cloud Function. + // A CloudFunctionInfo is populated with starting function information. + START_FROM_CLOUD_FUNCTION = 23; + + // Initial state: packet originating from an App Engine service version. + // An AppEngineVersionInfo is populated with starting version information. + START_FROM_APP_ENGINE_VERSION = 25; + + // Initial state: packet originating from a Cloud Run revision. + // A CloudRunRevisionInfo is populated with starting revision information. + START_FROM_CLOUD_RUN_REVISION = 26; + + // Config checking state: verify ingress firewall rule. + APPLY_INGRESS_FIREWALL_RULE = 4; + + // Config checking state: verify egress firewall rule. + APPLY_EGRESS_FIREWALL_RULE = 5; + + // Config checking state: verify route. + APPLY_ROUTE = 6; + + // Config checking state: match forwarding rule. + APPLY_FORWARDING_RULE = 7; + + // Config checking state: packet sent or received under foreign IP + // address and allowed. + SPOOFING_APPROVED = 8; + + // Forwarding state: arriving at a Compute Engine instance. + ARRIVE_AT_INSTANCE = 9; + + // Forwarding state: arriving at a Compute Engine internal load balancer. + ARRIVE_AT_INTERNAL_LOAD_BALANCER = 10; + + // Forwarding state: arriving at a Compute Engine external load balancer. + ARRIVE_AT_EXTERNAL_LOAD_BALANCER = 11; + + // Forwarding state: arriving at a Cloud VPN gateway. + ARRIVE_AT_VPN_GATEWAY = 12; + + // Forwarding state: arriving at a Cloud VPN tunnel. + ARRIVE_AT_VPN_TUNNEL = 13; + + // Forwarding state: arriving at a VPC connector. + ARRIVE_AT_VPC_CONNECTOR = 24; + + // Transition state: packet header translated. + NAT = 14; + + // Transition state: original connection is terminated and a new proxied + // connection is initiated. + PROXY_CONNECTION = 15; + + // Final state: packet could be delivered. + DELIVER = 16; + + // Final state: packet could be dropped. + DROP = 17; + + // Final state: packet could be forwarded to a network with an unknown + // configuration. + FORWARD = 18; + + // Final state: analysis is aborted. + ABORT = 19; + + // Special state: viewer of the test result does not have permission to + // see the configuration in this step. + VIEWER_PERMISSION_MISSING = 20; + } + + // A description of the step. Usually this is a summary of the state. + string description = 1; + + // Each step is in one of the pre-defined states. + State state = 2; + + // This is a step that leads to the final state Drop. + bool causes_drop = 3; + + // Project ID that contains the configuration this step is validating. + string project_id = 4; + + // Configuration or metadata associated with each step. + // The configuration is filtered based on viewer's permission. If a viewer + // has no permission to view the configuration in this step, for non-final + // states a special state is populated (VIEWER_PERMISSION_MISSING), and for + // final state the configuration is cleared. + oneof step_info { + // Display information of a Compute Engine instance. + InstanceInfo instance = 5; + + // Display information of a Compute Engine firewall rule. + FirewallInfo firewall = 6; + + // Display information of a Compute Engine route. + RouteInfo route = 7; + + // Display information of the source and destination under analysis. + // The endpoint information in an intermediate state may differ with the + // initial input, as it might be modified by state like NAT, + // or Connection Proxy. + EndpointInfo endpoint = 8; + + // Display information of a Google service + GoogleServiceInfo google_service = 24; + + // Display information of a Compute Engine forwarding rule. + ForwardingRuleInfo forwarding_rule = 9; + + // Display information of a Compute Engine VPN gateway. + VpnGatewayInfo vpn_gateway = 10; + + // Display information of a Compute Engine VPN tunnel. + VpnTunnelInfo vpn_tunnel = 11; + + // Display information of a VPC connector. + VpcConnectorInfo vpc_connector = 21; + + // Display information of the final state "deliver" and reason. + DeliverInfo deliver = 12; + + // Display information of the final state "forward" and reason. + ForwardInfo forward = 13; + + // Display information of the final state "abort" and reason. + AbortInfo abort = 14; + + // Display information of the final state "drop" and reason. + DropInfo drop = 15; + + // Display information of the load balancers. + LoadBalancerInfo load_balancer = 16; + + // Display information of a Google Cloud network. + NetworkInfo network = 17; + + // Display information of a Google Kubernetes Engine cluster master. + GKEMasterInfo gke_master = 18; + + // Display information of a Cloud SQL instance. + CloudSQLInstanceInfo cloud_sql_instance = 19; + + // Display information of a Cloud Function. + CloudFunctionInfo cloud_function = 20; + + // Display information of an App Engine service version. + AppEngineVersionInfo app_engine_version = 22; + + // Display information of a Cloud Run revision. + CloudRunRevisionInfo cloud_run_revision = 23; + } +} + +// For display only. Metadata associated with a Compute Engine instance. +message InstanceInfo { + // Name of a Compute Engine instance. + string display_name = 1; + + // URI of a Compute Engine instance. + string uri = 2; + + // Name of the network interface of a Compute Engine instance. + string interface = 3; + + // URI of a Compute Engine network. + string network_uri = 4; + + // Internal IP address of the network interface. + string internal_ip = 5; + + // External IP address of the network interface. + string external_ip = 6; + + // Network tags configured on the instance. + repeated string network_tags = 7; + + // Service account authorized for the instance. + string service_account = 8 [deprecated = true]; +} + +// For display only. Metadata associated with a Compute Engine network. +message NetworkInfo { + // Name of a Compute Engine network. + string display_name = 1; + + // URI of a Compute Engine network. + string uri = 2; + + // The IP range that matches the test. + string matched_ip_range = 4; +} + +// For display only. Metadata associated with a VPC firewall rule, an implied +// VPC firewall rule, or a hierarchical firewall policy rule. +message FirewallInfo { + // The firewall rule's type. + enum FirewallRuleType { + // Unspecified type. + FIREWALL_RULE_TYPE_UNSPECIFIED = 0; + + // Hierarchical firewall policy rule. For details, see + // [Hierarchical firewall policies + // overview](https://cloud.google.com/vpc/docs/firewall-policies). + HIERARCHICAL_FIREWALL_POLICY_RULE = 1; + + // VPC firewall rule. For details, see + // [VPC firewall rules + // overview](https://cloud.google.com/vpc/docs/firewalls). + VPC_FIREWALL_RULE = 2; + + // Implied VPC firewall rule. For details, see + // [Implied + // rules](https://cloud.google.com/vpc/docs/firewalls#default_firewall_rules). + IMPLIED_VPC_FIREWALL_RULE = 3; + + // Implicit firewall rules that are managed by serverless VPC access to + // allow ingress access. They are not visible in the Google Cloud console. + // For details, see [VPC connector's implicit + // rules](https://cloud.google.com/functions/docs/networking/connecting-vpc#restrict-access). + SERVERLESS_VPC_ACCESS_MANAGED_FIREWALL_RULE = 4; + + // Global network firewall policy rule. + // For details, see [Network firewall + // policies](https://cloud.google.com/vpc/docs/network-firewall-policies). + NETWORK_FIREWALL_POLICY_RULE = 5; + + // Regional network firewall policy rule. + // For details, see [Regional network firewall + // policies](https://cloud.google.com/firewall/docs/regional-firewall-policies). + NETWORK_REGIONAL_FIREWALL_POLICY_RULE = 6; + } + + // The display name of the VPC firewall rule. This field is not applicable + // to hierarchical firewall policy rules. + string display_name = 1; + + // The URI of the VPC firewall rule. This field is not applicable to + // implied firewall rules or hierarchical firewall policy rules. + string uri = 2; + + // Possible values: INGRESS, EGRESS + string direction = 3; + + // Possible values: ALLOW, DENY + string action = 4; + + // The priority of the firewall rule. + int32 priority = 5; + + // The URI of the VPC network that the firewall rule is associated with. + // This field is not applicable to hierarchical firewall policy rules. + string network_uri = 6; + + // The target tags defined by the VPC firewall rule. This field is not + // applicable to hierarchical firewall policy rules. + repeated string target_tags = 7; + + // The target service accounts specified by the firewall rule. + repeated string target_service_accounts = 8; + + // The hierarchical firewall policy that this rule is associated with. + // This field is not applicable to VPC firewall rules. + string policy = 9; + + // The firewall rule's type. + FirewallRuleType firewall_rule_type = 10; +} + +// For display only. Metadata associated with a Compute Engine route. +message RouteInfo { + // Type of route: + enum RouteType { + // Unspecified type. Default value. + ROUTE_TYPE_UNSPECIFIED = 0; + + // Route is a subnet route automatically created by the system. + SUBNET = 1; + + // Static route created by the user, including the default route to the + // internet. + STATIC = 2; + + // Dynamic route exchanged between BGP peers. + DYNAMIC = 3; + + // A subnet route received from peering network. + PEERING_SUBNET = 4; + + // A static route received from peering network. + PEERING_STATIC = 5; + + // A dynamic route received from peering network. + PEERING_DYNAMIC = 6; + + // Policy based route. + POLICY_BASED = 7; + } + + // Type of next hop: + enum NextHopType { + // Unspecified type. Default value. + NEXT_HOP_TYPE_UNSPECIFIED = 0; + + // Next hop is an IP address. + NEXT_HOP_IP = 1; + + // Next hop is a Compute Engine instance. + NEXT_HOP_INSTANCE = 2; + + // Next hop is a VPC network gateway. + NEXT_HOP_NETWORK = 3; + + // Next hop is a peering VPC. + NEXT_HOP_PEERING = 4; + + // Next hop is an interconnect. + NEXT_HOP_INTERCONNECT = 5; + + // Next hop is a VPN tunnel. + NEXT_HOP_VPN_TUNNEL = 6; + + // Next hop is a VPN gateway. This scenario only happens when tracing + // connectivity from an on-premises network to Google Cloud through a VPN. + // The analysis simulates a packet departing from the on-premises network + // through a VPN tunnel and arriving at a Cloud VPN gateway. + NEXT_HOP_VPN_GATEWAY = 7; + + // Next hop is an internet gateway. + NEXT_HOP_INTERNET_GATEWAY = 8; + + // Next hop is blackhole; that is, the next hop either does not exist or is + // not running. + NEXT_HOP_BLACKHOLE = 9; + + // Next hop is the forwarding rule of an Internal Load Balancer. + NEXT_HOP_ILB = 10; + + // Next hop is a + // [router appliance + // instance](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/ra-overview). + NEXT_HOP_ROUTER_APPLIANCE = 11; + + // Next hop is an NCC hub. + NEXT_HOP_NCC_HUB = 12; + } + + // Indicates where routes are applicable. + enum RouteScope { + // Unspecified scope. Default value. + ROUTE_SCOPE_UNSPECIFIED = 0; + + // Route is applicable to packets in Network. + NETWORK = 1; + + // Route is applicable to packets using NCC Hub's routing table. + NCC_HUB = 2; + } + + // Type of route. + RouteType route_type = 8; + + // Type of next hop. + NextHopType next_hop_type = 9; + + // Indicates where route is applicable. + RouteScope route_scope = 14; + + // Name of a route. + string display_name = 1; + + // URI of a route. + // Dynamic, peering static and peering dynamic routes do not have an URI. + // Advertised route from Google Cloud VPC to on-premises network also does + // not have an URI. + string uri = 2; + + // Destination IP range of the route. + string dest_ip_range = 3; + + // Next hop of the route. + string next_hop = 4; + + // URI of a Compute Engine network. NETWORK routes only. + string network_uri = 5; + + // Priority of the route. + int32 priority = 6; + + // Instance tags of the route. + repeated string instance_tags = 7; + + // Source IP address range of the route. Policy based routes only. + string src_ip_range = 10; + + // Destination port ranges of the route. Policy based routes only. + repeated string dest_port_ranges = 11; + + // Source port ranges of the route. Policy based routes only. + repeated string src_port_ranges = 12; + + // Protocols of the route. Policy based routes only. + repeated string protocols = 13; + + // URI of a NCC Hub. NCC_HUB routes only. + optional string ncc_hub_uri = 15; + + // URI of a NCC Spoke. NCC_HUB routes only. + optional string ncc_spoke_uri = 16; +} + +// For display only. Details of a Google Service sending packets to a +// VPC network. Although the source IP might be a publicly routable address, +// some Google Services use special routes within Google production +// infrastructure to reach Compute Engine Instances. +// https://cloud.google.com/vpc/docs/routes#special_return_paths +message GoogleServiceInfo { + // Recognized type of a Google Service. + enum GoogleServiceType { + // Unspecified Google Service. Includes most of Google APIs and services. + GOOGLE_SERVICE_TYPE_UNSPECIFIED = 0; + + // Identity aware proxy. + // https://cloud.google.com/iap/docs/using-tcp-forwarding + IAP = 1; + + // One of two services sharing IP ranges: + // * Load Balancer proxy + // * Centralized Health Check prober + // https://cloud.google.com/load-balancing/docs/firewall-rules + GFE_PROXY_OR_HEALTH_CHECK_PROBER = 2; + + // Connectivity from Cloud DNS to forwarding targets or alternate name + // servers that use private routing. + // https://cloud.google.com/dns/docs/zones/forwarding-zones#firewall-rules + // https://cloud.google.com/dns/docs/policies#firewall-rules + CLOUD_DNS = 3; + } + + // Source IP address. + string source_ip = 1; + + // Recognized type of a Google Service. + GoogleServiceType google_service_type = 2; +} + +// For display only. Metadata associated with a Compute Engine forwarding rule. +message ForwardingRuleInfo { + // Name of a Compute Engine forwarding rule. + string display_name = 1; + + // URI of a Compute Engine forwarding rule. + string uri = 2; + + // Protocol defined in the forwarding rule that matches the test. + string matched_protocol = 3; + + // Port range defined in the forwarding rule that matches the test. + string matched_port_range = 6; + + // VIP of the forwarding rule. + string vip = 4; + + // Target type of the forwarding rule. + string target = 5; + + // Network URI. Only valid for Internal Load Balancer. + string network_uri = 7; +} + +// For display only. Metadata associated with a load balancer. +message LoadBalancerInfo { + // The type definition for a load balancer: + enum LoadBalancerType { + // Type is unspecified. + LOAD_BALANCER_TYPE_UNSPECIFIED = 0; + + // Internal TCP/UDP load balancer. + INTERNAL_TCP_UDP = 1; + + // Network TCP/UDP load balancer. + NETWORK_TCP_UDP = 2; + + // HTTP(S) proxy load balancer. + HTTP_PROXY = 3; + + // TCP proxy load balancer. + TCP_PROXY = 4; + + // SSL proxy load balancer. + SSL_PROXY = 5; + } + + // The type definition for a load balancer backend configuration: + enum BackendType { + // Type is unspecified. + BACKEND_TYPE_UNSPECIFIED = 0; + + // Backend Service as the load balancer's backend. + BACKEND_SERVICE = 1; + + // Target Pool as the load balancer's backend. + TARGET_POOL = 2; + + // Target Instance as the load balancer's backend. + TARGET_INSTANCE = 3; + } + + // Type of the load balancer. + LoadBalancerType load_balancer_type = 1; + + // URI of the health check for the load balancer. + string health_check_uri = 2; + + // Information for the loadbalancer backends. + repeated LoadBalancerBackend backends = 3; + + // Type of load balancer's backend configuration. + BackendType backend_type = 4; + + // Backend configuration URI. + string backend_uri = 5; +} + +// For display only. Metadata associated with a specific load balancer backend. +message LoadBalancerBackend { + // State of a health check firewall configuration: + enum HealthCheckFirewallState { + // State is unspecified. Default state if not populated. + HEALTH_CHECK_FIREWALL_STATE_UNSPECIFIED = 0; + + // There are configured firewall rules to allow health check probes to the + // backend. + CONFIGURED = 1; + + // There are firewall rules configured to allow partial health check ranges + // or block all health check ranges. + // If a health check probe is sent from denied IP ranges, + // the health check to the backend will fail. Then, the backend will be + // marked unhealthy and will not receive traffic sent to the load balancer. + MISCONFIGURED = 2; + } + + // Name of a Compute Engine instance or network endpoint. + string display_name = 1; + + // URI of a Compute Engine instance or network endpoint. + string uri = 2; + + // State of the health check firewall configuration. + HealthCheckFirewallState health_check_firewall_state = 3; + + // A list of firewall rule URIs allowing probes from health check IP ranges. + repeated string health_check_allowing_firewall_rules = 4; + + // A list of firewall rule URIs blocking probes from health check IP ranges. + repeated string health_check_blocking_firewall_rules = 5; +} + +// For display only. Metadata associated with a Compute Engine VPN gateway. +message VpnGatewayInfo { + // Name of a VPN gateway. + string display_name = 1; + + // URI of a VPN gateway. + string uri = 2; + + // URI of a Compute Engine network where the VPN gateway is configured. + string network_uri = 3; + + // IP address of the VPN gateway. + string ip_address = 4; + + // A VPN tunnel that is associated with this VPN gateway. + // There may be multiple VPN tunnels configured on a VPN gateway, and only + // the one relevant to the test is displayed. + string vpn_tunnel_uri = 5; + + // Name of a Google Cloud region where this VPN gateway is configured. + string region = 6; +} + +// For display only. Metadata associated with a Compute Engine VPN tunnel. +message VpnTunnelInfo { + // Types of VPN routing policy. For details, refer to [Networks and Tunnel + // routing](https://cloud.google.com/network-connectivity/docs/vpn/concepts/choosing-networks-routing/). + enum RoutingType { + // Unspecified type. Default value. + ROUTING_TYPE_UNSPECIFIED = 0; + + // Route based VPN. + ROUTE_BASED = 1; + + // Policy based routing. + POLICY_BASED = 2; + + // Dynamic (BGP) routing. + DYNAMIC = 3; + } + + // Name of a VPN tunnel. + string display_name = 1; + + // URI of a VPN tunnel. + string uri = 2; + + // URI of the VPN gateway at local end of the tunnel. + string source_gateway = 3; + + // URI of a VPN gateway at remote end of the tunnel. + string remote_gateway = 4; + + // Remote VPN gateway's IP address. + string remote_gateway_ip = 5; + + // Local VPN gateway's IP address. + string source_gateway_ip = 6; + + // URI of a Compute Engine network where the VPN tunnel is configured. + string network_uri = 7; + + // Name of a Google Cloud region where this VPN tunnel is configured. + string region = 8; + + // Type of the routing policy. + RoutingType routing_type = 9; +} + +// For display only. The specification of the endpoints for the test. +// EndpointInfo is derived from source and destination Endpoint and validated +// by the backend data plane model. +message EndpointInfo { + // Source IP address. + string source_ip = 1; + + // Destination IP address. + string destination_ip = 2; + + // IP protocol in string format, for example: "TCP", "UDP", "ICMP". + string protocol = 3; + + // Source port. Only valid when protocol is TCP or UDP. + int32 source_port = 4; + + // Destination port. Only valid when protocol is TCP or UDP. + int32 destination_port = 5; + + // URI of the network where this packet originates from. + string source_network_uri = 6; + + // URI of the network where this packet is sent to. + string destination_network_uri = 7; + + // URI of the source telemetry agent this packet originates from. + string source_agent_uri = 8; +} + +// Details of the final state "deliver" and associated resource. +message DeliverInfo { + // Deliver target types: + enum Target { + // Target not specified. + TARGET_UNSPECIFIED = 0; + + // Target is a Compute Engine instance. + INSTANCE = 1; + + // Target is the internet. + INTERNET = 2; + + // Target is a Google API. + GOOGLE_API = 3; + + // Target is a Google Kubernetes Engine cluster master. + GKE_MASTER = 4; + + // Target is a Cloud SQL instance. + CLOUD_SQL_INSTANCE = 5; + + // Target is a published service that uses [Private Service + // Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-services). + PSC_PUBLISHED_SERVICE = 6; + + // Target is all Google APIs that use [Private Service + // Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-apis). + PSC_GOOGLE_API = 7; + + // Target is a VPC-SC that uses [Private Service + // Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-apis). + PSC_VPC_SC = 8; + + // Target is a serverless network endpoint group. + SERVERLESS_NEG = 9; + } + + // Target type where the packet is delivered to. + Target target = 1; + + // URI of the resource that the packet is delivered to. + string resource_uri = 2; +} + +// Details of the final state "forward" and associated resource. +message ForwardInfo { + // Forward target types. + enum Target { + // Target not specified. + TARGET_UNSPECIFIED = 0; + + // Forwarded to a VPC peering network. + PEERING_VPC = 1; + + // Forwarded to a Cloud VPN gateway. + VPN_GATEWAY = 2; + + // Forwarded to a Cloud Interconnect connection. + INTERCONNECT = 3; + + // Forwarded to a Google Kubernetes Engine Container cluster master. + GKE_MASTER = 4; + + // Forwarded to the next hop of a custom route imported from a peering VPC. + IMPORTED_CUSTOM_ROUTE_NEXT_HOP = 5; + + // Forwarded to a Cloud SQL instance. + CLOUD_SQL_INSTANCE = 6; + + // Forwarded to a VPC network in another project. + ANOTHER_PROJECT = 7; + + // Forwarded to an NCC Hub. + NCC_HUB = 8; + } + + // Target type where this packet is forwarded to. + Target target = 1; + + // URI of the resource that the packet is forwarded to. + string resource_uri = 2; +} + +// Details of the final state "abort" and associated resource. +message AbortInfo { + // Abort cause types: + enum Cause { + // Cause is unspecified. + CAUSE_UNSPECIFIED = 0; + + // Aborted due to unknown network. + // The reachability analysis cannot proceed because the user does not have + // access to the host project's network configurations, including firewall + // rules and routes. This happens when the project is a service project and + // the endpoints being traced are in the host project's network. + UNKNOWN_NETWORK = 1; + + // Aborted because the IP address(es) are unknown. + UNKNOWN_IP = 2; + + // Aborted because no project information can be derived from the test + // input. + UNKNOWN_PROJECT = 3; + + // Aborted because the user lacks the permission to access all or part of + // the network configurations required to run the test. + PERMISSION_DENIED = 4; + + // Aborted because no valid source endpoint is derived from the input test + // request. + NO_SOURCE_LOCATION = 5; + + // Aborted because the source and/or destination endpoint specified in + // the test are invalid. The possible reasons that an endpoint is + // invalid include: malformed IP address; nonexistent instance or + // network URI; IP address not in the range of specified network URI; and + // instance not owning the network interface in the specified network. + INVALID_ARGUMENT = 6; + + // Aborted because traffic is sent from a public IP to an instance without + // an external IP. + NO_EXTERNAL_IP = 7; + + // Aborted because none of the traces matches destination information + // specified in the input test request. + UNINTENDED_DESTINATION = 8; + + // Aborted because the number of steps in the trace exceeding a certain + // limit which may be caused by routing loop. + TRACE_TOO_LONG = 9; + + // Aborted due to internal server error. + INTERNAL_ERROR = 10; + + // Aborted because the source endpoint could not be found. + SOURCE_ENDPOINT_NOT_FOUND = 11; + + // Aborted because the source network does not match the source endpoint. + MISMATCHED_SOURCE_NETWORK = 12; + + // Aborted because the destination endpoint could not be found. + DESTINATION_ENDPOINT_NOT_FOUND = 13; + + // Aborted because the destination network does not match the destination + // endpoint. + MISMATCHED_DESTINATION_NETWORK = 14; + + // Aborted because the test scenario is not supported. + UNSUPPORTED = 15; + + // Aborted because the source and destination resources have no common IP + // version. + MISMATCHED_IP_VERSION = 16; + + // Aborted because the connection between the control plane and the node of + // the source cluster is initiated by the node and managed by the + // Konnectivity proxy. + GKE_KONNECTIVITY_PROXY_UNSUPPORTED = 17; + + // Aborted because expected resource configuration was missing. + RESOURCE_CONFIG_NOT_FOUND = 18; + + // Aborted because a PSC endpoint selection for the Google-managed service + // is ambiguous (several PSC endpoints satisfy test input). + GOOGLE_MANAGED_SERVICE_AMBIGUOUS_PSC_ENDPOINT = 19; + + // Aborted because tests with a PSC-based Cloud SQL instance as a source are + // not supported. + SOURCE_PSC_CLOUD_SQL_UNSUPPORTED = 20; + + // Aborted because tests with a forwarding rule as a source are not + // supported. + SOURCE_FORWARDING_RULE_UNSUPPORTED = 21; + } + + // Causes that the analysis is aborted. + Cause cause = 1; + + // URI of the resource that caused the abort. + string resource_uri = 2; + + // List of project IDs that the user has specified in the request but does + // not have permission to access network configs. Analysis is aborted in this + // case with the PERMISSION_DENIED cause. + repeated string projects_missing_permission = 3; +} + +// Details of the final state "drop" and associated resource. +message DropInfo { + // Drop cause types: + enum Cause { + // Cause is unspecified. + CAUSE_UNSPECIFIED = 0; + + // Destination external address cannot be resolved to a known target. If + // the address is used in a Google Cloud project, provide the project ID + // as test input. + UNKNOWN_EXTERNAL_ADDRESS = 1; + + // A Compute Engine instance can only send or receive a packet with a + // foreign IP address if ip_forward is enabled. + FOREIGN_IP_DISALLOWED = 2; + + // Dropped due to a firewall rule, unless allowed due to connection + // tracking. + FIREWALL_RULE = 3; + + // Dropped due to no routes. + NO_ROUTE = 4; + + // Dropped due to invalid route. Route's next hop is a blackhole. + ROUTE_BLACKHOLE = 5; + + // Packet is sent to a wrong (unintended) network. Example: you trace a + // packet from VM1:Network1 to VM2:Network2, however, the route configured + // in Network1 sends the packet destined for VM2's IP addresss to Network3. + ROUTE_WRONG_NETWORK = 6; + + // Packet with internal destination address sent to the internet gateway. + PRIVATE_TRAFFIC_TO_INTERNET = 7; + + // Instance with only an internal IP address tries to access Google API and + // services, but private Google access is not enabled. + PRIVATE_GOOGLE_ACCESS_DISALLOWED = 8; + + // Instance with only an internal IP address tries to access external hosts, + // but Cloud NAT is not enabled in the subnet, unless special configurations + // on a VM allow this connection. + NO_EXTERNAL_ADDRESS = 9; + + // Destination internal address cannot be resolved to a known target. If + // this is a shared VPC scenario, verify if the service project ID is + // provided as test input. Otherwise, verify if the IP address is being + // used in the project. + UNKNOWN_INTERNAL_ADDRESS = 10; + + // Forwarding rule's protocol and ports do not match the packet header. + FORWARDING_RULE_MISMATCH = 11; + + // Packet could be dropped because it was sent from a different region + // to a regional forwarding without global access. + FORWARDING_RULE_REGION_MISMATCH = 25; + + // Forwarding rule does not have backends configured. + FORWARDING_RULE_NO_INSTANCES = 12; + + // Firewalls block the health check probes to the backends and cause + // the backends to be unavailable for traffic from the load balancer. + // For more details, see [Health check firewall + // rules](https://cloud.google.com/load-balancing/docs/health-checks#firewall_rules). + FIREWALL_BLOCKING_LOAD_BALANCER_BACKEND_HEALTH_CHECK = 13; + + // Packet is sent from or to a Compute Engine instance that is not in a + // running state. + INSTANCE_NOT_RUNNING = 14; + + // Packet sent from or to a GKE cluster that is not in running state. + GKE_CLUSTER_NOT_RUNNING = 27; + + // Packet sent from or to a Cloud SQL instance that is not in running state. + CLOUD_SQL_INSTANCE_NOT_RUNNING = 28; + + // The type of traffic is blocked and the user cannot configure a firewall + // rule to enable it. See [Always blocked + // traffic](https://cloud.google.com/vpc/docs/firewalls#blockedtraffic) for + // more details. + TRAFFIC_TYPE_BLOCKED = 15; + + // Access to Google Kubernetes Engine cluster master's endpoint is not + // authorized. See [Access to the cluster + // endpoints](https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters#access_to_the_cluster_endpoints) + // for more details. + GKE_MASTER_UNAUTHORIZED_ACCESS = 16; + + // Access to the Cloud SQL instance endpoint is not authorized. + // See [Authorizing with authorized + // networks](https://cloud.google.com/sql/docs/mysql/authorize-networks) for + // more details. + CLOUD_SQL_INSTANCE_UNAUTHORIZED_ACCESS = 17; + + // Packet was dropped inside Google Kubernetes Engine Service. + DROPPED_INSIDE_GKE_SERVICE = 18; + + // Packet was dropped inside Cloud SQL Service. + DROPPED_INSIDE_CLOUD_SQL_SERVICE = 19; + + // Packet was dropped because there is no peering between the originating + // network and the Google Managed Services Network. + GOOGLE_MANAGED_SERVICE_NO_PEERING = 20; + + // Packet was dropped because the Google-managed service uses Private + // Service Connect (PSC), but the PSC endpoint is not found in the project. + GOOGLE_MANAGED_SERVICE_NO_PSC_ENDPOINT = 38; + + // Packet was dropped because the GKE cluster uses Private Service Connect + // (PSC), but the PSC endpoint is not found in the project. + GKE_PSC_ENDPOINT_MISSING = 36; + + // Packet was dropped because the Cloud SQL instance has neither a private + // nor a public IP address. + CLOUD_SQL_INSTANCE_NO_IP_ADDRESS = 21; + + // Packet was dropped because a GKE cluster private endpoint is + // unreachable from a region different from the cluster's region. + GKE_CONTROL_PLANE_REGION_MISMATCH = 30; + + // Packet sent from a public GKE cluster control plane to a private + // IP address. + PUBLIC_GKE_CONTROL_PLANE_TO_PRIVATE_DESTINATION = 31; + + // Packet was dropped because there is no route from a GKE cluster + // control plane to a destination network. + GKE_CONTROL_PLANE_NO_ROUTE = 32; + + // Packet sent from a Cloud SQL instance to an external IP address is not + // allowed. The Cloud SQL instance is not configured to send packets to + // external IP addresses. + CLOUD_SQL_INSTANCE_NOT_CONFIGURED_FOR_EXTERNAL_TRAFFIC = 33; + + // Packet sent from a Cloud SQL instance with only a public IP address to a + // private IP address. + PUBLIC_CLOUD_SQL_INSTANCE_TO_PRIVATE_DESTINATION = 34; + + // Packet was dropped because there is no route from a Cloud SQL + // instance to a destination network. + CLOUD_SQL_INSTANCE_NO_ROUTE = 35; + + // Packet could be dropped because the Cloud Function is not in an active + // status. + CLOUD_FUNCTION_NOT_ACTIVE = 22; + + // Packet could be dropped because no VPC connector is set. + VPC_CONNECTOR_NOT_SET = 23; + + // Packet could be dropped because the VPC connector is not in a running + // state. + VPC_CONNECTOR_NOT_RUNNING = 24; + + // The Private Service Connect endpoint is in a project that is not approved + // to connect to the service. + PSC_CONNECTION_NOT_ACCEPTED = 26; + + // Packet sent from a Cloud Run revision that is not ready. + CLOUD_RUN_REVISION_NOT_READY = 29; + + // Packet was dropped inside Private Service Connect service producer. + DROPPED_INSIDE_PSC_SERVICE_PRODUCER = 37; + + // Packet sent to a load balancer, which requires a proxy-only subnet and + // the subnet is not found. + LOAD_BALANCER_HAS_NO_PROXY_SUBNET = 39; + } + + // Cause that the packet is dropped. + Cause cause = 1; + + // URI of the resource that caused the drop. + string resource_uri = 2; +} + +// For display only. Metadata associated with a Google Kubernetes Engine (GKE) +// cluster master. +message GKEMasterInfo { + // URI of a GKE cluster. + string cluster_uri = 2; + + // URI of a GKE cluster network. + string cluster_network_uri = 4; + + // Internal IP address of a GKE cluster master. + string internal_ip = 5; + + // External IP address of a GKE cluster master. + string external_ip = 6; +} + +// For display only. Metadata associated with a Cloud SQL instance. +message CloudSQLInstanceInfo { + // Name of a Cloud SQL instance. + string display_name = 1; + + // URI of a Cloud SQL instance. + string uri = 2; + + // URI of a Cloud SQL instance network or empty string if the instance does + // not have one. + string network_uri = 4; + + // Internal IP address of a Cloud SQL instance. + string internal_ip = 5; + + // External IP address of a Cloud SQL instance. + string external_ip = 6; + + // Region in which the Cloud SQL instance is running. + string region = 7; +} + +// For display only. Metadata associated with a Cloud Function. +message CloudFunctionInfo { + // Name of a Cloud Function. + string display_name = 1; + + // URI of a Cloud Function. + string uri = 2; + + // Location in which the Cloud Function is deployed. + string location = 3; + + // Latest successfully deployed version id of the Cloud Function. + int64 version_id = 4; +} + +// For display only. Metadata associated with a Cloud Run revision. +message CloudRunRevisionInfo { + // Name of a Cloud Run revision. + string display_name = 1; + + // URI of a Cloud Run revision. + string uri = 2; + + // Location in which this revision is deployed. + string location = 4; + + // URI of Cloud Run service this revision belongs to. + string service_uri = 5; +} + +// For display only. Metadata associated with an App Engine version. +message AppEngineVersionInfo { + // Name of an App Engine version. + string display_name = 1; + + // URI of an App Engine version. + string uri = 2; + + // Runtime of the App Engine version. + string runtime = 3; + + // App Engine execution environment for a version. + string environment = 4; +} + +// For display only. Metadata associated with a VPC connector. +message VpcConnectorInfo { + // Name of a VPC connector. + string display_name = 1; + + // URI of a VPC connector. + string uri = 2; + + // Location in which the VPC connector is deployed. + string location = 3; +} + +// Type of a load balancer. For more information, see [Summary of Google Cloud +// load +// balancers](https://cloud.google.com/load-balancing/docs/load-balancing-overview#summary-of-google-cloud-load-balancers). +enum LoadBalancerType { + // Forwarding rule points to a different target than a load balancer or a + // load balancer type is unknown. + LOAD_BALANCER_TYPE_UNSPECIFIED = 0; + + // Global external HTTP(S) load balancer. + HTTPS_ADVANCED_LOAD_BALANCER = 1; + + // Global external HTTP(S) load balancer (classic) + HTTPS_LOAD_BALANCER = 2; + + // Regional external HTTP(S) load balancer. + REGIONAL_HTTPS_LOAD_BALANCER = 3; + + // Internal HTTP(S) load balancer. + INTERNAL_HTTPS_LOAD_BALANCER = 4; + + // External SSL proxy load balancer. + SSL_PROXY_LOAD_BALANCER = 5; + + // External TCP proxy load balancer. + TCP_PROXY_LOAD_BALANCER = 6; + + // Internal regional TCP proxy load balancer. + INTERNAL_TCP_PROXY_LOAD_BALANCER = 7; + + // External TCP/UDP Network load balancer. + NETWORK_LOAD_BALANCER = 8; + + // Target-pool based external TCP/UDP Network load balancer. + LEGACY_NETWORK_LOAD_BALANCER = 9; + + // Internal TCP/UDP load balancer. + TCP_UDP_INTERNAL_LOAD_BALANCER = 10; +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.create_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.create_connectivity_test.js new file mode 100644 index 00000000000..32c809a7810 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.create_connectivity_test.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, testId, resource) { + // [START networkmanagement_v1beta1_generated_ReachabilityService_CreateConnectivityTest_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 parent resource of the Connectivity Test to create: + * `projects/{project_id}/locations/global` + */ + // const parent = 'abc123' + /** + * Required. The logical name of the Connectivity Test in your project + * with the following restrictions: + * * Must contain only lowercase letters, numbers, and hyphens. + * * Must start with a letter. + * * Must be between 1-40 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project + */ + // const testId = 'abc123' + /** + * Required. A `ConnectivityTest` resource + */ + // const resource = {} + + // Imports the Networkmanagement library + const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1beta1; + + // Instantiates a client + const networkmanagementClient = new ReachabilityServiceClient(); + + async function callCreateConnectivityTest() { + // Construct request + const request = { + parent, + testId, + resource, + }; + + // Run request + const [operation] = await networkmanagementClient.createConnectivityTest(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateConnectivityTest(); + // [END networkmanagement_v1beta1_generated_ReachabilityService_CreateConnectivityTest_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-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.delete_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.delete_connectivity_test.js new file mode 100644 index 00000000000..779d0bba582 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.delete_connectivity_test.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 networkmanagement_v1beta1_generated_ReachabilityService_DeleteConnectivityTest_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. Connectivity Test resource name using the form: + * `projects/{project_id}/locations/global/connectivityTests/{test_id}` + */ + // const name = 'abc123' + + // Imports the Networkmanagement library + const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1beta1; + + // Instantiates a client + const networkmanagementClient = new ReachabilityServiceClient(); + + async function callDeleteConnectivityTest() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networkmanagementClient.deleteConnectivityTest(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteConnectivityTest(); + // [END networkmanagement_v1beta1_generated_ReachabilityService_DeleteConnectivityTest_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-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.get_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.get_connectivity_test.js new file mode 100644 index 00000000000..36b77449e00 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.get_connectivity_test.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 networkmanagement_v1beta1_generated_ReachabilityService_GetConnectivityTest_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. `ConnectivityTest` resource name using the form: + * `projects/{project_id}/locations/global/connectivityTests/{test_id}` + */ + // const name = 'abc123' + + // Imports the Networkmanagement library + const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1beta1; + + // Instantiates a client + const networkmanagementClient = new ReachabilityServiceClient(); + + async function callGetConnectivityTest() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await networkmanagementClient.getConnectivityTest(request); + console.log(response); + } + + callGetConnectivityTest(); + // [END networkmanagement_v1beta1_generated_ReachabilityService_GetConnectivityTest_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-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.list_connectivity_tests.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.list_connectivity_tests.js new file mode 100644 index 00000000000..d4c6277f0af --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.list_connectivity_tests.js @@ -0,0 +1,95 @@ +// 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 networkmanagement_v1beta1_generated_ReachabilityService_ListConnectivityTests_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 parent resource of the Connectivity Tests: + * `projects/{project_id}/locations/global` + */ + // const parent = 'abc123' + /** + * Number of `ConnectivityTests` to return. + */ + // const pageSize = 1234 + /** + * Page token from an earlier query, as returned in `next_page_token`. + */ + // const pageToken = 'abc123' + /** + * Lists the `ConnectivityTests` that match the filter expression. A filter + * expression filters the resources listed in the response. The expression + * must be of the form ` ` where operators: `<`, `>`, + * `<=`, + * `>=`, + * `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is + * roughly synonymous with equality). can refer to a proto or JSON + * field, or a synthetic field. Field names can be camelCase or snake_case. + * Examples: + * - Filter by name: + * name = "projects/proj-1/locations/global/connectivityTests/test-1 + * - Filter by labels: + * - Resources that have a key called `foo` + * labels.foo:* + * - Resources that have a key called `foo` whose value is `bar` + * labels.foo = bar + */ + // const filter = 'abc123' + /** + * Field to use to sort the list. + */ + // const orderBy = 'abc123' + + // Imports the Networkmanagement library + const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1beta1; + + // Instantiates a client + const networkmanagementClient = new ReachabilityServiceClient(); + + async function callListConnectivityTests() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await networkmanagementClient.listConnectivityTestsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConnectivityTests(); + // [END networkmanagement_v1beta1_generated_ReachabilityService_ListConnectivityTests_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-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.rerun_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.rerun_connectivity_test.js new file mode 100644 index 00000000000..ab700df0a97 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.rerun_connectivity_test.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 networkmanagement_v1beta1_generated_ReachabilityService_RerunConnectivityTest_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. Connectivity Test resource name using the form: + * `projects/{project_id}/locations/global/connectivityTests/{test_id}` + */ + // const name = 'abc123' + + // Imports the Networkmanagement library + const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1beta1; + + // Instantiates a client + const networkmanagementClient = new ReachabilityServiceClient(); + + async function callRerunConnectivityTest() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networkmanagementClient.rerunConnectivityTest(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRerunConnectivityTest(); + // [END networkmanagement_v1beta1_generated_ReachabilityService_RerunConnectivityTest_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-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.update_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.update_connectivity_test.js new file mode 100644 index 00000000000..97e4345ec1a --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.update_connectivity_test.js @@ -0,0 +1,68 @@ +// 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(updateMask, resource) { + // [START networkmanagement_v1beta1_generated_ReachabilityService_UpdateConnectivityTest_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. Mask of fields to update. At least one path must be supplied in + * this field. + */ + // const updateMask = {} + /** + * Required. Only fields specified in update_mask are updated. + */ + // const resource = {} + + // Imports the Networkmanagement library + const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1beta1; + + // Instantiates a client + const networkmanagementClient = new ReachabilityServiceClient(); + + async function callUpdateConnectivityTest() { + // Construct request + const request = { + updateMask, + resource, + }; + + // Run request + const [operation] = await networkmanagementClient.updateConnectivityTest(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateConnectivityTest(); + // [END networkmanagement_v1beta1_generated_ReachabilityService_UpdateConnectivityTest_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-networkmanagement/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.networkmanagement.v1beta1.json b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.networkmanagement.v1beta1.json new file mode 100644 index 00000000000..3c9479a081a --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.networkmanagement.v1beta1.json @@ -0,0 +1,283 @@ +{ + "clientLibrary": { + "name": "nodejs-networkmanagement", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.networkmanagement.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "networkmanagement_v1beta1_generated_ReachabilityService_ListConnectivityTests_async", + "title": "ReachabilityService listConnectivityTests Sample", + "origin": "API_DEFINITION", + "description": " Lists all Connectivity Tests owned by a project.", + "canonical": true, + "file": "reachability_service.list_connectivity_tests.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConnectivityTests", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.ListConnectivityTests", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkmanagement.v1beta1.ListConnectivityTestsResponse", + "client": { + "shortName": "ReachabilityServiceClient", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityServiceClient" + }, + "method": { + "shortName": "ListConnectivityTests", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.ListConnectivityTests", + "service": { + "shortName": "ReachabilityService", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService" + } + } + } + }, + { + "regionTag": "networkmanagement_v1beta1_generated_ReachabilityService_GetConnectivityTest_async", + "title": "ReachabilityService getConnectivityTest Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a specific Connectivity Test.", + "canonical": true, + "file": "reachability_service.get_connectivity_test.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.GetConnectivityTest", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkmanagement.v1beta1.ConnectivityTest", + "client": { + "shortName": "ReachabilityServiceClient", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityServiceClient" + }, + "method": { + "shortName": "GetConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.GetConnectivityTest", + "service": { + "shortName": "ReachabilityService", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService" + } + } + } + }, + { + "regionTag": "networkmanagement_v1beta1_generated_ReachabilityService_CreateConnectivityTest_async", + "title": "ReachabilityService createConnectivityTest Sample", + "origin": "API_DEFINITION", + "description": " Creates a new Connectivity Test. After you create a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. If the endpoint specifications in `ConnectivityTest` are invalid (for example, containing non-existent resources in the network, or you don't have read permissions to the network configurations of listed projects), then the reachability result returns a value of `UNKNOWN`. If the endpoint specifications in `ConnectivityTest` are incomplete, the reachability result returns a value of AMBIGUOUS. For more information, see the Connectivity Test documentation.", + "canonical": true, + "file": "reachability_service.create_connectivity_test.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.CreateConnectivityTest", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "test_id", + "type": "TYPE_STRING" + }, + { + "name": "resource", + "type": ".google.cloud.networkmanagement.v1beta1.ConnectivityTest" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ReachabilityServiceClient", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityServiceClient" + }, + "method": { + "shortName": "CreateConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.CreateConnectivityTest", + "service": { + "shortName": "ReachabilityService", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService" + } + } + } + }, + { + "regionTag": "networkmanagement_v1beta1_generated_ReachabilityService_UpdateConnectivityTest_async", + "title": "ReachabilityService updateConnectivityTest Sample", + "origin": "API_DEFINITION", + "description": " Updates the configuration of an existing `ConnectivityTest`. After you update a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. The Reachability state in the test resource is updated with the new result. If the endpoint specifications in `ConnectivityTest` are invalid (for example, they contain non-existent resources in the network, or the user does not have read permissions to the network configurations of listed projects), then the reachability result returns a value of UNKNOWN. If the endpoint specifications in `ConnectivityTest` are incomplete, the reachability result returns a value of `AMBIGUOUS`. See the documentation in `ConnectivityTest` for for more details.", + "canonical": true, + "file": "reachability_service.update_connectivity_test.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.UpdateConnectivityTest", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "resource", + "type": ".google.cloud.networkmanagement.v1beta1.ConnectivityTest" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ReachabilityServiceClient", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityServiceClient" + }, + "method": { + "shortName": "UpdateConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.UpdateConnectivityTest", + "service": { + "shortName": "ReachabilityService", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService" + } + } + } + }, + { + "regionTag": "networkmanagement_v1beta1_generated_ReachabilityService_RerunConnectivityTest_async", + "title": "ReachabilityService rerunConnectivityTest Sample", + "origin": "API_DEFINITION", + "description": " Rerun an existing `ConnectivityTest`. After the user triggers the rerun, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. Even though the test configuration remains the same, the reachability result may change due to underlying network configuration changes. If the endpoint specifications in `ConnectivityTest` become invalid (for example, specified resources are deleted in the network, or you lost read permissions to the network configurations of listed projects), then the reachability result returns a value of `UNKNOWN`.", + "canonical": true, + "file": "reachability_service.rerun_connectivity_test.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RerunConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.RerunConnectivityTest", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ReachabilityServiceClient", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityServiceClient" + }, + "method": { + "shortName": "RerunConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.RerunConnectivityTest", + "service": { + "shortName": "ReachabilityService", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService" + } + } + } + }, + { + "regionTag": "networkmanagement_v1beta1_generated_ReachabilityService_DeleteConnectivityTest_async", + "title": "ReachabilityService deleteConnectivityTest Sample", + "origin": "API_DEFINITION", + "description": " Deletes a specific `ConnectivityTest`.", + "canonical": true, + "file": "reachability_service.delete_connectivity_test.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.DeleteConnectivityTest", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ReachabilityServiceClient", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityServiceClient" + }, + "method": { + "shortName": "DeleteConnectivityTest", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.DeleteConnectivityTest", + "service": { + "shortName": "ReachabilityService", + "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/index.ts new file mode 100644 index 00000000000..9081c16e578 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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 ReachabilityServiceClient = v1beta1.ReachabilityServiceClient; +type ReachabilityServiceClient = v1beta1.ReachabilityServiceClient; +export {v1beta1, ReachabilityServiceClient}; +export default {v1beta1, ReachabilityServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/gapic_metadata.json new file mode 100644 index 00000000000..ef6ab2ba0d6 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/gapic_metadata.json @@ -0,0 +1,87 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.networkmanagement.v1beta1", + "libraryPackage": "@google-cloud/network-management", + "services": { + "ReachabilityService": { + "clients": { + "grpc": { + "libraryClient": "ReachabilityServiceClient", + "rpcs": { + "GetConnectivityTest": { + "methods": [ + "getConnectivityTest" + ] + }, + "CreateConnectivityTest": { + "methods": [ + "createConnectivityTest" + ] + }, + "UpdateConnectivityTest": { + "methods": [ + "updateConnectivityTest" + ] + }, + "RerunConnectivityTest": { + "methods": [ + "rerunConnectivityTest" + ] + }, + "DeleteConnectivityTest": { + "methods": [ + "deleteConnectivityTest" + ] + }, + "ListConnectivityTests": { + "methods": [ + "listConnectivityTests", + "listConnectivityTestsStream", + "listConnectivityTestsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ReachabilityServiceClient", + "rpcs": { + "GetConnectivityTest": { + "methods": [ + "getConnectivityTest" + ] + }, + "CreateConnectivityTest": { + "methods": [ + "createConnectivityTest" + ] + }, + "UpdateConnectivityTest": { + "methods": [ + "updateConnectivityTest" + ] + }, + "RerunConnectivityTest": { + "methods": [ + "rerunConnectivityTest" + ] + }, + "DeleteConnectivityTest": { + "methods": [ + "deleteConnectivityTest" + ] + }, + "ListConnectivityTests": { + "methods": [ + "listConnectivityTests", + "listConnectivityTestsStream", + "listConnectivityTestsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/index.ts new file mode 100644 index 00000000000..ffe401de1fe --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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 {ReachabilityServiceClient} from './reachability_service_client'; diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_client.ts b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_client.ts new file mode 100644 index 00000000000..9a44026ce70 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_client.ts @@ -0,0 +1,1139 @@ +// 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, GrpcClientOptions, LROperation, 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/v1beta1/reachability_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './reachability_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The Reachability service in the Google Cloud Network Management API provides + * services that analyze the reachability within a single Google Virtual Private + * Cloud (VPC) network, between peered VPC networks, between VPC and on-premises + * networks, or between VPC networks and internet hosts. A reachability analysis + * is based on Google Cloud network configurations. + * + * You can use the analysis results to verify these configurations and + * to troubleshoot connectivity issues. + * @class + * @memberof v1beta1 + */ +export class ReachabilityServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + reachabilityServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ReachabilityServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 ReachabilityServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ReachabilityServiceClient; + 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 { + 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 = { + connectivityTestPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/global/connectivityTests/{test}' + ), + }; + + // 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 = { + listConnectivityTests: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta1/{resource=projects/*/locations/global/connectivityTests/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta1/{resource=projects/*/locations/global/connectivityTests/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta1/{resource=projects/*/locations/global/connectivityTests/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=projects/*/locations/global/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/{name=projects/*/locations/global}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createConnectivityTestResponse = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1beta1.ConnectivityTest') as gax.protobuf.Type; + const createConnectivityTestMetadata = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1beta1.OperationMetadata') as gax.protobuf.Type; + const updateConnectivityTestResponse = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1beta1.ConnectivityTest') as gax.protobuf.Type; + const updateConnectivityTestMetadata = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1beta1.OperationMetadata') as gax.protobuf.Type; + const rerunConnectivityTestResponse = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1beta1.ConnectivityTest') as gax.protobuf.Type; + const rerunConnectivityTestMetadata = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1beta1.OperationMetadata') as gax.protobuf.Type; + const deleteConnectivityTestResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteConnectivityTestMetadata = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1beta1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createConnectivityTest: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createConnectivityTestResponse.decode.bind(createConnectivityTestResponse), + createConnectivityTestMetadata.decode.bind(createConnectivityTestMetadata)), + updateConnectivityTest: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateConnectivityTestResponse.decode.bind(updateConnectivityTestResponse), + updateConnectivityTestMetadata.decode.bind(updateConnectivityTestMetadata)), + rerunConnectivityTest: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + rerunConnectivityTestResponse.decode.bind(rerunConnectivityTestResponse), + rerunConnectivityTestMetadata.decode.bind(rerunConnectivityTestMetadata)), + deleteConnectivityTest: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteConnectivityTestResponse.decode.bind(deleteConnectivityTestResponse), + deleteConnectivityTestMetadata.decode.bind(deleteConnectivityTestMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.networkmanagement.v1beta1.ReachabilityService', 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.reachabilityServiceStub) { + return this.reachabilityServiceStub; + } + + // Put together the "service stub" for + // google.cloud.networkmanagement.v1beta1.ReachabilityService. + this.reachabilityServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.networkmanagement.v1beta1.ReachabilityService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networkmanagement.v1beta1.ReachabilityService, + 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 reachabilityServiceStubMethods = + ['listConnectivityTests', 'getConnectivityTest', 'createConnectivityTest', 'updateConnectivityTest', 'rerunConnectivityTest', 'deleteConnectivityTest']; + for (const methodName of reachabilityServiceStubMethods) { + const callPromise = this.reachabilityServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.reachabilityServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'networkmanagement.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 'networkmanagement.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 -- + // ------------------- +/** + * Gets the details of a specific Connectivity Test. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. `ConnectivityTest` resource name using the form: + * `projects/{project_id}/locations/global/connectivityTests/{test_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 protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest|ConnectivityTest}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/reachability_service.get_connectivity_test.js + * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_GetConnectivityTest_async + */ + getConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest, + protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest|undefined, {}|undefined + ]>; + getConnectivityTest( + request: protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest, + protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest|null|undefined, + {}|null|undefined>): void; + getConnectivityTest( + request: protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest, + callback: Callback< + protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest, + protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest|null|undefined, + {}|null|undefined>): void; + getConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest, + protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest, + protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest, + protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest|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.getConnectivityTest(request, options, callback); + } + +/** + * Creates a new Connectivity Test. + * After you create a test, the reachability analysis is performed as part + * of the long running operation, which completes when the analysis completes. + * + * If the endpoint specifications in `ConnectivityTest` are invalid + * (for example, containing non-existent resources in the network, or you + * don't have read permissions to the network configurations of listed + * projects), then the reachability result returns a value of `UNKNOWN`. + * + * If the endpoint specifications in `ConnectivityTest` are + * incomplete, the reachability result returns a value of + * AMBIGUOUS. For more information, + * see the Connectivity Test documentation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the Connectivity Test to create: + * `projects/{project_id}/locations/global` + * @param {string} request.testId + * Required. The logical name of the Connectivity Test in your project + * with the following restrictions: + * + * * Must contain only lowercase letters, numbers, and hyphens. + * * Must start with a letter. + * * Must be between 1-40 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project + * @param {google.cloud.networkmanagement.v1beta1.ConnectivityTest} request.resource + * Required. A `ConnectivityTest` 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/reachability_service.create_connectivity_test.js + * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_CreateConnectivityTest_async + */ + createConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1beta1.ICreateConnectivityTestRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createConnectivityTest( + request: protos.google.cloud.networkmanagement.v1beta1.ICreateConnectivityTestRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConnectivityTest( + request: protos.google.cloud.networkmanagement.v1beta1.ICreateConnectivityTestRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1beta1.ICreateConnectivityTestRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createConnectivityTest(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createConnectivityTest()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/reachability_service.create_connectivity_test.js + * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_CreateConnectivityTest_async + */ + async checkCreateConnectivityTestProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConnectivityTest, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the configuration of an existing `ConnectivityTest`. + * After you update a test, the reachability analysis is performed as part + * of the long running operation, which completes when the analysis completes. + * The Reachability state in the test resource is updated with the new result. + * + * If the endpoint specifications in `ConnectivityTest` are invalid + * (for example, they contain non-existent resources in the network, or the + * user does not have read permissions to the network configurations of + * listed projects), then the reachability result returns a value of + * UNKNOWN. + * + * If the endpoint specifications in `ConnectivityTest` are incomplete, the + * reachability result returns a value of `AMBIGUOUS`. See the documentation + * in `ConnectivityTest` for for more details. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. At least one path must be supplied in + * this field. + * @param {google.cloud.networkmanagement.v1beta1.ConnectivityTest} request.resource + * Required. Only fields specified in update_mask are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/reachability_service.update_connectivity_test.js + * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_UpdateConnectivityTest_async + */ + updateConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1beta1.IUpdateConnectivityTestRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateConnectivityTest( + request: protos.google.cloud.networkmanagement.v1beta1.IUpdateConnectivityTestRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateConnectivityTest( + request: protos.google.cloud.networkmanagement.v1beta1.IUpdateConnectivityTestRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1beta1.IUpdateConnectivityTestRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource.name': request.resource!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateConnectivityTest(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateConnectivityTest()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/reachability_service.update_connectivity_test.js + * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_UpdateConnectivityTest_async + */ + async checkUpdateConnectivityTestProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateConnectivityTest, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Rerun an existing `ConnectivityTest`. + * After the user triggers the rerun, the reachability analysis is performed + * as part of the long running operation, which completes when the analysis + * completes. + * + * Even though the test configuration remains the same, the reachability + * result may change due to underlying network configuration changes. + * + * If the endpoint specifications in `ConnectivityTest` become invalid (for + * example, specified resources are deleted in the network, or you lost + * read permissions to the network configurations of listed projects), then + * the reachability result returns a value of `UNKNOWN`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Connectivity Test resource name using the form: + * `projects/{project_id}/locations/global/connectivityTests/{test_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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/reachability_service.rerun_connectivity_test.js + * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_RerunConnectivityTest_async + */ + rerunConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1beta1.IRerunConnectivityTestRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + rerunConnectivityTest( + request: protos.google.cloud.networkmanagement.v1beta1.IRerunConnectivityTestRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + rerunConnectivityTest( + request: protos.google.cloud.networkmanagement.v1beta1.IRerunConnectivityTestRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + rerunConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1beta1.IRerunConnectivityTestRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.rerunConnectivityTest(request, options, callback); + } +/** + * Check the status of the long running operation returned by `rerunConnectivityTest()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/reachability_service.rerun_connectivity_test.js + * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_RerunConnectivityTest_async + */ + async checkRerunConnectivityTestProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.rerunConnectivityTest, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a specific `ConnectivityTest`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Connectivity Test resource name using the form: + * `projects/{project_id}/locations/global/connectivityTests/{test_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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/reachability_service.delete_connectivity_test.js + * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_DeleteConnectivityTest_async + */ + deleteConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1beta1.IDeleteConnectivityTestRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteConnectivityTest( + request: protos.google.cloud.networkmanagement.v1beta1.IDeleteConnectivityTestRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConnectivityTest( + request: protos.google.cloud.networkmanagement.v1beta1.IDeleteConnectivityTestRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConnectivityTest( + request?: protos.google.cloud.networkmanagement.v1beta1.IDeleteConnectivityTestRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteConnectivityTest(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteConnectivityTest()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/reachability_service.delete_connectivity_test.js + * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_DeleteConnectivityTest_async + */ + async checkDeleteConnectivityTestProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConnectivityTest, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists all Connectivity Tests owned by a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the Connectivity Tests: + * `projects/{project_id}/locations/global` + * @param {number} request.pageSize + * Number of `ConnectivityTests` to return. + * @param {string} request.pageToken + * Page token from an earlier query, as returned in `next_page_token`. + * @param {string} request.filter + * Lists the `ConnectivityTests` that match the filter expression. A filter + * expression filters the resources listed in the response. The expression + * must be of the form ` ` where operators: `<`, `>`, + * `<=`, + * `>=`, + * `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is + * roughly synonymous with equality). can refer to a proto or JSON + * field, or a synthetic field. Field names can be camelCase or snake_case. + * + * Examples: + * - Filter by name: + * name = "projects/proj-1/locations/global/connectivityTests/test-1 + * + * - Filter by labels: + * - Resources that have a key called `foo` + * labels.foo:* + * - Resources that have a key called `foo` whose value is `bar` + * labels.foo = bar + * @param {string} request.orderBy + * Field to use to sort the list. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest|ConnectivityTest}. + * 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 `listConnectivityTestsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listConnectivityTests( + request?: protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest[], + protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest|null, + protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsResponse + ]>; + listConnectivityTests( + request: protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, + protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsResponse|null|undefined, + protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest>): void; + listConnectivityTests( + request: protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, + callback: PaginationCallback< + protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, + protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsResponse|null|undefined, + protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest>): void; + listConnectivityTests( + request?: protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, + protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsResponse|null|undefined, + protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest>, + callback?: PaginationCallback< + protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, + protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsResponse|null|undefined, + protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest>): + Promise<[ + protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest[], + protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest|null, + protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listConnectivityTests(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the Connectivity Tests: + * `projects/{project_id}/locations/global` + * @param {number} request.pageSize + * Number of `ConnectivityTests` to return. + * @param {string} request.pageToken + * Page token from an earlier query, as returned in `next_page_token`. + * @param {string} request.filter + * Lists the `ConnectivityTests` that match the filter expression. A filter + * expression filters the resources listed in the response. The expression + * must be of the form ` ` where operators: `<`, `>`, + * `<=`, + * `>=`, + * `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is + * roughly synonymous with equality). can refer to a proto or JSON + * field, or a synthetic field. Field names can be camelCase or snake_case. + * + * Examples: + * - Filter by name: + * name = "projects/proj-1/locations/global/connectivityTests/test-1 + * + * - Filter by labels: + * - Resources that have a key called `foo` + * labels.foo:* + * - Resources that have a key called `foo` whose value is `bar` + * labels.foo = bar + * @param {string} request.orderBy + * Field to use to sort the list. + * @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 protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest|ConnectivityTest} 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 `listConnectivityTestsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listConnectivityTestsStream( + request?: protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, + 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['listConnectivityTests']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConnectivityTests.createStream( + this.innerApiCalls.listConnectivityTests as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listConnectivityTests`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the Connectivity Tests: + * `projects/{project_id}/locations/global` + * @param {number} request.pageSize + * Number of `ConnectivityTests` to return. + * @param {string} request.pageToken + * Page token from an earlier query, as returned in `next_page_token`. + * @param {string} request.filter + * Lists the `ConnectivityTests` that match the filter expression. A filter + * expression filters the resources listed in the response. The expression + * must be of the form ` ` where operators: `<`, `>`, + * `<=`, + * `>=`, + * `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is + * roughly synonymous with equality). can refer to a proto or JSON + * field, or a synthetic field. Field names can be camelCase or snake_case. + * + * Examples: + * - Filter by name: + * name = "projects/proj-1/locations/global/connectivityTests/test-1 + * + * - Filter by labels: + * - Resources that have a key called `foo` + * labels.foo:* + * - Resources that have a key called `foo` whose value is `bar` + * labels.foo = bar + * @param {string} request.orderBy + * Field to use to sort the list. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest|ConnectivityTest}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/reachability_service.list_connectivity_tests.js + * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_ListConnectivityTests_async + */ + listConnectivityTestsAsync( + request?: protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, + 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['listConnectivityTests']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConnectivityTests.asyncIterate( + this.innerApiCalls['listConnectivityTests'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified connectivityTest resource name string. + * + * @param {string} project + * @param {string} test + * @returns {string} Resource name string. + */ + connectivityTestPath(project:string,test:string) { + return this.pathTemplates.connectivityTestPathTemplate.render({ + project: project, + test: test, + }); + } + + /** + * Parse the project from ConnectivityTest resource. + * + * @param {string} connectivityTestName + * A fully-qualified path representing ConnectivityTest resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConnectivityTestName(connectivityTestName: string) { + return this.pathTemplates.connectivityTestPathTemplate.match(connectivityTestName).project; + } + + /** + * Parse the test from ConnectivityTest resource. + * + * @param {string} connectivityTestName + * A fully-qualified path representing ConnectivityTest resource. + * @returns {string} A string representing the test. + */ + matchTestFromConnectivityTestName(connectivityTestName: string) { + return this.pathTemplates.connectivityTestPathTemplate.match(connectivityTestName).test; + } + + /** + * 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.reachabilityServiceStub && !this._terminated) { + return this.reachabilityServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_client_config.json b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_client_config.json new file mode 100644 index 00000000000..0d2fd849ae5 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_client_config.json @@ -0,0 +1,56 @@ +{ + "interfaces": { + "google.cloud.networkmanagement.v1beta1.ReachabilityService": { + "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": { + "ListConnectivityTests": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetConnectivityTest": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateConnectivityTest": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateConnectivityTest": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RerunConnectivityTest": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteConnectivityTest": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_proto_list.json b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_proto_list.json new file mode 100644 index 00000000000..7b7d6d56cc1 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/networkmanagement/v1beta1/connectivity_test.proto", + "../../protos/google/cloud/networkmanagement/v1beta1/reachability.proto", + "../../protos/google/cloud/networkmanagement/v1beta1/trace.proto" +] diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..fd277b9a109 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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 networkmanagement = require('@google-cloud/network-management'); + +function main() { + const reachabilityServiceClient = new networkmanagement.ReachabilityServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..1a6b5c88dd3 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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 {ReachabilityServiceClient} from '@google-cloud/network-management'; + +// check that the client class type name can be used +function doStuffWithReachabilityServiceClient(client: ReachabilityServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const reachabilityServiceClient = new ReachabilityServiceClient(); + doStuffWithReachabilityServiceClient(reachabilityServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1beta1/test/gapic_reachability_service_v1beta1.ts b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/test/gapic_reachability_service_v1beta1.ts new file mode 100644 index 00000000000..cb9ff3fce3d --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/test/gapic_reachability_service_v1beta1.ts @@ -0,0 +1,1227 @@ +// 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 reachabilityserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta1.ReachabilityServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = reachabilityserviceModule.v1beta1.ReachabilityServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = reachabilityserviceModule.v1beta1.ReachabilityServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = reachabilityserviceModule.v1beta1.ReachabilityServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.reachabilityServiceStub, undefined); + await client.initialize(); + assert(client.reachabilityServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.reachabilityServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.reachabilityServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + 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 reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + 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('getConnectivityTest', () => { + it('invokes getConnectivityTest without error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.GetConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.GetConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest() + ); + client.innerApiCalls.getConnectivityTest = stubSimpleCall(expectedResponse); + const [response] = await client.getConnectivityTest(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectivityTest without error using callback', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.GetConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.GetConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest() + ); + client.innerApiCalls.getConnectivityTest = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConnectivityTest( + request, + (err?: Error|null, result?: protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectivityTest with error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.GetConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.GetConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConnectivityTest = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConnectivityTest(request), expectedError); + const actualRequest = (client.innerApiCalls.getConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectivityTest with closed client', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.GetConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.GetConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getConnectivityTest(request), expectedError); + }); + }); + + describe('createConnectivityTest', () => { + it('invokes createConnectivityTest without error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConnectivityTest = stubLongRunningCall(expectedResponse); + const [operation] = await client.createConnectivityTest(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnectivityTest without error using callback', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConnectivityTest = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConnectivityTest( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnectivityTest with call error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConnectivityTest = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createConnectivityTest(request), expectedError); + const actualRequest = (client.innerApiCalls.createConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnectivityTest with LRO error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConnectivityTest = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createConnectivityTest(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateConnectivityTestProgress without error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateConnectivityTestProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateConnectivityTestProgress with error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateConnectivityTestProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateConnectivityTest', () => { + it('invokes updateConnectivityTest without error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.UpdateConnectivityTestRequest() + ); + request.resource ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.UpdateConnectivityTestRequest', ['resource', 'name']); + request.resource.name = defaultValue1; + const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateConnectivityTest = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateConnectivityTest(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnectivityTest without error using callback', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.UpdateConnectivityTestRequest() + ); + request.resource ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.UpdateConnectivityTestRequest', ['resource', 'name']); + request.resource.name = defaultValue1; + const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateConnectivityTest = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateConnectivityTest( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnectivityTest with call error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.UpdateConnectivityTestRequest() + ); + request.resource ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.UpdateConnectivityTestRequest', ['resource', 'name']); + request.resource.name = defaultValue1; + const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConnectivityTest = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateConnectivityTest(request), expectedError); + const actualRequest = (client.innerApiCalls.updateConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnectivityTest with LRO error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.UpdateConnectivityTestRequest() + ); + request.resource ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.UpdateConnectivityTestRequest', ['resource', 'name']); + request.resource.name = defaultValue1; + const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConnectivityTest = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateConnectivityTest(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateConnectivityTestProgress without error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateConnectivityTestProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateConnectivityTestProgress with error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateConnectivityTestProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('rerunConnectivityTest', () => { + it('invokes rerunConnectivityTest without error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.RerunConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.RerunConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.rerunConnectivityTest = stubLongRunningCall(expectedResponse); + const [operation] = await client.rerunConnectivityTest(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rerunConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rerunConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rerunConnectivityTest without error using callback', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.RerunConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.RerunConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.rerunConnectivityTest = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rerunConnectivityTest( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rerunConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rerunConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rerunConnectivityTest with call error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.RerunConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.RerunConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rerunConnectivityTest = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.rerunConnectivityTest(request), expectedError); + const actualRequest = (client.innerApiCalls.rerunConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rerunConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rerunConnectivityTest with LRO error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.RerunConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.RerunConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rerunConnectivityTest = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.rerunConnectivityTest(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.rerunConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rerunConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRerunConnectivityTestProgress without error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRerunConnectivityTestProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRerunConnectivityTestProgress with error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRerunConnectivityTestProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteConnectivityTest', () => { + it('invokes deleteConnectivityTest without error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.DeleteConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.DeleteConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConnectivityTest = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteConnectivityTest(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnectivityTest without error using callback', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.DeleteConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.DeleteConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConnectivityTest = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteConnectivityTest( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnectivityTest with call error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.DeleteConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.DeleteConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConnectivityTest = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteConnectivityTest(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnectivityTest with LRO error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.DeleteConnectivityTestRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.DeleteConnectivityTestRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConnectivityTest = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteConnectivityTest(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteConnectivityTest as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectivityTest as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteConnectivityTestProgress without error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteConnectivityTestProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteConnectivityTestProgress with error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteConnectivityTestProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listConnectivityTests', () => { + it('invokes listConnectivityTests without error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), + generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), + generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), + ]; + client.innerApiCalls.listConnectivityTests = stubSimpleCall(expectedResponse); + const [response] = await client.listConnectivityTests(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConnectivityTests as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnectivityTests as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnectivityTests without error using callback', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), + generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), + generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), + ]; + client.innerApiCalls.listConnectivityTests = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConnectivityTests( + request, + (err?: Error|null, result?: protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConnectivityTests as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnectivityTests as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnectivityTests with error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConnectivityTests = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConnectivityTests(request), expectedError); + const actualRequest = (client.innerApiCalls.listConnectivityTests as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnectivityTests as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnectivityTestsStream without error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), + generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), + generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), + ]; + client.descriptors.page.listConnectivityTests.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listConnectivityTestsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest[] = []; + stream.on('data', (response: protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest) => { + 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.listConnectivityTests.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConnectivityTests, request)); + assert( + (client.descriptors.page.listConnectivityTests.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listConnectivityTestsStream with error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConnectivityTests.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listConnectivityTestsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest[] = []; + stream.on('data', (response: protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listConnectivityTests.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConnectivityTests, request)); + assert( + (client.descriptors.page.listConnectivityTests.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConnectivityTests without error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), + generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), + generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), + ]; + client.descriptors.page.listConnectivityTests.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest[] = []; + const iterable = client.listConnectivityTestsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listConnectivityTests.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConnectivityTests.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConnectivityTests with error', async () => { + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConnectivityTests.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConnectivityTestsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listConnectivityTests.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConnectivityTests.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('connectivityTest', () => { + const fakePath = "/rendered/path/connectivityTest"; + const expectedParameters = { + project: "projectValue", + test: "testValue", + }; + const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.connectivityTestPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.connectivityTestPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('connectivityTestPath', () => { + const result = client.connectivityTestPath("projectValue", "testValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.connectivityTestPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConnectivityTestName', () => { + const result = client.matchProjectFromConnectivityTestName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.connectivityTestPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTestFromConnectivityTestName', () => { + const result = client.matchTestFromConnectivityTestName(fakePath); + assert.strictEqual(result, "testValue"); + assert((client.pathTemplates.connectivityTestPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/webpack.config.js new file mode 100644 index 00000000000..d975be0ab73 --- /dev/null +++ b/owl-bot-staging/google-cloud-networkmanagement/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: 'ReachabilityService', + filename: './reachability-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From 71cab32875c444c6c973acd68b37a6dd6689968f Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 24 Aug 2023 21:17:05 +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-functions/v1/.eslintignore | 7 - .../google-cloud-functions/v1/.eslintrc.json | 3 - .../google-cloud-functions/v1/.gitignore | 14 - .../google-cloud-functions/v1/.jsdoc.js | 55 - .../google-cloud-functions/v1/.mocharc.js | 33 - .../google-cloud-functions/v1/.prettierrc.js | 22 - .../google-cloud-functions/v1/README.md | 1 - .../google-cloud-functions/v1/package.json | 58 - .../google/cloud/functions/v1/functions.proto | 866 -- .../cloud/functions/v1/operations.proto | 73 - .../cloud_functions_service.call_function.js | 66 - ...cloud_functions_service.create_function.js | 68 - ...cloud_functions_service.delete_function.js | 62 - ...functions_service.generate_download_url.js | 66 - ...d_functions_service.generate_upload_url.js | 79 - .../cloud_functions_service.get_function.js | 61 - .../cloud_functions_service.get_iam_policy.js | 67 - .../cloud_functions_service.list_functions.js | 78 - .../cloud_functions_service.set_iam_policy.js | 77 - ..._functions_service.test_iam_permissions.js | 70 - ...cloud_functions_service.update_function.js | 66 - ...et_metadata_google.cloud.functions.v1.json | 499 - .../google-cloud-functions/v1/src/index.ts | 25 - .../src/v1/cloud_functions_service_client.ts | 1881 ---- ...cloud_functions_service_client_config.json | 76 - .../cloud_functions_service_proto_list.json | 4 - .../v1/src/v1/gapic_metadata.json | 137 - .../google-cloud-functions/v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../test/gapic_cloud_functions_service_v1.ts | 2288 ----- .../google-cloud-functions/v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../google-cloud-functions/v2/.eslintignore | 7 - .../google-cloud-functions/v2/.eslintrc.json | 3 - .../google-cloud-functions/v2/.gitignore | 14 - .../google-cloud-functions/v2/.jsdoc.js | 55 - .../google-cloud-functions/v2/.mocharc.js | 33 - .../google-cloud-functions/v2/.prettierrc.js | 22 - .../google-cloud-functions/v2/README.md | 1 - .../google-cloud-functions/v2/package.json | 58 - .../google/cloud/functions/v2/functions.proto | 1147 --- .../v2/function_service.create_function.js | 75 - .../v2/function_service.delete_function.js | 62 - .../function_service.generate_download_url.js | 62 - .../function_service.generate_upload_url.js | 78 - .../v2/function_service.get_function.js | 61 - .../v2/function_service.list_functions.js | 93 - .../v2/function_service.list_runtimes.js | 67 - .../v2/function_service.update_function.js | 68 - ...et_metadata_google.cloud.functions.v2.json | 371 - .../google-cloud-functions/v2/src/index.ts | 25 - .../v2/src/v2/function_service_client.ts | 2197 ----- .../v2/function_service_client_config.json | 58 - .../src/v2/function_service_proto_list.json | 3 - .../v2/src/v2/gapic_metadata.json | 107 - .../google-cloud-functions/v2/src/v2/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v2/system-test/install.ts | 49 - .../v2/test/gapic_function_service_v2.ts | 2584 ----- .../google-cloud-functions/v2/tsconfig.json | 19 - .../v2/webpack.config.js | 64 - .../v2alpha/.eslintignore | 7 - .../v2alpha/.eslintrc.json | 3 - .../google-cloud-functions/v2alpha/.gitignore | 14 - .../google-cloud-functions/v2alpha/.jsdoc.js | 55 - .../v2alpha/.mocharc.js | 33 - .../v2alpha/.prettierrc.js | 22 - .../google-cloud-functions/v2alpha/README.md | 1 - .../v2alpha/package.json | 58 - .../cloud/functions/v2alpha/functions.proto | 1147 --- .../function_service.create_function.js | 75 - .../function_service.delete_function.js | 62 - .../function_service.generate_download_url.js | 62 - .../function_service.generate_upload_url.js | 78 - .../v2alpha/function_service.get_function.js | 61 - .../function_service.list_functions.js | 93 - .../v2alpha/function_service.list_runtimes.js | 67 - .../function_service.update_function.js | 68 - ...tadata_google.cloud.functions.v2alpha.json | 371 - .../v2alpha/src/index.ts | 25 - .../src/v2alpha/function_service_client.ts | 2197 ----- .../function_service_client_config.json | 58 - .../v2alpha/function_service_proto_list.json | 3 - .../v2alpha/src/v2alpha/gapic_metadata.json | 107 - .../v2alpha/src/v2alpha/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v2alpha/system-test/install.ts | 49 - .../test/gapic_function_service_v2alpha.ts | 2584 ----- .../v2alpha/tsconfig.json | 19 - .../v2alpha/webpack.config.js | 64 - .../v2beta/.eslintignore | 7 - .../v2beta/.eslintrc.json | 3 - .../google-cloud-functions/v2beta/.gitignore | 14 - .../google-cloud-functions/v2beta/.jsdoc.js | 55 - .../google-cloud-functions/v2beta/.mocharc.js | 33 - .../v2beta/.prettierrc.js | 22 - .../google-cloud-functions/v2beta/README.md | 1 - .../v2beta/package.json | 58 - .../cloud/functions/v2beta/functions.proto | 1147 --- .../function_service.create_function.js | 75 - .../function_service.delete_function.js | 62 - .../function_service.generate_download_url.js | 62 - .../function_service.generate_upload_url.js | 78 - .../v2beta/function_service.get_function.js | 61 - .../v2beta/function_service.list_functions.js | 93 - .../v2beta/function_service.list_runtimes.js | 67 - .../function_service.update_function.js | 68 - ...etadata_google.cloud.functions.v2beta.json | 371 - .../v2beta/src/index.ts | 25 - .../src/v2beta/function_service_client.ts | 2197 ----- .../function_service_client_config.json | 58 - .../v2beta/function_service_proto_list.json | 3 - .../v2beta/src/v2beta/gapic_metadata.json | 107 - .../v2beta/src/v2beta/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v2beta/system-test/install.ts | 49 - .../test/gapic_function_service_v2beta.ts | 2584 ----- .../v2beta/tsconfig.json | 19 - .../v2beta/webpack.config.js | 64 - .../google-cloud-gkebackup/v1/.eslintignore | 7 - .../google-cloud-gkebackup/v1/.eslintrc.json | 3 - .../google-cloud-gkebackup/v1/.gitignore | 14 - .../google-cloud-gkebackup/v1/.jsdoc.js | 55 - .../google-cloud-gkebackup/v1/.mocharc.js | 33 - .../google-cloud-gkebackup/v1/.prettierrc.js | 22 - .../google-cloud-gkebackup/v1/README.md | 1 - .../google-cloud-gkebackup/v1/package.json | 58 - .../google/cloud/gkebackup/v1/backup.proto | 242 - .../cloud/gkebackup/v1/backup_plan.proto | 238 - .../google/cloud/gkebackup/v1/common.proto | 58 - .../google/cloud/gkebackup/v1/gkebackup.proto | 960 -- .../google/cloud/gkebackup/v1/restore.proto | 494 - .../cloud/gkebackup/v1/restore_plan.proto | 130 - .../google/cloud/gkebackup/v1/volume.proto | 231 - .../v1/backup_for_g_k_e.create_backup.js | 77 - .../v1/backup_for_g_k_e.create_backup_plan.js | 79 - .../v1/backup_for_g_k_e.create_restore.js | 79 - .../backup_for_g_k_e.create_restore_plan.js | 79 - .../v1/backup_for_g_k_e.delete_backup.js | 75 - .../v1/backup_for_g_k_e.delete_backup_plan.js | 69 - .../v1/backup_for_g_k_e.delete_restore.js | 75 - .../backup_for_g_k_e.delete_restore_plan.js | 75 - .../v1/backup_for_g_k_e.get_backup.js | 62 - .../v1/backup_for_g_k_e.get_backup_plan.js | 62 - .../v1/backup_for_g_k_e.get_restore.js | 62 - .../v1/backup_for_g_k_e.get_restore_plan.js | 62 - .../v1/backup_for_g_k_e.get_volume_backup.js | 62 - .../v1/backup_for_g_k_e.get_volume_restore.js | 62 - .../v1/backup_for_g_k_e.list_backup_plans.js | 90 - .../v1/backup_for_g_k_e.list_backups.js | 90 - .../v1/backup_for_g_k_e.list_restore_plans.js | 90 - .../v1/backup_for_g_k_e.list_restores.js | 90 - .../backup_for_g_k_e.list_volume_backups.js | 90 - .../backup_for_g_k_e.list_volume_restores.js | 90 - .../v1/backup_for_g_k_e.update_backup.js | 74 - .../v1/backup_for_g_k_e.update_backup_plan.js | 75 - .../v1/backup_for_g_k_e.update_restore.js | 74 - .../backup_for_g_k_e.update_restore_plan.js | 74 - ...et_metadata_google.cloud.gkebackup.v1.json | 1147 --- .../google-cloud-gkebackup/v1/src/index.ts | 25 - .../v1/src/v1/backup_for_g_k_e_client.ts | 4191 -------- .../v1/backup_for_g_k_e_client_config.json | 158 - .../src/v1/backup_for_g_k_e_proto_list.json | 9 - .../v1/src/v1/gapic_metadata.json | 287 - .../google-cloud-gkebackup/v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_backup_for_g_k_e_v1.ts | 5257 ---------- .../google-cloud-gkebackup/v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1beta1/.eslintignore | 7 - .../v1beta1/.eslintrc.json | 3 - .../v1beta1/.gitignore | 14 - .../v1beta1/.jsdoc.js | 55 - .../v1beta1/.mocharc.js | 33 - .../v1beta1/.prettierrc.js | 22 - .../v1beta1/README.md | 1 - .../v1beta1/package.json | 58 - .../gkeconnect/gateway/v1beta1/gateway.proto | 75 - .../gateway_service.delete_resource.js | 69 - .../v1beta1/gateway_service.get_resource.js | 69 - .../v1beta1/gateway_service.patch_resource.js | 69 - .../v1beta1/gateway_service.post_resource.js | 69 - .../v1beta1/gateway_service.put_resource.js | 69 - ...ogle.cloud.gkeconnect.gateway.v1beta1.json | 255 - .../v1beta1/src/index.ts | 25 - .../v1beta1/src/v1beta1/gapic_metadata.json | 73 - .../src/v1beta1/gateway_service_client.ts | 657 -- .../gateway_service_client_config.json | 46 - .../v1beta1/gateway_service_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 - .../test/gapic_gateway_service_v1beta1.ts | 525 - .../v1beta1/tsconfig.json | 19 - .../v1beta1/webpack.config.js | 64 - .../google-cloud-gkehub/v1/.eslintignore | 7 - .../google-cloud-gkehub/v1/.eslintrc.json | 3 - .../google-cloud-gkehub/v1/.gitignore | 14 - .../google-cloud-gkehub/v1/.jsdoc.js | 55 - .../google-cloud-gkehub/v1/.mocharc.js | 33 - .../google-cloud-gkehub/v1/.prettierrc.js | 22 - .../google-cloud-gkehub/v1/README.md | 1 - .../google-cloud-gkehub/v1/package.json | 58 - .../configmanagement/configmanagement.proto | 382 - .../google/cloud/gkehub/v1/feature.proto | 198 - .../google/cloud/gkehub/v1/membership.proto | 348 - .../multiclusteringress.proto | 33 - .../google/cloud/gkehub/v1/service.proto | 648 -- .../generated/v1/gke_hub.create_feature.js | 84 - .../generated/v1/gke_hub.create_membership.js | 93 - .../generated/v1/gke_hub.delete_feature.js | 82 - .../generated/v1/gke_hub.delete_membership.js | 83 - .../v1/gke_hub.generate_connect_manifest.js | 97 - .../generated/v1/gke_hub.get_feature.js | 61 - .../generated/v1/gke_hub.get_membership.js | 62 - .../generated/v1/gke_hub.list_features.js | 92 - .../generated/v1/gke_hub.list_memberships.js | 96 - .../generated/v1/gke_hub.update_feature.js | 91 - .../generated/v1/gke_hub.update_membership.js | 94 - ...ippet_metadata_google.cloud.gkehub.v1.json | 575 -- .../google-cloud-gkehub/v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 141 - .../v1/src/v1/gke_hub_client.ts | 2006 ---- .../v1/src/v1/gke_hub_client_config.json | 93 - .../v1/src/v1/gke_hub_proto_list.json | 7 - .../google-cloud-gkehub/v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_gke_hub_v1.ts | 2114 ---- .../google-cloud-gkehub/v1/tsconfig.json | 19 - .../google-cloud-gkehub/v1/webpack.config.js | 64 - .../google-cloud-gkehub/v1alpha/.eslintignore | 7 - .../v1alpha/.eslintrc.json | 3 - .../google-cloud-gkehub/v1alpha/.gitignore | 14 - .../google-cloud-gkehub/v1alpha/.jsdoc.js | 55 - .../google-cloud-gkehub/v1alpha/.mocharc.js | 33 - .../v1alpha/.prettierrc.js | 22 - .../google-cloud-gkehub/v1alpha/README.md | 1 - .../google-cloud-gkehub/v1alpha/package.json | 58 - .../cloudauditlogging/cloudauditlogging.proto | 36 - .../configmanagement/configmanagement.proto | 415 - .../google/cloud/gkehub/v1alpha/feature.proto | 215 - .../gkehub/v1alpha/metering/metering.proto | 38 - .../multiclusteringress.proto | 49 - .../google/cloud/gkehub/v1alpha/service.proto | 280 - .../v1alpha/servicemesh/servicemesh.proto | 114 - .../v1alpha/gke_hub.create_feature.js | 84 - .../v1alpha/gke_hub.delete_feature.js | 82 - .../generated/v1alpha/gke_hub.get_feature.js | 61 - .../v1alpha/gke_hub.list_features.js | 92 - .../v1alpha/gke_hub.update_feature.js | 91 - ..._metadata_google.cloud.gkehub.v1alpha.json | 263 - .../google-cloud-gkehub/v1alpha/src/index.ts | 25 - .../v1alpha/src/v1alpha/gapic_metadata.json | 77 - .../v1alpha/src/v1alpha/gke_hub_client.ts | 1084 -- .../src/v1alpha/gke_hub_client_config.json | 63 - .../src/v1alpha/gke_hub_proto_list.json | 9 - .../v1alpha/src/v1alpha/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1alpha/system-test/install.ts | 49 - .../v1alpha/test/gapic_gke_hub_v1alpha.ts | 1077 -- .../google-cloud-gkehub/v1alpha/tsconfig.json | 19 - .../v1alpha/webpack.config.js | 64 - .../v1alpha2/.eslintignore | 7 - .../v1alpha2/.eslintrc.json | 3 - .../google-cloud-gkehub/v1alpha2/.gitignore | 14 - .../google-cloud-gkehub/v1alpha2/.jsdoc.js | 55 - .../google-cloud-gkehub/v1alpha2/.mocharc.js | 33 - .../v1alpha2/.prettierrc.js | 22 - .../google-cloud-gkehub/v1alpha2/README.md | 1 - .../google-cloud-gkehub/v1alpha2/package.json | 58 - .../cloud/gkehub/v1alpha2/membership.proto | 713 -- .../v1alpha2/gke_hub.create_membership.js | 79 - .../v1alpha2/gke_hub.delete_membership.js | 63 - .../gke_hub.generate_connect_manifest.js | 95 - .../v1alpha2/gke_hub.get_membership.js | 62 - .../v1alpha2/gke_hub.initialize_hub.js | 62 - .../v1alpha2/gke_hub.list_memberships.js | 95 - .../v1alpha2/gke_hub.update_membership.js | 80 - ...metadata_google.cloud.gkehub.v1alpha2.json | 351 - .../google-cloud-gkehub/v1alpha2/src/index.ts | 25 - .../v1alpha2/src/v1alpha2/gapic_metadata.json | 97 - .../v1alpha2/src/v1alpha2/gke_hub_client.ts | 1296 --- .../src/v1alpha2/gke_hub_client_config.json | 73 - .../src/v1alpha2/gke_hub_proto_list.json | 3 - .../v1alpha2/src/v1alpha2/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1alpha2/system-test/install.ts | 49 - .../v1alpha2/test/gapic_gke_hub_v1alpha2.ts | 1361 --- .../v1alpha2/tsconfig.json | 19 - .../v1alpha2/webpack.config.js | 64 - .../google-cloud-gkehub/v1beta/.eslintignore | 7 - .../google-cloud-gkehub/v1beta/.eslintrc.json | 3 - .../google-cloud-gkehub/v1beta/.gitignore | 14 - .../google-cloud-gkehub/v1beta/.jsdoc.js | 55 - .../google-cloud-gkehub/v1beta/.mocharc.js | 33 - .../google-cloud-gkehub/v1beta/.prettierrc.js | 22 - .../google-cloud-gkehub/v1beta/README.md | 1 - .../google-cloud-gkehub/v1beta/package.json | 58 - .../configmanagement/configmanagement.proto | 409 - .../google/cloud/gkehub/v1beta/feature.proto | 202 - .../gkehub/v1beta/metering/metering.proto | 38 - .../multiclusteringress.proto | 49 - .../google/cloud/gkehub/v1beta/service.proto | 280 - .../v1beta/gke_hub.create_feature.js | 84 - .../v1beta/gke_hub.delete_feature.js | 82 - .../generated/v1beta/gke_hub.get_feature.js | 61 - .../generated/v1beta/gke_hub.list_features.js | 92 - .../v1beta/gke_hub.update_feature.js | 91 - ...t_metadata_google.cloud.gkehub.v1beta.json | 263 - .../google-cloud-gkehub/v1beta/src/index.ts | 25 - .../v1beta/src/v1beta/gapic_metadata.json | 77 - .../v1beta/src/v1beta/gke_hub_client.ts | 1084 -- .../src/v1beta/gke_hub_client_config.json | 63 - .../v1beta/src/v1beta/gke_hub_proto_list.json | 7 - .../v1beta/src/v1beta/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1beta/system-test/install.ts | 49 - .../v1beta/test/gapic_gke_hub_v1beta.ts | 1077 -- .../google-cloud-gkehub/v1beta/tsconfig.json | 19 - .../v1beta/webpack.config.js | 64 - .../google-cloud-gkehub/v1beta1/.eslintignore | 7 - .../v1beta1/.eslintrc.json | 3 - .../google-cloud-gkehub/v1beta1/.gitignore | 14 - .../google-cloud-gkehub/v1beta1/.jsdoc.js | 55 - .../google-cloud-gkehub/v1beta1/.mocharc.js | 33 - .../v1beta1/.prettierrc.js | 22 - .../google-cloud-gkehub/v1beta1/README.md | 1 - .../google-cloud-gkehub/v1beta1/package.json | 58 - .../cloud/gkehub/v1beta1/membership.proto | 957 -- ...ub_membership_service.create_membership.js | 93 - ...ub_membership_service.delete_membership.js | 83 - ...rship_service.generate_connect_manifest.js | 85 - ...p_service.generate_exclusivity_manifest.js | 74 - ...e_hub_membership_service.get_membership.js | 62 - ...hub_membership_service.list_memberships.js | 96 - ...ub_membership_service.update_membership.js | 95 - ...membership_service.validate_exclusivity.js | 74 - ..._metadata_google.cloud.gkehub.v1beta1.json | 419 - .../google-cloud-gkehub/v1beta1/src/index.ts | 25 - .../v1beta1/src/v1beta1/gapic_metadata.json | 107 - .../gke_hub_membership_service_client.ts | 1832 ---- ..._hub_membership_service_client_config.json | 78 - ...gke_hub_membership_service_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 - ...apic_gke_hub_membership_service_v1beta1.ts | 2166 ---- .../google-cloud-gkehub/v1beta1/tsconfig.json | 19 - .../v1beta1/webpack.config.js | 64 - .../v1/.eslintignore | 7 - .../v1/.eslintrc.json | 3 - .../google-cloud-gkemulticloud/v1/.gitignore | 14 - .../google-cloud-gkemulticloud/v1/.jsdoc.js | 55 - .../google-cloud-gkemulticloud/v1/.mocharc.js | 33 - .../v1/.prettierrc.js | 22 - .../google-cloud-gkemulticloud/v1/README.md | 1 - .../v1/package.json | 60 - .../gkemulticloud/v1/attached_resources.proto | 230 - .../gkemulticloud/v1/attached_service.proto | 432 - .../gkemulticloud/v1/aws_resources.proto | 627 -- .../cloud/gkemulticloud/v1/aws_service.proto | 605 -- .../gkemulticloud/v1/azure_resources.proto | 708 -- .../gkemulticloud/v1/azure_service.proto | 776 -- .../gkemulticloud/v1/common_resources.proto | 174 - ...tached_clusters.create_attached_cluster.js | 88 - ...tached_clusters.delete_attached_cluster.js | 95 - ...erate_attached_cluster_install_manifest.js | 89 - .../attached_clusters.get_attached_cluster.js | 67 - ...hed_clusters.get_attached_server_config.js | 67 - ...tached_clusters.import_attached_cluster.js | 90 - ...ttached_clusters.list_attached_clusters.js | 82 - ...tached_clusters.update_attached_cluster.js | 82 - .../v1/aws_clusters.create_aws_cluster.js | 88 - .../v1/aws_clusters.create_aws_node_pool.js | 89 - .../v1/aws_clusters.delete_aws_cluster.js | 87 - .../v1/aws_clusters.delete_aws_node_pool.js | 88 - .../aws_clusters.generate_aws_access_token.js | 67 - .../v1/aws_clusters.get_aws_cluster.js | 67 - .../v1/aws_clusters.get_aws_node_pool.js | 67 - .../v1/aws_clusters.get_aws_server_config.js | 67 - .../v1/aws_clusters.list_aws_clusters.js | 82 - .../v1/aws_clusters.list_aws_node_pools.js | 83 - .../v1/aws_clusters.update_aws_cluster.js | 97 - .../v1/aws_clusters.update_aws_node_pool.js | 96 - .../v1/azure_clusters.create_azure_client.js | 88 - .../v1/azure_clusters.create_azure_cluster.js | 88 - .../azure_clusters.create_azure_node_pool.js | 88 - .../v1/azure_clusters.delete_azure_client.js | 80 - .../v1/azure_clusters.delete_azure_cluster.js | 87 - .../azure_clusters.delete_azure_node_pool.js | 89 - ...re_clusters.generate_azure_access_token.js | 67 - .../v1/azure_clusters.get_azure_client.js | 68 - .../v1/azure_clusters.get_azure_cluster.js | 67 - .../v1/azure_clusters.get_azure_node_pool.js | 67 - .../azure_clusters.get_azure_server_config.js | 67 - .../v1/azure_clusters.list_azure_clients.js | 82 - .../v1/azure_clusters.list_azure_clusters.js | 82 - .../azure_clusters.list_azure_node_pools.js | 83 - .../v1/azure_clusters.update_azure_cluster.js | 90 - .../azure_clusters.update_azure_node_pool.js | 79 - ...etadata_google.cloud.gkemulticloud.v1.json | 1711 ---- .../v1/src/index.ts | 29 - .../v1/src/v1/attached_clusters_client.ts | 2007 ---- .../v1/attached_clusters_client_config.json | 78 - .../src/v1/attached_clusters_proto_list.json | 9 - .../v1/src/v1/aws_clusters_client.ts | 2546 ----- .../v1/src/v1/aws_clusters_client_config.json | 98 - .../v1/src/v1/aws_clusters_proto_list.json | 9 - .../v1/src/v1/azure_clusters_client.ts | 3068 ------ .../src/v1/azure_clusters_client_config.json | 118 - .../v1/src/v1/azure_clusters_proto_list.json | 9 - .../v1/src/v1/gapic_metadata.json | 435 - .../v1/src/v1/index.ts | 21 - .../system-test/fixtures/sample/src/index.js | 29 - .../system-test/fixtures/sample/src/index.ts | 44 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_attached_clusters_v1.ts | 2134 ---- .../v1/test/gapic_aws_clusters_v1.ts | 2799 ------ .../v1/test/gapic_azure_clusters_v1.ts | 3460 ------- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1/.eslintignore | 7 - .../v1/.eslintrc.json | 3 - .../google-cloud-gsuiteaddons/v1/.gitignore | 14 - .../google-cloud-gsuiteaddons/v1/.jsdoc.js | 55 - .../google-cloud-gsuiteaddons/v1/.mocharc.js | 33 - .../v1/.prettierrc.js | 22 - .../google-cloud-gsuiteaddons/v1/README.md | 1 - .../google-cloud-gsuiteaddons/v1/package.json | 58 - .../apps/script/type/addon_widget_set.proto | 58 - .../calendar/calendar_addon_manifest.proto | 107 - .../type/docs/docs_addon_manifest.proto | 47 - .../type/drive/drive_addon_manifest.proto | 48 - .../apps/script/type/extension_point.proto | 77 - .../type/gmail/gmail_addon_manifest.proto | 127 - .../apps/script/type/script_manifest.proto | 105 - .../type/sheets/sheets_addon_manifest.proto | 47 - .../type/slides/slides_addon_manifest.proto | 47 - .../cloud/gsuiteaddons/v1/gsuiteaddons.proto | 389 - .../v1/g_suite_add_ons.create_deployment.js | 73 - .../v1/g_suite_add_ons.delete_deployment.js | 67 - .../v1/g_suite_add_ons.get_authorization.js | 63 - .../v1/g_suite_add_ons.get_deployment.js | 62 - .../v1/g_suite_add_ons.get_install_status.js | 62 - .../v1/g_suite_add_ons.install_deployment.js | 62 - .../v1/g_suite_add_ons.list_deployments.js | 78 - .../v1/g_suite_add_ons.replace_deployment.js | 61 - .../g_suite_add_ons.uninstall_deployment.js | 62 - ...metadata_google.cloud.gsuiteaddons.v1.json | 395 - .../google-cloud-gsuiteaddons/v1/src/index.ts | 25 - .../v1/src/v1/g_suite_add_ons_client.ts | 1266 --- .../src/v1/g_suite_add_ons_client_config.json | 84 - .../v1/src/v1/g_suite_add_ons_proto_list.json | 12 - .../v1/src/v1/gapic_metadata.json | 117 - .../v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_g_suite_add_ons_v1.ts | 1449 --- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../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 - .../google-cloud-iap/v1/package.json | 59 - .../protos/google/cloud/iap/v1/service.proto | 736 -- ..._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 | 1338 --- ...are_proxy_admin_service_client_config.json | 76 - ..._aware_proxy_admin_service_proto_list.json | 3 - ...ntity_aware_proxy_o_auth_service_client.ts | 1160 --- ...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 - .../google-cloud-iap/v1beta1/package.json | 58 - .../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 | 549 -- ...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 - .../google-cloud-ids/v1/.eslintignore | 7 - .../google-cloud-ids/v1/.eslintrc.json | 3 - .../google-cloud-ids/v1/.gitignore | 14 - owl-bot-staging/google-cloud-ids/v1/.jsdoc.js | 55 - .../google-cloud-ids/v1/.mocharc.js | 33 - .../google-cloud-ids/v1/.prettierrc.js | 22 - owl-bot-staging/google-cloud-ids/v1/README.md | 1 - .../google-cloud-ids/v1/package.json | 58 - .../v1/protos/google/cloud/ids/v1/ids.proto | 296 - .../generated/v1/i_d_s.create_endpoint.js | 91 - .../generated/v1/i_d_s.delete_endpoint.js | 76 - .../generated/v1/i_d_s.get_endpoint.js | 62 - .../generated/v1/i_d_s.list_endpoints.js | 85 - .../snippet_metadata_google.cloud.ids.v1.json | 207 - .../google-cloud-ids/v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 67 - .../v1/src/v1/i_d_s_client.ts | 967 -- .../v1/src/v1/i_d_s_client_config.json | 58 - .../v1/src/v1/i_d_s_proto_list.json | 3 - .../google-cloud-ids/v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_i_d_s_v1.ts | 991 -- .../google-cloud-ids/v1/tsconfig.json | 19 - .../google-cloud-ids/v1/webpack.config.js | 64 - .../google-cloud-iot/v1/.eslintignore | 7 - .../google-cloud-iot/v1/.eslintrc.json | 3 - .../google-cloud-iot/v1/.gitignore | 14 - owl-bot-staging/google-cloud-iot/v1/.jsdoc.js | 55 - .../google-cloud-iot/v1/.mocharc.js | 33 - .../google-cloud-iot/v1/.prettierrc.js | 22 - owl-bot-staging/google-cloud-iot/v1/README.md | 1 - .../google-cloud-iot/v1/package.json | 58 - .../google/cloud/iot/v1/device_manager.proto | 651 -- .../google/cloud/iot/v1/resources.proto | 483 - .../device_manager.bind_device_to_gateway.js | 75 - .../v1/device_manager.create_device.js | 70 - .../device_manager.create_device_registry.js | 69 - .../v1/device_manager.delete_device.js | 63 - .../device_manager.delete_device_registry.js | 62 - .../generated/v1/device_manager.get_device.js | 69 - .../v1/device_manager.get_device_registry.js | 62 - .../v1/device_manager.get_iam_policy.js | 67 - ...ice_manager.list_device_config_versions.js | 69 - .../device_manager.list_device_registries.js | 77 - .../v1/device_manager.list_device_states.js | 69 - .../v1/device_manager.list_devices.js | 98 - ...e_manager.modify_cloud_to_device_config.js | 76 - .../device_manager.send_command_to_device.js | 76 - .../v1/device_manager.set_iam_policy.js | 77 - .../v1/device_manager.test_iam_permissions.js | 70 - ...vice_manager.unbind_device_from_gateway.js | 75 - .../v1/device_manager.update_device.js | 72 - .../device_manager.update_device_registry.js | 72 - .../snippet_metadata_google.cloud.iot.v1.json | 883 -- .../google-cloud-iot/v1/src/index.ts | 25 - .../v1/src/v1/device_manager_client.ts | 2217 ----- .../src/v1/device_manager_client_config.json | 135 - .../v1/src/v1/device_manager_proto_list.json | 4 - .../v1/src/v1/gapic_metadata.json | 221 - .../google-cloud-iot/v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_device_manager_v1.ts | 2672 ----- .../google-cloud-iot/v1/tsconfig.json | 19 - .../google-cloud-iot/v1/webpack.config.js | 64 - .../v1/.eslintignore | 7 - .../v1/.eslintrc.json | 3 - .../google-cloud-kms-inventory/v1/.gitignore | 14 - .../google-cloud-kms-inventory/v1/.jsdoc.js | 55 - .../google-cloud-kms-inventory/v1/.mocharc.js | 33 - .../v1/.prettierrc.js | 22 - .../google-cloud-kms-inventory/v1/README.md | 1 - .../v1/package.json | 59 - .../inventory/v1/key_dashboard_service.proto | 81 - .../inventory/v1/key_tracking_service.proto | 228 - .../key_dashboard_service.list_crypto_keys.js | 75 - ...service.get_protected_resources_summary.js | 62 - ...king_service.search_protected_resources.js | 100 - ...etadata_google.cloud.kms.inventory.v1.json | 159 - .../v1/src/index.ts | 27 - .../v1/src/v1/gapic_metadata.json | 75 - .../v1/src/v1/index.ts | 20 - .../v1/src/v1/key_dashboard_service_client.ts | 1016 -- .../key_dashboard_service_client_config.json | 31 - .../v1/key_dashboard_service_proto_list.json | 5 - .../v1/src/v1/key_tracking_service_client.ts | 1163 --- .../key_tracking_service_client_config.json | 36 - .../v1/key_tracking_service_proto_list.json | 5 - .../system-test/fixtures/sample/src/index.js | 28 - .../system-test/fixtures/sample/src/index.ts | 38 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_key_dashboard_service_v1.ts | 869 -- .../v1/test/gapic_key_tracking_service_v1.ts | 977 -- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../google-cloud-kms/v1/.eslintignore | 7 - .../google-cloud-kms/v1/.eslintrc.json | 3 - .../google-cloud-kms/v1/.gitignore | 14 - owl-bot-staging/google-cloud-kms/v1/.jsdoc.js | 55 - .../google-cloud-kms/v1/.mocharc.js | 33 - .../google-cloud-kms/v1/.prettierrc.js | 22 - owl-bot-staging/google-cloud-kms/v1/README.md | 1 - .../google-cloud-kms/v1/package.json | 59 - .../google/cloud/kms/v1/ekm_service.proto | 451 - .../google/cloud/kms/v1/resources.proto | 920 -- .../protos/google/cloud/kms/v1/service.proto | 2073 ---- .../v1/ekm_service.create_ekm_connection.js | 75 - .../v1/ekm_service.get_ekm_config.js | 62 - .../v1/ekm_service.get_ekm_connection.js | 62 - .../v1/ekm_service.list_ekm_connections.js | 94 - .../v1/ekm_service.update_ekm_config.js | 66 - .../v1/ekm_service.update_ekm_connection.js | 67 - .../v1/ekm_service.verify_connectivity.js | 62 - ...y_management_service.asymmetric_decrypt.js | 92 - .../key_management_service.asymmetric_sign.js | 123 - ...ey_management_service.create_crypto_key.js | 85 - ...ement_service.create_crypto_key_version.js | 69 - ...ey_management_service.create_import_job.js | 75 - .../key_management_service.create_key_ring.js | 75 - .../v1/key_management_service.decrypt.js | 118 - ...ment_service.destroy_crypto_key_version.js | 62 - .../v1/key_management_service.encrypt.js | 139 - ...anagement_service.generate_random_bytes.js | 73 - .../key_management_service.get_crypto_key.js | 62 - ...nagement_service.get_crypto_key_version.js | 62 - .../key_management_service.get_import_job.js | 62 - .../v1/key_management_service.get_key_ring.js | 62 - .../key_management_service.get_public_key.js | 62 - ...ement_service.import_crypto_key_version.js | 145 - ...gement_service.list_crypto_key_versions.js | 98 - ...key_management_service.list_crypto_keys.js | 97 - ...key_management_service.list_import_jobs.js | 93 - .../key_management_service.list_key_rings.js | 94 - .../v1/key_management_service.mac_sign.js | 89 - .../v1/key_management_service.mac_verify.js | 115 - .../v1/key_management_service.raw_decrypt.js | 142 - .../v1/key_management_service.raw_encrypt.js | 154 - ...ment_service.restore_crypto_key_version.js | 62 - ...ey_management_service.update_crypto_key.js | 66 - ...rvice.update_crypto_key_primary_version.js | 68 - ...ement_service.update_crypto_key_version.js | 67 - .../snippet_metadata_google.cloud.kms.v1.json | 1723 ---- .../google-cloud-kms/v1/src/index.ts | 27 - .../v1/src/v1/ekm_service_client.ts | 1696 ---- .../v1/src/v1/ekm_service_client_config.json | 58 - .../v1/src/v1/ekm_service_proto_list.json | 5 - .../v1/src/v1/gapic_metadata.json | 407 - .../google-cloud-kms/v1/src/v1/index.ts | 20 - .../src/v1/key_management_service_client.ts | 4292 -------- .../key_management_service_client_config.json | 164 - .../v1/key_management_service_proto_list.json | 5 - .../system-test/fixtures/sample/src/index.js | 28 - .../system-test/fixtures/sample/src/index.ts | 38 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_ekm_service_v1.ts | 1943 ---- .../test/gapic_key_management_service_v1.ts | 4622 --------- .../google-cloud-kms/v1/tsconfig.json | 19 - .../google-cloud-kms/v1/webpack.config.js | 64 - .../google-cloud-language/v1/.eslintignore | 7 - .../google-cloud-language/v1/.eslintrc.json | 3 - .../google-cloud-language/v1/.gitignore | 14 - .../google-cloud-language/v1/.jsdoc.js | 55 - .../google-cloud-language/v1/.mocharc.js | 33 - .../google-cloud-language/v1/.prettierrc.js | 22 - .../google-cloud-language/v1/README.md | 1 - .../google-cloud-language/v1/package.json | 58 - .../cloud/language/v1/language_service.proto | 1211 --- .../v1/language_service.analyze_entities.js | 65 - ...nguage_service.analyze_entity_sentiment.js | 65 - .../v1/language_service.analyze_sentiment.js | 65 - .../v1/language_service.analyze_syntax.js | 65 - .../v1/language_service.annotate_text.js | 70 - .../v1/language_service.classify_text.js | 66 - .../v1/language_service.moderate_text.js | 61 - ...pet_metadata_google.cloud.language.v1.json | 323 - .../google-cloud-language/v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 93 - .../google-cloud-language/v1/src/v1/index.ts | 19 - .../v1/src/v1/language_service_client.ts | 786 -- .../v1/language_service_client_config.json | 60 - .../src/v1/language_service_proto_list.json | 3 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_language_service_v1.ts | 675 -- .../google-cloud-language/v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1beta2/.eslintignore | 7 - .../v1beta2/.eslintrc.json | 3 - .../google-cloud-language/v1beta2/.gitignore | 14 - .../google-cloud-language/v1beta2/.jsdoc.js | 55 - .../google-cloud-language/v1beta2/.mocharc.js | 33 - .../v1beta2/.prettierrc.js | 22 - .../google-cloud-language/v1beta2/README.md | 1 - .../v1beta2/package.json | 58 - .../language/v1beta2/language_service.proto | 1235 --- .../language_service.analyze_entities.js | 65 - ...nguage_service.analyze_entity_sentiment.js | 65 - .../language_service.analyze_sentiment.js | 66 - .../language_service.analyze_syntax.js | 65 - .../v1beta2/language_service.annotate_text.js | 70 - .../v1beta2/language_service.classify_text.js | 66 - .../v1beta2/language_service.moderate_text.js | 61 - ...etadata_google.cloud.language.v1beta2.json | 323 - .../v1beta2/src/index.ts | 25 - .../v1beta2/src/v1beta2/gapic_metadata.json | 93 - .../v1beta2/src/v1beta2/index.ts | 19 - .../src/v1beta2/language_service_client.ts | 787 -- .../language_service_client_config.json | 60 - .../v1beta2/language_service_proto_list.json | 3 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1beta2/system-test/install.ts | 49 - .../test/gapic_language_service_v1beta2.ts | 675 -- .../v1beta2/tsconfig.json | 19 - .../v1beta2/webpack.config.js | 64 - .../google-cloud-language/v2/.eslintignore | 7 - .../google-cloud-language/v2/.eslintrc.json | 3 - .../google-cloud-language/v2/.gitignore | 14 - .../google-cloud-language/v2/.jsdoc.js | 55 - .../google-cloud-language/v2/.mocharc.js | 33 - .../google-cloud-language/v2/.prettierrc.js | 22 - .../google-cloud-language/v2/README.md | 1 - .../google-cloud-language/v2/package.json | 58 - .../cloud/language/v2/language_service.proto | 504 - .../v2/language_service.analyze_entities.js | 65 - .../v2/language_service.analyze_sentiment.js | 65 - .../v2/language_service.annotate_text.js | 70 - .../v2/language_service.classify_text.js | 61 - .../v2/language_service.moderate_text.js | 61 - ...pet_metadata_google.cloud.language.v2.json | 231 - .../google-cloud-language/v2/src/index.ts | 25 - .../v2/src/v2/gapic_metadata.json | 73 - .../google-cloud-language/v2/src/v2/index.ts | 19 - .../v2/src/v2/language_service_client.ts | 643 -- .../v2/language_service_client_config.json | 51 - .../src/v2/language_service_proto_list.json | 3 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v2/system-test/install.ts | 49 - .../v2/test/gapic_language_service_v2.ts | 525 - .../google-cloud-language/v2/tsconfig.json | 19 - .../v2/webpack.config.js | 64 - .../v2beta/.eslintignore | 7 - .../v2beta/.eslintrc.json | 3 - .../v2beta/.gitignore | 14 - .../v2beta/.jsdoc.js | 55 - .../v2beta/.mocharc.js | 33 - .../v2beta/.prettierrc.js | 22 - .../v2beta/README.md | 1 - .../v2beta/package.json | 58 - .../cloud/lifesciences/v2beta/workflows.proto | 783 -- ...data_google.cloud.lifesciences.v2beta.json | 67 - .../workflows_service_v2_beta.run_pipeline.js | 81 - .../v2beta/src/index.ts | 25 - .../v2beta/src/v2beta/gapic_metadata.json | 33 - .../v2beta/src/v2beta/index.ts | 19 - .../workflows_service_v2_beta_client.ts | 714 -- ...rkflows_service_v2_beta_client_config.json | 31 - .../workflows_service_v2_beta_proto_list.json | 3 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v2beta/system-test/install.ts | 49 - .../gapic_workflows_service_v2_beta_v2beta.ts | 757 -- .../v2beta/tsconfig.json | 19 - .../v2beta/webpack.config.js | 64 - .../v1/.eslintignore | 7 - .../v1/.eslintrc.json | 3 - .../v1/.gitignore | 14 - .../v1/.jsdoc.js | 55 - .../v1/.mocharc.js | 33 - .../v1/.prettierrc.js | 22 - .../v1/README.md | 1 - .../v1/package.json | 58 - .../v1/managed_identities_service.proto | 422 - .../cloud/managedidentities/v1/resource.proto | 212 - ...managed_identities_service.attach_trust.js | 68 - ...ties_service.create_microsoft_ad_domain.js | 83 - ...anaged_identities_service.delete_domain.js | 63 - ...managed_identities_service.detach_trust.js | 68 - .../managed_identities_service.get_domain.js | 62 - ...managed_identities_service.list_domains.js | 90 - ...ed_identities_service.reconfigure_trust.js | 75 - ...identities_service.reset_admin_password.js | 62 - ...anaged_identities_service.update_domain.js | 73 - ...naged_identities_service.validate_trust.js | 68 - ...ata_google.cloud.managedidentities.v1.json | 463 - .../v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 127 - .../v1/src/v1/index.ts | 19 - .../v1/managed_identities_service_client.ts | 1574 --- ...aged_identities_service_client_config.json | 76 - ...managed_identities_service_proto_list.json | 4 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../gapic_managed_identities_service_v1.ts | 1873 ---- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1beta1/.eslintignore | 7 - .../v1beta1/.eslintrc.json | 3 - .../v1beta1/.gitignore | 14 - .../v1beta1/.jsdoc.js | 55 - .../v1beta1/.mocharc.js | 33 - .../v1beta1/.prettierrc.js | 22 - .../v1beta1/README.md | 1 - .../v1beta1/package.json | 58 - .../v1beta1/managed_identities_service.proto | 389 - .../managedidentities/v1beta1/resource.proto | 216 - ...managed_identities_service.attach_trust.js | 68 - ...ties_service.create_microsoft_ad_domain.js | 82 - ...anaged_identities_service.delete_domain.js | 63 - ...managed_identities_service.detach_trust.js | 68 - .../managed_identities_service.get_domain.js | 62 - ...managed_identities_service.list_domains.js | 90 - ...ed_identities_service.reconfigure_trust.js | 75 - ...identities_service.reset_admin_password.js | 62 - ...anaged_identities_service.update_domain.js | 74 - ...naged_identities_service.validate_trust.js | 68 - ...oogle.cloud.managedidentities.v1beta1.json | 463 - .../v1beta1/src/index.ts | 25 - .../v1beta1/src/v1beta1/gapic_metadata.json | 127 - .../v1beta1/src/v1beta1/index.ts | 19 - .../managed_identities_service_client.ts | 1541 --- ...aged_identities_service_client_config.json | 66 - ...managed_identities_service_proto_list.json | 4 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1beta1/system-test/install.ts | 49 - ...apic_managed_identities_service_v1beta1.ts | 1873 ---- .../v1beta1/tsconfig.json | 19 - .../v1beta1/webpack.config.js | 64 - .../v1beta1/.eslintignore | 7 - .../v1beta1/.eslintrc.json | 3 - .../v1beta1/.gitignore | 14 - .../v1beta1/.jsdoc.js | 55 - .../v1beta1/.mocharc.js | 33 - .../v1beta1/.prettierrc.js | 22 - .../v1beta1/README.md | 1 - .../v1beta1/package.json | 58 - .../v1beta1/media_translation.proto | 204 - ...google.cloud.mediatranslation.v1beta1.json | 59 - ...tion_service.streaming_translate_speech.js | 77 - .../v1beta1/src/index.ts | 25 - .../v1beta1/src/v1beta1/gapic_metadata.json | 27 - .../v1beta1/src/v1beta1/index.ts | 19 - .../speech_translation_service_client.ts | 342 - ...ech_translation_service_client_config.json | 31 - ...speech_translation_service_proto_list.json | 3 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1beta1/system-test/install.ts | 49 - ...apic_speech_translation_service_v1beta1.ts | 217 - .../v1beta1/tsconfig.json | 19 - .../v1beta1/webpack.config.js | 64 - .../google-cloud-memcache/v1/.eslintignore | 7 - .../google-cloud-memcache/v1/.eslintrc.json | 3 - .../google-cloud-memcache/v1/.gitignore | 14 - .../google-cloud-memcache/v1/.jsdoc.js | 55 - .../google-cloud-memcache/v1/.mocharc.js | 33 - .../google-cloud-memcache/v1/.prettierrc.js | 22 - .../google-cloud-memcache/v1/README.md | 1 - .../google-cloud-memcache/v1/package.json | 58 - .../cloud/memcache/v1/cloud_memcache.proto | 618 -- .../v1/cloud_memcache.apply_parameters.js | 73 - .../v1/cloud_memcache.create_instance.js | 81 - .../v1/cloud_memcache.delete_instance.js | 64 - .../v1/cloud_memcache.get_instance.js | 63 - .../v1/cloud_memcache.list_instances.js | 87 - .../cloud_memcache.reschedule_maintenance.js | 75 - .../v1/cloud_memcache.update_instance.js | 69 - .../v1/cloud_memcache.update_parameters.js | 72 - ...pet_metadata_google.cloud.memcache.v1.json | 387 - .../google-cloud-memcache/v1/src/index.ts | 25 - .../v1/src/v1/cloud_memcache_client.ts | 1619 --- .../src/v1/cloud_memcache_client_config.json | 66 - .../v1/src/v1/cloud_memcache_proto_list.json | 3 - .../v1/src/v1/gapic_metadata.json | 107 - .../google-cloud-memcache/v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_cloud_memcache_v1.ts | 2002 ---- .../google-cloud-memcache/v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1beta2/.eslintignore | 7 - .../v1beta2/.eslintrc.json | 3 - .../google-cloud-memcache/v1beta2/.gitignore | 14 - .../google-cloud-memcache/v1beta2/.jsdoc.js | 55 - .../google-cloud-memcache/v1beta2/.mocharc.js | 33 - .../v1beta2/.prettierrc.js | 22 - .../google-cloud-memcache/v1beta2/README.md | 1 - .../v1beta2/package.json | 58 - .../memcache/v1beta2/cloud_memcache.proto | 658 -- .../cloud_memcache.apply_parameters.js | 73 - .../cloud_memcache.apply_software_update.js | 74 - .../v1beta2/cloud_memcache.create_instance.js | 81 - .../v1beta2/cloud_memcache.delete_instance.js | 64 - .../v1beta2/cloud_memcache.get_instance.js | 63 - .../v1beta2/cloud_memcache.list_instances.js | 87 - .../cloud_memcache.reschedule_maintenance.js | 75 - .../v1beta2/cloud_memcache.update_instance.js | 69 - .../cloud_memcache.update_parameters.js | 72 - ...etadata_google.cloud.memcache.v1beta2.json | 435 - .../v1beta2/src/index.ts | 25 - .../src/v1beta2/cloud_memcache_client.ts | 1724 ---- .../v1beta2/cloud_memcache_client_config.json | 71 - .../v1beta2/cloud_memcache_proto_list.json | 3 - .../v1beta2/src/v1beta2/gapic_metadata.json | 117 - .../v1beta2/src/v1beta2/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1beta2/system-test/install.ts | 49 - .../test/gapic_cloud_memcache_v1beta2.ts | 2156 ---- .../v1beta2/tsconfig.json | 19 - .../v1beta2/webpack.config.js | 64 - .../google-cloud-metastore/v1/.eslintignore | 7 - .../google-cloud-metastore/v1/.eslintrc.json | 3 - .../google-cloud-metastore/v1/.gitignore | 14 - .../google-cloud-metastore/v1/.jsdoc.js | 55 - .../google-cloud-metastore/v1/.mocharc.js | 33 - .../google-cloud-metastore/v1/.prettierrc.js | 22 - .../google-cloud-metastore/v1/README.md | 1 - .../google-cloud-metastore/v1/package.json | 59 - .../google/cloud/metastore/v1/metastore.proto | 1602 --- .../metastore/v1/metastore_federation.proto | 374 - ...astore.alter_metadata_resource_location.js | 79 - .../v1/dataproc_metastore.create_backup.js | 92 - ...taproc_metastore.create_metadata_import.js | 93 - .../v1/dataproc_metastore.create_service.js | 93 - .../v1/dataproc_metastore.delete_backup.js | 77 - .../v1/dataproc_metastore.delete_service.js | 77 - .../v1/dataproc_metastore.export_metadata.js | 88 - .../v1/dataproc_metastore.get_backup.js | 63 - .../dataproc_metastore.get_metadata_import.js | 63 - .../v1/dataproc_metastore.get_service.js | 63 - .../v1/dataproc_metastore.list_backups.js | 91 - ...ataproc_metastore.list_metadata_imports.js | 91 - .../v1/dataproc_metastore.list_services.js | 92 - ...taproc_metastore.move_table_to_database.js | 79 - .../v1/dataproc_metastore.query_metadata.js | 70 - .../v1/dataproc_metastore.restore_service.js | 88 - ...taproc_metastore.update_metadata_import.js | 86 - .../v1/dataproc_metastore.update_service.js | 86 - ..._metastore_federation.create_federation.js | 93 - ..._metastore_federation.delete_federation.js | 77 - ...roc_metastore_federation.get_federation.js | 63 - ...c_metastore_federation.list_federations.js | 91 - ..._metastore_federation.update_federation.js | 86 - ...et_metadata_google.cloud.metastore.v1.json | 1131 --- .../google-cloud-metastore/v1/src/index.ts | 27 - .../v1/src/v1/dataproc_metastore_client.ts | 3409 ------- .../v1/dataproc_metastore_client_config.json | 128 - .../dataproc_metastore_federation_client.ts | 1714 ---- ...oc_metastore_federation_client_config.json | 46 - ...aproc_metastore_federation_proto_list.json | 4 - .../src/v1/dataproc_metastore_proto_list.json | 4 - .../v1/src/v1/gapic_metadata.json | 283 - .../google-cloud-metastore/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 - .../gapic_dataproc_metastore_federation_v1.ts | 2000 ---- .../v1/test/gapic_dataproc_metastore_v1.ts | 4134 -------- .../google-cloud-metastore/v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1alpha/.eslintignore | 7 - .../v1alpha/.eslintrc.json | 3 - .../google-cloud-metastore/v1alpha/.gitignore | 14 - .../google-cloud-metastore/v1alpha/.jsdoc.js | 55 - .../v1alpha/.mocharc.js | 33 - .../v1alpha/.prettierrc.js | 22 - .../google-cloud-metastore/v1alpha/README.md | 1 - .../v1alpha/package.json | 59 - .../cloud/metastore/v1alpha/metastore.proto | 1681 ---- .../v1alpha/metastore_federation.proto | 377 - ...astore.alter_metadata_resource_location.js | 79 - .../dataproc_metastore.create_backup.js | 92 - ...taproc_metastore.create_metadata_import.js | 93 - .../dataproc_metastore.create_service.js | 93 - .../dataproc_metastore.delete_backup.js | 77 - .../dataproc_metastore.delete_service.js | 77 - .../dataproc_metastore.export_metadata.js | 88 - .../v1alpha/dataproc_metastore.get_backup.js | 63 - .../dataproc_metastore.get_metadata_import.js | 63 - .../v1alpha/dataproc_metastore.get_service.js | 63 - .../dataproc_metastore.list_backups.js | 91 - ...ataproc_metastore.list_metadata_imports.js | 91 - .../dataproc_metastore.list_services.js | 92 - ...taproc_metastore.move_table_to_database.js | 79 - .../dataproc_metastore.query_metadata.js | 70 - .../dataproc_metastore.remove_iam_policy.js | 70 - .../dataproc_metastore.restore_service.js | 88 - ...taproc_metastore.update_metadata_import.js | 86 - .../dataproc_metastore.update_service.js | 86 - ..._metastore_federation.create_federation.js | 93 - ..._metastore_federation.delete_federation.js | 77 - ...roc_metastore_federation.get_federation.js | 63 - ...c_metastore_federation.list_federations.js | 91 - ..._metastore_federation.update_federation.js | 86 - ...tadata_google.cloud.metastore.v1alpha.json | 1175 --- .../v1alpha/src/index.ts | 27 - .../src/v1alpha/dataproc_metastore_client.ts | 3539 ------- .../dataproc_metastore_client_config.json | 133 - .../dataproc_metastore_federation_client.ts | 1714 ---- ...oc_metastore_federation_client_config.json | 46 - ...aproc_metastore_federation_proto_list.json | 4 - .../dataproc_metastore_proto_list.json | 4 - .../v1alpha/src/v1alpha/gapic_metadata.json | 293 - .../v1alpha/src/v1alpha/index.ts | 20 - .../system-test/fixtures/sample/src/index.js | 28 - .../system-test/fixtures/sample/src/index.ts | 38 - .../v1alpha/system-test/install.ts | 49 - ...c_dataproc_metastore_federation_v1alpha.ts | 2000 ---- .../test/gapic_dataproc_metastore_v1alpha.ts | 4288 -------- .../v1alpha/tsconfig.json | 19 - .../v1alpha/webpack.config.js | 64 - .../v1beta/.eslintignore | 7 - .../v1beta/.eslintrc.json | 3 - .../google-cloud-metastore/v1beta/.gitignore | 14 - .../google-cloud-metastore/v1beta/.jsdoc.js | 55 - .../google-cloud-metastore/v1beta/.mocharc.js | 33 - .../v1beta/.prettierrc.js | 22 - .../google-cloud-metastore/v1beta/README.md | 1 - .../v1beta/package.json | 59 - .../cloud/metastore/v1beta/metastore.proto | 1681 ---- .../v1beta/metastore_federation.proto | 377 - ...astore.alter_metadata_resource_location.js | 79 - .../dataproc_metastore.create_backup.js | 92 - ...taproc_metastore.create_metadata_import.js | 93 - .../dataproc_metastore.create_service.js | 93 - .../dataproc_metastore.delete_backup.js | 77 - .../dataproc_metastore.delete_service.js | 77 - .../dataproc_metastore.export_metadata.js | 88 - .../v1beta/dataproc_metastore.get_backup.js | 63 - .../dataproc_metastore.get_metadata_import.js | 63 - .../v1beta/dataproc_metastore.get_service.js | 63 - .../v1beta/dataproc_metastore.list_backups.js | 91 - ...ataproc_metastore.list_metadata_imports.js | 91 - .../dataproc_metastore.list_services.js | 92 - ...taproc_metastore.move_table_to_database.js | 79 - .../dataproc_metastore.query_metadata.js | 70 - .../dataproc_metastore.remove_iam_policy.js | 70 - .../dataproc_metastore.restore_service.js | 88 - ...taproc_metastore.update_metadata_import.js | 86 - .../dataproc_metastore.update_service.js | 86 - ..._metastore_federation.create_federation.js | 93 - ..._metastore_federation.delete_federation.js | 77 - ...roc_metastore_federation.get_federation.js | 63 - ...c_metastore_federation.list_federations.js | 91 - ..._metastore_federation.update_federation.js | 86 - ...etadata_google.cloud.metastore.v1beta.json | 1175 --- .../v1beta/src/index.ts | 27 - .../src/v1beta/dataproc_metastore_client.ts | 3539 ------- .../dataproc_metastore_client_config.json | 133 - .../dataproc_metastore_federation_client.ts | 1714 ---- ...oc_metastore_federation_client_config.json | 46 - ...aproc_metastore_federation_proto_list.json | 4 - .../v1beta/dataproc_metastore_proto_list.json | 4 - .../v1beta/src/v1beta/gapic_metadata.json | 293 - .../v1beta/src/v1beta/index.ts | 20 - .../system-test/fixtures/sample/src/index.js | 28 - .../system-test/fixtures/sample/src/index.ts | 38 - .../v1beta/system-test/install.ts | 49 - ...ic_dataproc_metastore_federation_v1beta.ts | 2000 ---- .../test/gapic_dataproc_metastore_v1beta.ts | 4288 -------- .../v1beta/tsconfig.json | 19 - .../v1beta/webpack.config.js | 64 - .../v1/.eslintignore | 7 - .../v1/.eslintrc.json | 3 - .../v1/.gitignore | 14 - .../google-cloud-migrationcenter/v1/.jsdoc.js | 55 - .../v1/.mocharc.js | 33 - .../v1/.prettierrc.js | 22 - .../google-cloud-migrationcenter/v1/README.md | 1 - .../v1/package.json | 58 - .../migrationcenter/v1/migrationcenter.proto | 4005 -------- .../migration_center.add_assets_to_group.js | 91 - ...igration_center.aggregate_assets_values.js | 70 - .../migration_center.batch_delete_assets.js | 74 - .../migration_center.batch_update_assets.js | 67 - .../v1/migration_center.create_group.js | 90 - ...igration_center.create_import_data_file.js | 86 - .../v1/migration_center.create_import_job.js | 86 - .../migration_center.create_preference_set.js | 91 - .../v1/migration_center.create_report.js | 90 - .../migration_center.create_report_config.js | 90 - .../v1/migration_center.create_source.js | 90 - .../v1/migration_center.delete_asset.js | 75 - .../v1/migration_center.delete_group.js | 76 - ...igration_center.delete_import_data_file.js | 76 - .../v1/migration_center.delete_import_job.js | 82 - .../migration_center.delete_preference_set.js | 76 - .../v1/migration_center.delete_report.js | 76 - .../migration_center.delete_report_config.js | 82 - .../v1/migration_center.delete_source.js | 76 - .../v1/migration_center.get_asset.js | 65 - .../v1/migration_center.get_error_frame.js | 68 - .../v1/migration_center.get_group.js | 61 - .../migration_center.get_import_data_file.js | 61 - .../v1/migration_center.get_import_job.js | 66 - .../v1/migration_center.get_preference_set.js | 61 - .../v1/migration_center.get_report.js | 65 - .../v1/migration_center.get_report_config.js | 61 - .../v1/migration_center.get_settings.js | 61 - .../v1/migration_center.get_source.js | 61 - .../v1/migration_center.list_assets.js | 84 - .../v1/migration_center.list_error_frames.js | 77 - .../v1/migration_center.list_groups.js | 80 - ...migration_center.list_import_data_files.js | 85 - .../v1/migration_center.list_import_jobs.js | 85 - .../migration_center.list_preference_sets.js | 77 - .../migration_center.list_report_configs.js | 80 - .../v1/migration_center.list_reports.js | 84 - .../v1/migration_center.list_sources.js | 80 - ...gration_center.remove_assets_from_group.js | 90 - .../migration_center.report_asset_frames.js | 70 - .../v1/migration_center.run_import_job.js | 76 - .../v1/migration_center.update_asset.js | 85 - .../v1/migration_center.update_group.js | 85 - .../v1/migration_center.update_import_job.js | 86 - .../migration_center.update_preference_set.js | 86 - .../v1/migration_center.update_settings.js | 86 - .../v1/migration_center.update_source.js | 86 - .../migration_center.validate_import_job.js | 76 - ...adata_google.cloud.migrationcenter.v1.json | 2331 ----- .../v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 539 - .../v1/src/v1/index.ts | 19 - .../v1/src/v1/migration_center_client.ts | 6782 ------------- .../v1/migration_center_client_config.json | 266 - .../src/v1/migration_center_proto_list.json | 3 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_migration_center_v1.ts | 8680 ----------------- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1/.eslintignore | 7 - .../v1/.eslintrc.json | 3 - .../v1/.gitignore | 14 - .../v1/.jsdoc.js | 55 - .../v1/.mocharc.js | 33 - .../v1/.prettierrc.js | 22 - .../v1/README.md | 1 - .../v1/package.json | 58 - .../cloud/networkconnectivity/v1/common.proto | 64 - .../cloud/networkconnectivity/v1/hub.proto | 694 -- .../generated/v1/hub_service.create_hub.js | 87 - .../generated/v1/hub_service.create_spoke.js | 87 - .../generated/v1/hub_service.delete_hub.js | 77 - .../generated/v1/hub_service.delete_spoke.js | 77 - .../generated/v1/hub_service.get_hub.js | 61 - .../generated/v1/hub_service.get_spoke.js | 61 - .../generated/v1/hub_service.list_hubs.js | 79 - .../generated/v1/hub_service.list_spokes.js | 79 - .../generated/v1/hub_service.update_hub.js | 85 - .../generated/v1/hub_service.update_spoke.js | 85 - ...a_google.cloud.networkconnectivity.v1.json | 495 - .../v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 131 - .../v1/src/v1/hub_service_client.ts | 2277 ----- .../v1/src/v1/hub_service_client_config.json | 88 - .../v1/src/v1/hub_service_proto_list.json | 4 - .../v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_hub_service_v1.ts | 2849 ------ .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1alpha1/.eslintignore | 7 - .../v1alpha1/.eslintrc.json | 3 - .../v1alpha1/.gitignore | 14 - .../v1alpha1/.jsdoc.js | 55 - .../v1alpha1/.mocharc.js | 33 - .../v1alpha1/.prettierrc.js | 22 - .../v1alpha1/README.md | 1 - .../v1alpha1/package.json | 58 - .../networkconnectivity/v1alpha1/common.proto | 55 - .../networkconnectivity/v1alpha1/hub.proto | 551 -- .../v1alpha1/hub_service.create_hub.js | 85 - .../v1alpha1/hub_service.create_spoke.js | 85 - .../v1alpha1/hub_service.delete_hub.js | 76 - .../v1alpha1/hub_service.delete_spoke.js | 76 - .../generated/v1alpha1/hub_service.get_hub.js | 61 - .../v1alpha1/hub_service.get_spoke.js | 61 - .../v1alpha1/hub_service.list_hubs.js | 79 - .../v1alpha1/hub_service.list_spokes.js | 79 - .../v1alpha1/hub_service.update_hub.js | 84 - .../v1alpha1/hub_service.update_spoke.js | 84 - ...le.cloud.networkconnectivity.v1alpha1.json | 495 - .../v1alpha1/src/index.ts | 25 - .../v1alpha1/src/v1alpha1/gapic_metadata.json | 131 - .../src/v1alpha1/hub_service_client.ts | 1829 ---- .../v1alpha1/hub_service_client_config.json | 88 - .../src/v1alpha1/hub_service_proto_list.json | 4 - .../v1alpha1/src/v1alpha1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1alpha1/system-test/install.ts | 49 - .../test/gapic_hub_service_v1alpha1.ts | 2114 ---- .../v1alpha1/tsconfig.json | 19 - .../v1alpha1/webpack.config.js | 64 - .../v1/.eslintignore | 7 - .../v1/.eslintrc.json | 3 - .../v1/.gitignore | 14 - .../v1/.jsdoc.js | 55 - .../v1/.mocharc.js | 33 - .../v1/.prettierrc.js | 22 - .../v1/README.md | 1 - .../v1/package.json | 58 - .../v1/connectivity_test.proto | 405 - .../networkmanagement/v1/reachability.proto | 274 - .../cloud/networkmanagement/v1/trace.proto | 1241 --- ...bility_service.create_connectivity_test.js | 79 - ...bility_service.delete_connectivity_test.js | 63 - ...chability_service.get_connectivity_test.js | 62 - ...ability_service.list_connectivity_tests.js | 95 - ...ability_service.rerun_connectivity_test.js | 63 - ...bility_service.update_connectivity_test.js | 68 - ...ata_google.cloud.networkmanagement.v1.json | 283 - .../v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 87 - .../v1/src/v1/index.ts | 19 - .../v1/src/v1/reachability_service_client.ts | 1139 --- .../reachability_service_client_config.json | 56 - .../v1/reachability_service_proto_list.json | 5 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_reachability_service_v1.ts | 1227 --- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1beta1/.eslintignore | 7 - .../v1beta1/.eslintrc.json | 3 - .../v1beta1/.gitignore | 14 - .../v1beta1/.jsdoc.js | 55 - .../v1beta1/.mocharc.js | 33 - .../v1beta1/.prettierrc.js | 22 - .../v1beta1/README.md | 1 - .../v1beta1/package.json | 58 - .../v1beta1/connectivity_test.proto | 405 - .../v1beta1/reachability.proto | 269 - .../networkmanagement/v1beta1/trace.proto | 1241 --- ...bility_service.create_connectivity_test.js | 79 - ...bility_service.delete_connectivity_test.js | 63 - ...chability_service.get_connectivity_test.js | 62 - ...ability_service.list_connectivity_tests.js | 95 - ...ability_service.rerun_connectivity_test.js | 63 - ...bility_service.update_connectivity_test.js | 68 - ...oogle.cloud.networkmanagement.v1beta1.json | 283 - .../v1beta1/src/index.ts | 25 - .../v1beta1/src/v1beta1/gapic_metadata.json | 87 - .../v1beta1/src/v1beta1/index.ts | 19 - .../v1beta1/reachability_service_client.ts | 1139 --- .../reachability_service_client_config.json | 56 - .../reachability_service_proto_list.json | 5 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1beta1/system-test/install.ts | 49 - .../gapic_reachability_service_v1beta1.ts | 1227 --- .../v1beta1/tsconfig.json | 19 - .../v1beta1/webpack.config.js | 64 - .../src/v1/cloud_functions_service_client.ts | 9 +- .../src/v2/function_service_client.ts | 9 +- .../src/v2alpha/function_service_client.ts | 9 +- .../src/v2beta/function_service_client.ts | 9 +- .../src/v1/backup_for_g_k_e_client.ts | 9 +- .../src/v1beta1/gateway_service_client.ts | 7 +- .../src/v1/gke_hub_client.ts | 9 +- .../src/v1alpha/gke_hub_client.ts | 9 +- .../src/v1alpha2/gke_hub_client.ts | 9 +- .../src/v1beta/gke_hub_client.ts | 9 +- .../gke_hub_membership_service_client.ts | 9 +- .../src/v1/attached_clusters_client.ts | 9 +- .../src/v1/aws_clusters_client.ts | 9 +- .../src/v1/azure_clusters_client.ts | 9 +- .../test/gapic_attached_clusters_v1.ts | 5 +- .../src/v1/g_suite_add_ons_client.ts | 7 +- ...entity_aware_proxy_admin_service_client.ts | 7 +- ...ntity_aware_proxy_o_auth_service_client.ts | 7 +- ...ntity_aware_proxy_admin_v1_beta1_client.ts | 7 +- ..._identity_aware_proxy_o_auth_service_v1.ts | 5 +- .../google-cloud-ids/src/v1/i_d_s_client.ts | 9 +- .../src/v1/device_manager_client.ts | 7 +- .../src/v1/key_dashboard_service_client.ts | 7 +- .../src/v1/key_tracking_service_client.ts | 7 +- .../src/v1/ekm_service_client.ts | 7 +- .../src/v1/key_management_service_client.ts | 7 +- .../src/v1/language_service_client.ts | 7 +- .../src/v1beta2/language_service_client.ts | 7 +- .../src/v2/language_service_client.ts | 7 +- .../workflows_service_v2_beta_client.ts | 9 +- .../v1/managed_identities_service_client.ts | 9 +- .../managed_identities_service_client.ts | 9 +- .../speech_translation_service_client.ts | 9 +- .../src/v1/cloud_memcache_client.ts | 9 +- .../src/v1beta2/cloud_memcache_client.ts | 9 +- .../src/v1/dataproc_metastore_client.ts | 9 +- .../dataproc_metastore_federation_client.ts | 9 +- .../src/v1alpha/dataproc_metastore_client.ts | 9 +- .../dataproc_metastore_federation_client.ts | 9 +- .../src/v1beta/dataproc_metastore_client.ts | 9 +- .../dataproc_metastore_federation_client.ts | 9 +- .../src/v1/migration_center_client.ts | 9 +- .../src/v1/hub_service_client.ts | 9 +- .../src/v1alpha1/hub_service_client.ts | 9 +- .../src/v1/reachability_service_client.ts | 9 +- .../v1beta1/reachability_service_client.ts | 9 +- 1357 files changed, 169 insertions(+), 300779 deletions(-) delete mode 100644 owl-bot-staging/google-cloud-functions/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-functions/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-functions/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-functions/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-functions/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-functions/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-functions/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-functions/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-functions/v1/protos/google/cloud/functions/v1/functions.proto delete mode 100644 owl-bot-staging/google-cloud-functions/v1/protos/google/cloud/functions/v1/operations.proto delete mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.call_function.js delete mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.create_function.js delete mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.delete_function.js delete mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.generate_download_url.js delete mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.generate_upload_url.js delete mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.get_function.js delete mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.get_iam_policy.js delete mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.list_functions.js delete mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.set_iam_policy.js delete mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.test_iam_permissions.js delete mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.update_function.js delete mode 100644 owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/snippet_metadata_google.cloud.functions.v1.json delete mode 100644 owl-bot-staging/google-cloud-functions/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-functions/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-functions/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-functions/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v1/test/gapic_cloud_functions_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-functions/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-functions/v2/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2/.gitignore delete mode 100644 owl-bot-staging/google-cloud-functions/v2/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2/README.md delete mode 100644 owl-bot-staging/google-cloud-functions/v2/package.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2/protos/google/cloud/functions/v2/functions.proto delete mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.create_function.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.delete_function.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.generate_download_url.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.generate_upload_url.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.get_function.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.list_functions.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.list_runtimes.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.update_function.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/snippet_metadata_google.cloud.functions.v2.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2/src/v2/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2/src/v2/index.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2/test/gapic_function_service_v2.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/.gitignore delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/README.md delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/package.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/protos/google/cloud/functions/v2alpha/functions.proto delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.create_function.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.delete_function.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.generate_download_url.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.generate_upload_url.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.get_function.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.list_functions.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.list_runtimes.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.update_function.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/snippet_metadata_google.cloud.functions.v2alpha.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/index.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/test/gapic_function_service_v2alpha.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2alpha/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/.gitignore delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/README.md delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/package.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/protos/google/cloud/functions/v2beta/functions.proto delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.create_function.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.delete_function.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.generate_download_url.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.generate_upload_url.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.get_function.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.list_functions.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.list_runtimes.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.update_function.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/snippet_metadata_google.cloud.functions.v2beta.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/index.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/test/gapic_function_service_v2beta.ts delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-functions/v2beta/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/backup.proto delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/backup_plan.proto delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/common.proto delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/gkebackup.proto delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/restore.proto delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/restore_plan.proto delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/volume.proto delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_backup.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_backup_plan.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_restore.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_restore_plan.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_backup.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_backup_plan.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_restore.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_restore_plan.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_backup.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_backup_plan.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_restore.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_restore_plan.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_volume_backup.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_volume_restore.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_backup_plans.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_backups.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_restore_plans.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_restores.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_volume_backups.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_volume_restores.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_backup.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_backup_plan.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_restore.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_restore_plan.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/snippet_metadata_google.cloud.gkebackup.v1.json delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_client.ts delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_client_config.json delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/test/gapic_backup_for_g_k_e_v1.ts delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-gkebackup/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/README.md delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/package.json delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.delete_resource.js delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.get_resource.js delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.patch_resource.js delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.post_resource.js delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.put_resource.js delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.gkeconnect.gateway.v1beta1.json delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/test/gapic_gateway_service_v1beta1.ts delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/configmanagement/configmanagement.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/feature.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/membership.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/multiclusteringress/multiclusteringress.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/service.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.create_feature.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.create_membership.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.delete_feature.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.delete_membership.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.generate_connect_manifest.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.get_feature.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.get_membership.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.list_features.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.list_memberships.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.update_feature.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.update_membership.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/snippet_metadata_google.cloud.gkehub.v1.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_client.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_client_config.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/test/gapic_gke_hub_v1.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/.gitignore delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/README.md delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/package.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/cloudauditlogging/cloudauditlogging.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/configmanagement/configmanagement.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/feature.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/metering/metering.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/multiclusteringress/multiclusteringress.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/service.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/servicemesh/servicemesh.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.create_feature.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.delete_feature.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.get_feature.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.list_features.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.update_feature.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.gkehub.v1alpha.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_client.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_client_config.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/test/gapic_gke_hub_v1alpha.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/.gitignore delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/README.md delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/package.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/protos/google/cloud/gkehub/v1alpha2/membership.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.create_membership.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.delete_membership.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.generate_connect_manifest.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.get_membership.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.initialize_hub.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.list_memberships.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.update_membership.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/snippet_metadata_google.cloud.gkehub.v1alpha2.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_client.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_client_config.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/test/gapic_gke_hub_v1alpha2.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1alpha2/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/.gitignore delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/README.md delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/package.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/configmanagement/configmanagement.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/feature.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/metering/metering.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/multiclusteringress/multiclusteringress.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/service.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.create_feature.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.delete_feature.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.get_feature.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.list_features.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.update_feature.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.gkehub.v1beta.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_client.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_client_config.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/test/gapic_gke_hub_v1beta.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/README.md delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/package.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/protos/google/cloud/gkehub/v1beta1/membership.proto delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.create_membership.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.delete_membership.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.generate_connect_manifest.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.generate_exclusivity_manifest.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.get_membership.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.list_memberships.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.update_membership.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.validate_exclusivity.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.gkehub.v1beta1.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/test/gapic_gke_hub_membership_service_v1beta1.ts delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-gkehub/v1beta1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/attached_resources.proto delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/attached_service.proto delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/aws_resources.proto delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/aws_service.proto delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/azure_resources.proto delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/azure_service.proto delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/common_resources.proto delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.create_attached_cluster.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.delete_attached_cluster.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.generate_attached_cluster_install_manifest.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.get_attached_cluster.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.get_attached_server_config.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.import_attached_cluster.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.list_attached_clusters.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.update_attached_cluster.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.create_aws_cluster.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.create_aws_node_pool.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.delete_aws_cluster.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.delete_aws_node_pool.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.generate_aws_access_token.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_cluster.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_node_pool.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_server_config.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.list_aws_clusters.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.list_aws_node_pools.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.update_aws_cluster.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.update_aws_node_pool.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_client.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_cluster.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_node_pool.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_client.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_cluster.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_node_pool.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.generate_azure_access_token.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_client.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_cluster.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_node_pool.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_server_config.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_clients.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_clusters.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_node_pools.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.update_azure_cluster.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.update_azure_node_pool.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/snippet_metadata_google.cloud.gkemulticloud.v1.json delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_client.ts delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_client_config.json delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_client.ts delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_client_config.json delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_client.ts delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_client_config.json delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_attached_clusters_v1.ts delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_aws_clusters_v1.ts delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_azure_clusters_v1.ts delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-gkemulticloud/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/addon_widget_set.proto delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/calendar/calendar_addon_manifest.proto delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/docs/docs_addon_manifest.proto delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/drive/drive_addon_manifest.proto delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/extension_point.proto delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/gmail/gmail_addon_manifest.proto delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/script_manifest.proto delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/sheets/sheets_addon_manifest.proto delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/slides/slides_addon_manifest.proto delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/cloud/gsuiteaddons/v1/gsuiteaddons.proto delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.create_deployment.js delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.delete_deployment.js delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_authorization.js delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_deployment.js delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_install_status.js delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.install_deployment.js delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.list_deployments.js delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.replace_deployment.js delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.uninstall_deployment.js delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/snippet_metadata_google.cloud.gsuiteaddons.v1.json delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_client.ts delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_client_config.json delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/test/gapic_g_suite_add_ons_v1.ts delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-gsuiteaddons/v1/webpack.config.js 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/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/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 delete mode 100644 owl-bot-staging/google-cloud-ids/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-ids/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-ids/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-ids/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-ids/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-ids/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-ids/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-ids/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-ids/v1/protos/google/cloud/ids/v1/ids.proto delete mode 100644 owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.create_endpoint.js delete mode 100644 owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.delete_endpoint.js delete mode 100644 owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.get_endpoint.js delete mode 100644 owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.list_endpoints.js delete mode 100644 owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/snippet_metadata_google.cloud.ids.v1.json delete mode 100644 owl-bot-staging/google-cloud-ids/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-ids/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_client.ts delete mode 100644 owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_client_config.json delete mode 100644 owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-ids/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-ids/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-ids/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-ids/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-ids/v1/test/gapic_i_d_s_v1.ts delete mode 100644 owl-bot-staging/google-cloud-ids/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-ids/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-iot/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-iot/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-iot/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-iot/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-iot/v1/protos/google/cloud/iot/v1/device_manager.proto delete mode 100644 owl-bot-staging/google-cloud-iot/v1/protos/google/cloud/iot/v1/resources.proto delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.bind_device_to_gateway.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.create_device.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.create_device_registry.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.delete_device.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.delete_device_registry.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.get_device.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.get_device_registry.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.get_iam_policy.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_config_versions.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_registries.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_states.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_devices.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.modify_cloud_to_device_config.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.send_command_to_device.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.set_iam_policy.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.test_iam_permissions.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.unbind_device_from_gateway.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.update_device.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.update_device_registry.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/snippet_metadata_google.cloud.iot.v1.json delete mode 100644 owl-bot-staging/google-cloud-iot/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_client.ts delete mode 100644 owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_client_config.json delete mode 100644 owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-iot/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-iot/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-iot/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-iot/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-iot/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-iot/v1/test/gapic_device_manager_v1.ts delete mode 100644 owl-bot-staging/google-cloud-iot/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-iot/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/protos/google/cloud/kms/inventory/v1/key_dashboard_service.proto delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/protos/google/cloud/kms/inventory/v1/key_tracking_service.proto delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_dashboard_service.list_crypto_keys.js delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_tracking_service.get_protected_resources_summary.js delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_tracking_service.search_protected_resources.js delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/snippet_metadata_google.cloud.kms.inventory.v1.json delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/test/gapic_key_dashboard_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/test/gapic_key_tracking_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-kms-inventory/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-kms/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-kms/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-kms/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-kms/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/ekm_service.proto delete mode 100644 owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/resources.proto delete mode 100644 owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/service.proto delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.create_ekm_connection.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.get_ekm_config.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.get_ekm_connection.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.list_ekm_connections.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.update_ekm_config.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.update_ekm_connection.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.verify_connectivity.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.asymmetric_decrypt.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.asymmetric_sign.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_crypto_key.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_crypto_key_version.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_import_job.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_key_ring.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.decrypt.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.destroy_crypto_key_version.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.encrypt.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.generate_random_bytes.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_crypto_key.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_crypto_key_version.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_import_job.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_key_ring.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_public_key.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.import_crypto_key_version.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_crypto_key_versions.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_crypto_keys.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_import_jobs.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_key_rings.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.mac_sign.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.mac_verify.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.raw_decrypt.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.raw_encrypt.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.restore_crypto_key_version.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key_version.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/snippet_metadata_google.cloud.kms.v1.json delete mode 100644 owl-bot-staging/google-cloud-kms/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-kms/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-kms/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-kms/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-kms/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-kms/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-kms/v1/test/gapic_ekm_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-kms/v1/test/gapic_key_management_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-kms/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-kms/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-language/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-language/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-language/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-language/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-language/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-language/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-language/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-language/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-language/v1/protos/google/cloud/language/v1/language_service.proto delete mode 100644 owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_entities.js delete mode 100644 owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_entity_sentiment.js delete mode 100644 owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_sentiment.js delete mode 100644 owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_syntax.js delete mode 100644 owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.annotate_text.js delete mode 100644 owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.classify_text.js delete mode 100644 owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.moderate_text.js delete mode 100644 owl-bot-staging/google-cloud-language/v1/samples/generated/v1/snippet_metadata_google.cloud.language.v1.json delete mode 100644 owl-bot-staging/google-cloud-language/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-language/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-language/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-language/v1/src/v1/language_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-language/v1/src/v1/language_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-language/v1/src/v1/language_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-language/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-language/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-language/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-language/v1/test/gapic_language_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-language/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-language/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/.gitignore delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/README.md delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/package.json delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/protos/google/cloud/language/v1beta2/language_service.proto delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_entities.js delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_entity_sentiment.js delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_sentiment.js delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_syntax.js delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.annotate_text.js delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.classify_text.js delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.moderate_text.js delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/snippet_metadata_google.cloud.language.v1beta2.json delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/index.ts delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/test/gapic_language_service_v1beta2.ts delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-language/v1beta2/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-language/v2/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-language/v2/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-language/v2/.gitignore delete mode 100644 owl-bot-staging/google-cloud-language/v2/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-language/v2/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-language/v2/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-language/v2/README.md delete mode 100644 owl-bot-staging/google-cloud-language/v2/package.json delete mode 100644 owl-bot-staging/google-cloud-language/v2/protos/google/cloud/language/v2/language_service.proto delete mode 100644 owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.analyze_entities.js delete mode 100644 owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.analyze_sentiment.js delete mode 100644 owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.annotate_text.js delete mode 100644 owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.classify_text.js delete mode 100644 owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.moderate_text.js delete mode 100644 owl-bot-staging/google-cloud-language/v2/samples/generated/v2/snippet_metadata_google.cloud.language.v2.json delete mode 100644 owl-bot-staging/google-cloud-language/v2/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-language/v2/src/v2/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-language/v2/src/v2/index.ts delete mode 100644 owl-bot-staging/google-cloud-language/v2/src/v2/language_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-language/v2/src/v2/language_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-language/v2/src/v2/language_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-language/v2/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-language/v2/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-language/v2/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-language/v2/test/gapic_language_service_v2.ts delete mode 100644 owl-bot-staging/google-cloud-language/v2/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-language/v2/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.gitignore delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/README.md delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/package.json delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/protos/google/cloud/lifesciences/v2beta/workflows.proto delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/snippet_metadata_google.cloud.lifesciences.v2beta.json delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/index.ts delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client_config.json delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/test/gapic_workflows_service_v2_beta_v2beta.ts delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/protos/google/cloud/managedidentities/v1/managed_identities_service.proto delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/protos/google/cloud/managedidentities/v1/resource.proto delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.attach_trust.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.delete_domain.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.detach_trust.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.get_domain.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.list_domains.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.reconfigure_trust.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.reset_admin_password.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.update_domain.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.validate_trust.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/snippet_metadata_google.cloud.managedidentities.v1.json delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/test/gapic_managed_identities_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/README.md delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/package.json delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/protos/google/cloud/managedidentities/v1beta1/resource.proto delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.attach_trust.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.delete_domain.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.detach_trust.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.get_domain.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.list_domains.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.reset_admin_password.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.update_domain.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.validate_trust.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.managedidentities.v1beta1.json delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/index.ts delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/test/gapic_managed_identities_service_v1beta1.ts delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-managedidentities/v1beta1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/README.md delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/package.json delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/protos/google/cloud/mediatranslation/v1beta1/media_translation.proto delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.mediatranslation.v1beta1.json delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/samples/generated/v1beta1/speech_translation_service.streaming_translate_speech.js delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/index.ts delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/test/gapic_speech_translation_service_v1beta1.ts delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-mediatranslation/v1beta1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/protos/google/cloud/memcache/v1/cloud_memcache.proto delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.apply_parameters.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.create_instance.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.delete_instance.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.get_instance.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.list_instances.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.reschedule_maintenance.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.update_instance.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.update_parameters.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/snippet_metadata_google.cloud.memcache.v1.json delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_client.ts delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_client_config.json delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/test/gapic_cloud_memcache_v1.ts delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-memcache/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/.gitignore delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/README.md delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/package.json delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/protos/google/cloud/memcache/v1beta2/cloud_memcache.proto delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.apply_parameters.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.apply_software_update.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.create_instance.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.delete_instance.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.get_instance.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.list_instances.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.reschedule_maintenance.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.update_instance.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.update_parameters.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/snippet_metadata_google.cloud.memcache.v1beta2.json delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_client.ts delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_client_config.json delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/index.ts delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/test/gapic_cloud_memcache_v1beta2.ts delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-memcache/v1beta2/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore.proto delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore_federation.proto delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.alter_metadata_resource_location.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.export_metadata.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_backups.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_metadata_imports.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_services.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.move_table_to_database.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.query_metadata.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.restore_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.create_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.delete_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.get_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.list_federations.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.update_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/snippet_metadata_google.cloud.metastore.v1.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client_config.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client_config.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_federation_v1.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_v1.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.gitignore delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/README.md delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/package.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore.proto delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore_federation.proto delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.alter_metadata_resource_location.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.export_metadata.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_backups.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_services.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.move_table_to_database.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.query_metadata.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.remove_iam_policy.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.restore_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.metastore.v1alpha.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client_config.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client_config.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_federation_v1alpha.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_v1alpha.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.gitignore delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/README.md delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/package.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore.proto delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore_federation.proto delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.alter_metadata_resource_location.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.export_metadata.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_backups.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_services.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.move_table_to_database.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.query_metadata.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.remove_iam_policy.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.restore_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.create_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.get_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.list_federations.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.update_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.metastore.v1beta.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client_config.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client_config.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_federation_v1beta.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_v1beta.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/protos/google/cloud/migrationcenter/v1/migrationcenter.proto delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.add_assets_to_group.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.aggregate_assets_values.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.batch_delete_assets.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.batch_update_assets.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_group.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_import_data_file.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_import_job.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_preference_set.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_report.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_report_config.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_source.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_asset.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_group.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_import_data_file.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_import_job.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_preference_set.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_report.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_report_config.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_source.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_asset.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_error_frame.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_group.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_import_data_file.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_import_job.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_preference_set.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_report.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_report_config.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_settings.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_source.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_assets.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_error_frames.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_groups.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_import_data_files.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_import_jobs.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_preference_sets.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_report_configs.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_reports.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_sources.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.remove_assets_from_group.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.report_asset_frames.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.run_import_job.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_asset.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_group.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_import_job.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_preference_set.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_settings.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_source.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.validate_import_job.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/snippet_metadata_google.cloud.migrationcenter.v1.json delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_client.ts delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_client_config.json delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/test/gapic_migration_center_v1.ts delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-migrationcenter/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/protos/google/cloud/networkconnectivity/v1/common.proto delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/protos/google/cloud/networkconnectivity/v1/hub.proto delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.create_hub.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.create_spoke.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.delete_hub.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.delete_spoke.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.get_hub.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.get_spoke.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.list_hubs.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.list_spokes.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.update_hub.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.update_spoke.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/snippet_metadata_google.cloud.networkconnectivity.v1.json delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/test/gapic_hub_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/README.md delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/package.json delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/common.proto delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/hub.proto delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.create_hub.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.create_spoke.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.delete_hub.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.delete_spoke.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.get_hub.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.get_spoke.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.list_hubs.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.list_spokes.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.update_hub.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.update_spoke.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/snippet_metadata_google.cloud.networkconnectivity.v1alpha1.json delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/index.ts delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/test/gapic_hub_service_v1alpha1.ts delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/connectivity_test.proto delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/reachability.proto delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/trace.proto delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.create_connectivity_test.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.delete_connectivity_test.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.get_connectivity_test.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.list_connectivity_tests.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.rerun_connectivity_test.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.update_connectivity_test.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/snippet_metadata_google.cloud.networkmanagement.v1.json delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/test/gapic_reachability_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/README.md delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/package.json delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/connectivity_test.proto delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/reachability.proto delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/trace.proto delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.create_connectivity_test.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.delete_connectivity_test.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.get_connectivity_test.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.list_connectivity_tests.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.rerun_connectivity_test.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.update_connectivity_test.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.networkmanagement.v1beta1.json delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/index.ts delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/test/gapic_reachability_service_v1beta1.ts delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-networkmanagement/v1beta1/webpack.config.js diff --git a/owl-bot-staging/google-cloud-functions/v1/.eslintignore b/owl-bot-staging/google-cloud-functions/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-functions/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-functions/v1/.eslintrc.json b/owl-bot-staging/google-cloud-functions/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-functions/v1/.gitignore b/owl-bot-staging/google-cloud-functions/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-functions/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-functions/v1/.jsdoc.js b/owl-bot-staging/google-cloud-functions/v1/.jsdoc.js deleted file mode 100644 index 43186156cf8..00000000000 --- a/owl-bot-staging/google-cloud-functions/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/functions', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-functions/v1/.mocharc.js b/owl-bot-staging/google-cloud-functions/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-functions/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-functions/v1/.prettierrc.js b/owl-bot-staging/google-cloud-functions/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-functions/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-functions/v1/README.md b/owl-bot-staging/google-cloud-functions/v1/README.md deleted file mode 100644 index efb614cf6e7..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Functions: Nodejs Client diff --git a/owl-bot-staging/google-cloud-functions/v1/package.json b/owl-bot-staging/google-cloud-functions/v1/package.json deleted file mode 100644 index 8ccda2512b2..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/functions", - "version": "0.1.0", - "description": "Functions client for Node.js", - "repository": "googleapis/nodejs-functions", - "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 functions", - "functions", - "cloud functions service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-functions/v1/protos/google/cloud/functions/v1/functions.proto b/owl-bot-staging/google-cloud-functions/v1/protos/google/cloud/functions/v1/functions.proto deleted file mode 100644 index 340338e5b23..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/protos/google/cloud/functions/v1/functions.proto +++ /dev/null @@ -1,866 +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 -// -// 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.functions.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/functions/v1/operations.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/functions/apiv1/functionspb;functionspb"; -option java_multiple_files = true; -option java_outer_classname = "FunctionsProto"; -option java_package = "com.google.cloud.functions.v1"; -option objc_class_prefix = "GCF"; -option (google.api.resource_definition) = { - type: "artifactregistry.googleapis.com/Repository" - pattern: "projects/{project}/locations/{location}/repositories/{repository}" -}; -option (google.api.resource_definition) = { - type: "cloudkms.googleapis.com/CryptoKey" - pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" -}; - -// A service that application uses to manipulate triggers and functions. -service CloudFunctionsService { - option (google.api.default_host) = "cloudfunctions.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Returns a list of functions that belong to the requested project. - rpc ListFunctions(ListFunctionsRequest) returns (ListFunctionsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/functions" - }; - } - - // Returns a function with the given name from the requested project. - rpc GetFunction(GetFunctionRequest) returns (CloudFunction) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/functions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new function. If a function with the given name already exists in - // the specified project, the long running operation returns an - // `ALREADY_EXISTS` error. - rpc CreateFunction(CreateFunctionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{location=projects/*/locations/*}/functions" - body: "function" - }; - option (google.api.method_signature) = "location,function"; - option (google.longrunning.operation_info) = { - response_type: "CloudFunction" - metadata_type: "OperationMetadataV1" - }; - } - - // Updates existing function. - rpc UpdateFunction(UpdateFunctionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{function.name=projects/*/locations/*/functions/*}" - body: "function" - }; - option (google.api.method_signature) = "function"; - option (google.longrunning.operation_info) = { - response_type: "CloudFunction" - metadata_type: "OperationMetadataV1" - }; - } - - // Deletes a function with the given name from the specified project. If the - // given function is used by some trigger, the trigger is updated to - // remove this function. - rpc DeleteFunction(DeleteFunctionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/functions/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadataV1" - }; - } - - // Synchronously invokes a deployed Cloud Function. To be used for testing - // purposes as very limited traffic is allowed. For more information on - // the actual limits, refer to - // [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits). - rpc CallFunction(CallFunctionRequest) returns (CallFunctionResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/functions/*}:call" - body: "*" - }; - option (google.api.method_signature) = "name,data"; - } - - // Returns a signed URL for uploading a function source code. - // For more information about the signed URL usage see: - // https://cloud.google.com/storage/docs/access-control/signed-urls. - // Once the function source code upload is complete, the used signed - // URL should be provided in CreateFunction or UpdateFunction request - // as a reference to the function source code. - // - // When uploading source code to the generated signed URL, please follow - // these restrictions: - // - // * Source file type should be a zip file. - // * Source file size should not exceed 100MB limit. - // * No credentials should be attached - the signed URLs provide access to the - // target bucket using internal service identity; if credentials were - // attached, the identity from the credentials would be used, but that - // identity does not have permissions to upload files to the URL. - // - // When making an HTTP PUT request, these two headers must be specified: - // - // * `content-type: application/zip` - // * `x-goog-content-length-range: 0,104857600` - // - // And this header must NOT be specified: - // - // * `Authorization: Bearer YOUR_TOKEN` - rpc GenerateUploadUrl(GenerateUploadUrlRequest) - returns (GenerateUploadUrlResponse) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/functions:generateUploadUrl" - body: "*" - }; - } - - // Returns a signed URL for downloading deployed function source code. - // The URL is only valid for a limited period and must be used within - // minutes after generation. - // For more information about the signed URL usage, see: - // https://cloud.google.com/storage/docs/access-control/signed-urls - rpc GenerateDownloadUrl(GenerateDownloadUrlRequest) - returns (GenerateDownloadUrlResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/functions/*}:generateDownloadUrl" - body: "*" - }; - } - - // Sets the IAM access control policy on the specified function. - // Replaces any existing policy. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) - returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1/{resource=projects/*/locations/*/functions/*}:setIamPolicy" - body: "*" - }; - } - - // Gets the IAM access control policy for a function. - // Returns an empty policy if the function exists and does not have a policy - // set. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) - returns (google.iam.v1.Policy) { - option (google.api.http) = { - get: "/v1/{resource=projects/*/locations/*/functions/*}:getIamPolicy" - }; - } - - // Tests the specified permissions against the IAM access control policy - // for a function. - // If the function does not exist, this returns an empty set of - // permissions, not a NOT_FOUND error. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) - returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1/{resource=projects/*/locations/*/functions/*}:testIamPermissions" - body: "*" - }; - } -} - -// Describes a Cloud Function that contains user computation executed in -// response to an event. It encapsulates function and triggers configurations. -message CloudFunction { - option (google.api.resource) = { - type: "cloudfunctions.googleapis.com/CloudFunction" - pattern: "projects/{project}/locations/{location}/functions/{function}" - }; - - // Available egress settings. - // - // This controls what traffic is diverted through the Serverless VPC Access - // connector resource. By default, PRIVATE_RANGES_ONLY is used. - enum VpcConnectorEgressSettings { - // Unspecified. - VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; - - // Use the Serverless VPC Access connector only for private IP space from - // RFC1918. - PRIVATE_RANGES_ONLY = 1; - - // Force the use of Serverless VPC Access connector for all egress traffic - // from the function. - ALL_TRAFFIC = 2; - } - - // Available ingress settings. - // - // This controls what traffic can reach the function. - // - // If unspecified, ALLOW_ALL is used. - enum IngressSettings { - // Unspecified. - INGRESS_SETTINGS_UNSPECIFIED = 0; - - // Allow HTTP traffic from public and private sources. - ALLOW_ALL = 1; - - // Allow HTTP traffic from only private VPC sources. - ALLOW_INTERNAL_ONLY = 2; - - // Allow HTTP traffic from private VPC sources and through GCLB. - ALLOW_INTERNAL_AND_GCLB = 3; - } - - // Docker Registry to use for storing function Docker images. - enum DockerRegistry { - // Unspecified. - DOCKER_REGISTRY_UNSPECIFIED = 0; - - // Docker images are stored in multi-regional Container Registry - // repositories named `gcf`. - CONTAINER_REGISTRY = 1; - - // Docker images are stored in regional Artifact Registry repositories. - // By default, Cloud Functions creates and uses repositories named - // `gcf-artifacts` in every region in which a function is deployed. But the - // repository to use can also be specified by the user by using the - // `docker_repository` field. - ARTIFACT_REGISTRY = 2; - } - - // A user-defined name of the function. Function names must be unique - // globally and match pattern `projects/*/locations/*/functions/*` - string name = 1; - - // User-provided description of a function. - string description = 2; - - // The location of the function source code. - oneof source_code { - // The Google Cloud Storage URL, starting with `gs://`, pointing to the zip - // archive which contains the function. - string source_archive_url = 3; - - // **Beta Feature** - // - // The source repository where a function is hosted. - SourceRepository source_repository = 4; - - // The Google Cloud Storage-signed URL used for source uploading, generated - // by calling [google.cloud.functions.v1.GenerateUploadUrl]. - // - // The signature is validated on write methods (Create, Update) - // The signature is stripped from the Function object on read methods (Get, - // List) - string source_upload_url = 16; - } - - // An event that triggers the function. - oneof trigger { - // An HTTPS endpoint type of source that can be triggered via URL. - HttpsTrigger https_trigger = 5; - - // A source that fires events in response to a condition in another service. - EventTrigger event_trigger = 6; - } - - // Output only. Status of the function deployment. - CloudFunctionStatus status = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The name of the function (as defined in source code) that is executed. - // Defaults to the resource name suffix, if not specified. For - // backward compatibility, if function with given name is not found, the - // system tries to use the function named "function". - // For Node.js, this is the name of a function exported by the module - // as specified in `source_location`. - string entry_point = 8; - - // The runtime in which to run the function. Required when deploying a new - // function, optional when updating an existing function. For a complete - // list of possible choices, see the - // [`gcloud` command - // reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - string runtime = 19; - - // The function execution timeout. Execution is considered failed and - // can be terminated if the function is not completed at the end of the - // timeout period. Defaults to 60 seconds. - google.protobuf.Duration timeout = 9; - - // The amount of memory in MB available for a function. - // Defaults to 256MB. - int32 available_memory_mb = 10; - - // The email of the function's service account. If empty, defaults to - // `{project_id}@appspot.gserviceaccount.com`. - string service_account_email = 11; - - // Output only. The last update timestamp of a Cloud Function. - google.protobuf.Timestamp update_time = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The version identifier of the Cloud Function. Each deployment - // attempt results in a new version of a function being created. - int64 version_id = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels associated with this Cloud Function. - map labels = 15; - - // Environment variables that shall be available during function execution. - map environment_variables = 17; - - // Build environment variables that shall be available during build time. - map build_environment_variables = 28; - - // The Serverless VPC Access connector that this cloud function can connect - // to. It can be either the fully qualified URI, or the short name of the - // connector resource. If the connector name is used, the connector must - // belong to the same project as the function. Otherwise, it must belong to a - // project within the same organization. The format of this field is either - // `projects/{project}/global/networks/{network}` or `{network}`, where - // `{project}` is a project id where the network is defined, and `{network}` - // is the short name of the network. - // - // This field is mutually exclusive with `vpc_connector` and will be replaced - // by it. - // - // See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for - // more information on connecting Cloud projects. - string network = 18; - - // The limit on the maximum number of function instances that can coexist at a - // given time. - // - // In some cases, such as rapid traffic surges, Cloud Functions can for a - // short period of time create more instances than the specified max - // instances limit. If your function cannot tolerate this temporary behavior, - // you might want to factor in a safety margin and set a lower max instances - // value than your function can tolerate. - // - // See the [Max - // Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - // more details. - int32 max_instances = 20; - - // A lower bound for the number function instances that can coexist at a - // given time. - int32 min_instances = 32; - - // The VPC Network Connector that this cloud function can connect to. It can - // be either the fully qualified URI, or the short name of the network - // connector resource. The format of this field is - // `projects/*/locations/*/connectors/*` - // - // This field is mutually exclusive with `network` field and will eventually - // replace it. - // - // See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for - // more information on connecting Cloud projects. - string vpc_connector = 22; - - // The egress settings for the connector, controlling what traffic is diverted - // through it. - VpcConnectorEgressSettings vpc_connector_egress_settings = 23; - - // The ingress settings for the function, controlling what traffic can reach - // it. - IngressSettings ingress_settings = 24; - - // Resource name of a KMS crypto key (managed by the user) used to - // encrypt/decrypt function resources. - // - // It must match the pattern - // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - // - // If specified, you must also provide an artifact registry repository using - // the `docker_repository` field that was created with the same KMS crypto - // key. - // - // The following service accounts need to be granted the role 'Cloud KMS - // CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' - // on the Key/KeyRing/Project/Organization (least access preferred). - // - // 1. Google Cloud Functions service account - // (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - - // Required to protect the function's image. - // 2. Google Storage service account - // (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - - // Required to protect the function's source code. - // If this service account does not exist, deploying a function without a - // KMS key or retrieving the service agent name provisions it. For more - // information, see - // https://cloud.google.com/storage/docs/projects#service-agents and - // https://cloud.google.com/storage/docs/getting-service-agent#gsutil. - // - // Google Cloud Functions delegates access to service agents to protect - // function resources in internal projects that are not accessible by the - // end user. - string kms_key_name = 25 [(google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - }]; - - // Name of the Cloud Build Custom Worker Pool that should be used to build the - // function. The format of this field is - // `projects/{project}/locations/{region}/workerPools/{workerPool}` where - // `{project}` and `{region}` are the project id and region respectively where - // the worker pool is defined and `{workerPool}` is the short name of the - // worker pool. - // - // If the project id is not the same as the function, then the Cloud - // Functions Service Agent - // (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must - // be granted the role Cloud Build Custom Workers Builder - // (`roles/cloudbuild.customworkers.builder`) in the project. - string build_worker_pool = 26; - - // Output only. The Cloud Build ID of the latest successful deployment of the - // function. - string build_id = 27 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The Cloud Build Name of the function deployment. - // `projects//locations//builds/`. - string build_name = 33 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Secret environment variables configuration. - repeated SecretEnvVar secret_environment_variables = 29; - - // Secret volumes configuration. - repeated SecretVolume secret_volumes = 30; - - // Input only. An identifier for Firebase function sources. Disclaimer: This - // field is only supported for Firebase function deployments. - string source_token = 31 [(google.api.field_behavior) = INPUT_ONLY]; - - // User managed repository created in Artifact Registry optionally with a - // customer managed encryption key. If specified, deployments will use - // Artifact Registry. If unspecified and the deployment is eligible to use - // Artifact Registry, GCF will create and use a repository named - // 'gcf-artifacts' for every deployed region. This is the repository to which - // the function docker image is pushed after it is built by Cloud Build. - // - // It must match the pattern - // `projects/{project}/locations/{location}/repositories/{repository}`. - // - // Cross-project repositories are not supported. - // Cross-location repositories are not supported. - // Repository format must be 'DOCKER'. - string docker_repository = 34 [(google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/Repository" - }]; - - // Docker Registry to use for this deployment. - // - // If `docker_repository` field is specified, this field is automatically - // set as `ARTIFACT_REGISTRY`. - // If unspecified, it currently defaults to `CONTAINER_REGISTRY`. - // This field may be overridden by the backend for eligible deployments. - DockerRegistry docker_registry = 35; -} - -// Describes SourceRepository, used to represent parameters related to -// source repository where a function is hosted. -message SourceRepository { - // The URL pointing to the hosted repository where the function is defined. - // There are supported Cloud Source Repository URLs in the following - // formats: - // - // To refer to a specific commit: - // `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` - // To refer to a moveable alias (branch): - // `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` - // In particular, to refer to HEAD use `master` moveable alias. - // To refer to a specific fixed alias (tag): - // `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` - // - // You can omit `paths/*` if you want to use the main directory. - string url = 1; - - // Output only. The URL pointing to the hosted repository where the function - // were defined at the time of deployment. It always points to a specific - // commit in the format described above. - string deployed_url = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Describes HttpsTrigger, could be used to connect web hooks to function. -message HttpsTrigger { - // Available security-level settings. - // - // This controls the methods to enforce security (HTTPS) on a URL. - // - // If unspecified, SECURE_OPTIONAL is used. - enum SecurityLevel { - // Unspecified. - SECURITY_LEVEL_UNSPECIFIED = 0; - - // Requests for a URL that match this handler that do not use HTTPS are - // automatically redirected to the HTTPS URL with the same path. Query - // parameters are reserved for the redirect. - SECURE_ALWAYS = 1; - - // Both HTTP and HTTPS requests with URLs that match the handler succeed - // without redirects. The application can examine the request to determine - // which protocol was used and respond accordingly. - SECURE_OPTIONAL = 2; - } - - // Output only. The deployed URL for the function. - string url = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The security level for the function. - SecurityLevel security_level = 2; -} - -// Describes EventTrigger, used to request that events be sent from another -// service. -message EventTrigger { - // Required. The type of event to observe. For example: - // `providers/cloud.storage/eventTypes/object.change` and - // `providers/cloud.pubsub/eventTypes/topic.publish`. - // - // Event types match pattern `providers/*/eventTypes/*.*`. - // The pattern contains: - // - // 1. namespace: For example, `cloud.storage` and - // `google.firebase.analytics`. - // 2. resource type: The type of resource on which event occurs. For - // example, the Google Cloud Storage API includes the type `object`. - // 3. action: The action that generates the event. For example, action for - // a Google Cloud Storage Object is 'change'. - // These parts are lowercase. - string event_type = 1; - - // Required. The resource(s) from which to observe events, for example, - // `projects/_/buckets/myBucket`. - // - // Not all syntactically correct values are accepted by all services. For - // example: - // - // 1. The authorization model must support it. Google Cloud Functions - // only allows EventTriggers to be deployed that observe resources in the - // same project as the `CloudFunction`. - // 2. The resource type must match the pattern expected for an - // `event_type`. For example, an `EventTrigger` that has an - // `event_type` of "google.pubsub.topic.publish" should have a resource - // that matches Google Cloud Pub/Sub topics. - // - // Additionally, some services may support short names when creating an - // `EventTrigger`. These are always returned in the normalized "long" - // format. - // - // See each *service's* documentation for supported formats. - string resource = 2; - - // The hostname of the service that should be observed. - // - // If no string is provided, the default service implementing the API will - // be used. For example, `storage.googleapis.com` is the default for all - // event types in the `google.storage` namespace. - string service = 3; - - // Specifies policy for failed executions. - FailurePolicy failure_policy = 5; -} - -// Describes the policy in case of function's execution failure. -// If empty, then defaults to ignoring failures (i.e., not retrying them). -message FailurePolicy { - // Describes the retry policy in case of function's execution failure. - // A function execution is retried on any failure. - // A failed execution is retried up to 7 days with an exponential backoff - // (capped at 10 seconds). - // Retried execution is charged as any other execution. - message Retry {} - - // Defines the action taken in case of a function execution failure. - oneof action { - // If specified, the function is retried in case of a failure. - Retry retry = 1; - } -} - -// Describes the current stage of a deployment. -enum CloudFunctionStatus { - // Not specified. Invalid state. - CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0; - - // Function has been successfully deployed and is serving. - ACTIVE = 1; - - // Function deployment failed and the function isn’t serving. - OFFLINE = 2; - - // Function is being created or updated. - DEPLOY_IN_PROGRESS = 3; - - // Function is being deleted. - DELETE_IN_PROGRESS = 4; - - // Function deployment failed and the function serving state is undefined. - // The function should be updated or deleted to move it out of this state. - UNKNOWN = 5; -} - -// Configuration for a secret environment variable. It has the information -// necessary to fetch the secret value from Secret Manager and expose it as an -// environment variable. -message SecretEnvVar { - // Name of the environment variable. - string key = 1; - - // Project identifier (preferrably project number but can also be the project - // ID) of the project that contains the secret. If not set, it is - // populated with the function's project, assuming that the secret exists in - // the same project as the function. - string project_id = 2; - - // Name of the secret in Secret Manager (not the full resource name). - string secret = 3; - - // Version of the secret (version number or the string 'latest'). It is - // recommended to use a numeric version for secret environment variables as - // any updates to the secret value is not reflected until new instances start. - string version = 4; -} - -// Configuration for a secret volume. It has the information necessary to fetch -// the secret value from Secret Manager and make it available as files mounted -// at the requested paths within the application container. Secret value is not -// a part of the configuration. Every file system read operation performs a -// lookup in Secret Manager to retrieve the secret value. -message SecretVolume { - // Configuration for a single version. - message SecretVersion { - // Version of the secret (version number or the string 'latest'). It is - // preferable to use `latest` version with secret volumes as secret value - // changes are reflected immediately. - string version = 1; - - // Relative path of the file under the mount path where the secret value for - // this version is fetched and made available. For example, setting the - // mount_path as '/etc/secrets' and path as `/secret_foo` mounts the - // secret value file at `/etc/secrets/secret_foo`. - string path = 2; - } - - // The path within the container to mount the secret volume. For example, - // setting the mount_path as `/etc/secrets` mounts the secret value files - // under the `/etc/secrets` directory. This directory is also completely - // shadowed and unavailable to mount any other secrets. - // - // Recommended mount paths: /etc/secrets - // Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log - string mount_path = 1; - - // Project identifier (preferrably project number but can also be the project - // ID) of the project that contains the secret. If not set, it is - // populated with the function's project, assuming that the secret exists in - // the same project as the function. - string project_id = 2; - - // Name of the secret in Secret Manager (not the full resource name). - string secret = 3; - - // List of secret versions to mount for this secret. If empty, the `latest` - // version of the secret is made available in a file named after the - // secret under the mount point. - repeated SecretVersion versions = 4; -} - -// Request for the `CreateFunction` method. -message CreateFunctionRequest { - // Required. The project and location in which the function should be created, - // specified in the format `projects/*/locations/*` - string location = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. Function to be created. - CloudFunction function = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `UpdateFunction` method. -message UpdateFunctionRequest { - // Required. New version of the function. - CloudFunction function = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The list of fields in `CloudFunction` that have to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request for the `GetFunction` method. -message GetFunctionRequest { - // Required. The name of the function which details should be obtained. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudfunctions.googleapis.com/CloudFunction" - } - ]; -} - -// Request for the `ListFunctions` method. -message ListFunctionsRequest { - // The project and location from which the function should be listed, - // specified in the format `projects/*/locations/*` - // If you want to list functions in all locations, use "-" in place of a - // location. When listing functions in all locations, if one or more - // location(s) are unreachable, the response will contain functions from all - // reachable locations along with the names of any unreachable locations. - string parent = 1 [(google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - }]; - - // Maximum number of functions to return per call. - int32 page_size = 2; - - // The value returned by the last - // `ListFunctionsResponse`; indicates that - // this is a continuation of a prior `ListFunctions` call, and that the - // system should return the next page of data. - string page_token = 3; -} - -// Response for the `ListFunctions` method. -message ListFunctionsResponse { - // The functions that match the request. - repeated CloudFunction functions = 1; - - // If not empty, indicates that there may be more functions that match - // the request; this value should be passed in a new - // [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] - // to get more functions. - string next_page_token = 2; - - // Locations that could not be reached. The response does not include any - // functions from these locations. - repeated string unreachable = 3; -} - -// Request for the `DeleteFunction` method. -message DeleteFunctionRequest { - // Required. The name of the function which should be deleted. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudfunctions.googleapis.com/CloudFunction" - } - ]; -} - -// Request for the `CallFunction` method. -message CallFunctionRequest { - // Required. The name of the function to be called. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudfunctions.googleapis.com/CloudFunction" - } - ]; - - // Required. Input to be passed to the function. - string data = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response of `CallFunction` method. -message CallFunctionResponse { - // Execution id of function invocation. - string execution_id = 1; - - // Result populated for successful execution of synchronous function. Will - // not be populated if function does not return a result through context. - string result = 2; - - // Either system or user-function generated error. Set if execution - // was not successful. - string error = 3; -} - -// Request of `GenerateSourceUploadUrl` method. -message GenerateUploadUrlRequest { - // The project and location in which the Google Cloud Storage signed URL - // should be generated, specified in the format `projects/*/locations/*`. - string parent = 1; - - // Resource name of a KMS crypto key (managed by the user) used to - // encrypt/decrypt function source code objects in staging Cloud Storage - // buckets. When you generate an upload url and upload your source code, it - // gets copied to a staging Cloud Storage bucket in an internal regional - // project. The source code is then copied to a versioned directory in the - // sources bucket in the consumer project during the function deployment. - // - // It must match the pattern - // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - // - // The Google Cloud Functions service account - // (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - // granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - // (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - // Key/KeyRing/Project/Organization (least access preferred). GCF will - // delegate access to the Google Storage service account in the internal - // project. - string kms_key_name = 2 [(google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - }]; -} - -// Response of `GenerateSourceUploadUrl` method. -message GenerateUploadUrlResponse { - // The generated Google Cloud Storage signed URL that should be used for a - // function source code upload. The uploaded file should be a zip archive - // which contains a function. - string upload_url = 1; -} - -// Request of `GenerateDownloadUrl` method. -message GenerateDownloadUrlRequest { - // The name of function for which source code Google Cloud Storage signed - // URL should be generated. - string name = 1; - - // The optional version of function. If not set, default, current version - // is used. - uint64 version_id = 2; -} - -// Response of `GenerateDownloadUrl` method. -message GenerateDownloadUrlResponse { - // The generated Google Cloud Storage signed URL that should be used for - // function source code download. - string download_url = 1; -} diff --git a/owl-bot-staging/google-cloud-functions/v1/protos/google/cloud/functions/v1/operations.proto b/owl-bot-staging/google-cloud-functions/v1/protos/google/cloud/functions/v1/operations.proto deleted file mode 100644 index 1a9ba18890b..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/protos/google/cloud/functions/v1/operations.proto +++ /dev/null @@ -1,73 +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 -// -// 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.functions.v1; - -import "google/protobuf/any.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/functions/apiv1/functionspb;functionspb"; -option java_multiple_files = true; -option java_outer_classname = "FunctionsOperationsProto"; -option java_package = "com.google.cloud.functions.v1"; - -// A type of an operation. -enum OperationType { - // Unknown operation type. - OPERATION_UNSPECIFIED = 0; - - // Triggered by CreateFunction call - CREATE_FUNCTION = 1; - - // Triggered by UpdateFunction call - UPDATE_FUNCTION = 2; - - // Triggered by DeleteFunction call. - DELETE_FUNCTION = 3; -} - -// Metadata describing an [Operation][google.longrunning.Operation] -message OperationMetadataV1 { - // Target of the operation - for example - // `projects/project-1/locations/region-1/functions/function-1` - string target = 1; - - // Type of operation. - OperationType type = 2; - - // The original request that started the operation. - google.protobuf.Any request = 3; - - // Version id of the function created or updated by an API call. - // This field is only populated for Create and Update operations. - int64 version_id = 4; - - // The last update timestamp of the operation. - google.protobuf.Timestamp update_time = 5; - - // The Cloud Build ID of the function created or updated by an API call. - // This field is only populated for Create and Update operations. - string build_id = 6; - - // An identifier for Firebase function sources. Disclaimer: This field is only - // supported for Firebase function deployments. - string source_token = 7; - - // The Cloud Build Name of the function deployment. - // This field is only populated for Create and Update operations. - // `projects//locations//builds/`. - string build_name = 8; -} diff --git a/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.call_function.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.call_function.js deleted file mode 100644 index c3c01a9aaf3..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.call_function.js +++ /dev/null @@ -1,66 +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, data) { - // [START cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the function to be called. - */ - // const name = 'abc123' - /** - * Required. Input to be passed to the function. - */ - // const data = 'abc123' - - // Imports the Functions library - const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; - - // Instantiates a client - const functionsClient = new CloudFunctionsServiceClient(); - - async function callCallFunction() { - // Construct request - const request = { - name, - data, - }; - - // Run request - const response = await functionsClient.callFunction(request); - console.log(response); - } - - callCallFunction(); - // [END cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_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-functions/v1/samples/generated/v1/cloud_functions_service.create_function.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.create_function.js deleted file mode 100644 index dbb4c91641e..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.create_function.js +++ /dev/null @@ -1,68 +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(location, function1) { - // [START cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_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 project and location in which the function should be created, - * specified in the format `projects/* /locations/*` - */ - // const location = 'abc123' - /** - * Required. Function to be created. - */ - // const function = {} - - // Imports the Functions library - const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; - - // Instantiates a client - const functionsClient = new CloudFunctionsServiceClient(); - - async function callCreateFunction() { - // Construct request - const request = { - location, - function1, - }; - - // Run request - const [operation] = await functionsClient.createFunction(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateFunction(); - // [END cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_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-functions/v1/samples/generated/v1/cloud_functions_service.delete_function.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.delete_function.js deleted file mode 100644 index 20927310ece..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.delete_function.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 cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the function which should be deleted. - */ - // const name = 'abc123' - - // Imports the Functions library - const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; - - // Instantiates a client - const functionsClient = new CloudFunctionsServiceClient(); - - async function callDeleteFunction() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await functionsClient.deleteFunction(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteFunction(); - // [END cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_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-functions/v1/samples/generated/v1/cloud_functions_service.generate_download_url.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.generate_download_url.js deleted file mode 100644 index bb0ca85a69a..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.generate_download_url.js +++ /dev/null @@ -1,66 +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() { - // [START cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The name of function for which source code Google Cloud Storage signed - * URL should be generated. - */ - // const name = 'abc123' - /** - * The optional version of function. If not set, default, current version - * is used. - */ - // const versionId = 1234 - - // Imports the Functions library - const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; - - // Instantiates a client - const functionsClient = new CloudFunctionsServiceClient(); - - async function callGenerateDownloadUrl() { - // Construct request - const request = { - }; - - // Run request - const response = await functionsClient.generateDownloadUrl(request); - console.log(response); - } - - callGenerateDownloadUrl(); - // [END cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_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-functions/v1/samples/generated/v1/cloud_functions_service.generate_upload_url.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.generate_upload_url.js deleted file mode 100644 index 52ec47839a4..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.generate_upload_url.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() { - // [START cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The project and location in which the Google Cloud Storage signed URL - * should be generated, specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in staging Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to a staging Cloud Storage bucket in an internal regional - * project. The source code is then copied to a versioned directory in the - * sources bucket in the consumer project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). GCF will - * delegate access to the Google Storage service account in the internal - * project. - */ - // const kmsKeyName = 'abc123' - - // Imports the Functions library - const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; - - // Instantiates a client - const functionsClient = new CloudFunctionsServiceClient(); - - async function callGenerateUploadUrl() { - // Construct request - const request = { - }; - - // Run request - const response = await functionsClient.generateUploadUrl(request); - console.log(response); - } - - callGenerateUploadUrl(); - // [END cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_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-functions/v1/samples/generated/v1/cloud_functions_service.get_function.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.get_function.js deleted file mode 100644 index 7882acbad52..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.get_function.js +++ /dev/null @@ -1,61 +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 cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the function which details should be obtained. - */ - // const name = 'abc123' - - // Imports the Functions library - const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; - - // Instantiates a client - const functionsClient = new CloudFunctionsServiceClient(); - - async function callGetFunction() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await functionsClient.getFunction(request); - console.log(response); - } - - callGetFunction(); - // [END cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_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-functions/v1/samples/generated/v1/cloud_functions_service.get_iam_policy.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.get_iam_policy.js deleted file mode 100644 index 8f206ab5c56..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_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 cloudfunctions_v1_generated_CloudFunctionsService_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 Functions library - const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; - - // Instantiates a client - const functionsClient = new CloudFunctionsServiceClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await functionsClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END cloudfunctions_v1_generated_CloudFunctionsService_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-functions/v1/samples/generated/v1/cloud_functions_service.list_functions.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.list_functions.js deleted file mode 100644 index 9b3a80b942f..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.list_functions.js +++ /dev/null @@ -1,78 +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() { - // [START cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The project and location from which the function should be listed, - * specified in the format `projects/* /locations/*` - * If you want to list functions in all locations, use "-" in place of a - * location. When listing functions in all locations, if one or more - * location(s) are unreachable, the response will contain functions from all - * reachable locations along with the names of any unreachable locations. - */ - // const parent = 'abc123' - /** - * Maximum number of functions to return per call. - */ - // const pageSize = 1234 - /** - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - */ - // const pageToken = 'abc123' - - // Imports the Functions library - const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; - - // Instantiates a client - const functionsClient = new CloudFunctionsServiceClient(); - - async function callListFunctions() { - // Construct request - const request = { - }; - - // Run request - const iterable = await functionsClient.listFunctionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFunctions(); - // [END cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_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-functions/v1/samples/generated/v1/cloud_functions_service.set_iam_policy.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.set_iam_policy.js deleted file mode 100644 index 823bd367827..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_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 cloudfunctions_v1_generated_CloudFunctionsService_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 Functions library - const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; - - // Instantiates a client - const functionsClient = new CloudFunctionsServiceClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await functionsClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END cloudfunctions_v1_generated_CloudFunctionsService_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-functions/v1/samples/generated/v1/cloud_functions_service.test_iam_permissions.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.test_iam_permissions.js deleted file mode 100644 index 54f1cec58ab..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_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 cloudfunctions_v1_generated_CloudFunctionsService_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 = ['abc','def'] - - // Imports the Functions library - const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; - - // Instantiates a client - const functionsClient = new CloudFunctionsServiceClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await functionsClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END cloudfunctions_v1_generated_CloudFunctionsService_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-functions/v1/samples/generated/v1/cloud_functions_service.update_function.js b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.update_function.js deleted file mode 100644 index 6d6d22999b6..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/cloud_functions_service.update_function.js +++ /dev/null @@ -1,66 +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(function1) { - // [START cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_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. New version of the function. - */ - // const function = {} - /** - * Required. The list of fields in `CloudFunction` that have to be updated. - */ - // const updateMask = {} - - // Imports the Functions library - const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; - - // Instantiates a client - const functionsClient = new CloudFunctionsServiceClient(); - - async function callUpdateFunction() { - // Construct request - const request = { - function1, - }; - - // Run request - const [operation] = await functionsClient.updateFunction(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateFunction(); - // [END cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_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-functions/v1/samples/generated/v1/snippet_metadata_google.cloud.functions.v1.json b/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/snippet_metadata_google.cloud.functions.v1.json deleted file mode 100644 index 6fbe3144065..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/samples/generated/v1/snippet_metadata_google.cloud.functions.v1.json +++ /dev/null @@ -1,499 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-functions", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.functions.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_async", - "title": "CloudFunctionsService listFunctions Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of functions that belong to the requested project.", - "canonical": true, - "file": "cloud_functions_service.list_functions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFunctions", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.ListFunctions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v1.ListFunctionsResponse", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" - }, - "method": { - "shortName": "ListFunctions", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.ListFunctions", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_async", - "title": "CloudFunctionsService getFunction Sample", - "origin": "API_DEFINITION", - "description": " Returns a function with the given name from the requested project.", - "canonical": true, - "file": "cloud_functions_service.get_function.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetFunction", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v1.CloudFunction", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" - }, - "method": { - "shortName": "GetFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetFunction", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_async", - "title": "CloudFunctionsService createFunction Sample", - "origin": "API_DEFINITION", - "description": " Creates a new function. If a function with the given name already exists in the specified project, the long running operation returns an `ALREADY_EXISTS` error.", - "canonical": true, - "file": "cloud_functions_service.create_function.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.CreateFunction", - "async": true, - "parameters": [ - { - "name": "location", - "type": "TYPE_STRING" - }, - { - "name": "function", - "type": ".google.cloud.functions.v1.CloudFunction" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" - }, - "method": { - "shortName": "CreateFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.CreateFunction", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_async", - "title": "CloudFunctionsService updateFunction Sample", - "origin": "API_DEFINITION", - "description": " Updates existing function.", - "canonical": true, - "file": "cloud_functions_service.update_function.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.UpdateFunction", - "async": true, - "parameters": [ - { - "name": "function", - "type": ".google.cloud.functions.v1.CloudFunction" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" - }, - "method": { - "shortName": "UpdateFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.UpdateFunction", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async", - "title": "CloudFunctionsService deleteFunction Sample", - "origin": "API_DEFINITION", - "description": " Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger is updated to remove this function.", - "canonical": true, - "file": "cloud_functions_service.delete_function.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.DeleteFunction", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" - }, - "method": { - "shortName": "DeleteFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.DeleteFunction", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_async", - "title": "CloudFunctionsService callFunction Sample", - "origin": "API_DEFINITION", - "description": " Synchronously invokes a deployed Cloud Function. To be used for testing purposes as very limited traffic is allowed. For more information on the actual limits, refer to [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits).", - "canonical": true, - "file": "cloud_functions_service.call_function.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CallFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.CallFunction", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "data", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v1.CallFunctionResponse", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" - }, - "method": { - "shortName": "CallFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.CallFunction", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_async", - "title": "CloudFunctionsService generateUploadUrl Sample", - "origin": "API_DEFINITION", - "description": " Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * Source file size should not exceed 100MB limit. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making an HTTP PUT request, these two headers must be specified: * `content-type: application/zip` * `x-goog-content-length-range: 0,104857600` And this header must NOT be specified: * `Authorization: Bearer YOUR_TOKEN`", - "canonical": true, - "file": "cloud_functions_service.generate_upload_url.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateUploadUrl", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateUploadUrl", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "kms_key_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v1.GenerateUploadUrlResponse", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" - }, - "method": { - "shortName": "GenerateUploadUrl", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateUploadUrl", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_async", - "title": "CloudFunctionsService generateDownloadUrl Sample", - "origin": "API_DEFINITION", - "description": " Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and must be used within minutes after generation. For more information about the signed URL usage, see: https://cloud.google.com/storage/docs/access-control/signed-urls", - "canonical": true, - "file": "cloud_functions_service.generate_download_url.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateDownloadUrl", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateDownloadUrl", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "version_id", - "type": "TYPE_UINT64" - } - ], - "resultType": ".google.cloud.functions.v1.GenerateDownloadUrlResponse", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" - }, - "method": { - "shortName": "GenerateDownloadUrl", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateDownloadUrl", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_SetIamPolicy_async", - "title": "CloudFunctionsService setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the IAM access control policy on the specified function. Replaces any existing policy.", - "canonical": true, - "file": "cloud_functions_service.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.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": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.SetIamPolicy", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GetIamPolicy_async", - "title": "CloudFunctionsService getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the IAM access control policy for a function. Returns an empty policy if the function exists and does not have a policy set.", - "canonical": true, - "file": "cloud_functions_service.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetIamPolicy", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_TestIamPermissions_async", - "title": "CloudFunctionsService testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Tests the specified permissions against the IAM access control policy for a function. If the function does not exist, this returns an empty set of permissions, not a NOT_FOUND error.", - "canonical": true, - "file": "cloud_functions_service.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.TestIamPermissions", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-functions/v1/src/index.ts b/owl-bot-staging/google-cloud-functions/v1/src/index.ts deleted file mode 100644 index 269dff995d6..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/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 v1 from './v1'; -const CloudFunctionsServiceClient = v1.CloudFunctionsServiceClient; -type CloudFunctionsServiceClient = v1.CloudFunctionsServiceClient; -export {v1, CloudFunctionsServiceClient}; -export default {v1, CloudFunctionsServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_client.ts b/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_client.ts deleted file mode 100644 index 38275e292d4..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_client.ts +++ /dev/null @@ -1,1881 +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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/cloud_functions_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './cloud_functions_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * A service that application uses to manipulate triggers and functions. - * @class - * @memberof v1 - */ -export class CloudFunctionsServiceClient { - 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}; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - cloudFunctionsServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CloudFunctionsServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 CloudFunctionsServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof CloudFunctionsServiceClient; - 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; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - 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 = { - cloudFunctionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/functions/{function}' - ), - cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - repositoryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}' - ), - }; - - // 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 = { - listFunctions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'functions') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createFunctionResponse = protoFilesRoot.lookup( - '.google.cloud.functions.v1.CloudFunction') as gax.protobuf.Type; - const createFunctionMetadata = protoFilesRoot.lookup( - '.google.cloud.functions.v1.OperationMetadataV1') as gax.protobuf.Type; - const updateFunctionResponse = protoFilesRoot.lookup( - '.google.cloud.functions.v1.CloudFunction') as gax.protobuf.Type; - const updateFunctionMetadata = protoFilesRoot.lookup( - '.google.cloud.functions.v1.OperationMetadataV1') as gax.protobuf.Type; - const deleteFunctionResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteFunctionMetadata = protoFilesRoot.lookup( - '.google.cloud.functions.v1.OperationMetadataV1') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createFunction: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createFunctionResponse.decode.bind(createFunctionResponse), - createFunctionMetadata.decode.bind(createFunctionMetadata)), - updateFunction: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateFunctionResponse.decode.bind(updateFunctionResponse), - updateFunctionMetadata.decode.bind(updateFunctionMetadata)), - deleteFunction: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteFunctionResponse.decode.bind(deleteFunctionResponse), - deleteFunctionMetadata.decode.bind(deleteFunctionMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.functions.v1.CloudFunctionsService', 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.cloudFunctionsServiceStub) { - return this.cloudFunctionsServiceStub; - } - - // Put together the "service stub" for - // google.cloud.functions.v1.CloudFunctionsService. - this.cloudFunctionsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.functions.v1.CloudFunctionsService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.functions.v1.CloudFunctionsService, - 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 cloudFunctionsServiceStubMethods = - ['listFunctions', 'getFunction', 'createFunction', 'updateFunction', 'deleteFunction', 'callFunction', 'generateUploadUrl', 'generateDownloadUrl', 'setIamPolicy', 'getIamPolicy', 'testIamPermissions']; - for (const methodName of cloudFunctionsServiceStubMethods) { - const callPromise = this.cloudFunctionsServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.cloudFunctionsServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'cloudfunctions.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 'cloudfunctions.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 -- - // ------------------- -/** - * Returns a function with the given name from the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the function which details should be obtained. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v1.CloudFunction|CloudFunction}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_functions_service.get_function.js - * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_async - */ - getFunction( - request?: protos.google.cloud.functions.v1.IGetFunctionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v1.ICloudFunction, - protos.google.cloud.functions.v1.IGetFunctionRequest|undefined, {}|undefined - ]>; - getFunction( - request: protos.google.cloud.functions.v1.IGetFunctionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.functions.v1.ICloudFunction, - protos.google.cloud.functions.v1.IGetFunctionRequest|null|undefined, - {}|null|undefined>): void; - getFunction( - request: protos.google.cloud.functions.v1.IGetFunctionRequest, - callback: Callback< - protos.google.cloud.functions.v1.ICloudFunction, - protos.google.cloud.functions.v1.IGetFunctionRequest|null|undefined, - {}|null|undefined>): void; - getFunction( - request?: protos.google.cloud.functions.v1.IGetFunctionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.functions.v1.ICloudFunction, - protos.google.cloud.functions.v1.IGetFunctionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.functions.v1.ICloudFunction, - protos.google.cloud.functions.v1.IGetFunctionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v1.ICloudFunction, - protos.google.cloud.functions.v1.IGetFunctionRequest|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.getFunction(request, options, callback); - } -/** - * Synchronously invokes a deployed Cloud Function. To be used for testing - * purposes as very limited traffic is allowed. For more information on - * the actual limits, refer to - * [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the function to be called. - * @param {string} request.data - * Required. Input to be passed to the function. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v1.CallFunctionResponse|CallFunctionResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_functions_service.call_function.js - * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_async - */ - callFunction( - request?: protos.google.cloud.functions.v1.ICallFunctionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v1.ICallFunctionResponse, - protos.google.cloud.functions.v1.ICallFunctionRequest|undefined, {}|undefined - ]>; - callFunction( - request: protos.google.cloud.functions.v1.ICallFunctionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.functions.v1.ICallFunctionResponse, - protos.google.cloud.functions.v1.ICallFunctionRequest|null|undefined, - {}|null|undefined>): void; - callFunction( - request: protos.google.cloud.functions.v1.ICallFunctionRequest, - callback: Callback< - protos.google.cloud.functions.v1.ICallFunctionResponse, - protos.google.cloud.functions.v1.ICallFunctionRequest|null|undefined, - {}|null|undefined>): void; - callFunction( - request?: protos.google.cloud.functions.v1.ICallFunctionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.functions.v1.ICallFunctionResponse, - protos.google.cloud.functions.v1.ICallFunctionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.functions.v1.ICallFunctionResponse, - protos.google.cloud.functions.v1.ICallFunctionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v1.ICallFunctionResponse, - protos.google.cloud.functions.v1.ICallFunctionRequest|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.callFunction(request, options, callback); - } -/** - * Returns a signed URL for uploading a function source code. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls. - * Once the function source code upload is complete, the used signed - * URL should be provided in CreateFunction or UpdateFunction request - * as a reference to the function source code. - * - * When uploading source code to the generated signed URL, please follow - * these restrictions: - * - * * Source file type should be a zip file. - * * Source file size should not exceed 100MB limit. - * * No credentials should be attached - the signed URLs provide access to the - * target bucket using internal service identity; if credentials were - * attached, the identity from the credentials would be used, but that - * identity does not have permissions to upload files to the URL. - * - * When making an HTTP PUT request, these two headers must be specified: - * - * * `content-type: application/zip` - * * `x-goog-content-length-range: 0,104857600` - * - * And this header must NOT be specified: - * - * * `Authorization: Bearer YOUR_TOKEN` - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The project and location in which the Google Cloud Storage signed URL - * should be generated, specified in the format `projects/* /locations/*`. - * @param {string} request.kmsKeyName - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in staging Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to a staging Cloud Storage bucket in an internal regional - * project. The source code is then copied to a versioned directory in the - * sources bucket in the consumer project during the function deployment. - * - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). GCF will - * delegate access to the Google Storage service account in the internal - * project. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v1.GenerateUploadUrlResponse|GenerateUploadUrlResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_functions_service.generate_upload_url.js - * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_async - */ - generateUploadUrl( - request?: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|undefined, {}|undefined - ]>; - generateUploadUrl( - request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>): void; - generateUploadUrl( - request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, - callback: Callback< - protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>): void; - generateUploadUrl( - request?: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|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.generateUploadUrl(request, options, callback); - } -/** - * Returns a signed URL for downloading deployed function source code. - * The URL is only valid for a limited period and must be used within - * minutes after generation. - * For more information about the signed URL usage, see: - * https://cloud.google.com/storage/docs/access-control/signed-urls - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of function for which source code Google Cloud Storage signed - * URL should be generated. - * @param {number} request.versionId - * The optional version of function. If not set, default, current version - * is used. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v1.GenerateDownloadUrlResponse|GenerateDownloadUrlResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_functions_service.generate_download_url.js - * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_async - */ - generateDownloadUrl( - request?: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|undefined, {}|undefined - ]>; - generateDownloadUrl( - request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>): void; - generateDownloadUrl( - request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, - callback: Callback< - protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>): void; - generateDownloadUrl( - request?: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|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.generateDownloadUrl(request, options, callback); - } -/** - * Sets the IAM access control policy on the specified function. - * Replaces any existing policy. - * - * @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 protos.google.iam.v1.Policy|Policy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_functions_service.set_iam_policy.js - * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_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 IAM access control policy for a function. - * Returns an empty policy if the function exists and does not have a policy - * set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {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 protos.google.iam.v1.Policy|Policy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_functions_service.get_iam_policy.js - * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_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); - } -/** - * Tests the specified permissions against the IAM access control policy - * for a function. - * If the function does not exist, this returns an empty set of - * permissions, not a NOT_FOUND error. - * - * @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 protos.google.iam.v1.TestIamPermissionsResponse|TestIamPermissionsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_functions_service.test_iam_permissions.js - * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_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); - } - -/** - * Creates a new function. If a function with the given name already exists in - * the specified project, the long running operation returns an - * `ALREADY_EXISTS` error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.location - * Required. The project and location in which the function should be created, - * specified in the format `projects/* /locations/*` - * @param {google.cloud.functions.v1.CloudFunction} request.function - * Required. Function 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_functions_service.create_function.js - * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_async - */ - createFunction( - request?: protos.google.cloud.functions.v1.ICreateFunctionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createFunction( - request: protos.google.cloud.functions.v1.ICreateFunctionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFunction( - request: protos.google.cloud.functions.v1.ICreateFunctionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFunction( - request?: protos.google.cloud.functions.v1.ICreateFunctionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'location': request.location ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFunction(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createFunction()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_functions_service.create_function.js - * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_async - */ - async checkCreateFunctionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFunction, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates existing function. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.functions.v1.CloudFunction} request.function - * Required. New version of the function. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The list of fields in `CloudFunction` that have to be updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_functions_service.update_function.js - * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_async - */ - updateFunction( - request?: protos.google.cloud.functions.v1.IUpdateFunctionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateFunction( - request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFunction( - request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFunction( - request?: protos.google.cloud.functions.v1.IUpdateFunctionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'function.name': request.function!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFunction(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateFunction()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_functions_service.update_function.js - * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_async - */ - async checkUpdateFunctionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFunction, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a function with the given name from the specified project. If the - * given function is used by some trigger, the trigger is updated to - * remove this function. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the function which should be deleted. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_functions_service.delete_function.js - * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async - */ - deleteFunction( - request?: protos.google.cloud.functions.v1.IDeleteFunctionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteFunction( - request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFunction( - request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFunction( - request?: protos.google.cloud.functions.v1.IDeleteFunctionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteFunction(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteFunction()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_functions_service.delete_function.js - * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async - */ - async checkDeleteFunctionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFunction, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Returns a list of functions that belong to the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The project and location from which the function should be listed, - * specified in the format `projects/* /locations/*` - * If you want to list functions in all locations, use "-" in place of a - * location. When listing functions in all locations, if one or more - * location(s) are unreachable, the response will contain functions from all - * reachable locations along with the names of any unreachable locations. - * @param {number} request.pageSize - * Maximum number of functions to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v1.CloudFunction|CloudFunction}. - * 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 `listFunctionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFunctions( - request?: protos.google.cloud.functions.v1.IListFunctionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v1.ICloudFunction[], - protos.google.cloud.functions.v1.IListFunctionsRequest|null, - protos.google.cloud.functions.v1.IListFunctionsResponse - ]>; - listFunctions( - request: protos.google.cloud.functions.v1.IListFunctionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.functions.v1.IListFunctionsRequest, - protos.google.cloud.functions.v1.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v1.ICloudFunction>): void; - listFunctions( - request: protos.google.cloud.functions.v1.IListFunctionsRequest, - callback: PaginationCallback< - protos.google.cloud.functions.v1.IListFunctionsRequest, - protos.google.cloud.functions.v1.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v1.ICloudFunction>): void; - listFunctions( - request?: protos.google.cloud.functions.v1.IListFunctionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.functions.v1.IListFunctionsRequest, - protos.google.cloud.functions.v1.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v1.ICloudFunction>, - callback?: PaginationCallback< - protos.google.cloud.functions.v1.IListFunctionsRequest, - protos.google.cloud.functions.v1.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v1.ICloudFunction>): - Promise<[ - protos.google.cloud.functions.v1.ICloudFunction[], - protos.google.cloud.functions.v1.IListFunctionsRequest|null, - protos.google.cloud.functions.v1.IListFunctionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listFunctions(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 - * The project and location from which the function should be listed, - * specified in the format `projects/* /locations/*` - * If you want to list functions in all locations, use "-" in place of a - * location. When listing functions in all locations, if one or more - * location(s) are unreachable, the response will contain functions from all - * reachable locations along with the names of any unreachable locations. - * @param {number} request.pageSize - * Maximum number of functions to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * @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 protos.google.cloud.functions.v1.CloudFunction|CloudFunction} 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 `listFunctionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFunctionsStream( - request?: protos.google.cloud.functions.v1.IListFunctionsRequest, - 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['listFunctions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFunctions.createStream( - this.innerApiCalls.listFunctions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFunctions`, 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 - * The project and location from which the function should be listed, - * specified in the format `projects/* /locations/*` - * If you want to list functions in all locations, use "-" in place of a - * location. When listing functions in all locations, if one or more - * location(s) are unreachable, the response will contain functions from all - * reachable locations along with the names of any unreachable locations. - * @param {number} request.pageSize - * Maximum number of functions to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.functions.v1.CloudFunction|CloudFunction}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_functions_service.list_functions.js - * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_async - */ - listFunctionsAsync( - request?: protos.google.cloud.functions.v1.IListFunctionsRequest, - 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['listFunctions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFunctions.asyncIterate( - this.innerApiCalls['listFunctions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified cloudFunction resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} functionParam - * @returns {string} Resource name string. - */ - cloudFunctionPath(project:string,location:string,functionParam:string) { - return this.pathTemplates.cloudFunctionPathTemplate.render({ - project: project, - location: location, - function: functionParam, - }); - } - - /** - * Parse the project from CloudFunction resource. - * - * @param {string} cloudFunctionName - * A fully-qualified path representing CloudFunction resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCloudFunctionName(cloudFunctionName: string) { - return this.pathTemplates.cloudFunctionPathTemplate.match(cloudFunctionName).project; - } - - /** - * Parse the location from CloudFunction resource. - * - * @param {string} cloudFunctionName - * A fully-qualified path representing CloudFunction resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCloudFunctionName(cloudFunctionName: string) { - return this.pathTemplates.cloudFunctionPathTemplate.match(cloudFunctionName).location; - } - - /** - * Parse the function from CloudFunction resource. - * - * @param {string} cloudFunctionName - * A fully-qualified path representing CloudFunction resource. - * @returns {string} A string representing the function. - */ - matchFunctionFromCloudFunctionName(cloudFunctionName: string) { - return this.pathTemplates.cloudFunctionPathTemplate.match(cloudFunctionName).function; - } - - /** - * Return a fully-qualified cryptoKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @returns {string} Resource name string. - */ - cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { - return this.pathTemplates.cryptoKeyPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - }); - } - - /** - * Parse the project from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; - } - - /** - * Parse the location from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; - } - - /** - * Parse the key_ring from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; - } - - /** - * Parse the crypto_key from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified repository resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @returns {string} Resource name string. - */ - repositoryPath(project:string,location:string,repository:string) { - return this.pathTemplates.repositoryPathTemplate.render({ - project: project, - location: location, - repository: repository, - }); - } - - /** - * Parse the project from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).project; - } - - /** - * Parse the location from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the location. - */ - matchLocationFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).location; - } - - /** - * Parse the repository from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).repository; - } - - /** - * 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.cloudFunctionsServiceStub && !this._terminated) { - return this.cloudFunctionsServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_client_config.json b/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_client_config.json deleted file mode 100644 index d7b46e523f7..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_client_config.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "interfaces": { - "google.cloud.functions.v1.CloudFunctionsService": { - "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": { - "ListFunctions": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetFunction": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateFunction": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateFunction": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteFunction": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CallFunction": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GenerateUploadUrl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GenerateDownloadUrl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetIamPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIamPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "TestIamPermissions": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_proto_list.json b/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_proto_list.json deleted file mode 100644 index 26c6fb8d3dd..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/src/v1/cloud_functions_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/functions/v1/functions.proto", - "../../protos/google/cloud/functions/v1/operations.proto" -] diff --git a/owl-bot-staging/google-cloud-functions/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-functions/v1/src/v1/gapic_metadata.json deleted file mode 100644 index d48829005cf..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.functions.v1", - "libraryPackage": "@google-cloud/functions", - "services": { - "CloudFunctionsService": { - "clients": { - "grpc": { - "libraryClient": "CloudFunctionsServiceClient", - "rpcs": { - "GetFunction": { - "methods": [ - "getFunction" - ] - }, - "CallFunction": { - "methods": [ - "callFunction" - ] - }, - "GenerateUploadUrl": { - "methods": [ - "generateUploadUrl" - ] - }, - "GenerateDownloadUrl": { - "methods": [ - "generateDownloadUrl" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "CreateFunction": { - "methods": [ - "createFunction" - ] - }, - "UpdateFunction": { - "methods": [ - "updateFunction" - ] - }, - "DeleteFunction": { - "methods": [ - "deleteFunction" - ] - }, - "ListFunctions": { - "methods": [ - "listFunctions", - "listFunctionsStream", - "listFunctionsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "CloudFunctionsServiceClient", - "rpcs": { - "GetFunction": { - "methods": [ - "getFunction" - ] - }, - "CallFunction": { - "methods": [ - "callFunction" - ] - }, - "GenerateUploadUrl": { - "methods": [ - "generateUploadUrl" - ] - }, - "GenerateDownloadUrl": { - "methods": [ - "generateDownloadUrl" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "CreateFunction": { - "methods": [ - "createFunction" - ] - }, - "UpdateFunction": { - "methods": [ - "updateFunction" - ] - }, - "DeleteFunction": { - "methods": [ - "deleteFunction" - ] - }, - "ListFunctions": { - "methods": [ - "listFunctions", - "listFunctionsStream", - "listFunctionsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-functions/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-functions/v1/src/v1/index.ts deleted file mode 100644 index 5eca92cc0d7..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/src/v1/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 {CloudFunctionsServiceClient} from './cloud_functions_service_client'; diff --git a/owl-bot-staging/google-cloud-functions/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-functions/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 5fe0f8cfa53..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/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 functions = require('@google-cloud/functions'); - -function main() { - const cloudFunctionsServiceClient = new functions.CloudFunctionsServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-functions/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-functions/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index a300aff6476..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/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 {CloudFunctionsServiceClient} from '@google-cloud/functions'; - -// check that the client class type name can be used -function doStuffWithCloudFunctionsServiceClient(client: CloudFunctionsServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - doStuffWithCloudFunctionsServiceClient(cloudFunctionsServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-functions/v1/system-test/install.ts b/owl-bot-staging/google-cloud-functions/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-functions/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-functions/v1/test/gapic_cloud_functions_service_v1.ts b/owl-bot-staging/google-cloud-functions/v1/test/gapic_cloud_functions_service_v1.ts deleted file mode 100644 index f8d2faaeb6c..00000000000 --- a/owl-bot-staging/google-cloud-functions/v1/test/gapic_cloud_functions_service_v1.ts +++ /dev/null @@ -1,2288 +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 cloudfunctionsserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.CloudFunctionsServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudFunctionsServiceStub, undefined); - await client.initialize(); - assert(client.cloudFunctionsServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.cloudFunctionsServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudFunctionsServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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('getFunction', () => { - it('invokes getFunction without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.GetFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.GetFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v1.CloudFunction() - ); - client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); - const [response] = await client.getFunction(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFunction without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.GetFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.GetFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v1.CloudFunction() - ); - client.innerApiCalls.getFunction = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFunction( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v1.ICloudFunction|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFunction with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.GetFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.GetFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFunction = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFunction(request), expectedError); - const actualRequest = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFunction with closed client', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.GetFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.GetFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFunction(request), expectedError); - }); - }); - - describe('callFunction', () => { - it('invokes callFunction without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.CallFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.CallFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v1.CallFunctionResponse() - ); - client.innerApiCalls.callFunction = stubSimpleCall(expectedResponse); - const [response] = await client.callFunction(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.callFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.callFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes callFunction without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.CallFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.CallFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v1.CallFunctionResponse() - ); - client.innerApiCalls.callFunction = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.callFunction( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v1.ICallFunctionResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.callFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.callFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes callFunction with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.CallFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.CallFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.callFunction = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.callFunction(request), expectedError); - const actualRequest = (client.innerApiCalls.callFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.callFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes callFunction with closed client', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.CallFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.CallFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.callFunction(request), expectedError); - }); - }); - - describe('generateUploadUrl', () => { - it('invokes generateUploadUrl without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.GenerateUploadUrlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v1.GenerateUploadUrlResponse() - ); - client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); - const [response] = await client.generateUploadUrl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateUploadUrl without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.GenerateUploadUrlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v1.GenerateUploadUrlResponse() - ); - client.innerApiCalls.generateUploadUrl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateUploadUrl( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v1.IGenerateUploadUrlResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateUploadUrl with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.GenerateUploadUrlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateUploadUrl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateUploadUrl(request), expectedError); - const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateUploadUrl with closed client', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.GenerateUploadUrlRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateUploadUrl(request), expectedError); - }); - }); - - describe('generateDownloadUrl', () => { - it('invokes generateDownloadUrl without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.GenerateDownloadUrlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v1.GenerateDownloadUrlResponse() - ); - client.innerApiCalls.generateDownloadUrl = stubSimpleCall(expectedResponse); - const [response] = await client.generateDownloadUrl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateDownloadUrl without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.GenerateDownloadUrlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v1.GenerateDownloadUrlResponse() - ); - client.innerApiCalls.generateDownloadUrl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateDownloadUrl( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateDownloadUrl with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.GenerateDownloadUrlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateDownloadUrl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateDownloadUrl(request), expectedError); - const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateDownloadUrl with closed client', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.GenerateDownloadUrlRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateDownloadUrl(request), expectedError); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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('createFunction', () => { - it('invokes createFunction without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.CreateFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.CreateFunctionRequest', ['location']); - request.location = defaultValue1; - const expectedHeaderRequestParams = `location=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFunction = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFunction(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFunction without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.CreateFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.CreateFunctionRequest', ['location']); - request.location = defaultValue1; - const expectedHeaderRequestParams = `location=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFunction = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFunction( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFunction with call error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.CreateFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.CreateFunctionRequest', ['location']); - request.location = defaultValue1; - const expectedHeaderRequestParams = `location=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFunction = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFunction(request), expectedError); - const actualRequest = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFunction with LRO error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.CreateFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.CreateFunctionRequest', ['location']); - request.location = defaultValue1; - const expectedHeaderRequestParams = `location=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFunction = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFunction(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateFunctionProgress without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateFunctionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateFunctionProgress with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFunctionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateFunction', () => { - it('invokes updateFunction without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.UpdateFunctionRequest() - ); - request.function ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.UpdateFunctionRequest', ['function', 'name']); - request.function.name = defaultValue1; - const expectedHeaderRequestParams = `function.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFunction = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFunction(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFunction without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.UpdateFunctionRequest() - ); - request.function ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.UpdateFunctionRequest', ['function', 'name']); - request.function.name = defaultValue1; - const expectedHeaderRequestParams = `function.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFunction = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFunction( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFunction with call error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.UpdateFunctionRequest() - ); - request.function ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.UpdateFunctionRequest', ['function', 'name']); - request.function.name = defaultValue1; - const expectedHeaderRequestParams = `function.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFunction(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFunction with LRO error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.UpdateFunctionRequest() - ); - request.function ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.UpdateFunctionRequest', ['function', 'name']); - request.function.name = defaultValue1; - const expectedHeaderRequestParams = `function.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFunction(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateFunctionProgress without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateFunctionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateFunctionProgress with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFunctionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteFunction', () => { - it('invokes deleteFunction without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.DeleteFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.DeleteFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFunction = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFunction(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFunction without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.DeleteFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.DeleteFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFunction = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFunction( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFunction with call error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.DeleteFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.DeleteFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFunction(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFunction with LRO error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.DeleteFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.DeleteFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFunction(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteFunctionProgress without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteFunctionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteFunctionProgress with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFunctionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listFunctions', () => { - it('invokes listFunctions without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - ]; - client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); - const [response] = await client.listFunctions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFunctions without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - ]; - client.innerApiCalls.listFunctions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFunctions( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v1.ICloudFunction[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFunctions with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFunctions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFunctions(request), expectedError); - const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFunctionsStream without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - ]; - client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFunctionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.functions.v1.CloudFunction[] = []; - stream.on('data', (response: protos.google.cloud.functions.v1.CloudFunction) => { - 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.listFunctions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); - assert( - (client.descriptors.page.listFunctions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFunctionsStream with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFunctionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.functions.v1.CloudFunction[] = []; - stream.on('data', (response: protos.google.cloud.functions.v1.CloudFunction) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFunctions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); - assert( - (client.descriptors.page.listFunctions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFunctions without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - ]; - client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.functions.v1.ICloudFunction[] = []; - const iterable = client.listFunctionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFunctions with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v1.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v1.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFunctionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.functions.v1.ICloudFunction[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('cloudFunction', () => { - const fakePath = "/rendered/path/cloudFunction"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - function: "functionValue", - }; - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.cloudFunctionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cloudFunctionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cloudFunctionPath', () => { - const result = client.cloudFunctionPath("projectValue", "locationValue", "functionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cloudFunctionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCloudFunctionName', () => { - const result = client.matchProjectFromCloudFunctionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cloudFunctionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCloudFunctionName', () => { - const result = client.matchLocationFromCloudFunctionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cloudFunctionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFunctionFromCloudFunctionName', () => { - const result = client.matchFunctionFromCloudFunctionName(fakePath); - assert.strictEqual(result, "functionValue"); - assert((client.pathTemplates.cloudFunctionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('cryptoKey', () => { - const fakePath = "/rendered/path/cryptoKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - }; - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.cryptoKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cryptoKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cryptoKeyPath', () => { - const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCryptoKeyName', () => { - const result = client.matchProjectFromCryptoKeyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCryptoKeyName', () => { - const result = client.matchLocationFromCryptoKeyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromCryptoKeyName', () => { - const result = client.matchKeyRingFromCryptoKeyName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromCryptoKeyName', () => { - const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('repository', () => { - const fakePath = "/rendered/path/repository"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - }; - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.repositoryPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.repositoryPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('repositoryPath', () => { - const result = client.repositoryPath("projectValue", "locationValue", "repositoryValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.repositoryPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRepositoryName', () => { - const result = client.matchProjectFromRepositoryName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromRepositoryName', () => { - const result = client.matchLocationFromRepositoryName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromRepositoryName', () => { - const result = client.matchRepositoryFromRepositoryName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-functions/v1/tsconfig.json b/owl-bot-staging/google-cloud-functions/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-functions/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-functions/v1/webpack.config.js b/owl-bot-staging/google-cloud-functions/v1/webpack.config.js deleted file mode 100644 index 115d8297e02..00000000000 --- a/owl-bot-staging/google-cloud-functions/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: 'CloudFunctionsService', - filename: './cloud-functions-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-functions/v2/.eslintignore b/owl-bot-staging/google-cloud-functions/v2/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/.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-functions/v2/.eslintrc.json b/owl-bot-staging/google-cloud-functions/v2/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-functions/v2/.gitignore b/owl-bot-staging/google-cloud-functions/v2/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/.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-functions/v2/.jsdoc.js b/owl-bot-staging/google-cloud-functions/v2/.jsdoc.js deleted file mode 100644 index 43186156cf8..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/.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/functions', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-functions/v2/.mocharc.js b/owl-bot-staging/google-cloud-functions/v2/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/.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-functions/v2/.prettierrc.js b/owl-bot-staging/google-cloud-functions/v2/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/.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-functions/v2/README.md b/owl-bot-staging/google-cloud-functions/v2/README.md deleted file mode 100644 index efb614cf6e7..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/README.md +++ /dev/null @@ -1 +0,0 @@ -Functions: Nodejs Client diff --git a/owl-bot-staging/google-cloud-functions/v2/package.json b/owl-bot-staging/google-cloud-functions/v2/package.json deleted file mode 100644 index a5e7b166e52..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/functions", - "version": "0.1.0", - "description": "Functions client for Node.js", - "repository": "googleapis/nodejs-functions", - "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 functions", - "functions", - "function service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-functions/v2/protos/google/cloud/functions/v2/functions.proto b/owl-bot-staging/google-cloud-functions/v2/protos/google/cloud/functions/v2/functions.proto deleted file mode 100644 index ae0cdc1ef22..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/protos/google/cloud/functions/v2/functions.proto +++ /dev/null @@ -1,1147 +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 -// -// 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.functions.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/functions/apiv2/functionspb;functionspb"; -option java_multiple_files = true; -option java_outer_classname = "FunctionsProto"; -option java_package = "com.google.cloud.functions.v2"; -option objc_class_prefix = "GCF"; -option (google.api.resource_definition) = { - type: "artifactregistry.googleapis.com/Repository" - pattern: "projects/{project}/locations/{location}/repositories/{repository}" -}; -option (google.api.resource_definition) = { - type: "cloudbuild.googleapis.com/Build" - pattern: "projects/{project}/locations/{location}/builds/{build}" -}; -option (google.api.resource_definition) = { - type: "cloudbuild.googleapis.com/WorkerPool" - pattern: "projects/{project}/locations/{location}/workerPools/{worker_pool}" -}; -option (google.api.resource_definition) = { - type: "run.googleapis.com/Service" - pattern: "projects/{project}/locations/{location}/services/{service}" -}; -option (google.api.resource_definition) = { - type: "vpcaccess.googleapis.com/Connector" - pattern: "projects/{project}/locations/{location}/connectors/{connector}" -}; -option (google.api.resource_definition) = { - type: "eventarc.googleapis.com/Trigger" - pattern: "projects/{project}/locations/{location}/triggers/{trigger}" -}; -option (google.api.resource_definition) = { - type: "eventarc.googleapis.com/Channel" - pattern: "projects/{project}/locations/{location}/channels/{channel}" -}; -option (google.api.resource_definition) = { - type: "pubsub.googleapis.com/Topic" - pattern: "projects/{project}/topics/{topic}" -}; -option (google.api.resource_definition) = { - type: "cloudkms.googleapis.com/CryptoKey" - pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" -}; - -// Google Cloud Functions is used to deploy functions that are executed by -// Google in response to various events. Data connected with that event is -// passed to a function as the input data. -// -// A **function** is a resource which describes a function that should be -// executed and how it is triggered. -service FunctionService { - option (google.api.default_host) = "cloudfunctions.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Returns a function with the given name from the requested project. - rpc GetFunction(GetFunctionRequest) returns (Function) { - option (google.api.http) = { - get: "/v2/{name=projects/*/locations/*/functions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns a list of functions that belong to the requested project. - rpc ListFunctions(ListFunctionsRequest) returns (ListFunctionsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/locations/*}/functions" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a new function. If a function with the given name already exists in - // the specified project, the long running operation will return - // `ALREADY_EXISTS` error. - rpc CreateFunction(CreateFunctionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/locations/*}/functions" - body: "function" - }; - option (google.api.method_signature) = "parent,function,function_id"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.functions.v2.Function" - metadata_type: "google.cloud.functions.v2.OperationMetadata" - }; - } - - // Updates existing function. - rpc UpdateFunction(UpdateFunctionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v2/{function.name=projects/*/locations/*/functions/*}" - body: "function" - }; - option (google.api.method_signature) = "function,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.functions.v2.Function" - metadata_type: "google.cloud.functions.v2.OperationMetadata" - }; - } - - // Deletes a function with the given name from the specified project. If the - // given function is used by some trigger, the trigger will be updated to - // remove this function. - rpc DeleteFunction(DeleteFunctionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/locations/*/functions/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.functions.v2.OperationMetadata" - }; - } - - // Returns a signed URL for uploading a function source code. - // For more information about the signed URL usage see: - // https://cloud.google.com/storage/docs/access-control/signed-urls. - // Once the function source code upload is complete, the used signed - // URL should be provided in CreateFunction or UpdateFunction request - // as a reference to the function source code. - // - // When uploading source code to the generated signed URL, please follow - // these restrictions: - // - // * Source file type should be a zip file. - // * No credentials should be attached - the signed URLs provide access to the - // target bucket using internal service identity; if credentials were - // attached, the identity from the credentials would be used, but that - // identity does not have permissions to upload files to the URL. - // - // When making a HTTP PUT request, these two headers need to be specified: - // - // * `content-type: application/zip` - // - // And this header SHOULD NOT be specified: - // - // * `Authorization: Bearer YOUR_TOKEN` - rpc GenerateUploadUrl(GenerateUploadUrlRequest) - returns (GenerateUploadUrlResponse) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/locations/*}/functions:generateUploadUrl" - body: "*" - }; - } - - // Returns a signed URL for downloading deployed function source code. - // The URL is only valid for a limited period and should be used within - // 30 minutes of generation. - // For more information about the signed URL usage see: - // https://cloud.google.com/storage/docs/access-control/signed-urls - rpc GenerateDownloadUrl(GenerateDownloadUrlRequest) - returns (GenerateDownloadUrlResponse) { - option (google.api.http) = { - post: "/v2/{name=projects/*/locations/*/functions/*}:generateDownloadUrl" - body: "*" - }; - } - - // Returns a list of runtimes that are supported for the requested project. - rpc ListRuntimes(ListRuntimesRequest) returns (ListRuntimesResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/locations/*}/runtimes" - }; - option (google.api.method_signature) = "parent"; - } -} - -// The environment the function is hosted on. -enum Environment { - // Unspecified - ENVIRONMENT_UNSPECIFIED = 0; - - // Gen 1 - GEN_1 = 1; - - // Gen 2 - GEN_2 = 2; -} - -// Describes a Cloud Function that contains user computation executed in -// response to an event. It encapsulates function and trigger configurations. -message Function { - option (google.api.resource) = { - type: "cloudfunctions.googleapis.com/Function" - pattern: "projects/{project}/locations/{location}/functions/{function}" - plural: "functions" - singular: "function" - }; - - // Describes the current state of the function. - enum State { - // Not specified. Invalid state. - STATE_UNSPECIFIED = 0; - - // Function has been successfully deployed and is serving. - ACTIVE = 1; - - // Function deployment failed and the function is not serving. - FAILED = 2; - - // Function is being created or updated. - DEPLOYING = 3; - - // Function is being deleted. - DELETING = 4; - - // Function deployment failed and the function serving state is undefined. - // The function should be updated or deleted to move it out of this state. - UNKNOWN = 5; - } - - // A user-defined name of the function. Function names must be unique - // globally and match pattern `projects/*/locations/*/functions/*` - string name = 1; - - // User-provided description of a function. - string description = 2; - - // Describes the Build step of the function that builds a container from the - // given source. - BuildConfig build_config = 3; - - // Describes the Service being deployed. Currently deploys services to Cloud - // Run (fully managed). - ServiceConfig service_config = 4; - - // An Eventarc trigger managed by Google Cloud Functions that fires events in - // response to a condition in another service. - EventTrigger event_trigger = 5; - - // Output only. State of the function. - State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of a Cloud Function. - google.protobuf.Timestamp update_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels associated with this Cloud Function. - map labels = 8; - - // Output only. State Messages for this Cloud Function. - repeated StateMessage state_messages = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Describe whether the function is 1st Gen or 2nd Gen. - Environment environment = 10; - - // Output only. The deployed url for the function. - string url = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // [Preview] Resource name of a KMS crypto key (managed by the user) used to - // encrypt/decrypt function resources. - // - // It must match the pattern - // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - string kms_key_name = 25 [(google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - }]; -} - -// Informational messages about the state of the Cloud Function or Operation. -message StateMessage { - // Severity of the state message. - enum Severity { - // Not specified. Invalid severity. - SEVERITY_UNSPECIFIED = 0; - - // ERROR-level severity. - ERROR = 1; - - // WARNING-level severity. - WARNING = 2; - - // INFO-level severity. - INFO = 3; - } - - // Severity of the state message. - Severity severity = 1; - - // One-word CamelCase type of the state message. - string type = 2; - - // The message. - string message = 3; -} - -// Location of the source in an archive file in Google Cloud Storage. -message StorageSource { - // Google Cloud Storage bucket containing the source (see - // [Bucket Name - // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - string bucket = 1; - - // Google Cloud Storage object containing the source. - // - // This object must be a gzipped archive file (`.tar.gz`) containing source to - // build. - string object = 2; - - // Google Cloud Storage generation for the object. If the generation is - // omitted, the latest generation will be used. - int64 generation = 3; -} - -// Location of the source in a Google Cloud Source Repository. -message RepoSource { - // A revision within the Cloud Source Repository must be specified in - // one of these ways. - oneof revision { - // Regex matching branches to build. - // - // The syntax of the regular expressions accepted is the syntax accepted by - // RE2 and described at https://github.com/google/re2/wiki/Syntax - string branch_name = 3; - - // Regex matching tags to build. - // - // The syntax of the regular expressions accepted is the syntax accepted by - // RE2 and described at https://github.com/google/re2/wiki/Syntax - string tag_name = 4; - - // Explicit commit SHA to build. - string commit_sha = 5; - } - - // ID of the project that owns the Cloud Source Repository. If omitted, the - // project ID requesting the build is assumed. - string project_id = 1; - - // Name of the Cloud Source Repository. - string repo_name = 2; - - // Directory, relative to the source root, in which to run the build. - // - // This must be a relative path. If a step's `dir` is specified and is an - // absolute path, this value is ignored for that step's execution. - // eg. helloworld (no leading slash allowed) - string dir = 6; - - // Only trigger a build if the revision regex does NOT match the revision - // regex. - bool invert_regex = 7; -} - -// The location of the function source code. -message Source { - // Location of the source. - // At least one source needs to be provided for the deployment to succeed. - oneof source { - // If provided, get the source from this location in Google Cloud Storage. - StorageSource storage_source = 1; - - // If provided, get the source from this location in a Cloud Source - // Repository. - RepoSource repo_source = 2; - } -} - -// Provenance of the source. Ways to find the original source, or verify that -// some source was used for this build. -message SourceProvenance { - // A copy of the build's `source.storage_source`, if exists, with any - // generations resolved. - StorageSource resolved_storage_source = 1; - - // A copy of the build's `source.repo_source`, if exists, with any - // revisions resolved. - RepoSource resolved_repo_source = 2; -} - -// Describes the Build step of the function that builds a container from the -// given source. -message BuildConfig { - // Docker Registry to use for storing function Docker images. - enum DockerRegistry { - // Unspecified. - DOCKER_REGISTRY_UNSPECIFIED = 0; - - // Docker images will be stored in multi-regional Container Registry - // repositories named `gcf`. - CONTAINER_REGISTRY = 1; - - // Docker images will be stored in regional Artifact Registry repositories. - // By default, GCF will create and use repositories named `gcf-artifacts` - // in every region in which a function is deployed. But the repository to - // use can also be specified by the user using the `docker_repository` - // field. - ARTIFACT_REGISTRY = 2; - } - - // Output only. The Cloud Build name of the latest successful deployment of - // the function. - string build = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Build" - } - ]; - - // The runtime in which to run the function. Required when deploying a new - // function, optional when updating an existing function. For a complete - // list of possible choices, see the - // [`gcloud` command - // reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - string runtime = 2; - - // The name of the function (as defined in source code) that will be - // executed. Defaults to the resource name suffix, if not specified. For - // backward compatibility, if function with given name is not found, then the - // system will try to use function named "function". - // For Node.js this is name of a function exported by the module specified - // in `source_location`. - string entry_point = 3; - - // The location of the function source code. - Source source = 4; - - // Output only. A permanent fixed identifier for source. - SourceProvenance source_provenance = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Name of the Cloud Build Custom Worker Pool that should be used to build the - // function. The format of this field is - // `projects/{project}/locations/{region}/workerPools/{workerPool}` where - // {project} and {region} are the project id and region respectively where the - // worker pool is defined and {workerPool} is the short name of the worker - // pool. - // - // If the project id is not the same as the function, then the Cloud - // Functions Service Agent - // (service-@gcf-admin-robot.iam.gserviceaccount.com) must be - // granted the role Cloud Build Custom Workers Builder - // (roles/cloudbuild.customworkers.builder) in the project. - string worker_pool = 5 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - }]; - - // User-provided build-time environment variables for the function - map environment_variables = 6; - - // Docker Registry to use for this deployment. This configuration is only - // applicable to 1st Gen functions, 2nd Gen functions can only use Artifact - // Registry. - // - // If `docker_repository` field is specified, this field will be automatically - // set as `ARTIFACT_REGISTRY`. - // If unspecified, it currently defaults to `CONTAINER_REGISTRY`. - // This field may be overridden by the backend for eligible deployments. - DockerRegistry docker_registry = 10; - - // User managed repository created in Artifact Registry optionally - // with a customer managed encryption key. This is the repository to which the - // function docker image will be pushed after it is built by Cloud Build. - // If unspecified, GCF will create and use a repository named 'gcf-artifacts' - // for every deployed region. - // - // It must match the pattern - // `projects/{project}/locations/{location}/repositories/{repository}`. - // - // Cross-project repositories are not supported. - // Cross-location repositories are not supported. - // Repository format must be 'DOCKER'. - string docker_repository = 7 [(google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/Repository" - }]; -} - -// Describes the Service being deployed. -// Currently Supported : Cloud Run (fully managed). -message ServiceConfig { - // Available egress settings. - // - // This controls what traffic is diverted through the VPC Access Connector - // resource. By default PRIVATE_RANGES_ONLY will be used. - enum VpcConnectorEgressSettings { - // Unspecified. - VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; - - // Use the VPC Access Connector only for private IP space from RFC1918. - PRIVATE_RANGES_ONLY = 1; - - // Force the use of VPC Access Connector for all egress traffic from the - // function. - ALL_TRAFFIC = 2; - } - - // Available ingress settings. - // - // This controls what traffic can reach the function. - // - // If unspecified, ALLOW_ALL will be used. - enum IngressSettings { - // Unspecified. - INGRESS_SETTINGS_UNSPECIFIED = 0; - - // Allow HTTP traffic from public and private sources. - ALLOW_ALL = 1; - - // Allow HTTP traffic from only private VPC sources. - ALLOW_INTERNAL_ONLY = 2; - - // Allow HTTP traffic from private VPC sources and through GCLB. - ALLOW_INTERNAL_AND_GCLB = 3; - } - - // Available security level settings. - // - // This enforces security protocol on function URL. - // - // Security level is only configurable for 1st Gen functions, If unspecified, - // SECURE_OPTIONAL will be used. 2nd Gen functions are SECURE_ALWAYS ONLY. - enum SecurityLevel { - // Unspecified. - SECURITY_LEVEL_UNSPECIFIED = 0; - - // Requests for a URL that match this handler that do not use HTTPS are - // automatically redirected to the HTTPS URL with the same path. Query - // parameters are reserved for the redirect. - SECURE_ALWAYS = 1; - - // Both HTTP and HTTPS requests with URLs that match the handler succeed - // without redirects. The application can examine the request to determine - // which protocol was used and respond accordingly. - SECURE_OPTIONAL = 2; - } - - // Output only. Name of the service associated with a Function. - // The format of this field is - // `projects/{project}/locations/{region}/services/{service}` - string service = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { type: "run.googleapis.com/Service" } - ]; - - // The function execution timeout. Execution is considered failed and - // can be terminated if the function is not completed at the end of the - // timeout period. Defaults to 60 seconds. - int32 timeout_seconds = 2; - - // The amount of memory available for a function. - // Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is - // supplied the value is interpreted as bytes. - // See - // https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go - // a full description. - string available_memory = 13; - - // [Preview] The number of CPUs used in a single container instance. - // Default value is calculated from available memory. - // Supports the same values as Cloud Run, see - // https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements - // Example: "1" indicates 1 vCPU - string available_cpu = 22; - - // Environment variables that shall be available during function execution. - map environment_variables = 4; - - // The limit on the maximum number of function instances that may coexist at a - // given time. - // - // In some cases, such as rapid traffic surges, Cloud Functions may, for a - // short period of time, create more instances than the specified max - // instances limit. If your function cannot tolerate this temporary behavior, - // you may want to factor in a safety margin and set a lower max instances - // value than your function can tolerate. - // - // See the [Max - // Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - // more details. - int32 max_instance_count = 5; - - // The limit on the minimum number of function instances that may coexist at a - // given time. - // - // Function instances are kept in idle state for a short period after they - // finished executing the request to reduce cold start time for subsequent - // requests. Setting a minimum instance count will ensure that the given - // number of instances are kept running in idle state always. This can help - // with cold start times when jump in incoming request count occurs after the - // idle instance would have been stopped in the default case. - int32 min_instance_count = 12; - - // The Serverless VPC Access connector that this cloud function can connect - // to. The format of this field is `projects/*/locations/*/connectors/*`. - string vpc_connector = 6 [(google.api.resource_reference) = { - type: "vpcaccess.googleapis.com/Connector" - }]; - - // The egress settings for the connector, controlling what traffic is diverted - // through it. - VpcConnectorEgressSettings vpc_connector_egress_settings = 7; - - // The ingress settings for the function, controlling what traffic can reach - // it. - IngressSettings ingress_settings = 8; - - // Output only. URI of the Service deployed. - string uri = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The email of the service's service account. If empty, defaults to - // `{project_number}-compute@developer.gserviceaccount.com`. - string service_account_email = 10; - - // Whether 100% of traffic is routed to the latest revision. - // On CreateFunction and UpdateFunction, when set to true, the revision being - // deployed will serve 100% of traffic, ignoring any traffic split settings, - // if any. On GetFunction, true will be returned if the latest revision is - // serving 100% of traffic. - bool all_traffic_on_latest_revision = 16; - - // Secret environment variables configuration. - repeated SecretEnvVar secret_environment_variables = 17; - - // Secret volumes configuration. - repeated SecretVolume secret_volumes = 19; - - // Output only. The name of service revision. - string revision = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // [Preview] Sets the maximum number of concurrent requests that each instance - // can receive. Defaults to 1. - int32 max_instance_request_concurrency = 20; - - // Security level configure whether the function only accepts https. - // This configuration is only applicable to 1st Gen functions with Http - // trigger. By default https is optional for 1st Gen functions; 2nd Gen - // functions are https ONLY. - SecurityLevel security_level = 21; -} - -// Configuration for a secret environment variable. It has the information -// necessary to fetch the secret value from secret manager and expose it as an -// environment variable. -message SecretEnvVar { - // Name of the environment variable. - string key = 1; - - // Project identifier (preferably project number but can also be the - // project ID) of the project that contains the secret. If not set, it is - // assumed that the secret is in the same project as the function. - string project_id = 2; - - // Name of the secret in secret manager (not the full resource name). - string secret = 3; - - // Version of the secret (version number or the string 'latest'). It is - // recommended to use a numeric version for secret environment variables as - // any updates to the secret value is not reflected until new instances - // start. - string version = 4; -} - -// Configuration for a secret volume. It has the information necessary to fetch -// the secret value from secret manager and make it available as files mounted -// at the requested paths within the application container. -message SecretVolume { - // Configuration for a single version. - message SecretVersion { - // Version of the secret (version number or the string 'latest'). It is - // preferable to use `latest` version with secret volumes as secret value - // changes are reflected immediately. - string version = 1; - - // Relative path of the file under the mount path where the secret value for - // this version will be fetched and made available. For example, setting the - // mount_path as '/etc/secrets' and path as `secret_foo` would mount the - // secret value file at `/etc/secrets/secret_foo`. - string path = 2; - } - - // The path within the container to mount the secret volume. For example, - // setting the mount_path as `/etc/secrets` would mount the secret value files - // under the `/etc/secrets` directory. This directory will also be completely - // shadowed and unavailable to mount any other secrets. - // Recommended mount path: /etc/secrets - string mount_path = 1; - - // Project identifier (preferably project number but can also be the project - // ID) of the project that contains the secret. If not set, it is - // assumed that the secret is in the same project as the function. - string project_id = 2; - - // Name of the secret in secret manager (not the full resource name). - string secret = 3; - - // List of secret versions to mount for this secret. If empty, the `latest` - // version of the secret will be made available in a file named after the - // secret under the mount point. - repeated SecretVersion versions = 4; -} - -// Describes EventTrigger, used to request events to be sent from another -// service. -message EventTrigger { - // Describes the retry policy in case of function's execution failure. - // Retried execution is charged as any other execution. - enum RetryPolicy { - // Not specified. - RETRY_POLICY_UNSPECIFIED = 0; - - // Do not retry. - RETRY_POLICY_DO_NOT_RETRY = 1; - - // Retry on any failure, retry up to 7 days with an exponential backoff - // (capped at 10 seconds). - RETRY_POLICY_RETRY = 2; - } - - // Output only. The resource name of the Eventarc trigger. The format of this - // field is `projects/{project}/locations/{region}/triggers/{trigger}`. - string trigger = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "eventarc.googleapis.com/Trigger" - } - ]; - - // The region that the trigger will be in. The trigger will only receive - // events originating in this region. It can be the same - // region as the function, a different region or multi-region, or the global - // region. If not provided, defaults to the same region as the function. - string trigger_region = 2; - - // Required. The type of event to observe. For example: - // `google.cloud.audit.log.v1.written` or - // `google.cloud.pubsub.topic.v1.messagePublished`. - string event_type = 3 [(google.api.field_behavior) = REQUIRED]; - - // Criteria used to filter events. - repeated EventFilter event_filters = 4; - - // Optional. The name of a Pub/Sub topic in the same project that will be used - // as the transport topic for the event delivery. Format: - // `projects/{project}/topics/{topic}`. - // - // This is only valid for events of type - // `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here - // will not be deleted at function deletion. - string pubsub_topic = 5 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // Optional. The email of the trigger's service account. The service account - // must have permission to invoke Cloud Run services, the permission is - // `run.routes.invoke`. - // If empty, defaults to the Compute Engine default service account: - // `{project_number}-compute@developer.gserviceaccount.com`. - string service_account_email = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If unset, then defaults to ignoring failures (i.e. not retrying - // them). - RetryPolicy retry_policy = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The name of the channel associated with the trigger in - // `projects/{project}/locations/{location}/channels/{channel}` format. - // You must provide a channel to receive events from Eventarc SaaS partners. - string channel = 8 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - type: "eventarc.googleapis.com/Channel" - } - ]; -} - -// Filters events based on exact matches on the CloudEvents attributes. -message EventFilter { - // Required. The name of a CloudEvents attribute. - string attribute = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The value for the attribute. - string value = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The operator used for matching the events with the value of the - // filter. If not specified, only events that have an exact key-value pair - // specified in the filter are matched. The only allowed value is - // `match-path-pattern`. - string operator = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for the `GetFunction` method. -message GetFunctionRequest { - // Required. The name of the function which details should be obtained. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudfunctions.googleapis.com/Function" - } - ]; -} - -// Request for the `ListFunctions` method. -message ListFunctionsRequest { - // Required. The project and location from which the function should be - // listed, specified in the format `projects/*/locations/*` If you want to - // list functions in all locations, use "-" in place of a location. When - // listing functions in all locations, if one or more location(s) are - // unreachable, the response will contain functions from all reachable - // locations along with the names of any unreachable locations. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudfunctions.googleapis.com/Function" - } - ]; - - // Maximum number of functions to return per call. The largest allowed - // page_size is 1,000, if the page_size is omitted or specified as greater - // than 1,000 then it will be replaced as 1,000. The size of the list - // response can be less than specified when used with filters. - int32 page_size = 2; - - // The value returned by the last - // `ListFunctionsResponse`; indicates that - // this is a continuation of a prior `ListFunctions` call, and that the - // system should return the next page of data. - string page_token = 3; - - // The filter for Functions that match the filter expression, - // following the syntax outlined in https://google.aip.dev/160. - string filter = 4; - - // The sorting order of the resources returned. Value should be a comma - // separated list of fields. The default sorting oder is ascending. - // See https://google.aip.dev/132#ordering. - string order_by = 5; -} - -// Response for the `ListFunctions` method. -message ListFunctionsResponse { - // The functions that match the request. - repeated Function functions = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. The response does not include any - // functions from these locations. - repeated string unreachable = 3; -} - -// Request for the `CreateFunction` method. -message CreateFunctionRequest { - // Required. The project and location in which the function should be created, - // specified in the format `projects/*/locations/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. Function to be created. - Function function = 2 [(google.api.field_behavior) = REQUIRED]; - - // The ID to use for the function, which will become the final component of - // the function's resource name. - // - // This value should be 4-63 characters, and valid characters - // are /[a-z][0-9]-/. - string function_id = 3; -} - -// Request for the `UpdateFunction` method. -message UpdateFunctionRequest { - // Required. New version of the function. - Function function = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. - // If no field mask is provided, all provided fields in the request will be - // updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request for the `DeleteFunction` method. -message DeleteFunctionRequest { - // Required. The name of the function which should be deleted. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudfunctions.googleapis.com/Function" - } - ]; -} - -// Request of `GenerateSourceUploadUrl` method. -message GenerateUploadUrlRequest { - // Required. The project and location in which the Google Cloud Storage signed - // URL should be generated, specified in the format `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // [Preview] Resource name of a KMS crypto key (managed by the user) used to - // encrypt/decrypt function source code objects in intermediate Cloud Storage - // buckets. When you generate an upload url and upload your source code, it - // gets copied to an intermediate Cloud Storage bucket. The source code is - // then copied to a versioned directory in the sources bucket in the consumer - // project during the function deployment. - // - // It must match the pattern - // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - // - // The Google Cloud Functions service account - // (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - // granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - // (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - // Key/KeyRing/Project/Organization (least access preferred). - string kms_key_name = 2 [(google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - }]; -} - -// Response of `GenerateSourceUploadUrl` method. -message GenerateUploadUrlResponse { - // The generated Google Cloud Storage signed URL that should be used for a - // function source code upload. The uploaded file should be a zip archive - // which contains a function. - string upload_url = 1; - - // The location of the source code in the upload bucket. - // - // Once the archive is uploaded using the `upload_url` use this field to - // set the `function.build_config.source.storage_source` - // during CreateFunction and UpdateFunction. - // - // Generation defaults to 0, as Cloud Storage provides a new generation only - // upon uploading a new object or version of an object. - StorageSource storage_source = 2; -} - -// Request of `GenerateDownloadUrl` method. -message GenerateDownloadUrlRequest { - // Required. The name of function for which source code Google Cloud Storage - // signed URL should be generated. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudfunctions.googleapis.com/Function" - } - ]; -} - -// Response of `GenerateDownloadUrl` method. -message GenerateDownloadUrlResponse { - // The generated Google Cloud Storage signed URL that should be used for - // function source code download. - string download_url = 1; -} - -// Request for the `ListRuntimes` method. -message ListRuntimesRequest { - // Required. The project and location from which the runtimes should be - // listed, specified in the format `projects/*/locations/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The filter for Runtimes that match the filter expression, - // following the syntax outlined in https://google.aip.dev/160. - string filter = 2; -} - -// Response for the `ListRuntimes` method. -message ListRuntimesResponse { - // Describes a runtime and any special information (e.g., deprecation status) - // related to it. - message Runtime { - // The name of the runtime, e.g., 'go113', 'nodejs12', etc. - string name = 1; - - // The user facing name, eg 'Go 1.13', 'Node.js 12', etc. - string display_name = 5; - - // The stage of life this runtime is in, e.g., BETA, GA, etc. - RuntimeStage stage = 2; - - // Warning messages, e.g., a deprecation warning. - repeated string warnings = 3; - - // The environment for the runtime. - Environment environment = 4; - } - - // The various stages that a runtime can be in. - enum RuntimeStage { - // Not specified. - RUNTIME_STAGE_UNSPECIFIED = 0; - - // The runtime is in development. - DEVELOPMENT = 1; - - // The runtime is in the Alpha stage. - ALPHA = 2; - - // The runtime is in the Beta stage. - BETA = 3; - - // The runtime is generally available. - GA = 4; - - // The runtime is deprecated. - DEPRECATED = 5; - - // The runtime is no longer supported. - DECOMMISSIONED = 6; - } - - // The runtimes that match the request. - repeated Runtime runtimes = 1; -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // The time the operation was created. - google.protobuf.Timestamp create_time = 1; - - // The time the operation finished running. - google.protobuf.Timestamp end_time = 2; - - // Server-defined resource path for the target of the operation. - string target = 3; - - // Name of the verb executed by the operation. - string verb = 4; - - // Human-readable status of the operation, if any. - string status_detail = 5; - - // Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a - // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - // `Code.CANCELLED`. - bool cancel_requested = 6; - - // API version used to start the operation. - string api_version = 7; - - // The original request that started the operation. - google.protobuf.Any request_resource = 8; - - // Mechanism for reporting in-progress stages - repeated Stage stages = 9; -} - -// Extra GCF specific location information. -message LocationMetadata { - // The Cloud Function environments this location supports. - repeated Environment environments = 1; -} - -// Each Stage of the deployment process -message Stage { - // Possible names for a Stage - enum Name { - // Not specified. Invalid name. - NAME_UNSPECIFIED = 0; - - // Artifact Regsitry Stage - ARTIFACT_REGISTRY = 1; - - // Build Stage - BUILD = 2; - - // Service Stage - SERVICE = 3; - - // Trigger Stage - TRIGGER = 4; - - // Service Rollback Stage - SERVICE_ROLLBACK = 5; - - // Trigger Rollback Stage - TRIGGER_ROLLBACK = 6; - } - - // Possible states for a Stage - enum State { - // Not specified. Invalid state. - STATE_UNSPECIFIED = 0; - - // Stage has not started. - NOT_STARTED = 1; - - // Stage is in progress. - IN_PROGRESS = 2; - - // Stage has completed. - COMPLETE = 3; - } - - // Name of the Stage. This will be unique for each Stage. - Name name = 1; - - // Message describing the Stage - string message = 2; - - // Current state of the Stage - State state = 3; - - // Resource of the Stage - string resource = 4; - - // Link to the current Stage resource - string resource_uri = 5; - - // State messages from the current Stage. - repeated StateMessage state_messages = 6; -} diff --git a/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.create_function.js b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.create_function.js deleted file mode 100644 index 08fde6038e3..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.create_function.js +++ /dev/null @@ -1,75 +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, function1) { - // [START cloudfunctions_v2_generated_FunctionService_CreateFunction_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 project and location in which the function should be created, - * specified in the format `projects/* /locations/*` - */ - // const parent = 'abc123' - /** - * Required. Function to be created. - */ - // const function = {} - /** - * The ID to use for the function, which will become the final component of - * the function's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - */ - // const functionId = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callCreateFunction() { - // Construct request - const request = { - parent, - function1, - }; - - // Run request - const [operation] = await functionsClient.createFunction(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateFunction(); - // [END cloudfunctions_v2_generated_FunctionService_CreateFunction_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-functions/v2/samples/generated/v2/function_service.delete_function.js b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.delete_function.js deleted file mode 100644 index ce53678f3f9..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.delete_function.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 cloudfunctions_v2_generated_FunctionService_DeleteFunction_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the function which should be deleted. - */ - // const name = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callDeleteFunction() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await functionsClient.deleteFunction(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteFunction(); - // [END cloudfunctions_v2_generated_FunctionService_DeleteFunction_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-functions/v2/samples/generated/v2/function_service.generate_download_url.js b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.generate_download_url.js deleted file mode 100644 index 069b98c675b..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.generate_download_url.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 cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of function for which source code Google Cloud Storage - * signed URL should be generated. - */ - // const name = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callGenerateDownloadUrl() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await functionsClient.generateDownloadUrl(request); - console.log(response); - } - - callGenerateDownloadUrl(); - // [END cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_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-functions/v2/samples/generated/v2/function_service.generate_upload_url.js b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.generate_upload_url.js deleted file mode 100644 index e5ad4b903cb..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.generate_upload_url.js +++ /dev/null @@ -1,78 +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 cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_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 project and location in which the Google Cloud Storage signed - * URL should be generated, specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Preview Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). - */ - // const kmsKeyName = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callGenerateUploadUrl() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await functionsClient.generateUploadUrl(request); - console.log(response); - } - - callGenerateUploadUrl(); - // [END cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_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-functions/v2/samples/generated/v2/function_service.get_function.js b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.get_function.js deleted file mode 100644 index a4d115c143f..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.get_function.js +++ /dev/null @@ -1,61 +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 cloudfunctions_v2_generated_FunctionService_GetFunction_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the function which details should be obtained. - */ - // const name = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callGetFunction() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await functionsClient.getFunction(request); - console.log(response); - } - - callGetFunction(); - // [END cloudfunctions_v2_generated_FunctionService_GetFunction_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-functions/v2/samples/generated/v2/function_service.list_functions.js b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.list_functions.js deleted file mode 100644 index bf396080a4d..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.list_functions.js +++ /dev/null @@ -1,93 +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 cloudfunctions_v2_generated_FunctionService_ListFunctions_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 project and location from which the function should be - * listed, specified in the format `projects/* /locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. - */ - // const parent = 'abc123' - /** - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - */ - // const pageSize = 1234 - /** - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - */ - // const filter = 'abc123' - /** - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - */ - // const orderBy = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callListFunctions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await functionsClient.listFunctionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFunctions(); - // [END cloudfunctions_v2_generated_FunctionService_ListFunctions_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-functions/v2/samples/generated/v2/function_service.list_runtimes.js b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.list_runtimes.js deleted file mode 100644 index d1ee7e22ebd..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.list_runtimes.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) { - // [START cloudfunctions_v2_generated_FunctionService_ListRuntimes_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 project and location from which the runtimes should be - * listed, specified in the format `projects/* /locations/*` - */ - // const parent = 'abc123' - /** - * The filter for Runtimes that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - */ - // const filter = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callListRuntimes() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await functionsClient.listRuntimes(request); - console.log(response); - } - - callListRuntimes(); - // [END cloudfunctions_v2_generated_FunctionService_ListRuntimes_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-functions/v2/samples/generated/v2/function_service.update_function.js b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.update_function.js deleted file mode 100644 index b6122068c28..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/function_service.update_function.js +++ /dev/null @@ -1,68 +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(function1) { - // [START cloudfunctions_v2_generated_FunctionService_UpdateFunction_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. New version of the function. - */ - // const function = {} - /** - * The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. - */ - // const updateMask = {} - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callUpdateFunction() { - // Construct request - const request = { - function1, - }; - - // Run request - const [operation] = await functionsClient.updateFunction(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateFunction(); - // [END cloudfunctions_v2_generated_FunctionService_UpdateFunction_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-functions/v2/samples/generated/v2/snippet_metadata_google.cloud.functions.v2.json b/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/snippet_metadata_google.cloud.functions.v2.json deleted file mode 100644 index a39ba256d39..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/samples/generated/v2/snippet_metadata_google.cloud.functions.v2.json +++ /dev/null @@ -1,371 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-functions", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.functions.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudfunctions_v2_generated_FunctionService_GetFunction_async", - "title": "FunctionService getFunction Sample", - "origin": "API_DEFINITION", - "description": " Returns a function with the given name from the requested project.", - "canonical": true, - "file": "function_service.get_function.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFunction", - "fullName": "google.cloud.functions.v2.FunctionService.GetFunction", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v2.Function", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2.FunctionServiceClient" - }, - "method": { - "shortName": "GetFunction", - "fullName": "google.cloud.functions.v2.FunctionService.GetFunction", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2_generated_FunctionService_ListFunctions_async", - "title": "FunctionService listFunctions Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of functions that belong to the requested project.", - "canonical": true, - "file": "function_service.list_functions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFunctions", - "fullName": "google.cloud.functions.v2.FunctionService.ListFunctions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v2.ListFunctionsResponse", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2.FunctionServiceClient" - }, - "method": { - "shortName": "ListFunctions", - "fullName": "google.cloud.functions.v2.FunctionService.ListFunctions", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2_generated_FunctionService_CreateFunction_async", - "title": "FunctionService createFunction Sample", - "origin": "API_DEFINITION", - "description": " Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return `ALREADY_EXISTS` error.", - "canonical": true, - "file": "function_service.create_function.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFunction", - "fullName": "google.cloud.functions.v2.FunctionService.CreateFunction", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "function", - "type": ".google.cloud.functions.v2.Function" - }, - { - "name": "function_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2.FunctionServiceClient" - }, - "method": { - "shortName": "CreateFunction", - "fullName": "google.cloud.functions.v2.FunctionService.CreateFunction", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2_generated_FunctionService_UpdateFunction_async", - "title": "FunctionService updateFunction Sample", - "origin": "API_DEFINITION", - "description": " Updates existing function.", - "canonical": true, - "file": "function_service.update_function.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFunction", - "fullName": "google.cloud.functions.v2.FunctionService.UpdateFunction", - "async": true, - "parameters": [ - { - "name": "function", - "type": ".google.cloud.functions.v2.Function" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2.FunctionServiceClient" - }, - "method": { - "shortName": "UpdateFunction", - "fullName": "google.cloud.functions.v2.FunctionService.UpdateFunction", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2_generated_FunctionService_DeleteFunction_async", - "title": "FunctionService deleteFunction Sample", - "origin": "API_DEFINITION", - "description": " Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.", - "canonical": true, - "file": "function_service.delete_function.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteFunction", - "fullName": "google.cloud.functions.v2.FunctionService.DeleteFunction", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2.FunctionServiceClient" - }, - "method": { - "shortName": "DeleteFunction", - "fullName": "google.cloud.functions.v2.FunctionService.DeleteFunction", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_async", - "title": "FunctionService generateUploadUrl Sample", - "origin": "API_DEFINITION", - "description": " Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type: application/zip` And this header SHOULD NOT be specified: * `Authorization: Bearer YOUR_TOKEN`", - "canonical": true, - "file": "function_service.generate_upload_url.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateUploadUrl", - "fullName": "google.cloud.functions.v2.FunctionService.GenerateUploadUrl", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "kms_key_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v2.GenerateUploadUrlResponse", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2.FunctionServiceClient" - }, - "method": { - "shortName": "GenerateUploadUrl", - "fullName": "google.cloud.functions.v2.FunctionService.GenerateUploadUrl", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_async", - "title": "FunctionService generateDownloadUrl Sample", - "origin": "API_DEFINITION", - "description": " Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls", - "canonical": true, - "file": "function_service.generate_download_url.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateDownloadUrl", - "fullName": "google.cloud.functions.v2.FunctionService.GenerateDownloadUrl", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v2.GenerateDownloadUrlResponse", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2.FunctionServiceClient" - }, - "method": { - "shortName": "GenerateDownloadUrl", - "fullName": "google.cloud.functions.v2.FunctionService.GenerateDownloadUrl", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2_generated_FunctionService_ListRuntimes_async", - "title": "FunctionService listRuntimes Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of runtimes that are supported for the requested project.", - "canonical": true, - "file": "function_service.list_runtimes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListRuntimes", - "fullName": "google.cloud.functions.v2.FunctionService.ListRuntimes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v2.ListRuntimesResponse", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2.FunctionServiceClient" - }, - "method": { - "shortName": "ListRuntimes", - "fullName": "google.cloud.functions.v2.FunctionService.ListRuntimes", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2.FunctionService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-functions/v2/src/index.ts b/owl-bot-staging/google-cloud-functions/v2/src/index.ts deleted file mode 100644 index 2a635dc096f..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/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 v2 from './v2'; -const FunctionServiceClient = v2.FunctionServiceClient; -type FunctionServiceClient = v2.FunctionServiceClient; -export {v2, FunctionServiceClient}; -export default {v2, FunctionServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_client.ts b/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_client.ts deleted file mode 100644 index cac23924837..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_client.ts +++ /dev/null @@ -1,2197 +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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/function_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './function_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Google Cloud Functions is used to deploy functions that are executed by - * Google in response to various events. Data connected with that event is - * passed to a function as the input data. - * - * A **function** is a resource which describes a function that should be - * executed and how it is triggered. - * @class - * @memberof v2 - */ -export class FunctionServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - functionServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of FunctionServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 FunctionServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof FunctionServiceClient; - 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; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - 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 = { - buildPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/builds/{build}' - ), - channelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/channels/{channel}' - ), - connectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/connectors/{connector}' - ), - cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' - ), - functionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/functions/{function}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - repositoryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ), - topicPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/topics/{topic}' - ), - triggerPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/triggers/{trigger}' - ), - workerPoolPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workerPools/{worker_pool}' - ), - }; - - // 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 = { - listFunctions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'functions') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v2/{resource=projects/*/locations/*/functions/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v2/{resource=projects/*/locations/*/functions/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v2/{resource=projects/*/locations/*/functions/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createFunctionResponse = protoFilesRoot.lookup( - '.google.cloud.functions.v2.Function') as gax.protobuf.Type; - const createFunctionMetadata = protoFilesRoot.lookup( - '.google.cloud.functions.v2.OperationMetadata') as gax.protobuf.Type; - const updateFunctionResponse = protoFilesRoot.lookup( - '.google.cloud.functions.v2.Function') as gax.protobuf.Type; - const updateFunctionMetadata = protoFilesRoot.lookup( - '.google.cloud.functions.v2.OperationMetadata') as gax.protobuf.Type; - const deleteFunctionResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteFunctionMetadata = protoFilesRoot.lookup( - '.google.cloud.functions.v2.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createFunction: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createFunctionResponse.decode.bind(createFunctionResponse), - createFunctionMetadata.decode.bind(createFunctionMetadata)), - updateFunction: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateFunctionResponse.decode.bind(updateFunctionResponse), - updateFunctionMetadata.decode.bind(updateFunctionMetadata)), - deleteFunction: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteFunctionResponse.decode.bind(deleteFunctionResponse), - deleteFunctionMetadata.decode.bind(deleteFunctionMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.functions.v2.FunctionService', 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.functionServiceStub) { - return this.functionServiceStub; - } - - // Put together the "service stub" for - // google.cloud.functions.v2.FunctionService. - this.functionServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.functions.v2.FunctionService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.functions.v2.FunctionService, - 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 functionServiceStubMethods = - ['getFunction', 'listFunctions', 'createFunction', 'updateFunction', 'deleteFunction', 'generateUploadUrl', 'generateDownloadUrl', 'listRuntimes']; - for (const methodName of functionServiceStubMethods) { - const callPromise = this.functionServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.functionServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'cloudfunctions.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 'cloudfunctions.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 -- - // ------------------- -/** - * Returns a function with the given name from the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the function which details should be obtained. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2.Function|Function}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/function_service.get_function.js - * region_tag:cloudfunctions_v2_generated_FunctionService_GetFunction_async - */ - getFunction( - request?: protos.google.cloud.functions.v2.IGetFunctionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v2.IFunction, - protos.google.cloud.functions.v2.IGetFunctionRequest|undefined, {}|undefined - ]>; - getFunction( - request: protos.google.cloud.functions.v2.IGetFunctionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.functions.v2.IFunction, - protos.google.cloud.functions.v2.IGetFunctionRequest|null|undefined, - {}|null|undefined>): void; - getFunction( - request: protos.google.cloud.functions.v2.IGetFunctionRequest, - callback: Callback< - protos.google.cloud.functions.v2.IFunction, - protos.google.cloud.functions.v2.IGetFunctionRequest|null|undefined, - {}|null|undefined>): void; - getFunction( - request?: protos.google.cloud.functions.v2.IGetFunctionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.functions.v2.IFunction, - protos.google.cloud.functions.v2.IGetFunctionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.functions.v2.IFunction, - protos.google.cloud.functions.v2.IGetFunctionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v2.IFunction, - protos.google.cloud.functions.v2.IGetFunctionRequest|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.getFunction(request, options, callback); - } -/** - * Returns a signed URL for uploading a function source code. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls. - * Once the function source code upload is complete, the used signed - * URL should be provided in CreateFunction or UpdateFunction request - * as a reference to the function source code. - * - * When uploading source code to the generated signed URL, please follow - * these restrictions: - * - * * Source file type should be a zip file. - * * No credentials should be attached - the signed URLs provide access to the - * target bucket using internal service identity; if credentials were - * attached, the identity from the credentials would be used, but that - * identity does not have permissions to upload files to the URL. - * - * When making a HTTP PUT request, these two headers need to be specified: - * - * * `content-type: application/zip` - * - * And this header SHOULD NOT be specified: - * - * * `Authorization: Bearer YOUR_TOKEN` - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location in which the Google Cloud Storage signed - * URL should be generated, specified in the format `projects/* /locations/*`. - * @param {string} request.kmsKeyName - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2.GenerateUploadUrlResponse|GenerateUploadUrlResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/function_service.generate_upload_url.js - * region_tag:cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_async - */ - generateUploadUrl( - request?: protos.google.cloud.functions.v2.IGenerateUploadUrlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2.IGenerateUploadUrlRequest|undefined, {}|undefined - ]>; - generateUploadUrl( - request: protos.google.cloud.functions.v2.IGenerateUploadUrlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>): void; - generateUploadUrl( - request: protos.google.cloud.functions.v2.IGenerateUploadUrlRequest, - callback: Callback< - protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>): void; - generateUploadUrl( - request?: protos.google.cloud.functions.v2.IGenerateUploadUrlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2.IGenerateUploadUrlRequest|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.generateUploadUrl(request, options, callback); - } -/** - * Returns a signed URL for downloading deployed function source code. - * The URL is only valid for a limited period and should be used within - * 30 minutes of generation. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of function for which source code Google Cloud Storage - * signed URL should be generated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2.GenerateDownloadUrlResponse|GenerateDownloadUrlResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/function_service.generate_download_url.js - * region_tag:cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_async - */ - generateDownloadUrl( - request?: protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest|undefined, {}|undefined - ]>; - generateDownloadUrl( - request: protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>): void; - generateDownloadUrl( - request: protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest, - callback: Callback< - protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>): void; - generateDownloadUrl( - request?: protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest|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.generateDownloadUrl(request, options, callback); - } -/** - * Returns a list of runtimes that are supported for the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the runtimes should be - * listed, specified in the format `projects/* /locations/*` - * @param {string} request.filter - * The filter for Runtimes that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2.ListRuntimesResponse|ListRuntimesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/function_service.list_runtimes.js - * region_tag:cloudfunctions_v2_generated_FunctionService_ListRuntimes_async - */ - listRuntimes( - request?: protos.google.cloud.functions.v2.IListRuntimesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v2.IListRuntimesResponse, - protos.google.cloud.functions.v2.IListRuntimesRequest|undefined, {}|undefined - ]>; - listRuntimes( - request: protos.google.cloud.functions.v2.IListRuntimesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.functions.v2.IListRuntimesResponse, - protos.google.cloud.functions.v2.IListRuntimesRequest|null|undefined, - {}|null|undefined>): void; - listRuntimes( - request: protos.google.cloud.functions.v2.IListRuntimesRequest, - callback: Callback< - protos.google.cloud.functions.v2.IListRuntimesResponse, - protos.google.cloud.functions.v2.IListRuntimesRequest|null|undefined, - {}|null|undefined>): void; - listRuntimes( - request?: protos.google.cloud.functions.v2.IListRuntimesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.functions.v2.IListRuntimesResponse, - protos.google.cloud.functions.v2.IListRuntimesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.functions.v2.IListRuntimesResponse, - protos.google.cloud.functions.v2.IListRuntimesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v2.IListRuntimesResponse, - protos.google.cloud.functions.v2.IListRuntimesRequest|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.listRuntimes(request, options, callback); - } - -/** - * Creates a new function. If a function with the given name already exists in - * the specified project, the long running operation will return - * `ALREADY_EXISTS` error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location in which the function should be created, - * specified in the format `projects/* /locations/*` - * @param {google.cloud.functions.v2.Function} request.function - * Required. Function to be created. - * @param {string} request.functionId - * The ID to use for the function, which will become the final component of - * the function's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /{@link protos.0-9|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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/function_service.create_function.js - * region_tag:cloudfunctions_v2_generated_FunctionService_CreateFunction_async - */ - createFunction( - request?: protos.google.cloud.functions.v2.ICreateFunctionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createFunction( - request: protos.google.cloud.functions.v2.ICreateFunctionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFunction( - request: protos.google.cloud.functions.v2.ICreateFunctionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFunction( - request?: protos.google.cloud.functions.v2.ICreateFunctionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFunction(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createFunction()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/function_service.create_function.js - * region_tag:cloudfunctions_v2_generated_FunctionService_CreateFunction_async - */ - async checkCreateFunctionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFunction, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates existing function. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.functions.v2.Function} request.function - * Required. New version of the function. - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/function_service.update_function.js - * region_tag:cloudfunctions_v2_generated_FunctionService_UpdateFunction_async - */ - updateFunction( - request?: protos.google.cloud.functions.v2.IUpdateFunctionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateFunction( - request: protos.google.cloud.functions.v2.IUpdateFunctionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFunction( - request: protos.google.cloud.functions.v2.IUpdateFunctionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFunction( - request?: protos.google.cloud.functions.v2.IUpdateFunctionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'function.name': request.function!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFunction(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateFunction()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/function_service.update_function.js - * region_tag:cloudfunctions_v2_generated_FunctionService_UpdateFunction_async - */ - async checkUpdateFunctionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFunction, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a function with the given name from the specified project. If the - * given function is used by some trigger, the trigger will be updated to - * remove this function. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the function which should be deleted. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/function_service.delete_function.js - * region_tag:cloudfunctions_v2_generated_FunctionService_DeleteFunction_async - */ - deleteFunction( - request?: protos.google.cloud.functions.v2.IDeleteFunctionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteFunction( - request: protos.google.cloud.functions.v2.IDeleteFunctionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFunction( - request: protos.google.cloud.functions.v2.IDeleteFunctionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFunction( - request?: protos.google.cloud.functions.v2.IDeleteFunctionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteFunction(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteFunction()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/function_service.delete_function.js - * region_tag:cloudfunctions_v2_generated_FunctionService_DeleteFunction_async - */ - async checkDeleteFunctionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFunction, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Returns a list of functions that belong to the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the function should be - * listed, specified in the format `projects/* /locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. - * @param {number} request.pageSize - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - * @param {string} request.pageToken - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * @param {string} request.filter - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2.Function|Function}. - * 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 `listFunctionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFunctions( - request?: protos.google.cloud.functions.v2.IListFunctionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v2.IFunction[], - protos.google.cloud.functions.v2.IListFunctionsRequest|null, - protos.google.cloud.functions.v2.IListFunctionsResponse - ]>; - listFunctions( - request: protos.google.cloud.functions.v2.IListFunctionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.functions.v2.IListFunctionsRequest, - protos.google.cloud.functions.v2.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v2.IFunction>): void; - listFunctions( - request: protos.google.cloud.functions.v2.IListFunctionsRequest, - callback: PaginationCallback< - protos.google.cloud.functions.v2.IListFunctionsRequest, - protos.google.cloud.functions.v2.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v2.IFunction>): void; - listFunctions( - request?: protos.google.cloud.functions.v2.IListFunctionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.functions.v2.IListFunctionsRequest, - protos.google.cloud.functions.v2.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v2.IFunction>, - callback?: PaginationCallback< - protos.google.cloud.functions.v2.IListFunctionsRequest, - protos.google.cloud.functions.v2.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v2.IFunction>): - Promise<[ - protos.google.cloud.functions.v2.IFunction[], - protos.google.cloud.functions.v2.IListFunctionsRequest|null, - protos.google.cloud.functions.v2.IListFunctionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listFunctions(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the function should be - * listed, specified in the format `projects/* /locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. - * @param {number} request.pageSize - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - * @param {string} request.pageToken - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * @param {string} request.filter - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * @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 protos.google.cloud.functions.v2.Function|Function} 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 `listFunctionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFunctionsStream( - request?: protos.google.cloud.functions.v2.IListFunctionsRequest, - 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['listFunctions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFunctions.createStream( - this.innerApiCalls.listFunctions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFunctions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the function should be - * listed, specified in the format `projects/* /locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. - * @param {number} request.pageSize - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - * @param {string} request.pageToken - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * @param {string} request.filter - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.functions.v2.Function|Function}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/function_service.list_functions.js - * region_tag:cloudfunctions_v2_generated_FunctionService_ListFunctions_async - */ - listFunctionsAsync( - request?: protos.google.cloud.functions.v2.IListFunctionsRequest, - 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['listFunctions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFunctions.asyncIterate( - this.innerApiCalls['listFunctions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified build resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} build - * @returns {string} Resource name string. - */ - buildPath(project:string,location:string,build:string) { - return this.pathTemplates.buildPathTemplate.render({ - project: project, - location: location, - build: build, - }); - } - - /** - * Parse the project from Build resource. - * - * @param {string} buildName - * A fully-qualified path representing Build resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBuildName(buildName: string) { - return this.pathTemplates.buildPathTemplate.match(buildName).project; - } - - /** - * Parse the location from Build resource. - * - * @param {string} buildName - * A fully-qualified path representing Build resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBuildName(buildName: string) { - return this.pathTemplates.buildPathTemplate.match(buildName).location; - } - - /** - * Parse the build from Build resource. - * - * @param {string} buildName - * A fully-qualified path representing Build resource. - * @returns {string} A string representing the build. - */ - matchBuildFromBuildName(buildName: string) { - return this.pathTemplates.buildPathTemplate.match(buildName).build; - } - - /** - * Return a fully-qualified channel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} channel - * @returns {string} Resource name string. - */ - channelPath(project:string,location:string,channel:string) { - return this.pathTemplates.channelPathTemplate.render({ - project: project, - location: location, - channel: channel, - }); - } - - /** - * Parse the project from Channel resource. - * - * @param {string} channelName - * A fully-qualified path representing Channel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromChannelName(channelName: string) { - return this.pathTemplates.channelPathTemplate.match(channelName).project; - } - - /** - * Parse the location from Channel resource. - * - * @param {string} channelName - * A fully-qualified path representing Channel resource. - * @returns {string} A string representing the location. - */ - matchLocationFromChannelName(channelName: string) { - return this.pathTemplates.channelPathTemplate.match(channelName).location; - } - - /** - * Parse the channel from Channel resource. - * - * @param {string} channelName - * A fully-qualified path representing Channel resource. - * @returns {string} A string representing the channel. - */ - matchChannelFromChannelName(channelName: string) { - return this.pathTemplates.channelPathTemplate.match(channelName).channel; - } - - /** - * Return a fully-qualified connector resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} connector - * @returns {string} Resource name string. - */ - connectorPath(project:string,location:string,connector:string) { - return this.pathTemplates.connectorPathTemplate.render({ - project: project, - location: location, - connector: connector, - }); - } - - /** - * Parse the project from Connector resource. - * - * @param {string} connectorName - * A fully-qualified path representing Connector resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConnectorName(connectorName: string) { - return this.pathTemplates.connectorPathTemplate.match(connectorName).project; - } - - /** - * Parse the location from Connector resource. - * - * @param {string} connectorName - * A fully-qualified path representing Connector resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConnectorName(connectorName: string) { - return this.pathTemplates.connectorPathTemplate.match(connectorName).location; - } - - /** - * Parse the connector from Connector resource. - * - * @param {string} connectorName - * A fully-qualified path representing Connector resource. - * @returns {string} A string representing the connector. - */ - matchConnectorFromConnectorName(connectorName: string) { - return this.pathTemplates.connectorPathTemplate.match(connectorName).connector; - } - - /** - * Return a fully-qualified cryptoKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @returns {string} Resource name string. - */ - cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { - return this.pathTemplates.cryptoKeyPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - }); - } - - /** - * Parse the project from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; - } - - /** - * Parse the location from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; - } - - /** - * Parse the key_ring from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; - } - - /** - * Parse the crypto_key from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; - } - - /** - * Return a fully-qualified function resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} functionParam - * @returns {string} Resource name string. - */ - functionPath(project:string,location:string,functionParam:string) { - return this.pathTemplates.functionPathTemplate.render({ - project: project, - location: location, - function: functionParam, - }); - } - - /** - * Parse the project from Function resource. - * - * @param {string} functionName - * A fully-qualified path representing Function resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFunctionName(functionName: string) { - return this.pathTemplates.functionPathTemplate.match(functionName).project; - } - - /** - * Parse the location from Function resource. - * - * @param {string} functionName - * A fully-qualified path representing Function resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFunctionName(functionName: string) { - return this.pathTemplates.functionPathTemplate.match(functionName).location; - } - - /** - * Parse the function from Function resource. - * - * @param {string} functionName - * A fully-qualified path representing Function resource. - * @returns {string} A string representing the function. - */ - matchFunctionFromFunctionName(functionName: string) { - return this.pathTemplates.functionPathTemplate.match(functionName).function; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified 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 repository resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @returns {string} Resource name string. - */ - repositoryPath(project:string,location:string,repository:string) { - return this.pathTemplates.repositoryPathTemplate.render({ - project: project, - location: location, - repository: repository, - }); - } - - /** - * Parse the project from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).project; - } - - /** - * Parse the location from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the location. - */ - matchLocationFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).location; - } - - /** - * Parse the repository from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).repository; - } - - /** - * Return a fully-qualified service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - service: service, - }); - } - - /** - * Parse the project from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).project; - } - - /** - * Parse the location from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).location; - } - - /** - * Parse the service from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).service; - } - - /** - * Return a fully-qualified topic resource name string. - * - * @param {string} project - * @param {string} topic - * @returns {string} Resource name string. - */ - topicPath(project:string,topic:string) { - return this.pathTemplates.topicPathTemplate.render({ - project: project, - topic: topic, - }); - } - - /** - * Parse the project from Topic resource. - * - * @param {string} topicName - * A fully-qualified path representing Topic resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTopicName(topicName: string) { - return this.pathTemplates.topicPathTemplate.match(topicName).project; - } - - /** - * Parse the topic from Topic resource. - * - * @param {string} topicName - * A fully-qualified path representing Topic resource. - * @returns {string} A string representing the topic. - */ - matchTopicFromTopicName(topicName: string) { - return this.pathTemplates.topicPathTemplate.match(topicName).topic; - } - - /** - * Return a fully-qualified trigger resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} trigger - * @returns {string} Resource name string. - */ - triggerPath(project:string,location:string,trigger:string) { - return this.pathTemplates.triggerPathTemplate.render({ - project: project, - location: location, - trigger: trigger, - }); - } - - /** - * Parse the project from Trigger resource. - * - * @param {string} triggerName - * A fully-qualified path representing Trigger resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTriggerName(triggerName: string) { - return this.pathTemplates.triggerPathTemplate.match(triggerName).project; - } - - /** - * Parse the location from Trigger resource. - * - * @param {string} triggerName - * A fully-qualified path representing Trigger resource. - * @returns {string} A string representing the location. - */ - matchLocationFromTriggerName(triggerName: string) { - return this.pathTemplates.triggerPathTemplate.match(triggerName).location; - } - - /** - * Parse the trigger from Trigger resource. - * - * @param {string} triggerName - * A fully-qualified path representing Trigger resource. - * @returns {string} A string representing the trigger. - */ - matchTriggerFromTriggerName(triggerName: string) { - return this.pathTemplates.triggerPathTemplate.match(triggerName).trigger; - } - - /** - * Return a fully-qualified workerPool resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} worker_pool - * @returns {string} Resource name string. - */ - workerPoolPath(project:string,location:string,workerPool:string) { - return this.pathTemplates.workerPoolPathTemplate.render({ - project: project, - location: location, - worker_pool: workerPool, - }); - } - - /** - * Parse the project from WorkerPool resource. - * - * @param {string} workerPoolName - * A fully-qualified path representing WorkerPool resource. - * @returns {string} A string representing the project. - */ - matchProjectFromWorkerPoolName(workerPoolName: string) { - return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).project; - } - - /** - * Parse the location from WorkerPool resource. - * - * @param {string} workerPoolName - * A fully-qualified path representing WorkerPool resource. - * @returns {string} A string representing the location. - */ - matchLocationFromWorkerPoolName(workerPoolName: string) { - return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).location; - } - - /** - * Parse the worker_pool from WorkerPool resource. - * - * @param {string} workerPoolName - * A fully-qualified path representing WorkerPool resource. - * @returns {string} A string representing the worker_pool. - */ - matchWorkerPoolFromWorkerPoolName(workerPoolName: string) { - return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).worker_pool; - } - - /** - * 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.functionServiceStub && !this._terminated) { - return this.functionServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_client_config.json b/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_client_config.json deleted file mode 100644 index 936769f0cb7..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_client_config.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "interfaces": { - "google.cloud.functions.v2.FunctionService": { - "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": { - "GetFunction": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListFunctions": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateFunction": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateFunction": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteFunction": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GenerateUploadUrl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GenerateDownloadUrl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListRuntimes": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_proto_list.json b/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_proto_list.json deleted file mode 100644 index cfde205a091..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/src/v2/function_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/functions/v2/functions.proto" -] diff --git a/owl-bot-staging/google-cloud-functions/v2/src/v2/gapic_metadata.json b/owl-bot-staging/google-cloud-functions/v2/src/v2/gapic_metadata.json deleted file mode 100644 index 4342a4d7966..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/src/v2/gapic_metadata.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.functions.v2", - "libraryPackage": "@google-cloud/functions", - "services": { - "FunctionService": { - "clients": { - "grpc": { - "libraryClient": "FunctionServiceClient", - "rpcs": { - "GetFunction": { - "methods": [ - "getFunction" - ] - }, - "GenerateUploadUrl": { - "methods": [ - "generateUploadUrl" - ] - }, - "GenerateDownloadUrl": { - "methods": [ - "generateDownloadUrl" - ] - }, - "ListRuntimes": { - "methods": [ - "listRuntimes" - ] - }, - "CreateFunction": { - "methods": [ - "createFunction" - ] - }, - "UpdateFunction": { - "methods": [ - "updateFunction" - ] - }, - "DeleteFunction": { - "methods": [ - "deleteFunction" - ] - }, - "ListFunctions": { - "methods": [ - "listFunctions", - "listFunctionsStream", - "listFunctionsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "FunctionServiceClient", - "rpcs": { - "GetFunction": { - "methods": [ - "getFunction" - ] - }, - "GenerateUploadUrl": { - "methods": [ - "generateUploadUrl" - ] - }, - "GenerateDownloadUrl": { - "methods": [ - "generateDownloadUrl" - ] - }, - "ListRuntimes": { - "methods": [ - "listRuntimes" - ] - }, - "CreateFunction": { - "methods": [ - "createFunction" - ] - }, - "UpdateFunction": { - "methods": [ - "updateFunction" - ] - }, - "DeleteFunction": { - "methods": [ - "deleteFunction" - ] - }, - "ListFunctions": { - "methods": [ - "listFunctions", - "listFunctionsStream", - "listFunctionsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-functions/v2/src/v2/index.ts b/owl-bot-staging/google-cloud-functions/v2/src/v2/index.ts deleted file mode 100644 index ec33a786b85..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/src/v2/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 {FunctionServiceClient} from './function_service_client'; diff --git a/owl-bot-staging/google-cloud-functions/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-functions/v2/system-test/fixtures/sample/src/index.js deleted file mode 100644 index c41f33eb2a8..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/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 functions = require('@google-cloud/functions'); - -function main() { - const functionServiceClient = new functions.FunctionServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-functions/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-functions/v2/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 530ace3134e..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/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 {FunctionServiceClient} from '@google-cloud/functions'; - -// check that the client class type name can be used -function doStuffWithFunctionServiceClient(client: FunctionServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const functionServiceClient = new FunctionServiceClient(); - doStuffWithFunctionServiceClient(functionServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-functions/v2/system-test/install.ts b/owl-bot-staging/google-cloud-functions/v2/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/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-functions/v2/test/gapic_function_service_v2.ts b/owl-bot-staging/google-cloud-functions/v2/test/gapic_function_service_v2.ts deleted file mode 100644 index 6256c9ab9ed..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/test/gapic_function_service_v2.ts +++ /dev/null @@ -1,2584 +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 functionserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.FunctionServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = functionserviceModule.v2.FunctionServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = functionserviceModule.v2.FunctionServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = functionserviceModule.v2.FunctionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new functionserviceModule.v2.FunctionServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.functionServiceStub, undefined); - await client.initialize(); - assert(client.functionServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.functionServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.functionServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new functionserviceModule.v2.FunctionServiceClient({ - 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 functionserviceModule.v2.FunctionServiceClient({ - 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('getFunction', () => { - it('invokes getFunction without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.GetFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.GetFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2.Function() - ); - client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); - const [response] = await client.getFunction(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFunction without error using callback', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.GetFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.GetFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2.Function() - ); - client.innerApiCalls.getFunction = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFunction( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v2.IFunction|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFunction with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.GetFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.GetFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFunction = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFunction(request), expectedError); - const actualRequest = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFunction with closed client', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.GetFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.GetFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFunction(request), expectedError); - }); - }); - - describe('generateUploadUrl', () => { - it('invokes generateUploadUrl without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.GenerateUploadUrlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2.GenerateUploadUrlResponse() - ); - client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); - const [response] = await client.generateUploadUrl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateUploadUrl without error using callback', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.GenerateUploadUrlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2.GenerateUploadUrlResponse() - ); - client.innerApiCalls.generateUploadUrl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateUploadUrl( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v2.IGenerateUploadUrlResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateUploadUrl with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.GenerateUploadUrlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateUploadUrl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateUploadUrl(request), expectedError); - const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateUploadUrl with closed client', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.GenerateUploadUrlRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateUploadUrl(request), expectedError); - }); - }); - - describe('generateDownloadUrl', () => { - it('invokes generateDownloadUrl without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.GenerateDownloadUrlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2.GenerateDownloadUrlResponse() - ); - client.innerApiCalls.generateDownloadUrl = stubSimpleCall(expectedResponse); - const [response] = await client.generateDownloadUrl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateDownloadUrl without error using callback', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.GenerateDownloadUrlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2.GenerateDownloadUrlResponse() - ); - client.innerApiCalls.generateDownloadUrl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateDownloadUrl( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateDownloadUrl with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.GenerateDownloadUrlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateDownloadUrl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateDownloadUrl(request), expectedError); - const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateDownloadUrl with closed client', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.GenerateDownloadUrlRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateDownloadUrl(request), expectedError); - }); - }); - - describe('listRuntimes', () => { - it('invokes listRuntimes without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.ListRuntimesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.ListRuntimesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2.ListRuntimesResponse() - ); - client.innerApiCalls.listRuntimes = stubSimpleCall(expectedResponse); - const [response] = await client.listRuntimes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRuntimes without error using callback', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.ListRuntimesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.ListRuntimesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2.ListRuntimesResponse() - ); - client.innerApiCalls.listRuntimes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRuntimes( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v2.IListRuntimesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRuntimes with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.ListRuntimesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.ListRuntimesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRuntimes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRuntimes(request), expectedError); - const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRuntimes with closed client', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.ListRuntimesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.ListRuntimesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listRuntimes(request), expectedError); - }); - }); - - describe('createFunction', () => { - it('invokes createFunction without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.CreateFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.CreateFunctionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFunction = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFunction(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFunction without error using callback', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.CreateFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.CreateFunctionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFunction = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFunction( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFunction with call error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.CreateFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.CreateFunctionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFunction = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFunction(request), expectedError); - const actualRequest = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFunction with LRO error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.CreateFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.CreateFunctionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFunction = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFunction(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateFunctionProgress without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateFunctionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateFunctionProgress with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFunctionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateFunction', () => { - it('invokes updateFunction without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.UpdateFunctionRequest() - ); - request.function ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.UpdateFunctionRequest', ['function', 'name']); - request.function.name = defaultValue1; - const expectedHeaderRequestParams = `function.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFunction = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFunction(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFunction without error using callback', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.UpdateFunctionRequest() - ); - request.function ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.UpdateFunctionRequest', ['function', 'name']); - request.function.name = defaultValue1; - const expectedHeaderRequestParams = `function.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFunction = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFunction( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFunction with call error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.UpdateFunctionRequest() - ); - request.function ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.UpdateFunctionRequest', ['function', 'name']); - request.function.name = defaultValue1; - const expectedHeaderRequestParams = `function.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFunction(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFunction with LRO error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.UpdateFunctionRequest() - ); - request.function ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.UpdateFunctionRequest', ['function', 'name']); - request.function.name = defaultValue1; - const expectedHeaderRequestParams = `function.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFunction(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateFunctionProgress without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateFunctionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateFunctionProgress with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFunctionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteFunction', () => { - it('invokes deleteFunction without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.DeleteFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.DeleteFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFunction = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFunction(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFunction without error using callback', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.DeleteFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.DeleteFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFunction = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFunction( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFunction with call error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.DeleteFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.DeleteFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFunction(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFunction with LRO error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.DeleteFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.DeleteFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFunction(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteFunctionProgress without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteFunctionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteFunctionProgress with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFunctionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listFunctions', () => { - it('invokes listFunctions without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v2.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2.Function()), - ]; - client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); - const [response] = await client.listFunctions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFunctions without error using callback', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v2.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2.Function()), - ]; - client.innerApiCalls.listFunctions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFunctions( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v2.IFunction[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFunctions with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFunctions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFunctions(request), expectedError); - const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFunctionsStream without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v2.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2.Function()), - ]; - client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFunctionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.functions.v2.Function[] = []; - stream.on('data', (response: protos.google.cloud.functions.v2.Function) => { - 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.listFunctions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); - assert( - (client.descriptors.page.listFunctions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFunctionsStream with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFunctionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.functions.v2.Function[] = []; - stream.on('data', (response: protos.google.cloud.functions.v2.Function) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFunctions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); - assert( - (client.descriptors.page.listFunctions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFunctions without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v2.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2.Function()), - ]; - client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.functions.v2.IFunction[] = []; - const iterable = client.listFunctionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFunctions with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFunctionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.functions.v2.IFunction[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('build', () => { - const fakePath = "/rendered/path/build"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - build: "buildValue", - }; - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.buildPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.buildPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('buildPath', () => { - const result = client.buildPath("projectValue", "locationValue", "buildValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.buildPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBuildName', () => { - const result = client.matchProjectFromBuildName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.buildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBuildName', () => { - const result = client.matchLocationFromBuildName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.buildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBuildFromBuildName', () => { - const result = client.matchBuildFromBuildName(fakePath); - assert.strictEqual(result, "buildValue"); - assert((client.pathTemplates.buildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('channel', () => { - const fakePath = "/rendered/path/channel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - channel: "channelValue", - }; - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.channelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.channelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('channelPath', () => { - const result = client.channelPath("projectValue", "locationValue", "channelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.channelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromChannelName', () => { - const result = client.matchProjectFromChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromChannelName', () => { - const result = client.matchLocationFromChannelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelFromChannelName', () => { - const result = client.matchChannelFromChannelName(fakePath); - assert.strictEqual(result, "channelValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('connector', () => { - const fakePath = "/rendered/path/connector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - connector: "connectorValue", - }; - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.connectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.connectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('connectorPath', () => { - const result = client.connectorPath("projectValue", "locationValue", "connectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.connectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConnectorName', () => { - const result = client.matchProjectFromConnectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConnectorName', () => { - const result = client.matchLocationFromConnectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConnectorFromConnectorName', () => { - const result = client.matchConnectorFromConnectorName(fakePath); - assert.strictEqual(result, "connectorValue"); - assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('cryptoKey', () => { - const fakePath = "/rendered/path/cryptoKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - }; - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.cryptoKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cryptoKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cryptoKeyPath', () => { - const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCryptoKeyName', () => { - const result = client.matchProjectFromCryptoKeyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCryptoKeyName', () => { - const result = client.matchLocationFromCryptoKeyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromCryptoKeyName', () => { - const result = client.matchKeyRingFromCryptoKeyName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromCryptoKeyName', () => { - const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('function', () => { - const fakePath = "/rendered/path/function"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - function: "functionValue", - }; - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.functionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.functionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('functionPath', () => { - const result = client.functionPath("projectValue", "locationValue", "functionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.functionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFunctionName', () => { - const result = client.matchProjectFromFunctionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.functionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFunctionName', () => { - const result = client.matchLocationFromFunctionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.functionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFunctionFromFunctionName', () => { - const result = client.matchFunctionFromFunctionName(fakePath); - assert.strictEqual(result, "functionValue"); - assert((client.pathTemplates.functionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new functionserviceModule.v2.FunctionServiceClient({ - 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('repository', () => { - const fakePath = "/rendered/path/repository"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - }; - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.repositoryPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.repositoryPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('repositoryPath', () => { - const result = client.repositoryPath("projectValue", "locationValue", "repositoryValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.repositoryPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRepositoryName', () => { - const result = client.matchProjectFromRepositoryName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromRepositoryName', () => { - const result = client.matchLocationFromRepositoryName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromRepositoryName', () => { - const result = client.matchRepositoryFromRepositoryName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - }; - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePath', () => { - const result = client.servicePath("projectValue", "locationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceName', () => { - const result = client.matchProjectFromServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServiceName', () => { - const result = client.matchLocationFromServiceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('topic', () => { - const fakePath = "/rendered/path/topic"; - const expectedParameters = { - project: "projectValue", - topic: "topicValue", - }; - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.topicPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.topicPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('topicPath', () => { - const result = client.topicPath("projectValue", "topicValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.topicPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTopicName', () => { - const result = client.matchProjectFromTopicName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.topicPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTopicFromTopicName', () => { - const result = client.matchTopicFromTopicName(fakePath); - assert.strictEqual(result, "topicValue"); - assert((client.pathTemplates.topicPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('trigger', () => { - const fakePath = "/rendered/path/trigger"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - trigger: "triggerValue", - }; - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.triggerPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.triggerPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('triggerPath', () => { - const result = client.triggerPath("projectValue", "locationValue", "triggerValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.triggerPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTriggerName', () => { - const result = client.matchProjectFromTriggerName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTriggerName', () => { - const result = client.matchLocationFromTriggerName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTriggerFromTriggerName', () => { - const result = client.matchTriggerFromTriggerName(fakePath); - assert.strictEqual(result, "triggerValue"); - assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('workerPool', () => { - const fakePath = "/rendered/path/workerPool"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - worker_pool: "workerPoolValue", - }; - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workerPoolPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workerPoolPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workerPoolPath', () => { - const result = client.workerPoolPath("projectValue", "locationValue", "workerPoolValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workerPoolPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkerPoolName', () => { - const result = client.matchProjectFromWorkerPoolName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkerPoolName', () => { - const result = client.matchLocationFromWorkerPoolName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkerPoolFromWorkerPoolName', () => { - const result = client.matchWorkerPoolFromWorkerPoolName(fakePath); - assert.strictEqual(result, "workerPoolValue"); - assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-functions/v2/tsconfig.json b/owl-bot-staging/google-cloud-functions/v2/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/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-functions/v2/webpack.config.js b/owl-bot-staging/google-cloud-functions/v2/webpack.config.js deleted file mode 100644 index 527abad554f..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2/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: 'FunctionService', - filename: './function-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-functions/v2alpha/.eslintignore b/owl-bot-staging/google-cloud-functions/v2alpha/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/.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-functions/v2alpha/.eslintrc.json b/owl-bot-staging/google-cloud-functions/v2alpha/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/.gitignore b/owl-bot-staging/google-cloud-functions/v2alpha/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/.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-functions/v2alpha/.jsdoc.js b/owl-bot-staging/google-cloud-functions/v2alpha/.jsdoc.js deleted file mode 100644 index 43186156cf8..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/.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/functions', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/.mocharc.js b/owl-bot-staging/google-cloud-functions/v2alpha/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/.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-functions/v2alpha/.prettierrc.js b/owl-bot-staging/google-cloud-functions/v2alpha/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/.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-functions/v2alpha/README.md b/owl-bot-staging/google-cloud-functions/v2alpha/README.md deleted file mode 100644 index efb614cf6e7..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/README.md +++ /dev/null @@ -1 +0,0 @@ -Functions: Nodejs Client diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/package.json b/owl-bot-staging/google-cloud-functions/v2alpha/package.json deleted file mode 100644 index a5e7b166e52..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/functions", - "version": "0.1.0", - "description": "Functions client for Node.js", - "repository": "googleapis/nodejs-functions", - "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 functions", - "functions", - "function service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/protos/google/cloud/functions/v2alpha/functions.proto b/owl-bot-staging/google-cloud-functions/v2alpha/protos/google/cloud/functions/v2alpha/functions.proto deleted file mode 100644 index 3c96518d728..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/protos/google/cloud/functions/v2alpha/functions.proto +++ /dev/null @@ -1,1147 +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 -// -// 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.functions.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/functions/apiv2alpha/functionspb;functionspb"; -option java_multiple_files = true; -option java_outer_classname = "FunctionsProto"; -option java_package = "com.google.cloud.functions.v2alpha"; -option objc_class_prefix = "GCF"; -option (google.api.resource_definition) = { - type: "artifactregistry.googleapis.com/Repository" - pattern: "projects/{project}/locations/{location}/repositories/{repository}" -}; -option (google.api.resource_definition) = { - type: "cloudbuild.googleapis.com/Build" - pattern: "projects/{project}/locations/{location}/builds/{build}" -}; -option (google.api.resource_definition) = { - type: "cloudbuild.googleapis.com/WorkerPool" - pattern: "projects/{project}/locations/{location}/workerPools/{worker_pool}" -}; -option (google.api.resource_definition) = { - type: "run.googleapis.com/Service" - pattern: "projects/{project}/locations/{location}/services/{service}" -}; -option (google.api.resource_definition) = { - type: "vpcaccess.googleapis.com/Connector" - pattern: "projects/{project}/locations/{location}/connectors/{connector}" -}; -option (google.api.resource_definition) = { - type: "eventarc.googleapis.com/Trigger" - pattern: "projects/{project}/locations/{location}/triggers/{trigger}" -}; -option (google.api.resource_definition) = { - type: "eventarc.googleapis.com/Channel" - pattern: "projects/{project}/locations/{location}/channels/{channel}" -}; -option (google.api.resource_definition) = { - type: "pubsub.googleapis.com/Topic" - pattern: "projects/{project}/topics/{topic}" -}; -option (google.api.resource_definition) = { - type: "cloudkms.googleapis.com/CryptoKey" - pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" -}; - -// Google Cloud Functions is used to deploy functions that are executed by -// Google in response to various events. Data connected with that event is -// passed to a function as the input data. -// -// A **function** is a resource which describes a function that should be -// executed and how it is triggered. -service FunctionService { - option (google.api.default_host) = "cloudfunctions.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Returns a function with the given name from the requested project. - rpc GetFunction(GetFunctionRequest) returns (Function) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/locations/*/functions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns a list of functions that belong to the requested project. - rpc ListFunctions(ListFunctionsRequest) returns (ListFunctionsResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*}/functions" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a new function. If a function with the given name already exists in - // the specified project, the long running operation will return - // `ALREADY_EXISTS` error. - rpc CreateFunction(CreateFunctionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*}/functions" - body: "function" - }; - option (google.api.method_signature) = "parent,function,function_id"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.functions.v2alpha.Function" - metadata_type: "google.cloud.functions.v2alpha.OperationMetadata" - }; - } - - // Updates existing function. - rpc UpdateFunction(UpdateFunctionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v2alpha/{function.name=projects/*/locations/*/functions/*}" - body: "function" - }; - option (google.api.method_signature) = "function,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.functions.v2alpha.Function" - metadata_type: "google.cloud.functions.v2alpha.OperationMetadata" - }; - } - - // Deletes a function with the given name from the specified project. If the - // given function is used by some trigger, the trigger will be updated to - // remove this function. - rpc DeleteFunction(DeleteFunctionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v2alpha/{name=projects/*/locations/*/functions/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.functions.v2alpha.OperationMetadata" - }; - } - - // Returns a signed URL for uploading a function source code. - // For more information about the signed URL usage see: - // https://cloud.google.com/storage/docs/access-control/signed-urls. - // Once the function source code upload is complete, the used signed - // URL should be provided in CreateFunction or UpdateFunction request - // as a reference to the function source code. - // - // When uploading source code to the generated signed URL, please follow - // these restrictions: - // - // * Source file type should be a zip file. - // * No credentials should be attached - the signed URLs provide access to the - // target bucket using internal service identity; if credentials were - // attached, the identity from the credentials would be used, but that - // identity does not have permissions to upload files to the URL. - // - // When making a HTTP PUT request, these two headers need to be specified: - // - // * `content-type: application/zip` - // - // And this header SHOULD NOT be specified: - // - // * `Authorization: Bearer YOUR_TOKEN` - rpc GenerateUploadUrl(GenerateUploadUrlRequest) - returns (GenerateUploadUrlResponse) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*}/functions:generateUploadUrl" - body: "*" - }; - } - - // Returns a signed URL for downloading deployed function source code. - // The URL is only valid for a limited period and should be used within - // 30 minutes of generation. - // For more information about the signed URL usage see: - // https://cloud.google.com/storage/docs/access-control/signed-urls - rpc GenerateDownloadUrl(GenerateDownloadUrlRequest) - returns (GenerateDownloadUrlResponse) { - option (google.api.http) = { - post: "/v2alpha/{name=projects/*/locations/*/functions/*}:generateDownloadUrl" - body: "*" - }; - } - - // Returns a list of runtimes that are supported for the requested project. - rpc ListRuntimes(ListRuntimesRequest) returns (ListRuntimesResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*}/runtimes" - }; - option (google.api.method_signature) = "parent"; - } -} - -// The environment the function is hosted on. -enum Environment { - // Unspecified - ENVIRONMENT_UNSPECIFIED = 0; - - // Gen 1 - GEN_1 = 1; - - // Gen 2 - GEN_2 = 2; -} - -// Describes a Cloud Function that contains user computation executed in -// response to an event. It encapsulates function and trigger configurations. -message Function { - option (google.api.resource) = { - type: "cloudfunctions.googleapis.com/Function" - pattern: "projects/{project}/locations/{location}/functions/{function}" - plural: "functions" - singular: "function" - }; - - // Describes the current state of the function. - enum State { - // Not specified. Invalid state. - STATE_UNSPECIFIED = 0; - - // Function has been successfully deployed and is serving. - ACTIVE = 1; - - // Function deployment failed and the function is not serving. - FAILED = 2; - - // Function is being created or updated. - DEPLOYING = 3; - - // Function is being deleted. - DELETING = 4; - - // Function deployment failed and the function serving state is undefined. - // The function should be updated or deleted to move it out of this state. - UNKNOWN = 5; - } - - // A user-defined name of the function. Function names must be unique - // globally and match pattern `projects/*/locations/*/functions/*` - string name = 1; - - // User-provided description of a function. - string description = 2; - - // Describes the Build step of the function that builds a container from the - // given source. - BuildConfig build_config = 3; - - // Describes the Service being deployed. Currently deploys services to Cloud - // Run (fully managed). - ServiceConfig service_config = 4; - - // An Eventarc trigger managed by Google Cloud Functions that fires events in - // response to a condition in another service. - EventTrigger event_trigger = 5; - - // Output only. State of the function. - State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of a Cloud Function. - google.protobuf.Timestamp update_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels associated with this Cloud Function. - map labels = 8; - - // Output only. State Messages for this Cloud Function. - repeated StateMessage state_messages = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Describe whether the function is 1st Gen or 2nd Gen. - Environment environment = 10; - - // Output only. The deployed url for the function. - string url = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // [Preview] Resource name of a KMS crypto key (managed by the user) used to - // encrypt/decrypt function resources. - // - // It must match the pattern - // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - string kms_key_name = 25 [(google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - }]; -} - -// Informational messages about the state of the Cloud Function or Operation. -message StateMessage { - // Severity of the state message. - enum Severity { - // Not specified. Invalid severity. - SEVERITY_UNSPECIFIED = 0; - - // ERROR-level severity. - ERROR = 1; - - // WARNING-level severity. - WARNING = 2; - - // INFO-level severity. - INFO = 3; - } - - // Severity of the state message. - Severity severity = 1; - - // One-word CamelCase type of the state message. - string type = 2; - - // The message. - string message = 3; -} - -// Location of the source in an archive file in Google Cloud Storage. -message StorageSource { - // Google Cloud Storage bucket containing the source (see - // [Bucket Name - // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - string bucket = 1; - - // Google Cloud Storage object containing the source. - // - // This object must be a gzipped archive file (`.tar.gz`) containing source to - // build. - string object = 2; - - // Google Cloud Storage generation for the object. If the generation is - // omitted, the latest generation will be used. - int64 generation = 3; -} - -// Location of the source in a Google Cloud Source Repository. -message RepoSource { - // A revision within the Cloud Source Repository must be specified in - // one of these ways. - oneof revision { - // Regex matching branches to build. - // - // The syntax of the regular expressions accepted is the syntax accepted by - // RE2 and described at https://github.com/google/re2/wiki/Syntax - string branch_name = 3; - - // Regex matching tags to build. - // - // The syntax of the regular expressions accepted is the syntax accepted by - // RE2 and described at https://github.com/google/re2/wiki/Syntax - string tag_name = 4; - - // Explicit commit SHA to build. - string commit_sha = 5; - } - - // ID of the project that owns the Cloud Source Repository. If omitted, the - // project ID requesting the build is assumed. - string project_id = 1; - - // Name of the Cloud Source Repository. - string repo_name = 2; - - // Directory, relative to the source root, in which to run the build. - // - // This must be a relative path. If a step's `dir` is specified and is an - // absolute path, this value is ignored for that step's execution. - // eg. helloworld (no leading slash allowed) - string dir = 6; - - // Only trigger a build if the revision regex does NOT match the revision - // regex. - bool invert_regex = 7; -} - -// The location of the function source code. -message Source { - // Location of the source. - // At least one source needs to be provided for the deployment to succeed. - oneof source { - // If provided, get the source from this location in Google Cloud Storage. - StorageSource storage_source = 1; - - // If provided, get the source from this location in a Cloud Source - // Repository. - RepoSource repo_source = 2; - } -} - -// Provenance of the source. Ways to find the original source, or verify that -// some source was used for this build. -message SourceProvenance { - // A copy of the build's `source.storage_source`, if exists, with any - // generations resolved. - StorageSource resolved_storage_source = 1; - - // A copy of the build's `source.repo_source`, if exists, with any - // revisions resolved. - RepoSource resolved_repo_source = 2; -} - -// Describes the Build step of the function that builds a container from the -// given source. -message BuildConfig { - // Docker Registry to use for storing function Docker images. - enum DockerRegistry { - // Unspecified. - DOCKER_REGISTRY_UNSPECIFIED = 0; - - // Docker images will be stored in multi-regional Container Registry - // repositories named `gcf`. - CONTAINER_REGISTRY = 1; - - // Docker images will be stored in regional Artifact Registry repositories. - // By default, GCF will create and use repositories named `gcf-artifacts` - // in every region in which a function is deployed. But the repository to - // use can also be specified by the user using the `docker_repository` - // field. - ARTIFACT_REGISTRY = 2; - } - - // Output only. The Cloud Build name of the latest successful deployment of - // the function. - string build = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Build" - } - ]; - - // The runtime in which to run the function. Required when deploying a new - // function, optional when updating an existing function. For a complete - // list of possible choices, see the - // [`gcloud` command - // reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - string runtime = 2; - - // The name of the function (as defined in source code) that will be - // executed. Defaults to the resource name suffix, if not specified. For - // backward compatibility, if function with given name is not found, then the - // system will try to use function named "function". - // For Node.js this is name of a function exported by the module specified - // in `source_location`. - string entry_point = 3; - - // The location of the function source code. - Source source = 4; - - // Output only. A permanent fixed identifier for source. - SourceProvenance source_provenance = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Name of the Cloud Build Custom Worker Pool that should be used to build the - // function. The format of this field is - // `projects/{project}/locations/{region}/workerPools/{workerPool}` where - // {project} and {region} are the project id and region respectively where the - // worker pool is defined and {workerPool} is the short name of the worker - // pool. - // - // If the project id is not the same as the function, then the Cloud - // Functions Service Agent - // (service-@gcf-admin-robot.iam.gserviceaccount.com) must be - // granted the role Cloud Build Custom Workers Builder - // (roles/cloudbuild.customworkers.builder) in the project. - string worker_pool = 5 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - }]; - - // User-provided build-time environment variables for the function - map environment_variables = 6; - - // Docker Registry to use for this deployment. This configuration is only - // applicable to 1st Gen functions, 2nd Gen functions can only use Artifact - // Registry. - // - // If `docker_repository` field is specified, this field will be automatically - // set as `ARTIFACT_REGISTRY`. - // If unspecified, it currently defaults to `CONTAINER_REGISTRY`. - // This field may be overridden by the backend for eligible deployments. - DockerRegistry docker_registry = 10; - - // User managed repository created in Artifact Registry optionally - // with a customer managed encryption key. This is the repository to which the - // function docker image will be pushed after it is built by Cloud Build. - // If unspecified, GCF will create and use a repository named 'gcf-artifacts' - // for every deployed region. - // - // It must match the pattern - // `projects/{project}/locations/{location}/repositories/{repository}`. - // - // Cross-project repositories are not supported. - // Cross-location repositories are not supported. - // Repository format must be 'DOCKER'. - string docker_repository = 7 [(google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/Repository" - }]; -} - -// Describes the Service being deployed. -// Currently Supported : Cloud Run (fully managed). -message ServiceConfig { - // Available egress settings. - // - // This controls what traffic is diverted through the VPC Access Connector - // resource. By default PRIVATE_RANGES_ONLY will be used. - enum VpcConnectorEgressSettings { - // Unspecified. - VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; - - // Use the VPC Access Connector only for private IP space from RFC1918. - PRIVATE_RANGES_ONLY = 1; - - // Force the use of VPC Access Connector for all egress traffic from the - // function. - ALL_TRAFFIC = 2; - } - - // Available ingress settings. - // - // This controls what traffic can reach the function. - // - // If unspecified, ALLOW_ALL will be used. - enum IngressSettings { - // Unspecified. - INGRESS_SETTINGS_UNSPECIFIED = 0; - - // Allow HTTP traffic from public and private sources. - ALLOW_ALL = 1; - - // Allow HTTP traffic from only private VPC sources. - ALLOW_INTERNAL_ONLY = 2; - - // Allow HTTP traffic from private VPC sources and through GCLB. - ALLOW_INTERNAL_AND_GCLB = 3; - } - - // Available security level settings. - // - // This enforces security protocol on function URL. - // - // Security level is only configurable for 1st Gen functions, If unspecified, - // SECURE_OPTIONAL will be used. 2nd Gen functions are SECURE_ALWAYS ONLY. - enum SecurityLevel { - // Unspecified. - SECURITY_LEVEL_UNSPECIFIED = 0; - - // Requests for a URL that match this handler that do not use HTTPS are - // automatically redirected to the HTTPS URL with the same path. Query - // parameters are reserved for the redirect. - SECURE_ALWAYS = 1; - - // Both HTTP and HTTPS requests with URLs that match the handler succeed - // without redirects. The application can examine the request to determine - // which protocol was used and respond accordingly. - SECURE_OPTIONAL = 2; - } - - // Output only. Name of the service associated with a Function. - // The format of this field is - // `projects/{project}/locations/{region}/services/{service}` - string service = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { type: "run.googleapis.com/Service" } - ]; - - // The function execution timeout. Execution is considered failed and - // can be terminated if the function is not completed at the end of the - // timeout period. Defaults to 60 seconds. - int32 timeout_seconds = 2; - - // The amount of memory available for a function. - // Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is - // supplied the value is interpreted as bytes. - // See - // https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go - // a full description. - string available_memory = 13; - - // [Preview] The number of CPUs used in a single container instance. - // Default value is calculated from available memory. - // Supports the same values as Cloud Run, see - // https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements - // Example: "1" indicates 1 vCPU - string available_cpu = 22; - - // Environment variables that shall be available during function execution. - map environment_variables = 4; - - // The limit on the maximum number of function instances that may coexist at a - // given time. - // - // In some cases, such as rapid traffic surges, Cloud Functions may, for a - // short period of time, create more instances than the specified max - // instances limit. If your function cannot tolerate this temporary behavior, - // you may want to factor in a safety margin and set a lower max instances - // value than your function can tolerate. - // - // See the [Max - // Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - // more details. - int32 max_instance_count = 5; - - // The limit on the minimum number of function instances that may coexist at a - // given time. - // - // Function instances are kept in idle state for a short period after they - // finished executing the request to reduce cold start time for subsequent - // requests. Setting a minimum instance count will ensure that the given - // number of instances are kept running in idle state always. This can help - // with cold start times when jump in incoming request count occurs after the - // idle instance would have been stopped in the default case. - int32 min_instance_count = 12; - - // The Serverless VPC Access connector that this cloud function can connect - // to. The format of this field is `projects/*/locations/*/connectors/*`. - string vpc_connector = 6 [(google.api.resource_reference) = { - type: "vpcaccess.googleapis.com/Connector" - }]; - - // The egress settings for the connector, controlling what traffic is diverted - // through it. - VpcConnectorEgressSettings vpc_connector_egress_settings = 7; - - // The ingress settings for the function, controlling what traffic can reach - // it. - IngressSettings ingress_settings = 8; - - // Output only. URI of the Service deployed. - string uri = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The email of the service's service account. If empty, defaults to - // `{project_number}-compute@developer.gserviceaccount.com`. - string service_account_email = 10; - - // Whether 100% of traffic is routed to the latest revision. - // On CreateFunction and UpdateFunction, when set to true, the revision being - // deployed will serve 100% of traffic, ignoring any traffic split settings, - // if any. On GetFunction, true will be returned if the latest revision is - // serving 100% of traffic. - bool all_traffic_on_latest_revision = 16; - - // Secret environment variables configuration. - repeated SecretEnvVar secret_environment_variables = 17; - - // Secret volumes configuration. - repeated SecretVolume secret_volumes = 19; - - // Output only. The name of service revision. - string revision = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // [Preview] Sets the maximum number of concurrent requests that each instance - // can receive. Defaults to 1. - int32 max_instance_request_concurrency = 20; - - // Security level configure whether the function only accepts https. - // This configuration is only applicable to 1st Gen functions with Http - // trigger. By default https is optional for 1st Gen functions; 2nd Gen - // functions are https ONLY. - SecurityLevel security_level = 21; -} - -// Configuration for a secret environment variable. It has the information -// necessary to fetch the secret value from secret manager and expose it as an -// environment variable. -message SecretEnvVar { - // Name of the environment variable. - string key = 1; - - // Project identifier (preferably project number but can also be the - // project ID) of the project that contains the secret. If not set, it is - // assumed that the secret is in the same project as the function. - string project_id = 2; - - // Name of the secret in secret manager (not the full resource name). - string secret = 3; - - // Version of the secret (version number or the string 'latest'). It is - // recommended to use a numeric version for secret environment variables as - // any updates to the secret value is not reflected until new instances - // start. - string version = 4; -} - -// Configuration for a secret volume. It has the information necessary to fetch -// the secret value from secret manager and make it available as files mounted -// at the requested paths within the application container. -message SecretVolume { - // Configuration for a single version. - message SecretVersion { - // Version of the secret (version number or the string 'latest'). It is - // preferable to use `latest` version with secret volumes as secret value - // changes are reflected immediately. - string version = 1; - - // Relative path of the file under the mount path where the secret value for - // this version will be fetched and made available. For example, setting the - // mount_path as '/etc/secrets' and path as `secret_foo` would mount the - // secret value file at `/etc/secrets/secret_foo`. - string path = 2; - } - - // The path within the container to mount the secret volume. For example, - // setting the mount_path as `/etc/secrets` would mount the secret value files - // under the `/etc/secrets` directory. This directory will also be completely - // shadowed and unavailable to mount any other secrets. - // Recommended mount path: /etc/secrets - string mount_path = 1; - - // Project identifier (preferably project number but can also be the project - // ID) of the project that contains the secret. If not set, it is - // assumed that the secret is in the same project as the function. - string project_id = 2; - - // Name of the secret in secret manager (not the full resource name). - string secret = 3; - - // List of secret versions to mount for this secret. If empty, the `latest` - // version of the secret will be made available in a file named after the - // secret under the mount point. - repeated SecretVersion versions = 4; -} - -// Describes EventTrigger, used to request events to be sent from another -// service. -message EventTrigger { - // Describes the retry policy in case of function's execution failure. - // Retried execution is charged as any other execution. - enum RetryPolicy { - // Not specified. - RETRY_POLICY_UNSPECIFIED = 0; - - // Do not retry. - RETRY_POLICY_DO_NOT_RETRY = 1; - - // Retry on any failure, retry up to 7 days with an exponential backoff - // (capped at 10 seconds). - RETRY_POLICY_RETRY = 2; - } - - // Output only. The resource name of the Eventarc trigger. The format of this - // field is `projects/{project}/locations/{region}/triggers/{trigger}`. - string trigger = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "eventarc.googleapis.com/Trigger" - } - ]; - - // The region that the trigger will be in. The trigger will only receive - // events originating in this region. It can be the same - // region as the function, a different region or multi-region, or the global - // region. If not provided, defaults to the same region as the function. - string trigger_region = 2; - - // Required. The type of event to observe. For example: - // `google.cloud.audit.log.v1.written` or - // `google.cloud.pubsub.topic.v1.messagePublished`. - string event_type = 3 [(google.api.field_behavior) = REQUIRED]; - - // Criteria used to filter events. - repeated EventFilter event_filters = 4; - - // Optional. The name of a Pub/Sub topic in the same project that will be used - // as the transport topic for the event delivery. Format: - // `projects/{project}/topics/{topic}`. - // - // This is only valid for events of type - // `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here - // will not be deleted at function deletion. - string pubsub_topic = 5 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // Optional. The email of the trigger's service account. The service account - // must have permission to invoke Cloud Run services, the permission is - // `run.routes.invoke`. - // If empty, defaults to the Compute Engine default service account: - // `{project_number}-compute@developer.gserviceaccount.com`. - string service_account_email = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If unset, then defaults to ignoring failures (i.e. not retrying - // them). - RetryPolicy retry_policy = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The name of the channel associated with the trigger in - // `projects/{project}/locations/{location}/channels/{channel}` format. - // You must provide a channel to receive events from Eventarc SaaS partners. - string channel = 8 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - type: "eventarc.googleapis.com/Channel" - } - ]; -} - -// Filters events based on exact matches on the CloudEvents attributes. -message EventFilter { - // Required. The name of a CloudEvents attribute. - string attribute = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The value for the attribute. - string value = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The operator used for matching the events with the value of the - // filter. If not specified, only events that have an exact key-value pair - // specified in the filter are matched. The only allowed value is - // `match-path-pattern`. - string operator = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for the `GetFunction` method. -message GetFunctionRequest { - // Required. The name of the function which details should be obtained. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudfunctions.googleapis.com/Function" - } - ]; -} - -// Request for the `ListFunctions` method. -message ListFunctionsRequest { - // Required. The project and location from which the function should be - // listed, specified in the format `projects/*/locations/*` If you want to - // list functions in all locations, use "-" in place of a location. When - // listing functions in all locations, if one or more location(s) are - // unreachable, the response will contain functions from all reachable - // locations along with the names of any unreachable locations. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudfunctions.googleapis.com/Function" - } - ]; - - // Maximum number of functions to return per call. The largest allowed - // page_size is 1,000, if the page_size is omitted or specified as greater - // than 1,000 then it will be replaced as 1,000. The size of the list - // response can be less than specified when used with filters. - int32 page_size = 2; - - // The value returned by the last - // `ListFunctionsResponse`; indicates that - // this is a continuation of a prior `ListFunctions` call, and that the - // system should return the next page of data. - string page_token = 3; - - // The filter for Functions that match the filter expression, - // following the syntax outlined in https://google.aip.dev/160. - string filter = 4; - - // The sorting order of the resources returned. Value should be a comma - // separated list of fields. The default sorting oder is ascending. - // See https://google.aip.dev/132#ordering. - string order_by = 5; -} - -// Response for the `ListFunctions` method. -message ListFunctionsResponse { - // The functions that match the request. - repeated Function functions = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. The response does not include any - // functions from these locations. - repeated string unreachable = 3; -} - -// Request for the `CreateFunction` method. -message CreateFunctionRequest { - // Required. The project and location in which the function should be created, - // specified in the format `projects/*/locations/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. Function to be created. - Function function = 2 [(google.api.field_behavior) = REQUIRED]; - - // The ID to use for the function, which will become the final component of - // the function's resource name. - // - // This value should be 4-63 characters, and valid characters - // are /[a-z][0-9]-/. - string function_id = 3; -} - -// Request for the `UpdateFunction` method. -message UpdateFunctionRequest { - // Required. New version of the function. - Function function = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. - // If no field mask is provided, all provided fields in the request will be - // updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request for the `DeleteFunction` method. -message DeleteFunctionRequest { - // Required. The name of the function which should be deleted. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudfunctions.googleapis.com/Function" - } - ]; -} - -// Request of `GenerateSourceUploadUrl` method. -message GenerateUploadUrlRequest { - // Required. The project and location in which the Google Cloud Storage signed - // URL should be generated, specified in the format `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // [Preview] Resource name of a KMS crypto key (managed by the user) used to - // encrypt/decrypt function source code objects in intermediate Cloud Storage - // buckets. When you generate an upload url and upload your source code, it - // gets copied to an intermediate Cloud Storage bucket. The source code is - // then copied to a versioned directory in the sources bucket in the consumer - // project during the function deployment. - // - // It must match the pattern - // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - // - // The Google Cloud Functions service account - // (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - // granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - // (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - // Key/KeyRing/Project/Organization (least access preferred). - string kms_key_name = 2 [(google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - }]; -} - -// Response of `GenerateSourceUploadUrl` method. -message GenerateUploadUrlResponse { - // The generated Google Cloud Storage signed URL that should be used for a - // function source code upload. The uploaded file should be a zip archive - // which contains a function. - string upload_url = 1; - - // The location of the source code in the upload bucket. - // - // Once the archive is uploaded using the `upload_url` use this field to - // set the `function.build_config.source.storage_source` - // during CreateFunction and UpdateFunction. - // - // Generation defaults to 0, as Cloud Storage provides a new generation only - // upon uploading a new object or version of an object. - StorageSource storage_source = 2; -} - -// Request of `GenerateDownloadUrl` method. -message GenerateDownloadUrlRequest { - // Required. The name of function for which source code Google Cloud Storage - // signed URL should be generated. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudfunctions.googleapis.com/Function" - } - ]; -} - -// Response of `GenerateDownloadUrl` method. -message GenerateDownloadUrlResponse { - // The generated Google Cloud Storage signed URL that should be used for - // function source code download. - string download_url = 1; -} - -// Request for the `ListRuntimes` method. -message ListRuntimesRequest { - // Required. The project and location from which the runtimes should be - // listed, specified in the format `projects/*/locations/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The filter for Runtimes that match the filter expression, - // following the syntax outlined in https://google.aip.dev/160. - string filter = 2; -} - -// Response for the `ListRuntimes` method. -message ListRuntimesResponse { - // Describes a runtime and any special information (e.g., deprecation status) - // related to it. - message Runtime { - // The name of the runtime, e.g., 'go113', 'nodejs12', etc. - string name = 1; - - // The user facing name, eg 'Go 1.13', 'Node.js 12', etc. - string display_name = 5; - - // The stage of life this runtime is in, e.g., BETA, GA, etc. - RuntimeStage stage = 2; - - // Warning messages, e.g., a deprecation warning. - repeated string warnings = 3; - - // The environment for the runtime. - Environment environment = 4; - } - - // The various stages that a runtime can be in. - enum RuntimeStage { - // Not specified. - RUNTIME_STAGE_UNSPECIFIED = 0; - - // The runtime is in development. - DEVELOPMENT = 1; - - // The runtime is in the Alpha stage. - ALPHA = 2; - - // The runtime is in the Beta stage. - BETA = 3; - - // The runtime is generally available. - GA = 4; - - // The runtime is deprecated. - DEPRECATED = 5; - - // The runtime is no longer supported. - DECOMMISSIONED = 6; - } - - // The runtimes that match the request. - repeated Runtime runtimes = 1; -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // The time the operation was created. - google.protobuf.Timestamp create_time = 1; - - // The time the operation finished running. - google.protobuf.Timestamp end_time = 2; - - // Server-defined resource path for the target of the operation. - string target = 3; - - // Name of the verb executed by the operation. - string verb = 4; - - // Human-readable status of the operation, if any. - string status_detail = 5; - - // Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a - // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - // `Code.CANCELLED`. - bool cancel_requested = 6; - - // API version used to start the operation. - string api_version = 7; - - // The original request that started the operation. - google.protobuf.Any request_resource = 8; - - // Mechanism for reporting in-progress stages - repeated Stage stages = 9; -} - -// Extra GCF specific location information. -message LocationMetadata { - // The Cloud Function environments this location supports. - repeated Environment environments = 1; -} - -// Each Stage of the deployment process -message Stage { - // Possible names for a Stage - enum Name { - // Not specified. Invalid name. - NAME_UNSPECIFIED = 0; - - // Artifact Regsitry Stage - ARTIFACT_REGISTRY = 1; - - // Build Stage - BUILD = 2; - - // Service Stage - SERVICE = 3; - - // Trigger Stage - TRIGGER = 4; - - // Service Rollback Stage - SERVICE_ROLLBACK = 5; - - // Trigger Rollback Stage - TRIGGER_ROLLBACK = 6; - } - - // Possible states for a Stage - enum State { - // Not specified. Invalid state. - STATE_UNSPECIFIED = 0; - - // Stage has not started. - NOT_STARTED = 1; - - // Stage is in progress. - IN_PROGRESS = 2; - - // Stage has completed. - COMPLETE = 3; - } - - // Name of the Stage. This will be unique for each Stage. - Name name = 1; - - // Message describing the Stage - string message = 2; - - // Current state of the Stage - State state = 3; - - // Resource of the Stage - string resource = 4; - - // Link to the current Stage resource - string resource_uri = 5; - - // State messages from the current Stage. - repeated StateMessage state_messages = 6; -} diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.create_function.js b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.create_function.js deleted file mode 100644 index 0f5680a4aa3..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.create_function.js +++ /dev/null @@ -1,75 +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, function1) { - // [START cloudfunctions_v2alpha_generated_FunctionService_CreateFunction_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 project and location in which the function should be created, - * specified in the format `projects/* /locations/*` - */ - // const parent = 'abc123' - /** - * Required. Function to be created. - */ - // const function = {} - /** - * The ID to use for the function, which will become the final component of - * the function's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - */ - // const functionId = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callCreateFunction() { - // Construct request - const request = { - parent, - function1, - }; - - // Run request - const [operation] = await functionsClient.createFunction(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateFunction(); - // [END cloudfunctions_v2alpha_generated_FunctionService_CreateFunction_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-functions/v2alpha/samples/generated/v2alpha/function_service.delete_function.js b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.delete_function.js deleted file mode 100644 index d835bb0b47e..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.delete_function.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 cloudfunctions_v2alpha_generated_FunctionService_DeleteFunction_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the function which should be deleted. - */ - // const name = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callDeleteFunction() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await functionsClient.deleteFunction(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteFunction(); - // [END cloudfunctions_v2alpha_generated_FunctionService_DeleteFunction_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-functions/v2alpha/samples/generated/v2alpha/function_service.generate_download_url.js b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.generate_download_url.js deleted file mode 100644 index aef6c59f518..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.generate_download_url.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 cloudfunctions_v2alpha_generated_FunctionService_GenerateDownloadUrl_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of function for which source code Google Cloud Storage - * signed URL should be generated. - */ - // const name = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callGenerateDownloadUrl() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await functionsClient.generateDownloadUrl(request); - console.log(response); - } - - callGenerateDownloadUrl(); - // [END cloudfunctions_v2alpha_generated_FunctionService_GenerateDownloadUrl_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-functions/v2alpha/samples/generated/v2alpha/function_service.generate_upload_url.js b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.generate_upload_url.js deleted file mode 100644 index 06ed9cd3085..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.generate_upload_url.js +++ /dev/null @@ -1,78 +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 cloudfunctions_v2alpha_generated_FunctionService_GenerateUploadUrl_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 project and location in which the Google Cloud Storage signed - * URL should be generated, specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Preview Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). - */ - // const kmsKeyName = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callGenerateUploadUrl() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await functionsClient.generateUploadUrl(request); - console.log(response); - } - - callGenerateUploadUrl(); - // [END cloudfunctions_v2alpha_generated_FunctionService_GenerateUploadUrl_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-functions/v2alpha/samples/generated/v2alpha/function_service.get_function.js b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.get_function.js deleted file mode 100644 index d560d8fb815..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.get_function.js +++ /dev/null @@ -1,61 +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 cloudfunctions_v2alpha_generated_FunctionService_GetFunction_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the function which details should be obtained. - */ - // const name = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callGetFunction() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await functionsClient.getFunction(request); - console.log(response); - } - - callGetFunction(); - // [END cloudfunctions_v2alpha_generated_FunctionService_GetFunction_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-functions/v2alpha/samples/generated/v2alpha/function_service.list_functions.js b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.list_functions.js deleted file mode 100644 index 9e131b18177..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.list_functions.js +++ /dev/null @@ -1,93 +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 cloudfunctions_v2alpha_generated_FunctionService_ListFunctions_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 project and location from which the function should be - * listed, specified in the format `projects/* /locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. - */ - // const parent = 'abc123' - /** - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - */ - // const pageSize = 1234 - /** - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - */ - // const filter = 'abc123' - /** - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - */ - // const orderBy = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callListFunctions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await functionsClient.listFunctionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFunctions(); - // [END cloudfunctions_v2alpha_generated_FunctionService_ListFunctions_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-functions/v2alpha/samples/generated/v2alpha/function_service.list_runtimes.js b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.list_runtimes.js deleted file mode 100644 index 9a5754e50d3..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.list_runtimes.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) { - // [START cloudfunctions_v2alpha_generated_FunctionService_ListRuntimes_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 project and location from which the runtimes should be - * listed, specified in the format `projects/* /locations/*` - */ - // const parent = 'abc123' - /** - * The filter for Runtimes that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - */ - // const filter = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callListRuntimes() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await functionsClient.listRuntimes(request); - console.log(response); - } - - callListRuntimes(); - // [END cloudfunctions_v2alpha_generated_FunctionService_ListRuntimes_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-functions/v2alpha/samples/generated/v2alpha/function_service.update_function.js b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.update_function.js deleted file mode 100644 index 799bde25a65..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/function_service.update_function.js +++ /dev/null @@ -1,68 +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(function1) { - // [START cloudfunctions_v2alpha_generated_FunctionService_UpdateFunction_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. New version of the function. - */ - // const function = {} - /** - * The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. - */ - // const updateMask = {} - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callUpdateFunction() { - // Construct request - const request = { - function1, - }; - - // Run request - const [operation] = await functionsClient.updateFunction(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateFunction(); - // [END cloudfunctions_v2alpha_generated_FunctionService_UpdateFunction_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-functions/v2alpha/samples/generated/v2alpha/snippet_metadata_google.cloud.functions.v2alpha.json b/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/snippet_metadata_google.cloud.functions.v2alpha.json deleted file mode 100644 index 2cf3cbeee32..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/samples/generated/v2alpha/snippet_metadata_google.cloud.functions.v2alpha.json +++ /dev/null @@ -1,371 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-functions", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.functions.v2alpha", - "version": "v2alpha" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_GetFunction_async", - "title": "FunctionService getFunction Sample", - "origin": "API_DEFINITION", - "description": " Returns a function with the given name from the requested project.", - "canonical": true, - "file": "function_service.get_function.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFunction", - "fullName": "google.cloud.functions.v2alpha.FunctionService.GetFunction", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v2alpha.Function", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" - }, - "method": { - "shortName": "GetFunction", - "fullName": "google.cloud.functions.v2alpha.FunctionService.GetFunction", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2alpha.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_ListFunctions_async", - "title": "FunctionService listFunctions Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of functions that belong to the requested project.", - "canonical": true, - "file": "function_service.list_functions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFunctions", - "fullName": "google.cloud.functions.v2alpha.FunctionService.ListFunctions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v2alpha.ListFunctionsResponse", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" - }, - "method": { - "shortName": "ListFunctions", - "fullName": "google.cloud.functions.v2alpha.FunctionService.ListFunctions", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2alpha.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_CreateFunction_async", - "title": "FunctionService createFunction Sample", - "origin": "API_DEFINITION", - "description": " Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return `ALREADY_EXISTS` error.", - "canonical": true, - "file": "function_service.create_function.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFunction", - "fullName": "google.cloud.functions.v2alpha.FunctionService.CreateFunction", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "function", - "type": ".google.cloud.functions.v2alpha.Function" - }, - { - "name": "function_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" - }, - "method": { - "shortName": "CreateFunction", - "fullName": "google.cloud.functions.v2alpha.FunctionService.CreateFunction", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2alpha.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_UpdateFunction_async", - "title": "FunctionService updateFunction Sample", - "origin": "API_DEFINITION", - "description": " Updates existing function.", - "canonical": true, - "file": "function_service.update_function.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFunction", - "fullName": "google.cloud.functions.v2alpha.FunctionService.UpdateFunction", - "async": true, - "parameters": [ - { - "name": "function", - "type": ".google.cloud.functions.v2alpha.Function" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" - }, - "method": { - "shortName": "UpdateFunction", - "fullName": "google.cloud.functions.v2alpha.FunctionService.UpdateFunction", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2alpha.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_DeleteFunction_async", - "title": "FunctionService deleteFunction Sample", - "origin": "API_DEFINITION", - "description": " Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.", - "canonical": true, - "file": "function_service.delete_function.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteFunction", - "fullName": "google.cloud.functions.v2alpha.FunctionService.DeleteFunction", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" - }, - "method": { - "shortName": "DeleteFunction", - "fullName": "google.cloud.functions.v2alpha.FunctionService.DeleteFunction", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2alpha.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_GenerateUploadUrl_async", - "title": "FunctionService generateUploadUrl Sample", - "origin": "API_DEFINITION", - "description": " Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type: application/zip` And this header SHOULD NOT be specified: * `Authorization: Bearer YOUR_TOKEN`", - "canonical": true, - "file": "function_service.generate_upload_url.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateUploadUrl", - "fullName": "google.cloud.functions.v2alpha.FunctionService.GenerateUploadUrl", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "kms_key_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v2alpha.GenerateUploadUrlResponse", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" - }, - "method": { - "shortName": "GenerateUploadUrl", - "fullName": "google.cloud.functions.v2alpha.FunctionService.GenerateUploadUrl", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2alpha.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_GenerateDownloadUrl_async", - "title": "FunctionService generateDownloadUrl Sample", - "origin": "API_DEFINITION", - "description": " Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls", - "canonical": true, - "file": "function_service.generate_download_url.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateDownloadUrl", - "fullName": "google.cloud.functions.v2alpha.FunctionService.GenerateDownloadUrl", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v2alpha.GenerateDownloadUrlResponse", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" - }, - "method": { - "shortName": "GenerateDownloadUrl", - "fullName": "google.cloud.functions.v2alpha.FunctionService.GenerateDownloadUrl", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2alpha.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_ListRuntimes_async", - "title": "FunctionService listRuntimes Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of runtimes that are supported for the requested project.", - "canonical": true, - "file": "function_service.list_runtimes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListRuntimes", - "fullName": "google.cloud.functions.v2alpha.FunctionService.ListRuntimes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v2alpha.ListRuntimesResponse", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" - }, - "method": { - "shortName": "ListRuntimes", - "fullName": "google.cloud.functions.v2alpha.FunctionService.ListRuntimes", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2alpha.FunctionService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/src/index.ts b/owl-bot-staging/google-cloud-functions/v2alpha/src/index.ts deleted file mode 100644 index 0d4a89e06b1..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/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 v2alpha from './v2alpha'; -const FunctionServiceClient = v2alpha.FunctionServiceClient; -type FunctionServiceClient = v2alpha.FunctionServiceClient; -export {v2alpha, FunctionServiceClient}; -export default {v2alpha, FunctionServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_client.ts b/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_client.ts deleted file mode 100644 index 1b23e790c16..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_client.ts +++ /dev/null @@ -1,2197 +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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/function_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './function_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Google Cloud Functions is used to deploy functions that are executed by - * Google in response to various events. Data connected with that event is - * passed to a function as the input data. - * - * A **function** is a resource which describes a function that should be - * executed and how it is triggered. - * @class - * @memberof v2alpha - */ -export class FunctionServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - functionServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of FunctionServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 FunctionServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof FunctionServiceClient; - 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; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - 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 = { - buildPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/builds/{build}' - ), - channelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/channels/{channel}' - ), - connectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/connectors/{connector}' - ), - cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' - ), - functionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/functions/{function}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - repositoryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ), - topicPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/topics/{topic}' - ), - triggerPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/triggers/{trigger}' - ), - workerPoolPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workerPools/{worker_pool}' - ), - }; - - // 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 = { - listFunctions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'functions') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2alpha/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v2alpha/{resource=projects/*/locations/*/functions/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v2alpha/{resource=projects/*/locations/*/functions/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v2alpha/{resource=projects/*/locations/*/functions/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v2alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v2alpha/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createFunctionResponse = protoFilesRoot.lookup( - '.google.cloud.functions.v2alpha.Function') as gax.protobuf.Type; - const createFunctionMetadata = protoFilesRoot.lookup( - '.google.cloud.functions.v2alpha.OperationMetadata') as gax.protobuf.Type; - const updateFunctionResponse = protoFilesRoot.lookup( - '.google.cloud.functions.v2alpha.Function') as gax.protobuf.Type; - const updateFunctionMetadata = protoFilesRoot.lookup( - '.google.cloud.functions.v2alpha.OperationMetadata') as gax.protobuf.Type; - const deleteFunctionResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteFunctionMetadata = protoFilesRoot.lookup( - '.google.cloud.functions.v2alpha.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createFunction: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createFunctionResponse.decode.bind(createFunctionResponse), - createFunctionMetadata.decode.bind(createFunctionMetadata)), - updateFunction: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateFunctionResponse.decode.bind(updateFunctionResponse), - updateFunctionMetadata.decode.bind(updateFunctionMetadata)), - deleteFunction: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteFunctionResponse.decode.bind(deleteFunctionResponse), - deleteFunctionMetadata.decode.bind(deleteFunctionMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.functions.v2alpha.FunctionService', 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.functionServiceStub) { - return this.functionServiceStub; - } - - // Put together the "service stub" for - // google.cloud.functions.v2alpha.FunctionService. - this.functionServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.functions.v2alpha.FunctionService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.functions.v2alpha.FunctionService, - 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 functionServiceStubMethods = - ['getFunction', 'listFunctions', 'createFunction', 'updateFunction', 'deleteFunction', 'generateUploadUrl', 'generateDownloadUrl', 'listRuntimes']; - for (const methodName of functionServiceStubMethods) { - const callPromise = this.functionServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.functionServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'cloudfunctions.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 'cloudfunctions.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 -- - // ------------------- -/** - * Returns a function with the given name from the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the function which details should be obtained. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2alpha.Function|Function}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/function_service.get_function.js - * region_tag:cloudfunctions_v2alpha_generated_FunctionService_GetFunction_async - */ - getFunction( - request?: protos.google.cloud.functions.v2alpha.IGetFunctionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v2alpha.IFunction, - protos.google.cloud.functions.v2alpha.IGetFunctionRequest|undefined, {}|undefined - ]>; - getFunction( - request: protos.google.cloud.functions.v2alpha.IGetFunctionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.functions.v2alpha.IFunction, - protos.google.cloud.functions.v2alpha.IGetFunctionRequest|null|undefined, - {}|null|undefined>): void; - getFunction( - request: protos.google.cloud.functions.v2alpha.IGetFunctionRequest, - callback: Callback< - protos.google.cloud.functions.v2alpha.IFunction, - protos.google.cloud.functions.v2alpha.IGetFunctionRequest|null|undefined, - {}|null|undefined>): void; - getFunction( - request?: protos.google.cloud.functions.v2alpha.IGetFunctionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.functions.v2alpha.IFunction, - protos.google.cloud.functions.v2alpha.IGetFunctionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.functions.v2alpha.IFunction, - protos.google.cloud.functions.v2alpha.IGetFunctionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v2alpha.IFunction, - protos.google.cloud.functions.v2alpha.IGetFunctionRequest|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.getFunction(request, options, callback); - } -/** - * Returns a signed URL for uploading a function source code. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls. - * Once the function source code upload is complete, the used signed - * URL should be provided in CreateFunction or UpdateFunction request - * as a reference to the function source code. - * - * When uploading source code to the generated signed URL, please follow - * these restrictions: - * - * * Source file type should be a zip file. - * * No credentials should be attached - the signed URLs provide access to the - * target bucket using internal service identity; if credentials were - * attached, the identity from the credentials would be used, but that - * identity does not have permissions to upload files to the URL. - * - * When making a HTTP PUT request, these two headers need to be specified: - * - * * `content-type: application/zip` - * - * And this header SHOULD NOT be specified: - * - * * `Authorization: Bearer YOUR_TOKEN` - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location in which the Google Cloud Storage signed - * URL should be generated, specified in the format `projects/* /locations/*`. - * @param {string} request.kmsKeyName - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2alpha.GenerateUploadUrlResponse|GenerateUploadUrlResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/function_service.generate_upload_url.js - * region_tag:cloudfunctions_v2alpha_generated_FunctionService_GenerateUploadUrl_async - */ - generateUploadUrl( - request?: protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest|undefined, {}|undefined - ]>; - generateUploadUrl( - request: protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>): void; - generateUploadUrl( - request: protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest, - callback: Callback< - protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>): void; - generateUploadUrl( - request?: protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest|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.generateUploadUrl(request, options, callback); - } -/** - * Returns a signed URL for downloading deployed function source code. - * The URL is only valid for a limited period and should be used within - * 30 minutes of generation. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of function for which source code Google Cloud Storage - * signed URL should be generated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2alpha.GenerateDownloadUrlResponse|GenerateDownloadUrlResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/function_service.generate_download_url.js - * region_tag:cloudfunctions_v2alpha_generated_FunctionService_GenerateDownloadUrl_async - */ - generateDownloadUrl( - request?: protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest|undefined, {}|undefined - ]>; - generateDownloadUrl( - request: protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>): void; - generateDownloadUrl( - request: protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest, - callback: Callback< - protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>): void; - generateDownloadUrl( - request?: protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest|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.generateDownloadUrl(request, options, callback); - } -/** - * Returns a list of runtimes that are supported for the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the runtimes should be - * listed, specified in the format `projects/* /locations/*` - * @param {string} request.filter - * The filter for Runtimes that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2alpha.ListRuntimesResponse|ListRuntimesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/function_service.list_runtimes.js - * region_tag:cloudfunctions_v2alpha_generated_FunctionService_ListRuntimes_async - */ - listRuntimes( - request?: protos.google.cloud.functions.v2alpha.IListRuntimesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v2alpha.IListRuntimesResponse, - protos.google.cloud.functions.v2alpha.IListRuntimesRequest|undefined, {}|undefined - ]>; - listRuntimes( - request: protos.google.cloud.functions.v2alpha.IListRuntimesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.functions.v2alpha.IListRuntimesResponse, - protos.google.cloud.functions.v2alpha.IListRuntimesRequest|null|undefined, - {}|null|undefined>): void; - listRuntimes( - request: protos.google.cloud.functions.v2alpha.IListRuntimesRequest, - callback: Callback< - protos.google.cloud.functions.v2alpha.IListRuntimesResponse, - protos.google.cloud.functions.v2alpha.IListRuntimesRequest|null|undefined, - {}|null|undefined>): void; - listRuntimes( - request?: protos.google.cloud.functions.v2alpha.IListRuntimesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.functions.v2alpha.IListRuntimesResponse, - protos.google.cloud.functions.v2alpha.IListRuntimesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.functions.v2alpha.IListRuntimesResponse, - protos.google.cloud.functions.v2alpha.IListRuntimesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v2alpha.IListRuntimesResponse, - protos.google.cloud.functions.v2alpha.IListRuntimesRequest|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.listRuntimes(request, options, callback); - } - -/** - * Creates a new function. If a function with the given name already exists in - * the specified project, the long running operation will return - * `ALREADY_EXISTS` error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location in which the function should be created, - * specified in the format `projects/* /locations/*` - * @param {google.cloud.functions.v2alpha.Function} request.function - * Required. Function to be created. - * @param {string} request.functionId - * The ID to use for the function, which will become the final component of - * the function's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /{@link protos.0-9|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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/function_service.create_function.js - * region_tag:cloudfunctions_v2alpha_generated_FunctionService_CreateFunction_async - */ - createFunction( - request?: protos.google.cloud.functions.v2alpha.ICreateFunctionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createFunction( - request: protos.google.cloud.functions.v2alpha.ICreateFunctionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFunction( - request: protos.google.cloud.functions.v2alpha.ICreateFunctionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFunction( - request?: protos.google.cloud.functions.v2alpha.ICreateFunctionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFunction(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createFunction()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/function_service.create_function.js - * region_tag:cloudfunctions_v2alpha_generated_FunctionService_CreateFunction_async - */ - async checkCreateFunctionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFunction, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates existing function. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.functions.v2alpha.Function} request.function - * Required. New version of the function. - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/function_service.update_function.js - * region_tag:cloudfunctions_v2alpha_generated_FunctionService_UpdateFunction_async - */ - updateFunction( - request?: protos.google.cloud.functions.v2alpha.IUpdateFunctionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateFunction( - request: protos.google.cloud.functions.v2alpha.IUpdateFunctionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFunction( - request: protos.google.cloud.functions.v2alpha.IUpdateFunctionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFunction( - request?: protos.google.cloud.functions.v2alpha.IUpdateFunctionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'function.name': request.function!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFunction(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateFunction()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/function_service.update_function.js - * region_tag:cloudfunctions_v2alpha_generated_FunctionService_UpdateFunction_async - */ - async checkUpdateFunctionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFunction, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a function with the given name from the specified project. If the - * given function is used by some trigger, the trigger will be updated to - * remove this function. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the function which should be deleted. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/function_service.delete_function.js - * region_tag:cloudfunctions_v2alpha_generated_FunctionService_DeleteFunction_async - */ - deleteFunction( - request?: protos.google.cloud.functions.v2alpha.IDeleteFunctionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteFunction( - request: protos.google.cloud.functions.v2alpha.IDeleteFunctionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFunction( - request: protos.google.cloud.functions.v2alpha.IDeleteFunctionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFunction( - request?: protos.google.cloud.functions.v2alpha.IDeleteFunctionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteFunction(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteFunction()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/function_service.delete_function.js - * region_tag:cloudfunctions_v2alpha_generated_FunctionService_DeleteFunction_async - */ - async checkDeleteFunctionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFunction, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Returns a list of functions that belong to the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the function should be - * listed, specified in the format `projects/* /locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. - * @param {number} request.pageSize - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - * @param {string} request.pageToken - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * @param {string} request.filter - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2alpha.Function|Function}. - * 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 `listFunctionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFunctions( - request?: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v2alpha.IFunction[], - protos.google.cloud.functions.v2alpha.IListFunctionsRequest|null, - protos.google.cloud.functions.v2alpha.IListFunctionsResponse - ]>; - listFunctions( - request: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.functions.v2alpha.IListFunctionsRequest, - protos.google.cloud.functions.v2alpha.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v2alpha.IFunction>): void; - listFunctions( - request: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, - callback: PaginationCallback< - protos.google.cloud.functions.v2alpha.IListFunctionsRequest, - protos.google.cloud.functions.v2alpha.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v2alpha.IFunction>): void; - listFunctions( - request?: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.functions.v2alpha.IListFunctionsRequest, - protos.google.cloud.functions.v2alpha.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v2alpha.IFunction>, - callback?: PaginationCallback< - protos.google.cloud.functions.v2alpha.IListFunctionsRequest, - protos.google.cloud.functions.v2alpha.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v2alpha.IFunction>): - Promise<[ - protos.google.cloud.functions.v2alpha.IFunction[], - protos.google.cloud.functions.v2alpha.IListFunctionsRequest|null, - protos.google.cloud.functions.v2alpha.IListFunctionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listFunctions(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the function should be - * listed, specified in the format `projects/* /locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. - * @param {number} request.pageSize - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - * @param {string} request.pageToken - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * @param {string} request.filter - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * @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 protos.google.cloud.functions.v2alpha.Function|Function} 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 `listFunctionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFunctionsStream( - request?: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, - 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['listFunctions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFunctions.createStream( - this.innerApiCalls.listFunctions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFunctions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the function should be - * listed, specified in the format `projects/* /locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. - * @param {number} request.pageSize - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - * @param {string} request.pageToken - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * @param {string} request.filter - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.functions.v2alpha.Function|Function}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/function_service.list_functions.js - * region_tag:cloudfunctions_v2alpha_generated_FunctionService_ListFunctions_async - */ - listFunctionsAsync( - request?: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, - 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['listFunctions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFunctions.asyncIterate( - this.innerApiCalls['listFunctions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified build resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} build - * @returns {string} Resource name string. - */ - buildPath(project:string,location:string,build:string) { - return this.pathTemplates.buildPathTemplate.render({ - project: project, - location: location, - build: build, - }); - } - - /** - * Parse the project from Build resource. - * - * @param {string} buildName - * A fully-qualified path representing Build resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBuildName(buildName: string) { - return this.pathTemplates.buildPathTemplate.match(buildName).project; - } - - /** - * Parse the location from Build resource. - * - * @param {string} buildName - * A fully-qualified path representing Build resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBuildName(buildName: string) { - return this.pathTemplates.buildPathTemplate.match(buildName).location; - } - - /** - * Parse the build from Build resource. - * - * @param {string} buildName - * A fully-qualified path representing Build resource. - * @returns {string} A string representing the build. - */ - matchBuildFromBuildName(buildName: string) { - return this.pathTemplates.buildPathTemplate.match(buildName).build; - } - - /** - * Return a fully-qualified channel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} channel - * @returns {string} Resource name string. - */ - channelPath(project:string,location:string,channel:string) { - return this.pathTemplates.channelPathTemplate.render({ - project: project, - location: location, - channel: channel, - }); - } - - /** - * Parse the project from Channel resource. - * - * @param {string} channelName - * A fully-qualified path representing Channel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromChannelName(channelName: string) { - return this.pathTemplates.channelPathTemplate.match(channelName).project; - } - - /** - * Parse the location from Channel resource. - * - * @param {string} channelName - * A fully-qualified path representing Channel resource. - * @returns {string} A string representing the location. - */ - matchLocationFromChannelName(channelName: string) { - return this.pathTemplates.channelPathTemplate.match(channelName).location; - } - - /** - * Parse the channel from Channel resource. - * - * @param {string} channelName - * A fully-qualified path representing Channel resource. - * @returns {string} A string representing the channel. - */ - matchChannelFromChannelName(channelName: string) { - return this.pathTemplates.channelPathTemplate.match(channelName).channel; - } - - /** - * Return a fully-qualified connector resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} connector - * @returns {string} Resource name string. - */ - connectorPath(project:string,location:string,connector:string) { - return this.pathTemplates.connectorPathTemplate.render({ - project: project, - location: location, - connector: connector, - }); - } - - /** - * Parse the project from Connector resource. - * - * @param {string} connectorName - * A fully-qualified path representing Connector resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConnectorName(connectorName: string) { - return this.pathTemplates.connectorPathTemplate.match(connectorName).project; - } - - /** - * Parse the location from Connector resource. - * - * @param {string} connectorName - * A fully-qualified path representing Connector resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConnectorName(connectorName: string) { - return this.pathTemplates.connectorPathTemplate.match(connectorName).location; - } - - /** - * Parse the connector from Connector resource. - * - * @param {string} connectorName - * A fully-qualified path representing Connector resource. - * @returns {string} A string representing the connector. - */ - matchConnectorFromConnectorName(connectorName: string) { - return this.pathTemplates.connectorPathTemplate.match(connectorName).connector; - } - - /** - * Return a fully-qualified cryptoKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @returns {string} Resource name string. - */ - cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { - return this.pathTemplates.cryptoKeyPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - }); - } - - /** - * Parse the project from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; - } - - /** - * Parse the location from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; - } - - /** - * Parse the key_ring from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; - } - - /** - * Parse the crypto_key from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; - } - - /** - * Return a fully-qualified function resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} functionParam - * @returns {string} Resource name string. - */ - functionPath(project:string,location:string,functionParam:string) { - return this.pathTemplates.functionPathTemplate.render({ - project: project, - location: location, - function: functionParam, - }); - } - - /** - * Parse the project from Function resource. - * - * @param {string} functionName - * A fully-qualified path representing Function resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFunctionName(functionName: string) { - return this.pathTemplates.functionPathTemplate.match(functionName).project; - } - - /** - * Parse the location from Function resource. - * - * @param {string} functionName - * A fully-qualified path representing Function resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFunctionName(functionName: string) { - return this.pathTemplates.functionPathTemplate.match(functionName).location; - } - - /** - * Parse the function from Function resource. - * - * @param {string} functionName - * A fully-qualified path representing Function resource. - * @returns {string} A string representing the function. - */ - matchFunctionFromFunctionName(functionName: string) { - return this.pathTemplates.functionPathTemplate.match(functionName).function; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified 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 repository resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @returns {string} Resource name string. - */ - repositoryPath(project:string,location:string,repository:string) { - return this.pathTemplates.repositoryPathTemplate.render({ - project: project, - location: location, - repository: repository, - }); - } - - /** - * Parse the project from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).project; - } - - /** - * Parse the location from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the location. - */ - matchLocationFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).location; - } - - /** - * Parse the repository from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).repository; - } - - /** - * Return a fully-qualified service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - service: service, - }); - } - - /** - * Parse the project from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).project; - } - - /** - * Parse the location from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).location; - } - - /** - * Parse the service from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).service; - } - - /** - * Return a fully-qualified topic resource name string. - * - * @param {string} project - * @param {string} topic - * @returns {string} Resource name string. - */ - topicPath(project:string,topic:string) { - return this.pathTemplates.topicPathTemplate.render({ - project: project, - topic: topic, - }); - } - - /** - * Parse the project from Topic resource. - * - * @param {string} topicName - * A fully-qualified path representing Topic resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTopicName(topicName: string) { - return this.pathTemplates.topicPathTemplate.match(topicName).project; - } - - /** - * Parse the topic from Topic resource. - * - * @param {string} topicName - * A fully-qualified path representing Topic resource. - * @returns {string} A string representing the topic. - */ - matchTopicFromTopicName(topicName: string) { - return this.pathTemplates.topicPathTemplate.match(topicName).topic; - } - - /** - * Return a fully-qualified trigger resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} trigger - * @returns {string} Resource name string. - */ - triggerPath(project:string,location:string,trigger:string) { - return this.pathTemplates.triggerPathTemplate.render({ - project: project, - location: location, - trigger: trigger, - }); - } - - /** - * Parse the project from Trigger resource. - * - * @param {string} triggerName - * A fully-qualified path representing Trigger resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTriggerName(triggerName: string) { - return this.pathTemplates.triggerPathTemplate.match(triggerName).project; - } - - /** - * Parse the location from Trigger resource. - * - * @param {string} triggerName - * A fully-qualified path representing Trigger resource. - * @returns {string} A string representing the location. - */ - matchLocationFromTriggerName(triggerName: string) { - return this.pathTemplates.triggerPathTemplate.match(triggerName).location; - } - - /** - * Parse the trigger from Trigger resource. - * - * @param {string} triggerName - * A fully-qualified path representing Trigger resource. - * @returns {string} A string representing the trigger. - */ - matchTriggerFromTriggerName(triggerName: string) { - return this.pathTemplates.triggerPathTemplate.match(triggerName).trigger; - } - - /** - * Return a fully-qualified workerPool resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} worker_pool - * @returns {string} Resource name string. - */ - workerPoolPath(project:string,location:string,workerPool:string) { - return this.pathTemplates.workerPoolPathTemplate.render({ - project: project, - location: location, - worker_pool: workerPool, - }); - } - - /** - * Parse the project from WorkerPool resource. - * - * @param {string} workerPoolName - * A fully-qualified path representing WorkerPool resource. - * @returns {string} A string representing the project. - */ - matchProjectFromWorkerPoolName(workerPoolName: string) { - return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).project; - } - - /** - * Parse the location from WorkerPool resource. - * - * @param {string} workerPoolName - * A fully-qualified path representing WorkerPool resource. - * @returns {string} A string representing the location. - */ - matchLocationFromWorkerPoolName(workerPoolName: string) { - return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).location; - } - - /** - * Parse the worker_pool from WorkerPool resource. - * - * @param {string} workerPoolName - * A fully-qualified path representing WorkerPool resource. - * @returns {string} A string representing the worker_pool. - */ - matchWorkerPoolFromWorkerPoolName(workerPoolName: string) { - return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).worker_pool; - } - - /** - * 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.functionServiceStub && !this._terminated) { - return this.functionServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_client_config.json b/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_client_config.json deleted file mode 100644 index 2ca6513ccba..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_client_config.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "interfaces": { - "google.cloud.functions.v2alpha.FunctionService": { - "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": { - "GetFunction": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListFunctions": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateFunction": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateFunction": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteFunction": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GenerateUploadUrl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GenerateDownloadUrl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListRuntimes": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_proto_list.json b/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_proto_list.json deleted file mode 100644 index 78acb336bb6..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/function_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/functions/v2alpha/functions.proto" -] diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/gapic_metadata.json b/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/gapic_metadata.json deleted file mode 100644 index eaf1f6d3475..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/gapic_metadata.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.functions.v2alpha", - "libraryPackage": "@google-cloud/functions", - "services": { - "FunctionService": { - "clients": { - "grpc": { - "libraryClient": "FunctionServiceClient", - "rpcs": { - "GetFunction": { - "methods": [ - "getFunction" - ] - }, - "GenerateUploadUrl": { - "methods": [ - "generateUploadUrl" - ] - }, - "GenerateDownloadUrl": { - "methods": [ - "generateDownloadUrl" - ] - }, - "ListRuntimes": { - "methods": [ - "listRuntimes" - ] - }, - "CreateFunction": { - "methods": [ - "createFunction" - ] - }, - "UpdateFunction": { - "methods": [ - "updateFunction" - ] - }, - "DeleteFunction": { - "methods": [ - "deleteFunction" - ] - }, - "ListFunctions": { - "methods": [ - "listFunctions", - "listFunctionsStream", - "listFunctionsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "FunctionServiceClient", - "rpcs": { - "GetFunction": { - "methods": [ - "getFunction" - ] - }, - "GenerateUploadUrl": { - "methods": [ - "generateUploadUrl" - ] - }, - "GenerateDownloadUrl": { - "methods": [ - "generateDownloadUrl" - ] - }, - "ListRuntimes": { - "methods": [ - "listRuntimes" - ] - }, - "CreateFunction": { - "methods": [ - "createFunction" - ] - }, - "UpdateFunction": { - "methods": [ - "updateFunction" - ] - }, - "DeleteFunction": { - "methods": [ - "deleteFunction" - ] - }, - "ListFunctions": { - "methods": [ - "listFunctions", - "listFunctionsStream", - "listFunctionsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/index.ts b/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/index.ts deleted file mode 100644 index ec33a786b85..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/src/v2alpha/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 {FunctionServiceClient} from './function_service_client'; diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-functions/v2alpha/system-test/fixtures/sample/src/index.js deleted file mode 100644 index c41f33eb2a8..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/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 functions = require('@google-cloud/functions'); - -function main() { - const functionServiceClient = new functions.FunctionServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-functions/v2alpha/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 530ace3134e..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/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 {FunctionServiceClient} from '@google-cloud/functions'; - -// check that the client class type name can be used -function doStuffWithFunctionServiceClient(client: FunctionServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const functionServiceClient = new FunctionServiceClient(); - doStuffWithFunctionServiceClient(functionServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/system-test/install.ts b/owl-bot-staging/google-cloud-functions/v2alpha/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/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-functions/v2alpha/test/gapic_function_service_v2alpha.ts b/owl-bot-staging/google-cloud-functions/v2alpha/test/gapic_function_service_v2alpha.ts deleted file mode 100644 index ae797ac80fe..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/test/gapic_function_service_v2alpha.ts +++ /dev/null @@ -1,2584 +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 functionserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2alpha.FunctionServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = functionserviceModule.v2alpha.FunctionServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = functionserviceModule.v2alpha.FunctionServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = functionserviceModule.v2alpha.FunctionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.functionServiceStub, undefined); - await client.initialize(); - assert(client.functionServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.functionServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.functionServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - 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 functionserviceModule.v2alpha.FunctionServiceClient({ - 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('getFunction', () => { - it('invokes getFunction without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.GetFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.GetFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.Function() - ); - client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); - const [response] = await client.getFunction(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFunction without error using callback', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.GetFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.GetFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.Function() - ); - client.innerApiCalls.getFunction = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFunction( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v2alpha.IFunction|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFunction with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.GetFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.GetFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFunction = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFunction(request), expectedError); - const actualRequest = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFunction with closed client', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.GetFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.GetFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFunction(request), expectedError); - }); - }); - - describe('generateUploadUrl', () => { - it('invokes generateUploadUrl without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.GenerateUploadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.GenerateUploadUrlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.GenerateUploadUrlResponse() - ); - client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); - const [response] = await client.generateUploadUrl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateUploadUrl without error using callback', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.GenerateUploadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.GenerateUploadUrlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.GenerateUploadUrlResponse() - ); - client.innerApiCalls.generateUploadUrl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateUploadUrl( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateUploadUrl with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.GenerateUploadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.GenerateUploadUrlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateUploadUrl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateUploadUrl(request), expectedError); - const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateUploadUrl with closed client', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.GenerateUploadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.GenerateUploadUrlRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateUploadUrl(request), expectedError); - }); - }); - - describe('generateDownloadUrl', () => { - it('invokes generateDownloadUrl without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlResponse() - ); - client.innerApiCalls.generateDownloadUrl = stubSimpleCall(expectedResponse); - const [response] = await client.generateDownloadUrl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateDownloadUrl without error using callback', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlResponse() - ); - client.innerApiCalls.generateDownloadUrl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateDownloadUrl( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateDownloadUrl with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateDownloadUrl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateDownloadUrl(request), expectedError); - const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateDownloadUrl with closed client', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateDownloadUrl(request), expectedError); - }); - }); - - describe('listRuntimes', () => { - it('invokes listRuntimes without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.ListRuntimesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.ListRuntimesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.ListRuntimesResponse() - ); - client.innerApiCalls.listRuntimes = stubSimpleCall(expectedResponse); - const [response] = await client.listRuntimes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRuntimes without error using callback', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.ListRuntimesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.ListRuntimesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.ListRuntimesResponse() - ); - client.innerApiCalls.listRuntimes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRuntimes( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v2alpha.IListRuntimesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRuntimes with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.ListRuntimesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.ListRuntimesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRuntimes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRuntimes(request), expectedError); - const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRuntimes with closed client', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.ListRuntimesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.ListRuntimesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listRuntimes(request), expectedError); - }); - }); - - describe('createFunction', () => { - it('invokes createFunction without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.CreateFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.CreateFunctionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFunction = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFunction(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFunction without error using callback', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.CreateFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.CreateFunctionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFunction = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFunction( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFunction with call error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.CreateFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.CreateFunctionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFunction = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFunction(request), expectedError); - const actualRequest = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFunction with LRO error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.CreateFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.CreateFunctionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFunction = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFunction(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateFunctionProgress without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateFunctionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateFunctionProgress with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFunctionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateFunction', () => { - it('invokes updateFunction without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.UpdateFunctionRequest() - ); - request.function ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.UpdateFunctionRequest', ['function', 'name']); - request.function.name = defaultValue1; - const expectedHeaderRequestParams = `function.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFunction = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFunction(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFunction without error using callback', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.UpdateFunctionRequest() - ); - request.function ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.UpdateFunctionRequest', ['function', 'name']); - request.function.name = defaultValue1; - const expectedHeaderRequestParams = `function.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFunction = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFunction( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFunction with call error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.UpdateFunctionRequest() - ); - request.function ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.UpdateFunctionRequest', ['function', 'name']); - request.function.name = defaultValue1; - const expectedHeaderRequestParams = `function.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFunction(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFunction with LRO error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.UpdateFunctionRequest() - ); - request.function ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.UpdateFunctionRequest', ['function', 'name']); - request.function.name = defaultValue1; - const expectedHeaderRequestParams = `function.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFunction(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateFunctionProgress without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateFunctionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateFunctionProgress with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFunctionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteFunction', () => { - it('invokes deleteFunction without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.DeleteFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.DeleteFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFunction = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFunction(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFunction without error using callback', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.DeleteFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.DeleteFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFunction = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFunction( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFunction with call error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.DeleteFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.DeleteFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFunction(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFunction with LRO error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.DeleteFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.DeleteFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFunction(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteFunctionProgress without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteFunctionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteFunctionProgress with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFunctionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listFunctions', () => { - it('invokes listFunctions without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), - ]; - client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); - const [response] = await client.listFunctions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFunctions without error using callback', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), - ]; - client.innerApiCalls.listFunctions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFunctions( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v2alpha.IFunction[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFunctions with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFunctions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFunctions(request), expectedError); - const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFunctionsStream without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), - ]; - client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFunctionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.functions.v2alpha.Function[] = []; - stream.on('data', (response: protos.google.cloud.functions.v2alpha.Function) => { - 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.listFunctions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); - assert( - (client.descriptors.page.listFunctions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFunctionsStream with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFunctionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.functions.v2alpha.Function[] = []; - stream.on('data', (response: protos.google.cloud.functions.v2alpha.Function) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFunctions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); - assert( - (client.descriptors.page.listFunctions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFunctions without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2alpha.Function()), - ]; - client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.functions.v2alpha.IFunction[] = []; - const iterable = client.listFunctionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFunctions with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2alpha.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFunctionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.functions.v2alpha.IFunction[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('build', () => { - const fakePath = "/rendered/path/build"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - build: "buildValue", - }; - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.buildPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.buildPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('buildPath', () => { - const result = client.buildPath("projectValue", "locationValue", "buildValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.buildPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBuildName', () => { - const result = client.matchProjectFromBuildName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.buildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBuildName', () => { - const result = client.matchLocationFromBuildName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.buildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBuildFromBuildName', () => { - const result = client.matchBuildFromBuildName(fakePath); - assert.strictEqual(result, "buildValue"); - assert((client.pathTemplates.buildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('channel', () => { - const fakePath = "/rendered/path/channel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - channel: "channelValue", - }; - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.channelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.channelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('channelPath', () => { - const result = client.channelPath("projectValue", "locationValue", "channelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.channelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromChannelName', () => { - const result = client.matchProjectFromChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromChannelName', () => { - const result = client.matchLocationFromChannelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelFromChannelName', () => { - const result = client.matchChannelFromChannelName(fakePath); - assert.strictEqual(result, "channelValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('connector', () => { - const fakePath = "/rendered/path/connector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - connector: "connectorValue", - }; - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.connectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.connectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('connectorPath', () => { - const result = client.connectorPath("projectValue", "locationValue", "connectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.connectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConnectorName', () => { - const result = client.matchProjectFromConnectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConnectorName', () => { - const result = client.matchLocationFromConnectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConnectorFromConnectorName', () => { - const result = client.matchConnectorFromConnectorName(fakePath); - assert.strictEqual(result, "connectorValue"); - assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('cryptoKey', () => { - const fakePath = "/rendered/path/cryptoKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - }; - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.cryptoKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cryptoKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cryptoKeyPath', () => { - const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCryptoKeyName', () => { - const result = client.matchProjectFromCryptoKeyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCryptoKeyName', () => { - const result = client.matchLocationFromCryptoKeyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromCryptoKeyName', () => { - const result = client.matchKeyRingFromCryptoKeyName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromCryptoKeyName', () => { - const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('function', () => { - const fakePath = "/rendered/path/function"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - function: "functionValue", - }; - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.functionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.functionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('functionPath', () => { - const result = client.functionPath("projectValue", "locationValue", "functionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.functionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFunctionName', () => { - const result = client.matchProjectFromFunctionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.functionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFunctionName', () => { - const result = client.matchLocationFromFunctionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.functionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFunctionFromFunctionName', () => { - const result = client.matchFunctionFromFunctionName(fakePath); - assert.strictEqual(result, "functionValue"); - assert((client.pathTemplates.functionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - 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('repository', () => { - const fakePath = "/rendered/path/repository"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - }; - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.repositoryPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.repositoryPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('repositoryPath', () => { - const result = client.repositoryPath("projectValue", "locationValue", "repositoryValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.repositoryPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRepositoryName', () => { - const result = client.matchProjectFromRepositoryName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromRepositoryName', () => { - const result = client.matchLocationFromRepositoryName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromRepositoryName', () => { - const result = client.matchRepositoryFromRepositoryName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - }; - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePath', () => { - const result = client.servicePath("projectValue", "locationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceName', () => { - const result = client.matchProjectFromServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServiceName', () => { - const result = client.matchLocationFromServiceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('topic', () => { - const fakePath = "/rendered/path/topic"; - const expectedParameters = { - project: "projectValue", - topic: "topicValue", - }; - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.topicPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.topicPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('topicPath', () => { - const result = client.topicPath("projectValue", "topicValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.topicPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTopicName', () => { - const result = client.matchProjectFromTopicName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.topicPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTopicFromTopicName', () => { - const result = client.matchTopicFromTopicName(fakePath); - assert.strictEqual(result, "topicValue"); - assert((client.pathTemplates.topicPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('trigger', () => { - const fakePath = "/rendered/path/trigger"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - trigger: "triggerValue", - }; - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.triggerPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.triggerPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('triggerPath', () => { - const result = client.triggerPath("projectValue", "locationValue", "triggerValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.triggerPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTriggerName', () => { - const result = client.matchProjectFromTriggerName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTriggerName', () => { - const result = client.matchLocationFromTriggerName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTriggerFromTriggerName', () => { - const result = client.matchTriggerFromTriggerName(fakePath); - assert.strictEqual(result, "triggerValue"); - assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('workerPool', () => { - const fakePath = "/rendered/path/workerPool"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - worker_pool: "workerPoolValue", - }; - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workerPoolPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workerPoolPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workerPoolPath', () => { - const result = client.workerPoolPath("projectValue", "locationValue", "workerPoolValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workerPoolPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkerPoolName', () => { - const result = client.matchProjectFromWorkerPoolName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkerPoolName', () => { - const result = client.matchLocationFromWorkerPoolName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkerPoolFromWorkerPoolName', () => { - const result = client.matchWorkerPoolFromWorkerPoolName(fakePath); - assert.strictEqual(result, "workerPoolValue"); - assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-functions/v2alpha/tsconfig.json b/owl-bot-staging/google-cloud-functions/v2alpha/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/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-functions/v2alpha/webpack.config.js b/owl-bot-staging/google-cloud-functions/v2alpha/webpack.config.js deleted file mode 100644 index 527abad554f..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2alpha/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: 'FunctionService', - filename: './function-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-functions/v2beta/.eslintignore b/owl-bot-staging/google-cloud-functions/v2beta/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/.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-functions/v2beta/.eslintrc.json b/owl-bot-staging/google-cloud-functions/v2beta/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-functions/v2beta/.gitignore b/owl-bot-staging/google-cloud-functions/v2beta/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/.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-functions/v2beta/.jsdoc.js b/owl-bot-staging/google-cloud-functions/v2beta/.jsdoc.js deleted file mode 100644 index 43186156cf8..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/.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/functions', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-functions/v2beta/.mocharc.js b/owl-bot-staging/google-cloud-functions/v2beta/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/.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-functions/v2beta/.prettierrc.js b/owl-bot-staging/google-cloud-functions/v2beta/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/.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-functions/v2beta/README.md b/owl-bot-staging/google-cloud-functions/v2beta/README.md deleted file mode 100644 index efb614cf6e7..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/README.md +++ /dev/null @@ -1 +0,0 @@ -Functions: Nodejs Client diff --git a/owl-bot-staging/google-cloud-functions/v2beta/package.json b/owl-bot-staging/google-cloud-functions/v2beta/package.json deleted file mode 100644 index a5e7b166e52..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/functions", - "version": "0.1.0", - "description": "Functions client for Node.js", - "repository": "googleapis/nodejs-functions", - "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 functions", - "functions", - "function service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-functions/v2beta/protos/google/cloud/functions/v2beta/functions.proto b/owl-bot-staging/google-cloud-functions/v2beta/protos/google/cloud/functions/v2beta/functions.proto deleted file mode 100644 index a8f89d5a4f4..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/protos/google/cloud/functions/v2beta/functions.proto +++ /dev/null @@ -1,1147 +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 -// -// 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.functions.v2beta; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/functions/apiv2beta/functionspb;functionspb"; -option java_multiple_files = true; -option java_outer_classname = "FunctionsProto"; -option java_package = "com.google.cloud.functions.v2beta"; -option objc_class_prefix = "GCF"; -option (google.api.resource_definition) = { - type: "artifactregistry.googleapis.com/Repository" - pattern: "projects/{project}/locations/{location}/repositories/{repository}" -}; -option (google.api.resource_definition) = { - type: "cloudbuild.googleapis.com/Build" - pattern: "projects/{project}/locations/{location}/builds/{build}" -}; -option (google.api.resource_definition) = { - type: "cloudbuild.googleapis.com/WorkerPool" - pattern: "projects/{project}/locations/{location}/workerPools/{worker_pool}" -}; -option (google.api.resource_definition) = { - type: "run.googleapis.com/Service" - pattern: "projects/{project}/locations/{location}/services/{service}" -}; -option (google.api.resource_definition) = { - type: "vpcaccess.googleapis.com/Connector" - pattern: "projects/{project}/locations/{location}/connectors/{connector}" -}; -option (google.api.resource_definition) = { - type: "eventarc.googleapis.com/Trigger" - pattern: "projects/{project}/locations/{location}/triggers/{trigger}" -}; -option (google.api.resource_definition) = { - type: "eventarc.googleapis.com/Channel" - pattern: "projects/{project}/locations/{location}/channels/{channel}" -}; -option (google.api.resource_definition) = { - type: "pubsub.googleapis.com/Topic" - pattern: "projects/{project}/topics/{topic}" -}; -option (google.api.resource_definition) = { - type: "cloudkms.googleapis.com/CryptoKey" - pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" -}; - -// Google Cloud Functions is used to deploy functions that are executed by -// Google in response to various events. Data connected with that event is -// passed to a function as the input data. -// -// A **function** is a resource which describes a function that should be -// executed and how it is triggered. -service FunctionService { - option (google.api.default_host) = "cloudfunctions.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Returns a function with the given name from the requested project. - rpc GetFunction(GetFunctionRequest) returns (Function) { - option (google.api.http) = { - get: "/v2beta/{name=projects/*/locations/*/functions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns a list of functions that belong to the requested project. - rpc ListFunctions(ListFunctionsRequest) returns (ListFunctionsResponse) { - option (google.api.http) = { - get: "/v2beta/{parent=projects/*/locations/*}/functions" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a new function. If a function with the given name already exists in - // the specified project, the long running operation will return - // `ALREADY_EXISTS` error. - rpc CreateFunction(CreateFunctionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2beta/{parent=projects/*/locations/*}/functions" - body: "function" - }; - option (google.api.method_signature) = "parent,function,function_id"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.functions.v2beta.Function" - metadata_type: "google.cloud.functions.v2beta.OperationMetadata" - }; - } - - // Updates existing function. - rpc UpdateFunction(UpdateFunctionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v2beta/{function.name=projects/*/locations/*/functions/*}" - body: "function" - }; - option (google.api.method_signature) = "function,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.functions.v2beta.Function" - metadata_type: "google.cloud.functions.v2beta.OperationMetadata" - }; - } - - // Deletes a function with the given name from the specified project. If the - // given function is used by some trigger, the trigger will be updated to - // remove this function. - rpc DeleteFunction(DeleteFunctionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v2beta/{name=projects/*/locations/*/functions/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.functions.v2beta.OperationMetadata" - }; - } - - // Returns a signed URL for uploading a function source code. - // For more information about the signed URL usage see: - // https://cloud.google.com/storage/docs/access-control/signed-urls. - // Once the function source code upload is complete, the used signed - // URL should be provided in CreateFunction or UpdateFunction request - // as a reference to the function source code. - // - // When uploading source code to the generated signed URL, please follow - // these restrictions: - // - // * Source file type should be a zip file. - // * No credentials should be attached - the signed URLs provide access to the - // target bucket using internal service identity; if credentials were - // attached, the identity from the credentials would be used, but that - // identity does not have permissions to upload files to the URL. - // - // When making a HTTP PUT request, these two headers need to be specified: - // - // * `content-type: application/zip` - // - // And this header SHOULD NOT be specified: - // - // * `Authorization: Bearer YOUR_TOKEN` - rpc GenerateUploadUrl(GenerateUploadUrlRequest) - returns (GenerateUploadUrlResponse) { - option (google.api.http) = { - post: "/v2beta/{parent=projects/*/locations/*}/functions:generateUploadUrl" - body: "*" - }; - } - - // Returns a signed URL for downloading deployed function source code. - // The URL is only valid for a limited period and should be used within - // 30 minutes of generation. - // For more information about the signed URL usage see: - // https://cloud.google.com/storage/docs/access-control/signed-urls - rpc GenerateDownloadUrl(GenerateDownloadUrlRequest) - returns (GenerateDownloadUrlResponse) { - option (google.api.http) = { - post: "/v2beta/{name=projects/*/locations/*/functions/*}:generateDownloadUrl" - body: "*" - }; - } - - // Returns a list of runtimes that are supported for the requested project. - rpc ListRuntimes(ListRuntimesRequest) returns (ListRuntimesResponse) { - option (google.api.http) = { - get: "/v2beta/{parent=projects/*/locations/*}/runtimes" - }; - option (google.api.method_signature) = "parent"; - } -} - -// The environment the function is hosted on. -enum Environment { - // Unspecified - ENVIRONMENT_UNSPECIFIED = 0; - - // Gen 1 - GEN_1 = 1; - - // Gen 2 - GEN_2 = 2; -} - -// Describes a Cloud Function that contains user computation executed in -// response to an event. It encapsulates function and trigger configurations. -message Function { - option (google.api.resource) = { - type: "cloudfunctions.googleapis.com/Function" - pattern: "projects/{project}/locations/{location}/functions/{function}" - plural: "functions" - singular: "function" - }; - - // Describes the current state of the function. - enum State { - // Not specified. Invalid state. - STATE_UNSPECIFIED = 0; - - // Function has been successfully deployed and is serving. - ACTIVE = 1; - - // Function deployment failed and the function is not serving. - FAILED = 2; - - // Function is being created or updated. - DEPLOYING = 3; - - // Function is being deleted. - DELETING = 4; - - // Function deployment failed and the function serving state is undefined. - // The function should be updated or deleted to move it out of this state. - UNKNOWN = 5; - } - - // A user-defined name of the function. Function names must be unique - // globally and match pattern `projects/*/locations/*/functions/*` - string name = 1; - - // User-provided description of a function. - string description = 2; - - // Describes the Build step of the function that builds a container from the - // given source. - BuildConfig build_config = 3; - - // Describes the Service being deployed. Currently deploys services to Cloud - // Run (fully managed). - ServiceConfig service_config = 4; - - // An Eventarc trigger managed by Google Cloud Functions that fires events in - // response to a condition in another service. - EventTrigger event_trigger = 5; - - // Output only. State of the function. - State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of a Cloud Function. - google.protobuf.Timestamp update_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels associated with this Cloud Function. - map labels = 8; - - // Output only. State Messages for this Cloud Function. - repeated StateMessage state_messages = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Describe whether the function is 1st Gen or 2nd Gen. - Environment environment = 10; - - // Output only. The deployed url for the function. - string url = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // [Preview] Resource name of a KMS crypto key (managed by the user) used to - // encrypt/decrypt function resources. - // - // It must match the pattern - // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - string kms_key_name = 25 [(google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - }]; -} - -// Informational messages about the state of the Cloud Function or Operation. -message StateMessage { - // Severity of the state message. - enum Severity { - // Not specified. Invalid severity. - SEVERITY_UNSPECIFIED = 0; - - // ERROR-level severity. - ERROR = 1; - - // WARNING-level severity. - WARNING = 2; - - // INFO-level severity. - INFO = 3; - } - - // Severity of the state message. - Severity severity = 1; - - // One-word CamelCase type of the state message. - string type = 2; - - // The message. - string message = 3; -} - -// Location of the source in an archive file in Google Cloud Storage. -message StorageSource { - // Google Cloud Storage bucket containing the source (see - // [Bucket Name - // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - string bucket = 1; - - // Google Cloud Storage object containing the source. - // - // This object must be a gzipped archive file (`.tar.gz`) containing source to - // build. - string object = 2; - - // Google Cloud Storage generation for the object. If the generation is - // omitted, the latest generation will be used. - int64 generation = 3; -} - -// Location of the source in a Google Cloud Source Repository. -message RepoSource { - // A revision within the Cloud Source Repository must be specified in - // one of these ways. - oneof revision { - // Regex matching branches to build. - // - // The syntax of the regular expressions accepted is the syntax accepted by - // RE2 and described at https://github.com/google/re2/wiki/Syntax - string branch_name = 3; - - // Regex matching tags to build. - // - // The syntax of the regular expressions accepted is the syntax accepted by - // RE2 and described at https://github.com/google/re2/wiki/Syntax - string tag_name = 4; - - // Explicit commit SHA to build. - string commit_sha = 5; - } - - // ID of the project that owns the Cloud Source Repository. If omitted, the - // project ID requesting the build is assumed. - string project_id = 1; - - // Name of the Cloud Source Repository. - string repo_name = 2; - - // Directory, relative to the source root, in which to run the build. - // - // This must be a relative path. If a step's `dir` is specified and is an - // absolute path, this value is ignored for that step's execution. - // eg. helloworld (no leading slash allowed) - string dir = 6; - - // Only trigger a build if the revision regex does NOT match the revision - // regex. - bool invert_regex = 7; -} - -// The location of the function source code. -message Source { - // Location of the source. - // At least one source needs to be provided for the deployment to succeed. - oneof source { - // If provided, get the source from this location in Google Cloud Storage. - StorageSource storage_source = 1; - - // If provided, get the source from this location in a Cloud Source - // Repository. - RepoSource repo_source = 2; - } -} - -// Provenance of the source. Ways to find the original source, or verify that -// some source was used for this build. -message SourceProvenance { - // A copy of the build's `source.storage_source`, if exists, with any - // generations resolved. - StorageSource resolved_storage_source = 1; - - // A copy of the build's `source.repo_source`, if exists, with any - // revisions resolved. - RepoSource resolved_repo_source = 2; -} - -// Describes the Build step of the function that builds a container from the -// given source. -message BuildConfig { - // Docker Registry to use for storing function Docker images. - enum DockerRegistry { - // Unspecified. - DOCKER_REGISTRY_UNSPECIFIED = 0; - - // Docker images will be stored in multi-regional Container Registry - // repositories named `gcf`. - CONTAINER_REGISTRY = 1; - - // Docker images will be stored in regional Artifact Registry repositories. - // By default, GCF will create and use repositories named `gcf-artifacts` - // in every region in which a function is deployed. But the repository to - // use can also be specified by the user using the `docker_repository` - // field. - ARTIFACT_REGISTRY = 2; - } - - // Output only. The Cloud Build name of the latest successful deployment of - // the function. - string build = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Build" - } - ]; - - // The runtime in which to run the function. Required when deploying a new - // function, optional when updating an existing function. For a complete - // list of possible choices, see the - // [`gcloud` command - // reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - string runtime = 2; - - // The name of the function (as defined in source code) that will be - // executed. Defaults to the resource name suffix, if not specified. For - // backward compatibility, if function with given name is not found, then the - // system will try to use function named "function". - // For Node.js this is name of a function exported by the module specified - // in `source_location`. - string entry_point = 3; - - // The location of the function source code. - Source source = 4; - - // Output only. A permanent fixed identifier for source. - SourceProvenance source_provenance = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Name of the Cloud Build Custom Worker Pool that should be used to build the - // function. The format of this field is - // `projects/{project}/locations/{region}/workerPools/{workerPool}` where - // {project} and {region} are the project id and region respectively where the - // worker pool is defined and {workerPool} is the short name of the worker - // pool. - // - // If the project id is not the same as the function, then the Cloud - // Functions Service Agent - // (service-@gcf-admin-robot.iam.gserviceaccount.com) must be - // granted the role Cloud Build Custom Workers Builder - // (roles/cloudbuild.customworkers.builder) in the project. - string worker_pool = 5 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - }]; - - // User-provided build-time environment variables for the function - map environment_variables = 6; - - // Docker Registry to use for this deployment. This configuration is only - // applicable to 1st Gen functions, 2nd Gen functions can only use Artifact - // Registry. - // - // If `docker_repository` field is specified, this field will be automatically - // set as `ARTIFACT_REGISTRY`. - // If unspecified, it currently defaults to `CONTAINER_REGISTRY`. - // This field may be overridden by the backend for eligible deployments. - DockerRegistry docker_registry = 10; - - // User managed repository created in Artifact Registry optionally - // with a customer managed encryption key. This is the repository to which the - // function docker image will be pushed after it is built by Cloud Build. - // If unspecified, GCF will create and use a repository named 'gcf-artifacts' - // for every deployed region. - // - // It must match the pattern - // `projects/{project}/locations/{location}/repositories/{repository}`. - // - // Cross-project repositories are not supported. - // Cross-location repositories are not supported. - // Repository format must be 'DOCKER'. - string docker_repository = 7 [(google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/Repository" - }]; -} - -// Describes the Service being deployed. -// Currently Supported : Cloud Run (fully managed). -message ServiceConfig { - // Available egress settings. - // - // This controls what traffic is diverted through the VPC Access Connector - // resource. By default PRIVATE_RANGES_ONLY will be used. - enum VpcConnectorEgressSettings { - // Unspecified. - VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; - - // Use the VPC Access Connector only for private IP space from RFC1918. - PRIVATE_RANGES_ONLY = 1; - - // Force the use of VPC Access Connector for all egress traffic from the - // function. - ALL_TRAFFIC = 2; - } - - // Available ingress settings. - // - // This controls what traffic can reach the function. - // - // If unspecified, ALLOW_ALL will be used. - enum IngressSettings { - // Unspecified. - INGRESS_SETTINGS_UNSPECIFIED = 0; - - // Allow HTTP traffic from public and private sources. - ALLOW_ALL = 1; - - // Allow HTTP traffic from only private VPC sources. - ALLOW_INTERNAL_ONLY = 2; - - // Allow HTTP traffic from private VPC sources and through GCLB. - ALLOW_INTERNAL_AND_GCLB = 3; - } - - // Available security level settings. - // - // This enforces security protocol on function URL. - // - // Security level is only configurable for 1st Gen functions, If unspecified, - // SECURE_OPTIONAL will be used. 2nd Gen functions are SECURE_ALWAYS ONLY. - enum SecurityLevel { - // Unspecified. - SECURITY_LEVEL_UNSPECIFIED = 0; - - // Requests for a URL that match this handler that do not use HTTPS are - // automatically redirected to the HTTPS URL with the same path. Query - // parameters are reserved for the redirect. - SECURE_ALWAYS = 1; - - // Both HTTP and HTTPS requests with URLs that match the handler succeed - // without redirects. The application can examine the request to determine - // which protocol was used and respond accordingly. - SECURE_OPTIONAL = 2; - } - - // Output only. Name of the service associated with a Function. - // The format of this field is - // `projects/{project}/locations/{region}/services/{service}` - string service = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { type: "run.googleapis.com/Service" } - ]; - - // The function execution timeout. Execution is considered failed and - // can be terminated if the function is not completed at the end of the - // timeout period. Defaults to 60 seconds. - int32 timeout_seconds = 2; - - // The amount of memory available for a function. - // Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is - // supplied the value is interpreted as bytes. - // See - // https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go - // a full description. - string available_memory = 13; - - // [Preview] The number of CPUs used in a single container instance. - // Default value is calculated from available memory. - // Supports the same values as Cloud Run, see - // https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements - // Example: "1" indicates 1 vCPU - string available_cpu = 22; - - // Environment variables that shall be available during function execution. - map environment_variables = 4; - - // The limit on the maximum number of function instances that may coexist at a - // given time. - // - // In some cases, such as rapid traffic surges, Cloud Functions may, for a - // short period of time, create more instances than the specified max - // instances limit. If your function cannot tolerate this temporary behavior, - // you may want to factor in a safety margin and set a lower max instances - // value than your function can tolerate. - // - // See the [Max - // Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - // more details. - int32 max_instance_count = 5; - - // The limit on the minimum number of function instances that may coexist at a - // given time. - // - // Function instances are kept in idle state for a short period after they - // finished executing the request to reduce cold start time for subsequent - // requests. Setting a minimum instance count will ensure that the given - // number of instances are kept running in idle state always. This can help - // with cold start times when jump in incoming request count occurs after the - // idle instance would have been stopped in the default case. - int32 min_instance_count = 12; - - // The Serverless VPC Access connector that this cloud function can connect - // to. The format of this field is `projects/*/locations/*/connectors/*`. - string vpc_connector = 6 [(google.api.resource_reference) = { - type: "vpcaccess.googleapis.com/Connector" - }]; - - // The egress settings for the connector, controlling what traffic is diverted - // through it. - VpcConnectorEgressSettings vpc_connector_egress_settings = 7; - - // The ingress settings for the function, controlling what traffic can reach - // it. - IngressSettings ingress_settings = 8; - - // Output only. URI of the Service deployed. - string uri = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The email of the service's service account. If empty, defaults to - // `{project_number}-compute@developer.gserviceaccount.com`. - string service_account_email = 10; - - // Whether 100% of traffic is routed to the latest revision. - // On CreateFunction and UpdateFunction, when set to true, the revision being - // deployed will serve 100% of traffic, ignoring any traffic split settings, - // if any. On GetFunction, true will be returned if the latest revision is - // serving 100% of traffic. - bool all_traffic_on_latest_revision = 16; - - // Secret environment variables configuration. - repeated SecretEnvVar secret_environment_variables = 17; - - // Secret volumes configuration. - repeated SecretVolume secret_volumes = 19; - - // Output only. The name of service revision. - string revision = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // [Preview] Sets the maximum number of concurrent requests that each instance - // can receive. Defaults to 1. - int32 max_instance_request_concurrency = 20; - - // Security level configure whether the function only accepts https. - // This configuration is only applicable to 1st Gen functions with Http - // trigger. By default https is optional for 1st Gen functions; 2nd Gen - // functions are https ONLY. - SecurityLevel security_level = 21; -} - -// Configuration for a secret environment variable. It has the information -// necessary to fetch the secret value from secret manager and expose it as an -// environment variable. -message SecretEnvVar { - // Name of the environment variable. - string key = 1; - - // Project identifier (preferably project number but can also be the - // project ID) of the project that contains the secret. If not set, it is - // assumed that the secret is in the same project as the function. - string project_id = 2; - - // Name of the secret in secret manager (not the full resource name). - string secret = 3; - - // Version of the secret (version number or the string 'latest'). It is - // recommended to use a numeric version for secret environment variables as - // any updates to the secret value is not reflected until new instances - // start. - string version = 4; -} - -// Configuration for a secret volume. It has the information necessary to fetch -// the secret value from secret manager and make it available as files mounted -// at the requested paths within the application container. -message SecretVolume { - // Configuration for a single version. - message SecretVersion { - // Version of the secret (version number or the string 'latest'). It is - // preferable to use `latest` version with secret volumes as secret value - // changes are reflected immediately. - string version = 1; - - // Relative path of the file under the mount path where the secret value for - // this version will be fetched and made available. For example, setting the - // mount_path as '/etc/secrets' and path as `secret_foo` would mount the - // secret value file at `/etc/secrets/secret_foo`. - string path = 2; - } - - // The path within the container to mount the secret volume. For example, - // setting the mount_path as `/etc/secrets` would mount the secret value files - // under the `/etc/secrets` directory. This directory will also be completely - // shadowed and unavailable to mount any other secrets. - // Recommended mount path: /etc/secrets - string mount_path = 1; - - // Project identifier (preferably project number but can also be the project - // ID) of the project that contains the secret. If not set, it is - // assumed that the secret is in the same project as the function. - string project_id = 2; - - // Name of the secret in secret manager (not the full resource name). - string secret = 3; - - // List of secret versions to mount for this secret. If empty, the `latest` - // version of the secret will be made available in a file named after the - // secret under the mount point. - repeated SecretVersion versions = 4; -} - -// Describes EventTrigger, used to request events to be sent from another -// service. -message EventTrigger { - // Describes the retry policy in case of function's execution failure. - // Retried execution is charged as any other execution. - enum RetryPolicy { - // Not specified. - RETRY_POLICY_UNSPECIFIED = 0; - - // Do not retry. - RETRY_POLICY_DO_NOT_RETRY = 1; - - // Retry on any failure, retry up to 7 days with an exponential backoff - // (capped at 10 seconds). - RETRY_POLICY_RETRY = 2; - } - - // Output only. The resource name of the Eventarc trigger. The format of this - // field is `projects/{project}/locations/{region}/triggers/{trigger}`. - string trigger = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "eventarc.googleapis.com/Trigger" - } - ]; - - // The region that the trigger will be in. The trigger will only receive - // events originating in this region. It can be the same - // region as the function, a different region or multi-region, or the global - // region. If not provided, defaults to the same region as the function. - string trigger_region = 2; - - // Required. The type of event to observe. For example: - // `google.cloud.audit.log.v1.written` or - // `google.cloud.pubsub.topic.v1.messagePublished`. - string event_type = 3 [(google.api.field_behavior) = REQUIRED]; - - // Criteria used to filter events. - repeated EventFilter event_filters = 4; - - // Optional. The name of a Pub/Sub topic in the same project that will be used - // as the transport topic for the event delivery. Format: - // `projects/{project}/topics/{topic}`. - // - // This is only valid for events of type - // `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here - // will not be deleted at function deletion. - string pubsub_topic = 5 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // Optional. The email of the trigger's service account. The service account - // must have permission to invoke Cloud Run services, the permission is - // `run.routes.invoke`. - // If empty, defaults to the Compute Engine default service account: - // `{project_number}-compute@developer.gserviceaccount.com`. - string service_account_email = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If unset, then defaults to ignoring failures (i.e. not retrying - // them). - RetryPolicy retry_policy = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The name of the channel associated with the trigger in - // `projects/{project}/locations/{location}/channels/{channel}` format. - // You must provide a channel to receive events from Eventarc SaaS partners. - string channel = 8 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - type: "eventarc.googleapis.com/Channel" - } - ]; -} - -// Filters events based on exact matches on the CloudEvents attributes. -message EventFilter { - // Required. The name of a CloudEvents attribute. - string attribute = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The value for the attribute. - string value = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The operator used for matching the events with the value of the - // filter. If not specified, only events that have an exact key-value pair - // specified in the filter are matched. The only allowed value is - // `match-path-pattern`. - string operator = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for the `GetFunction` method. -message GetFunctionRequest { - // Required. The name of the function which details should be obtained. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudfunctions.googleapis.com/Function" - } - ]; -} - -// Request for the `ListFunctions` method. -message ListFunctionsRequest { - // Required. The project and location from which the function should be - // listed, specified in the format `projects/*/locations/*` If you want to - // list functions in all locations, use "-" in place of a location. When - // listing functions in all locations, if one or more location(s) are - // unreachable, the response will contain functions from all reachable - // locations along with the names of any unreachable locations. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudfunctions.googleapis.com/Function" - } - ]; - - // Maximum number of functions to return per call. The largest allowed - // page_size is 1,000, if the page_size is omitted or specified as greater - // than 1,000 then it will be replaced as 1,000. The size of the list - // response can be less than specified when used with filters. - int32 page_size = 2; - - // The value returned by the last - // `ListFunctionsResponse`; indicates that - // this is a continuation of a prior `ListFunctions` call, and that the - // system should return the next page of data. - string page_token = 3; - - // The filter for Functions that match the filter expression, - // following the syntax outlined in https://google.aip.dev/160. - string filter = 4; - - // The sorting order of the resources returned. Value should be a comma - // separated list of fields. The default sorting oder is ascending. - // See https://google.aip.dev/132#ordering. - string order_by = 5; -} - -// Response for the `ListFunctions` method. -message ListFunctionsResponse { - // The functions that match the request. - repeated Function functions = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. The response does not include any - // functions from these locations. - repeated string unreachable = 3; -} - -// Request for the `CreateFunction` method. -message CreateFunctionRequest { - // Required. The project and location in which the function should be created, - // specified in the format `projects/*/locations/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. Function to be created. - Function function = 2 [(google.api.field_behavior) = REQUIRED]; - - // The ID to use for the function, which will become the final component of - // the function's resource name. - // - // This value should be 4-63 characters, and valid characters - // are /[a-z][0-9]-/. - string function_id = 3; -} - -// Request for the `UpdateFunction` method. -message UpdateFunctionRequest { - // Required. New version of the function. - Function function = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. - // If no field mask is provided, all provided fields in the request will be - // updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request for the `DeleteFunction` method. -message DeleteFunctionRequest { - // Required. The name of the function which should be deleted. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudfunctions.googleapis.com/Function" - } - ]; -} - -// Request of `GenerateSourceUploadUrl` method. -message GenerateUploadUrlRequest { - // Required. The project and location in which the Google Cloud Storage signed - // URL should be generated, specified in the format `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // [Preview] Resource name of a KMS crypto key (managed by the user) used to - // encrypt/decrypt function source code objects in intermediate Cloud Storage - // buckets. When you generate an upload url and upload your source code, it - // gets copied to an intermediate Cloud Storage bucket. The source code is - // then copied to a versioned directory in the sources bucket in the consumer - // project during the function deployment. - // - // It must match the pattern - // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - // - // The Google Cloud Functions service account - // (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - // granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - // (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - // Key/KeyRing/Project/Organization (least access preferred). - string kms_key_name = 2 [(google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - }]; -} - -// Response of `GenerateSourceUploadUrl` method. -message GenerateUploadUrlResponse { - // The generated Google Cloud Storage signed URL that should be used for a - // function source code upload. The uploaded file should be a zip archive - // which contains a function. - string upload_url = 1; - - // The location of the source code in the upload bucket. - // - // Once the archive is uploaded using the `upload_url` use this field to - // set the `function.build_config.source.storage_source` - // during CreateFunction and UpdateFunction. - // - // Generation defaults to 0, as Cloud Storage provides a new generation only - // upon uploading a new object or version of an object. - StorageSource storage_source = 2; -} - -// Request of `GenerateDownloadUrl` method. -message GenerateDownloadUrlRequest { - // Required. The name of function for which source code Google Cloud Storage - // signed URL should be generated. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudfunctions.googleapis.com/Function" - } - ]; -} - -// Response of `GenerateDownloadUrl` method. -message GenerateDownloadUrlResponse { - // The generated Google Cloud Storage signed URL that should be used for - // function source code download. - string download_url = 1; -} - -// Request for the `ListRuntimes` method. -message ListRuntimesRequest { - // Required. The project and location from which the runtimes should be - // listed, specified in the format `projects/*/locations/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The filter for Runtimes that match the filter expression, - // following the syntax outlined in https://google.aip.dev/160. - string filter = 2; -} - -// Response for the `ListRuntimes` method. -message ListRuntimesResponse { - // Describes a runtime and any special information (e.g., deprecation status) - // related to it. - message Runtime { - // The name of the runtime, e.g., 'go113', 'nodejs12', etc. - string name = 1; - - // The user facing name, eg 'Go 1.13', 'Node.js 12', etc. - string display_name = 5; - - // The stage of life this runtime is in, e.g., BETA, GA, etc. - RuntimeStage stage = 2; - - // Warning messages, e.g., a deprecation warning. - repeated string warnings = 3; - - // The environment for the runtime. - Environment environment = 4; - } - - // The various stages that a runtime can be in. - enum RuntimeStage { - // Not specified. - RUNTIME_STAGE_UNSPECIFIED = 0; - - // The runtime is in development. - DEVELOPMENT = 1; - - // The runtime is in the Alpha stage. - ALPHA = 2; - - // The runtime is in the Beta stage. - BETA = 3; - - // The runtime is generally available. - GA = 4; - - // The runtime is deprecated. - DEPRECATED = 5; - - // The runtime is no longer supported. - DECOMMISSIONED = 6; - } - - // The runtimes that match the request. - repeated Runtime runtimes = 1; -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // The time the operation was created. - google.protobuf.Timestamp create_time = 1; - - // The time the operation finished running. - google.protobuf.Timestamp end_time = 2; - - // Server-defined resource path for the target of the operation. - string target = 3; - - // Name of the verb executed by the operation. - string verb = 4; - - // Human-readable status of the operation, if any. - string status_detail = 5; - - // Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a - // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - // `Code.CANCELLED`. - bool cancel_requested = 6; - - // API version used to start the operation. - string api_version = 7; - - // The original request that started the operation. - google.protobuf.Any request_resource = 8; - - // Mechanism for reporting in-progress stages - repeated Stage stages = 9; -} - -// Extra GCF specific location information. -message LocationMetadata { - // The Cloud Function environments this location supports. - repeated Environment environments = 1; -} - -// Each Stage of the deployment process -message Stage { - // Possible names for a Stage - enum Name { - // Not specified. Invalid name. - NAME_UNSPECIFIED = 0; - - // Artifact Regsitry Stage - ARTIFACT_REGISTRY = 1; - - // Build Stage - BUILD = 2; - - // Service Stage - SERVICE = 3; - - // Trigger Stage - TRIGGER = 4; - - // Service Rollback Stage - SERVICE_ROLLBACK = 5; - - // Trigger Rollback Stage - TRIGGER_ROLLBACK = 6; - } - - // Possible states for a Stage - enum State { - // Not specified. Invalid state. - STATE_UNSPECIFIED = 0; - - // Stage has not started. - NOT_STARTED = 1; - - // Stage is in progress. - IN_PROGRESS = 2; - - // Stage has completed. - COMPLETE = 3; - } - - // Name of the Stage. This will be unique for each Stage. - Name name = 1; - - // Message describing the Stage - string message = 2; - - // Current state of the Stage - State state = 3; - - // Resource of the Stage - string resource = 4; - - // Link to the current Stage resource - string resource_uri = 5; - - // State messages from the current Stage. - repeated StateMessage state_messages = 6; -} diff --git a/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.create_function.js b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.create_function.js deleted file mode 100644 index aed5e22444d..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.create_function.js +++ /dev/null @@ -1,75 +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, function1) { - // [START cloudfunctions_v2beta_generated_FunctionService_CreateFunction_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 project and location in which the function should be created, - * specified in the format `projects/* /locations/*` - */ - // const parent = 'abc123' - /** - * Required. Function to be created. - */ - // const function = {} - /** - * The ID to use for the function, which will become the final component of - * the function's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - */ - // const functionId = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callCreateFunction() { - // Construct request - const request = { - parent, - function1, - }; - - // Run request - const [operation] = await functionsClient.createFunction(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateFunction(); - // [END cloudfunctions_v2beta_generated_FunctionService_CreateFunction_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-functions/v2beta/samples/generated/v2beta/function_service.delete_function.js b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.delete_function.js deleted file mode 100644 index 32bcd8d5058..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.delete_function.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 cloudfunctions_v2beta_generated_FunctionService_DeleteFunction_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the function which should be deleted. - */ - // const name = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callDeleteFunction() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await functionsClient.deleteFunction(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteFunction(); - // [END cloudfunctions_v2beta_generated_FunctionService_DeleteFunction_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-functions/v2beta/samples/generated/v2beta/function_service.generate_download_url.js b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.generate_download_url.js deleted file mode 100644 index cc28d633047..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.generate_download_url.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 cloudfunctions_v2beta_generated_FunctionService_GenerateDownloadUrl_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of function for which source code Google Cloud Storage - * signed URL should be generated. - */ - // const name = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callGenerateDownloadUrl() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await functionsClient.generateDownloadUrl(request); - console.log(response); - } - - callGenerateDownloadUrl(); - // [END cloudfunctions_v2beta_generated_FunctionService_GenerateDownloadUrl_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-functions/v2beta/samples/generated/v2beta/function_service.generate_upload_url.js b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.generate_upload_url.js deleted file mode 100644 index a148b14523d..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.generate_upload_url.js +++ /dev/null @@ -1,78 +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 cloudfunctions_v2beta_generated_FunctionService_GenerateUploadUrl_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 project and location in which the Google Cloud Storage signed - * URL should be generated, specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Preview Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). - */ - // const kmsKeyName = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callGenerateUploadUrl() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await functionsClient.generateUploadUrl(request); - console.log(response); - } - - callGenerateUploadUrl(); - // [END cloudfunctions_v2beta_generated_FunctionService_GenerateUploadUrl_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-functions/v2beta/samples/generated/v2beta/function_service.get_function.js b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.get_function.js deleted file mode 100644 index 0c61728a517..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.get_function.js +++ /dev/null @@ -1,61 +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 cloudfunctions_v2beta_generated_FunctionService_GetFunction_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the function which details should be obtained. - */ - // const name = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callGetFunction() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await functionsClient.getFunction(request); - console.log(response); - } - - callGetFunction(); - // [END cloudfunctions_v2beta_generated_FunctionService_GetFunction_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-functions/v2beta/samples/generated/v2beta/function_service.list_functions.js b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.list_functions.js deleted file mode 100644 index c1eaa32538e..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.list_functions.js +++ /dev/null @@ -1,93 +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 cloudfunctions_v2beta_generated_FunctionService_ListFunctions_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 project and location from which the function should be - * listed, specified in the format `projects/* /locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. - */ - // const parent = 'abc123' - /** - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - */ - // const pageSize = 1234 - /** - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - */ - // const filter = 'abc123' - /** - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - */ - // const orderBy = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callListFunctions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await functionsClient.listFunctionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFunctions(); - // [END cloudfunctions_v2beta_generated_FunctionService_ListFunctions_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-functions/v2beta/samples/generated/v2beta/function_service.list_runtimes.js b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.list_runtimes.js deleted file mode 100644 index 7e10600b474..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.list_runtimes.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) { - // [START cloudfunctions_v2beta_generated_FunctionService_ListRuntimes_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 project and location from which the runtimes should be - * listed, specified in the format `projects/* /locations/*` - */ - // const parent = 'abc123' - /** - * The filter for Runtimes that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - */ - // const filter = 'abc123' - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callListRuntimes() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await functionsClient.listRuntimes(request); - console.log(response); - } - - callListRuntimes(); - // [END cloudfunctions_v2beta_generated_FunctionService_ListRuntimes_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-functions/v2beta/samples/generated/v2beta/function_service.update_function.js b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.update_function.js deleted file mode 100644 index dd0d2483a80..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/function_service.update_function.js +++ /dev/null @@ -1,68 +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(function1) { - // [START cloudfunctions_v2beta_generated_FunctionService_UpdateFunction_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. New version of the function. - */ - // const function = {} - /** - * The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. - */ - // const updateMask = {} - - // Imports the Functions library - const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; - - // Instantiates a client - const functionsClient = new FunctionServiceClient(); - - async function callUpdateFunction() { - // Construct request - const request = { - function1, - }; - - // Run request - const [operation] = await functionsClient.updateFunction(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateFunction(); - // [END cloudfunctions_v2beta_generated_FunctionService_UpdateFunction_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-functions/v2beta/samples/generated/v2beta/snippet_metadata_google.cloud.functions.v2beta.json b/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/snippet_metadata_google.cloud.functions.v2beta.json deleted file mode 100644 index e2a32a49e0c..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/samples/generated/v2beta/snippet_metadata_google.cloud.functions.v2beta.json +++ /dev/null @@ -1,371 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-functions", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.functions.v2beta", - "version": "v2beta" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudfunctions_v2beta_generated_FunctionService_GetFunction_async", - "title": "FunctionService getFunction Sample", - "origin": "API_DEFINITION", - "description": " Returns a function with the given name from the requested project.", - "canonical": true, - "file": "function_service.get_function.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFunction", - "fullName": "google.cloud.functions.v2beta.FunctionService.GetFunction", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v2beta.Function", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" - }, - "method": { - "shortName": "GetFunction", - "fullName": "google.cloud.functions.v2beta.FunctionService.GetFunction", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2beta.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2beta_generated_FunctionService_ListFunctions_async", - "title": "FunctionService listFunctions Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of functions that belong to the requested project.", - "canonical": true, - "file": "function_service.list_functions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFunctions", - "fullName": "google.cloud.functions.v2beta.FunctionService.ListFunctions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v2beta.ListFunctionsResponse", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" - }, - "method": { - "shortName": "ListFunctions", - "fullName": "google.cloud.functions.v2beta.FunctionService.ListFunctions", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2beta.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2beta_generated_FunctionService_CreateFunction_async", - "title": "FunctionService createFunction Sample", - "origin": "API_DEFINITION", - "description": " Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return `ALREADY_EXISTS` error.", - "canonical": true, - "file": "function_service.create_function.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFunction", - "fullName": "google.cloud.functions.v2beta.FunctionService.CreateFunction", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "function", - "type": ".google.cloud.functions.v2beta.Function" - }, - { - "name": "function_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" - }, - "method": { - "shortName": "CreateFunction", - "fullName": "google.cloud.functions.v2beta.FunctionService.CreateFunction", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2beta.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2beta_generated_FunctionService_UpdateFunction_async", - "title": "FunctionService updateFunction Sample", - "origin": "API_DEFINITION", - "description": " Updates existing function.", - "canonical": true, - "file": "function_service.update_function.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFunction", - "fullName": "google.cloud.functions.v2beta.FunctionService.UpdateFunction", - "async": true, - "parameters": [ - { - "name": "function", - "type": ".google.cloud.functions.v2beta.Function" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" - }, - "method": { - "shortName": "UpdateFunction", - "fullName": "google.cloud.functions.v2beta.FunctionService.UpdateFunction", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2beta.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2beta_generated_FunctionService_DeleteFunction_async", - "title": "FunctionService deleteFunction Sample", - "origin": "API_DEFINITION", - "description": " Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.", - "canonical": true, - "file": "function_service.delete_function.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteFunction", - "fullName": "google.cloud.functions.v2beta.FunctionService.DeleteFunction", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" - }, - "method": { - "shortName": "DeleteFunction", - "fullName": "google.cloud.functions.v2beta.FunctionService.DeleteFunction", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2beta.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2beta_generated_FunctionService_GenerateUploadUrl_async", - "title": "FunctionService generateUploadUrl Sample", - "origin": "API_DEFINITION", - "description": " Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type: application/zip` And this header SHOULD NOT be specified: * `Authorization: Bearer YOUR_TOKEN`", - "canonical": true, - "file": "function_service.generate_upload_url.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateUploadUrl", - "fullName": "google.cloud.functions.v2beta.FunctionService.GenerateUploadUrl", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "kms_key_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v2beta.GenerateUploadUrlResponse", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" - }, - "method": { - "shortName": "GenerateUploadUrl", - "fullName": "google.cloud.functions.v2beta.FunctionService.GenerateUploadUrl", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2beta.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2beta_generated_FunctionService_GenerateDownloadUrl_async", - "title": "FunctionService generateDownloadUrl Sample", - "origin": "API_DEFINITION", - "description": " Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls", - "canonical": true, - "file": "function_service.generate_download_url.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateDownloadUrl", - "fullName": "google.cloud.functions.v2beta.FunctionService.GenerateDownloadUrl", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v2beta.GenerateDownloadUrlResponse", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" - }, - "method": { - "shortName": "GenerateDownloadUrl", - "fullName": "google.cloud.functions.v2beta.FunctionService.GenerateDownloadUrl", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2beta.FunctionService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v2beta_generated_FunctionService_ListRuntimes_async", - "title": "FunctionService listRuntimes Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of runtimes that are supported for the requested project.", - "canonical": true, - "file": "function_service.list_runtimes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListRuntimes", - "fullName": "google.cloud.functions.v2beta.FunctionService.ListRuntimes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v2beta.ListRuntimesResponse", - "client": { - "shortName": "FunctionServiceClient", - "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" - }, - "method": { - "shortName": "ListRuntimes", - "fullName": "google.cloud.functions.v2beta.FunctionService.ListRuntimes", - "service": { - "shortName": "FunctionService", - "fullName": "google.cloud.functions.v2beta.FunctionService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-functions/v2beta/src/index.ts b/owl-bot-staging/google-cloud-functions/v2beta/src/index.ts deleted file mode 100644 index 168b8ae2042..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/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 v2beta from './v2beta'; -const FunctionServiceClient = v2beta.FunctionServiceClient; -type FunctionServiceClient = v2beta.FunctionServiceClient; -export {v2beta, FunctionServiceClient}; -export default {v2beta, FunctionServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_client.ts b/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_client.ts deleted file mode 100644 index 13e4f1ad7b3..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_client.ts +++ /dev/null @@ -1,2197 +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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta/function_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './function_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Google Cloud Functions is used to deploy functions that are executed by - * Google in response to various events. Data connected with that event is - * passed to a function as the input data. - * - * A **function** is a resource which describes a function that should be - * executed and how it is triggered. - * @class - * @memberof v2beta - */ -export class FunctionServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - functionServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of FunctionServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 FunctionServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof FunctionServiceClient; - 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; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - 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 = { - buildPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/builds/{build}' - ), - channelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/channels/{channel}' - ), - connectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/connectors/{connector}' - ), - cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' - ), - functionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/functions/{function}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - repositoryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ), - topicPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/topics/{topic}' - ), - triggerPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/triggers/{trigger}' - ), - workerPoolPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workerPools/{worker_pool}' - ), - }; - - // 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 = { - listFunctions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'functions') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2beta/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v2beta/{resource=projects/*/locations/*/functions/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v2beta/{resource=projects/*/locations/*/functions/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v2beta/{resource=projects/*/locations/*/functions/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v2beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v2beta/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createFunctionResponse = protoFilesRoot.lookup( - '.google.cloud.functions.v2beta.Function') as gax.protobuf.Type; - const createFunctionMetadata = protoFilesRoot.lookup( - '.google.cloud.functions.v2beta.OperationMetadata') as gax.protobuf.Type; - const updateFunctionResponse = protoFilesRoot.lookup( - '.google.cloud.functions.v2beta.Function') as gax.protobuf.Type; - const updateFunctionMetadata = protoFilesRoot.lookup( - '.google.cloud.functions.v2beta.OperationMetadata') as gax.protobuf.Type; - const deleteFunctionResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteFunctionMetadata = protoFilesRoot.lookup( - '.google.cloud.functions.v2beta.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createFunction: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createFunctionResponse.decode.bind(createFunctionResponse), - createFunctionMetadata.decode.bind(createFunctionMetadata)), - updateFunction: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateFunctionResponse.decode.bind(updateFunctionResponse), - updateFunctionMetadata.decode.bind(updateFunctionMetadata)), - deleteFunction: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteFunctionResponse.decode.bind(deleteFunctionResponse), - deleteFunctionMetadata.decode.bind(deleteFunctionMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.functions.v2beta.FunctionService', 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.functionServiceStub) { - return this.functionServiceStub; - } - - // Put together the "service stub" for - // google.cloud.functions.v2beta.FunctionService. - this.functionServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.functions.v2beta.FunctionService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.functions.v2beta.FunctionService, - 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 functionServiceStubMethods = - ['getFunction', 'listFunctions', 'createFunction', 'updateFunction', 'deleteFunction', 'generateUploadUrl', 'generateDownloadUrl', 'listRuntimes']; - for (const methodName of functionServiceStubMethods) { - const callPromise = this.functionServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.functionServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'cloudfunctions.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 'cloudfunctions.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 -- - // ------------------- -/** - * Returns a function with the given name from the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the function which details should be obtained. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2beta.Function|Function}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2beta/function_service.get_function.js - * region_tag:cloudfunctions_v2beta_generated_FunctionService_GetFunction_async - */ - getFunction( - request?: protos.google.cloud.functions.v2beta.IGetFunctionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v2beta.IFunction, - protos.google.cloud.functions.v2beta.IGetFunctionRequest|undefined, {}|undefined - ]>; - getFunction( - request: protos.google.cloud.functions.v2beta.IGetFunctionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.functions.v2beta.IFunction, - protos.google.cloud.functions.v2beta.IGetFunctionRequest|null|undefined, - {}|null|undefined>): void; - getFunction( - request: protos.google.cloud.functions.v2beta.IGetFunctionRequest, - callback: Callback< - protos.google.cloud.functions.v2beta.IFunction, - protos.google.cloud.functions.v2beta.IGetFunctionRequest|null|undefined, - {}|null|undefined>): void; - getFunction( - request?: protos.google.cloud.functions.v2beta.IGetFunctionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.functions.v2beta.IFunction, - protos.google.cloud.functions.v2beta.IGetFunctionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.functions.v2beta.IFunction, - protos.google.cloud.functions.v2beta.IGetFunctionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v2beta.IFunction, - protos.google.cloud.functions.v2beta.IGetFunctionRequest|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.getFunction(request, options, callback); - } -/** - * Returns a signed URL for uploading a function source code. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls. - * Once the function source code upload is complete, the used signed - * URL should be provided in CreateFunction or UpdateFunction request - * as a reference to the function source code. - * - * When uploading source code to the generated signed URL, please follow - * these restrictions: - * - * * Source file type should be a zip file. - * * No credentials should be attached - the signed URLs provide access to the - * target bucket using internal service identity; if credentials were - * attached, the identity from the credentials would be used, but that - * identity does not have permissions to upload files to the URL. - * - * When making a HTTP PUT request, these two headers need to be specified: - * - * * `content-type: application/zip` - * - * And this header SHOULD NOT be specified: - * - * * `Authorization: Bearer YOUR_TOKEN` - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location in which the Google Cloud Storage signed - * URL should be generated, specified in the format `projects/* /locations/*`. - * @param {string} request.kmsKeyName - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2beta.GenerateUploadUrlResponse|GenerateUploadUrlResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2beta/function_service.generate_upload_url.js - * region_tag:cloudfunctions_v2beta_generated_FunctionService_GenerateUploadUrl_async - */ - generateUploadUrl( - request?: protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest|undefined, {}|undefined - ]>; - generateUploadUrl( - request: protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>): void; - generateUploadUrl( - request: protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest, - callback: Callback< - protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>): void; - generateUploadUrl( - request?: protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest|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.generateUploadUrl(request, options, callback); - } -/** - * Returns a signed URL for downloading deployed function source code. - * The URL is only valid for a limited period and should be used within - * 30 minutes of generation. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of function for which source code Google Cloud Storage - * signed URL should be generated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2beta.GenerateDownloadUrlResponse|GenerateDownloadUrlResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2beta/function_service.generate_download_url.js - * region_tag:cloudfunctions_v2beta_generated_FunctionService_GenerateDownloadUrl_async - */ - generateDownloadUrl( - request?: protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest|undefined, {}|undefined - ]>; - generateDownloadUrl( - request: protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>): void; - generateDownloadUrl( - request: protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest, - callback: Callback< - protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>): void; - generateDownloadUrl( - request?: protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest|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.generateDownloadUrl(request, options, callback); - } -/** - * Returns a list of runtimes that are supported for the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the runtimes should be - * listed, specified in the format `projects/* /locations/*` - * @param {string} request.filter - * The filter for Runtimes that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2beta.ListRuntimesResponse|ListRuntimesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2beta/function_service.list_runtimes.js - * region_tag:cloudfunctions_v2beta_generated_FunctionService_ListRuntimes_async - */ - listRuntimes( - request?: protos.google.cloud.functions.v2beta.IListRuntimesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v2beta.IListRuntimesResponse, - protos.google.cloud.functions.v2beta.IListRuntimesRequest|undefined, {}|undefined - ]>; - listRuntimes( - request: protos.google.cloud.functions.v2beta.IListRuntimesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.functions.v2beta.IListRuntimesResponse, - protos.google.cloud.functions.v2beta.IListRuntimesRequest|null|undefined, - {}|null|undefined>): void; - listRuntimes( - request: protos.google.cloud.functions.v2beta.IListRuntimesRequest, - callback: Callback< - protos.google.cloud.functions.v2beta.IListRuntimesResponse, - protos.google.cloud.functions.v2beta.IListRuntimesRequest|null|undefined, - {}|null|undefined>): void; - listRuntimes( - request?: protos.google.cloud.functions.v2beta.IListRuntimesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.functions.v2beta.IListRuntimesResponse, - protos.google.cloud.functions.v2beta.IListRuntimesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.functions.v2beta.IListRuntimesResponse, - protos.google.cloud.functions.v2beta.IListRuntimesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v2beta.IListRuntimesResponse, - protos.google.cloud.functions.v2beta.IListRuntimesRequest|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.listRuntimes(request, options, callback); - } - -/** - * Creates a new function. If a function with the given name already exists in - * the specified project, the long running operation will return - * `ALREADY_EXISTS` error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location in which the function should be created, - * specified in the format `projects/* /locations/*` - * @param {google.cloud.functions.v2beta.Function} request.function - * Required. Function to be created. - * @param {string} request.functionId - * The ID to use for the function, which will become the final component of - * the function's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /{@link protos.0-9|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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2beta/function_service.create_function.js - * region_tag:cloudfunctions_v2beta_generated_FunctionService_CreateFunction_async - */ - createFunction( - request?: protos.google.cloud.functions.v2beta.ICreateFunctionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createFunction( - request: protos.google.cloud.functions.v2beta.ICreateFunctionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFunction( - request: protos.google.cloud.functions.v2beta.ICreateFunctionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFunction( - request?: protos.google.cloud.functions.v2beta.ICreateFunctionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFunction(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createFunction()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2beta/function_service.create_function.js - * region_tag:cloudfunctions_v2beta_generated_FunctionService_CreateFunction_async - */ - async checkCreateFunctionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFunction, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates existing function. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.functions.v2beta.Function} request.function - * Required. New version of the function. - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2beta/function_service.update_function.js - * region_tag:cloudfunctions_v2beta_generated_FunctionService_UpdateFunction_async - */ - updateFunction( - request?: protos.google.cloud.functions.v2beta.IUpdateFunctionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateFunction( - request: protos.google.cloud.functions.v2beta.IUpdateFunctionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFunction( - request: protos.google.cloud.functions.v2beta.IUpdateFunctionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFunction( - request?: protos.google.cloud.functions.v2beta.IUpdateFunctionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'function.name': request.function!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFunction(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateFunction()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2beta/function_service.update_function.js - * region_tag:cloudfunctions_v2beta_generated_FunctionService_UpdateFunction_async - */ - async checkUpdateFunctionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFunction, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a function with the given name from the specified project. If the - * given function is used by some trigger, the trigger will be updated to - * remove this function. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the function which should be deleted. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2beta/function_service.delete_function.js - * region_tag:cloudfunctions_v2beta_generated_FunctionService_DeleteFunction_async - */ - deleteFunction( - request?: protos.google.cloud.functions.v2beta.IDeleteFunctionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteFunction( - request: protos.google.cloud.functions.v2beta.IDeleteFunctionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFunction( - request: protos.google.cloud.functions.v2beta.IDeleteFunctionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFunction( - request?: protos.google.cloud.functions.v2beta.IDeleteFunctionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteFunction(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteFunction()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2beta/function_service.delete_function.js - * region_tag:cloudfunctions_v2beta_generated_FunctionService_DeleteFunction_async - */ - async checkDeleteFunctionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFunction, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Returns a list of functions that belong to the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the function should be - * listed, specified in the format `projects/* /locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. - * @param {number} request.pageSize - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - * @param {string} request.pageToken - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * @param {string} request.filter - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.functions.v2beta.Function|Function}. - * 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 `listFunctionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFunctions( - request?: protos.google.cloud.functions.v2beta.IListFunctionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.functions.v2beta.IFunction[], - protos.google.cloud.functions.v2beta.IListFunctionsRequest|null, - protos.google.cloud.functions.v2beta.IListFunctionsResponse - ]>; - listFunctions( - request: protos.google.cloud.functions.v2beta.IListFunctionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.functions.v2beta.IListFunctionsRequest, - protos.google.cloud.functions.v2beta.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v2beta.IFunction>): void; - listFunctions( - request: protos.google.cloud.functions.v2beta.IListFunctionsRequest, - callback: PaginationCallback< - protos.google.cloud.functions.v2beta.IListFunctionsRequest, - protos.google.cloud.functions.v2beta.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v2beta.IFunction>): void; - listFunctions( - request?: protos.google.cloud.functions.v2beta.IListFunctionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.functions.v2beta.IListFunctionsRequest, - protos.google.cloud.functions.v2beta.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v2beta.IFunction>, - callback?: PaginationCallback< - protos.google.cloud.functions.v2beta.IListFunctionsRequest, - protos.google.cloud.functions.v2beta.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v2beta.IFunction>): - Promise<[ - protos.google.cloud.functions.v2beta.IFunction[], - protos.google.cloud.functions.v2beta.IListFunctionsRequest|null, - protos.google.cloud.functions.v2beta.IListFunctionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listFunctions(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the function should be - * listed, specified in the format `projects/* /locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. - * @param {number} request.pageSize - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - * @param {string} request.pageToken - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * @param {string} request.filter - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * @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 protos.google.cloud.functions.v2beta.Function|Function} 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 `listFunctionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFunctionsStream( - request?: protos.google.cloud.functions.v2beta.IListFunctionsRequest, - 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['listFunctions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFunctions.createStream( - this.innerApiCalls.listFunctions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFunctions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the function should be - * listed, specified in the format `projects/* /locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. - * @param {number} request.pageSize - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - * @param {string} request.pageToken - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * @param {string} request.filter - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.functions.v2beta.Function|Function}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2beta/function_service.list_functions.js - * region_tag:cloudfunctions_v2beta_generated_FunctionService_ListFunctions_async - */ - listFunctionsAsync( - request?: protos.google.cloud.functions.v2beta.IListFunctionsRequest, - 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['listFunctions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFunctions.asyncIterate( - this.innerApiCalls['listFunctions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified build resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} build - * @returns {string} Resource name string. - */ - buildPath(project:string,location:string,build:string) { - return this.pathTemplates.buildPathTemplate.render({ - project: project, - location: location, - build: build, - }); - } - - /** - * Parse the project from Build resource. - * - * @param {string} buildName - * A fully-qualified path representing Build resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBuildName(buildName: string) { - return this.pathTemplates.buildPathTemplate.match(buildName).project; - } - - /** - * Parse the location from Build resource. - * - * @param {string} buildName - * A fully-qualified path representing Build resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBuildName(buildName: string) { - return this.pathTemplates.buildPathTemplate.match(buildName).location; - } - - /** - * Parse the build from Build resource. - * - * @param {string} buildName - * A fully-qualified path representing Build resource. - * @returns {string} A string representing the build. - */ - matchBuildFromBuildName(buildName: string) { - return this.pathTemplates.buildPathTemplate.match(buildName).build; - } - - /** - * Return a fully-qualified channel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} channel - * @returns {string} Resource name string. - */ - channelPath(project:string,location:string,channel:string) { - return this.pathTemplates.channelPathTemplate.render({ - project: project, - location: location, - channel: channel, - }); - } - - /** - * Parse the project from Channel resource. - * - * @param {string} channelName - * A fully-qualified path representing Channel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromChannelName(channelName: string) { - return this.pathTemplates.channelPathTemplate.match(channelName).project; - } - - /** - * Parse the location from Channel resource. - * - * @param {string} channelName - * A fully-qualified path representing Channel resource. - * @returns {string} A string representing the location. - */ - matchLocationFromChannelName(channelName: string) { - return this.pathTemplates.channelPathTemplate.match(channelName).location; - } - - /** - * Parse the channel from Channel resource. - * - * @param {string} channelName - * A fully-qualified path representing Channel resource. - * @returns {string} A string representing the channel. - */ - matchChannelFromChannelName(channelName: string) { - return this.pathTemplates.channelPathTemplate.match(channelName).channel; - } - - /** - * Return a fully-qualified connector resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} connector - * @returns {string} Resource name string. - */ - connectorPath(project:string,location:string,connector:string) { - return this.pathTemplates.connectorPathTemplate.render({ - project: project, - location: location, - connector: connector, - }); - } - - /** - * Parse the project from Connector resource. - * - * @param {string} connectorName - * A fully-qualified path representing Connector resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConnectorName(connectorName: string) { - return this.pathTemplates.connectorPathTemplate.match(connectorName).project; - } - - /** - * Parse the location from Connector resource. - * - * @param {string} connectorName - * A fully-qualified path representing Connector resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConnectorName(connectorName: string) { - return this.pathTemplates.connectorPathTemplate.match(connectorName).location; - } - - /** - * Parse the connector from Connector resource. - * - * @param {string} connectorName - * A fully-qualified path representing Connector resource. - * @returns {string} A string representing the connector. - */ - matchConnectorFromConnectorName(connectorName: string) { - return this.pathTemplates.connectorPathTemplate.match(connectorName).connector; - } - - /** - * Return a fully-qualified cryptoKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @returns {string} Resource name string. - */ - cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { - return this.pathTemplates.cryptoKeyPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - }); - } - - /** - * Parse the project from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; - } - - /** - * Parse the location from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; - } - - /** - * Parse the key_ring from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; - } - - /** - * Parse the crypto_key from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; - } - - /** - * Return a fully-qualified function resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} functionParam - * @returns {string} Resource name string. - */ - functionPath(project:string,location:string,functionParam:string) { - return this.pathTemplates.functionPathTemplate.render({ - project: project, - location: location, - function: functionParam, - }); - } - - /** - * Parse the project from Function resource. - * - * @param {string} functionName - * A fully-qualified path representing Function resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFunctionName(functionName: string) { - return this.pathTemplates.functionPathTemplate.match(functionName).project; - } - - /** - * Parse the location from Function resource. - * - * @param {string} functionName - * A fully-qualified path representing Function resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFunctionName(functionName: string) { - return this.pathTemplates.functionPathTemplate.match(functionName).location; - } - - /** - * Parse the function from Function resource. - * - * @param {string} functionName - * A fully-qualified path representing Function resource. - * @returns {string} A string representing the function. - */ - matchFunctionFromFunctionName(functionName: string) { - return this.pathTemplates.functionPathTemplate.match(functionName).function; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified 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 repository resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @returns {string} Resource name string. - */ - repositoryPath(project:string,location:string,repository:string) { - return this.pathTemplates.repositoryPathTemplate.render({ - project: project, - location: location, - repository: repository, - }); - } - - /** - * Parse the project from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).project; - } - - /** - * Parse the location from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the location. - */ - matchLocationFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).location; - } - - /** - * Parse the repository from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).repository; - } - - /** - * Return a fully-qualified service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - service: service, - }); - } - - /** - * Parse the project from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).project; - } - - /** - * Parse the location from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).location; - } - - /** - * Parse the service from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).service; - } - - /** - * Return a fully-qualified topic resource name string. - * - * @param {string} project - * @param {string} topic - * @returns {string} Resource name string. - */ - topicPath(project:string,topic:string) { - return this.pathTemplates.topicPathTemplate.render({ - project: project, - topic: topic, - }); - } - - /** - * Parse the project from Topic resource. - * - * @param {string} topicName - * A fully-qualified path representing Topic resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTopicName(topicName: string) { - return this.pathTemplates.topicPathTemplate.match(topicName).project; - } - - /** - * Parse the topic from Topic resource. - * - * @param {string} topicName - * A fully-qualified path representing Topic resource. - * @returns {string} A string representing the topic. - */ - matchTopicFromTopicName(topicName: string) { - return this.pathTemplates.topicPathTemplate.match(topicName).topic; - } - - /** - * Return a fully-qualified trigger resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} trigger - * @returns {string} Resource name string. - */ - triggerPath(project:string,location:string,trigger:string) { - return this.pathTemplates.triggerPathTemplate.render({ - project: project, - location: location, - trigger: trigger, - }); - } - - /** - * Parse the project from Trigger resource. - * - * @param {string} triggerName - * A fully-qualified path representing Trigger resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTriggerName(triggerName: string) { - return this.pathTemplates.triggerPathTemplate.match(triggerName).project; - } - - /** - * Parse the location from Trigger resource. - * - * @param {string} triggerName - * A fully-qualified path representing Trigger resource. - * @returns {string} A string representing the location. - */ - matchLocationFromTriggerName(triggerName: string) { - return this.pathTemplates.triggerPathTemplate.match(triggerName).location; - } - - /** - * Parse the trigger from Trigger resource. - * - * @param {string} triggerName - * A fully-qualified path representing Trigger resource. - * @returns {string} A string representing the trigger. - */ - matchTriggerFromTriggerName(triggerName: string) { - return this.pathTemplates.triggerPathTemplate.match(triggerName).trigger; - } - - /** - * Return a fully-qualified workerPool resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} worker_pool - * @returns {string} Resource name string. - */ - workerPoolPath(project:string,location:string,workerPool:string) { - return this.pathTemplates.workerPoolPathTemplate.render({ - project: project, - location: location, - worker_pool: workerPool, - }); - } - - /** - * Parse the project from WorkerPool resource. - * - * @param {string} workerPoolName - * A fully-qualified path representing WorkerPool resource. - * @returns {string} A string representing the project. - */ - matchProjectFromWorkerPoolName(workerPoolName: string) { - return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).project; - } - - /** - * Parse the location from WorkerPool resource. - * - * @param {string} workerPoolName - * A fully-qualified path representing WorkerPool resource. - * @returns {string} A string representing the location. - */ - matchLocationFromWorkerPoolName(workerPoolName: string) { - return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).location; - } - - /** - * Parse the worker_pool from WorkerPool resource. - * - * @param {string} workerPoolName - * A fully-qualified path representing WorkerPool resource. - * @returns {string} A string representing the worker_pool. - */ - matchWorkerPoolFromWorkerPoolName(workerPoolName: string) { - return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).worker_pool; - } - - /** - * 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.functionServiceStub && !this._terminated) { - return this.functionServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_client_config.json b/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_client_config.json deleted file mode 100644 index d6bce91ead4..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_client_config.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "interfaces": { - "google.cloud.functions.v2beta.FunctionService": { - "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": { - "GetFunction": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListFunctions": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateFunction": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateFunction": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteFunction": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GenerateUploadUrl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GenerateDownloadUrl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListRuntimes": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_proto_list.json b/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_proto_list.json deleted file mode 100644 index a92a5d75e33..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/function_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/functions/v2beta/functions.proto" -] diff --git a/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/gapic_metadata.json b/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/gapic_metadata.json deleted file mode 100644 index e66fe6e8e8b..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/gapic_metadata.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.functions.v2beta", - "libraryPackage": "@google-cloud/functions", - "services": { - "FunctionService": { - "clients": { - "grpc": { - "libraryClient": "FunctionServiceClient", - "rpcs": { - "GetFunction": { - "methods": [ - "getFunction" - ] - }, - "GenerateUploadUrl": { - "methods": [ - "generateUploadUrl" - ] - }, - "GenerateDownloadUrl": { - "methods": [ - "generateDownloadUrl" - ] - }, - "ListRuntimes": { - "methods": [ - "listRuntimes" - ] - }, - "CreateFunction": { - "methods": [ - "createFunction" - ] - }, - "UpdateFunction": { - "methods": [ - "updateFunction" - ] - }, - "DeleteFunction": { - "methods": [ - "deleteFunction" - ] - }, - "ListFunctions": { - "methods": [ - "listFunctions", - "listFunctionsStream", - "listFunctionsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "FunctionServiceClient", - "rpcs": { - "GetFunction": { - "methods": [ - "getFunction" - ] - }, - "GenerateUploadUrl": { - "methods": [ - "generateUploadUrl" - ] - }, - "GenerateDownloadUrl": { - "methods": [ - "generateDownloadUrl" - ] - }, - "ListRuntimes": { - "methods": [ - "listRuntimes" - ] - }, - "CreateFunction": { - "methods": [ - "createFunction" - ] - }, - "UpdateFunction": { - "methods": [ - "updateFunction" - ] - }, - "DeleteFunction": { - "methods": [ - "deleteFunction" - ] - }, - "ListFunctions": { - "methods": [ - "listFunctions", - "listFunctionsStream", - "listFunctionsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/index.ts b/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/index.ts deleted file mode 100644 index ec33a786b85..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/src/v2beta/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 {FunctionServiceClient} from './function_service_client'; diff --git a/owl-bot-staging/google-cloud-functions/v2beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-functions/v2beta/system-test/fixtures/sample/src/index.js deleted file mode 100644 index c41f33eb2a8..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/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 functions = require('@google-cloud/functions'); - -function main() { - const functionServiceClient = new functions.FunctionServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-functions/v2beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-functions/v2beta/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 530ace3134e..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/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 {FunctionServiceClient} from '@google-cloud/functions'; - -// check that the client class type name can be used -function doStuffWithFunctionServiceClient(client: FunctionServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const functionServiceClient = new FunctionServiceClient(); - doStuffWithFunctionServiceClient(functionServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-functions/v2beta/system-test/install.ts b/owl-bot-staging/google-cloud-functions/v2beta/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/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-functions/v2beta/test/gapic_function_service_v2beta.ts b/owl-bot-staging/google-cloud-functions/v2beta/test/gapic_function_service_v2beta.ts deleted file mode 100644 index 849027018ec..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/test/gapic_function_service_v2beta.ts +++ /dev/null @@ -1,2584 +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 functionserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2beta.FunctionServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = functionserviceModule.v2beta.FunctionServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = functionserviceModule.v2beta.FunctionServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = functionserviceModule.v2beta.FunctionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.functionServiceStub, undefined); - await client.initialize(); - assert(client.functionServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.functionServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.functionServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - 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 functionserviceModule.v2beta.FunctionServiceClient({ - 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('getFunction', () => { - it('invokes getFunction without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.GetFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.GetFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2beta.Function() - ); - client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); - const [response] = await client.getFunction(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFunction without error using callback', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.GetFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.GetFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2beta.Function() - ); - client.innerApiCalls.getFunction = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFunction( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v2beta.IFunction|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFunction with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.GetFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.GetFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFunction = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFunction(request), expectedError); - const actualRequest = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFunction with closed client', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.GetFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.GetFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFunction(request), expectedError); - }); - }); - - describe('generateUploadUrl', () => { - it('invokes generateUploadUrl without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.GenerateUploadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.GenerateUploadUrlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2beta.GenerateUploadUrlResponse() - ); - client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); - const [response] = await client.generateUploadUrl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateUploadUrl without error using callback', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.GenerateUploadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.GenerateUploadUrlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2beta.GenerateUploadUrlResponse() - ); - client.innerApiCalls.generateUploadUrl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateUploadUrl( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateUploadUrl with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.GenerateUploadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.GenerateUploadUrlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateUploadUrl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateUploadUrl(request), expectedError); - const actualRequest = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateUploadUrl with closed client', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.GenerateUploadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.GenerateUploadUrlRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateUploadUrl(request), expectedError); - }); - }); - - describe('generateDownloadUrl', () => { - it('invokes generateDownloadUrl without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.GenerateDownloadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.GenerateDownloadUrlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2beta.GenerateDownloadUrlResponse() - ); - client.innerApiCalls.generateDownloadUrl = stubSimpleCall(expectedResponse); - const [response] = await client.generateDownloadUrl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateDownloadUrl without error using callback', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.GenerateDownloadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.GenerateDownloadUrlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2beta.GenerateDownloadUrlResponse() - ); - client.innerApiCalls.generateDownloadUrl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateDownloadUrl( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateDownloadUrl with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.GenerateDownloadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.GenerateDownloadUrlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateDownloadUrl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateDownloadUrl(request), expectedError); - const actualRequest = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateDownloadUrl with closed client', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.GenerateDownloadUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.GenerateDownloadUrlRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateDownloadUrl(request), expectedError); - }); - }); - - describe('listRuntimes', () => { - it('invokes listRuntimes without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.ListRuntimesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.ListRuntimesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2beta.ListRuntimesResponse() - ); - client.innerApiCalls.listRuntimes = stubSimpleCall(expectedResponse); - const [response] = await client.listRuntimes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRuntimes without error using callback', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.ListRuntimesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.ListRuntimesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.functions.v2beta.ListRuntimesResponse() - ); - client.innerApiCalls.listRuntimes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRuntimes( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v2beta.IListRuntimesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRuntimes with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.ListRuntimesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.ListRuntimesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRuntimes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRuntimes(request), expectedError); - const actualRequest = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRuntimes with closed client', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.ListRuntimesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.ListRuntimesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listRuntimes(request), expectedError); - }); - }); - - describe('createFunction', () => { - it('invokes createFunction without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.CreateFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.CreateFunctionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFunction = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFunction(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFunction without error using callback', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.CreateFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.CreateFunctionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFunction = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFunction( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFunction with call error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.CreateFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.CreateFunctionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFunction = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFunction(request), expectedError); - const actualRequest = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFunction with LRO error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.CreateFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.CreateFunctionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFunction = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFunction(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateFunctionProgress without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateFunctionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateFunctionProgress with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFunctionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateFunction', () => { - it('invokes updateFunction without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.UpdateFunctionRequest() - ); - request.function ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.UpdateFunctionRequest', ['function', 'name']); - request.function.name = defaultValue1; - const expectedHeaderRequestParams = `function.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFunction = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFunction(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFunction without error using callback', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.UpdateFunctionRequest() - ); - request.function ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.UpdateFunctionRequest', ['function', 'name']); - request.function.name = defaultValue1; - const expectedHeaderRequestParams = `function.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFunction = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFunction( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFunction with call error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.UpdateFunctionRequest() - ); - request.function ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.UpdateFunctionRequest', ['function', 'name']); - request.function.name = defaultValue1; - const expectedHeaderRequestParams = `function.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFunction(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFunction with LRO error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.UpdateFunctionRequest() - ); - request.function ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.UpdateFunctionRequest', ['function', 'name']); - request.function.name = defaultValue1; - const expectedHeaderRequestParams = `function.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFunction(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateFunctionProgress without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateFunctionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateFunctionProgress with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFunctionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteFunction', () => { - it('invokes deleteFunction without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.DeleteFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.DeleteFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFunction = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFunction(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFunction without error using callback', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.DeleteFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.DeleteFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFunction = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFunction( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFunction with call error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.DeleteFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.DeleteFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFunction(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFunction with LRO error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.DeleteFunctionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.DeleteFunctionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFunction(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteFunctionProgress without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteFunctionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteFunctionProgress with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFunctionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listFunctions', () => { - it('invokes listFunctions without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), - ]; - client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); - const [response] = await client.listFunctions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFunctions without error using callback', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), - ]; - client.innerApiCalls.listFunctions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFunctions( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v2beta.IFunction[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFunctions with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFunctions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFunctions(request), expectedError); - const actualRequest = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFunctionsStream without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), - ]; - client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFunctionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.functions.v2beta.Function[] = []; - stream.on('data', (response: protos.google.cloud.functions.v2beta.Function) => { - 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.listFunctions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); - assert( - (client.descriptors.page.listFunctions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFunctionsStream with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFunctionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.functions.v2beta.Function[] = []; - stream.on('data', (response: protos.google.cloud.functions.v2beta.Function) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFunctions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); - assert( - (client.descriptors.page.listFunctions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFunctions without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), - generateSampleMessage(new protos.google.cloud.functions.v2beta.Function()), - ]; - client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.functions.v2beta.IFunction[] = []; - const iterable = client.listFunctionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFunctions with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.functions.v2beta.ListFunctionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.functions.v2beta.ListFunctionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFunctionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.functions.v2beta.IFunction[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('build', () => { - const fakePath = "/rendered/path/build"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - build: "buildValue", - }; - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.buildPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.buildPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('buildPath', () => { - const result = client.buildPath("projectValue", "locationValue", "buildValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.buildPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBuildName', () => { - const result = client.matchProjectFromBuildName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.buildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBuildName', () => { - const result = client.matchLocationFromBuildName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.buildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBuildFromBuildName', () => { - const result = client.matchBuildFromBuildName(fakePath); - assert.strictEqual(result, "buildValue"); - assert((client.pathTemplates.buildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('channel', () => { - const fakePath = "/rendered/path/channel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - channel: "channelValue", - }; - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.channelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.channelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('channelPath', () => { - const result = client.channelPath("projectValue", "locationValue", "channelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.channelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromChannelName', () => { - const result = client.matchProjectFromChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromChannelName', () => { - const result = client.matchLocationFromChannelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelFromChannelName', () => { - const result = client.matchChannelFromChannelName(fakePath); - assert.strictEqual(result, "channelValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('connector', () => { - const fakePath = "/rendered/path/connector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - connector: "connectorValue", - }; - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.connectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.connectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('connectorPath', () => { - const result = client.connectorPath("projectValue", "locationValue", "connectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.connectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConnectorName', () => { - const result = client.matchProjectFromConnectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConnectorName', () => { - const result = client.matchLocationFromConnectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConnectorFromConnectorName', () => { - const result = client.matchConnectorFromConnectorName(fakePath); - assert.strictEqual(result, "connectorValue"); - assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('cryptoKey', () => { - const fakePath = "/rendered/path/cryptoKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - }; - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.cryptoKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cryptoKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cryptoKeyPath', () => { - const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCryptoKeyName', () => { - const result = client.matchProjectFromCryptoKeyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCryptoKeyName', () => { - const result = client.matchLocationFromCryptoKeyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromCryptoKeyName', () => { - const result = client.matchKeyRingFromCryptoKeyName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromCryptoKeyName', () => { - const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('function', () => { - const fakePath = "/rendered/path/function"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - function: "functionValue", - }; - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.functionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.functionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('functionPath', () => { - const result = client.functionPath("projectValue", "locationValue", "functionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.functionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFunctionName', () => { - const result = client.matchProjectFromFunctionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.functionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFunctionName', () => { - const result = client.matchLocationFromFunctionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.functionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFunctionFromFunctionName', () => { - const result = client.matchFunctionFromFunctionName(fakePath); - assert.strictEqual(result, "functionValue"); - assert((client.pathTemplates.functionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - 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('repository', () => { - const fakePath = "/rendered/path/repository"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - }; - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.repositoryPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.repositoryPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('repositoryPath', () => { - const result = client.repositoryPath("projectValue", "locationValue", "repositoryValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.repositoryPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRepositoryName', () => { - const result = client.matchProjectFromRepositoryName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromRepositoryName', () => { - const result = client.matchLocationFromRepositoryName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromRepositoryName', () => { - const result = client.matchRepositoryFromRepositoryName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - }; - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePath', () => { - const result = client.servicePath("projectValue", "locationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceName', () => { - const result = client.matchProjectFromServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServiceName', () => { - const result = client.matchLocationFromServiceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('topic', () => { - const fakePath = "/rendered/path/topic"; - const expectedParameters = { - project: "projectValue", - topic: "topicValue", - }; - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.topicPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.topicPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('topicPath', () => { - const result = client.topicPath("projectValue", "topicValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.topicPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTopicName', () => { - const result = client.matchProjectFromTopicName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.topicPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTopicFromTopicName', () => { - const result = client.matchTopicFromTopicName(fakePath); - assert.strictEqual(result, "topicValue"); - assert((client.pathTemplates.topicPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('trigger', () => { - const fakePath = "/rendered/path/trigger"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - trigger: "triggerValue", - }; - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.triggerPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.triggerPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('triggerPath', () => { - const result = client.triggerPath("projectValue", "locationValue", "triggerValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.triggerPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTriggerName', () => { - const result = client.matchProjectFromTriggerName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTriggerName', () => { - const result = client.matchLocationFromTriggerName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTriggerFromTriggerName', () => { - const result = client.matchTriggerFromTriggerName(fakePath); - assert.strictEqual(result, "triggerValue"); - assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('workerPool', () => { - const fakePath = "/rendered/path/workerPool"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - worker_pool: "workerPoolValue", - }; - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workerPoolPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workerPoolPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workerPoolPath', () => { - const result = client.workerPoolPath("projectValue", "locationValue", "workerPoolValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workerPoolPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkerPoolName', () => { - const result = client.matchProjectFromWorkerPoolName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkerPoolName', () => { - const result = client.matchLocationFromWorkerPoolName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkerPoolFromWorkerPoolName', () => { - const result = client.matchWorkerPoolFromWorkerPoolName(fakePath); - assert.strictEqual(result, "workerPoolValue"); - assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-functions/v2beta/tsconfig.json b/owl-bot-staging/google-cloud-functions/v2beta/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/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-functions/v2beta/webpack.config.js b/owl-bot-staging/google-cloud-functions/v2beta/webpack.config.js deleted file mode 100644 index 527abad554f..00000000000 --- a/owl-bot-staging/google-cloud-functions/v2beta/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: 'FunctionService', - filename: './function-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-gkebackup/v1/.eslintignore b/owl-bot-staging/google-cloud-gkebackup/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/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-gkebackup/v1/.eslintrc.json b/owl-bot-staging/google-cloud-gkebackup/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/.gitignore b/owl-bot-staging/google-cloud-gkebackup/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/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-gkebackup/v1/.jsdoc.js b/owl-bot-staging/google-cloud-gkebackup/v1/.jsdoc.js deleted file mode 100644 index b81e717f4c5..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/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/gke-backup', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/.mocharc.js b/owl-bot-staging/google-cloud-gkebackup/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/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-gkebackup/v1/.prettierrc.js b/owl-bot-staging/google-cloud-gkebackup/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/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-gkebackup/v1/README.md b/owl-bot-staging/google-cloud-gkebackup/v1/README.md deleted file mode 100644 index 095871c3b72..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Gkebackup: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/package.json b/owl-bot-staging/google-cloud-gkebackup/v1/package.json deleted file mode 100644 index 77c3f209041..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/gke-backup", - "version": "0.1.0", - "description": "Gkebackup client for Node.js", - "repository": "googleapis/nodejs-gkebackup", - "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 gkebackup", - "gkebackup", - "backup for g k e" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/backup.proto b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/backup.proto deleted file mode 100644 index 88a95493ada..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/backup.proto +++ /dev/null @@ -1,242 +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 -// -// 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.gkebackup.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/gkebackup/v1/common.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeBackup.V1"; -option go_package = "cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppb"; -option java_multiple_files = true; -option java_outer_classname = "BackupProto"; -option java_package = "com.google.cloud.gkebackup.v1"; -option php_namespace = "Google\\Cloud\\GkeBackup\\V1"; -option ruby_package = "Google::Cloud::GkeBackup::V1"; - -// Represents a request to perform a single point-in-time capture of -// some portion of the state of a GKE cluster, the record of the backup -// operation itself, and an anchor for the underlying artifacts that -// comprise the Backup (the config backup and VolumeBackups). -// Next id: 28 -message Backup { - option (google.api.resource) = { - type: "gkebackup.googleapis.com/Backup" - pattern: "projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}" - }; - - // Information about the GKE cluster from which this Backup was created. - message ClusterMetadata { - // The source cluster from which this Backup was created. - // Valid formats: - // - // - `projects/*/locations/*/clusters/*` - // - `projects/*/zones/*/clusters/*` - // - // This is inherited from the parent BackupPlan's - // [cluster][google.cloud.gkebackup.v1.BackupPlan.cluster] field. - string cluster = 1; - - // The Kubernetes server version of the source cluster. - string k8s_version = 2; - - // A list of the Backup for GKE CRD versions found in the cluster. - map backup_crd_versions = 3; - - // Platform-specific version - oneof platform_version { - // GKE version - string gke_version = 4; - - // Anthos version - string anthos_version = 5; - } - } - - // State - enum State { - // The Backup resource is in the process of being created. - STATE_UNSPECIFIED = 0; - - // The Backup resource has been created and the associated BackupJob - // Kubernetes resource has been injected into the source cluster. - CREATING = 1; - - // The gkebackup agent in the cluster has begun executing the backup - // operation. - IN_PROGRESS = 2; - - // The backup operation has completed successfully. - SUCCEEDED = 3; - - // The backup operation has failed. - FAILED = 4; - - // This Backup resource (and its associated artifacts) is in the process - // of being deleted. - DELETING = 5; - } - - // Output only. The fully qualified name of the Backup. - // `projects/*/locations/*/backupPlans/*/backups/*` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server generated global unique identifier of - // [UUID4](https://en.wikipedia.org/wiki/Universally_unique_identifier) - string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when this Backup resource was created. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when this Backup resource was last updated. - google.protobuf.Timestamp update_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This flag indicates whether this Backup resource was created - // manually by a user or via a schedule in the BackupPlan. A value of True - // means that the Backup was created manually. - bool manual = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A set of custom labels supplied by user. - map labels = 6; - - // Minimum age for this Backup (in days). If this field is set to a non-zero - // value, the Backup will be "locked" against deletion (either manual or - // automatic deletion) for the number of days provided (measured from the - // creation time of the Backup). MUST be an integer value between 0-90 - // (inclusive). - // - // Defaults to parent BackupPlan's - // [backup_delete_lock_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days] - // setting and may only be increased - // (either at creation time or in a subsequent update). - int32 delete_lock_days = 7; - - // Output only. The time at which an existing delete lock will expire for this - // backup (calculated from create_time + - // [delete_lock_days][google.cloud.gkebackup.v1.Backup.delete_lock_days]). - google.protobuf.Timestamp delete_lock_expire_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The age (in days) after which this Backup will be automatically deleted. - // Must be an integer value >= 0: - // - // - If 0, no automatic deletion will occur for this Backup. - // - If not 0, this must be >= - // [delete_lock_days][google.cloud.gkebackup.v1.Backup.delete_lock_days] and - // <= 365. - // - // Once a Backup is created, this value may only be increased. - // - // Defaults to the parent BackupPlan's - // [backup_retain_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days] - // value. - int32 retain_days = 9; - - // Output only. The time at which this Backup will be automatically deleted - // (calculated from create_time + - // [retain_days][google.cloud.gkebackup.v1.Backup.retain_days]). - google.protobuf.Timestamp retain_expire_time = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The customer managed encryption key that was used to encrypt - // the Backup's artifacts. Inherited from the parent BackupPlan's - // [encryption_key][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.encryption_key] - // value. - EncryptionKey encryption_key = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Defines the "scope" of the Backup - which namespaced resources in the - // cluster were included in the Backup. Inherited from the parent - // BackupPlan's - // [backup_scope][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.backup_scope] - // value. - oneof backup_scope { - // Output only. If True, all namespaces were included in the Backup. - bool all_namespaces = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If set, the list of namespaces that were included in the - // Backup. - Namespaces selected_namespaces = 13 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If set, the list of ProtectedApplications whose resources - // were included in the Backup. - NamespacedNames selected_applications = 14 - [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. Whether or not the Backup contains volume data. Controlled by - // the parent BackupPlan's - // [include_volume_data][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_volume_data] - // value. - bool contains_volume_data = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Whether or not the Backup contains Kubernetes Secrets. - // Controlled by the parent BackupPlan's - // [include_secrets][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_secrets] - // value. - bool contains_secrets = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Information about the GKE cluster from which this Backup was - // created. - ClusterMetadata cluster_metadata = 17 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Current state of the Backup - State state = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable description of why the backup is in the current - // `state`. - string state_reason = 19 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Completion time of the Backup - google.protobuf.Timestamp complete_time = 20 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The total number of Kubernetes resources included in the - // Backup. - int32 resource_count = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The total number of volume backups contained in the Backup. - int32 volume_count = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The total size of the Backup in bytes = config backup size + - // sum(volume backup sizes) - int64 size_bytes = 23 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. `etag` is used for optimistic concurrency control as a way to - // help prevent simultaneous updates of a backup from overwriting each other. - // It is strongly suggested that systems make use of the `etag` in the - // read-modify-write cycle to perform backup updates in order to avoid - // race conditions: An `etag` is returned in the response to `GetBackup`, - // and systems are expected to put that etag in the request to - // `UpdateBackup` or `DeleteBackup` to ensure that their change will be - // applied to the same version of the resource. - string etag = 24 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User specified descriptive string for this Backup. - string description = 25; - - // Output only. The total number of Kubernetes Pods contained in the Backup. - int32 pod_count = 26 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The size of the config backup in bytes. - int64 config_backup_size_bytes = 27 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/backup_plan.proto b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/backup_plan.proto deleted file mode 100644 index 42ed47db4a9..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/backup_plan.proto +++ /dev/null @@ -1,238 +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 -// -// 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.gkebackup.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/gkebackup/v1/common.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeBackup.V1"; -option go_package = "cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppb"; -option java_multiple_files = true; -option java_outer_classname = "BackupPlanProto"; -option java_package = "com.google.cloud.gkebackup.v1"; -option php_namespace = "Google\\Cloud\\GkeBackup\\V1"; -option ruby_package = "Google::Cloud::GkeBackup::V1"; - -// Defines the configuration and scheduling for a "line" of Backups. -message BackupPlan { - option (google.api.resource) = { - type: "gkebackup.googleapis.com/BackupPlan" - pattern: "projects/{project}/locations/{location}/backupPlans/{backup_plan}" - }; - - // RetentionPolicy defines a Backup retention policy for a BackupPlan. - message RetentionPolicy { - // Minimum age for Backups created via this BackupPlan (in days). - // This field MUST be an integer value between 0-90 (inclusive). - // A Backup created under this BackupPlan will NOT be deletable until it - // reaches Backup's (create_time + backup_delete_lock_days). - // Updating this field of a BackupPlan does NOT affect existing Backups - // under it. Backups created AFTER a successful update will inherit - // the new value. - // - // Default: 0 (no delete blocking) - int32 backup_delete_lock_days = 1; - - // The default maximum age of a Backup created via this BackupPlan. - // This field MUST be an integer value >= 0 and <= 365. - // If specified, a Backup created under this BackupPlan will be - // automatically deleted after its age reaches (create_time + - // backup_retain_days). - // If not specified, Backups created under this BackupPlan will NOT be - // subject to automatic deletion. - // Updating this field does NOT affect existing Backups under it. Backups - // created AFTER a successful update will automatically pick up the new - // value. - // NOTE: backup_retain_days must be >= - // [backup_delete_lock_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days]. - // If - // [cron_schedule][google.cloud.gkebackup.v1.BackupPlan.Schedule.cron_schedule] - // is defined, then this must be - // <= 360 * the creation interval. - // - // Default: 0 (no automatic deletion) - int32 backup_retain_days = 2; - - // This flag denotes whether the retention policy of this BackupPlan is - // locked. If set to True, no further update is allowed on this policy, - // including the `locked` field itself. - // - // Default: False - bool locked = 3; - } - - // Defines scheduling parameters for automatically creating Backups - // via this BackupPlan. - message Schedule { - // A standard [cron](https://wikipedia.com/wiki/cron) string that defines a - // repeating schedule for creating Backups via this BackupPlan. If this is - // defined, then - // [backup_retain_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days] - // must also be defined. - // - // Default (empty): no automatic backup creation will occur. - string cron_schedule = 1; - - // This flag denotes whether automatic Backup creation is paused for this - // BackupPlan. - // - // Default: False - bool paused = 2; - } - - // BackupConfig defines the configuration of Backups created via this - // BackupPlan. - message BackupConfig { - // This defines the "scope" of the Backup - which namespaced - // resources in the cluster will be included in a Backup. - // Exactly one of the fields of backup_scope MUST be specified. - oneof backup_scope { - // If True, include all namespaced resources - bool all_namespaces = 1; - - // If set, include just the resources in the listed namespaces. - Namespaces selected_namespaces = 2; - - // If set, include just the resources referenced by the listed - // ProtectedApplications. - NamespacedNames selected_applications = 3; - } - - // This flag specifies whether volume data should be backed up when - // PVCs are included in the scope of a Backup. - // - // Default: False - bool include_volume_data = 4; - - // This flag specifies whether Kubernetes Secret resources should be - // included when they fall into the scope of Backups. - // - // Default: False - bool include_secrets = 5; - - // This defines a customer managed encryption key that will be used to - // encrypt the "config" portion (the Kubernetes resources) of Backups - // created via this plan. - // - // Default (empty): Config backup artifacts will not be encrypted. - EncryptionKey encryption_key = 6; - } - - // State - enum State { - // Default first value for Enums. - STATE_UNSPECIFIED = 0; - - // Waiting for cluster state to be RUNNING. - CLUSTER_PENDING = 1; - - // The BackupPlan is in the process of being created. - PROVISIONING = 2; - - // The BackupPlan has successfully been created and is ready for Backups. - READY = 3; - - // BackupPlan creation has failed. - FAILED = 4; - - // The BackupPlan has been deactivated. - DEACTIVATED = 5; - - // The BackupPlan is in the process of being deleted. - DELETING = 6; - } - - // Output only. The full name of the BackupPlan resource. - // Format: `projects/*/locations/*/backupPlans/*` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server generated global unique identifier of - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. - string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when this BackupPlan resource was created. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when this BackupPlan resource was last - // updated. - google.protobuf.Timestamp update_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User specified descriptive string for this BackupPlan. - string description = 5; - - // Required. Immutable. The source cluster from which Backups will be created - // via this BackupPlan. Valid formats: - // - // - `projects/*/locations/*/clusters/*` - // - `projects/*/zones/*/clusters/*` - string cluster = 6 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "container.googleapis.com/Cluster" - } - ]; - - // RetentionPolicy governs lifecycle of Backups created under this plan. - RetentionPolicy retention_policy = 7; - - // A set of custom labels supplied by user. - map labels = 8; - - // Defines a schedule for automatic Backup creation via this BackupPlan. - Schedule backup_schedule = 9; - - // Output only. `etag` is used for optimistic concurrency control as a way to - // help prevent simultaneous updates of a backup plan from overwriting each - // other. It is strongly suggested that systems make use of the 'etag' in the - // read-modify-write cycle to perform BackupPlan updates in order to avoid - // race conditions: An `etag` is returned in the response to `GetBackupPlan`, - // and systems are expected to put that etag in the request to - // `UpdateBackupPlan` or `DeleteBackupPlan` to ensure that their change - // will be applied to the same version of the resource. - string etag = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // This flag indicates whether this BackupPlan has been deactivated. - // Setting this field to True locks the BackupPlan such that no further - // updates will be allowed (except deletes), including the deactivated field - // itself. It also prevents any new Backups from being created via this - // BackupPlan (including scheduled Backups). - // - // Default: False - bool deactivated = 11; - - // Defines the configuration of Backups created via this BackupPlan. - BackupConfig backup_config = 12; - - // Output only. The number of Kubernetes Pods backed up in the - // last successful Backup created via this BackupPlan. - int32 protected_pod_count = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. State of the BackupPlan. This State field reflects the - // various stages a BackupPlan can be in - // during the Create operation. It will be set to "DEACTIVATED" - // if the BackupPlan is deactivated on an Update - State state = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable description of why BackupPlan is in the current - // `state` - string state_reason = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/common.proto b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/common.proto deleted file mode 100644 index 7521d246832..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/common.proto +++ /dev/null @@ -1,58 +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 -// -// 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.gkebackup.v1; - -import "google/api/resource.proto"; - -option csharp_namespace = "Google.Cloud.GkeBackup.V1"; -option go_package = "cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppb"; -option java_multiple_files = true; -option java_outer_classname = "CommonProto"; -option java_package = "com.google.cloud.gkebackup.v1"; -option php_namespace = "Google\\Cloud\\GkeBackup\\V1"; -option ruby_package = "Google::Cloud::GkeBackup::V1"; - -// A list of Kubernetes Namespaces -message Namespaces { - // A list of Kubernetes Namespaces - repeated string namespaces = 1; -} - -// A reference to a namespaced resource in Kubernetes. -message NamespacedName { - // The Namespace of the Kubernetes resource. - string namespace = 1; - - // The name of the Kubernetes resource. - string name = 2; -} - -// A list of namespaced Kubernetes resources. -message NamespacedNames { - // A list of namespaced Kubernetes resources. - repeated NamespacedName namespaced_names = 1; -} - -// Defined a customer managed encryption key that will be used to encrypt Backup -// artifacts. -message EncryptionKey { - // Google Cloud KMS encryption key. Format: - // `projects/*/locations/*/keyRings/*/cryptoKeys/*` - string gcp_kms_encryption_key = 1 [(google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - }]; -} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/gkebackup.proto b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/gkebackup.proto deleted file mode 100644 index 1a1bd10f5c4..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/gkebackup.proto +++ /dev/null @@ -1,960 +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 -// -// 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.gkebackup.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/gkebackup/v1/backup.proto"; -import "google/cloud/gkebackup/v1/backup_plan.proto"; -import "google/cloud/gkebackup/v1/restore.proto"; -import "google/cloud/gkebackup/v1/restore_plan.proto"; -import "google/cloud/gkebackup/v1/volume.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeBackup.V1"; -option go_package = "cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppb"; -option java_multiple_files = true; -option java_outer_classname = "GKEBackupProto"; -option java_package = "com.google.cloud.gkebackup.v1"; -option php_namespace = "Google\\Cloud\\GkeBackup\\V1"; -option ruby_package = "Google::Cloud::GkeBackup::V1"; -option (google.api.resource_definition) = { - type: "container.googleapis.com/Cluster" - pattern: "projects/{project}/locations/{location}/clusters/{cluster}" -}; -option (google.api.resource_definition) = { - type: "cloudkms.googleapis.com/CryptoKey" - pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" -}; - -// BackupForGKE allows Kubernetes administrators to configure, execute, and -// manage backup and restore operations for their GKE clusters. -service BackupForGKE { - option (google.api.default_host) = "gkebackup.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a new BackupPlan in a given location. - rpc CreateBackupPlan(CreateBackupPlanRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/backupPlans" - body: "backup_plan" - }; - option (google.api.method_signature) = "parent,backup_plan,backup_plan_id"; - option (google.longrunning.operation_info) = { - response_type: "BackupPlan" - metadata_type: "OperationMetadata" - }; - } - - // Lists BackupPlans in a given location. - rpc ListBackupPlans(ListBackupPlansRequest) - returns (ListBackupPlansResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/backupPlans" - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieve the details of a single BackupPlan. - rpc GetBackupPlan(GetBackupPlanRequest) returns (BackupPlan) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/backupPlans/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Update a BackupPlan. - rpc UpdateBackupPlan(UpdateBackupPlanRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{backup_plan.name=projects/*/locations/*/backupPlans/*}" - body: "backup_plan" - }; - option (google.api.method_signature) = "backup_plan,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "BackupPlan" - metadata_type: "OperationMetadata" - }; - } - - // Deletes an existing BackupPlan. - rpc DeleteBackupPlan(DeleteBackupPlanRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/backupPlans/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Creates a Backup for the given BackupPlan. - rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/backupPlans/*}/backups" - body: "backup" - }; - option (google.api.method_signature) = "parent,backup,backup_id"; - option (google.longrunning.operation_info) = { - response_type: "Backup" - metadata_type: "OperationMetadata" - }; - } - - // Lists the Backups for a given BackupPlan. - rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/backupPlans/*}/backups" - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieve the details of a single Backup. - rpc GetBackup(GetBackupRequest) returns (Backup) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/backupPlans/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Update a Backup. - rpc UpdateBackup(UpdateBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{backup.name=projects/*/locations/*/backupPlans/*/backups/*}" - body: "backup" - }; - option (google.api.method_signature) = "backup,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Backup" - metadata_type: "OperationMetadata" - }; - } - - // Deletes an existing Backup. - rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/backupPlans/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Lists the VolumeBackups for a given Backup. - rpc ListVolumeBackups(ListVolumeBackupsRequest) - returns (ListVolumeBackupsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/backupPlans/*/backups/*}/volumeBackups" - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieve the details of a single VolumeBackup. - rpc GetVolumeBackup(GetVolumeBackupRequest) returns (VolumeBackup) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new RestorePlan in a given location. - rpc CreateRestorePlan(CreateRestorePlanRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/restorePlans" - body: "restore_plan" - }; - option (google.api.method_signature) = - "parent,restore_plan,restore_plan_id"; - option (google.longrunning.operation_info) = { - response_type: "RestorePlan" - metadata_type: "OperationMetadata" - }; - } - - // Lists RestorePlans in a given location. - rpc ListRestorePlans(ListRestorePlansRequest) - returns (ListRestorePlansResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/restorePlans" - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieve the details of a single RestorePlan. - rpc GetRestorePlan(GetRestorePlanRequest) returns (RestorePlan) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/restorePlans/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Update a RestorePlan. - rpc UpdateRestorePlan(UpdateRestorePlanRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{restore_plan.name=projects/*/locations/*/restorePlans/*}" - body: "restore_plan" - }; - option (google.api.method_signature) = "restore_plan,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "RestorePlan" - metadata_type: "OperationMetadata" - }; - } - - // Deletes an existing RestorePlan. - rpc DeleteRestorePlan(DeleteRestorePlanRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/restorePlans/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Creates a new Restore for the given RestorePlan. - rpc CreateRestore(CreateRestoreRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/restorePlans/*}/restores" - body: "restore" - }; - option (google.api.method_signature) = "parent,restore,restore_id"; - option (google.longrunning.operation_info) = { - response_type: "Restore" - metadata_type: "OperationMetadata" - }; - } - - // Lists the Restores for a given RestorePlan. - rpc ListRestores(ListRestoresRequest) returns (ListRestoresResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/restorePlans/*}/restores" - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the details of a single Restore. - rpc GetRestore(GetRestoreRequest) returns (Restore) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/restorePlans/*/restores/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Update a Restore. - rpc UpdateRestore(UpdateRestoreRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{restore.name=projects/*/locations/*/restorePlans/*/restores/*}" - body: "restore" - }; - option (google.api.method_signature) = "restore,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Restore" - metadata_type: "OperationMetadata" - }; - } - - // Deletes an existing Restore. - rpc DeleteRestore(DeleteRestoreRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/restorePlans/*/restores/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Lists the VolumeRestores for a given Restore. - rpc ListVolumeRestores(ListVolumeRestoresRequest) - returns (ListVolumeRestoresResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/restorePlans/*/restores/*}/volumeRestores" - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieve the details of a single VolumeRestore. - rpc GetVolumeRestore(GetVolumeRestoreRequest) returns (VolumeRestore) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a - // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - // `Code.CANCELLED`. - bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request message for CreateBackupPlan. -message CreateBackupPlanRequest { - // Required. The location within which to create the BackupPlan. - // Format: `projects/*/locations/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The BackupPlan resource object to create. - BackupPlan backup_plan = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The client-provided short name for the BackupPlan resource. - // This name must: - // - // - be between 1 and 63 characters long (inclusive) - // - consist of only lower-case ASCII letters, numbers, and dashes - // - start with a lower-case letter - // - end with a lower-case letter or number - // - be unique within the set of BackupPlans in this location - string backup_plan_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for ListBackupPlans. -message ListBackupPlansRequest { - // Required. The location that contains the BackupPlans to list. - // Format: `projects/*/locations/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The target number of results to return in a single response. - // If not specified, a default value will be chosen by the service. - // Note that the response may inclue a partial list and a caller should - // only rely on the response's - // [next_page_token][google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token] - // to determine if there are more instances left to be queried. - int32 page_size = 2; - - // The value of - // [next_page_token][google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token] - // received from a previous `ListBackupPlans` call. - // Provide this to retrieve the subsequent page in a multi-page list of - // results. When paginating, all other parameters provided to - // `ListBackupPlans` must match the call that provided the page token. - string page_token = 3; - - // Field match expression used to filter the results. - string filter = 4; - - // Field by which to sort the results. - string order_by = 5; -} - -// Response message for ListBackupPlans. -message ListBackupPlansResponse { - // The list of BackupPlans matching the given criteria. - repeated BackupPlan backup_plans = 1; - - // A token which may be sent as - // [page_token][google.cloud.gkebackup.v1.ListBackupPlansRequest.page_token] - // in a subsequent `ListBackupPlans` call to retrieve the next page of - // results. If this field is omitted or empty, then there are no more results - // to return. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for GetBackupPlan. -message GetBackupPlanRequest { - // Required. Fully qualified BackupPlan name. - // Format: `projects/*/locations/*/backupPlans/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/BackupPlan" - } - ]; -} - -// Request message for UpdateBackupPlan. -message UpdateBackupPlanRequest { - // Required. A new version of the BackupPlan resource that contains updated - // fields. This may be sparsely populated if an `update_mask` is provided. - BackupPlan backup_plan = 1 [(google.api.field_behavior) = REQUIRED]; - - // This is used to specify the fields to be overwritten in the - // BackupPlan targeted for update. The values for each of these - // updated fields will be taken from the `backup_plan` provided - // with this request. Field names are relative to the root of the resource - // (e.g., `description`, `backup_config.include_volume_data`, etc.) - // If no `update_mask` is provided, all fields in `backup_plan` will be - // written to the target BackupPlan resource. - // Note that OUTPUT_ONLY and IMMUTABLE fields in `backup_plan` are ignored - // and are not used to update the target BackupPlan. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for DeleteBackupPlan. -message DeleteBackupPlanRequest { - // Required. Fully qualified BackupPlan name. - // Format: `projects/*/locations/*/backupPlans/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/BackupPlan" - } - ]; - - // If provided, this value must match the current value of the - // target BackupPlan's [etag][google.cloud.gkebackup.v1.BackupPlan.etag] field - // or the request is rejected. - string etag = 2; -} - -// Request message for CreateBackup. -message CreateBackupRequest { - // Required. The BackupPlan within which to create the Backup. - // Format: `projects/*/locations/*/backupPlans/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/BackupPlan" - } - ]; - - // The Backup resource to create. - Backup backup = 2; - - // The client-provided short name for the Backup resource. - // This name must: - // - // - be between 1 and 63 characters long (inclusive) - // - consist of only lower-case ASCII letters, numbers, and dashes - // - start with a lower-case letter - // - end with a lower-case letter or number - // - be unique within the set of Backups in this BackupPlan - string backup_id = 3; -} - -// Request message for ListBackups. -message ListBackupsRequest { - // Required. The BackupPlan that contains the Backups to list. - // Format: `projects/*/locations/*/backupPlans/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/BackupPlan" - } - ]; - - // The target number of results to return in a single response. - // If not specified, a default value will be chosen by the service. - // Note that the response may inclue a partial list and a caller should - // only rely on the response's - // [next_page_token][google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token] - // to determine if there are more instances left to be queried. - int32 page_size = 2; - - // The value of - // [next_page_token][google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token] - // received from a previous `ListBackups` call. - // Provide this to retrieve the subsequent page in a multi-page list of - // results. When paginating, all other parameters provided to - // `ListBackups` must match the call that provided the page token. - string page_token = 3; - - // Field match expression used to filter the results. - string filter = 4; - - // Field by which to sort the results. - string order_by = 5; -} - -// Response message for ListBackups. -message ListBackupsResponse { - // The list of Backups matching the given criteria. - repeated Backup backups = 1; - - // A token which may be sent as - // [page_token][google.cloud.gkebackup.v1.ListBackupsRequest.page_token] in a - // subsequent `ListBackups` call to retrieve the next page of results. If this - // field is omitted or empty, then there are no more results to return. - string next_page_token = 2; -} - -// Request message for GetBackup. -message GetBackupRequest { - // Required. Full name of the Backup resource. - // Format: `projects/*/locations/*/backupPlans/*/backups/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/Backup" - } - ]; -} - -// Request message for UpdateBackup. -message UpdateBackupRequest { - // Required. A new version of the Backup resource that contains updated - // fields. This may be sparsely populated if an `update_mask` is provided. - Backup backup = 1 [(google.api.field_behavior) = REQUIRED]; - - // This is used to specify the fields to be overwritten in the - // Backup targeted for update. The values for each of these - // updated fields will be taken from the `backup_plan` provided - // with this request. Field names are relative to the root of the resource. - // If no `update_mask` is provided, all fields in `backup` will be - // written to the target Backup resource. - // Note that OUTPUT_ONLY and IMMUTABLE fields in `backup` are ignored - // and are not used to update the target Backup. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for DeleteBackup. -message DeleteBackupRequest { - // Required. Name of the Backup resource. - // Format: `projects/*/locations/*/backupPlans/*/backups/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/Backup" - } - ]; - - // If provided, this value must match the current value of the - // target Backup's [etag][google.cloud.gkebackup.v1.Backup.etag] field or the - // request is rejected. - string etag = 2; - - // If set to true, any VolumeBackups below this Backup will also be deleted. - // Otherwise, the request will only succeed if the Backup has no - // VolumeBackups. - bool force = 3; -} - -// Request message for ListVolumeBackups. -message ListVolumeBackupsRequest { - // Required. The Backup that contains the VolumeBackups to list. - // Format: `projects/*/locations/*/backupPlans/*/backups/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/Backup" - } - ]; - - // The target number of results to return in a single response. - // If not specified, a default value will be chosen by the service. - // Note that the response may inclue a partial list and a caller should - // only rely on the response's - // [next_page_token][google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token] - // to determine if there are more instances left to be queried. - int32 page_size = 2; - - // The value of - // [next_page_token][google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token] - // received from a previous `ListVolumeBackups` call. - // Provide this to retrieve the subsequent page in a multi-page list of - // results. When paginating, all other parameters provided to - // `ListVolumeBackups` must match the call that provided the page token. - string page_token = 3; - - // Field match expression used to filter the results. - string filter = 4; - - // Field by which to sort the results. - string order_by = 5; -} - -// Response message for ListVolumeBackups. -message ListVolumeBackupsResponse { - // The list of VolumeBackups matching the given criteria. - repeated VolumeBackup volume_backups = 1; - - // A token which may be sent as - // [page_token][google.cloud.gkebackup.v1.ListVolumeBackupsRequest.page_token] - // in a subsequent `ListVolumeBackups` call to retrieve the next page of - // results. If this field is omitted or empty, then there are no more results - // to return. - string next_page_token = 2; -} - -// Request message for GetVolumeBackup. -message GetVolumeBackupRequest { - // Required. Full name of the VolumeBackup resource. - // Format: `projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/VolumeBackup" - } - ]; -} - -// Request message for CreateRestorePlan. -message CreateRestorePlanRequest { - // Required. The location within which to create the RestorePlan. - // Format: `projects/*/locations/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The RestorePlan resource object to create. - RestorePlan restore_plan = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The client-provided short name for the RestorePlan resource. - // This name must: - // - // - be between 1 and 63 characters long (inclusive) - // - consist of only lower-case ASCII letters, numbers, and dashes - // - start with a lower-case letter - // - end with a lower-case letter or number - // - be unique within the set of RestorePlans in this location - string restore_plan_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for ListRestorePlans. -message ListRestorePlansRequest { - // Required. The location that contains the RestorePlans to list. - // Format: `projects/*/locations/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The target number of results to return in a single response. - // If not specified, a default value will be chosen by the service. - // Note that the response may inclue a partial list and a caller should - // only rely on the response's - // [next_page_token][google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token] - // to determine if there are more instances left to be queried. - int32 page_size = 2; - - // The value of - // [next_page_token][google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token] - // received from a previous `ListRestorePlans` call. - // Provide this to retrieve the subsequent page in a multi-page list of - // results. When paginating, all other parameters provided to - // `ListRestorePlans` must match the call that provided the page token. - string page_token = 3; - - // Field match expression used to filter the results. - string filter = 4; - - // Field by which to sort the results. - string order_by = 5; -} - -// Response message for ListRestorePlans. -message ListRestorePlansResponse { - // The list of RestorePlans matching the given criteria. - repeated RestorePlan restore_plans = 1; - - // A token which may be sent as - // [page_token][google.cloud.gkebackup.v1.ListRestorePlansRequest.page_token] - // in a subsequent `ListRestorePlans` call to retrieve the next page of - // results. If this field is omitted or empty, then there are no more results - // to return. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for GetRestorePlan. -message GetRestorePlanRequest { - // Required. Fully qualified RestorePlan name. - // Format: `projects/*/locations/*/restorePlans/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/RestorePlan" - } - ]; -} - -// Request message for UpdateRestorePlan. -message UpdateRestorePlanRequest { - // Required. A new version of the RestorePlan resource that contains updated - // fields. This may be sparsely populated if an `update_mask` is provided. - RestorePlan restore_plan = 1 [(google.api.field_behavior) = REQUIRED]; - - // This is used to specify the fields to be overwritten in the - // RestorePlan targeted for update. The values for each of these - // updated fields will be taken from the `restore_plan` provided - // with this request. Field names are relative to the root of the resource. - // If no `update_mask` is provided, all fields in `restore_plan` will be - // written to the target RestorePlan resource. - // Note that OUTPUT_ONLY and IMMUTABLE fields in `restore_plan` are ignored - // and are not used to update the target RestorePlan. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for DeleteRestorePlan. -message DeleteRestorePlanRequest { - // Required. Fully qualified RestorePlan name. - // Format: `projects/*/locations/*/restorePlans/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/RestorePlan" - } - ]; - - // If provided, this value must match the current value of the - // target RestorePlan's [etag][google.cloud.gkebackup.v1.RestorePlan.etag] - // field or the request is rejected. - string etag = 2; - - // If set to true, any Restores below this RestorePlan will also be deleted. - // Otherwise, the request will only succeed if the RestorePlan has no - // Restores. - bool force = 3; -} - -// Request message for CreateRestore. -message CreateRestoreRequest { - // Required. The RestorePlan within which to create the Restore. - // Format: `projects/*/locations/*/restorePlans/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/RestorePlan" - } - ]; - - // Required. The restore resource to create. - Restore restore = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The client-provided short name for the Restore resource. - // This name must: - // - // - be between 1 and 63 characters long (inclusive) - // - consist of only lower-case ASCII letters, numbers, and dashes - // - start with a lower-case letter - // - end with a lower-case letter or number - // - be unique within the set of Restores in this RestorePlan. - string restore_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for ListRestores. -message ListRestoresRequest { - // Required. The RestorePlan that contains the Restores to list. - // Format: `projects/*/locations/*/restorePlans/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/RestorePlan" - } - ]; - - // The target number of results to return in a single response. - // If not specified, a default value will be chosen by the service. - // Note that the response may inclue a partial list and a caller should - // only rely on the response's - // [next_page_token][google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token] - // to determine if there are more instances left to be queried. - int32 page_size = 2; - - // The value of - // [next_page_token][google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token] - // received from a previous `ListRestores` call. - // Provide this to retrieve the subsequent page in a multi-page list of - // results. When paginating, all other parameters provided to `ListRestores` - // must match the call that provided the page token. - string page_token = 3; - - // Field match expression used to filter the results. - string filter = 4; - - // Field by which to sort the results. - string order_by = 5; -} - -// Response message for ListRestores. -message ListRestoresResponse { - // The list of Restores matching the given criteria. - repeated Restore restores = 1; - - // A token which may be sent as - // [page_token][google.cloud.gkebackup.v1.ListRestoresRequest.page_token] in a - // subsequent `ListRestores` call to retrieve the next page of results. If - // this field is omitted or empty, then there are no more results to return. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for GetRestore. -message GetRestoreRequest { - // Required. Name of the restore resource. - // Format: `projects/*/locations/*/restorePlans/*/restores/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/Restore" - } - ]; -} - -// Request message for UpdateRestore. -message UpdateRestoreRequest { - // Required. A new version of the Restore resource that contains updated - // fields. This may be sparsely populated if an `update_mask` is provided. - Restore restore = 1 [(google.api.field_behavior) = REQUIRED]; - - // This is used to specify the fields to be overwritten in the - // Restore targeted for update. The values for each of these - // updated fields will be taken from the `restore` provided - // with this request. Field names are relative to the root of the resource. - // If no `update_mask` is provided, all fields in `restore` will be - // written to the target Restore resource. - // Note that OUTPUT_ONLY and IMMUTABLE fields in `restore` are ignored - // and are not used to update the target Restore. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for DeleteRestore. -message DeleteRestoreRequest { - // Required. Full name of the Restore - // Format: `projects/*/locations/*/restorePlans/*/restores/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/Restore" - } - ]; - - // If provided, this value must match the current value of the - // target Restore's [etag][google.cloud.gkebackup.v1.Restore.etag] field or - // the request is rejected. - string etag = 2; - - // If set to true, any VolumeRestores below this restore will also be deleted. - // Otherwise, the request will only succeed if the restore has no - // VolumeRestores. - bool force = 3; -} - -// Request message for ListVolumeRestores. -message ListVolumeRestoresRequest { - // Required. The Restore that contains the VolumeRestores to list. - // Format: `projects/*/locations/*/restorePlans/*/restores/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/Restore" - } - ]; - - // The target number of results to return in a single response. - // If not specified, a default value will be chosen by the service. - // Note that the response may inclue a partial list and a caller should - // only rely on the response's - // [next_page_token][google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token] - // to determine if there are more instances left to be queried. - int32 page_size = 2; - - // The value of - // [next_page_token][google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token] - // received from a previous `ListVolumeRestores` call. - // Provide this to retrieve the subsequent page in a multi-page list of - // results. When paginating, all other parameters provided to - // `ListVolumeRestores` must match the call that provided the page token. - string page_token = 3; - - // Field match expression used to filter the results. - string filter = 4; - - // Field by which to sort the results. - string order_by = 5; -} - -// Response message for ListVolumeRestores. -message ListVolumeRestoresResponse { - // The list of VolumeRestores matching the given criteria. - repeated VolumeRestore volume_restores = 1; - - // A token which may be sent as - // [page_token][google.cloud.gkebackup.v1.ListVolumeRestoresRequest.page_token] - // in a subsequent `ListVolumeRestores` call to retrieve the next page of - // results. If this field is omitted or empty, then there are no more results - // to return. - string next_page_token = 2; -} - -// Request message for GetVolumeRestore. -message GetVolumeRestoreRequest { - // Required. Full name of the VolumeRestore resource. - // Format: `projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/VolumeRestore" - } - ]; -} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/restore.proto b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/restore.proto deleted file mode 100644 index 968b4f447d9..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/restore.proto +++ /dev/null @@ -1,494 +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 -// -// 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.gkebackup.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/gkebackup/v1/common.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeBackup.V1"; -option go_package = "cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppb"; -option java_multiple_files = true; -option java_outer_classname = "RestoreProto"; -option java_package = "com.google.cloud.gkebackup.v1"; -option php_namespace = "Google\\Cloud\\GkeBackup\\V1"; -option ruby_package = "Google::Cloud::GkeBackup::V1"; - -// Represents both a request to Restore some portion of a Backup into -// a target GKE cluster and a record of the restore operation itself. -// Next id: 18 -message Restore { - option (google.api.resource) = { - type: "gkebackup.googleapis.com/Restore" - pattern: "projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore}" - }; - - // Possible values for state of the Restore. - enum State { - // The Restore resource is in the process of being created. - STATE_UNSPECIFIED = 0; - - // The Restore resource has been created and the associated RestoreJob - // Kubernetes resource has been injected into target cluster. - CREATING = 1; - - // The gkebackup agent in the cluster has begun executing the restore - // operation. - IN_PROGRESS = 2; - - // The restore operation has completed successfully. Restored workloads may - // not yet be operational. - SUCCEEDED = 3; - - // The restore operation has failed. - FAILED = 4; - - // This Restore resource is in the process of being deleted. - DELETING = 5; - } - - // Output only. The full name of the Restore resource. - // Format: `projects/*/locations/*/restorePlans/*/restores/*` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server generated global unique identifier of - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. - string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when this Restore resource was created. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when this Restore resource was last - // updated. - google.protobuf.Timestamp update_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User specified descriptive string for this Restore. - string description = 5; - - // Required. Immutable. A reference to the - // [Backup][google.cloud.gkebackup.v1.Backup] used as the source from which - // this Restore will restore. Note that this Backup must be a sub-resource of - // the RestorePlan's - // [backup_plan][google.cloud.gkebackup.v1.RestorePlan.backup_plan]. Format: - // `projects/*/locations/*/backupPlans/*/backups/*`. - string backup = 6 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/Backup" - } - ]; - - // Output only. The target cluster into which this Restore will restore data. - // Valid formats: - // - // - `projects/*/locations/*/clusters/*` - // - `projects/*/zones/*/clusters/*` - // - // Inherited from parent RestorePlan's - // [cluster][google.cloud.gkebackup.v1.RestorePlan.cluster] value. - string cluster = 7 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "container.googleapis.com/Cluster" - } - ]; - - // Output only. Configuration of the Restore. Inherited from parent - // RestorePlan's - // [restore_config][google.cloud.gkebackup.v1.RestorePlan.restore_config]. - RestoreConfig restore_config = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A set of custom labels supplied by user. - map labels = 9; - - // Output only. The current state of the Restore. - State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable description of why the Restore is in its - // current state. - string state_reason = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Timestamp of when the restore operation completed. - google.protobuf.Timestamp complete_time = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of resources restored during the restore execution. - int32 resources_restored_count = 13 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of resources excluded during the restore execution. - int32 resources_excluded_count = 14 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of resources that failed to be restored during the - // restore execution. - int32 resources_failed_count = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of volumes restored during the restore execution. - int32 volumes_restored_count = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. `etag` is used for optimistic concurrency control as a way to - // help prevent simultaneous updates of a restore from overwriting each other. - // It is strongly suggested that systems make use of the `etag` in the - // read-modify-write cycle to perform restore updates in order to avoid - // race conditions: An `etag` is returned in the response to `GetRestore`, - // and systems are expected to put that etag in the request to - // `UpdateRestore` or `DeleteRestore` to ensure that their change will be - // applied to the same version of the resource. - string etag = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Configuration of a restore. -// Next id: 12 -message RestoreConfig { - // Defines how volume data should be restored. - enum VolumeDataRestorePolicy { - // Unspecified (illegal). - VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED = 0; - - // For each PVC to be restored, create a new underlying volume and PV - // from the corresponding VolumeBackup contained within the Backup. - RESTORE_VOLUME_DATA_FROM_BACKUP = 1; - - // For each PVC to be restored, attempt to reuse the original PV contained - // in the Backup (with its original underlying volume). This option - // is likely only usable when restoring a workload to its original cluster. - REUSE_VOLUME_HANDLE_FROM_BACKUP = 2; - - // For each PVC to be restored, create PVC without any particular - // action to restore data. In this case, the normal Kubernetes provisioning - // logic would kick in, and this would likely result in either dynamically - // provisioning blank PVs or binding to statically provisioned PVs. - NO_VOLUME_DATA_RESTORATION = 3; - } - - // Defines the behavior for handling the situation where cluster-scoped - // resources being restored already exist in the target cluster. - enum ClusterResourceConflictPolicy { - // Unspecified. Only allowed if no cluster-scoped resources will be - // restored. - CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED = 0; - - // Do not attempt to restore the conflicting resource. - USE_EXISTING_VERSION = 1; - - // Delete the existing version before re-creating it from the Backup. - // This is a dangerous option which could cause unintentional - // data loss if used inappropriately. For example, deleting a CRD will - // cause Kubernetes to delete all CRs of that type. - USE_BACKUP_VERSION = 2; - } - - // Defines the behavior for handling the situation where sets of namespaced - // resources being restored already exist in the target cluster. - enum NamespacedResourceRestoreMode { - // Unspecified (invalid). - NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED = 0; - - // When conflicting top-level resources (either Namespaces or - // ProtectedApplications, depending upon the scope) are encountered, this - // will first trigger a delete of the conflicting resource AND ALL OF ITS - // REFERENCED RESOURCES (e.g., all resources in the Namespace or all - // resources referenced by the ProtectedApplication) before restoring the - // resources from the Backup. This mode should only be used when you are - // intending to revert some portion of a cluster to an earlier state. - DELETE_AND_RESTORE = 1; - - // If conflicting top-level resources (either Namespaces or - // ProtectedApplications, depending upon the scope) are encountered at the - // beginning of a restore process, the Restore will fail. If a conflict - // occurs during the restore process itself (e.g., because an out of band - // process creates conflicting resources), a conflict will be reported. - FAIL_ON_CONFLICT = 2; - } - - // This is a direct map to the Kubernetes GroupKind type - // [GroupKind](https://godoc.org/k8s.io/apimachinery/pkg/runtime/schema#GroupKind) - // and is used for identifying specific "types" of resources to restore. - message GroupKind { - // API group string of a Kubernetes resource, e.g. - // "apiextensions.k8s.io", "storage.k8s.io", etc. - // Note: use empty string for core API group - string resource_group = 1; - - // Kind of a Kubernetes resource, e.g. - // "CustomResourceDefinition", "StorageClass", etc. - string resource_kind = 2; - } - - // Defines the scope of cluster-scoped resources to restore. - // - // Some group kinds are not reasonable choices for a restore, and will cause - // an error if selected here. Any scope selection that would restore - // "all valid" resources automatically excludes these group kinds. - // - gkebackup.gke.io/BackupJob - // - gkebackup.gke.io/RestoreJob - // - metrics.k8s.io/NodeMetrics - // - migration.k8s.io/StorageState - // - migration.k8s.io/StorageVersionMigration - // - Node - // - snapshot.storage.k8s.io/VolumeSnapshotContent - // - storage.k8s.io/CSINode - // - // Some group kinds are driven by restore configuration elsewhere, - // and will cause an error if selected here. - // - Namespace - // - PersistentVolume - message ClusterResourceRestoreScope { - // A list of cluster-scoped resource group kinds to restore from the - // backup. If specified, only the selected resources will be restored. - // Mutually exclusive to any other field in the message. - repeated GroupKind selected_group_kinds = 1; - - // A list of cluster-scoped resource group kinds to NOT restore from the - // backup. If specified, all valid cluster-scoped resources will be - // restored except for those specified in the list. - // Mutually exclusive to any other field in the message. - repeated GroupKind excluded_group_kinds = 2; - - // If True, all valid cluster-scoped resources will be restored. - // Mutually exclusive to any other field in the message. - bool all_group_kinds = 3; - - // If True, no cluster-scoped resources will be restored. - // This has the same restore scope as if the message is not defined. - // Mutually exclusive to any other field in the message. - bool no_group_kinds = 4; - } - - // A transformation rule to be applied against Kubernetes resources as they - // are selected for restoration from a Backup. A rule contains both filtering - // logic (which resources are subject to substitution) and substitution logic. - message SubstitutionRule { - // (Filtering parameter) Any resource subject to substitution must be - // contained within one of the listed Kubernetes Namespace in the Backup. - // If this field is not provided, no namespace filtering will be performed - // (all resources in all Namespaces, including all cluster-scoped resources, - // will be candidates for substitution). - // To mix cluster-scoped and namespaced resources in the same rule, use an - // empty string ("") as one of the target namespaces. - repeated string target_namespaces = 1; - - // (Filtering parameter) Any resource subject to substitution must belong to - // one of the listed "types". - // If this field is not provided, no type filtering will be performed (all - // resources of all types matching previous filtering parameters will be - // candidates for substitution). - repeated GroupKind target_group_kinds = 2; - - // Required. This is a [JSONPath] - // (https://kubernetes.io/docs/reference/kubectl/jsonpath/) - // expression that matches specific fields of candidate - // resources and it operates as both a filtering parameter (resources that - // are not matched with this expression will not be candidates for - // substitution) as well as a field identifier (identifies exactly which - // fields out of the candidate resources will be modified). - string target_json_path = 3 [(google.api.field_behavior) = REQUIRED]; - - // (Filtering parameter) This is a [regular expression] - // (https://en.wikipedia.org/wiki/Regular_expression) - // that is compared against the fields matched by the target_json_path - // expression (and must also have passed the previous filters). - // Substitution will not be performed against fields whose - // value does not match this expression. If this field is NOT specified, - // then ALL fields matched by the target_json_path expression will undergo - // substitution. Note that an empty (e.g., "", rather than unspecified) - // value for this field will only match empty fields. - string original_value_pattern = 4; - - // This is the new value to set for any fields that pass the filtering and - // selection criteria. To remove a value from a Kubernetes resource, either - // leave this field unspecified, or set it to the empty string (""). - string new_value = 5; - } - - // TransformationRuleAction defines a TransformationRule action based on the - // JSON Patch RFC (https://www.rfc-editor.org/rfc/rfc6902) - message TransformationRuleAction { - // Possible values for operations of a transformation rule action. - enum Op { - // Unspecified operation - OP_UNSPECIFIED = 0; - - // The "remove" operation removes the value at the target location. - REMOVE = 1; - - // The "move" operation removes the value at a specified location and - // adds it to the target location. - MOVE = 2; - - // The "copy" operation copies the value at a specified location to the - // target location. - COPY = 3; - - // The "add" operation performs one of the following functions, - // depending upon what the target location references: - // 1. If the target location specifies an array index, a new value is - // inserted into the array at the specified index. - // 2. If the target location specifies an object member that does not - // already exist, a new member is added to the object. - // 3. If the target location specifies an object member that does exist, - // that member's value is replaced. - ADD = 4; - - // The "test" operation tests that a value at the target location is - // equal to a specified value. - TEST = 5; - - // The "replace" operation replaces the value at the target location - // with a new value. The operation object MUST contain a "value" member - // whose content specifies the replacement value. - REPLACE = 6; - } - - // Required. op specifies the operation to perform. - Op op = 1 [(google.api.field_behavior) = REQUIRED]; - - // A string containing a JSON Pointer value that references the location in - // the target document to move the value from. - string from_path = 2; - - // A string containing a JSON-Pointer value that references a location - // within the target document where the operation is performed. - string path = 3; - - // A string that specifies the desired value in string format to - // use for transformation. - string value = 4; - } - - // ResourceFilter specifies matching criteria to limit the scope of a - // change to a specific set of kubernetes resources that are selected for - // restoration from a backup. - message ResourceFilter { - // (Filtering parameter) Any resource subject to transformation must be - // contained within one of the listed Kubernetes Namespace in the Backup. - // If this field is not provided, no namespace filtering will be performed - // (all resources in all Namespaces, including all cluster-scoped resources, - // will be candidates for transformation). - // To mix cluster-scoped and namespaced resources in the same rule, use an - // empty string ("") as one of the target namespaces. - repeated string namespaces = 1; - - // (Filtering parameter) Any resource subject to transformation must belong - // to one of the listed "types". If this field is not provided, no type - // filtering will be performed (all resources of all types matching previous - // filtering parameters will be candidates for transformation). - repeated GroupKind group_kinds = 2; - - // This is a [JSONPath] - // (https://github.com/json-path/JsonPath/blob/master/README.md) - // expression that matches specific fields of candidate - // resources and it operates as a filtering parameter (resources that - // are not matched with this expression will not be candidates for - // transformation). - string json_path = 3; - } - - // A transformation rule to be applied against Kubernetes resources as they - // are selected for restoration from a Backup. A rule contains both filtering - // logic (which resources are subject to transform) and transformation logic. - message TransformationRule { - // Required. A list of transformation rule actions to take against candidate - // resources. Actions are executed in order defined - this order matters, as - // they could potentially interfere with each other and the first operation - // could affect the outcome of the second operation. - repeated TransformationRuleAction field_actions = 1 - [(google.api.field_behavior) = REQUIRED]; - - // This field is used to specify a set of fields that should be used to - // determine which resources in backup should be acted upon by the supplied - // transformation rule actions, and this will ensure that only specific - // resources are affected by transformation rule actions. - ResourceFilter resource_filter = 2; - - // The description is a user specified string description of the - // transformation rule. - string description = 3; - } - - // Specifies the mechanism to be used to restore volume data. - // Default: VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED (will be treated as - // NO_VOLUME_DATA_RESTORATION). - VolumeDataRestorePolicy volume_data_restore_policy = 1; - - // Defines the behavior for handling the situation where cluster-scoped - // resources being restored already exist in the target cluster. This MUST be - // set to a value other than CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED if - // [cluster_resource_restore_scope][google.cloud.gkebackup.v1.RestoreConfig.cluster_resource_restore_scope] - // is not empty. - ClusterResourceConflictPolicy cluster_resource_conflict_policy = 2; - - // Defines the behavior for handling the situation where sets of namespaced - // resources being restored already exist in the target cluster. This MUST be - // set to a value other than NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED. - NamespacedResourceRestoreMode namespaced_resource_restore_mode = 3; - - // Identifies the cluster-scoped resources to restore from the Backup. - // Not specifying it means NO cluster resource will be restored. - ClusterResourceRestoreScope cluster_resource_restore_scope = 4; - - // Specifies the namespaced resources to restore from the Backup. - // Only one of the entries may be specified. If not specified, NO namespaced - // resources will be restored. - // - // Note: Resources will never be restored into *managed* namespaces such as - // `kube-system`, `kube-public`, or `kube-node-lease`. These namespaces - // are silently skipped when - // [all_namespaces][google.cloud.gkebackup.v1.RestoreConfig.all_namespaces] is - // selected. Listing them explicitly will result in an error. - oneof namespaced_resource_restore_scope { - // Restore all namespaced resources in the Backup if set to "True". - // Specifying this field to "False" is an error. - bool all_namespaces = 5; - - // A list of selected Namespaces to restore from the Backup. The listed - // Namespaces and all resources contained in them will be restored. - Namespaces selected_namespaces = 6; - - // A list of selected ProtectedApplications to restore. The listed - // ProtectedApplications and all the resources to which they refer will be - // restored. - NamespacedNames selected_applications = 7; - - // Do not restore any namespaced resources if set to "True". - // Specifying this field to "False" is not allowed. - bool no_namespaces = 9; - - // A list of selected namespaces excluded from restoration. All - // namespaces except those in this list will be restored. - Namespaces excluded_namespaces = 10; - } - - // A list of transformation rules to be applied against Kubernetes resources - // as they are selected for restoration from a Backup. Rules are executed in - // order defined - this order matters, as changes made by a rule may impact - // the filtering logic of subsequent rules. An empty list means no - // substitution will occur. - repeated SubstitutionRule substitution_rules = 8; - - // A list of transformation rules to be applied against Kubernetes resources - // as they are selected for restoration from a Backup. Rules are executed in - // order defined - this order matters, as changes made by a rule may impact - // the filtering logic of subsequent rules. An empty list means no - // transformation will occur. - repeated TransformationRule transformation_rules = 11; -} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/restore_plan.proto b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/restore_plan.proto deleted file mode 100644 index 117412190ca..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/restore_plan.proto +++ /dev/null @@ -1,130 +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 -// -// 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.gkebackup.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/gkebackup/v1/restore.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeBackup.V1"; -option go_package = "cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppb"; -option java_multiple_files = true; -option java_outer_classname = "RestorePlanProto"; -option java_package = "com.google.cloud.gkebackup.v1"; -option php_namespace = "Google\\Cloud\\GkeBackup\\V1"; -option ruby_package = "Google::Cloud::GkeBackup::V1"; - -// The configuration of a potential series of Restore operations to be performed -// against Backups belong to a particular BackupPlan. -// Next id: 13 -message RestorePlan { - option (google.api.resource) = { - type: "gkebackup.googleapis.com/RestorePlan" - pattern: "projects/{project}/locations/{location}/restorePlans/{restore_plan}" - }; - - // State - enum State { - // Default first value for Enums. - STATE_UNSPECIFIED = 0; - - // Waiting for cluster state to be RUNNING. - CLUSTER_PENDING = 1; - - // The RestorePlan has successfully been created and is ready for Restores. - READY = 2; - - // RestorePlan creation has failed. - FAILED = 3; - - // The RestorePlan is in the process of being deleted. - DELETING = 4; - } - - // Output only. The full name of the RestorePlan resource. - // Format: `projects/*/locations/*/restorePlans/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server generated global unique identifier of - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. - string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when this RestorePlan resource was - // created. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when this RestorePlan resource was last - // updated. - google.protobuf.Timestamp update_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User specified descriptive string for this RestorePlan. - string description = 5; - - // Required. Immutable. A reference to the - // [BackupPlan][google.cloud.gkebackup.v1.BackupPlan] from which Backups may - // be used as the source for Restores created via this RestorePlan. Format: - // `projects/*/locations/*/backupPlans/*`. - string backup_plan = 6 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkebackup.googleapis.com/BackupPlan" - } - ]; - - // Required. Immutable. The target cluster into which Restores created via - // this RestorePlan will restore data. NOTE: the cluster's region must be the - // same as the RestorePlan. Valid formats: - // - // - `projects/*/locations/*/clusters/*` - // - `projects/*/zones/*/clusters/*` - string cluster = 7 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "container.googleapis.com/Cluster" - } - ]; - - // Required. Configuration of Restores created via this RestorePlan. - RestoreConfig restore_config = 8 [(google.api.field_behavior) = REQUIRED]; - - // A set of custom labels supplied by user. - map labels = 9; - - // Output only. `etag` is used for optimistic concurrency control as a way to - // help prevent simultaneous updates of a restore from overwriting each other. - // It is strongly suggested that systems make use of the `etag` in the - // read-modify-write cycle to perform restore updates in order to avoid - // race conditions: An `etag` is returned in the response to `GetRestorePlan`, - // and systems are expected to put that etag in the request to - // `UpdateRestorePlan` or `DeleteRestorePlan` to ensure that their change - // will be applied to the same version of the resource. - string etag = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. State of the RestorePlan. This State field reflects the - // various stages a RestorePlan can be in - // during the Create operation. - State state = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable description of why RestorePlan is in the - // current `state` - string state_reason = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/volume.proto b/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/volume.proto deleted file mode 100644 index 37c62f2c528..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/protos/google/cloud/gkebackup/v1/volume.proto +++ /dev/null @@ -1,231 +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 -// -// 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.gkebackup.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/gkebackup/v1/common.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeBackup.V1"; -option go_package = "cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppb"; -option java_multiple_files = true; -option java_outer_classname = "VolumeProto"; -option java_package = "com.google.cloud.gkebackup.v1"; -option php_namespace = "Google\\Cloud\\GkeBackup\\V1"; -option ruby_package = "Google::Cloud::GkeBackup::V1"; - -// Represents the backup of a specific persistent volume as a component of a -// Backup - both the record of the operation and a pointer to the underlying -// storage-specific artifacts. -// Next id: 14 -message VolumeBackup { - option (google.api.resource) = { - type: "gkebackup.googleapis.com/VolumeBackup" - pattern: "projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}/volumeBackups/{volume_backup}" - }; - - // Identifies the format used for the volume backup. - enum VolumeBackupFormat { - // Default value, not specified. - VOLUME_BACKUP_FORMAT_UNSPECIFIED = 0; - - // Compute Engine Persistent Disk snapshot based volume backup. - GCE_PERSISTENT_DISK = 1; - } - - // The current state of a VolumeBackup - enum State { - // This is an illegal state and should not be encountered. - STATE_UNSPECIFIED = 0; - - // A volume for the backup was identified and backup process is about to - // start. - CREATING = 1; - - // The volume backup operation has begun and is in the initial "snapshot" - // phase of the process. Any defined ProtectedApplication "pre" hooks will - // be executed before entering this state and "post" hooks will be executed - // upon leaving this state. - SNAPSHOTTING = 2; - - // The snapshot phase of the volume backup operation has completed and - // the snapshot is now being uploaded to backup storage. - UPLOADING = 3; - - // The volume backup operation has completed successfully. - SUCCEEDED = 4; - - // The volume backup operation has failed. - FAILED = 5; - - // This VolumeBackup resource (and its associated artifacts) is in the - // process of being deleted. - DELETING = 6; - } - - // Output only. The full name of the VolumeBackup resource. - // Format: `projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server generated global unique identifier of - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. - string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when this VolumeBackup resource was - // created. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when this VolumeBackup resource was last - // updated. - google.protobuf.Timestamp update_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A reference to the source Kubernetes PVC from which this - // VolumeBackup was created. - NamespacedName source_pvc = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A storage system-specific opaque handle to the underlying - // volume backup. - string volume_backup_handle = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The format used for the volume backup. - VolumeBackupFormat format = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The aggregate size of the underlying artifacts associated with - // this VolumeBackup in the backup storage. This may change over time when - // multiple backups of the same volume share the same backup storage - // location. In particular, this is likely to increase in size when - // the immediately preceding backup of the same volume is deleted. - int64 storage_bytes = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The minimum size of the disk to which this VolumeBackup can be - // restored. - int64 disk_size_bytes = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when the associated underlying volume backup - // operation completed. - google.protobuf.Timestamp complete_time = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of this VolumeBackup. - State state = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A human readable message explaining why the VolumeBackup is in - // its current state. - string state_message = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. `etag` is used for optimistic concurrency control as a way to - // help prevent simultaneous updates of a volume backup from overwriting each - // other. It is strongly suggested that systems make use of the `etag` in the - // read-modify-write cycle to perform volume backup updates in order to avoid - // race conditions. - string etag = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents the operation of restoring a volume from a VolumeBackup. -// Next id: 13 -message VolumeRestore { - option (google.api.resource) = { - type: "gkebackup.googleapis.com/VolumeRestore" - pattern: "projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore}/volumeRestores/{volume_restore}" - }; - - // Supported volume types. - enum VolumeType { - // Default - VOLUME_TYPE_UNSPECIFIED = 0; - - // Compute Engine Persistent Disk volume - GCE_PERSISTENT_DISK = 1; - } - - // The current state of a VolumeRestore - enum State { - // This is an illegal state and should not be encountered. - STATE_UNSPECIFIED = 0; - - // A volume for the restore was identified and restore process is about to - // start. - CREATING = 1; - - // The volume is currently being restored. - RESTORING = 2; - - // The volume has been successfully restored. - SUCCEEDED = 3; - - // The volume restoration process failed. - FAILED = 4; - - // This VolumeRestore resource is in the process of being deleted. - DELETING = 5; - } - - // Output only. Full name of the VolumeRestore resource. - // Format: `projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server generated global unique identifier of - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format. - string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when this VolumeRestore resource was - // created. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when this VolumeRestore resource was last - // updated. - google.protobuf.Timestamp update_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The full name of the VolumeBackup from which the volume will - // be restored. Format: - // `projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*`. - string volume_backup = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The reference to the target Kubernetes PVC to be restored. - NamespacedName target_pvc = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A storage system-specific opaque handler to the underlying - // volume created for the target PVC from the volume backup. - string volume_handle = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The type of volume provisioned - VolumeType volume_type = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when the associated underlying volume - // restoration completed. - google.protobuf.Timestamp complete_time = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of this VolumeRestore. - State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A human readable message explaining why the VolumeRestore is - // in its current state. - string state_message = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. `etag` is used for optimistic concurrency control as a way to - // help prevent simultaneous updates of a volume restore from overwriting each - // other. It is strongly suggested that systems make use of the `etag` in the - // read-modify-write cycle to perform volume restore updates in order to avoid - // race conditions. - string etag = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_backup.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_backup.js deleted file mode 100644 index 9388e7da332..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_backup.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(parent) { - // [START gkebackup_v1_generated_BackupForGKE_CreateBackup_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 BackupPlan within which to create the Backup. - * Format: `projects/* /locations/* /backupPlans/*` - */ - // const parent = 'abc123' - /** - * The Backup resource to create. - */ - // const backup = {} - /** - * The client-provided short name for the Backup resource. - * This name must: - * - be between 1 and 63 characters long (inclusive) - * - consist of only lower-case ASCII letters, numbers, and dashes - * - start with a lower-case letter - * - end with a lower-case letter or number - * - be unique within the set of Backups in this BackupPlan - */ - // const backupId = 'abc123' - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callCreateBackup() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await gkebackupClient.createBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateBackup(); - // [END gkebackup_v1_generated_BackupForGKE_CreateBackup_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_backup_plan.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_backup_plan.js deleted file mode 100644 index a2d2b30919d..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_backup_plan.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, backupPlan, backupPlanId) { - // [START gkebackup_v1_generated_BackupForGKE_CreateBackupPlan_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 location within which to create the BackupPlan. - * Format: `projects/* /locations/*` - */ - // const parent = 'abc123' - /** - * Required. The BackupPlan resource object to create. - */ - // const backupPlan = {} - /** - * Required. The client-provided short name for the BackupPlan resource. - * This name must: - * - be between 1 and 63 characters long (inclusive) - * - consist of only lower-case ASCII letters, numbers, and dashes - * - start with a lower-case letter - * - end with a lower-case letter or number - * - be unique within the set of BackupPlans in this location - */ - // const backupPlanId = 'abc123' - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callCreateBackupPlan() { - // Construct request - const request = { - parent, - backupPlan, - backupPlanId, - }; - - // Run request - const [operation] = await gkebackupClient.createBackupPlan(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateBackupPlan(); - // [END gkebackup_v1_generated_BackupForGKE_CreateBackupPlan_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_restore.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_restore.js deleted file mode 100644 index c42ba9c42c9..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_restore.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, restore, restoreId) { - // [START gkebackup_v1_generated_BackupForGKE_CreateRestore_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 RestorePlan within which to create the Restore. - * Format: `projects/* /locations/* /restorePlans/*` - */ - // const parent = 'abc123' - /** - * Required. The restore resource to create. - */ - // const restore = {} - /** - * Required. The client-provided short name for the Restore resource. - * This name must: - * - be between 1 and 63 characters long (inclusive) - * - consist of only lower-case ASCII letters, numbers, and dashes - * - start with a lower-case letter - * - end with a lower-case letter or number - * - be unique within the set of Restores in this RestorePlan. - */ - // const restoreId = 'abc123' - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callCreateRestore() { - // Construct request - const request = { - parent, - restore, - restoreId, - }; - - // Run request - const [operation] = await gkebackupClient.createRestore(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateRestore(); - // [END gkebackup_v1_generated_BackupForGKE_CreateRestore_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_restore_plan.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_restore_plan.js deleted file mode 100644 index 866d26ff959..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.create_restore_plan.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, restorePlan, restorePlanId) { - // [START gkebackup_v1_generated_BackupForGKE_CreateRestorePlan_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 location within which to create the RestorePlan. - * Format: `projects/* /locations/*` - */ - // const parent = 'abc123' - /** - * Required. The RestorePlan resource object to create. - */ - // const restorePlan = {} - /** - * Required. The client-provided short name for the RestorePlan resource. - * This name must: - * - be between 1 and 63 characters long (inclusive) - * - consist of only lower-case ASCII letters, numbers, and dashes - * - start with a lower-case letter - * - end with a lower-case letter or number - * - be unique within the set of RestorePlans in this location - */ - // const restorePlanId = 'abc123' - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callCreateRestorePlan() { - // Construct request - const request = { - parent, - restorePlan, - restorePlanId, - }; - - // Run request - const [operation] = await gkebackupClient.createRestorePlan(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateRestorePlan(); - // [END gkebackup_v1_generated_BackupForGKE_CreateRestorePlan_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_backup.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_backup.js deleted file mode 100644 index c6e2561ad2e..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_backup.js +++ /dev/null @@ -1,75 +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 gkebackup_v1_generated_BackupForGKE_DeleteBackup_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 Backup resource. - * Format: `projects/* /locations/* /backupPlans/* /backups/*` - */ - // const name = 'abc123' - /** - * If provided, this value must match the current value of the - * target Backup's etag google.cloud.gkebackup.v1.Backup.etag field or the - * request is rejected. - */ - // const etag = 'abc123' - /** - * If set to true, any VolumeBackups below this Backup will also be deleted. - * Otherwise, the request will only succeed if the Backup has no - * VolumeBackups. - */ - // const force = true - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callDeleteBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await gkebackupClient.deleteBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteBackup(); - // [END gkebackup_v1_generated_BackupForGKE_DeleteBackup_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_backup_plan.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_backup_plan.js deleted file mode 100644 index 77fa7928e78..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_backup_plan.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(name) { - // [START gkebackup_v1_generated_BackupForGKE_DeleteBackupPlan_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. Fully qualified BackupPlan name. - * Format: `projects/* /locations/* /backupPlans/*` - */ - // const name = 'abc123' - /** - * If provided, this value must match the current value of the - * target BackupPlan's etag google.cloud.gkebackup.v1.BackupPlan.etag field - * or the request is rejected. - */ - // const etag = 'abc123' - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callDeleteBackupPlan() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await gkebackupClient.deleteBackupPlan(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteBackupPlan(); - // [END gkebackup_v1_generated_BackupForGKE_DeleteBackupPlan_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_restore.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_restore.js deleted file mode 100644 index d40ce70f44f..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_restore.js +++ /dev/null @@ -1,75 +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 gkebackup_v1_generated_BackupForGKE_DeleteRestore_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 name of the Restore - * Format: `projects/* /locations/* /restorePlans/* /restores/*` - */ - // const name = 'abc123' - /** - * If provided, this value must match the current value of the - * target Restore's etag google.cloud.gkebackup.v1.Restore.etag field or - * the request is rejected. - */ - // const etag = 'abc123' - /** - * If set to true, any VolumeRestores below this restore will also be deleted. - * Otherwise, the request will only succeed if the restore has no - * VolumeRestores. - */ - // const force = true - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callDeleteRestore() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await gkebackupClient.deleteRestore(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteRestore(); - // [END gkebackup_v1_generated_BackupForGKE_DeleteRestore_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_restore_plan.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_restore_plan.js deleted file mode 100644 index 6bde8df7d83..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.delete_restore_plan.js +++ /dev/null @@ -1,75 +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 gkebackup_v1_generated_BackupForGKE_DeleteRestorePlan_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. Fully qualified RestorePlan name. - * Format: `projects/* /locations/* /restorePlans/*` - */ - // const name = 'abc123' - /** - * If provided, this value must match the current value of the - * target RestorePlan's etag google.cloud.gkebackup.v1.RestorePlan.etag - * field or the request is rejected. - */ - // const etag = 'abc123' - /** - * If set to true, any Restores below this RestorePlan will also be deleted. - * Otherwise, the request will only succeed if the RestorePlan has no - * Restores. - */ - // const force = true - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callDeleteRestorePlan() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await gkebackupClient.deleteRestorePlan(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteRestorePlan(); - // [END gkebackup_v1_generated_BackupForGKE_DeleteRestorePlan_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_backup.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_backup.js deleted file mode 100644 index e6af6b59405..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_backup.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 gkebackup_v1_generated_BackupForGKE_GetBackup_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 name of the Backup resource. - * Format: `projects/* /locations/* /backupPlans/* /backups/*` - */ - // const name = 'abc123' - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callGetBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkebackupClient.getBackup(request); - console.log(response); - } - - callGetBackup(); - // [END gkebackup_v1_generated_BackupForGKE_GetBackup_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_backup_plan.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_backup_plan.js deleted file mode 100644 index dc49b190bd5..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_backup_plan.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 gkebackup_v1_generated_BackupForGKE_GetBackupPlan_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. Fully qualified BackupPlan name. - * Format: `projects/* /locations/* /backupPlans/*` - */ - // const name = 'abc123' - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callGetBackupPlan() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkebackupClient.getBackupPlan(request); - console.log(response); - } - - callGetBackupPlan(); - // [END gkebackup_v1_generated_BackupForGKE_GetBackupPlan_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_restore.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_restore.js deleted file mode 100644 index 2029130e967..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_restore.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 gkebackup_v1_generated_BackupForGKE_GetRestore_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 restore resource. - * Format: `projects/* /locations/* /restorePlans/* /restores/*` - */ - // const name = 'abc123' - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callGetRestore() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkebackupClient.getRestore(request); - console.log(response); - } - - callGetRestore(); - // [END gkebackup_v1_generated_BackupForGKE_GetRestore_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_restore_plan.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_restore_plan.js deleted file mode 100644 index a87d83e5bd6..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_restore_plan.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 gkebackup_v1_generated_BackupForGKE_GetRestorePlan_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. Fully qualified RestorePlan name. - * Format: `projects/* /locations/* /restorePlans/*` - */ - // const name = 'abc123' - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callGetRestorePlan() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkebackupClient.getRestorePlan(request); - console.log(response); - } - - callGetRestorePlan(); - // [END gkebackup_v1_generated_BackupForGKE_GetRestorePlan_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_volume_backup.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_volume_backup.js deleted file mode 100644 index b3cd5d78a73..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_volume_backup.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 gkebackup_v1_generated_BackupForGKE_GetVolumeBackup_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 name of the VolumeBackup resource. - * Format: `projects/* /locations/* /backupPlans/* /backups/* /volumeBackups/*` - */ - // const name = 'abc123' - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callGetVolumeBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkebackupClient.getVolumeBackup(request); - console.log(response); - } - - callGetVolumeBackup(); - // [END gkebackup_v1_generated_BackupForGKE_GetVolumeBackup_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_volume_restore.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_volume_restore.js deleted file mode 100644 index 545ef9b8f5e..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.get_volume_restore.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 gkebackup_v1_generated_BackupForGKE_GetVolumeRestore_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 name of the VolumeRestore resource. - * Format: `projects/* /locations/* /restorePlans/* /restores/* /volumeRestores/*` - */ - // const name = 'abc123' - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callGetVolumeRestore() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkebackupClient.getVolumeRestore(request); - console.log(response); - } - - callGetVolumeRestore(); - // [END gkebackup_v1_generated_BackupForGKE_GetVolumeRestore_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_backup_plans.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_backup_plans.js deleted file mode 100644 index e81931bff1d..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_backup_plans.js +++ /dev/null @@ -1,90 +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 gkebackup_v1_generated_BackupForGKE_ListBackupPlans_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 location that contains the BackupPlans to list. - * Format: `projects/* /locations/*` - */ - // const parent = 'abc123' - /** - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * next_page_token google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token - * to determine if there are more instances left to be queried. - */ - // const pageSize = 1234 - /** - * The value of - * next_page_token google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token - * received from a previous `ListBackupPlans` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListBackupPlans` must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Field match expression used to filter the results. - */ - // const filter = 'abc123' - /** - * Field by which to sort the results. - */ - // const orderBy = 'abc123' - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callListBackupPlans() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await gkebackupClient.listBackupPlansAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBackupPlans(); - // [END gkebackup_v1_generated_BackupForGKE_ListBackupPlans_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_backups.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_backups.js deleted file mode 100644 index 90c2a8a7d29..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_backups.js +++ /dev/null @@ -1,90 +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 gkebackup_v1_generated_BackupForGKE_ListBackups_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 BackupPlan that contains the Backups to list. - * Format: `projects/* /locations/* /backupPlans/*` - */ - // const parent = 'abc123' - /** - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * next_page_token google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token - * to determine if there are more instances left to be queried. - */ - // const pageSize = 1234 - /** - * The value of - * next_page_token google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token - * received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListBackups` must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Field match expression used to filter the results. - */ - // const filter = 'abc123' - /** - * Field by which to sort the results. - */ - // const orderBy = 'abc123' - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callListBackups() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await gkebackupClient.listBackupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBackups(); - // [END gkebackup_v1_generated_BackupForGKE_ListBackups_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_restore_plans.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_restore_plans.js deleted file mode 100644 index 3163e412a3e..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_restore_plans.js +++ /dev/null @@ -1,90 +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 gkebackup_v1_generated_BackupForGKE_ListRestorePlans_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 location that contains the RestorePlans to list. - * Format: `projects/* /locations/*` - */ - // const parent = 'abc123' - /** - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * next_page_token google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token - * to determine if there are more instances left to be queried. - */ - // const pageSize = 1234 - /** - * The value of - * next_page_token google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token - * received from a previous `ListRestorePlans` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListRestorePlans` must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Field match expression used to filter the results. - */ - // const filter = 'abc123' - /** - * Field by which to sort the results. - */ - // const orderBy = 'abc123' - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callListRestorePlans() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await gkebackupClient.listRestorePlansAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListRestorePlans(); - // [END gkebackup_v1_generated_BackupForGKE_ListRestorePlans_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_restores.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_restores.js deleted file mode 100644 index 16d1bf0fceb..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_restores.js +++ /dev/null @@ -1,90 +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 gkebackup_v1_generated_BackupForGKE_ListRestores_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 RestorePlan that contains the Restores to list. - * Format: `projects/* /locations/* /restorePlans/*` - */ - // const parent = 'abc123' - /** - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * next_page_token google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token - * to determine if there are more instances left to be queried. - */ - // const pageSize = 1234 - /** - * The value of - * next_page_token google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token - * received from a previous `ListRestores` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to `ListRestores` - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Field match expression used to filter the results. - */ - // const filter = 'abc123' - /** - * Field by which to sort the results. - */ - // const orderBy = 'abc123' - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callListRestores() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await gkebackupClient.listRestoresAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListRestores(); - // [END gkebackup_v1_generated_BackupForGKE_ListRestores_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_volume_backups.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_volume_backups.js deleted file mode 100644 index c7503443c4b..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_volume_backups.js +++ /dev/null @@ -1,90 +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 gkebackup_v1_generated_BackupForGKE_ListVolumeBackups_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 Backup that contains the VolumeBackups to list. - * Format: `projects/* /locations/* /backupPlans/* /backups/*` - */ - // const parent = 'abc123' - /** - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * next_page_token google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token - * to determine if there are more instances left to be queried. - */ - // const pageSize = 1234 - /** - * The value of - * next_page_token google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token - * received from a previous `ListVolumeBackups` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListVolumeBackups` must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Field match expression used to filter the results. - */ - // const filter = 'abc123' - /** - * Field by which to sort the results. - */ - // const orderBy = 'abc123' - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callListVolumeBackups() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await gkebackupClient.listVolumeBackupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListVolumeBackups(); - // [END gkebackup_v1_generated_BackupForGKE_ListVolumeBackups_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_volume_restores.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_volume_restores.js deleted file mode 100644 index 1a27640625d..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.list_volume_restores.js +++ /dev/null @@ -1,90 +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 gkebackup_v1_generated_BackupForGKE_ListVolumeRestores_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 Restore that contains the VolumeRestores to list. - * Format: `projects/* /locations/* /restorePlans/* /restores/*` - */ - // const parent = 'abc123' - /** - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * next_page_token google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token - * to determine if there are more instances left to be queried. - */ - // const pageSize = 1234 - /** - * The value of - * next_page_token google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token - * received from a previous `ListVolumeRestores` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListVolumeRestores` must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Field match expression used to filter the results. - */ - // const filter = 'abc123' - /** - * Field by which to sort the results. - */ - // const orderBy = 'abc123' - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callListVolumeRestores() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await gkebackupClient.listVolumeRestoresAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListVolumeRestores(); - // [END gkebackup_v1_generated_BackupForGKE_ListVolumeRestores_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_backup.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_backup.js deleted file mode 100644 index a042cccd180..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_backup.js +++ /dev/null @@ -1,74 +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(backup) { - // [START gkebackup_v1_generated_BackupForGKE_UpdateBackup_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. A new version of the Backup resource that contains updated - * fields. This may be sparsely populated if an `update_mask` is provided. - */ - // const backup = {} - /** - * This is used to specify the fields to be overwritten in the - * Backup targeted for update. The values for each of these - * updated fields will be taken from the `backup_plan` provided - * with this request. Field names are relative to the root of the resource. - * If no `update_mask` is provided, all fields in `backup` will be - * written to the target Backup resource. - * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup` are ignored - * and are not used to update the target Backup. - */ - // const updateMask = {} - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callUpdateBackup() { - // Construct request - const request = { - backup, - }; - - // Run request - const [operation] = await gkebackupClient.updateBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateBackup(); - // [END gkebackup_v1_generated_BackupForGKE_UpdateBackup_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_backup_plan.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_backup_plan.js deleted file mode 100644 index b7556d4835a..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_backup_plan.js +++ /dev/null @@ -1,75 +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(backupPlan) { - // [START gkebackup_v1_generated_BackupForGKE_UpdateBackupPlan_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. A new version of the BackupPlan resource that contains updated - * fields. This may be sparsely populated if an `update_mask` is provided. - */ - // const backupPlan = {} - /** - * This is used to specify the fields to be overwritten in the - * BackupPlan targeted for update. The values for each of these - * updated fields will be taken from the `backup_plan` provided - * with this request. Field names are relative to the root of the resource - * (e.g., `description`, `backup_config.include_volume_data`, etc.) - * If no `update_mask` is provided, all fields in `backup_plan` will be - * written to the target BackupPlan resource. - * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup_plan` are ignored - * and are not used to update the target BackupPlan. - */ - // const updateMask = {} - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callUpdateBackupPlan() { - // Construct request - const request = { - backupPlan, - }; - - // Run request - const [operation] = await gkebackupClient.updateBackupPlan(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateBackupPlan(); - // [END gkebackup_v1_generated_BackupForGKE_UpdateBackupPlan_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_restore.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_restore.js deleted file mode 100644 index 335e0a8f149..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_restore.js +++ /dev/null @@ -1,74 +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(restore) { - // [START gkebackup_v1_generated_BackupForGKE_UpdateRestore_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. A new version of the Restore resource that contains updated - * fields. This may be sparsely populated if an `update_mask` is provided. - */ - // const restore = {} - /** - * This is used to specify the fields to be overwritten in the - * Restore targeted for update. The values for each of these - * updated fields will be taken from the `restore` provided - * with this request. Field names are relative to the root of the resource. - * If no `update_mask` is provided, all fields in `restore` will be - * written to the target Restore resource. - * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore` are ignored - * and are not used to update the target Restore. - */ - // const updateMask = {} - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callUpdateRestore() { - // Construct request - const request = { - restore, - }; - - // Run request - const [operation] = await gkebackupClient.updateRestore(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateRestore(); - // [END gkebackup_v1_generated_BackupForGKE_UpdateRestore_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-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_restore_plan.js b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_restore_plan.js deleted file mode 100644 index d13113bd688..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/backup_for_g_k_e.update_restore_plan.js +++ /dev/null @@ -1,74 +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(restorePlan) { - // [START gkebackup_v1_generated_BackupForGKE_UpdateRestorePlan_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. A new version of the RestorePlan resource that contains updated - * fields. This may be sparsely populated if an `update_mask` is provided. - */ - // const restorePlan = {} - /** - * This is used to specify the fields to be overwritten in the - * RestorePlan targeted for update. The values for each of these - * updated fields will be taken from the `restore_plan` provided - * with this request. Field names are relative to the root of the resource. - * If no `update_mask` is provided, all fields in `restore_plan` will be - * written to the target RestorePlan resource. - * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore_plan` are ignored - * and are not used to update the target RestorePlan. - */ - // const updateMask = {} - - // Imports the Gkebackup library - const {BackupForGKEClient} = require('@google-cloud/gke-backup').v1; - - // Instantiates a client - const gkebackupClient = new BackupForGKEClient(); - - async function callUpdateRestorePlan() { - // Construct request - const request = { - restorePlan, - }; - - // Run request - const [operation] = await gkebackupClient.updateRestorePlan(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateRestorePlan(); - // [END gkebackup_v1_generated_BackupForGKE_UpdateRestorePlan_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-gkebackup/v1/samples/generated/v1/snippet_metadata_google.cloud.gkebackup.v1.json b/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/snippet_metadata_google.cloud.gkebackup.v1.json deleted file mode 100644 index d3f46929343..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/samples/generated/v1/snippet_metadata_google.cloud.gkebackup.v1.json +++ /dev/null @@ -1,1147 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-gkebackup", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.gkebackup.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_CreateBackupPlan_async", - "title": "BackupForGKE createBackupPlan Sample", - "origin": "API_DEFINITION", - "description": " Creates a new BackupPlan in a given location.", - "canonical": true, - "file": "backup_for_g_k_e.create_backup_plan.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBackupPlan", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.CreateBackupPlan", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "backup_plan", - "type": ".google.cloud.gkebackup.v1.BackupPlan" - }, - { - "name": "backup_plan_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "CreateBackupPlan", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.CreateBackupPlan", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_ListBackupPlans_async", - "title": "BackupForGKE listBackupPlans Sample", - "origin": "API_DEFINITION", - "description": " Lists BackupPlans in a given location.", - "canonical": true, - "file": "backup_for_g_k_e.list_backup_plans.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBackupPlans", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListBackupPlans", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkebackup.v1.ListBackupPlansResponse", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "ListBackupPlans", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListBackupPlans", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_GetBackupPlan_async", - "title": "BackupForGKE getBackupPlan Sample", - "origin": "API_DEFINITION", - "description": " Retrieve the details of a single BackupPlan.", - "canonical": true, - "file": "backup_for_g_k_e.get_backup_plan.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBackupPlan", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetBackupPlan", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkebackup.v1.BackupPlan", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "GetBackupPlan", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetBackupPlan", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_UpdateBackupPlan_async", - "title": "BackupForGKE updateBackupPlan Sample", - "origin": "API_DEFINITION", - "description": " Update a BackupPlan.", - "canonical": true, - "file": "backup_for_g_k_e.update_backup_plan.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBackupPlan", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.UpdateBackupPlan", - "async": true, - "parameters": [ - { - "name": "backup_plan", - "type": ".google.cloud.gkebackup.v1.BackupPlan" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "UpdateBackupPlan", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.UpdateBackupPlan", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_DeleteBackupPlan_async", - "title": "BackupForGKE deleteBackupPlan Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing BackupPlan.", - "canonical": true, - "file": "backup_for_g_k_e.delete_backup_plan.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBackupPlan", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.DeleteBackupPlan", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "DeleteBackupPlan", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.DeleteBackupPlan", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_CreateBackup_async", - "title": "BackupForGKE createBackup Sample", - "origin": "API_DEFINITION", - "description": " Creates a Backup for the given BackupPlan.", - "canonical": true, - "file": "backup_for_g_k_e.create_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBackup", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.CreateBackup", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": ".google.cloud.gkebackup.v1.Backup" - }, - { - "name": "backup_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "CreateBackup", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.CreateBackup", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_ListBackups_async", - "title": "BackupForGKE listBackups Sample", - "origin": "API_DEFINITION", - "description": " Lists the Backups for a given BackupPlan.", - "canonical": true, - "file": "backup_for_g_k_e.list_backups.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBackups", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListBackups", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkebackup.v1.ListBackupsResponse", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "ListBackups", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListBackups", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_GetBackup_async", - "title": "BackupForGKE getBackup Sample", - "origin": "API_DEFINITION", - "description": " Retrieve the details of a single Backup.", - "canonical": true, - "file": "backup_for_g_k_e.get_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBackup", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkebackup.v1.Backup", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "GetBackup", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetBackup", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_UpdateBackup_async", - "title": "BackupForGKE updateBackup Sample", - "origin": "API_DEFINITION", - "description": " Update a Backup.", - "canonical": true, - "file": "backup_for_g_k_e.update_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBackup", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.UpdateBackup", - "async": true, - "parameters": [ - { - "name": "backup", - "type": ".google.cloud.gkebackup.v1.Backup" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "UpdateBackup", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.UpdateBackup", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_DeleteBackup_async", - "title": "BackupForGKE deleteBackup Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing Backup.", - "canonical": true, - "file": "backup_for_g_k_e.delete_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.DeleteBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.DeleteBackup", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_ListVolumeBackups_async", - "title": "BackupForGKE listVolumeBackups Sample", - "origin": "API_DEFINITION", - "description": " Lists the VolumeBackups for a given Backup.", - "canonical": true, - "file": "backup_for_g_k_e.list_volume_backups.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListVolumeBackups", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListVolumeBackups", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkebackup.v1.ListVolumeBackupsResponse", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "ListVolumeBackups", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListVolumeBackups", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_GetVolumeBackup_async", - "title": "BackupForGKE getVolumeBackup Sample", - "origin": "API_DEFINITION", - "description": " Retrieve the details of a single VolumeBackup.", - "canonical": true, - "file": "backup_for_g_k_e.get_volume_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetVolumeBackup", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetVolumeBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkebackup.v1.VolumeBackup", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "GetVolumeBackup", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetVolumeBackup", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_CreateRestorePlan_async", - "title": "BackupForGKE createRestorePlan Sample", - "origin": "API_DEFINITION", - "description": " Creates a new RestorePlan in a given location.", - "canonical": true, - "file": "backup_for_g_k_e.create_restore_plan.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateRestorePlan", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.CreateRestorePlan", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "restore_plan", - "type": ".google.cloud.gkebackup.v1.RestorePlan" - }, - { - "name": "restore_plan_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "CreateRestorePlan", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.CreateRestorePlan", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_ListRestorePlans_async", - "title": "BackupForGKE listRestorePlans Sample", - "origin": "API_DEFINITION", - "description": " Lists RestorePlans in a given location.", - "canonical": true, - "file": "backup_for_g_k_e.list_restore_plans.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListRestorePlans", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListRestorePlans", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkebackup.v1.ListRestorePlansResponse", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "ListRestorePlans", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListRestorePlans", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_GetRestorePlan_async", - "title": "BackupForGKE getRestorePlan Sample", - "origin": "API_DEFINITION", - "description": " Retrieve the details of a single RestorePlan.", - "canonical": true, - "file": "backup_for_g_k_e.get_restore_plan.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetRestorePlan", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetRestorePlan", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkebackup.v1.RestorePlan", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "GetRestorePlan", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetRestorePlan", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_UpdateRestorePlan_async", - "title": "BackupForGKE updateRestorePlan Sample", - "origin": "API_DEFINITION", - "description": " Update a RestorePlan.", - "canonical": true, - "file": "backup_for_g_k_e.update_restore_plan.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateRestorePlan", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.UpdateRestorePlan", - "async": true, - "parameters": [ - { - "name": "restore_plan", - "type": ".google.cloud.gkebackup.v1.RestorePlan" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "UpdateRestorePlan", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.UpdateRestorePlan", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_DeleteRestorePlan_async", - "title": "BackupForGKE deleteRestorePlan Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing RestorePlan.", - "canonical": true, - "file": "backup_for_g_k_e.delete_restore_plan.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteRestorePlan", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.DeleteRestorePlan", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "DeleteRestorePlan", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.DeleteRestorePlan", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_CreateRestore_async", - "title": "BackupForGKE createRestore Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Restore for the given RestorePlan.", - "canonical": true, - "file": "backup_for_g_k_e.create_restore.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateRestore", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.CreateRestore", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "restore", - "type": ".google.cloud.gkebackup.v1.Restore" - }, - { - "name": "restore_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "CreateRestore", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.CreateRestore", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_ListRestores_async", - "title": "BackupForGKE listRestores Sample", - "origin": "API_DEFINITION", - "description": " Lists the Restores for a given RestorePlan.", - "canonical": true, - "file": "backup_for_g_k_e.list_restores.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListRestores", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListRestores", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkebackup.v1.ListRestoresResponse", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "ListRestores", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListRestores", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_GetRestore_async", - "title": "BackupForGKE getRestore Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the details of a single Restore.", - "canonical": true, - "file": "backup_for_g_k_e.get_restore.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetRestore", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetRestore", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkebackup.v1.Restore", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "GetRestore", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetRestore", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_UpdateRestore_async", - "title": "BackupForGKE updateRestore Sample", - "origin": "API_DEFINITION", - "description": " Update a Restore.", - "canonical": true, - "file": "backup_for_g_k_e.update_restore.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateRestore", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.UpdateRestore", - "async": true, - "parameters": [ - { - "name": "restore", - "type": ".google.cloud.gkebackup.v1.Restore" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "UpdateRestore", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.UpdateRestore", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_DeleteRestore_async", - "title": "BackupForGKE deleteRestore Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing Restore.", - "canonical": true, - "file": "backup_for_g_k_e.delete_restore.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteRestore", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.DeleteRestore", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "DeleteRestore", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.DeleteRestore", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_ListVolumeRestores_async", - "title": "BackupForGKE listVolumeRestores Sample", - "origin": "API_DEFINITION", - "description": " Lists the VolumeRestores for a given Restore.", - "canonical": true, - "file": "backup_for_g_k_e.list_volume_restores.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListVolumeRestores", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListVolumeRestores", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkebackup.v1.ListVolumeRestoresResponse", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "ListVolumeRestores", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.ListVolumeRestores", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - }, - { - "regionTag": "gkebackup_v1_generated_BackupForGKE_GetVolumeRestore_async", - "title": "BackupForGKE getVolumeRestore Sample", - "origin": "API_DEFINITION", - "description": " Retrieve the details of a single VolumeRestore.", - "canonical": true, - "file": "backup_for_g_k_e.get_volume_restore.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetVolumeRestore", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetVolumeRestore", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkebackup.v1.VolumeRestore", - "client": { - "shortName": "BackupForGKEClient", - "fullName": "google.cloud.gkebackup.v1.BackupForGKEClient" - }, - "method": { - "shortName": "GetVolumeRestore", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE.GetVolumeRestore", - "service": { - "shortName": "BackupForGKE", - "fullName": "google.cloud.gkebackup.v1.BackupForGKE" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/src/index.ts b/owl-bot-staging/google-cloud-gkebackup/v1/src/index.ts deleted file mode 100644 index 4af80ba6308..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/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 v1 from './v1'; -const BackupForGKEClient = v1.BackupForGKEClient; -type BackupForGKEClient = v1.BackupForGKEClient; -export {v1, BackupForGKEClient}; -export default {v1, BackupForGKEClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_client.ts b/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_client.ts deleted file mode 100644 index 4b55b41380e..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_client.ts +++ /dev/null @@ -1,4191 +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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/backup_for_g_k_e_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './backup_for_g_k_e_client_config.json'; -const version = require('../../../package.json').version; - -/** - * BackupForGKE allows Kubernetes administrators to configure, execute, and - * manage backup and restore operations for their GKE clusters. - * @class - * @memberof v1 - */ -export class BackupForGKEClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - backupForGKEStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of BackupForGKEClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 BackupForGKEClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof BackupForGKEClient; - 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; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - 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 = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}' - ), - backupPlanPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backupPlans/{backup_plan}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - restorePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore}' - ), - restorePlanPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/restorePlans/{restore_plan}' - ), - volumeBackupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}/volumeBackups/{volume_backup}' - ), - volumeRestorePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore}/volumeRestores/{volume_restore}' - ), - }; - - // 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 = { - listBackupPlans: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backupPlans'), - listBackups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups'), - listVolumeBackups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'volumeBackups'), - listRestorePlans: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'restorePlans'), - listRestores: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'restores'), - listVolumeRestores: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'volumeRestores') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/backupPlans/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/restorePlans/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/backupPlans/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/restorePlans/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/backupPlans/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/restorePlans/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*}/operations',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createBackupPlanResponse = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.BackupPlan') as gax.protobuf.Type; - const createBackupPlanMetadata = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; - const updateBackupPlanResponse = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.BackupPlan') as gax.protobuf.Type; - const updateBackupPlanMetadata = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; - const deleteBackupPlanResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteBackupPlanMetadata = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; - const createBackupResponse = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.Backup') as gax.protobuf.Type; - const createBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; - const updateBackupResponse = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.Backup') as gax.protobuf.Type; - const updateBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; - const deleteBackupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; - const createRestorePlanResponse = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.RestorePlan') as gax.protobuf.Type; - const createRestorePlanMetadata = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; - const updateRestorePlanResponse = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.RestorePlan') as gax.protobuf.Type; - const updateRestorePlanMetadata = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; - const deleteRestorePlanResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteRestorePlanMetadata = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; - const createRestoreResponse = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.Restore') as gax.protobuf.Type; - const createRestoreMetadata = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; - const updateRestoreResponse = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.Restore') as gax.protobuf.Type; - const updateRestoreMetadata = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; - const deleteRestoreResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteRestoreMetadata = protoFilesRoot.lookup( - '.google.cloud.gkebackup.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createBackupPlan: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBackupPlanResponse.decode.bind(createBackupPlanResponse), - createBackupPlanMetadata.decode.bind(createBackupPlanMetadata)), - updateBackupPlan: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateBackupPlanResponse.decode.bind(updateBackupPlanResponse), - updateBackupPlanMetadata.decode.bind(updateBackupPlanMetadata)), - deleteBackupPlan: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteBackupPlanResponse.decode.bind(deleteBackupPlanResponse), - deleteBackupPlanMetadata.decode.bind(deleteBackupPlanMetadata)), - createBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBackupResponse.decode.bind(createBackupResponse), - createBackupMetadata.decode.bind(createBackupMetadata)), - updateBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateBackupResponse.decode.bind(updateBackupResponse), - updateBackupMetadata.decode.bind(updateBackupMetadata)), - deleteBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteBackupResponse.decode.bind(deleteBackupResponse), - deleteBackupMetadata.decode.bind(deleteBackupMetadata)), - createRestorePlan: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createRestorePlanResponse.decode.bind(createRestorePlanResponse), - createRestorePlanMetadata.decode.bind(createRestorePlanMetadata)), - updateRestorePlan: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateRestorePlanResponse.decode.bind(updateRestorePlanResponse), - updateRestorePlanMetadata.decode.bind(updateRestorePlanMetadata)), - deleteRestorePlan: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteRestorePlanResponse.decode.bind(deleteRestorePlanResponse), - deleteRestorePlanMetadata.decode.bind(deleteRestorePlanMetadata)), - createRestore: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createRestoreResponse.decode.bind(createRestoreResponse), - createRestoreMetadata.decode.bind(createRestoreMetadata)), - updateRestore: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateRestoreResponse.decode.bind(updateRestoreResponse), - updateRestoreMetadata.decode.bind(updateRestoreMetadata)), - deleteRestore: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteRestoreResponse.decode.bind(deleteRestoreResponse), - deleteRestoreMetadata.decode.bind(deleteRestoreMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.gkebackup.v1.BackupForGKE', 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.backupForGKEStub) { - return this.backupForGKEStub; - } - - // Put together the "service stub" for - // google.cloud.gkebackup.v1.BackupForGKE. - this.backupForGKEStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.gkebackup.v1.BackupForGKE') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.gkebackup.v1.BackupForGKE, - 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 backupForGKEStubMethods = - ['createBackupPlan', 'listBackupPlans', 'getBackupPlan', 'updateBackupPlan', 'deleteBackupPlan', 'createBackup', 'listBackups', 'getBackup', 'updateBackup', 'deleteBackup', 'listVolumeBackups', 'getVolumeBackup', 'createRestorePlan', 'listRestorePlans', 'getRestorePlan', 'updateRestorePlan', 'deleteRestorePlan', 'createRestore', 'listRestores', 'getRestore', 'updateRestore', 'deleteRestore', 'listVolumeRestores', 'getVolumeRestore']; - for (const methodName of backupForGKEStubMethods) { - const callPromise = this.backupForGKEStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.backupForGKEStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'gkebackup.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 'gkebackup.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 -- - // ------------------- -/** - * Retrieve the details of a single BackupPlan. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Fully qualified BackupPlan name. - * Format: `projects/* /locations/* /backupPlans/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkebackup.v1.BackupPlan|BackupPlan}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.get_backup_plan.js - * region_tag:gkebackup_v1_generated_BackupForGKE_GetBackupPlan_async - */ - getBackupPlan( - request?: protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkebackup.v1.IBackupPlan, - protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest|undefined, {}|undefined - ]>; - getBackupPlan( - request: protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkebackup.v1.IBackupPlan, - protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest|null|undefined, - {}|null|undefined>): void; - getBackupPlan( - request: protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest, - callback: Callback< - protos.google.cloud.gkebackup.v1.IBackupPlan, - protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest|null|undefined, - {}|null|undefined>): void; - getBackupPlan( - request?: protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkebackup.v1.IBackupPlan, - protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkebackup.v1.IBackupPlan, - protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkebackup.v1.IBackupPlan, - protos.google.cloud.gkebackup.v1.IGetBackupPlanRequest|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.getBackupPlan(request, options, callback); - } -/** - * Retrieve the details of a single Backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full name of the Backup resource. - * Format: `projects/* /locations/* /backupPlans/* /backups/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkebackup.v1.Backup|Backup}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.get_backup.js - * region_tag:gkebackup_v1_generated_BackupForGKE_GetBackup_async - */ - getBackup( - request?: protos.google.cloud.gkebackup.v1.IGetBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkebackup.v1.IBackup, - protos.google.cloud.gkebackup.v1.IGetBackupRequest|undefined, {}|undefined - ]>; - getBackup( - request: protos.google.cloud.gkebackup.v1.IGetBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkebackup.v1.IBackup, - protos.google.cloud.gkebackup.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request: protos.google.cloud.gkebackup.v1.IGetBackupRequest, - callback: Callback< - protos.google.cloud.gkebackup.v1.IBackup, - protos.google.cloud.gkebackup.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request?: protos.google.cloud.gkebackup.v1.IGetBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkebackup.v1.IBackup, - protos.google.cloud.gkebackup.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkebackup.v1.IBackup, - protos.google.cloud.gkebackup.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkebackup.v1.IBackup, - protos.google.cloud.gkebackup.v1.IGetBackupRequest|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.getBackup(request, options, callback); - } -/** - * Retrieve the details of a single VolumeBackup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full name of the VolumeBackup resource. - * Format: `projects/* /locations/* /backupPlans/* /backups/* /volumeBackups/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkebackup.v1.VolumeBackup|VolumeBackup}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.get_volume_backup.js - * region_tag:gkebackup_v1_generated_BackupForGKE_GetVolumeBackup_async - */ - getVolumeBackup( - request?: protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkebackup.v1.IVolumeBackup, - protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest|undefined, {}|undefined - ]>; - getVolumeBackup( - request: protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkebackup.v1.IVolumeBackup, - protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest|null|undefined, - {}|null|undefined>): void; - getVolumeBackup( - request: protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest, - callback: Callback< - protos.google.cloud.gkebackup.v1.IVolumeBackup, - protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest|null|undefined, - {}|null|undefined>): void; - getVolumeBackup( - request?: protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkebackup.v1.IVolumeBackup, - protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkebackup.v1.IVolumeBackup, - protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkebackup.v1.IVolumeBackup, - protos.google.cloud.gkebackup.v1.IGetVolumeBackupRequest|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.getVolumeBackup(request, options, callback); - } -/** - * Retrieve the details of a single RestorePlan. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Fully qualified RestorePlan name. - * Format: `projects/* /locations/* /restorePlans/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkebackup.v1.RestorePlan|RestorePlan}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.get_restore_plan.js - * region_tag:gkebackup_v1_generated_BackupForGKE_GetRestorePlan_async - */ - getRestorePlan( - request?: protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkebackup.v1.IRestorePlan, - protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest|undefined, {}|undefined - ]>; - getRestorePlan( - request: protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkebackup.v1.IRestorePlan, - protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest|null|undefined, - {}|null|undefined>): void; - getRestorePlan( - request: protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest, - callback: Callback< - protos.google.cloud.gkebackup.v1.IRestorePlan, - protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest|null|undefined, - {}|null|undefined>): void; - getRestorePlan( - request?: protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkebackup.v1.IRestorePlan, - protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkebackup.v1.IRestorePlan, - protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkebackup.v1.IRestorePlan, - protos.google.cloud.gkebackup.v1.IGetRestorePlanRequest|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.getRestorePlan(request, options, callback); - } -/** - * Retrieves the details of a single Restore. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the restore resource. - * Format: `projects/* /locations/* /restorePlans/* /restores/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkebackup.v1.Restore|Restore}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.get_restore.js - * region_tag:gkebackup_v1_generated_BackupForGKE_GetRestore_async - */ - getRestore( - request?: protos.google.cloud.gkebackup.v1.IGetRestoreRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkebackup.v1.IRestore, - protos.google.cloud.gkebackup.v1.IGetRestoreRequest|undefined, {}|undefined - ]>; - getRestore( - request: protos.google.cloud.gkebackup.v1.IGetRestoreRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkebackup.v1.IRestore, - protos.google.cloud.gkebackup.v1.IGetRestoreRequest|null|undefined, - {}|null|undefined>): void; - getRestore( - request: protos.google.cloud.gkebackup.v1.IGetRestoreRequest, - callback: Callback< - protos.google.cloud.gkebackup.v1.IRestore, - protos.google.cloud.gkebackup.v1.IGetRestoreRequest|null|undefined, - {}|null|undefined>): void; - getRestore( - request?: protos.google.cloud.gkebackup.v1.IGetRestoreRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkebackup.v1.IRestore, - protos.google.cloud.gkebackup.v1.IGetRestoreRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkebackup.v1.IRestore, - protos.google.cloud.gkebackup.v1.IGetRestoreRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkebackup.v1.IRestore, - protos.google.cloud.gkebackup.v1.IGetRestoreRequest|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.getRestore(request, options, callback); - } -/** - * Retrieve the details of a single VolumeRestore. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full name of the VolumeRestore resource. - * Format: `projects/* /locations/* /restorePlans/* /restores/* /volumeRestores/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkebackup.v1.VolumeRestore|VolumeRestore}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.get_volume_restore.js - * region_tag:gkebackup_v1_generated_BackupForGKE_GetVolumeRestore_async - */ - getVolumeRestore( - request?: protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkebackup.v1.IVolumeRestore, - protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest|undefined, {}|undefined - ]>; - getVolumeRestore( - request: protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkebackup.v1.IVolumeRestore, - protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest|null|undefined, - {}|null|undefined>): void; - getVolumeRestore( - request: protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest, - callback: Callback< - protos.google.cloud.gkebackup.v1.IVolumeRestore, - protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest|null|undefined, - {}|null|undefined>): void; - getVolumeRestore( - request?: protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkebackup.v1.IVolumeRestore, - protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkebackup.v1.IVolumeRestore, - protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkebackup.v1.IVolumeRestore, - protos.google.cloud.gkebackup.v1.IGetVolumeRestoreRequest|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.getVolumeRestore(request, options, callback); - } - -/** - * Creates a new BackupPlan in a given location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location within which to create the BackupPlan. - * Format: `projects/* /locations/*` - * @param {google.cloud.gkebackup.v1.BackupPlan} request.backupPlan - * Required. The BackupPlan resource object to create. - * @param {string} request.backupPlanId - * Required. The client-provided short name for the BackupPlan resource. - * This name must: - * - * - be between 1 and 63 characters long (inclusive) - * - consist of only lower-case ASCII letters, numbers, and dashes - * - start with a lower-case letter - * - end with a lower-case letter or number - * - be unique within the set of BackupPlans in this location - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.create_backup_plan.js - * region_tag:gkebackup_v1_generated_BackupForGKE_CreateBackupPlan_async - */ - createBackupPlan( - request?: protos.google.cloud.gkebackup.v1.ICreateBackupPlanRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createBackupPlan( - request: protos.google.cloud.gkebackup.v1.ICreateBackupPlanRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackupPlan( - request: protos.google.cloud.gkebackup.v1.ICreateBackupPlanRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackupPlan( - request?: protos.google.cloud.gkebackup.v1.ICreateBackupPlanRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createBackupPlan(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createBackupPlan()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.create_backup_plan.js - * region_tag:gkebackup_v1_generated_BackupForGKE_CreateBackupPlan_async - */ - async checkCreateBackupPlanProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackupPlan, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Update a BackupPlan. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.gkebackup.v1.BackupPlan} request.backupPlan - * Required. A new version of the BackupPlan resource that contains updated - * fields. This may be sparsely populated if an `update_mask` is provided. - * @param {google.protobuf.FieldMask} request.updateMask - * This is used to specify the fields to be overwritten in the - * BackupPlan targeted for update. The values for each of these - * updated fields will be taken from the `backup_plan` provided - * with this request. Field names are relative to the root of the resource - * (e.g., `description`, `backup_config.include_volume_data`, etc.) - * If no `update_mask` is provided, all fields in `backup_plan` will be - * written to the target BackupPlan resource. - * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup_plan` are ignored - * and are not used to update the target BackupPlan. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.update_backup_plan.js - * region_tag:gkebackup_v1_generated_BackupForGKE_UpdateBackupPlan_async - */ - updateBackupPlan( - request?: protos.google.cloud.gkebackup.v1.IUpdateBackupPlanRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateBackupPlan( - request: protos.google.cloud.gkebackup.v1.IUpdateBackupPlanRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateBackupPlan( - request: protos.google.cloud.gkebackup.v1.IUpdateBackupPlanRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateBackupPlan( - request?: protos.google.cloud.gkebackup.v1.IUpdateBackupPlanRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'backup_plan.name': request.backupPlan!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateBackupPlan(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateBackupPlan()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.update_backup_plan.js - * region_tag:gkebackup_v1_generated_BackupForGKE_UpdateBackupPlan_async - */ - async checkUpdateBackupPlanProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateBackupPlan, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes an existing BackupPlan. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Fully qualified BackupPlan name. - * Format: `projects/* /locations/* /backupPlans/*` - * @param {string} request.etag - * If provided, this value must match the current value of the - * target BackupPlan's {@link protos.google.cloud.gkebackup.v1.BackupPlan.etag|etag} field - * or the request is rejected. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.delete_backup_plan.js - * region_tag:gkebackup_v1_generated_BackupForGKE_DeleteBackupPlan_async - */ - deleteBackupPlan( - request?: protos.google.cloud.gkebackup.v1.IDeleteBackupPlanRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteBackupPlan( - request: protos.google.cloud.gkebackup.v1.IDeleteBackupPlanRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackupPlan( - request: protos.google.cloud.gkebackup.v1.IDeleteBackupPlanRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackupPlan( - request?: protos.google.cloud.gkebackup.v1.IDeleteBackupPlanRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteBackupPlan(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteBackupPlan()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.delete_backup_plan.js - * region_tag:gkebackup_v1_generated_BackupForGKE_DeleteBackupPlan_async - */ - async checkDeleteBackupPlanProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteBackupPlan, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a Backup for the given BackupPlan. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The BackupPlan within which to create the Backup. - * Format: `projects/* /locations/* /backupPlans/*` - * @param {google.cloud.gkebackup.v1.Backup} request.backup - * The Backup resource to create. - * @param {string} request.backupId - * The client-provided short name for the Backup resource. - * This name must: - * - * - be between 1 and 63 characters long (inclusive) - * - consist of only lower-case ASCII letters, numbers, and dashes - * - start with a lower-case letter - * - end with a lower-case letter or number - * - be unique within the set of Backups in this BackupPlan - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.create_backup.js - * region_tag:gkebackup_v1_generated_BackupForGKE_CreateBackup_async - */ - createBackup( - request?: protos.google.cloud.gkebackup.v1.ICreateBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createBackup( - request: protos.google.cloud.gkebackup.v1.ICreateBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request: protos.google.cloud.gkebackup.v1.ICreateBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request?: protos.google.cloud.gkebackup.v1.ICreateBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.create_backup.js - * region_tag:gkebackup_v1_generated_BackupForGKE_CreateBackup_async - */ - async checkCreateBackupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Update a Backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.gkebackup.v1.Backup} request.backup - * Required. A new version of the Backup resource that contains updated - * fields. This may be sparsely populated if an `update_mask` is provided. - * @param {google.protobuf.FieldMask} request.updateMask - * This is used to specify the fields to be overwritten in the - * Backup targeted for update. The values for each of these - * updated fields will be taken from the `backup_plan` provided - * with this request. Field names are relative to the root of the resource. - * If no `update_mask` is provided, all fields in `backup` will be - * written to the target Backup resource. - * Note that OUTPUT_ONLY and IMMUTABLE fields in `backup` are ignored - * and are not used to update the target Backup. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.update_backup.js - * region_tag:gkebackup_v1_generated_BackupForGKE_UpdateBackup_async - */ - updateBackup( - request?: protos.google.cloud.gkebackup.v1.IUpdateBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateBackup( - request: protos.google.cloud.gkebackup.v1.IUpdateBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateBackup( - request: protos.google.cloud.gkebackup.v1.IUpdateBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateBackup( - request?: protos.google.cloud.gkebackup.v1.IUpdateBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'backup.name': request.backup!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.update_backup.js - * region_tag:gkebackup_v1_generated_BackupForGKE_UpdateBackup_async - */ - async checkUpdateBackupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateBackup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes an existing Backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the Backup resource. - * Format: `projects/* /locations/* /backupPlans/* /backups/*` - * @param {string} request.etag - * If provided, this value must match the current value of the - * target Backup's {@link protos.google.cloud.gkebackup.v1.Backup.etag|etag} field or the - * request is rejected. - * @param {boolean} request.force - * If set to true, any VolumeBackups below this Backup will also be deleted. - * Otherwise, the request will only succeed if the Backup has no - * VolumeBackups. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.delete_backup.js - * region_tag:gkebackup_v1_generated_BackupForGKE_DeleteBackup_async - */ - deleteBackup( - request?: protos.google.cloud.gkebackup.v1.IDeleteBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteBackup( - request: protos.google.cloud.gkebackup.v1.IDeleteBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request: protos.google.cloud.gkebackup.v1.IDeleteBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request?: protos.google.cloud.gkebackup.v1.IDeleteBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.delete_backup.js - * region_tag:gkebackup_v1_generated_BackupForGKE_DeleteBackup_async - */ - async checkDeleteBackupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteBackup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new RestorePlan in a given location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location within which to create the RestorePlan. - * Format: `projects/* /locations/*` - * @param {google.cloud.gkebackup.v1.RestorePlan} request.restorePlan - * Required. The RestorePlan resource object to create. - * @param {string} request.restorePlanId - * Required. The client-provided short name for the RestorePlan resource. - * This name must: - * - * - be between 1 and 63 characters long (inclusive) - * - consist of only lower-case ASCII letters, numbers, and dashes - * - start with a lower-case letter - * - end with a lower-case letter or number - * - be unique within the set of RestorePlans in this location - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.create_restore_plan.js - * region_tag:gkebackup_v1_generated_BackupForGKE_CreateRestorePlan_async - */ - createRestorePlan( - request?: protos.google.cloud.gkebackup.v1.ICreateRestorePlanRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createRestorePlan( - request: protos.google.cloud.gkebackup.v1.ICreateRestorePlanRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createRestorePlan( - request: protos.google.cloud.gkebackup.v1.ICreateRestorePlanRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createRestorePlan( - request?: protos.google.cloud.gkebackup.v1.ICreateRestorePlanRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createRestorePlan(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createRestorePlan()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.create_restore_plan.js - * region_tag:gkebackup_v1_generated_BackupForGKE_CreateRestorePlan_async - */ - async checkCreateRestorePlanProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createRestorePlan, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Update a RestorePlan. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.gkebackup.v1.RestorePlan} request.restorePlan - * Required. A new version of the RestorePlan resource that contains updated - * fields. This may be sparsely populated if an `update_mask` is provided. - * @param {google.protobuf.FieldMask} request.updateMask - * This is used to specify the fields to be overwritten in the - * RestorePlan targeted for update. The values for each of these - * updated fields will be taken from the `restore_plan` provided - * with this request. Field names are relative to the root of the resource. - * If no `update_mask` is provided, all fields in `restore_plan` will be - * written to the target RestorePlan resource. - * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore_plan` are ignored - * and are not used to update the target RestorePlan. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.update_restore_plan.js - * region_tag:gkebackup_v1_generated_BackupForGKE_UpdateRestorePlan_async - */ - updateRestorePlan( - request?: protos.google.cloud.gkebackup.v1.IUpdateRestorePlanRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateRestorePlan( - request: protos.google.cloud.gkebackup.v1.IUpdateRestorePlanRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateRestorePlan( - request: protos.google.cloud.gkebackup.v1.IUpdateRestorePlanRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateRestorePlan( - request?: protos.google.cloud.gkebackup.v1.IUpdateRestorePlanRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'restore_plan.name': request.restorePlan!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateRestorePlan(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateRestorePlan()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.update_restore_plan.js - * region_tag:gkebackup_v1_generated_BackupForGKE_UpdateRestorePlan_async - */ - async checkUpdateRestorePlanProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateRestorePlan, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes an existing RestorePlan. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Fully qualified RestorePlan name. - * Format: `projects/* /locations/* /restorePlans/*` - * @param {string} request.etag - * If provided, this value must match the current value of the - * target RestorePlan's {@link protos.google.cloud.gkebackup.v1.RestorePlan.etag|etag} - * field or the request is rejected. - * @param {boolean} request.force - * If set to true, any Restores below this RestorePlan will also be deleted. - * Otherwise, the request will only succeed if the RestorePlan has no - * Restores. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.delete_restore_plan.js - * region_tag:gkebackup_v1_generated_BackupForGKE_DeleteRestorePlan_async - */ - deleteRestorePlan( - request?: protos.google.cloud.gkebackup.v1.IDeleteRestorePlanRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteRestorePlan( - request: protos.google.cloud.gkebackup.v1.IDeleteRestorePlanRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteRestorePlan( - request: protos.google.cloud.gkebackup.v1.IDeleteRestorePlanRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteRestorePlan( - request?: protos.google.cloud.gkebackup.v1.IDeleteRestorePlanRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteRestorePlan(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteRestorePlan()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.delete_restore_plan.js - * region_tag:gkebackup_v1_generated_BackupForGKE_DeleteRestorePlan_async - */ - async checkDeleteRestorePlanProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteRestorePlan, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new Restore for the given RestorePlan. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The RestorePlan within which to create the Restore. - * Format: `projects/* /locations/* /restorePlans/*` - * @param {google.cloud.gkebackup.v1.Restore} request.restore - * Required. The restore resource to create. - * @param {string} request.restoreId - * Required. The client-provided short name for the Restore resource. - * This name must: - * - * - be between 1 and 63 characters long (inclusive) - * - consist of only lower-case ASCII letters, numbers, and dashes - * - start with a lower-case letter - * - end with a lower-case letter or number - * - be unique within the set of Restores in this RestorePlan. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.create_restore.js - * region_tag:gkebackup_v1_generated_BackupForGKE_CreateRestore_async - */ - createRestore( - request?: protos.google.cloud.gkebackup.v1.ICreateRestoreRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createRestore( - request: protos.google.cloud.gkebackup.v1.ICreateRestoreRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createRestore( - request: protos.google.cloud.gkebackup.v1.ICreateRestoreRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createRestore( - request?: protos.google.cloud.gkebackup.v1.ICreateRestoreRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createRestore(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createRestore()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.create_restore.js - * region_tag:gkebackup_v1_generated_BackupForGKE_CreateRestore_async - */ - async checkCreateRestoreProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createRestore, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Update a Restore. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.gkebackup.v1.Restore} request.restore - * Required. A new version of the Restore resource that contains updated - * fields. This may be sparsely populated if an `update_mask` is provided. - * @param {google.protobuf.FieldMask} request.updateMask - * This is used to specify the fields to be overwritten in the - * Restore targeted for update. The values for each of these - * updated fields will be taken from the `restore` provided - * with this request. Field names are relative to the root of the resource. - * If no `update_mask` is provided, all fields in `restore` will be - * written to the target Restore resource. - * Note that OUTPUT_ONLY and IMMUTABLE fields in `restore` are ignored - * and are not used to update the target Restore. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.update_restore.js - * region_tag:gkebackup_v1_generated_BackupForGKE_UpdateRestore_async - */ - updateRestore( - request?: protos.google.cloud.gkebackup.v1.IUpdateRestoreRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateRestore( - request: protos.google.cloud.gkebackup.v1.IUpdateRestoreRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateRestore( - request: protos.google.cloud.gkebackup.v1.IUpdateRestoreRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateRestore( - request?: protos.google.cloud.gkebackup.v1.IUpdateRestoreRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'restore.name': request.restore!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateRestore(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateRestore()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.update_restore.js - * region_tag:gkebackup_v1_generated_BackupForGKE_UpdateRestore_async - */ - async checkUpdateRestoreProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateRestore, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes an existing Restore. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full name of the Restore - * Format: `projects/* /locations/* /restorePlans/* /restores/*` - * @param {string} request.etag - * If provided, this value must match the current value of the - * target Restore's {@link protos.google.cloud.gkebackup.v1.Restore.etag|etag} field or - * the request is rejected. - * @param {boolean} request.force - * If set to true, any VolumeRestores below this restore will also be deleted. - * Otherwise, the request will only succeed if the restore has no - * VolumeRestores. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.delete_restore.js - * region_tag:gkebackup_v1_generated_BackupForGKE_DeleteRestore_async - */ - deleteRestore( - request?: protos.google.cloud.gkebackup.v1.IDeleteRestoreRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteRestore( - request: protos.google.cloud.gkebackup.v1.IDeleteRestoreRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteRestore( - request: protos.google.cloud.gkebackup.v1.IDeleteRestoreRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteRestore( - request?: protos.google.cloud.gkebackup.v1.IDeleteRestoreRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteRestore(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteRestore()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.delete_restore.js - * region_tag:gkebackup_v1_generated_BackupForGKE_DeleteRestore_async - */ - async checkDeleteRestoreProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteRestore, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists BackupPlans in a given location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location that contains the BackupPlans to list. - * Format: `projects/* /locations/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token|next_page_token} - * received from a previous `ListBackupPlans` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListBackupPlans` must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.gkebackup.v1.BackupPlan|BackupPlan}. - * 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 `listBackupPlansAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBackupPlans( - request?: protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkebackup.v1.IBackupPlan[], - protos.google.cloud.gkebackup.v1.IListBackupPlansRequest|null, - protos.google.cloud.gkebackup.v1.IListBackupPlansResponse - ]>; - listBackupPlans( - request: protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, - protos.google.cloud.gkebackup.v1.IListBackupPlansResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IBackupPlan>): void; - listBackupPlans( - request: protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, - callback: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, - protos.google.cloud.gkebackup.v1.IListBackupPlansResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IBackupPlan>): void; - listBackupPlans( - request?: protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, - protos.google.cloud.gkebackup.v1.IListBackupPlansResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IBackupPlan>, - callback?: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, - protos.google.cloud.gkebackup.v1.IListBackupPlansResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IBackupPlan>): - Promise<[ - protos.google.cloud.gkebackup.v1.IBackupPlan[], - protos.google.cloud.gkebackup.v1.IListBackupPlansRequest|null, - protos.google.cloud.gkebackup.v1.IListBackupPlansResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listBackupPlans(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location that contains the BackupPlans to list. - * Format: `projects/* /locations/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token|next_page_token} - * received from a previous `ListBackupPlans` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListBackupPlans` must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.gkebackup.v1.BackupPlan|BackupPlan} 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 `listBackupPlansAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBackupPlansStream( - request?: protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, - 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['listBackupPlans']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackupPlans.createStream( - this.innerApiCalls.listBackupPlans as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBackupPlans`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location that contains the BackupPlans to list. - * Format: `projects/* /locations/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token|next_page_token} - * received from a previous `ListBackupPlans` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListBackupPlans` must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkebackup.v1.BackupPlan|BackupPlan}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.list_backup_plans.js - * region_tag:gkebackup_v1_generated_BackupForGKE_ListBackupPlans_async - */ - listBackupPlansAsync( - request?: protos.google.cloud.gkebackup.v1.IListBackupPlansRequest, - 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['listBackupPlans']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackupPlans.asyncIterate( - this.innerApiCalls['listBackupPlans'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the Backups for a given BackupPlan. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The BackupPlan that contains the Backups to list. - * Format: `projects/* /locations/* /backupPlans/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token|next_page_token} - * received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListBackups` must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.gkebackup.v1.Backup|Backup}. - * 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 `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBackups( - request?: protos.google.cloud.gkebackup.v1.IListBackupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkebackup.v1.IBackup[], - protos.google.cloud.gkebackup.v1.IListBackupsRequest|null, - protos.google.cloud.gkebackup.v1.IListBackupsResponse - ]>; - listBackups( - request: protos.google.cloud.gkebackup.v1.IListBackupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListBackupsRequest, - protos.google.cloud.gkebackup.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IBackup>): void; - listBackups( - request: protos.google.cloud.gkebackup.v1.IListBackupsRequest, - callback: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListBackupsRequest, - protos.google.cloud.gkebackup.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IBackup>): void; - listBackups( - request?: protos.google.cloud.gkebackup.v1.IListBackupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkebackup.v1.IListBackupsRequest, - protos.google.cloud.gkebackup.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IBackup>, - callback?: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListBackupsRequest, - protos.google.cloud.gkebackup.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IBackup>): - Promise<[ - protos.google.cloud.gkebackup.v1.IBackup[], - protos.google.cloud.gkebackup.v1.IListBackupsRequest|null, - protos.google.cloud.gkebackup.v1.IListBackupsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listBackups(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The BackupPlan that contains the Backups to list. - * Format: `projects/* /locations/* /backupPlans/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token|next_page_token} - * received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListBackups` must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.gkebackup.v1.Backup|Backup} 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 `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBackupsStream( - request?: protos.google.cloud.gkebackup.v1.IListBackupsRequest, - 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['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.createStream( - this.innerApiCalls.listBackups as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBackups`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The BackupPlan that contains the Backups to list. - * Format: `projects/* /locations/* /backupPlans/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token|next_page_token} - * received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListBackups` must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkebackup.v1.Backup|Backup}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.list_backups.js - * region_tag:gkebackup_v1_generated_BackupForGKE_ListBackups_async - */ - listBackupsAsync( - request?: protos.google.cloud.gkebackup.v1.IListBackupsRequest, - 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['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.asyncIterate( - this.innerApiCalls['listBackups'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the VolumeBackups for a given Backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The Backup that contains the VolumeBackups to list. - * Format: `projects/* /locations/* /backupPlans/* /backups/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token|next_page_token} - * received from a previous `ListVolumeBackups` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListVolumeBackups` must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.gkebackup.v1.VolumeBackup|VolumeBackup}. - * 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 `listVolumeBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listVolumeBackups( - request?: protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkebackup.v1.IVolumeBackup[], - protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest|null, - protos.google.cloud.gkebackup.v1.IListVolumeBackupsResponse - ]>; - listVolumeBackups( - request: protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, - protos.google.cloud.gkebackup.v1.IListVolumeBackupsResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IVolumeBackup>): void; - listVolumeBackups( - request: protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, - callback: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, - protos.google.cloud.gkebackup.v1.IListVolumeBackupsResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IVolumeBackup>): void; - listVolumeBackups( - request?: protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, - protos.google.cloud.gkebackup.v1.IListVolumeBackupsResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IVolumeBackup>, - callback?: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, - protos.google.cloud.gkebackup.v1.IListVolumeBackupsResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IVolumeBackup>): - Promise<[ - protos.google.cloud.gkebackup.v1.IVolumeBackup[], - protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest|null, - protos.google.cloud.gkebackup.v1.IListVolumeBackupsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listVolumeBackups(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The Backup that contains the VolumeBackups to list. - * Format: `projects/* /locations/* /backupPlans/* /backups/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token|next_page_token} - * received from a previous `ListVolumeBackups` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListVolumeBackups` must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.gkebackup.v1.VolumeBackup|VolumeBackup} 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 `listVolumeBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listVolumeBackupsStream( - request?: protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, - 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['listVolumeBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listVolumeBackups.createStream( - this.innerApiCalls.listVolumeBackups as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listVolumeBackups`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The Backup that contains the VolumeBackups to list. - * Format: `projects/* /locations/* /backupPlans/* /backups/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token|next_page_token} - * received from a previous `ListVolumeBackups` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListVolumeBackups` must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkebackup.v1.VolumeBackup|VolumeBackup}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.list_volume_backups.js - * region_tag:gkebackup_v1_generated_BackupForGKE_ListVolumeBackups_async - */ - listVolumeBackupsAsync( - request?: protos.google.cloud.gkebackup.v1.IListVolumeBackupsRequest, - 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['listVolumeBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listVolumeBackups.asyncIterate( - this.innerApiCalls['listVolumeBackups'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists RestorePlans in a given location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location that contains the RestorePlans to list. - * Format: `projects/* /locations/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token|next_page_token} - * received from a previous `ListRestorePlans` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListRestorePlans` must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.gkebackup.v1.RestorePlan|RestorePlan}. - * 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 `listRestorePlansAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listRestorePlans( - request?: protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkebackup.v1.IRestorePlan[], - protos.google.cloud.gkebackup.v1.IListRestorePlansRequest|null, - protos.google.cloud.gkebackup.v1.IListRestorePlansResponse - ]>; - listRestorePlans( - request: protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, - protos.google.cloud.gkebackup.v1.IListRestorePlansResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IRestorePlan>): void; - listRestorePlans( - request: protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, - callback: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, - protos.google.cloud.gkebackup.v1.IListRestorePlansResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IRestorePlan>): void; - listRestorePlans( - request?: protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, - protos.google.cloud.gkebackup.v1.IListRestorePlansResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IRestorePlan>, - callback?: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, - protos.google.cloud.gkebackup.v1.IListRestorePlansResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IRestorePlan>): - Promise<[ - protos.google.cloud.gkebackup.v1.IRestorePlan[], - protos.google.cloud.gkebackup.v1.IListRestorePlansRequest|null, - protos.google.cloud.gkebackup.v1.IListRestorePlansResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listRestorePlans(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location that contains the RestorePlans to list. - * Format: `projects/* /locations/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token|next_page_token} - * received from a previous `ListRestorePlans` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListRestorePlans` must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.gkebackup.v1.RestorePlan|RestorePlan} 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 `listRestorePlansAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listRestorePlansStream( - request?: protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, - 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['listRestorePlans']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRestorePlans.createStream( - this.innerApiCalls.listRestorePlans as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRestorePlans`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location that contains the RestorePlans to list. - * Format: `projects/* /locations/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token|next_page_token} - * received from a previous `ListRestorePlans` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListRestorePlans` must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkebackup.v1.RestorePlan|RestorePlan}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.list_restore_plans.js - * region_tag:gkebackup_v1_generated_BackupForGKE_ListRestorePlans_async - */ - listRestorePlansAsync( - request?: protos.google.cloud.gkebackup.v1.IListRestorePlansRequest, - 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['listRestorePlans']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRestorePlans.asyncIterate( - this.innerApiCalls['listRestorePlans'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the Restores for a given RestorePlan. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The RestorePlan that contains the Restores to list. - * Format: `projects/* /locations/* /restorePlans/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token|next_page_token} - * received from a previous `ListRestores` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to `ListRestores` - * must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.gkebackup.v1.Restore|Restore}. - * 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 `listRestoresAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listRestores( - request?: protos.google.cloud.gkebackup.v1.IListRestoresRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkebackup.v1.IRestore[], - protos.google.cloud.gkebackup.v1.IListRestoresRequest|null, - protos.google.cloud.gkebackup.v1.IListRestoresResponse - ]>; - listRestores( - request: protos.google.cloud.gkebackup.v1.IListRestoresRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListRestoresRequest, - protos.google.cloud.gkebackup.v1.IListRestoresResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IRestore>): void; - listRestores( - request: protos.google.cloud.gkebackup.v1.IListRestoresRequest, - callback: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListRestoresRequest, - protos.google.cloud.gkebackup.v1.IListRestoresResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IRestore>): void; - listRestores( - request?: protos.google.cloud.gkebackup.v1.IListRestoresRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkebackup.v1.IListRestoresRequest, - protos.google.cloud.gkebackup.v1.IListRestoresResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IRestore>, - callback?: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListRestoresRequest, - protos.google.cloud.gkebackup.v1.IListRestoresResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IRestore>): - Promise<[ - protos.google.cloud.gkebackup.v1.IRestore[], - protos.google.cloud.gkebackup.v1.IListRestoresRequest|null, - protos.google.cloud.gkebackup.v1.IListRestoresResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listRestores(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The RestorePlan that contains the Restores to list. - * Format: `projects/* /locations/* /restorePlans/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token|next_page_token} - * received from a previous `ListRestores` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to `ListRestores` - * must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.gkebackup.v1.Restore|Restore} 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 `listRestoresAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listRestoresStream( - request?: protos.google.cloud.gkebackup.v1.IListRestoresRequest, - 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['listRestores']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRestores.createStream( - this.innerApiCalls.listRestores as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRestores`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The RestorePlan that contains the Restores to list. - * Format: `projects/* /locations/* /restorePlans/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token|next_page_token} - * received from a previous `ListRestores` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to `ListRestores` - * must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkebackup.v1.Restore|Restore}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.list_restores.js - * region_tag:gkebackup_v1_generated_BackupForGKE_ListRestores_async - */ - listRestoresAsync( - request?: protos.google.cloud.gkebackup.v1.IListRestoresRequest, - 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['listRestores']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRestores.asyncIterate( - this.innerApiCalls['listRestores'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the VolumeRestores for a given Restore. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The Restore that contains the VolumeRestores to list. - * Format: `projects/* /locations/* /restorePlans/* /restores/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token|next_page_token} - * received from a previous `ListVolumeRestores` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListVolumeRestores` must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.gkebackup.v1.VolumeRestore|VolumeRestore}. - * 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 `listVolumeRestoresAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listVolumeRestores( - request?: protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkebackup.v1.IVolumeRestore[], - protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest|null, - protos.google.cloud.gkebackup.v1.IListVolumeRestoresResponse - ]>; - listVolumeRestores( - request: protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, - protos.google.cloud.gkebackup.v1.IListVolumeRestoresResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IVolumeRestore>): void; - listVolumeRestores( - request: protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, - callback: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, - protos.google.cloud.gkebackup.v1.IListVolumeRestoresResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IVolumeRestore>): void; - listVolumeRestores( - request?: protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, - protos.google.cloud.gkebackup.v1.IListVolumeRestoresResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IVolumeRestore>, - callback?: PaginationCallback< - protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, - protos.google.cloud.gkebackup.v1.IListVolumeRestoresResponse|null|undefined, - protos.google.cloud.gkebackup.v1.IVolumeRestore>): - Promise<[ - protos.google.cloud.gkebackup.v1.IVolumeRestore[], - protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest|null, - protos.google.cloud.gkebackup.v1.IListVolumeRestoresResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listVolumeRestores(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The Restore that contains the VolumeRestores to list. - * Format: `projects/* /locations/* /restorePlans/* /restores/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token|next_page_token} - * received from a previous `ListVolumeRestores` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListVolumeRestores` must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.gkebackup.v1.VolumeRestore|VolumeRestore} 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 `listVolumeRestoresAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listVolumeRestoresStream( - request?: protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, - 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['listVolumeRestores']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listVolumeRestores.createStream( - this.innerApiCalls.listVolumeRestores as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listVolumeRestores`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The Restore that contains the VolumeRestores to list. - * Format: `projects/* /locations/* /restorePlans/* /restores/*` - * @param {number} request.pageSize - * The target number of results to return in a single response. - * If not specified, a default value will be chosen by the service. - * Note that the response may inclue a partial list and a caller should - * only rely on the response's - * {@link protos.google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The value of - * {@link protos.google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token|next_page_token} - * received from a previous `ListVolumeRestores` call. - * Provide this to retrieve the subsequent page in a multi-page list of - * results. When paginating, all other parameters provided to - * `ListVolumeRestores` must match the call that provided the page token. - * @param {string} request.filter - * Field match expression used to filter the results. - * @param {string} request.orderBy - * Field by which to sort the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkebackup.v1.VolumeRestore|VolumeRestore}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/backup_for_g_k_e.list_volume_restores.js - * region_tag:gkebackup_v1_generated_BackupForGKE_ListVolumeRestores_async - */ - listVolumeRestoresAsync( - request?: protos.google.cloud.gkebackup.v1.IListVolumeRestoresRequest, - 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['listVolumeRestores']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listVolumeRestores.asyncIterate( - this.innerApiCalls['listVolumeRestores'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} backup_plan - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project:string,location:string,backupPlan:string,backup:string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - location: location, - backup_plan: backupPlan, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the location from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).location; - } - - /** - * Parse the backup_plan from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup_plan. - */ - matchBackupPlanFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup_plan; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified backupPlan resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} backup_plan - * @returns {string} Resource name string. - */ - backupPlanPath(project:string,location:string,backupPlan:string) { - return this.pathTemplates.backupPlanPathTemplate.render({ - project: project, - location: location, - backup_plan: backupPlan, - }); - } - - /** - * Parse the project from BackupPlan resource. - * - * @param {string} backupPlanName - * A fully-qualified path representing BackupPlan resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupPlanName(backupPlanName: string) { - return this.pathTemplates.backupPlanPathTemplate.match(backupPlanName).project; - } - - /** - * Parse the location from BackupPlan resource. - * - * @param {string} backupPlanName - * A fully-qualified path representing BackupPlan resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBackupPlanName(backupPlanName: string) { - return this.pathTemplates.backupPlanPathTemplate.match(backupPlanName).location; - } - - /** - * Parse the backup_plan from BackupPlan resource. - * - * @param {string} backupPlanName - * A fully-qualified path representing BackupPlan resource. - * @returns {string} A string representing the backup_plan. - */ - matchBackupPlanFromBackupPlanName(backupPlanName: string) { - return this.pathTemplates.backupPlanPathTemplate.match(backupPlanName).backup_plan; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified restore resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} restore_plan - * @param {string} restore - * @returns {string} Resource name string. - */ - restorePath(project:string,location:string,restorePlan:string,restore:string) { - return this.pathTemplates.restorePathTemplate.render({ - project: project, - location: location, - restore_plan: restorePlan, - restore: restore, - }); - } - - /** - * Parse the project from Restore resource. - * - * @param {string} restoreName - * A fully-qualified path representing Restore resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRestoreName(restoreName: string) { - return this.pathTemplates.restorePathTemplate.match(restoreName).project; - } - - /** - * Parse the location from Restore resource. - * - * @param {string} restoreName - * A fully-qualified path representing Restore resource. - * @returns {string} A string representing the location. - */ - matchLocationFromRestoreName(restoreName: string) { - return this.pathTemplates.restorePathTemplate.match(restoreName).location; - } - - /** - * Parse the restore_plan from Restore resource. - * - * @param {string} restoreName - * A fully-qualified path representing Restore resource. - * @returns {string} A string representing the restore_plan. - */ - matchRestorePlanFromRestoreName(restoreName: string) { - return this.pathTemplates.restorePathTemplate.match(restoreName).restore_plan; - } - - /** - * Parse the restore from Restore resource. - * - * @param {string} restoreName - * A fully-qualified path representing Restore resource. - * @returns {string} A string representing the restore. - */ - matchRestoreFromRestoreName(restoreName: string) { - return this.pathTemplates.restorePathTemplate.match(restoreName).restore; - } - - /** - * Return a fully-qualified restorePlan resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} restore_plan - * @returns {string} Resource name string. - */ - restorePlanPath(project:string,location:string,restorePlan:string) { - return this.pathTemplates.restorePlanPathTemplate.render({ - project: project, - location: location, - restore_plan: restorePlan, - }); - } - - /** - * Parse the project from RestorePlan resource. - * - * @param {string} restorePlanName - * A fully-qualified path representing RestorePlan resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRestorePlanName(restorePlanName: string) { - return this.pathTemplates.restorePlanPathTemplate.match(restorePlanName).project; - } - - /** - * Parse the location from RestorePlan resource. - * - * @param {string} restorePlanName - * A fully-qualified path representing RestorePlan resource. - * @returns {string} A string representing the location. - */ - matchLocationFromRestorePlanName(restorePlanName: string) { - return this.pathTemplates.restorePlanPathTemplate.match(restorePlanName).location; - } - - /** - * Parse the restore_plan from RestorePlan resource. - * - * @param {string} restorePlanName - * A fully-qualified path representing RestorePlan resource. - * @returns {string} A string representing the restore_plan. - */ - matchRestorePlanFromRestorePlanName(restorePlanName: string) { - return this.pathTemplates.restorePlanPathTemplate.match(restorePlanName).restore_plan; - } - - /** - * Return a fully-qualified volumeBackup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} backup_plan - * @param {string} backup - * @param {string} volume_backup - * @returns {string} Resource name string. - */ - volumeBackupPath(project:string,location:string,backupPlan:string,backup:string,volumeBackup:string) { - return this.pathTemplates.volumeBackupPathTemplate.render({ - project: project, - location: location, - backup_plan: backupPlan, - backup: backup, - volume_backup: volumeBackup, - }); - } - - /** - * Parse the project from VolumeBackup resource. - * - * @param {string} volumeBackupName - * A fully-qualified path representing VolumeBackup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromVolumeBackupName(volumeBackupName: string) { - return this.pathTemplates.volumeBackupPathTemplate.match(volumeBackupName).project; - } - - /** - * Parse the location from VolumeBackup resource. - * - * @param {string} volumeBackupName - * A fully-qualified path representing VolumeBackup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromVolumeBackupName(volumeBackupName: string) { - return this.pathTemplates.volumeBackupPathTemplate.match(volumeBackupName).location; - } - - /** - * Parse the backup_plan from VolumeBackup resource. - * - * @param {string} volumeBackupName - * A fully-qualified path representing VolumeBackup resource. - * @returns {string} A string representing the backup_plan. - */ - matchBackupPlanFromVolumeBackupName(volumeBackupName: string) { - return this.pathTemplates.volumeBackupPathTemplate.match(volumeBackupName).backup_plan; - } - - /** - * Parse the backup from VolumeBackup resource. - * - * @param {string} volumeBackupName - * A fully-qualified path representing VolumeBackup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromVolumeBackupName(volumeBackupName: string) { - return this.pathTemplates.volumeBackupPathTemplate.match(volumeBackupName).backup; - } - - /** - * Parse the volume_backup from VolumeBackup resource. - * - * @param {string} volumeBackupName - * A fully-qualified path representing VolumeBackup resource. - * @returns {string} A string representing the volume_backup. - */ - matchVolumeBackupFromVolumeBackupName(volumeBackupName: string) { - return this.pathTemplates.volumeBackupPathTemplate.match(volumeBackupName).volume_backup; - } - - /** - * Return a fully-qualified volumeRestore resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} restore_plan - * @param {string} restore - * @param {string} volume_restore - * @returns {string} Resource name string. - */ - volumeRestorePath(project:string,location:string,restorePlan:string,restore:string,volumeRestore:string) { - return this.pathTemplates.volumeRestorePathTemplate.render({ - project: project, - location: location, - restore_plan: restorePlan, - restore: restore, - volume_restore: volumeRestore, - }); - } - - /** - * Parse the project from VolumeRestore resource. - * - * @param {string} volumeRestoreName - * A fully-qualified path representing VolumeRestore resource. - * @returns {string} A string representing the project. - */ - matchProjectFromVolumeRestoreName(volumeRestoreName: string) { - return this.pathTemplates.volumeRestorePathTemplate.match(volumeRestoreName).project; - } - - /** - * Parse the location from VolumeRestore resource. - * - * @param {string} volumeRestoreName - * A fully-qualified path representing VolumeRestore resource. - * @returns {string} A string representing the location. - */ - matchLocationFromVolumeRestoreName(volumeRestoreName: string) { - return this.pathTemplates.volumeRestorePathTemplate.match(volumeRestoreName).location; - } - - /** - * Parse the restore_plan from VolumeRestore resource. - * - * @param {string} volumeRestoreName - * A fully-qualified path representing VolumeRestore resource. - * @returns {string} A string representing the restore_plan. - */ - matchRestorePlanFromVolumeRestoreName(volumeRestoreName: string) { - return this.pathTemplates.volumeRestorePathTemplate.match(volumeRestoreName).restore_plan; - } - - /** - * Parse the restore from VolumeRestore resource. - * - * @param {string} volumeRestoreName - * A fully-qualified path representing VolumeRestore resource. - * @returns {string} A string representing the restore. - */ - matchRestoreFromVolumeRestoreName(volumeRestoreName: string) { - return this.pathTemplates.volumeRestorePathTemplate.match(volumeRestoreName).restore; - } - - /** - * Parse the volume_restore from VolumeRestore resource. - * - * @param {string} volumeRestoreName - * A fully-qualified path representing VolumeRestore resource. - * @returns {string} A string representing the volume_restore. - */ - matchVolumeRestoreFromVolumeRestoreName(volumeRestoreName: string) { - return this.pathTemplates.volumeRestorePathTemplate.match(volumeRestoreName).volume_restore; - } - - /** - * 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.backupForGKEStub && !this._terminated) { - return this.backupForGKEStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_client_config.json b/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_client_config.json deleted file mode 100644 index 5b662185052..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_client_config.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "interfaces": { - "google.cloud.gkebackup.v1.BackupForGKE": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c": { - "initial_retry_delay_millis": 1000, - "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": { - "CreateBackupPlan": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBackupPlans": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" - }, - "GetBackupPlan": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" - }, - "UpdateBackupPlan": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBackupPlan": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateBackup": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBackups": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" - }, - "GetBackup": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" - }, - "UpdateBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBackup": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListVolumeBackups": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" - }, - "GetVolumeBackup": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" - }, - "CreateRestorePlan": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListRestorePlans": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" - }, - "GetRestorePlan": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" - }, - "UpdateRestorePlan": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteRestorePlan": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateRestore": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListRestores": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" - }, - "GetRestore": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" - }, - "UpdateRestore": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteRestore": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListVolumeRestores": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" - }, - "GetVolumeRestore": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_proto_list.json b/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_proto_list.json deleted file mode 100644 index 30bdfe50d4f..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/backup_for_g_k_e_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/cloud/gkebackup/v1/backup.proto", - "../../protos/google/cloud/gkebackup/v1/backup_plan.proto", - "../../protos/google/cloud/gkebackup/v1/common.proto", - "../../protos/google/cloud/gkebackup/v1/gkebackup.proto", - "../../protos/google/cloud/gkebackup/v1/restore.proto", - "../../protos/google/cloud/gkebackup/v1/restore_plan.proto", - "../../protos/google/cloud/gkebackup/v1/volume.proto" -] diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/gapic_metadata.json deleted file mode 100644 index f3498121c6e..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,287 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.gkebackup.v1", - "libraryPackage": "@google-cloud/gke-backup", - "services": { - "BackupForGKE": { - "clients": { - "grpc": { - "libraryClient": "BackupForGKEClient", - "rpcs": { - "GetBackupPlan": { - "methods": [ - "getBackupPlan" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "GetVolumeBackup": { - "methods": [ - "getVolumeBackup" - ] - }, - "GetRestorePlan": { - "methods": [ - "getRestorePlan" - ] - }, - "GetRestore": { - "methods": [ - "getRestore" - ] - }, - "GetVolumeRestore": { - "methods": [ - "getVolumeRestore" - ] - }, - "CreateBackupPlan": { - "methods": [ - "createBackupPlan" - ] - }, - "UpdateBackupPlan": { - "methods": [ - "updateBackupPlan" - ] - }, - "DeleteBackupPlan": { - "methods": [ - "deleteBackupPlan" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "UpdateBackup": { - "methods": [ - "updateBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "CreateRestorePlan": { - "methods": [ - "createRestorePlan" - ] - }, - "UpdateRestorePlan": { - "methods": [ - "updateRestorePlan" - ] - }, - "DeleteRestorePlan": { - "methods": [ - "deleteRestorePlan" - ] - }, - "CreateRestore": { - "methods": [ - "createRestore" - ] - }, - "UpdateRestore": { - "methods": [ - "updateRestore" - ] - }, - "DeleteRestore": { - "methods": [ - "deleteRestore" - ] - }, - "ListBackupPlans": { - "methods": [ - "listBackupPlans", - "listBackupPlansStream", - "listBackupPlansAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - }, - "ListVolumeBackups": { - "methods": [ - "listVolumeBackups", - "listVolumeBackupsStream", - "listVolumeBackupsAsync" - ] - }, - "ListRestorePlans": { - "methods": [ - "listRestorePlans", - "listRestorePlansStream", - "listRestorePlansAsync" - ] - }, - "ListRestores": { - "methods": [ - "listRestores", - "listRestoresStream", - "listRestoresAsync" - ] - }, - "ListVolumeRestores": { - "methods": [ - "listVolumeRestores", - "listVolumeRestoresStream", - "listVolumeRestoresAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "BackupForGKEClient", - "rpcs": { - "GetBackupPlan": { - "methods": [ - "getBackupPlan" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "GetVolumeBackup": { - "methods": [ - "getVolumeBackup" - ] - }, - "GetRestorePlan": { - "methods": [ - "getRestorePlan" - ] - }, - "GetRestore": { - "methods": [ - "getRestore" - ] - }, - "GetVolumeRestore": { - "methods": [ - "getVolumeRestore" - ] - }, - "CreateBackupPlan": { - "methods": [ - "createBackupPlan" - ] - }, - "UpdateBackupPlan": { - "methods": [ - "updateBackupPlan" - ] - }, - "DeleteBackupPlan": { - "methods": [ - "deleteBackupPlan" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "UpdateBackup": { - "methods": [ - "updateBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "CreateRestorePlan": { - "methods": [ - "createRestorePlan" - ] - }, - "UpdateRestorePlan": { - "methods": [ - "updateRestorePlan" - ] - }, - "DeleteRestorePlan": { - "methods": [ - "deleteRestorePlan" - ] - }, - "CreateRestore": { - "methods": [ - "createRestore" - ] - }, - "UpdateRestore": { - "methods": [ - "updateRestore" - ] - }, - "DeleteRestore": { - "methods": [ - "deleteRestore" - ] - }, - "ListBackupPlans": { - "methods": [ - "listBackupPlans", - "listBackupPlansStream", - "listBackupPlansAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - }, - "ListVolumeBackups": { - "methods": [ - "listVolumeBackups", - "listVolumeBackupsStream", - "listVolumeBackupsAsync" - ] - }, - "ListRestorePlans": { - "methods": [ - "listRestorePlans", - "listRestorePlansStream", - "listRestorePlansAsync" - ] - }, - "ListRestores": { - "methods": [ - "listRestores", - "listRestoresStream", - "listRestoresAsync" - ] - }, - "ListVolumeRestores": { - "methods": [ - "listVolumeRestores", - "listVolumeRestoresStream", - "listVolumeRestoresAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/index.ts deleted file mode 100644 index fcc504ab5a1..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/src/v1/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 {BackupForGKEClient} from './backup_for_g_k_e_client'; diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gkebackup/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 3214dcb132a..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/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 gkebackup = require('@google-cloud/gke-backup'); - -function main() { - const backupForGKEClient = new gkebackup.BackupForGKEClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gkebackup/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index ad85b8b7446..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/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 {BackupForGKEClient} from '@google-cloud/gke-backup'; - -// check that the client class type name can be used -function doStuffWithBackupForGKEClient(client: BackupForGKEClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const backupForGKEClient = new BackupForGKEClient(); - doStuffWithBackupForGKEClient(backupForGKEClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/system-test/install.ts b/owl-bot-staging/google-cloud-gkebackup/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/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-gkebackup/v1/test/gapic_backup_for_g_k_e_v1.ts b/owl-bot-staging/google-cloud-gkebackup/v1/test/gapic_backup_for_g_k_e_v1.ts deleted file mode 100644 index 04fd6e4db23..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/v1/test/gapic_backup_for_g_k_e_v1.ts +++ /dev/null @@ -1,5257 +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 backupforgkeModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.BackupForGKEClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = backupforgkeModule.v1.BackupForGKEClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = backupforgkeModule.v1.BackupForGKEClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = backupforgkeModule.v1.BackupForGKEClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new backupforgkeModule.v1.BackupForGKEClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.backupForGKEStub, undefined); - await client.initialize(); - assert(client.backupForGKEStub); - }); - - it('has close method for the initialized client', done => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.backupForGKEStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.backupForGKEStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new backupforgkeModule.v1.BackupForGKEClient({ - 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 backupforgkeModule.v1.BackupForGKEClient({ - 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('getBackupPlan', () => { - it('invokes getBackupPlan without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetBackupPlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetBackupPlanRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.BackupPlan() - ); - client.innerApiCalls.getBackupPlan = stubSimpleCall(expectedResponse); - const [response] = await client.getBackupPlan(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackupPlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackupPlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackupPlan without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetBackupPlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetBackupPlanRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.BackupPlan() - ); - client.innerApiCalls.getBackupPlan = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackupPlan( - request, - (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IBackupPlan|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackupPlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackupPlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackupPlan with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetBackupPlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetBackupPlanRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackupPlan = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackupPlan(request), expectedError); - const actualRequest = (client.innerApiCalls.getBackupPlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackupPlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackupPlan with closed client', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetBackupPlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetBackupPlanRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBackupPlan(request), expectedError); - }); - }); - - describe('getBackup', () => { - it('invokes getBackup without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); - const [response] = await client.getBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackup( - request, - (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IBackup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with closed client', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBackup(request), expectedError); - }); - }); - - describe('getVolumeBackup', () => { - it('invokes getVolumeBackup without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetVolumeBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetVolumeBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.VolumeBackup() - ); - client.innerApiCalls.getVolumeBackup = stubSimpleCall(expectedResponse); - const [response] = await client.getVolumeBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVolumeBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVolumeBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVolumeBackup without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetVolumeBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetVolumeBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.VolumeBackup() - ); - client.innerApiCalls.getVolumeBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getVolumeBackup( - request, - (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IVolumeBackup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVolumeBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVolumeBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVolumeBackup with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetVolumeBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetVolumeBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getVolumeBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getVolumeBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.getVolumeBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVolumeBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVolumeBackup with closed client', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetVolumeBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetVolumeBackupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getVolumeBackup(request), expectedError); - }); - }); - - describe('getRestorePlan', () => { - it('invokes getRestorePlan without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetRestorePlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetRestorePlanRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.RestorePlan() - ); - client.innerApiCalls.getRestorePlan = stubSimpleCall(expectedResponse); - const [response] = await client.getRestorePlan(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRestorePlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRestorePlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRestorePlan without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetRestorePlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetRestorePlanRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.RestorePlan() - ); - client.innerApiCalls.getRestorePlan = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getRestorePlan( - request, - (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IRestorePlan|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRestorePlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRestorePlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRestorePlan with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetRestorePlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetRestorePlanRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getRestorePlan = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getRestorePlan(request), expectedError); - const actualRequest = (client.innerApiCalls.getRestorePlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRestorePlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRestorePlan with closed client', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetRestorePlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetRestorePlanRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getRestorePlan(request), expectedError); - }); - }); - - describe('getRestore', () => { - it('invokes getRestore without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetRestoreRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.Restore() - ); - client.innerApiCalls.getRestore = stubSimpleCall(expectedResponse); - const [response] = await client.getRestore(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRestore without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetRestoreRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.Restore() - ); - client.innerApiCalls.getRestore = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getRestore( - request, - (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IRestore|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRestore with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetRestoreRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getRestore = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getRestore(request), expectedError); - const actualRequest = (client.innerApiCalls.getRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRestore with closed client', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetRestoreRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getRestore(request), expectedError); - }); - }); - - describe('getVolumeRestore', () => { - it('invokes getVolumeRestore without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetVolumeRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetVolumeRestoreRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.VolumeRestore() - ); - client.innerApiCalls.getVolumeRestore = stubSimpleCall(expectedResponse); - const [response] = await client.getVolumeRestore(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVolumeRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVolumeRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVolumeRestore without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetVolumeRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetVolumeRestoreRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.VolumeRestore() - ); - client.innerApiCalls.getVolumeRestore = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getVolumeRestore( - request, - (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IVolumeRestore|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVolumeRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVolumeRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVolumeRestore with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetVolumeRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetVolumeRestoreRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getVolumeRestore = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getVolumeRestore(request), expectedError); - const actualRequest = (client.innerApiCalls.getVolumeRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVolumeRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVolumeRestore with closed client', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.GetVolumeRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.GetVolumeRestoreRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getVolumeRestore(request), expectedError); - }); - }); - - describe('createBackupPlan', () => { - it('invokes createBackupPlan without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.CreateBackupPlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateBackupPlanRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackupPlan = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBackupPlan(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackupPlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackupPlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackupPlan without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.CreateBackupPlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateBackupPlanRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackupPlan = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackupPlan( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackupPlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackupPlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackupPlan with call error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.CreateBackupPlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateBackupPlanRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackupPlan = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBackupPlan(request), expectedError); - const actualRequest = (client.innerApiCalls.createBackupPlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackupPlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackupPlan with LRO error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.CreateBackupPlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateBackupPlanRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackupPlan = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBackupPlan(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createBackupPlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackupPlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateBackupPlanProgress without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateBackupPlanProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateBackupPlanProgress with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateBackupPlanProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateBackupPlan', () => { - it('invokes updateBackupPlan without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.UpdateBackupPlanRequest() - ); - request.backupPlan ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateBackupPlanRequest', ['backupPlan', 'name']); - request.backupPlan.name = defaultValue1; - const expectedHeaderRequestParams = `backup_plan.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateBackupPlan = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateBackupPlan(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBackupPlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackupPlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBackupPlan without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.UpdateBackupPlanRequest() - ); - request.backupPlan ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateBackupPlanRequest', ['backupPlan', 'name']); - request.backupPlan.name = defaultValue1; - const expectedHeaderRequestParams = `backup_plan.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateBackupPlan = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBackupPlan( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBackupPlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackupPlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBackupPlan with call error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.UpdateBackupPlanRequest() - ); - request.backupPlan ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateBackupPlanRequest', ['backupPlan', 'name']); - request.backupPlan.name = defaultValue1; - const expectedHeaderRequestParams = `backup_plan.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackupPlan = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateBackupPlan(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBackupPlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackupPlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBackupPlan with LRO error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.UpdateBackupPlanRequest() - ); - request.backupPlan ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateBackupPlanRequest', ['backupPlan', 'name']); - request.backupPlan.name = defaultValue1; - const expectedHeaderRequestParams = `backup_plan.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackupPlan = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateBackupPlan(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateBackupPlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackupPlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateBackupPlanProgress without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateBackupPlanProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateBackupPlanProgress with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateBackupPlanProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteBackupPlan', () => { - it('invokes deleteBackupPlan without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.DeleteBackupPlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteBackupPlanRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackupPlan = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteBackupPlan(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackupPlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackupPlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackupPlan without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.DeleteBackupPlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteBackupPlanRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackupPlan = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackupPlan( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackupPlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackupPlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackupPlan with call error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.DeleteBackupPlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteBackupPlanRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackupPlan = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteBackupPlan(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackupPlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackupPlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackupPlan with LRO error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.DeleteBackupPlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteBackupPlanRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackupPlan = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteBackupPlan(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackupPlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackupPlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteBackupPlanProgress without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteBackupPlanProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteBackupPlanProgress with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteBackupPlanProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createBackup', () => { - it('invokes createBackup without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with call error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with LRO error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBackup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateBackupProgress without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateBackupProgress with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateBackup', () => { - it('invokes updateBackup without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.UpdateBackupRequest() - ); - request.backup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateBackupRequest', ['backup', 'name']); - request.backup.name = defaultValue1; - const expectedHeaderRequestParams = `backup.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBackup without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.UpdateBackupRequest() - ); - request.backup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateBackupRequest', ['backup', 'name']); - request.backup.name = defaultValue1; - const expectedHeaderRequestParams = `backup.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBackup with call error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.UpdateBackupRequest() - ); - request.backup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateBackupRequest', ['backup', 'name']); - request.backup.name = defaultValue1; - const expectedHeaderRequestParams = `backup.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBackup with LRO error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.UpdateBackupRequest() - ); - request.backup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateBackupRequest', ['backup', 'name']); - request.backup.name = defaultValue1; - const expectedHeaderRequestParams = `backup.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateBackup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateBackupProgress without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateBackupProgress with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteBackup', () => { - it('invokes deleteBackup without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with call error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with LRO error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteBackup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteBackupProgress without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteBackupProgress with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createRestorePlan', () => { - it('invokes createRestorePlan without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.CreateRestorePlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateRestorePlanRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createRestorePlan = stubLongRunningCall(expectedResponse); - const [operation] = await client.createRestorePlan(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createRestorePlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRestorePlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRestorePlan without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.CreateRestorePlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateRestorePlanRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createRestorePlan = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createRestorePlan( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createRestorePlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRestorePlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRestorePlan with call error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.CreateRestorePlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateRestorePlanRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createRestorePlan = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createRestorePlan(request), expectedError); - const actualRequest = (client.innerApiCalls.createRestorePlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRestorePlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRestorePlan with LRO error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.CreateRestorePlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateRestorePlanRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createRestorePlan = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createRestorePlan(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createRestorePlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRestorePlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateRestorePlanProgress without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateRestorePlanProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateRestorePlanProgress with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateRestorePlanProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateRestorePlan', () => { - it('invokes updateRestorePlan without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.UpdateRestorePlanRequest() - ); - request.restorePlan ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateRestorePlanRequest', ['restorePlan', 'name']); - request.restorePlan.name = defaultValue1; - const expectedHeaderRequestParams = `restore_plan.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateRestorePlan = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateRestorePlan(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRestorePlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRestorePlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRestorePlan without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.UpdateRestorePlanRequest() - ); - request.restorePlan ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateRestorePlanRequest', ['restorePlan', 'name']); - request.restorePlan.name = defaultValue1; - const expectedHeaderRequestParams = `restore_plan.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateRestorePlan = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateRestorePlan( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRestorePlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRestorePlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRestorePlan with call error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.UpdateRestorePlanRequest() - ); - request.restorePlan ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateRestorePlanRequest', ['restorePlan', 'name']); - request.restorePlan.name = defaultValue1; - const expectedHeaderRequestParams = `restore_plan.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateRestorePlan = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateRestorePlan(request), expectedError); - const actualRequest = (client.innerApiCalls.updateRestorePlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRestorePlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRestorePlan with LRO error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.UpdateRestorePlanRequest() - ); - request.restorePlan ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateRestorePlanRequest', ['restorePlan', 'name']); - request.restorePlan.name = defaultValue1; - const expectedHeaderRequestParams = `restore_plan.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateRestorePlan = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateRestorePlan(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateRestorePlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRestorePlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateRestorePlanProgress without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateRestorePlanProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateRestorePlanProgress with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateRestorePlanProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteRestorePlan', () => { - it('invokes deleteRestorePlan without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.DeleteRestorePlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteRestorePlanRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteRestorePlan = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteRestorePlan(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRestorePlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRestorePlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRestorePlan without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.DeleteRestorePlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteRestorePlanRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteRestorePlan = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteRestorePlan( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRestorePlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRestorePlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRestorePlan with call error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.DeleteRestorePlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteRestorePlanRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRestorePlan = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteRestorePlan(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteRestorePlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRestorePlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRestorePlan with LRO error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.DeleteRestorePlanRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteRestorePlanRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRestorePlan = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteRestorePlan(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteRestorePlan as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRestorePlan as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteRestorePlanProgress without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteRestorePlanProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteRestorePlanProgress with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteRestorePlanProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createRestore', () => { - it('invokes createRestore without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.CreateRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateRestoreRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createRestore = stubLongRunningCall(expectedResponse); - const [operation] = await client.createRestore(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRestore without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.CreateRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateRestoreRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createRestore = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createRestore( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRestore with call error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.CreateRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateRestoreRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createRestore = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createRestore(request), expectedError); - const actualRequest = (client.innerApiCalls.createRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRestore with LRO error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.CreateRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.CreateRestoreRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createRestore = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createRestore(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateRestoreProgress without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateRestoreProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateRestoreProgress with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateRestoreProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateRestore', () => { - it('invokes updateRestore without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.UpdateRestoreRequest() - ); - request.restore ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateRestoreRequest', ['restore', 'name']); - request.restore.name = defaultValue1; - const expectedHeaderRequestParams = `restore.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateRestore = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateRestore(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRestore without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.UpdateRestoreRequest() - ); - request.restore ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateRestoreRequest', ['restore', 'name']); - request.restore.name = defaultValue1; - const expectedHeaderRequestParams = `restore.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateRestore = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateRestore( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRestore with call error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.UpdateRestoreRequest() - ); - request.restore ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateRestoreRequest', ['restore', 'name']); - request.restore.name = defaultValue1; - const expectedHeaderRequestParams = `restore.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateRestore = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateRestore(request), expectedError); - const actualRequest = (client.innerApiCalls.updateRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRestore with LRO error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.UpdateRestoreRequest() - ); - request.restore ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.UpdateRestoreRequest', ['restore', 'name']); - request.restore.name = defaultValue1; - const expectedHeaderRequestParams = `restore.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateRestore = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateRestore(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateRestoreProgress without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateRestoreProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateRestoreProgress with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateRestoreProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteRestore', () => { - it('invokes deleteRestore without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.DeleteRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteRestoreRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteRestore = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteRestore(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRestore without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.DeleteRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteRestoreRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteRestore = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteRestore( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRestore with call error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.DeleteRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteRestoreRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRestore = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteRestore(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRestore with LRO error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.DeleteRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.DeleteRestoreRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRestore = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteRestore(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteRestoreProgress without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteRestoreProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteRestoreProgress with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteRestoreProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listBackupPlans', () => { - it('invokes listBackupPlans without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListBackupPlansRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupPlansRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), - ]; - client.innerApiCalls.listBackupPlans = stubSimpleCall(expectedResponse); - const [response] = await client.listBackupPlans(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackupPlans as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackupPlans as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackupPlans without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListBackupPlansRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupPlansRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), - ]; - client.innerApiCalls.listBackupPlans = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackupPlans( - request, - (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IBackupPlan[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackupPlans as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackupPlans as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackupPlans with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListBackupPlansRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupPlansRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackupPlans = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBackupPlans(request), expectedError); - const actualRequest = (client.innerApiCalls.listBackupPlans as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackupPlans as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackupPlansStream without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListBackupPlansRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupPlansRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), - ]; - client.descriptors.page.listBackupPlans.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBackupPlansStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkebackup.v1.BackupPlan[] = []; - stream.on('data', (response: protos.google.cloud.gkebackup.v1.BackupPlan) => { - 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.listBackupPlans.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackupPlans, request)); - assert( - (client.descriptors.page.listBackupPlans.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBackupPlansStream with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListBackupPlansRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupPlansRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackupPlans.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBackupPlansStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkebackup.v1.BackupPlan[] = []; - stream.on('data', (response: protos.google.cloud.gkebackup.v1.BackupPlan) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBackupPlans.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackupPlans, request)); - assert( - (client.descriptors.page.listBackupPlans.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackupPlans without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListBackupPlansRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupPlansRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.BackupPlan()), - ]; - client.descriptors.page.listBackupPlans.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkebackup.v1.IBackupPlan[] = []; - const iterable = client.listBackupPlansAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackupPlans.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackupPlans.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackupPlans with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListBackupPlansRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupPlansRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackupPlans.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBackupPlansAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkebackup.v1.IBackupPlan[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackupPlans.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackupPlans.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listBackups', () => { - it('invokes listBackups without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); - const [response] = await client.listBackups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackups( - request, - (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IBackup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBackups(request), expectedError); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackupsStream without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), - ]; - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkebackup.v1.Backup[] = []; - stream.on('data', (response: protos.google.cloud.gkebackup.v1.Backup) => { - 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.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBackupsStream with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkebackup.v1.Backup[] = []; - stream.on('data', (response: protos.google.cloud.gkebackup.v1.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackups without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Backup()), - ]; - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkebackup.v1.IBackup[] = []; - const iterable = client.listBackupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackups with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBackupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkebackup.v1.IBackup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listVolumeBackups', () => { - it('invokes listVolumeBackups without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListVolumeBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), - ]; - client.innerApiCalls.listVolumeBackups = stubSimpleCall(expectedResponse); - const [response] = await client.listVolumeBackups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listVolumeBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVolumeBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listVolumeBackups without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListVolumeBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), - ]; - client.innerApiCalls.listVolumeBackups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listVolumeBackups( - request, - (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IVolumeBackup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listVolumeBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVolumeBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listVolumeBackups with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListVolumeBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listVolumeBackups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listVolumeBackups(request), expectedError); - const actualRequest = (client.innerApiCalls.listVolumeBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVolumeBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listVolumeBackupsStream without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListVolumeBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), - ]; - client.descriptors.page.listVolumeBackups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listVolumeBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkebackup.v1.VolumeBackup[] = []; - stream.on('data', (response: protos.google.cloud.gkebackup.v1.VolumeBackup) => { - 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.listVolumeBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listVolumeBackups, request)); - assert( - (client.descriptors.page.listVolumeBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listVolumeBackupsStream with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListVolumeBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listVolumeBackups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listVolumeBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkebackup.v1.VolumeBackup[] = []; - stream.on('data', (response: protos.google.cloud.gkebackup.v1.VolumeBackup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listVolumeBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listVolumeBackups, request)); - assert( - (client.descriptors.page.listVolumeBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listVolumeBackups without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListVolumeBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeBackup()), - ]; - client.descriptors.page.listVolumeBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkebackup.v1.IVolumeBackup[] = []; - const iterable = client.listVolumeBackupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listVolumeBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listVolumeBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listVolumeBackups with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListVolumeBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listVolumeBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listVolumeBackupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkebackup.v1.IVolumeBackup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listVolumeBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listVolumeBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listRestorePlans', () => { - it('invokes listRestorePlans without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListRestorePlansRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestorePlansRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), - ]; - client.innerApiCalls.listRestorePlans = stubSimpleCall(expectedResponse); - const [response] = await client.listRestorePlans(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRestorePlans as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRestorePlans as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRestorePlans without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListRestorePlansRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestorePlansRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), - ]; - client.innerApiCalls.listRestorePlans = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRestorePlans( - request, - (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IRestorePlan[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRestorePlans as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRestorePlans as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRestorePlans with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListRestorePlansRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestorePlansRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRestorePlans = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRestorePlans(request), expectedError); - const actualRequest = (client.innerApiCalls.listRestorePlans as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRestorePlans as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRestorePlansStream without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListRestorePlansRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestorePlansRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), - ]; - client.descriptors.page.listRestorePlans.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRestorePlansStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkebackup.v1.RestorePlan[] = []; - stream.on('data', (response: protos.google.cloud.gkebackup.v1.RestorePlan) => { - 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.listRestorePlans.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRestorePlans, request)); - assert( - (client.descriptors.page.listRestorePlans.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listRestorePlansStream with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListRestorePlansRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestorePlansRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRestorePlans.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRestorePlansStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkebackup.v1.RestorePlan[] = []; - stream.on('data', (response: protos.google.cloud.gkebackup.v1.RestorePlan) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRestorePlans.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRestorePlans, request)); - assert( - (client.descriptors.page.listRestorePlans.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRestorePlans without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListRestorePlansRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestorePlansRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.RestorePlan()), - ]; - client.descriptors.page.listRestorePlans.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkebackup.v1.IRestorePlan[] = []; - const iterable = client.listRestorePlansAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRestorePlans.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRestorePlans.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRestorePlans with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListRestorePlansRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestorePlansRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRestorePlans.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRestorePlansAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkebackup.v1.IRestorePlan[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRestorePlans.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRestorePlans.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listRestores', () => { - it('invokes listRestores without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListRestoresRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestoresRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), - ]; - client.innerApiCalls.listRestores = stubSimpleCall(expectedResponse); - const [response] = await client.listRestores(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRestores as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRestores as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRestores without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListRestoresRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestoresRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), - ]; - client.innerApiCalls.listRestores = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRestores( - request, - (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IRestore[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRestores as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRestores as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRestores with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListRestoresRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestoresRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRestores = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRestores(request), expectedError); - const actualRequest = (client.innerApiCalls.listRestores as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRestores as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRestoresStream without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListRestoresRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestoresRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), - ]; - client.descriptors.page.listRestores.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRestoresStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkebackup.v1.Restore[] = []; - stream.on('data', (response: protos.google.cloud.gkebackup.v1.Restore) => { - 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.listRestores.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRestores, request)); - assert( - (client.descriptors.page.listRestores.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listRestoresStream with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListRestoresRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestoresRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRestores.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRestoresStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkebackup.v1.Restore[] = []; - stream.on('data', (response: protos.google.cloud.gkebackup.v1.Restore) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRestores.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRestores, request)); - assert( - (client.descriptors.page.listRestores.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRestores without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListRestoresRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestoresRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.Restore()), - ]; - client.descriptors.page.listRestores.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkebackup.v1.IRestore[] = []; - const iterable = client.listRestoresAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRestores.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRestores.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRestores with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListRestoresRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListRestoresRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRestores.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRestoresAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkebackup.v1.IRestore[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRestores.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRestores.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listVolumeRestores', () => { - it('invokes listVolumeRestores without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListVolumeRestoresRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeRestoresRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), - ]; - client.innerApiCalls.listVolumeRestores = stubSimpleCall(expectedResponse); - const [response] = await client.listVolumeRestores(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listVolumeRestores as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVolumeRestores as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listVolumeRestores without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListVolumeRestoresRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeRestoresRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), - ]; - client.innerApiCalls.listVolumeRestores = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listVolumeRestores( - request, - (err?: Error|null, result?: protos.google.cloud.gkebackup.v1.IVolumeRestore[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listVolumeRestores as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVolumeRestores as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listVolumeRestores with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListVolumeRestoresRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeRestoresRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listVolumeRestores = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listVolumeRestores(request), expectedError); - const actualRequest = (client.innerApiCalls.listVolumeRestores as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVolumeRestores as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listVolumeRestoresStream without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListVolumeRestoresRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeRestoresRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), - ]; - client.descriptors.page.listVolumeRestores.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listVolumeRestoresStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkebackup.v1.VolumeRestore[] = []; - stream.on('data', (response: protos.google.cloud.gkebackup.v1.VolumeRestore) => { - 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.listVolumeRestores.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listVolumeRestores, request)); - assert( - (client.descriptors.page.listVolumeRestores.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listVolumeRestoresStream with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListVolumeRestoresRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeRestoresRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listVolumeRestores.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listVolumeRestoresStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkebackup.v1.VolumeRestore[] = []; - stream.on('data', (response: protos.google.cloud.gkebackup.v1.VolumeRestore) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listVolumeRestores.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listVolumeRestores, request)); - assert( - (client.descriptors.page.listVolumeRestores.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listVolumeRestores without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListVolumeRestoresRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeRestoresRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), - generateSampleMessage(new protos.google.cloud.gkebackup.v1.VolumeRestore()), - ]; - client.descriptors.page.listVolumeRestores.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkebackup.v1.IVolumeRestore[] = []; - const iterable = client.listVolumeRestoresAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listVolumeRestores.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listVolumeRestores.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listVolumeRestores with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkebackup.v1.ListVolumeRestoresRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkebackup.v1.ListVolumeRestoresRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listVolumeRestores.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listVolumeRestoresAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkebackup.v1.IVolumeRestore[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listVolumeRestores.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listVolumeRestores.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('backup', () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backup_plan: "backupPlanValue", - backup: "backupValue", - }; - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "locationValue", "backupPlanValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackupName', () => { - const result = client.matchLocationFromBackupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupPlanFromBackupName', () => { - const result = client.matchBackupPlanFromBackupName(fakePath); - assert.strictEqual(result, "backupPlanValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('backupPlan', () => { - const fakePath = "/rendered/path/backupPlan"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backup_plan: "backupPlanValue", - }; - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPlanPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPlanPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPlanPath', () => { - const result = client.backupPlanPath("projectValue", "locationValue", "backupPlanValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPlanPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupPlanName', () => { - const result = client.matchProjectFromBackupPlanName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPlanPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackupPlanName', () => { - const result = client.matchLocationFromBackupPlanName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backupPlanPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupPlanFromBackupPlanName', () => { - const result = client.matchBackupPlanFromBackupPlanName(fakePath); - assert.strictEqual(result, "backupPlanValue"); - assert((client.pathTemplates.backupPlanPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('restore', () => { - const fakePath = "/rendered/path/restore"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - restore_plan: "restorePlanValue", - restore: "restoreValue", - }; - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.restorePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.restorePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('restorePath', () => { - const result = client.restorePath("projectValue", "locationValue", "restorePlanValue", "restoreValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.restorePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRestoreName', () => { - const result = client.matchProjectFromRestoreName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.restorePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromRestoreName', () => { - const result = client.matchLocationFromRestoreName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.restorePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRestorePlanFromRestoreName', () => { - const result = client.matchRestorePlanFromRestoreName(fakePath); - assert.strictEqual(result, "restorePlanValue"); - assert((client.pathTemplates.restorePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRestoreFromRestoreName', () => { - const result = client.matchRestoreFromRestoreName(fakePath); - assert.strictEqual(result, "restoreValue"); - assert((client.pathTemplates.restorePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('restorePlan', () => { - const fakePath = "/rendered/path/restorePlan"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - restore_plan: "restorePlanValue", - }; - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.restorePlanPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.restorePlanPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('restorePlanPath', () => { - const result = client.restorePlanPath("projectValue", "locationValue", "restorePlanValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.restorePlanPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRestorePlanName', () => { - const result = client.matchProjectFromRestorePlanName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.restorePlanPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromRestorePlanName', () => { - const result = client.matchLocationFromRestorePlanName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.restorePlanPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRestorePlanFromRestorePlanName', () => { - const result = client.matchRestorePlanFromRestorePlanName(fakePath); - assert.strictEqual(result, "restorePlanValue"); - assert((client.pathTemplates.restorePlanPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('volumeBackup', () => { - const fakePath = "/rendered/path/volumeBackup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backup_plan: "backupPlanValue", - backup: "backupValue", - volume_backup: "volumeBackupValue", - }; - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.volumeBackupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.volumeBackupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('volumeBackupPath', () => { - const result = client.volumeBackupPath("projectValue", "locationValue", "backupPlanValue", "backupValue", "volumeBackupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.volumeBackupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromVolumeBackupName', () => { - const result = client.matchProjectFromVolumeBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.volumeBackupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromVolumeBackupName', () => { - const result = client.matchLocationFromVolumeBackupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.volumeBackupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupPlanFromVolumeBackupName', () => { - const result = client.matchBackupPlanFromVolumeBackupName(fakePath); - assert.strictEqual(result, "backupPlanValue"); - assert((client.pathTemplates.volumeBackupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromVolumeBackupName', () => { - const result = client.matchBackupFromVolumeBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.volumeBackupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVolumeBackupFromVolumeBackupName', () => { - const result = client.matchVolumeBackupFromVolumeBackupName(fakePath); - assert.strictEqual(result, "volumeBackupValue"); - assert((client.pathTemplates.volumeBackupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('volumeRestore', () => { - const fakePath = "/rendered/path/volumeRestore"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - restore_plan: "restorePlanValue", - restore: "restoreValue", - volume_restore: "volumeRestoreValue", - }; - const client = new backupforgkeModule.v1.BackupForGKEClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.volumeRestorePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.volumeRestorePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('volumeRestorePath', () => { - const result = client.volumeRestorePath("projectValue", "locationValue", "restorePlanValue", "restoreValue", "volumeRestoreValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.volumeRestorePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromVolumeRestoreName', () => { - const result = client.matchProjectFromVolumeRestoreName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.volumeRestorePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromVolumeRestoreName', () => { - const result = client.matchLocationFromVolumeRestoreName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.volumeRestorePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRestorePlanFromVolumeRestoreName', () => { - const result = client.matchRestorePlanFromVolumeRestoreName(fakePath); - assert.strictEqual(result, "restorePlanValue"); - assert((client.pathTemplates.volumeRestorePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRestoreFromVolumeRestoreName', () => { - const result = client.matchRestoreFromVolumeRestoreName(fakePath); - assert.strictEqual(result, "restoreValue"); - assert((client.pathTemplates.volumeRestorePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVolumeRestoreFromVolumeRestoreName', () => { - const result = client.matchVolumeRestoreFromVolumeRestoreName(fakePath); - assert.strictEqual(result, "volumeRestoreValue"); - assert((client.pathTemplates.volumeRestorePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-gkebackup/v1/tsconfig.json b/owl-bot-staging/google-cloud-gkebackup/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/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-gkebackup/v1/webpack.config.js b/owl-bot-staging/google-cloud-gkebackup/v1/webpack.config.js deleted file mode 100644 index dd31bf29da9..00000000000 --- a/owl-bot-staging/google-cloud-gkebackup/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: 'BackupForGKE', - filename: './backup-for-g-k-e.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-gkeconnect-gateway/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/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-gkeconnect-gateway/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.gitignore b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/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-gkeconnect-gateway/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.jsdoc.js deleted file mode 100644 index 69ac743e1fe..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/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/gke-connect-gateway', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/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-gkeconnect-gateway/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/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-gkeconnect-gateway/v1beta1/README.md b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/README.md deleted file mode 100644 index 796832af022..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Gateway: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/package.json b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/package.json deleted file mode 100644 index 6e17cee6b12..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/gke-connect-gateway", - "version": "0.1.0", - "description": "Gateway client for Node.js", - "repository": "googleapis/nodejs-gateway", - "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 gateway", - "gateway", - "gateway service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto deleted file mode 100644 index 5dc600c1c01..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto +++ /dev/null @@ -1,75 +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.gkeconnect.gateway.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/httpbody.proto"; - -option csharp_namespace = "Google.Cloud.GkeConnect.Gateway.V1Beta1"; -option go_package = "cloud.google.com/go/gkeconnect/gateway/apiv1beta1/gatewaypb;gatewaypb"; -option java_multiple_files = true; -option java_outer_classname = "GatewayProto"; -option java_package = "com.google.cloud.gkeconnect.gateway.v1beta1"; -option php_namespace = "Google\\Cloud\\GkeConnect\\Gateway\\V1beta1"; -option ruby_package = "Google::Cloud::GkeConnect::Gateway::V1beta1"; - -// Gateway service is a public API which works as a Kubernetes resource model -// proxy between end users and registered Kubernetes clusters. Each RPC in this -// service matches with an HTTP verb. End user will initiate kubectl commands -// against the Gateway service, and Gateway service will forward user requests -// to clusters. -service GatewayService { - option (google.api.default_host) = "connectgateway.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // GetResource performs an HTTP GET request on the Kubernetes API Server. - rpc GetResource(google.api.HttpBody) returns (google.api.HttpBody) { - option (google.api.http) = { - get: "/v1beta1/**" - }; - } - - // PostResource performs an HTTP POST on the Kubernetes API Server. - rpc PostResource(google.api.HttpBody) returns (google.api.HttpBody) { - option (google.api.http) = { - post: "/v1beta1/**" - }; - } - - // DeleteResource performs an HTTP DELETE on the Kubernetes API Server. - rpc DeleteResource(google.api.HttpBody) returns (google.api.HttpBody) { - option (google.api.http) = { - delete: "/v1beta1/**" - }; - } - - // PutResource performs an HTTP PUT on the Kubernetes API Server. - rpc PutResource(google.api.HttpBody) returns (google.api.HttpBody) { - option (google.api.http) = { - put: "/v1beta1/**" - }; - } - - // PatchResource performs an HTTP PATCH on the Kubernetes API Server. - rpc PatchResource(google.api.HttpBody) returns (google.api.HttpBody) { - option (google.api.http) = { - patch: "/v1beta1/**" - }; - } -} diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.delete_resource.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.delete_resource.js deleted file mode 100644 index 6ebdb5dfa3e..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.delete_resource.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() { - // [START connectgateway_v1beta1_generated_GatewayService_DeleteResource_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The HTTP Content-Type header value specifying the content type of the body. - */ - // const contentType = 'abc123' - /** - * The HTTP request/response body as raw binary. - */ - // const data = Buffer.from('string') - /** - * Application specific response metadata. Must be set in the first response - * for streaming APIs. - */ - // const extensions = [1,2,3,4] - - // Imports the Gateway library - const {GatewayServiceClient} = require('@google-cloud/gke-connect-gateway').v1beta1; - - // Instantiates a client - const gatewayClient = new GatewayServiceClient(); - - async function callDeleteResource() { - // Construct request - const request = { - }; - - // Run request - const response = await gatewayClient.deleteResource(request); - console.log(response); - } - - callDeleteResource(); - // [END connectgateway_v1beta1_generated_GatewayService_DeleteResource_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-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.get_resource.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.get_resource.js deleted file mode 100644 index 57fe1fbea62..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.get_resource.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() { - // [START connectgateway_v1beta1_generated_GatewayService_GetResource_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The HTTP Content-Type header value specifying the content type of the body. - */ - // const contentType = 'abc123' - /** - * The HTTP request/response body as raw binary. - */ - // const data = Buffer.from('string') - /** - * Application specific response metadata. Must be set in the first response - * for streaming APIs. - */ - // const extensions = [1,2,3,4] - - // Imports the Gateway library - const {GatewayServiceClient} = require('@google-cloud/gke-connect-gateway').v1beta1; - - // Instantiates a client - const gatewayClient = new GatewayServiceClient(); - - async function callGetResource() { - // Construct request - const request = { - }; - - // Run request - const response = await gatewayClient.getResource(request); - console.log(response); - } - - callGetResource(); - // [END connectgateway_v1beta1_generated_GatewayService_GetResource_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-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.patch_resource.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.patch_resource.js deleted file mode 100644 index 13f9c59cd99..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.patch_resource.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() { - // [START connectgateway_v1beta1_generated_GatewayService_PatchResource_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The HTTP Content-Type header value specifying the content type of the body. - */ - // const contentType = 'abc123' - /** - * The HTTP request/response body as raw binary. - */ - // const data = Buffer.from('string') - /** - * Application specific response metadata. Must be set in the first response - * for streaming APIs. - */ - // const extensions = [1,2,3,4] - - // Imports the Gateway library - const {GatewayServiceClient} = require('@google-cloud/gke-connect-gateway').v1beta1; - - // Instantiates a client - const gatewayClient = new GatewayServiceClient(); - - async function callPatchResource() { - // Construct request - const request = { - }; - - // Run request - const response = await gatewayClient.patchResource(request); - console.log(response); - } - - callPatchResource(); - // [END connectgateway_v1beta1_generated_GatewayService_PatchResource_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-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.post_resource.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.post_resource.js deleted file mode 100644 index 2d27942f42f..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.post_resource.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() { - // [START connectgateway_v1beta1_generated_GatewayService_PostResource_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The HTTP Content-Type header value specifying the content type of the body. - */ - // const contentType = 'abc123' - /** - * The HTTP request/response body as raw binary. - */ - // const data = Buffer.from('string') - /** - * Application specific response metadata. Must be set in the first response - * for streaming APIs. - */ - // const extensions = [1,2,3,4] - - // Imports the Gateway library - const {GatewayServiceClient} = require('@google-cloud/gke-connect-gateway').v1beta1; - - // Instantiates a client - const gatewayClient = new GatewayServiceClient(); - - async function callPostResource() { - // Construct request - const request = { - }; - - // Run request - const response = await gatewayClient.postResource(request); - console.log(response); - } - - callPostResource(); - // [END connectgateway_v1beta1_generated_GatewayService_PostResource_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-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.put_resource.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.put_resource.js deleted file mode 100644 index 74de65ce1ef..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/gateway_service.put_resource.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() { - // [START connectgateway_v1beta1_generated_GatewayService_PutResource_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The HTTP Content-Type header value specifying the content type of the body. - */ - // const contentType = 'abc123' - /** - * The HTTP request/response body as raw binary. - */ - // const data = Buffer.from('string') - /** - * Application specific response metadata. Must be set in the first response - * for streaming APIs. - */ - // const extensions = [1,2,3,4] - - // Imports the Gateway library - const {GatewayServiceClient} = require('@google-cloud/gke-connect-gateway').v1beta1; - - // Instantiates a client - const gatewayClient = new GatewayServiceClient(); - - async function callPutResource() { - // Construct request - const request = { - }; - - // Run request - const response = await gatewayClient.putResource(request); - console.log(response); - } - - callPutResource(); - // [END connectgateway_v1beta1_generated_GatewayService_PutResource_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-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.gkeconnect.gateway.v1beta1.json b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.gkeconnect.gateway.v1beta1.json deleted file mode 100644 index 4e4047a3e74..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.gkeconnect.gateway.v1beta1.json +++ /dev/null @@ -1,255 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-gateway", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.gkeconnect.gateway.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "connectgateway_v1beta1_generated_GatewayService_GetResource_async", - "title": "GatewayService getResource Sample", - "origin": "API_DEFINITION", - "description": " GetResource performs an HTTP GET request on the Kubernetes API Server.", - "canonical": true, - "file": "gateway_service.get_resource.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetResource", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.GetResource", - "async": true, - "parameters": [ - { - "name": "content_type", - "type": "TYPE_STRING" - }, - { - "name": "data", - "type": "TYPE_BYTES" - }, - { - "name": "extensions", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.api.HttpBody", - "client": { - "shortName": "GatewayServiceClient", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayServiceClient" - }, - "method": { - "shortName": "GetResource", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.GetResource", - "service": { - "shortName": "GatewayService", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService" - } - } - } - }, - { - "regionTag": "connectgateway_v1beta1_generated_GatewayService_PostResource_async", - "title": "GatewayService postResource Sample", - "origin": "API_DEFINITION", - "description": " PostResource performs an HTTP POST on the Kubernetes API Server.", - "canonical": true, - "file": "gateway_service.post_resource.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PostResource", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.PostResource", - "async": true, - "parameters": [ - { - "name": "content_type", - "type": "TYPE_STRING" - }, - { - "name": "data", - "type": "TYPE_BYTES" - }, - { - "name": "extensions", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.api.HttpBody", - "client": { - "shortName": "GatewayServiceClient", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayServiceClient" - }, - "method": { - "shortName": "PostResource", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.PostResource", - "service": { - "shortName": "GatewayService", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService" - } - } - } - }, - { - "regionTag": "connectgateway_v1beta1_generated_GatewayService_DeleteResource_async", - "title": "GatewayService deleteResource Sample", - "origin": "API_DEFINITION", - "description": " DeleteResource performs an HTTP DELETE on the Kubernetes API Server.", - "canonical": true, - "file": "gateway_service.delete_resource.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteResource", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.DeleteResource", - "async": true, - "parameters": [ - { - "name": "content_type", - "type": "TYPE_STRING" - }, - { - "name": "data", - "type": "TYPE_BYTES" - }, - { - "name": "extensions", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.api.HttpBody", - "client": { - "shortName": "GatewayServiceClient", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayServiceClient" - }, - "method": { - "shortName": "DeleteResource", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.DeleteResource", - "service": { - "shortName": "GatewayService", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService" - } - } - } - }, - { - "regionTag": "connectgateway_v1beta1_generated_GatewayService_PutResource_async", - "title": "GatewayService putResource Sample", - "origin": "API_DEFINITION", - "description": " PutResource performs an HTTP PUT on the Kubernetes API Server.", - "canonical": true, - "file": "gateway_service.put_resource.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PutResource", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.PutResource", - "async": true, - "parameters": [ - { - "name": "content_type", - "type": "TYPE_STRING" - }, - { - "name": "data", - "type": "TYPE_BYTES" - }, - { - "name": "extensions", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.api.HttpBody", - "client": { - "shortName": "GatewayServiceClient", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayServiceClient" - }, - "method": { - "shortName": "PutResource", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.PutResource", - "service": { - "shortName": "GatewayService", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService" - } - } - } - }, - { - "regionTag": "connectgateway_v1beta1_generated_GatewayService_PatchResource_async", - "title": "GatewayService patchResource Sample", - "origin": "API_DEFINITION", - "description": " PatchResource performs an HTTP PATCH on the Kubernetes API Server.", - "canonical": true, - "file": "gateway_service.patch_resource.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PatchResource", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.PatchResource", - "async": true, - "parameters": [ - { - "name": "content_type", - "type": "TYPE_STRING" - }, - { - "name": "data", - "type": "TYPE_BYTES" - }, - { - "name": "extensions", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.api.HttpBody", - "client": { - "shortName": "GatewayServiceClient", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayServiceClient" - }, - "method": { - "shortName": "PatchResource", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService.PatchResource", - "service": { - "shortName": "GatewayService", - "fullName": "google.cloud.gkeconnect.gateway.v1beta1.GatewayService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/index.ts deleted file mode 100644 index 394ba8ced0f..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/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 GatewayServiceClient = v1beta1.GatewayServiceClient; -type GatewayServiceClient = v1beta1.GatewayServiceClient; -export {v1beta1, GatewayServiceClient}; -export default {v1beta1, GatewayServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gapic_metadata.json deleted file mode 100644 index 5c3d96707e3..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gapic_metadata.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.gkeconnect.gateway.v1beta1", - "libraryPackage": "@google-cloud/gke-connect-gateway", - "services": { - "GatewayService": { - "clients": { - "grpc": { - "libraryClient": "GatewayServiceClient", - "rpcs": { - "GetResource": { - "methods": [ - "getResource" - ] - }, - "PostResource": { - "methods": [ - "postResource" - ] - }, - "DeleteResource": { - "methods": [ - "deleteResource" - ] - }, - "PutResource": { - "methods": [ - "putResource" - ] - }, - "PatchResource": { - "methods": [ - "patchResource" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "GatewayServiceClient", - "rpcs": { - "GetResource": { - "methods": [ - "getResource" - ] - }, - "PostResource": { - "methods": [ - "postResource" - ] - }, - "DeleteResource": { - "methods": [ - "deleteResource" - ] - }, - "PutResource": { - "methods": [ - "putResource" - ] - }, - "PatchResource": { - "methods": [ - "patchResource" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_client.ts b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_client.ts deleted file mode 100644 index be4f1a9820f..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_client.ts +++ /dev/null @@ -1,657 +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/gateway_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './gateway_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Gateway service is a public API which works as a Kubernetes resource model - * proxy between end users and registered Kubernetes clusters. Each RPC in this - * service matches with an HTTP verb. End user will initiate kubectl commands - * against the Gateway service, and Gateway service will forward user requests - * to clusters. - * @class - * @memberof v1beta1 - */ -export class GatewayServiceClient { - 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}; - gatewayServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of GatewayServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 GatewayServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof GatewayServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // 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 { - 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.gkeconnect.gateway.v1beta1.GatewayService', 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.gatewayServiceStub) { - return this.gatewayServiceStub; - } - - // Put together the "service stub" for - // google.cloud.gkeconnect.gateway.v1beta1.GatewayService. - this.gatewayServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.gkeconnect.gateway.v1beta1.GatewayService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.gkeconnect.gateway.v1beta1.GatewayService, - 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 gatewayServiceStubMethods = - ['getResource', 'postResource', 'deleteResource', 'putResource', 'patchResource']; - for (const methodName of gatewayServiceStubMethods) { - const callPromise = this.gatewayServiceStub.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.gatewayServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'connectgateway.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 'connectgateway.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 -- - // ------------------- -/** - * GetResource performs an HTTP GET request on the Kubernetes API Server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.contentType - * The HTTP Content-Type header value specifying the content type of the body. - * @param {Buffer} request.data - * The HTTP request/response body as raw binary. - * @param {number[]} request.extensions - * Application specific response metadata. Must be set in the first response - * for streaming APIs. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.api.HttpBody|HttpBody}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/gateway_service.get_resource.js - * region_tag:connectgateway_v1beta1_generated_GatewayService_GetResource_async - */ - getResource( - request?: protos.google.api.IHttpBody, - options?: CallOptions): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|undefined, {}|undefined - ]>; - getResource( - request: protos.google.api.IHttpBody, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; - getResource( - request: protos.google.api.IHttpBody, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; - getResource( - request?: protos.google.api.IHttpBody, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|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 || {}; - this.initialize(); - return this.innerApiCalls.getResource(request, options, callback); - } -/** - * PostResource performs an HTTP POST on the Kubernetes API Server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.contentType - * The HTTP Content-Type header value specifying the content type of the body. - * @param {Buffer} request.data - * The HTTP request/response body as raw binary. - * @param {number[]} request.extensions - * Application specific response metadata. Must be set in the first response - * for streaming APIs. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.api.HttpBody|HttpBody}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/gateway_service.post_resource.js - * region_tag:connectgateway_v1beta1_generated_GatewayService_PostResource_async - */ - postResource( - request?: protos.google.api.IHttpBody, - options?: CallOptions): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|undefined, {}|undefined - ]>; - postResource( - request: protos.google.api.IHttpBody, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; - postResource( - request: protos.google.api.IHttpBody, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; - postResource( - request?: protos.google.api.IHttpBody, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|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 || {}; - this.initialize(); - return this.innerApiCalls.postResource(request, options, callback); - } -/** - * DeleteResource performs an HTTP DELETE on the Kubernetes API Server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.contentType - * The HTTP Content-Type header value specifying the content type of the body. - * @param {Buffer} request.data - * The HTTP request/response body as raw binary. - * @param {number[]} request.extensions - * Application specific response metadata. Must be set in the first response - * for streaming APIs. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.api.HttpBody|HttpBody}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/gateway_service.delete_resource.js - * region_tag:connectgateway_v1beta1_generated_GatewayService_DeleteResource_async - */ - deleteResource( - request?: protos.google.api.IHttpBody, - options?: CallOptions): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|undefined, {}|undefined - ]>; - deleteResource( - request: protos.google.api.IHttpBody, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; - deleteResource( - request: protos.google.api.IHttpBody, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; - deleteResource( - request?: protos.google.api.IHttpBody, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|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 || {}; - this.initialize(); - return this.innerApiCalls.deleteResource(request, options, callback); - } -/** - * PutResource performs an HTTP PUT on the Kubernetes API Server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.contentType - * The HTTP Content-Type header value specifying the content type of the body. - * @param {Buffer} request.data - * The HTTP request/response body as raw binary. - * @param {number[]} request.extensions - * Application specific response metadata. Must be set in the first response - * for streaming APIs. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.api.HttpBody|HttpBody}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/gateway_service.put_resource.js - * region_tag:connectgateway_v1beta1_generated_GatewayService_PutResource_async - */ - putResource( - request?: protos.google.api.IHttpBody, - options?: CallOptions): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|undefined, {}|undefined - ]>; - putResource( - request: protos.google.api.IHttpBody, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; - putResource( - request: protos.google.api.IHttpBody, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; - putResource( - request?: protos.google.api.IHttpBody, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|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 || {}; - this.initialize(); - return this.innerApiCalls.putResource(request, options, callback); - } -/** - * PatchResource performs an HTTP PATCH on the Kubernetes API Server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.contentType - * The HTTP Content-Type header value specifying the content type of the body. - * @param {Buffer} request.data - * The HTTP request/response body as raw binary. - * @param {number[]} request.extensions - * Application specific response metadata. Must be set in the first response - * for streaming APIs. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.api.HttpBody|HttpBody}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/gateway_service.patch_resource.js - * region_tag:connectgateway_v1beta1_generated_GatewayService_PatchResource_async - */ - patchResource( - request?: protos.google.api.IHttpBody, - options?: CallOptions): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|undefined, {}|undefined - ]>; - patchResource( - request: protos.google.api.IHttpBody, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; - patchResource( - request: protos.google.api.IHttpBody, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; - patchResource( - request?: protos.google.api.IHttpBody, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|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 || {}; - this.initialize(); - return this.innerApiCalls.patchResource(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.gatewayServiceStub && !this._terminated) { - return this.gatewayServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_client_config.json b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_client_config.json deleted file mode 100644 index d733656e755..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.gkeconnect.gateway.v1beta1.GatewayService": { - "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": { - "GetResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PostResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PutResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PatchResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_proto_list.json b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_proto_list.json deleted file mode 100644 index 634a5e135a8..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/gateway_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto" -] diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/src/v1beta1/index.ts deleted file mode 100644 index 18ba6ccd01b..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/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 {GatewayServiceClient} from './gateway_service_client'; diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 5da58fffd69..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/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 gateway = require('@google-cloud/gke-connect-gateway'); - -function main() { - const gatewayServiceClient = new gateway.GatewayServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 6f3d526aa23..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/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 {GatewayServiceClient} from '@google-cloud/gke-connect-gateway'; - -// check that the client class type name can be used -function doStuffWithGatewayServiceClient(client: GatewayServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const gatewayServiceClient = new GatewayServiceClient(); - doStuffWithGatewayServiceClient(gatewayServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/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-gkeconnect-gateway/v1beta1/test/gapic_gateway_service_v1beta1.ts b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/test/gapic_gateway_service_v1beta1.ts deleted file mode 100644 index 845934d172d..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/test/gapic_gateway_service_v1beta1.ts +++ /dev/null @@ -1,525 +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 gatewayserviceModule 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.GatewayServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = gatewayserviceModule.v1beta1.GatewayServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = gatewayserviceModule.v1beta1.GatewayServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = gatewayserviceModule.v1beta1.GatewayServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.gatewayServiceStub, undefined); - await client.initialize(); - assert(client.gatewayServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.gatewayServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.gatewayServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - 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 gatewayserviceModule.v1beta1.GatewayServiceClient({ - 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('getResource', () => { - it('invokes getResource without error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.getResource = stubSimpleCall(expectedResponse); - const [response] = await client.getResource(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getResource without error using callback', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.getResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getResource( - request, - (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getResource with error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.getResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getResource(request), expectedError); - }); - - it('invokes getResource with closed client', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getResource(request), expectedError); - }); - }); - - describe('postResource', () => { - it('invokes postResource without error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.postResource = stubSimpleCall(expectedResponse); - const [response] = await client.postResource(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes postResource without error using callback', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.postResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.postResource( - request, - (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes postResource with error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.postResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.postResource(request), expectedError); - }); - - it('invokes postResource with closed client', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.postResource(request), expectedError); - }); - }); - - describe('deleteResource', () => { - it('invokes deleteResource without error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.deleteResource = stubSimpleCall(expectedResponse); - const [response] = await client.deleteResource(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes deleteResource without error using callback', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.deleteResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteResource( - request, - (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes deleteResource with error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.deleteResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteResource(request), expectedError); - }); - - it('invokes deleteResource with closed client', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteResource(request), expectedError); - }); - }); - - describe('putResource', () => { - it('invokes putResource without error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.putResource = stubSimpleCall(expectedResponse); - const [response] = await client.putResource(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes putResource without error using callback', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.putResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.putResource( - request, - (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes putResource with error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.putResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.putResource(request), expectedError); - }); - - it('invokes putResource with closed client', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.putResource(request), expectedError); - }); - }); - - describe('patchResource', () => { - it('invokes patchResource without error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.patchResource = stubSimpleCall(expectedResponse); - const [response] = await client.patchResource(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes patchResource without error using callback', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.patchResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patchResource( - request, - (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes patchResource with error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.patchResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patchResource(request), expectedError); - }); - - it('invokes patchResource with closed client', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.api.HttpBody() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.patchResource(request), expectedError); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/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-gkeconnect-gateway/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-gkeconnect-gateway/v1beta1/webpack.config.js deleted file mode 100644 index 32921119d6c..00000000000 --- a/owl-bot-staging/google-cloud-gkeconnect-gateway/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: 'GatewayService', - filename: './gateway-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-gkehub/v1/.eslintignore b/owl-bot-staging/google-cloud-gkehub/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1/.eslintrc.json b/owl-bot-staging/google-cloud-gkehub/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/.gitignore b/owl-bot-staging/google-cloud-gkehub/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1/.jsdoc.js b/owl-bot-staging/google-cloud-gkehub/v1/.jsdoc.js deleted file mode 100644 index b83282dcebb..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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/gke-hub', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-gkehub/v1/.mocharc.js b/owl-bot-staging/google-cloud-gkehub/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1/.prettierrc.js b/owl-bot-staging/google-cloud-gkehub/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1/README.md b/owl-bot-staging/google-cloud-gkehub/v1/README.md deleted file mode 100644 index f922950c787..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Gkehub: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gkehub/v1/package.json b/owl-bot-staging/google-cloud-gkehub/v1/package.json deleted file mode 100644 index 25f7a0fc625..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/gke-hub", - "version": "0.1.0", - "description": "Gkehub client for Node.js", - "repository": "googleapis/nodejs-gkehub", - "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 gkehub", - "gkehub", - "gke hub" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/configmanagement/configmanagement.proto b/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/configmanagement/configmanagement.proto deleted file mode 100644 index 978276dc5c6..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/configmanagement/configmanagement.proto +++ /dev/null @@ -1,382 +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.gkehub.configmanagement.v1; - -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeHub.ConfigManagement.V1"; -option go_package = "cloud.google.com/go/gkehub/configmanagement/apiv1/configmanagementpb;configmanagementpb"; -option java_multiple_files = true; -option java_outer_classname = "ConfigManagementProto"; -option java_package = "com.google.cloud.gkehub.configmanagement.v1"; -option php_namespace = "Google\\Cloud\\GkeHub\\ConfigManagement\\V1"; -option ruby_package = "Google::Cloud::GkeHub::ConfigManagement::V1"; - -// Enum representing the state of an ACM's deployment on a cluster -enum DeploymentState { - // Deployment's state cannot be determined - DEPLOYMENT_STATE_UNSPECIFIED = 0; - - // Deployment is not installed - NOT_INSTALLED = 1; - - // Deployment is installed - INSTALLED = 2; - - // Deployment was attempted to be installed, but has errors - ERROR = 3; -} - -// **Anthos Config Management**: State for a single cluster. -message MembershipState { - // The user-defined name for the cluster used by ClusterSelectors to group - // clusters together. This should match Membership's membership_name, - // unless the user installed ACM on the cluster manually prior to enabling - // the ACM hub feature. - // Unique within a Anthos Config Management installation. - string cluster_name = 1; - - // Membership configuration in the cluster. This represents the actual state - // in the cluster, while the MembershipSpec in the FeatureSpec represents - // the intended state - MembershipSpec membership_spec = 2; - - // Current install status of ACM's Operator - OperatorState operator_state = 3; - - // Current sync status - ConfigSyncState config_sync_state = 4; - - // PolicyController status - PolicyControllerState policy_controller_state = 5; - - // Hierarchy Controller status - HierarchyControllerState hierarchy_controller_state = 7; -} - -// **Anthos Config Management**: Configuration for a single cluster. -// Intended to parallel the ConfigManagement CR. -message MembershipSpec { - // Config Sync configuration for the cluster. - ConfigSync config_sync = 1; - - // Policy Controller configuration for the cluster. - PolicyController policy_controller = 2; - - // Hierarchy Controller configuration for the cluster. - HierarchyControllerConfig hierarchy_controller = 4; - - // Version of ACM installed. - string version = 10; -} - -// Configuration for Config Sync -message ConfigSync { - // Git repo configuration for the cluster. - GitConfig git = 7; - - // Specifies whether the Config Sync Repo is - // in “hierarchical” or “unstructured” mode. - string source_format = 8; -} - -// Git repo configuration for a single cluster. -message GitConfig { - // The URL of the Git repository to use as the source of truth. - string sync_repo = 1; - - // The branch of the repository to sync from. Default: master. - string sync_branch = 2; - - // The path within the Git repository that represents the top level of the - // repo to sync. Default: the root directory of the repository. - string policy_dir = 3; - - // Period in seconds between consecutive syncs. Default: 15. - int64 sync_wait_secs = 4; - - // Git revision (tag or hash) to check out. Default HEAD. - string sync_rev = 5; - - // Type of secret configured for access to the Git repo. - string secret_type = 6; - - // URL for the HTTPS proxy to be used when communicating with the Git repo. - string https_proxy = 7; - - // The GCP Service Account Email used for auth when secret_type is - // gcpServiceAccount. - string gcp_service_account_email = 8; -} - -// Configuration for Policy Controller -message PolicyController { - // Enables the installation of Policy Controller. - // If false, the rest of PolicyController fields take no - // effect. - bool enabled = 1; - - // Installs the default template library along with Policy Controller. - optional bool template_library_installed = 2; - - // Sets the interval for Policy Controller Audit Scans (in seconds). - // When set to 0, this disables audit functionality altogether. - optional int64 audit_interval_seconds = 3; - - // The set of namespaces that are excluded from Policy Controller checks. - // Namespaces do not need to currently exist on the cluster. - repeated string exemptable_namespaces = 4; - - // Enables the ability to use Constraint Templates that reference to objects - // other than the object currently being evaluated. - bool referential_rules_enabled = 5; - - // Logs all denies and dry run failures. - bool log_denies_enabled = 6; -} - -// Configuration for Hierarchy Controller -message HierarchyControllerConfig { - // Whether Hierarchy Controller is enabled in this cluster. - bool enabled = 1; - - // Whether pod tree labels are enabled in this cluster. - bool enable_pod_tree_labels = 2; - - // Whether hierarchical resource quota is enabled in this cluster. - bool enable_hierarchical_resource_quota = 3; -} - -// Deployment state for Hierarchy Controller -message HierarchyControllerDeploymentState { - // The deployment state for open source HNC (e.g. v0.7.0-hc.0) - DeploymentState hnc = 1; - - // The deployment state for Hierarchy Controller extension (e.g. v0.7.0-hc.1) - DeploymentState extension = 2; -} - -// Version for Hierarchy Controller -message HierarchyControllerVersion { - // Version for open source HNC - string hnc = 1; - - // Version for Hierarchy Controller extension - string extension = 2; -} - -// State for Hierarchy Controller -message HierarchyControllerState { - // The version for Hierarchy Controller - HierarchyControllerVersion version = 1; - - // The deployment state for Hierarchy Controller - HierarchyControllerDeploymentState state = 2; -} - -// State information for an ACM's Operator -message OperatorState { - // The semenatic version number of the operator - string version = 1; - - // The state of the Operator's deployment - DeploymentState deployment_state = 2; - - // Install errors. - repeated InstallError errors = 3; -} - -// Errors pertaining to the installation of ACM -message InstallError { - // A string representing the user facing error message - string error_message = 1; -} - -// State information for ConfigSync -message ConfigSyncState { - // The version of ConfigSync deployed - ConfigSyncVersion version = 1; - - // Information about the deployment of ConfigSync, including the version - // of the various Pods deployed - ConfigSyncDeploymentState deployment_state = 2; - - // The state of ConfigSync's process to sync configs to a cluster - SyncState sync_state = 3; -} - -// Specific versioning information pertaining to ConfigSync's Pods -message ConfigSyncVersion { - // Version of the deployed importer pod - string importer = 1; - - // Version of the deployed syncer pod - string syncer = 2; - - // Version of the deployed git-sync pod - string git_sync = 3; - - // Version of the deployed monitor pod - string monitor = 4; - - // Version of the deployed reconciler-manager pod - string reconciler_manager = 5; - - // Version of the deployed reconciler container in root-reconciler pod - string root_reconciler = 6; -} - -// The state of ConfigSync's deployment on a cluster -message ConfigSyncDeploymentState { - // Deployment state of the importer pod - DeploymentState importer = 1; - - // Deployment state of the syncer pod - DeploymentState syncer = 2; - - // Deployment state of the git-sync pod - DeploymentState git_sync = 3; - - // Deployment state of the monitor pod - DeploymentState monitor = 4; - - // Deployment state of reconciler-manager pod - DeploymentState reconciler_manager = 5; - - // Deployment state of root-reconciler - DeploymentState root_reconciler = 6; -} - -// State indicating an ACM's progress syncing configurations to a cluster -message SyncState { - // An enum representing an ACM's status syncing configs to a cluster - enum SyncCode { - // ACM cannot determine a sync code - SYNC_CODE_UNSPECIFIED = 0; - - // ACM successfully synced the git Repo with the cluster - SYNCED = 1; - - // ACM is in the progress of syncing a new change - PENDING = 2; - - // Indicates an error configuring ACM, and user action is required - ERROR = 3; - - // ACM has been installed (operator manifest deployed), - // but not configured. - NOT_CONFIGURED = 4; - - // ACM has not been installed (no operator pod found) - NOT_INSTALLED = 5; - - // Error authorizing with the cluster - UNAUTHORIZED = 6; - - // Cluster could not be reached - UNREACHABLE = 7; - } - - // Token indicating the state of the repo. - string source_token = 1; - - // Token indicating the state of the importer. - string import_token = 2; - - // Token indicating the state of the syncer. - string sync_token = 3; - - // Deprecated: use last_sync_time instead. - // Timestamp of when ACM last successfully synced the repo - // The time format is specified in https://golang.org/pkg/time/#Time.String - string last_sync = 4 [deprecated = true]; - - // Timestamp type of when ACM last successfully synced the repo - google.protobuf.Timestamp last_sync_time = 7; - - // Sync status code - SyncCode code = 5; - - // A list of errors resulting from problematic configs. - // This list will be truncated after 100 errors, although it is - // unlikely for that many errors to simultaneously exist. - repeated SyncError errors = 6; -} - -// An ACM created error representing a problem syncing configurations -message SyncError { - // An ACM defined error code - string code = 1; - - // A description of the error - string error_message = 2; - - // A list of config(s) associated with the error, if any - repeated ErrorResource error_resources = 3; -} - -// Model for a config file in the git repo with an associated Sync error -message ErrorResource { - // Path in the git repo of the erroneous config - string source_path = 1; - - // Metadata name of the resource that is causing an error - string resource_name = 2; - - // Namespace of the resource that is causing an error - string resource_namespace = 3; - - // Group/version/kind of the resource that is causing an error - GroupVersionKind resource_gvk = 4; -} - -// A Kubernetes object's GVK -message GroupVersionKind { - // Kubernetes Group - string group = 1; - - // Kubernetes Version - string version = 2; - - // Kubernetes Kind - string kind = 3; -} - -// State for PolicyControllerState. -message PolicyControllerState { - // The version of Gatekeeper Policy Controller deployed. - PolicyControllerVersion version = 1; - - // The state about the policy controller installation. - GatekeeperDeploymentState deployment_state = 2; -} - -// The build version of Gatekeeper Policy Controller is using. -message PolicyControllerVersion { - // The gatekeeper image tag that is composed of ACM version, git tag, build - // number. - string version = 1; -} - -// State of Policy Controller installation. -message GatekeeperDeploymentState { - // Status of gatekeeper-controller-manager pod. - DeploymentState gatekeeper_controller_manager_state = 1; - - // Status of gatekeeper-audit deployment. - DeploymentState gatekeeper_audit = 2; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/feature.proto b/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/feature.proto deleted file mode 100644 index 6b48661b4fd..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/feature.proto +++ /dev/null @@ -1,198 +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.gkehub.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/gkehub/v1/configmanagement/configmanagement.proto"; -import "google/cloud/gkehub/v1/multiclusteringress/multiclusteringress.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeHub.V1"; -option go_package = "cloud.google.com/go/gkehub/apiv1/gkehubpb;gkehubpb"; -option java_multiple_files = true; -option java_outer_classname = "FeatureProto"; -option java_package = "com.google.cloud.gkehub.v1"; -option php_namespace = "Google\\Cloud\\GkeHub\\V1"; -option ruby_package = "Google::Cloud::GkeHub::V1"; - -// Feature represents the settings and status of any Hub Feature. -message Feature { - option (google.api.resource) = { - type: "gkehub.googleapis.com/Feature" - pattern: "projects/{project}/locations/{location}/features/{feature}" - }; - - // Output only. The full, unique name of this Feature resource in the format - // `projects/*/locations/*/features/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // GCP labels for this Feature. - map labels = 2; - - // Output only. State of the Feature resource itself. - FeatureResourceState resource_state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Hub-wide Feature configuration. If this Feature does not support any - // Hub-wide configuration, this field may be unused. - CommonFeatureSpec spec = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Membership-specific configuration for this Feature. If this Feature does - // not support any per-Membership configuration, this field may be unused. - // - // The keys indicate which Membership the configuration is for, in the form: - // - // projects/{p}/locations/{l}/memberships/{m} - // - // Where {p} is the project, {l} is a valid location and {m} is a valid - // Membership in this project at that location. {p} WILL match the Feature's - // project. - // - // {p} will always be returned as the project number, but the project ID is - // also accepted during input. If the same Membership is specified in the map - // twice (using the project ID form, and the project number form), exactly - // ONE of the entries will be saved, with no guarantees as to which. For this - // reason, it is recommended the same format be used for all entries when - // mutating a Feature. - map membership_specs = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The Hub-wide Feature state. - CommonFeatureState state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Membership-specific Feature status. If this Feature does - // report any per-Membership status, this field may be unused. - // - // The keys indicate which Membership the state is for, in the form: - // - // projects/{p}/locations/{l}/memberships/{m} - // - // Where {p} is the project number, {l} is a valid location and {m} is a valid - // Membership in this project at that location. {p} MUST match the Feature's - // project number. - map membership_states = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the Feature resource was created. - google.protobuf.Timestamp create_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the Feature resource was last updated. - google.protobuf.Timestamp update_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the Feature resource was deleted. - google.protobuf.Timestamp delete_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// FeatureResourceState describes the state of a Feature *resource* in the -// GkeHub API. See `FeatureState` for the "running state" of the Feature in the -// Hub and across Memberships. -message FeatureResourceState { - // State describes the lifecycle status of a Feature. - enum State { - // State is unknown or not set. - STATE_UNSPECIFIED = 0; - - // The Feature is being enabled, and the Feature resource is being created. - // Once complete, the corresponding Feature will be enabled in this Hub. - ENABLING = 1; - - // The Feature is enabled in this Hub, and the Feature resource is fully - // available. - ACTIVE = 2; - - // The Feature is being disabled in this Hub, and the Feature resource - // is being deleted. - DISABLING = 3; - - // The Feature resource is being updated. - UPDATING = 4; - - // The Feature resource is being updated by the Hub Service. - SERVICE_UPDATING = 5; - } - - // The current state of the Feature resource in the Hub API. - State state = 1; -} - -// FeatureState describes the high-level state of a Feature. It may be used to -// describe a Feature's state at the environ-level, or per-membershop, depending -// on the context. -message FeatureState { - // Code represents a machine-readable, high-level status of the Feature. - enum Code { - // Unknown or not set. - CODE_UNSPECIFIED = 0; - - // The Feature is operating normally. - OK = 1; - - // The Feature has encountered an issue, and is operating in a degraded - // state. The Feature may need intervention to return to normal operation. - // See the description and any associated Feature-specific details for more - // information. - WARNING = 2; - - // The Feature is not operating or is in a severely degraded state. - // The Feature may need intervention to return to normal operation. - // See the description and any associated Feature-specific details for more - // information. - ERROR = 3; - } - - // The high-level, machine-readable status of this Feature. - Code code = 1; - - // A human-readable description of the current status. - string description = 2; - - // The time this status and any related Feature-specific details were updated. - google.protobuf.Timestamp update_time = 3; -} - -// CommonFeatureSpec contains Hub-wide configuration information -message CommonFeatureSpec { - oneof feature_spec { - // Multicluster Ingress-specific spec. - google.cloud.gkehub.multiclusteringress.v1.FeatureSpec multiclusteringress = 102; - } -} - -// CommonFeatureState contains Hub-wide Feature status information. -message CommonFeatureState { - // Output only. The "running state" of the Feature in this Hub. - FeatureState state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// MembershipFeatureSpec contains configuration information for a single -// Membership. -message MembershipFeatureSpec { - oneof feature_spec { - // Config Management-specific spec. - google.cloud.gkehub.configmanagement.v1.MembershipSpec configmanagement = 106; - } -} - -// MembershipFeatureState contains Feature status information for a single -// Membership. -message MembershipFeatureState { - oneof feature_state { - // Config Management-specific state. - google.cloud.gkehub.configmanagement.v1.MembershipState configmanagement = 106; - } - - // The high-level state of this Feature for a single membership. - FeatureState state = 1; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/membership.proto b/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/membership.proto deleted file mode 100644 index ae4337cc26e..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/membership.proto +++ /dev/null @@ -1,348 +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 -// -// 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.gkehub.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeHub.V1"; -option go_package = "cloud.google.com/go/gkehub/apiv1/gkehubpb;gkehubpb"; -option java_multiple_files = true; -option java_outer_classname = "MembershipProto"; -option java_package = "com.google.cloud.gkehub.v1"; -option php_namespace = "Google\\Cloud\\GkeHub\\V1"; -option ruby_package = "Google::Cloud::GkeHub::V1"; - -// Membership contains information about a member cluster. -message Membership { - option (google.api.resource) = { - type: "gkehub.googleapis.com/Membership" - pattern: "projects/{project}/locations/{location}/memberships/{membership}" - }; - - // Type of resource represented by this Membership - oneof type { - // Optional. Endpoint information to reach this member. - MembershipEndpoint endpoint = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // Output only. The full, unique name of this Membership resource in the - // format `projects/*/locations/*/memberships/{membership_id}`, set during - // creation. - // - // `membership_id` must be a valid RFC 1123 compliant DNS label: - // - // 1. At most 63 characters in length - // 2. It must consist of lower case alphanumeric characters or `-` - // 3. It must start and end with an alphanumeric character - // - // Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, - // with a maximum length of 63 characters. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Labels for this membership. - map labels = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Description of this membership, limited to 63 characters. - // Must match the regex: `[a-zA-Z0-9][a-zA-Z0-9_\-\.\ ]*` - // - // This field is present for legacy purposes. - string description = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. State of the Membership resource. - MembershipState state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the Membership was created. - google.protobuf.Timestamp create_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the Membership was last updated. - google.protobuf.Timestamp update_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the Membership was deleted. - google.protobuf.Timestamp delete_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. An externally-generated and managed ID for this Membership. This - // ID may be modified after creation, but this is not recommended. - // - // The ID must match the regex: `[a-zA-Z0-9][a-zA-Z0-9_\-\.]*` - // - // If this Membership represents a Kubernetes cluster, this value should be - // set to the UID of the `kube-system` namespace object. - string external_id = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. For clusters using Connect, the timestamp of the most recent - // connection established with Google Cloud. This time is updated every - // several minutes, not continuously. For clusters that do not use GKE - // Connect, or that have never connected successfully, this field will be - // unset. - google.protobuf.Timestamp last_connection_time = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Google-generated UUID for this resource. This is unique across - // all Membership resources. If a Membership resource is deleted and another - // resource with the same name is created, it gets a different unique_id. - string unique_id = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. How to identify workloads from this Membership. - // See the documentation on Workload Identity for more details: - // https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity - Authority authority = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The monitoring config information for this membership. - MonitoringConfig monitoring_config = 14 - [(google.api.field_behavior) = OPTIONAL]; -} - -// MembershipEndpoint contains information needed to contact a Kubernetes API, -// endpoint and any additional Kubernetes metadata. -message MembershipEndpoint { - // Optional. GKE-specific information. Only present if this Membership is a GKE cluster. - GkeCluster gke_cluster = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Useful Kubernetes-specific metadata. - KubernetesMetadata kubernetes_metadata = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The in-cluster Kubernetes Resources that should be applied for a - // correctly registered cluster, in the steady state. These resources: - // - // * Ensure that the cluster is exclusively registered to one and only one - // Hub Membership. - // * Propagate Workload Pool Information available in the Membership - // Authority field. - // * Ensure proper initial configuration of default Hub Features. - KubernetesResource kubernetes_resource = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Whether the lifecycle of this membership is managed by a - // google cluster platform service. - bool google_managed = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// KubernetesResource contains the YAML manifests and configuration for -// Membership Kubernetes resources in the cluster. After CreateMembership or -// UpdateMembership, these resources should be re-applied in the cluster. -message KubernetesResource { - // Input only. The YAML representation of the Membership CR. This field is - // ignored for GKE clusters where Hub can read the CR directly. - // - // Callers should provide the CR that is currently present in the cluster - // during CreateMembership or UpdateMembership, or leave this field empty if - // none exists. The CR manifest is used to validate the cluster has not been - // registered with another Membership. - string membership_cr_manifest = 1 [(google.api.field_behavior) = INPUT_ONLY]; - - // Output only. Additional Kubernetes resources that need to be applied to the - // cluster after Membership creation, and after every update. - // - // This field is only populated in the Membership returned from a successful - // long-running operation from CreateMembership or UpdateMembership. It is not - // populated during normal GetMembership or ListMemberships requests. To get - // the resource manifest after the initial registration, the caller should - // make a UpdateMembership call with an empty field mask. - repeated ResourceManifest membership_resources = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The Kubernetes resources for installing the GKE Connect agent - // - // This field is only populated in the Membership returned from a successful - // long-running operation from CreateMembership or UpdateMembership. It is not - // populated during normal GetMembership or ListMemberships requests. To get - // the resource manifest after the initial registration, the caller should - // make a UpdateMembership call with an empty field mask. - repeated ResourceManifest connect_resources = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Options for Kubernetes resource generation. - ResourceOptions resource_options = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// ResourceOptions represent options for Kubernetes resource generation. -message ResourceOptions { - // Optional. The Connect agent version to use for connect_resources. Defaults - // to the latest GKE Connect version. The version must be a currently - // supported version, obsolete versions will be rejected. - string connect_version = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Use `apiextensions/v1beta1` instead of `apiextensions/v1` for - // CustomResourceDefinition resources. - // This option should be set for clusters with Kubernetes apiserver versions - // <1.16. - bool v1beta1_crd = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Major version of the Kubernetes cluster. This is only used to - // determine which version to use for the CustomResourceDefinition resources, - // `apiextensions/v1beta1` or`apiextensions/v1`. - string k8s_version = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// ResourceManifest represents a single Kubernetes resource to be applied to -// the cluster. -message ResourceManifest { - // YAML manifest of the resource. - string manifest = 1; - - // Whether the resource provided in the manifest is `cluster_scoped`. - // If unset, the manifest is assumed to be namespace scoped. - // - // This field is used for REST mapping when applying the resource in a - // cluster. - bool cluster_scoped = 2; -} - -// GkeCluster contains information specific to GKE clusters. -message GkeCluster { - // Immutable. Self-link of the Google Cloud resource for the GKE cluster. For - // example: - // - // //container.googleapis.com/projects/my-project/locations/us-west1-a/clusters/my-cluster - // - // Zonal clusters are also supported. - string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. If cluster_missing is set then it denotes that the GKE cluster - // no longer exists in the GKE Control Plane. - bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// KubernetesMetadata provides informational metadata for Memberships -// representing Kubernetes clusters. -message KubernetesMetadata { - // Output only. Kubernetes API server version string as reported by - // `/version`. - string kubernetes_api_server_version = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Node providerID as reported by the first node in the list of - // nodes on the Kubernetes endpoint. On Kubernetes platforms that support - // zero-node clusters (like GKE-on-GCP), the node_count will be zero and the - // node_provider_id will be empty. - string node_provider_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Node count as reported by Kubernetes nodes resources. - int32 node_count = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. vCPU count as reported by Kubernetes nodes resources. - int32 vcpu_count = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The total memory capacity as reported by the sum of all - // Kubernetes nodes resources, defined in MB. - int32 memory_mb = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which these details were last updated. This - // update_time is different from the Membership-level update_time since - // EndpointDetails are updated internally for API consumers. - google.protobuf.Timestamp update_time = 100 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// This field informs Fleet-based applications/services/UIs with the necessary -// information for where each underlying Cluster reports its metrics. -message MonitoringConfig { - // Immutable. Project used to report Metrics - string project_id = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. Location used to report Metrics - string location = 2 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. Cluster name used to report metrics. - // For Anthos on VMWare/Baremetal, it would be in format - // `memberClusters/cluster_name`; And for Anthos on MultiCloud, it would be in - // format - // `{azureClusters, awsClusters}/cluster_name`. - string cluster = 3 [(google.api.field_behavior) = IMMUTABLE]; - - // Kubernetes system metrics, if available, are written to this prefix. - // This defaults to kubernetes.io for GKE, and kubernetes.io/anthos for Anthos - // eventually. Noted: Anthos MultiCloud will have kubernetes.io prefix today - // but will migration to be under kubernetes.io/anthos - string kubernetes_metrics_prefix = 4; - - // Immutable. Cluster hash, this is a unique string generated by google code, - // which does not contain any PII, which we can use to reference the cluster. - // This is expected to be created by the monitoring stack and persisted into - // the Cluster object as well as to GKE-Hub. - string cluster_hash = 5 [(google.api.field_behavior) = IMMUTABLE]; -} - -// MembershipState describes the state of a Membership resource. -message MembershipState { - // Code describes the state of a Membership resource. - enum Code { - // The code is not set. - CODE_UNSPECIFIED = 0; - - // The cluster is being registered. - CREATING = 1; - - // The cluster is registered. - READY = 2; - - // The cluster is being unregistered. - DELETING = 3; - - // The Membership is being updated. - UPDATING = 4; - - // The Membership is being updated by the Hub Service. - SERVICE_UPDATING = 5; - } - - // Output only. The current state of the Membership resource. - Code code = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Authority encodes how Google will recognize identities from this Membership. -// See the workload identity documentation for more details: -// https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity -message Authority { - // Optional. A JSON Web Token (JWT) issuer URI. `issuer` must start with - // `https://` and be a valid URL with length <2000 characters. - // - // If set, then Google will allow valid OIDC tokens from this issuer to - // authenticate within the workload_identity_pool. OIDC discovery will be - // performed on this URI to validate tokens from the issuer. - // - // Clearing `issuer` disables Workload Identity. `issuer` cannot be directly - // modified; it must be cleared (and Workload Identity disabled) before using - // a new issuer (and re-enabling Workload Identity). - string issuer = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The name of the workload identity pool in which `issuer` will - // be recognized. - // - // There is a single Workload Identity Pool per Hub that is shared - // between all Memberships that belong to that Hub. For a Hub hosted in - // {PROJECT_ID}, the workload pool format is `{PROJECT_ID}.hub.id.goog`, - // although this is subject to change in newer versions of this API. - string workload_identity_pool = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. An identity provider that reflects the `issuer` in the - // workload identity pool. - string identity_provider = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. OIDC verification keys for this Membership in JWKS format (RFC - // 7517). - // - // When this field is set, OIDC discovery will NOT be performed on `issuer`, - // and instead OIDC tokens will be validated using this field. - bytes oidc_jwks = 4 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/multiclusteringress/multiclusteringress.proto b/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/multiclusteringress/multiclusteringress.proto deleted file mode 100644 index ce9a72514d7..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/multiclusteringress/multiclusteringress.proto +++ /dev/null @@ -1,33 +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.gkehub.multiclusteringress.v1; - -option csharp_namespace = "Google.Cloud.GkeHub.MultiClusterIngress.V1"; -option go_package = "cloud.google.com/go/gkehub/multiclusteringress/apiv1/multiclusteringresspb;multiclusteringresspb"; -option java_multiple_files = true; -option java_outer_classname = "MultiClusterIngressProto"; -option java_package = "com.google.cloud.gkehub.multiclusteringress.v1"; -option php_namespace = "Google\\Cloud\\GkeHub\\MultiClusterIngress\\V1"; -option ruby_package = "Google::Cloud::GkeHub::MultiClusterIngress::V1"; - -// **Multi-cluster Ingress**: The configuration for the MultiClusterIngress -// feature. -message FeatureSpec { - // Fully-qualified Membership name which hosts the MultiClusterIngress CRD. - // Example: `projects/foo-proj/locations/global/memberships/bar` - string config_membership = 1; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/service.proto b/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/service.proto deleted file mode 100644 index cecf242e41a..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/protos/google/cloud/gkehub/v1/service.proto +++ /dev/null @@ -1,648 +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 -// -// 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.gkehub.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/gkehub/v1/feature.proto"; -import "google/cloud/gkehub/v1/membership.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeHub.V1"; -option go_package = "cloud.google.com/go/gkehub/apiv1/gkehubpb;gkehubpb"; -option java_multiple_files = true; -option java_outer_classname = "ServiceProto"; -option java_package = "com.google.cloud.gkehub.v1"; -option php_namespace = "Google\\Cloud\\GkeHub\\V1"; -option ruby_package = "Google::Cloud::GkeHub::V1"; - -// The GKE Hub service handles the registration of many Kubernetes clusters to -// Google Cloud, and the management of multi-cluster features over those -// clusters. -// -// The GKE Hub service operates on the following resources: -// -// * [Membership][google.cloud.gkehub.v1.Membership] -// * [Feature][google.cloud.gkehub.v1.Feature] -// -// GKE Hub is currently available in the global region and all regions in -// https://cloud.google.com/compute/docs/regions-zones. Feature is only -// available in global region while membership is global region and all the -// regions. -// -// **Membership management may be non-trivial:** it is recommended to use one -// of the Google-provided client libraries or tools where possible when working -// with Membership resources. -service GkeHub { - option (google.api.default_host) = "gkehub.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists Memberships in a given project and location. - rpc ListMemberships(ListMembershipsRequest) - returns (ListMembershipsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/memberships" - }; - option (google.api.method_signature) = "parent"; - } - - // Lists Features in a given project and location. - rpc ListFeatures(ListFeaturesRequest) returns (ListFeaturesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/features" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a Membership. - rpc GetMembership(GetMembershipRequest) returns (Membership) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/memberships/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets details of a single Feature. - rpc GetFeature(GetFeatureRequest) returns (Feature) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/features/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new Membership. - // - // **This is currently only supported for GKE clusters on Google Cloud**. - // To register other clusters, follow the instructions at - // https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster. - rpc CreateMembership(CreateMembershipRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/memberships" - body: "resource" - }; - option (google.api.method_signature) = "parent,resource,membership_id"; - option (google.longrunning.operation_info) = { - response_type: "Membership" - metadata_type: "OperationMetadata" - }; - } - - // Adds a new Feature. - rpc CreateFeature(CreateFeatureRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/features" - body: "resource" - }; - option (google.api.method_signature) = "parent,resource,feature_id"; - option (google.longrunning.operation_info) = { - response_type: "Feature" - metadata_type: "OperationMetadata" - }; - } - - // Removes a Membership. - // - // **This is currently only supported for GKE clusters on Google Cloud**. - // To unregister other clusters, follow the instructions at - // https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. - rpc DeleteMembership(DeleteMembershipRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/memberships/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Removes a Feature. - rpc DeleteFeature(DeleteFeatureRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/features/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Updates an existing Membership. - rpc UpdateMembership(UpdateMembershipRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{name=projects/*/locations/*/memberships/*}" - body: "resource" - }; - option (google.api.method_signature) = "name,resource,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Membership" - metadata_type: "OperationMetadata" - }; - } - - // Updates an existing Feature. - rpc UpdateFeature(UpdateFeatureRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{name=projects/*/locations/*/features/*}" - body: "resource" - }; - option (google.api.method_signature) = "name,resource,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Feature" - metadata_type: "OperationMetadata" - }; - } - - // Generates the manifest for deployment of the GKE connect agent. - // - // **This method is used internally by Google-provided libraries.** - // Most clients should not need to call this method directly. - rpc GenerateConnectManifest(GenerateConnectManifestRequest) - returns (GenerateConnectManifestResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/memberships/*}:generateConnectManifest" - }; - } -} - -// Request message for `GkeHub.ListMemberships` method. -message ListMembershipsRequest { - // Required. The parent (project and location) where the Memberships will be - // listed. Specified in the format `projects/*/locations/*`. - // `projects/*/locations/-` list memberships in all the regions. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkehub.googleapis.com/Membership" - } - ]; - - // Optional. When requesting a 'page' of resources, `page_size` specifies - // number of resources to return. If unspecified or set to 0, all resources - // will be returned. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Token returned by previous call to `ListMemberships` which - // specifies the position in the list from where to continue listing the - // resources. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Lists Memberships that match the filter expression, following the - // syntax outlined in https://google.aip.dev/160. - // - // Examples: - // - // - Name is `bar` in project `foo-proj` and location `global`: - // - // name = "projects/foo-proj/locations/global/membership/bar" - // - // - Memberships that have a label called `foo`: - // - // labels.foo:* - // - // - Memberships that have a label called `foo` whose value is `bar`: - // - // labels.foo = bar - // - // - Memberships in the CREATING state: - // - // state = CREATING - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. One or more fields to compare and use to sort the output. - // See https://google.aip.dev/132#ordering. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for the `GkeHub.ListMemberships` method. -message ListMembershipsResponse { - // The list of matching Memberships. - repeated Membership resources = 1; - - // A token to request the next page of resources from the - // `ListMemberships` method. The value of an empty string means that - // there are no more resources to return. - string next_page_token = 2; - - // List of locations that could not be reached while fetching this list. - repeated string unreachable = 3; -} - -// Request message for `GkeHub.GetMembership` method. -message GetMembershipRequest { - // Required. The Membership resource name in the format - // `projects/*/locations/*/memberships/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkehub.googleapis.com/Membership" - } - ]; -} - -// Request message for the `GkeHub.CreateMembership` method. -message CreateMembershipRequest { - // Required. The parent (project and location) where the Memberships will be - // created. Specified in the format `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkehub.googleapis.com/Membership" - } - ]; - - // Required. Client chosen ID for the membership. `membership_id` must be a - // valid RFC 1123 compliant DNS label: - // - // 1. At most 63 characters in length - // 2. It must consist of lower case alphanumeric characters or `-` - // 3. It must start and end with an alphanumeric character - // - // Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, - // with a maximum length of 63 characters. - string membership_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The membership to create. - Membership resource = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for `GkeHub.DeleteMembership` method. -message DeleteMembershipRequest { - // Required. The Membership resource name in the format - // `projects/*/locations/*/memberships/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkehub.googleapis.com/Membership" - } - ]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to true, any subresource from this Membership will also be - // deleted. Otherwise, the request will only work if the Membership has no - // subresource. - bool force = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for `GkeHub.UpdateMembership` method. -message UpdateMembershipRequest { - // Required. The Membership resource name in the format - // `projects/*/locations/*/memberships/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkehub.googleapis.com/Membership" - } - ]; - - // Required. Mask of fields to update. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Required. Only fields specified in update_mask are updated. - // If you specify a field in the update_mask but don't specify its value here - // that field will be deleted. - // If you are updating a map field, set the value of a key to null or empty - // string to delete the key from the map. It's not possible to update a key's - // value to the empty string. - // If you specify the update_mask to be a special path "*", fully replaces all - // user-modifiable fields to match `resource`. - Membership resource = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for `GkeHub.GenerateConnectManifest` -// method. -// . -message GenerateConnectManifestRequest { - // Required. The Membership resource name the Agent will associate with, in - // the format `projects/*/locations/*/memberships/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkehub.googleapis.com/Membership" - } - ]; - - // Optional. Namespace for GKE Connect agent resources. Defaults to - // `gke-connect`. - // - // The Connect Agent is authorized automatically when run in the default - // namespace. Otherwise, explicit authorization must be granted with an - // additional IAM binding. - string namespace = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. URI of a proxy if connectivity from the agent to - // gkeconnect.googleapis.com requires the use of a proxy. Format must be in - // the form `http(s)://{proxy_address}`, depending on the HTTP/HTTPS protocol - // supported by the proxy. This will direct the connect agent's outbound - // traffic through a HTTP(S) proxy. - bytes proxy = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Connect agent version to use. Defaults to the most current - // version. - string version = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true, generate the resources for upgrade only. Some resources - // generated only for installation (e.g. secrets) will be excluded. - bool is_upgrade = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The registry to fetch the connect agent image from. Defaults to - // gcr.io/gkeconnect. - string registry = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The image pull secret content for the registry, if not public. - bytes image_pull_secret_content = 7 [(google.api.field_behavior) = OPTIONAL]; -} - -// GenerateConnectManifestResponse contains manifest information for -// installing/upgrading a Connect agent. -message GenerateConnectManifestResponse { - // The ordered list of Kubernetes resources that need to be applied to the - // cluster for GKE Connect agent installation/upgrade. - repeated ConnectAgentResource manifest = 1; -} - -// ConnectAgentResource represents a Kubernetes resource manifest for Connect -// Agent deployment. -message ConnectAgentResource { - // Kubernetes type of the resource. - TypeMeta type = 1; - - // YAML manifest of the resource. - string manifest = 2; -} - -// TypeMeta is the type information needed for content unmarshalling of -// Kubernetes resources in the manifest. -message TypeMeta { - // Kind of the resource (e.g. Deployment). - string kind = 1; - - // APIVersion of the resource (e.g. v1). - string api_version = 2; -} - -// Request message for `GkeHub.ListFeatures` method. -message ListFeaturesRequest { - // Required. The parent (project and location) where the Features will be listed. - // Specified in the format `projects/*/locations/*`. - string parent = 1 [ - (google.api.resource_reference) = { - child_type: "gkehub.googleapis.com/Feature" - } - ]; - - // When requesting a 'page' of resources, `page_size` specifies number of - // resources to return. If unspecified or set to 0, all resources will - // be returned. - int32 page_size = 2; - - // Token returned by previous call to `ListFeatures` which - // specifies the position in the list from where to continue listing the - // resources. - string page_token = 3; - - // Lists Features that match the filter expression, following the syntax - // outlined in https://google.aip.dev/160. - // - // Examples: - // - // - Feature with the name "servicemesh" in project "foo-proj": - // - // name = "projects/foo-proj/locations/global/features/servicemesh" - // - // - Features that have a label called `foo`: - // - // labels.foo:* - // - // - Features that have a label called `foo` whose value is `bar`: - // - // labels.foo = bar - string filter = 4; - - // One or more fields to compare and use to sort the output. - // See https://google.aip.dev/132#ordering. - string order_by = 5; -} - -// Response message for the `GkeHub.ListFeatures` method. -message ListFeaturesResponse { - // The list of matching Features - repeated Feature resources = 1; - - // A token to request the next page of resources from the - // `ListFeatures` method. The value of an empty string means - // that there are no more resources to return. - string next_page_token = 2; -} - -// Request message for `GkeHub.GetFeature` method. -message GetFeatureRequest { - // Required. The Feature resource name in the format - // `projects/*/locations/*/features/*` - string name = 1 [ - (google.api.resource_reference) = { - type: "gkehub.googleapis.com/Feature" - } - ]; -} - -// Request message for the `GkeHub.CreateFeature` method. -message CreateFeatureRequest { - // Required. The parent (project and location) where the Feature will be created. - // Specified in the format `projects/*/locations/*`. - string parent = 1 [ - (google.api.resource_reference) = { - child_type: "gkehub.googleapis.com/Feature" - } - ]; - - // The ID of the feature to create. - string feature_id = 2; - - // The Feature resource to create. - Feature resource = 3; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4; -} - -// Request message for `GkeHub.DeleteFeature` method. -message DeleteFeatureRequest { - // Required. The Feature resource name in the format - // `projects/*/locations/*/features/*`. - string name = 1 [ - (google.api.resource_reference) = { - type: "gkehub.googleapis.com/Feature" - } - ]; - - // If set to true, the delete will ignore any outstanding resources for - // this Feature (that is, `FeatureState.has_resources` is set to true). These - // resources will NOT be cleaned up or modified in any way. - bool force = 2; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for `GkeHub.UpdateFeature` method. -message UpdateFeatureRequest { - // Required. The Feature resource name in the format - // `projects/*/locations/*/features/*`. - string name = 1 [ - (google.api.resource_reference) = { - type: "gkehub.googleapis.com/Feature" - } - ]; - - // Mask of fields to update. - google.protobuf.FieldMask update_mask = 2; - - // Only fields specified in update_mask are updated. - // If you specify a field in the update_mask but don't specify its value here - // that field will be deleted. - // If you are updating a map field, set the value of a key to null or empty - // string to delete the key from the map. It's not possible to update a key's - // value to the empty string. - // If you specify the update_mask to be a special path "*", fully replaces all - // user-modifiable fields to match `resource`. - Feature resource = 3; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4; -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_detail = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.create_feature.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.create_feature.js deleted file mode 100644 index d6daf14f31b..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.create_feature.js +++ /dev/null @@ -1,84 +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() { - // [START gkehub_v1_generated_GkeHub_CreateFeature_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 parent (project and location) where the Feature will be created. - * Specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * The ID of the feature to create. - */ - // const featureId = 'abc123' - /** - * The Feature resource to create. - */ - // const resource = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callCreateFeature() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await gkehubClient.createFeature(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateFeature(); - // [END gkehub_v1_generated_GkeHub_CreateFeature_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-gkehub/v1/samples/generated/v1/gke_hub.create_membership.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.create_membership.js deleted file mode 100644 index 62b23a56aa5..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.create_membership.js +++ /dev/null @@ -1,93 +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, membershipId, resource) { - // [START gkehub_v1_generated_GkeHub_CreateMembership_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 parent (project and location) where the Memberships will be - * created. Specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Required. Client chosen ID for the membership. `membership_id` must be a - * valid RFC 1123 compliant DNS label: - * 1. At most 63 characters in length - * 2. It must consist of lower case alphanumeric characters or `-` - * 3. It must start and end with an alphanumeric character - * Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, - * with a maximum length of 63 characters. - */ - // const membershipId = 'abc123' - /** - * Required. The membership to create. - */ - // const resource = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callCreateMembership() { - // Construct request - const request = { - parent, - membershipId, - resource, - }; - - // Run request - const [operation] = await gkehubClient.createMembership(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateMembership(); - // [END gkehub_v1_generated_GkeHub_CreateMembership_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-gkehub/v1/samples/generated/v1/gke_hub.delete_feature.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.delete_feature.js deleted file mode 100644 index 0b47b75b4a1..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.delete_feature.js +++ /dev/null @@ -1,82 +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() { - // [START gkehub_v1_generated_GkeHub_DeleteFeature_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 Feature resource name in the format - * `projects/* /locations/* /features/*`. - */ - // const name = 'abc123' - /** - * If set to true, the delete will ignore any outstanding resources for - * this Feature (that is, `FeatureState.has_resources` is set to true). These - * resources will NOT be cleaned up or modified in any way. - */ - // const force = true - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callDeleteFeature() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await gkehubClient.deleteFeature(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteFeature(); - // [END gkehub_v1_generated_GkeHub_DeleteFeature_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-gkehub/v1/samples/generated/v1/gke_hub.delete_membership.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.delete_membership.js deleted file mode 100644 index a0a28853539..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.delete_membership.js +++ /dev/null @@ -1,83 +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 gkehub_v1_generated_GkeHub_DeleteMembership_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 Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - */ - // const name = 'abc123' - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - /** - * Optional. If set to true, any subresource from this Membership will also be - * deleted. Otherwise, the request will only work if the Membership has no - * subresource. - */ - // const force = true - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callDeleteMembership() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await gkehubClient.deleteMembership(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteMembership(); - // [END gkehub_v1_generated_GkeHub_DeleteMembership_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-gkehub/v1/samples/generated/v1/gke_hub.generate_connect_manifest.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.generate_connect_manifest.js deleted file mode 100644 index aea17b705e6..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.generate_connect_manifest.js +++ /dev/null @@ -1,97 +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 gkehub_v1_generated_GkeHub_GenerateConnectManifest_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 Membership resource name the Agent will associate with, in - * the format `projects/* /locations/* /memberships/*`. - */ - // const name = 'abc123' - /** - * Optional. Namespace for GKE Connect agent resources. Defaults to - * `gke-connect`. - * The Connect Agent is authorized automatically when run in the default - * namespace. Otherwise, explicit authorization must be granted with an - * additional IAM binding. - */ - // const namespace = 'abc123' - /** - * Optional. URI of a proxy if connectivity from the agent to - * gkeconnect.googleapis.com requires the use of a proxy. Format must be in - * the form `http(s)://{proxy_address}`, depending on the HTTP/HTTPS protocol - * supported by the proxy. This will direct the connect agent's outbound - * traffic through a HTTP(S) proxy. - */ - // const proxy = Buffer.from('string') - /** - * Optional. The Connect agent version to use. Defaults to the most current - * version. - */ - // const version = 'abc123' - /** - * Optional. If true, generate the resources for upgrade only. Some resources - * generated only for installation (e.g. secrets) will be excluded. - */ - // const isUpgrade = true - /** - * Optional. The registry to fetch the connect agent image from. Defaults to - * gcr.io/gkeconnect. - */ - // const registry = 'abc123' - /** - * Optional. The image pull secret content for the registry, if not public. - */ - // const imagePullSecretContent = Buffer.from('string') - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callGenerateConnectManifest() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkehubClient.generateConnectManifest(request); - console.log(response); - } - - callGenerateConnectManifest(); - // [END gkehub_v1_generated_GkeHub_GenerateConnectManifest_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-gkehub/v1/samples/generated/v1/gke_hub.get_feature.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.get_feature.js deleted file mode 100644 index c9be528d16a..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.get_feature.js +++ /dev/null @@ -1,61 +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() { - // [START gkehub_v1_generated_GkeHub_GetFeature_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 Feature resource name in the format - * `projects/* /locations/* /features/*` - */ - // const name = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callGetFeature() { - // Construct request - const request = { - }; - - // Run request - const response = await gkehubClient.getFeature(request); - console.log(response); - } - - callGetFeature(); - // [END gkehub_v1_generated_GkeHub_GetFeature_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-gkehub/v1/samples/generated/v1/gke_hub.get_membership.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.get_membership.js deleted file mode 100644 index 106b54a33d5..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.get_membership.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 gkehub_v1_generated_GkeHub_GetMembership_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 Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - */ - // const name = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callGetMembership() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkehubClient.getMembership(request); - console.log(response); - } - - callGetMembership(); - // [END gkehub_v1_generated_GkeHub_GetMembership_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-gkehub/v1/samples/generated/v1/gke_hub.list_features.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.list_features.js deleted file mode 100644 index 8dae5e2ffeb..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.list_features.js +++ /dev/null @@ -1,92 +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() { - // [START gkehub_v1_generated_GkeHub_ListFeatures_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 parent (project and location) where the Features will be listed. - * Specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * When requesting a 'page' of resources, `page_size` specifies number of - * resources to return. If unspecified or set to 0, all resources will - * be returned. - */ - // const pageSize = 1234 - /** - * Token returned by previous call to `ListFeatures` which - * specifies the position in the list from where to continue listing the - * resources. - */ - // const pageToken = 'abc123' - /** - * Lists Features that match the filter expression, following the syntax - * outlined in https://google.aip.dev/160. - * Examples: - * - Feature with the name "servicemesh" in project "foo-proj": - * name = "projects/foo-proj/locations/global/features/servicemesh" - * - Features that have a label called `foo`: - * labels.foo:* - * - Features that have a label called `foo` whose value is `bar`: - * labels.foo = bar - */ - // const filter = 'abc123' - /** - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - */ - // const orderBy = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callListFeatures() { - // Construct request - const request = { - }; - - // Run request - const iterable = await gkehubClient.listFeaturesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFeatures(); - // [END gkehub_v1_generated_GkeHub_ListFeatures_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-gkehub/v1/samples/generated/v1/gke_hub.list_memberships.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.list_memberships.js deleted file mode 100644 index cde7e9d0e3f..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.list_memberships.js +++ /dev/null @@ -1,96 +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 gkehub_v1_generated_GkeHub_ListMemberships_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 parent (project and location) where the Memberships will be - * listed. Specified in the format `projects/* /locations/*`. - * `projects/* /locations/-` list memberships in all the regions. - */ - // const parent = 'abc123' - /** - * Optional. When requesting a 'page' of resources, `page_size` specifies - * number of resources to return. If unspecified or set to 0, all resources - * will be returned. - */ - // const pageSize = 1234 - /** - * Optional. Token returned by previous call to `ListMemberships` which - * specifies the position in the list from where to continue listing the - * resources. - */ - // const pageToken = 'abc123' - /** - * Optional. Lists Memberships that match the filter expression, following the - * syntax outlined in https://google.aip.dev/160. - * Examples: - * - Name is `bar` in project `foo-proj` and location `global`: - * name = "projects/foo-proj/locations/global/membership/bar" - * - Memberships that have a label called `foo`: - * labels.foo:* - * - Memberships that have a label called `foo` whose value is `bar`: - * labels.foo = bar - * - Memberships in the CREATING state: - * state = CREATING - */ - // const filter = 'abc123' - /** - * Optional. One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - */ - // const orderBy = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callListMemberships() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await gkehubClient.listMembershipsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMemberships(); - // [END gkehub_v1_generated_GkeHub_ListMemberships_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-gkehub/v1/samples/generated/v1/gke_hub.update_feature.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.update_feature.js deleted file mode 100644 index dc853f8d77b..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.update_feature.js +++ /dev/null @@ -1,91 +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() { - // [START gkehub_v1_generated_GkeHub_UpdateFeature_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 Feature resource name in the format - * `projects/* /locations/* /features/*`. - */ - // const name = 'abc123' - /** - * Mask of fields to update. - */ - // const updateMask = {} - /** - * Only fields specified in update_mask are updated. - * If you specify a field in the update_mask but don't specify its value here - * that field will be deleted. - * If you are updating a map field, set the value of a key to null or empty - * string to delete the key from the map. It's not possible to update a key's - * value to the empty string. - * If you specify the update_mask to be a special path "*", fully replaces all - * user-modifiable fields to match `resource`. - */ - // const resource = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callUpdateFeature() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await gkehubClient.updateFeature(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateFeature(); - // [END gkehub_v1_generated_GkeHub_UpdateFeature_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-gkehub/v1/samples/generated/v1/gke_hub.update_membership.js b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.update_membership.js deleted file mode 100644 index ca340c18ed7..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/gke_hub.update_membership.js +++ /dev/null @@ -1,94 +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, updateMask, resource) { - // [START gkehub_v1_generated_GkeHub_UpdateMembership_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 Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - */ - // const name = 'abc123' - /** - * Required. Mask of fields to update. - */ - // const updateMask = {} - /** - * Required. Only fields specified in update_mask are updated. - * If you specify a field in the update_mask but don't specify its value here - * that field will be deleted. - * If you are updating a map field, set the value of a key to null or empty - * string to delete the key from the map. It's not possible to update a key's - * value to the empty string. - * If you specify the update_mask to be a special path "*", fully replaces all - * user-modifiable fields to match `resource`. - */ - // const resource = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callUpdateMembership() { - // Construct request - const request = { - name, - updateMask, - resource, - }; - - // Run request - const [operation] = await gkehubClient.updateMembership(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateMembership(); - // [END gkehub_v1_generated_GkeHub_UpdateMembership_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-gkehub/v1/samples/generated/v1/snippet_metadata_google.cloud.gkehub.v1.json b/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/snippet_metadata_google.cloud.gkehub.v1.json deleted file mode 100644 index 70bea948783..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/samples/generated/v1/snippet_metadata_google.cloud.gkehub.v1.json +++ /dev/null @@ -1,575 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-gkehub", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.gkehub.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "gkehub_v1_generated_GkeHub_ListMemberships_async", - "title": "GkeHub listMemberships Sample", - "origin": "API_DEFINITION", - "description": " Lists Memberships in a given project and location.", - "canonical": true, - "file": "gke_hub.list_memberships.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 88, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMemberships", - "fullName": "google.cloud.gkehub.v1.GkeHub.ListMemberships", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkehub.v1.ListMembershipsResponse", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1.GkeHubClient" - }, - "method": { - "shortName": "ListMemberships", - "fullName": "google.cloud.gkehub.v1.GkeHub.ListMemberships", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1_generated_GkeHub_ListFeatures_async", - "title": "GkeHub listFeatures Sample", - "origin": "API_DEFINITION", - "description": " Lists Features in a given project and location.", - "canonical": true, - "file": "gke_hub.list_features.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFeatures", - "fullName": "google.cloud.gkehub.v1.GkeHub.ListFeatures", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkehub.v1.ListFeaturesResponse", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1.GkeHubClient" - }, - "method": { - "shortName": "ListFeatures", - "fullName": "google.cloud.gkehub.v1.GkeHub.ListFeatures", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1_generated_GkeHub_GetMembership_async", - "title": "GkeHub getMembership Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a Membership.", - "canonical": true, - "file": "gke_hub.get_membership.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetMembership", - "fullName": "google.cloud.gkehub.v1.GkeHub.GetMembership", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkehub.v1.Membership", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1.GkeHubClient" - }, - "method": { - "shortName": "GetMembership", - "fullName": "google.cloud.gkehub.v1.GkeHub.GetMembership", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1_generated_GkeHub_GetFeature_async", - "title": "GkeHub getFeature Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single Feature.", - "canonical": true, - "file": "gke_hub.get_feature.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFeature", - "fullName": "google.cloud.gkehub.v1.GkeHub.GetFeature", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkehub.v1.Feature", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1.GkeHubClient" - }, - "method": { - "shortName": "GetFeature", - "fullName": "google.cloud.gkehub.v1.GkeHub.GetFeature", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1_generated_GkeHub_CreateMembership_async", - "title": "GkeHub createMembership Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Membership. **This is currently only supported for GKE clusters on Google Cloud**. To register other clusters, follow the instructions at https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster.", - "canonical": true, - "file": "gke_hub.create_membership.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMembership", - "fullName": "google.cloud.gkehub.v1.GkeHub.CreateMembership", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "membership_id", - "type": "TYPE_STRING" - }, - { - "name": "resource", - "type": ".google.cloud.gkehub.v1.Membership" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1.GkeHubClient" - }, - "method": { - "shortName": "CreateMembership", - "fullName": "google.cloud.gkehub.v1.GkeHub.CreateMembership", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1_generated_GkeHub_CreateFeature_async", - "title": "GkeHub createFeature Sample", - "origin": "API_DEFINITION", - "description": " Adds a new Feature.", - "canonical": true, - "file": "gke_hub.create_feature.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFeature", - "fullName": "google.cloud.gkehub.v1.GkeHub.CreateFeature", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "feature_id", - "type": "TYPE_STRING" - }, - { - "name": "resource", - "type": ".google.cloud.gkehub.v1.Feature" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1.GkeHubClient" - }, - "method": { - "shortName": "CreateFeature", - "fullName": "google.cloud.gkehub.v1.GkeHub.CreateFeature", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1_generated_GkeHub_DeleteMembership_async", - "title": "GkeHub deleteMembership Sample", - "origin": "API_DEFINITION", - "description": " Removes a Membership. **This is currently only supported for GKE clusters on Google Cloud**. To unregister other clusters, follow the instructions at https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster.", - "canonical": true, - "file": "gke_hub.delete_membership.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteMembership", - "fullName": "google.cloud.gkehub.v1.GkeHub.DeleteMembership", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1.GkeHubClient" - }, - "method": { - "shortName": "DeleteMembership", - "fullName": "google.cloud.gkehub.v1.GkeHub.DeleteMembership", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1_generated_GkeHub_DeleteFeature_async", - "title": "GkeHub deleteFeature Sample", - "origin": "API_DEFINITION", - "description": " Removes a Feature.", - "canonical": true, - "file": "gke_hub.delete_feature.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteFeature", - "fullName": "google.cloud.gkehub.v1.GkeHub.DeleteFeature", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1.GkeHubClient" - }, - "method": { - "shortName": "DeleteFeature", - "fullName": "google.cloud.gkehub.v1.GkeHub.DeleteFeature", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1_generated_GkeHub_UpdateMembership_async", - "title": "GkeHub updateMembership Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing Membership.", - "canonical": true, - "file": "gke_hub.update_membership.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 86, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateMembership", - "fullName": "google.cloud.gkehub.v1.GkeHub.UpdateMembership", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "resource", - "type": ".google.cloud.gkehub.v1.Membership" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1.GkeHubClient" - }, - "method": { - "shortName": "UpdateMembership", - "fullName": "google.cloud.gkehub.v1.GkeHub.UpdateMembership", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1_generated_GkeHub_UpdateFeature_async", - "title": "GkeHub updateFeature Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing Feature.", - "canonical": true, - "file": "gke_hub.update_feature.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFeature", - "fullName": "google.cloud.gkehub.v1.GkeHub.UpdateFeature", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "resource", - "type": ".google.cloud.gkehub.v1.Feature" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1.GkeHubClient" - }, - "method": { - "shortName": "UpdateFeature", - "fullName": "google.cloud.gkehub.v1.GkeHub.UpdateFeature", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1_generated_GkeHub_GenerateConnectManifest_async", - "title": "GkeHub generateConnectManifest Sample", - "origin": "API_DEFINITION", - "description": " Generates the manifest for deployment of the GKE connect agent. **This method is used internally by Google-provided libraries.** Most clients should not need to call this method directly.", - "canonical": true, - "file": "gke_hub.generate_connect_manifest.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 89, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateConnectManifest", - "fullName": "google.cloud.gkehub.v1.GkeHub.GenerateConnectManifest", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "namespace", - "type": "TYPE_STRING" - }, - { - "name": "proxy", - "type": "TYPE_BYTES" - }, - { - "name": "version", - "type": "TYPE_STRING" - }, - { - "name": "is_upgrade", - "type": "TYPE_BOOL" - }, - { - "name": "registry", - "type": "TYPE_STRING" - }, - { - "name": "image_pull_secret_content", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.gkehub.v1.GenerateConnectManifestResponse", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1.GkeHubClient" - }, - "method": { - "shortName": "GenerateConnectManifest", - "fullName": "google.cloud.gkehub.v1.GkeHub.GenerateConnectManifest", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1.GkeHub" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1/src/index.ts deleted file mode 100644 index 38d16b6b8ee..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/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 v1 from './v1'; -const GkeHubClient = v1.GkeHubClient; -type GkeHubClient = v1.GkeHubClient; -export {v1, GkeHubClient}; -export default {v1, GkeHubClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gapic_metadata.json deleted file mode 100644 index d63689a48a5..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,141 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.gkehub.v1", - "libraryPackage": "@google-cloud/gke-hub", - "services": { - "GkeHub": { - "clients": { - "grpc": { - "libraryClient": "GkeHubClient", - "rpcs": { - "GetMembership": { - "methods": [ - "getMembership" - ] - }, - "GetFeature": { - "methods": [ - "getFeature" - ] - }, - "GenerateConnectManifest": { - "methods": [ - "generateConnectManifest" - ] - }, - "CreateMembership": { - "methods": [ - "createMembership" - ] - }, - "CreateFeature": { - "methods": [ - "createFeature" - ] - }, - "DeleteMembership": { - "methods": [ - "deleteMembership" - ] - }, - "DeleteFeature": { - "methods": [ - "deleteFeature" - ] - }, - "UpdateMembership": { - "methods": [ - "updateMembership" - ] - }, - "UpdateFeature": { - "methods": [ - "updateFeature" - ] - }, - "ListMemberships": { - "methods": [ - "listMemberships", - "listMembershipsStream", - "listMembershipsAsync" - ] - }, - "ListFeatures": { - "methods": [ - "listFeatures", - "listFeaturesStream", - "listFeaturesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "GkeHubClient", - "rpcs": { - "GetMembership": { - "methods": [ - "getMembership" - ] - }, - "GetFeature": { - "methods": [ - "getFeature" - ] - }, - "GenerateConnectManifest": { - "methods": [ - "generateConnectManifest" - ] - }, - "CreateMembership": { - "methods": [ - "createMembership" - ] - }, - "CreateFeature": { - "methods": [ - "createFeature" - ] - }, - "DeleteMembership": { - "methods": [ - "deleteMembership" - ] - }, - "DeleteFeature": { - "methods": [ - "deleteFeature" - ] - }, - "UpdateMembership": { - "methods": [ - "updateMembership" - ] - }, - "UpdateFeature": { - "methods": [ - "updateFeature" - ] - }, - "ListMemberships": { - "methods": [ - "listMemberships", - "listMembershipsStream", - "listMembershipsAsync" - ] - }, - "ListFeatures": { - "methods": [ - "listFeatures", - "listFeaturesStream", - "listFeaturesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_client.ts b/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_client.ts deleted file mode 100644 index 47d2608aa01..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_client.ts +++ /dev/null @@ -1,2006 +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, GrpcClientOptions, LROperation, 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/gke_hub_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './gke_hub_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The GKE Hub service handles the registration of many Kubernetes clusters to - * Google Cloud, and the management of multi-cluster features over those - * clusters. - * - * The GKE Hub service operates on the following resources: - * - * * {@link protos.google.cloud.gkehub.v1.Membership|Membership} - * * {@link protos.google.cloud.gkehub.v1.Feature|Feature} - * - * GKE Hub is currently available in the global region and all regions in - * https://cloud.google.com/compute/docs/regions-zones. Feature is only - * available in global region while membership is global region and all the - * regions. - * - * **Membership management may be non-trivial:** it is recommended to use one - * of the Google-provided client libraries or tools where possible when working - * with Membership resources. - * @class - * @memberof v1 - */ -export class GkeHubClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - gkeHubStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of GkeHubClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 GkeHubClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof GkeHubClient; - 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 { - 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 = { - featurePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/features/{feature}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - membershipPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/memberships/{membership}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - }; - - // 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 = { - listMemberships: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources'), - listFeatures: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/memberships/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/features/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/memberships/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/features/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/memberships/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/features/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createMembershipResponse = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1.Membership') as gax.protobuf.Type; - const createMembershipMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1.OperationMetadata') as gax.protobuf.Type; - const createFeatureResponse = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1.Feature') as gax.protobuf.Type; - const createFeatureMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1.OperationMetadata') as gax.protobuf.Type; - const deleteMembershipResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteMembershipMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1.OperationMetadata') as gax.protobuf.Type; - const deleteFeatureResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteFeatureMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1.OperationMetadata') as gax.protobuf.Type; - const updateMembershipResponse = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1.Membership') as gax.protobuf.Type; - const updateMembershipMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1.OperationMetadata') as gax.protobuf.Type; - const updateFeatureResponse = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1.Feature') as gax.protobuf.Type; - const updateFeatureMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createMembership: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createMembershipResponse.decode.bind(createMembershipResponse), - createMembershipMetadata.decode.bind(createMembershipMetadata)), - createFeature: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createFeatureResponse.decode.bind(createFeatureResponse), - createFeatureMetadata.decode.bind(createFeatureMetadata)), - deleteMembership: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteMembershipResponse.decode.bind(deleteMembershipResponse), - deleteMembershipMetadata.decode.bind(deleteMembershipMetadata)), - deleteFeature: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteFeatureResponse.decode.bind(deleteFeatureResponse), - deleteFeatureMetadata.decode.bind(deleteFeatureMetadata)), - updateMembership: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateMembershipResponse.decode.bind(updateMembershipResponse), - updateMembershipMetadata.decode.bind(updateMembershipMetadata)), - updateFeature: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateFeatureResponse.decode.bind(updateFeatureResponse), - updateFeatureMetadata.decode.bind(updateFeatureMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.gkehub.v1.GkeHub', 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.gkeHubStub) { - return this.gkeHubStub; - } - - // Put together the "service stub" for - // google.cloud.gkehub.v1.GkeHub. - this.gkeHubStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.gkehub.v1.GkeHub') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.gkehub.v1.GkeHub, - 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 gkeHubStubMethods = - ['listMemberships', 'listFeatures', 'getMembership', 'getFeature', 'createMembership', 'createFeature', 'deleteMembership', 'deleteFeature', 'updateMembership', 'updateFeature', 'generateConnectManifest']; - for (const methodName of gkeHubStubMethods) { - const callPromise = this.gkeHubStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.gkeHubStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'gkehub.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 'gkehub.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 -- - // ------------------- -/** - * Gets the details of a Membership. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1.Membership|Membership}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/gke_hub.get_membership.js - * region_tag:gkehub_v1_generated_GkeHub_GetMembership_async - */ - getMembership( - request?: protos.google.cloud.gkehub.v1.IGetMembershipRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1.IMembership, - protos.google.cloud.gkehub.v1.IGetMembershipRequest|undefined, {}|undefined - ]>; - getMembership( - request: protos.google.cloud.gkehub.v1.IGetMembershipRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkehub.v1.IMembership, - protos.google.cloud.gkehub.v1.IGetMembershipRequest|null|undefined, - {}|null|undefined>): void; - getMembership( - request: protos.google.cloud.gkehub.v1.IGetMembershipRequest, - callback: Callback< - protos.google.cloud.gkehub.v1.IMembership, - protos.google.cloud.gkehub.v1.IGetMembershipRequest|null|undefined, - {}|null|undefined>): void; - getMembership( - request?: protos.google.cloud.gkehub.v1.IGetMembershipRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkehub.v1.IMembership, - protos.google.cloud.gkehub.v1.IGetMembershipRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkehub.v1.IMembership, - protos.google.cloud.gkehub.v1.IGetMembershipRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkehub.v1.IMembership, - protos.google.cloud.gkehub.v1.IGetMembershipRequest|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.getMembership(request, options, callback); - } -/** - * Gets details of a single Feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Feature resource name in the format - * `projects/* /locations/* /features/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1.Feature|Feature}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/gke_hub.get_feature.js - * region_tag:gkehub_v1_generated_GkeHub_GetFeature_async - */ - getFeature( - request?: protos.google.cloud.gkehub.v1.IGetFeatureRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1.IFeature, - protos.google.cloud.gkehub.v1.IGetFeatureRequest|undefined, {}|undefined - ]>; - getFeature( - request: protos.google.cloud.gkehub.v1.IGetFeatureRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkehub.v1.IFeature, - protos.google.cloud.gkehub.v1.IGetFeatureRequest|null|undefined, - {}|null|undefined>): void; - getFeature( - request: protos.google.cloud.gkehub.v1.IGetFeatureRequest, - callback: Callback< - protos.google.cloud.gkehub.v1.IFeature, - protos.google.cloud.gkehub.v1.IGetFeatureRequest|null|undefined, - {}|null|undefined>): void; - getFeature( - request?: protos.google.cloud.gkehub.v1.IGetFeatureRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkehub.v1.IFeature, - protos.google.cloud.gkehub.v1.IGetFeatureRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkehub.v1.IFeature, - protos.google.cloud.gkehub.v1.IGetFeatureRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkehub.v1.IFeature, - protos.google.cloud.gkehub.v1.IGetFeatureRequest|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.getFeature(request, options, callback); - } -/** - * Generates the manifest for deployment of the GKE connect agent. - * - * **This method is used internally by Google-provided libraries.** - * Most clients should not need to call this method directly. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Membership resource name the Agent will associate with, in - * the format `projects/* /locations/* /memberships/*`. - * @param {string} [request.namespace] - * Optional. Namespace for GKE Connect agent resources. Defaults to - * `gke-connect`. - * - * The Connect Agent is authorized automatically when run in the default - * namespace. Otherwise, explicit authorization must be granted with an - * additional IAM binding. - * @param {Buffer} [request.proxy] - * Optional. URI of a proxy if connectivity from the agent to - * gkeconnect.googleapis.com requires the use of a proxy. Format must be in - * the form `http(s)://{proxy_address}`, depending on the HTTP/HTTPS protocol - * supported by the proxy. This will direct the connect agent's outbound - * traffic through a HTTP(S) proxy. - * @param {string} [request.version] - * Optional. The Connect agent version to use. Defaults to the most current - * version. - * @param {boolean} [request.isUpgrade] - * Optional. If true, generate the resources for upgrade only. Some resources - * generated only for installation (e.g. secrets) will be excluded. - * @param {string} [request.registry] - * Optional. The registry to fetch the connect agent image from. Defaults to - * gcr.io/gkeconnect. - * @param {Buffer} [request.imagePullSecretContent] - * Optional. The image pull secret content for the registry, if not public. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1.GenerateConnectManifestResponse|GenerateConnectManifestResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/gke_hub.generate_connect_manifest.js - * region_tag:gkehub_v1_generated_GkeHub_GenerateConnectManifest_async - */ - generateConnectManifest( - request?: protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest|undefined, {}|undefined - ]>; - generateConnectManifest( - request: protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkehub.v1.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest|null|undefined, - {}|null|undefined>): void; - generateConnectManifest( - request: protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest, - callback: Callback< - protos.google.cloud.gkehub.v1.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest|null|undefined, - {}|null|undefined>): void; - generateConnectManifest( - request?: protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkehub.v1.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkehub.v1.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkehub.v1.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1.IGenerateConnectManifestRequest|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.generateConnectManifest(request, options, callback); - } - -/** - * Creates a new Membership. - * - * **This is currently only supported for GKE clusters on Google Cloud**. - * To register other clusters, follow the instructions at - * https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) where the Memberships will be - * created. Specified in the format `projects/* /locations/*`. - * @param {string} request.membershipId - * Required. Client chosen ID for the membership. `membership_id` must be a - * valid RFC 1123 compliant DNS label: - * - * 1. At most 63 characters in length - * 2. It must consist of lower case alphanumeric characters or `-` - * 3. It must start and end with an alphanumeric character - * - * Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, - * with a maximum length of 63 characters. - * @param {google.cloud.gkehub.v1.Membership} request.resource - * Required. The membership to create. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/gke_hub.create_membership.js - * region_tag:gkehub_v1_generated_GkeHub_CreateMembership_async - */ - createMembership( - request?: protos.google.cloud.gkehub.v1.ICreateMembershipRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createMembership( - request: protos.google.cloud.gkehub.v1.ICreateMembershipRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMembership( - request: protos.google.cloud.gkehub.v1.ICreateMembershipRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMembership( - request?: protos.google.cloud.gkehub.v1.ICreateMembershipRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createMembership(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createMembership()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/gke_hub.create_membership.js - * region_tag:gkehub_v1_generated_GkeHub_CreateMembership_async - */ - async checkCreateMembershipProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMembership, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Adds a new Feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) where the Feature will be created. - * Specified in the format `projects/* /locations/*`. - * @param {string} request.featureId - * The ID of the feature to create. - * @param {google.cloud.gkehub.v1.Feature} request.resource - * The Feature resource to create. - * @param {string} request.requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/gke_hub.create_feature.js - * region_tag:gkehub_v1_generated_GkeHub_CreateFeature_async - */ - createFeature( - request?: protos.google.cloud.gkehub.v1.ICreateFeatureRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createFeature( - request: protos.google.cloud.gkehub.v1.ICreateFeatureRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFeature( - request: protos.google.cloud.gkehub.v1.ICreateFeatureRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFeature( - request?: protos.google.cloud.gkehub.v1.ICreateFeatureRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFeature(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createFeature()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/gke_hub.create_feature.js - * region_tag:gkehub_v1_generated_GkeHub_CreateFeature_async - */ - async checkCreateFeatureProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFeature, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Removes a Membership. - * - * **This is currently only supported for GKE clusters on Google Cloud**. - * To unregister other clusters, follow the instructions at - * https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.force] - * Optional. If set to true, any subresource from this Membership will also be - * deleted. Otherwise, the request will only work if the Membership has no - * subresource. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/gke_hub.delete_membership.js - * region_tag:gkehub_v1_generated_GkeHub_DeleteMembership_async - */ - deleteMembership( - request?: protos.google.cloud.gkehub.v1.IDeleteMembershipRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteMembership( - request: protos.google.cloud.gkehub.v1.IDeleteMembershipRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteMembership( - request: protos.google.cloud.gkehub.v1.IDeleteMembershipRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteMembership( - request?: protos.google.cloud.gkehub.v1.IDeleteMembershipRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteMembership(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteMembership()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/gke_hub.delete_membership.js - * region_tag:gkehub_v1_generated_GkeHub_DeleteMembership_async - */ - async checkDeleteMembershipProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteMembership, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Removes a Feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Feature resource name in the format - * `projects/* /locations/* /features/*`. - * @param {boolean} request.force - * If set to true, the delete will ignore any outstanding resources for - * this Feature (that is, `FeatureState.has_resources` is set to true). These - * resources will NOT be cleaned up or modified in any way. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/gke_hub.delete_feature.js - * region_tag:gkehub_v1_generated_GkeHub_DeleteFeature_async - */ - deleteFeature( - request?: protos.google.cloud.gkehub.v1.IDeleteFeatureRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteFeature( - request: protos.google.cloud.gkehub.v1.IDeleteFeatureRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFeature( - request: protos.google.cloud.gkehub.v1.IDeleteFeatureRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFeature( - request?: protos.google.cloud.gkehub.v1.IDeleteFeatureRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteFeature(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteFeature()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/gke_hub.delete_feature.js - * region_tag:gkehub_v1_generated_GkeHub_DeleteFeature_async - */ - async checkDeleteFeatureProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFeature, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an existing Membership. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. - * @param {google.cloud.gkehub.v1.Membership} request.resource - * Required. Only fields specified in update_mask are updated. - * If you specify a field in the update_mask but don't specify its value here - * that field will be deleted. - * If you are updating a map field, set the value of a key to null or empty - * string to delete the key from the map. It's not possible to update a key's - * value to the empty string. - * If you specify the update_mask to be a special path "*", fully replaces all - * user-modifiable fields to match `resource`. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/gke_hub.update_membership.js - * region_tag:gkehub_v1_generated_GkeHub_UpdateMembership_async - */ - updateMembership( - request?: protos.google.cloud.gkehub.v1.IUpdateMembershipRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateMembership( - request: protos.google.cloud.gkehub.v1.IUpdateMembershipRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMembership( - request: protos.google.cloud.gkehub.v1.IUpdateMembershipRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMembership( - request?: protos.google.cloud.gkehub.v1.IUpdateMembershipRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateMembership(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateMembership()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/gke_hub.update_membership.js - * region_tag:gkehub_v1_generated_GkeHub_UpdateMembership_async - */ - async checkUpdateMembershipProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMembership, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an existing Feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Feature resource name in the format - * `projects/* /locations/* /features/*`. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask of fields to update. - * @param {google.cloud.gkehub.v1.Feature} request.resource - * Only fields specified in update_mask are updated. - * If you specify a field in the update_mask but don't specify its value here - * that field will be deleted. - * If you are updating a map field, set the value of a key to null or empty - * string to delete the key from the map. It's not possible to update a key's - * value to the empty string. - * If you specify the update_mask to be a special path "*", fully replaces all - * user-modifiable fields to match `resource`. - * @param {string} request.requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/gke_hub.update_feature.js - * region_tag:gkehub_v1_generated_GkeHub_UpdateFeature_async - */ - updateFeature( - request?: protos.google.cloud.gkehub.v1.IUpdateFeatureRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateFeature( - request: protos.google.cloud.gkehub.v1.IUpdateFeatureRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFeature( - request: protos.google.cloud.gkehub.v1.IUpdateFeatureRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFeature( - request?: protos.google.cloud.gkehub.v1.IUpdateFeatureRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFeature(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateFeature()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/gke_hub.update_feature.js - * region_tag:gkehub_v1_generated_GkeHub_UpdateFeature_async - */ - async checkUpdateFeatureProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFeature, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Memberships in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) where the Memberships will be - * listed. Specified in the format `projects/* /locations/*`. - * `projects/* /locations/-` list memberships in all the regions. - * @param {number} [request.pageSize] - * Optional. When requesting a 'page' of resources, `page_size` specifies - * number of resources to return. If unspecified or set to 0, all resources - * will be returned. - * @param {string} [request.pageToken] - * Optional. Token returned by previous call to `ListMemberships` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} [request.filter] - * Optional. Lists Memberships that match the filter expression, following the - * syntax outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Name is `bar` in project `foo-proj` and location `global`: - * - * name = "projects/foo-proj/locations/global/membership/bar" - * - * - Memberships that have a label called `foo`: - * - * labels.foo:* - * - * - Memberships that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * - * - Memberships in the CREATING state: - * - * state = CREATING - * @param {string} [request.orderBy] - * Optional. One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1.Membership|Membership}. - * 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 `listMembershipsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMemberships( - request?: protos.google.cloud.gkehub.v1.IListMembershipsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1.IMembership[], - protos.google.cloud.gkehub.v1.IListMembershipsRequest|null, - protos.google.cloud.gkehub.v1.IListMembershipsResponse - ]>; - listMemberships( - request: protos.google.cloud.gkehub.v1.IListMembershipsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkehub.v1.IListMembershipsRequest, - protos.google.cloud.gkehub.v1.IListMembershipsResponse|null|undefined, - protos.google.cloud.gkehub.v1.IMembership>): void; - listMemberships( - request: protos.google.cloud.gkehub.v1.IListMembershipsRequest, - callback: PaginationCallback< - protos.google.cloud.gkehub.v1.IListMembershipsRequest, - protos.google.cloud.gkehub.v1.IListMembershipsResponse|null|undefined, - protos.google.cloud.gkehub.v1.IMembership>): void; - listMemberships( - request?: protos.google.cloud.gkehub.v1.IListMembershipsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkehub.v1.IListMembershipsRequest, - protos.google.cloud.gkehub.v1.IListMembershipsResponse|null|undefined, - protos.google.cloud.gkehub.v1.IMembership>, - callback?: PaginationCallback< - protos.google.cloud.gkehub.v1.IListMembershipsRequest, - protos.google.cloud.gkehub.v1.IListMembershipsResponse|null|undefined, - protos.google.cloud.gkehub.v1.IMembership>): - Promise<[ - protos.google.cloud.gkehub.v1.IMembership[], - protos.google.cloud.gkehub.v1.IListMembershipsRequest|null, - protos.google.cloud.gkehub.v1.IListMembershipsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listMemberships(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) where the Memberships will be - * listed. Specified in the format `projects/* /locations/*`. - * `projects/* /locations/-` list memberships in all the regions. - * @param {number} [request.pageSize] - * Optional. When requesting a 'page' of resources, `page_size` specifies - * number of resources to return. If unspecified or set to 0, all resources - * will be returned. - * @param {string} [request.pageToken] - * Optional. Token returned by previous call to `ListMemberships` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} [request.filter] - * Optional. Lists Memberships that match the filter expression, following the - * syntax outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Name is `bar` in project `foo-proj` and location `global`: - * - * name = "projects/foo-proj/locations/global/membership/bar" - * - * - Memberships that have a label called `foo`: - * - * labels.foo:* - * - * - Memberships that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * - * - Memberships in the CREATING state: - * - * state = CREATING - * @param {string} [request.orderBy] - * Optional. One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 protos.google.cloud.gkehub.v1.Membership|Membership} 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 `listMembershipsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMembershipsStream( - request?: protos.google.cloud.gkehub.v1.IListMembershipsRequest, - 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['listMemberships']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMemberships.createStream( - this.innerApiCalls.listMemberships as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMemberships`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) where the Memberships will be - * listed. Specified in the format `projects/* /locations/*`. - * `projects/* /locations/-` list memberships in all the regions. - * @param {number} [request.pageSize] - * Optional. When requesting a 'page' of resources, `page_size` specifies - * number of resources to return. If unspecified or set to 0, all resources - * will be returned. - * @param {string} [request.pageToken] - * Optional. Token returned by previous call to `ListMemberships` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} [request.filter] - * Optional. Lists Memberships that match the filter expression, following the - * syntax outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Name is `bar` in project `foo-proj` and location `global`: - * - * name = "projects/foo-proj/locations/global/membership/bar" - * - * - Memberships that have a label called `foo`: - * - * labels.foo:* - * - * - Memberships that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * - * - Memberships in the CREATING state: - * - * state = CREATING - * @param {string} [request.orderBy] - * Optional. One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkehub.v1.Membership|Membership}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/gke_hub.list_memberships.js - * region_tag:gkehub_v1_generated_GkeHub_ListMemberships_async - */ - listMembershipsAsync( - request?: protos.google.cloud.gkehub.v1.IListMembershipsRequest, - 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['listMemberships']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMemberships.asyncIterate( - this.innerApiCalls['listMemberships'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists Features in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) where the Features will be listed. - * Specified in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * When requesting a 'page' of resources, `page_size` specifies number of - * resources to return. If unspecified or set to 0, all resources will - * be returned. - * @param {string} request.pageToken - * Token returned by previous call to `ListFeatures` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} request.filter - * Lists Features that match the filter expression, following the syntax - * outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Feature with the name "servicemesh" in project "foo-proj": - * - * name = "projects/foo-proj/locations/global/features/servicemesh" - * - * - Features that have a label called `foo`: - * - * labels.foo:* - * - * - Features that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * @param {string} request.orderBy - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1.Feature|Feature}. - * 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 `listFeaturesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFeatures( - request?: protos.google.cloud.gkehub.v1.IListFeaturesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1.IFeature[], - protos.google.cloud.gkehub.v1.IListFeaturesRequest|null, - protos.google.cloud.gkehub.v1.IListFeaturesResponse - ]>; - listFeatures( - request: protos.google.cloud.gkehub.v1.IListFeaturesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkehub.v1.IListFeaturesRequest, - protos.google.cloud.gkehub.v1.IListFeaturesResponse|null|undefined, - protos.google.cloud.gkehub.v1.IFeature>): void; - listFeatures( - request: protos.google.cloud.gkehub.v1.IListFeaturesRequest, - callback: PaginationCallback< - protos.google.cloud.gkehub.v1.IListFeaturesRequest, - protos.google.cloud.gkehub.v1.IListFeaturesResponse|null|undefined, - protos.google.cloud.gkehub.v1.IFeature>): void; - listFeatures( - request?: protos.google.cloud.gkehub.v1.IListFeaturesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkehub.v1.IListFeaturesRequest, - protos.google.cloud.gkehub.v1.IListFeaturesResponse|null|undefined, - protos.google.cloud.gkehub.v1.IFeature>, - callback?: PaginationCallback< - protos.google.cloud.gkehub.v1.IListFeaturesRequest, - protos.google.cloud.gkehub.v1.IListFeaturesResponse|null|undefined, - protos.google.cloud.gkehub.v1.IFeature>): - Promise<[ - protos.google.cloud.gkehub.v1.IFeature[], - protos.google.cloud.gkehub.v1.IListFeaturesRequest|null, - protos.google.cloud.gkehub.v1.IListFeaturesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listFeatures(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) where the Features will be listed. - * Specified in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * When requesting a 'page' of resources, `page_size` specifies number of - * resources to return. If unspecified or set to 0, all resources will - * be returned. - * @param {string} request.pageToken - * Token returned by previous call to `ListFeatures` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} request.filter - * Lists Features that match the filter expression, following the syntax - * outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Feature with the name "servicemesh" in project "foo-proj": - * - * name = "projects/foo-proj/locations/global/features/servicemesh" - * - * - Features that have a label called `foo`: - * - * labels.foo:* - * - * - Features that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * @param {string} request.orderBy - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 protos.google.cloud.gkehub.v1.Feature|Feature} 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 `listFeaturesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFeaturesStream( - request?: protos.google.cloud.gkehub.v1.IListFeaturesRequest, - 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['listFeatures']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFeatures.createStream( - this.innerApiCalls.listFeatures as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFeatures`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) where the Features will be listed. - * Specified in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * When requesting a 'page' of resources, `page_size` specifies number of - * resources to return. If unspecified or set to 0, all resources will - * be returned. - * @param {string} request.pageToken - * Token returned by previous call to `ListFeatures` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} request.filter - * Lists Features that match the filter expression, following the syntax - * outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Feature with the name "servicemesh" in project "foo-proj": - * - * name = "projects/foo-proj/locations/global/features/servicemesh" - * - * - Features that have a label called `foo`: - * - * labels.foo:* - * - * - Features that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * @param {string} request.orderBy - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkehub.v1.Feature|Feature}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/gke_hub.list_features.js - * region_tag:gkehub_v1_generated_GkeHub_ListFeatures_async - */ - listFeaturesAsync( - request?: protos.google.cloud.gkehub.v1.IListFeaturesRequest, - 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['listFeatures']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFeatures.asyncIterate( - this.innerApiCalls['listFeatures'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified feature resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} feature - * @returns {string} Resource name string. - */ - featurePath(project:string,location:string,feature:string) { - return this.pathTemplates.featurePathTemplate.render({ - project: project, - location: location, - feature: feature, - }); - } - - /** - * Parse the project from Feature resource. - * - * @param {string} featureName - * A fully-qualified path representing Feature resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFeatureName(featureName: string) { - return this.pathTemplates.featurePathTemplate.match(featureName).project; - } - - /** - * Parse the location from Feature resource. - * - * @param {string} featureName - * A fully-qualified path representing Feature resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFeatureName(featureName: string) { - return this.pathTemplates.featurePathTemplate.match(featureName).location; - } - - /** - * Parse the feature from Feature resource. - * - * @param {string} featureName - * A fully-qualified path representing Feature resource. - * @returns {string} A string representing the feature. - */ - matchFeatureFromFeatureName(featureName: string) { - return this.pathTemplates.featurePathTemplate.match(featureName).feature; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified membership resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} membership - * @returns {string} Resource name string. - */ - membershipPath(project:string,location:string,membership:string) { - return this.pathTemplates.membershipPathTemplate.render({ - project: project, - location: location, - membership: membership, - }); - } - - /** - * Parse the project from Membership resource. - * - * @param {string} membershipName - * A fully-qualified path representing Membership resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMembershipName(membershipName: string) { - return this.pathTemplates.membershipPathTemplate.match(membershipName).project; - } - - /** - * Parse the location from Membership resource. - * - * @param {string} membershipName - * A fully-qualified path representing Membership resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMembershipName(membershipName: string) { - return this.pathTemplates.membershipPathTemplate.match(membershipName).location; - } - - /** - * Parse the membership from Membership resource. - * - * @param {string} membershipName - * A fully-qualified path representing Membership resource. - * @returns {string} A string representing the membership. - */ - matchMembershipFromMembershipName(membershipName: string) { - return this.pathTemplates.membershipPathTemplate.match(membershipName).membership; - } - - /** - * 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; - } - - /** - * 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.gkeHubStub && !this._terminated) { - return this.gkeHubStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_client_config.json b/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_client_config.json deleted file mode 100644 index e5baeaac099..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_client_config.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "interfaces": { - "google.cloud.gkehub.v1.GkeHub": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListMemberships": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListFeatures": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetMembership": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetFeature": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateMembership": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateFeature": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteMembership": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteFeature": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UpdateMembership": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UpdateFeature": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GenerateConnectManifest": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_proto_list.json b/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_proto_list.json deleted file mode 100644 index a96b9a7a883..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/src/v1/gke_hub_proto_list.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - "../../protos/google/cloud/gkehub/v1/configmanagement/configmanagement.proto", - "../../protos/google/cloud/gkehub/v1/feature.proto", - "../../protos/google/cloud/gkehub/v1/membership.proto", - "../../protos/google/cloud/gkehub/v1/multiclusteringress/multiclusteringress.proto", - "../../protos/google/cloud/gkehub/v1/service.proto" -] diff --git a/owl-bot-staging/google-cloud-gkehub/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-gkehub/v1/src/v1/index.ts deleted file mode 100644 index aaf819215ae..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/src/v1/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 {GkeHubClient} from './gke_hub_client'; diff --git a/owl-bot-staging/google-cloud-gkehub/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gkehub/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 723143457a0..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/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 gkehub = require('@google-cloud/gke-hub'); - -function main() { - const gkeHubClient = new gkehub.GkeHubClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 832fe8321c7..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/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 {GkeHubClient} from '@google-cloud/gke-hub'; - -// check that the client class type name can be used -function doStuffWithGkeHubClient(client: GkeHubClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const gkeHubClient = new GkeHubClient(); - doStuffWithGkeHubClient(gkeHubClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1/system-test/install.ts b/owl-bot-staging/google-cloud-gkehub/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1/test/gapic_gke_hub_v1.ts b/owl-bot-staging/google-cloud-gkehub/v1/test/gapic_gke_hub_v1.ts deleted file mode 100644 index ae43e9f2a42..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1/test/gapic_gke_hub_v1.ts +++ /dev/null @@ -1,2114 +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 gkehubModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.GkeHubClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = gkehubModule.v1.GkeHubClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = gkehubModule.v1.GkeHubClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = gkehubModule.v1.GkeHubClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new gkehubModule.v1.GkeHubClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new gkehubModule.v1.GkeHubClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.gkeHubStub, undefined); - await client.initialize(); - assert(client.gkeHubStub); - }); - - it('has close method for the initialized client', done => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.gkeHubStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.gkeHubStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new gkehubModule.v1.GkeHubClient({ - 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 gkehubModule.v1.GkeHubClient({ - 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('getMembership', () => { - it('invokes getMembership without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.GetMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.GetMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1.Membership() - ); - client.innerApiCalls.getMembership = stubSimpleCall(expectedResponse); - const [response] = await client.getMembership(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMembership without error using callback', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.GetMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.GetMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1.Membership() - ); - client.innerApiCalls.getMembership = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMembership( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1.IMembership|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMembership with error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.GetMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.GetMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMembership = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMembership(request), expectedError); - const actualRequest = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMembership with closed client', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.GetMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.GetMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getMembership(request), expectedError); - }); - }); - - describe('getFeature', () => { - it('invokes getFeature without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.GetFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.GetFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1.Feature() - ); - client.innerApiCalls.getFeature = stubSimpleCall(expectedResponse); - const [response] = await client.getFeature(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeature without error using callback', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.GetFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.GetFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1.Feature() - ); - client.innerApiCalls.getFeature = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFeature( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1.IFeature|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeature with error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.GetFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.GetFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFeature = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFeature(request), expectedError); - const actualRequest = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeature with closed client', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.GetFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.GetFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFeature(request), expectedError); - }); - }); - - describe('generateConnectManifest', () => { - it('invokes generateConnectManifest without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.GenerateConnectManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.GenerateConnectManifestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1.GenerateConnectManifestResponse() - ); - client.innerApiCalls.generateConnectManifest = stubSimpleCall(expectedResponse); - const [response] = await client.generateConnectManifest(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateConnectManifest without error using callback', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.GenerateConnectManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.GenerateConnectManifestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1.GenerateConnectManifestResponse() - ); - client.innerApiCalls.generateConnectManifest = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateConnectManifest( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1.IGenerateConnectManifestResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateConnectManifest with error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.GenerateConnectManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.GenerateConnectManifestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateConnectManifest = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateConnectManifest(request), expectedError); - const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateConnectManifest with closed client', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.GenerateConnectManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.GenerateConnectManifestRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateConnectManifest(request), expectedError); - }); - }); - - describe('createMembership', () => { - it('invokes createMembership without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.CreateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.CreateMembershipRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMembership = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMembership(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMembership without error using callback', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.CreateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.CreateMembershipRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMembership = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMembership( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMembership with call error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.CreateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.CreateMembershipRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMembership = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMembership(request), expectedError); - const actualRequest = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMembership with LRO error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.CreateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.CreateMembershipRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMembership = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMembership(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateMembershipProgress without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateMembershipProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateMembershipProgress with error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMembershipProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createFeature', () => { - it('invokes createFeature without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.CreateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.CreateFeatureRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFeature = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFeature(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeature without error using callback', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.CreateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.CreateFeatureRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFeature = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFeature( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeature with call error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.CreateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.CreateFeatureRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFeature = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFeature(request), expectedError); - const actualRequest = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeature with LRO error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.CreateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.CreateFeatureRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFeature = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFeature(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateFeatureProgress without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateFeatureProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateFeatureProgress with error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFeatureProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteMembership', () => { - it('invokes deleteMembership without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.DeleteMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.DeleteMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMembership = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteMembership(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMembership without error using callback', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.DeleteMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.DeleteMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMembership = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMembership( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMembership with call error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.DeleteMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.DeleteMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMembership = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteMembership(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMembership with LRO error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.DeleteMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.DeleteMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMembership = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteMembership(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteMembershipProgress without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteMembershipProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteMembershipProgress with error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteMembershipProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteFeature', () => { - it('invokes deleteFeature without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.DeleteFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.DeleteFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFeature = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFeature(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeature without error using callback', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.DeleteFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.DeleteFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFeature = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFeature( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeature with call error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.DeleteFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.DeleteFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFeature = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFeature(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeature with LRO error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.DeleteFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.DeleteFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFeature = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFeature(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteFeatureProgress without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteFeatureProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteFeatureProgress with error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFeatureProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateMembership', () => { - it('invokes updateMembership without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.UpdateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.UpdateMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMembership = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMembership(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMembership without error using callback', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.UpdateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.UpdateMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMembership = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMembership( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMembership with call error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.UpdateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.UpdateMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMembership = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMembership(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMembership with LRO error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.UpdateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.UpdateMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMembership = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMembership(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateMembershipProgress without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateMembershipProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateMembershipProgress with error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMembershipProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateFeature', () => { - it('invokes updateFeature without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.UpdateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.UpdateFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFeature = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFeature(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeature without error using callback', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.UpdateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.UpdateFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFeature = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFeature( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeature with call error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.UpdateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.UpdateFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFeature = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFeature(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeature with LRO error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.UpdateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.UpdateFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFeature = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFeature(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateFeatureProgress without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateFeatureProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateFeatureProgress with error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFeatureProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listMemberships', () => { - it('invokes listMemberships without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), - ]; - client.innerApiCalls.listMemberships = stubSimpleCall(expectedResponse); - const [response] = await client.listMemberships(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMemberships without error using callback', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), - ]; - client.innerApiCalls.listMemberships = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMemberships( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1.IMembership[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMemberships with error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMemberships = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMemberships(request), expectedError); - const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMembershipsStream without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), - ]; - client.descriptors.page.listMemberships.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMembershipsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkehub.v1.Membership[] = []; - stream.on('data', (response: protos.google.cloud.gkehub.v1.Membership) => { - 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.listMemberships.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMemberships, request)); - assert( - (client.descriptors.page.listMemberships.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listMembershipsStream with error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMemberships.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMembershipsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkehub.v1.Membership[] = []; - stream.on('data', (response: protos.google.cloud.gkehub.v1.Membership) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMemberships.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMemberships, request)); - assert( - (client.descriptors.page.listMemberships.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMemberships without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1.Membership()), - ]; - client.descriptors.page.listMemberships.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkehub.v1.IMembership[] = []; - const iterable = client.listMembershipsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMemberships.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMemberships.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMemberships with error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMemberships.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMembershipsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkehub.v1.IMembership[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMemberships.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMemberships.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listFeatures', () => { - it('invokes listFeatures without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), - ]; - client.innerApiCalls.listFeatures = stubSimpleCall(expectedResponse); - const [response] = await client.listFeatures(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeatures without error using callback', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), - ]; - client.innerApiCalls.listFeatures = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFeatures( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1.IFeature[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeatures with error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFeatures = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFeatures(request), expectedError); - const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeaturesStream without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), - ]; - client.descriptors.page.listFeatures.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFeaturesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkehub.v1.Feature[] = []; - stream.on('data', (response: protos.google.cloud.gkehub.v1.Feature) => { - 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.listFeatures.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFeatures, request)); - assert( - (client.descriptors.page.listFeatures.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFeaturesStream with error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFeatures.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFeaturesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkehub.v1.Feature[] = []; - stream.on('data', (response: protos.google.cloud.gkehub.v1.Feature) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFeatures.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFeatures, request)); - assert( - (client.descriptors.page.listFeatures.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFeatures without error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1.Feature()), - ]; - client.descriptors.page.listFeatures.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkehub.v1.IFeature[] = []; - const iterable = client.listFeaturesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFeatures.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFeatures.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFeatures with error', async () => { - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFeatures.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFeaturesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkehub.v1.IFeature[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFeatures.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFeatures.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('feature', () => { - const fakePath = "/rendered/path/feature"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - feature: "featureValue", - }; - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.featurePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.featurePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('featurePath', () => { - const result = client.featurePath("projectValue", "locationValue", "featureValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.featurePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFeatureName', () => { - const result = client.matchProjectFromFeatureName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.featurePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFeatureName', () => { - const result = client.matchLocationFromFeatureName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.featurePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFeatureFromFeatureName', () => { - const result = client.matchFeatureFromFeatureName(fakePath); - assert.strictEqual(result, "featureValue"); - assert((client.pathTemplates.featurePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('membership', () => { - const fakePath = "/rendered/path/membership"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - membership: "membershipValue", - }; - const client = new gkehubModule.v1.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.membershipPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.membershipPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('membershipPath', () => { - const result = client.membershipPath("projectValue", "locationValue", "membershipValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.membershipPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMembershipName', () => { - const result = client.matchProjectFromMembershipName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMembershipName', () => { - const result = client.matchLocationFromMembershipName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMembershipFromMembershipName', () => { - const result = client.matchMembershipFromMembershipName(fakePath); - assert.strictEqual(result, "membershipValue"); - assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new gkehubModule.v1.GkeHubClient({ - 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)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-gkehub/v1/tsconfig.json b/owl-bot-staging/google-cloud-gkehub/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1/webpack.config.js b/owl-bot-staging/google-cloud-gkehub/v1/webpack.config.js deleted file mode 100644 index 71afa3a607d..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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: 'GkeHub', - filename: './gke-hub.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-gkehub/v1alpha/.eslintignore b/owl-bot-staging/google-cloud-gkehub/v1alpha/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/.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-gkehub/v1alpha/.eslintrc.json b/owl-bot-staging/google-cloud-gkehub/v1alpha/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/.gitignore b/owl-bot-staging/google-cloud-gkehub/v1alpha/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/.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-gkehub/v1alpha/.jsdoc.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/.jsdoc.js deleted file mode 100644 index b83282dcebb..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/.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/gke-hub', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/.mocharc.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/.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-gkehub/v1alpha/.prettierrc.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/.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-gkehub/v1alpha/README.md b/owl-bot-staging/google-cloud-gkehub/v1alpha/README.md deleted file mode 100644 index f922950c787..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/README.md +++ /dev/null @@ -1 +0,0 @@ -Gkehub: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/package.json b/owl-bot-staging/google-cloud-gkehub/v1alpha/package.json deleted file mode 100644 index 25f7a0fc625..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/gke-hub", - "version": "0.1.0", - "description": "Gkehub client for Node.js", - "repository": "googleapis/nodejs-gkehub", - "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 gkehub", - "gkehub", - "gke hub" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/cloudauditlogging/cloudauditlogging.proto b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/cloudauditlogging/cloudauditlogging.proto deleted file mode 100644 index e8b3bb0caaf..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/cloudauditlogging/cloudauditlogging.proto +++ /dev/null @@ -1,36 +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.gkehub.cloudauditlogging.v1alpha; - - -option csharp_namespace = "Google.Cloud.GkeHub.CloudAuditLogging.V1Alpha"; -option go_package = "cloud.google.com/go/gkehub/cloudauditlogging/apiv1alpha/cloudauditloggingpb;cloudauditloggingpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudAuditLoggingProto"; -option java_package = "com.google.cloud.gkehub.cloudauditlogging.v1alpha"; -option php_namespace = "Google\\Cloud\\GkeHub\\CloudAuditLogging\\V1alpha"; -option ruby_package = "Google::Cloud::GkeHub::CloudAuditLogging::V1alpha"; - -// **Cloud Audit Logging**: Spec for Audit Logging Allowlisting. -message FeatureSpec { - // Service account that should be allowlisted to send the audit logs; eg - // cloudauditlogging@gcp-project.iam.gserviceaccount.com. These accounts must - // already exist, but do not need to have any permissions granted to them. - // The customer's entitlements will be checked prior to allowlisting (i.e. - // the customer must be an Anthos customer.) - repeated string allowlisted_service_accounts = 1; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/configmanagement/configmanagement.proto b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/configmanagement/configmanagement.proto deleted file mode 100644 index bca2e55108e..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/configmanagement/configmanagement.proto +++ /dev/null @@ -1,415 +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.gkehub.configmanagement.v1alpha; - -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeHub.ConfigManagement.V1Alpha"; -option go_package = "cloud.google.com/go/gkehub/configmanagement/apiv1alpha/configmanagementpb;configmanagementpb"; -option java_multiple_files = true; -option java_outer_classname = "ConfigManagementProto"; -option java_package = "com.google.cloud.gkehub.configmanagement.v1alpha"; -option php_namespace = "Google\\Cloud\\GkeHub\\ConfigManagement\\V1alpha"; -option ruby_package = "Google::Cloud::GkeHub::ConfigManagement::V1alpha"; - -// Enum representing the state of an ACM's deployment on a cluster -enum DeploymentState { - // Deployment's state cannot be determined - DEPLOYMENT_STATE_UNSPECIFIED = 0; - - // Deployment is not installed - NOT_INSTALLED = 1; - - // Deployment is installed - INSTALLED = 2; - - // Deployment was attempted to be installed, but has errors - ERROR = 3; -} - -// **Anthos Config Management**: State for a single cluster. -message MembershipState { - // The user-defined name for the cluster used by ClusterSelectors to group - // clusters together. This should match Membership's membership_name, - // unless the user installed ACM on the cluster manually prior to enabling - // the ACM hub feature. - // Unique within a Anthos Config Management installation. - string cluster_name = 1; - - // Membership configuration in the cluster. This represents the actual state - // in the cluster, while the MembershipSpec in the FeatureSpec represents - // the intended state - MembershipSpec membership_spec = 2; - - // Current install status of ACM's Operator - OperatorState operator_state = 3; - - // Current sync status - ConfigSyncState config_sync_state = 4; - - // PolicyController status - PolicyControllerState policy_controller_state = 5; - - // Binauthz status - BinauthzState binauthz_state = 6; - - // Hierarchy Controller status - HierarchyControllerState hierarchy_controller_state = 7; -} - -// **Anthos Config Management**: Configuration for a single cluster. -// Intended to parallel the ConfigManagement CR. -message MembershipSpec { - // Config Sync configuration for the cluster. - ConfigSync config_sync = 1; - - // Policy Controller configuration for the cluster. - PolicyController policy_controller = 2; - - // Binauthz conifguration for the cluster. - BinauthzConfig binauthz = 3; - - // Hierarchy Controller configuration for the cluster. - HierarchyControllerConfig hierarchy_controller = 4; - - // Version of ACM installed. - string version = 10; -} - -// Configuration for Config Sync -message ConfigSync { - // Git repo configuration for the cluster. - GitConfig git = 7; - - // Specifies whether the Config Sync Repo is - // in “hierarchical” or “unstructured” mode. - string source_format = 8; -} - -// Git repo configuration for a single cluster. -message GitConfig { - // The URL of the Git repository to use as the source of truth. - string sync_repo = 1; - - // The branch of the repository to sync from. Default: master. - string sync_branch = 2; - - // The path within the Git repository that represents the top level of the - // repo to sync. Default: the root directory of the repository. - string policy_dir = 3; - - // Period in seconds between consecutive syncs. Default: 15. - int64 sync_wait_secs = 4; - - // Git revision (tag or hash) to check out. Default HEAD. - string sync_rev = 5; - - // Type of secret configured for access to the Git repo. - string secret_type = 6; - - // URL for the HTTPS proxy to be used when communicating with the Git repo. - string https_proxy = 7; - - // The GCP Service Account Email used for auth when secret_type is - // gcpServiceAccount. - string gcp_service_account_email = 8; -} - -// Configuration for Policy Controller -message PolicyController { - // Enables the installation of Policy Controller. - // If false, the rest of PolicyController fields take no - // effect. - bool enabled = 1; - - // Installs the default template library along with Policy Controller. - optional bool template_library_installed = 2; - - // Sets the interval for Policy Controller Audit Scans (in seconds). - // When set to 0, this disables audit functionality altogether. - optional int64 audit_interval_seconds = 3; - - // The set of namespaces that are excluded from Policy Controller checks. - // Namespaces do not need to currently exist on the cluster. - repeated string exemptable_namespaces = 4; - - // Enables the ability to use Constraint Templates that reference to objects - // other than the object currently being evaluated. - bool referential_rules_enabled = 5; - - // Logs all denies and dry run failures. - bool log_denies_enabled = 6; - - // Enable users to try out mutation for PolicyController. - bool mutation_enabled = 7; -} - -// Configuration for Binauthz -message BinauthzConfig { - // Whether binauthz is enabled in this cluster. - bool enabled = 1; -} - -// Configuration for Hierarchy Controller -message HierarchyControllerConfig { - // Whether Hierarchy Controller is enabled in this cluster. - bool enabled = 1; - - // Whether pod tree labels are enabled in this cluster. - bool enable_pod_tree_labels = 2; - - // Whether hierarchical resource quota is enabled in this cluster. - bool enable_hierarchical_resource_quota = 3; -} - -// Deployment state for Hierarchy Controller -message HierarchyControllerDeploymentState { - // The deployment state for open source HNC (e.g. v0.7.0-hc.0) - DeploymentState hnc = 1; - - // The deployment state for Hierarchy Controller extension (e.g. v0.7.0-hc.1) - DeploymentState extension = 2; -} - -// Version for Hierarchy Controller -message HierarchyControllerVersion { - // Version for open source HNC - string hnc = 1; - - // Version for Hierarchy Controller extension - string extension = 2; -} - -// State for Hierarchy Controller -message HierarchyControllerState { - // The version for Hierarchy Controller - HierarchyControllerVersion version = 1; - - // The deployment state for Hierarchy Controller - HierarchyControllerDeploymentState state = 2; -} - -// State information for an ACM's Operator -message OperatorState { - // The semenatic version number of the operator - string version = 1; - - // The state of the Operator's deployment - DeploymentState deployment_state = 2; - - // Install errors. - repeated InstallError errors = 3; -} - -// Errors pertaining to the installation of ACM -message InstallError { - // A string representing the user facing error message - string error_message = 1; -} - -// State information for ConfigSync -message ConfigSyncState { - // The version of ConfigSync deployed - ConfigSyncVersion version = 1; - - // Information about the deployment of ConfigSync, including the version - // of the various Pods deployed - ConfigSyncDeploymentState deployment_state = 2; - - // The state of ConfigSync's process to sync configs to a cluster - SyncState sync_state = 3; -} - -// Specific versioning information pertaining to ConfigSync's Pods -message ConfigSyncVersion { - // Version of the deployed importer pod - string importer = 1; - - // Version of the deployed syncer pod - string syncer = 2; - - // Version of the deployed git-sync pod - string git_sync = 3; - - // Version of the deployed monitor pod - string monitor = 4; - - // Version of the deployed reconciler-manager pod - string reconciler_manager = 5; - - // Version of the deployed reconciler container in root-reconciler pod - string root_reconciler = 6; -} - -// The state of ConfigSync's deployment on a cluster -message ConfigSyncDeploymentState { - // Deployment state of the importer pod - DeploymentState importer = 1; - - // Deployment state of the syncer pod - DeploymentState syncer = 2; - - // Deployment state of the git-sync pod - DeploymentState git_sync = 3; - - // Deployment state of the monitor pod - DeploymentState monitor = 4; - - // Deployment state of reconciler-manager pod - DeploymentState reconciler_manager = 5; - - // Deployment state of root-reconciler - DeploymentState root_reconciler = 6; -} - -// State indicating an ACM's progress syncing configurations to a cluster -message SyncState { - // An enum representing an ACM's status syncing configs to a cluster - enum SyncCode { - // ACM cannot determine a sync code - SYNC_CODE_UNSPECIFIED = 0; - - // ACM successfully synced the git Repo with the cluster - SYNCED = 1; - - // ACM is in the progress of syncing a new change - PENDING = 2; - - // Indicates an error configuring ACM, and user action is required - ERROR = 3; - - // ACM has been installed (operator manifest deployed), - // but not configured. - NOT_CONFIGURED = 4; - - // ACM has not been installed (no operator pod found) - NOT_INSTALLED = 5; - - // Error authorizing with the cluster - UNAUTHORIZED = 6; - - // Cluster could not be reached - UNREACHABLE = 7; - } - - // Token indicating the state of the repo. - string source_token = 1; - - // Token indicating the state of the importer. - string import_token = 2; - - // Token indicating the state of the syncer. - string sync_token = 3; - - // Deprecated: use last_sync_time instead. - // Timestamp of when ACM last successfully synced the repo - // The time format is specified in https://golang.org/pkg/time/#Time.String - string last_sync = 4 [deprecated = true]; - - // Timestamp type of when ACM last successfully synced the repo - google.protobuf.Timestamp last_sync_time = 7; - - // Sync status code - SyncCode code = 5; - - // A list of errors resulting from problematic configs. - // This list will be truncated after 100 errors, although it is - // unlikely for that many errors to simultaneously exist. - repeated SyncError errors = 6; -} - -// An ACM created error representing a problem syncing configurations -message SyncError { - // An ACM defined error code - string code = 1; - - // A description of the error - string error_message = 2; - - // A list of config(s) associated with the error, if any - repeated ErrorResource error_resources = 3; -} - -// Model for a config file in the git repo with an associated Sync error -message ErrorResource { - // Path in the git repo of the erroneous config - string source_path = 1; - - // Metadata name of the resource that is causing an error - string resource_name = 2; - - // Namespace of the resource that is causing an error - string resource_namespace = 3; - - // Group/version/kind of the resource that is causing an error - GroupVersionKind resource_gvk = 4; -} - -// A Kubernetes object's GVK -message GroupVersionKind { - // Kubernetes Group - string group = 1; - - // Kubernetes Version - string version = 2; - - // Kubernetes Kind - string kind = 3; -} - -// State for PolicyControllerState. -message PolicyControllerState { - // The version of Gatekeeper Policy Controller deployed. - PolicyControllerVersion version = 1; - - // The state about the policy controller installation. - GatekeeperDeploymentState deployment_state = 2; -} - -// The build version of Gatekeeper Policy Controller is using. -message PolicyControllerVersion { - // The gatekeeper image tag that is composed of ACM version, git tag, build - // number. - string version = 1; -} - -// State for Binauthz -message BinauthzState { - // The state of the binauthz webhook. - DeploymentState webhook = 1; - - // The version of binauthz that is installed. - BinauthzVersion version = 2; -} - -// The version of binauthz. -message BinauthzVersion { - // The version of the binauthz webhook. - string webhook_version = 1; -} - -// State of Policy Controller installation. -message GatekeeperDeploymentState { - // Status of gatekeeper-controller-manager pod. - DeploymentState gatekeeper_controller_manager_state = 1; - - // Status of gatekeeper-audit deployment. - DeploymentState gatekeeper_audit = 2; - - // Status of the pod serving the mutation webhook. - DeploymentState gatekeeper_mutation = 3; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/feature.proto b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/feature.proto deleted file mode 100644 index e8557d90ab7..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/feature.proto +++ /dev/null @@ -1,215 +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.gkehub.v1alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/gkehub/v1alpha/cloudauditlogging/cloudauditlogging.proto"; -import "google/cloud/gkehub/v1alpha/configmanagement/configmanagement.proto"; -import "google/cloud/gkehub/v1alpha/metering/metering.proto"; -import "google/cloud/gkehub/v1alpha/multiclusteringress/multiclusteringress.proto"; -import "google/cloud/gkehub/v1alpha/servicemesh/servicemesh.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeHub.V1Alpha"; -option go_package = "cloud.google.com/go/gkehub/apiv1alpha/gkehubpb;gkehubpb"; -option java_multiple_files = true; -option java_outer_classname = "FeatureProto"; -option java_package = "com.google.cloud.gkehub.v1alpha"; -option php_namespace = "Google\\Cloud\\GkeHub\\V1alpha"; -option ruby_package = "Google::Cloud::GkeHub::V1alpha"; - -// Feature represents the settings and status of any Hub Feature. -message Feature { - option (google.api.resource) = { - type: "gkehub.googleapis.com/Feature" - pattern: "projects/{project}/locations/{location}/features/{feature}" - }; - - // Output only. The full, unique name of this Feature resource in the format - // `projects/*/locations/*/features/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // GCP labels for this Feature. - map labels = 2; - - // Output only. State of the Feature resource itself. - FeatureResourceState resource_state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Hub-wide Feature configuration. If this Feature does not support any - // Hub-wide configuration, this field may be unused. - CommonFeatureSpec spec = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Membership-specific configuration for this Feature. If this Feature does - // not support any per-Membership configuration, this field may be unused. - // - // The keys indicate which Membership the configuration is for, in the form: - // - // projects/{p}/locations/{l}/memberships/{m} - // - // Where {p} is the project, {l} is a valid location and {m} is a valid - // Membership in this project at that location. {p} WILL match the Feature's - // project. - // - // {p} will always be returned as the project number, but the project ID is - // also accepted during input. If the same Membership is specified in the map - // twice (using the project ID form, and the project number form), exactly - // ONE of the entries will be saved, with no guarantees as to which. For this - // reason, it is recommended the same format be used for all entries when - // mutating a Feature. - map membership_specs = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The Hub-wide Feature state. - CommonFeatureState state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Membership-specific Feature status. If this Feature does - // report any per-Membership status, this field may be unused. - // - // The keys indicate which Membership the state is for, in the form: - // - // projects/{p}/locations/{l}/memberships/{m} - // - // Where {p} is the project number, {l} is a valid location and {m} is a valid - // Membership in this project at that location. {p} MUST match the Feature's - // project number. - map membership_states = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the Feature resource was created. - google.protobuf.Timestamp create_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the Feature resource was last updated. - google.protobuf.Timestamp update_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the Feature resource was deleted. - google.protobuf.Timestamp delete_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// FeatureResourceState describes the state of a Feature *resource* in the -// GkeHub API. See `FeatureState` for the "running state" of the Feature in the -// Hub and across Memberships. -message FeatureResourceState { - // State describes the lifecycle status of a Feature. - enum State { - // State is unknown or not set. - STATE_UNSPECIFIED = 0; - - // The Feature is being enabled, and the Feature resource is being created. - // Once complete, the corresponding Feature will be enabled in this Hub. - ENABLING = 1; - - // The Feature is enabled in this Hub, and the Feature resource is fully - // available. - ACTIVE = 2; - - // The Feature is being disabled in this Hub, and the Feature resource - // is being deleted. - DISABLING = 3; - - // The Feature resource is being updated. - UPDATING = 4; - - // The Feature resource is being updated by the Hub Service. - SERVICE_UPDATING = 5; - } - - // The current state of the Feature resource in the Hub API. - State state = 1; -} - -// FeatureState describes the high-level state of a Feature. It may be used to -// describe a Feature's state at the environ-level, or per-membershop, depending -// on the context. -message FeatureState { - // Code represents a machine-readable, high-level status of the Feature. - enum Code { - // Unknown or not set. - CODE_UNSPECIFIED = 0; - - // The Feature is operating normally. - OK = 1; - - // The Feature has encountered an issue, and is operating in a degraded - // state. The Feature may need intervention to return to normal operation. - // See the description and any associated Feature-specific details for more - // information. - WARNING = 2; - - // The Feature is not operating or is in a severely degraded state. - // The Feature may need intervention to return to normal operation. - // See the description and any associated Feature-specific details for more - // information. - ERROR = 3; - } - - // The high-level, machine-readable status of this Feature. - Code code = 1; - - // A human-readable description of the current status. - string description = 2; - - // The time this status and any related Feature-specific details were updated. - google.protobuf.Timestamp update_time = 3; -} - -// CommonFeatureSpec contains Hub-wide configuration information -message CommonFeatureSpec { - oneof feature_spec { - // Multicluster Ingress-specific spec. - google.cloud.gkehub.multiclusteringress.v1alpha.FeatureSpec multiclusteringress = 102; - - // Cloud Audit Logging-specific spec. - google.cloud.gkehub.cloudauditlogging.v1alpha.FeatureSpec cloudauditlogging = 108; - } -} - -// CommonFeatureState contains Hub-wide Feature status information. -message CommonFeatureState { - oneof feature_state { - // Service Mesh-specific state. - google.cloud.gkehub.servicemesh.v1alpha.FeatureState servicemesh = 100; - } - - // Output only. The "running state" of the Feature in this Hub. - FeatureState state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// MembershipFeatureSpec contains configuration information for a single -// Membership. -message MembershipFeatureSpec { - oneof feature_spec { - // Config Management-specific spec. - google.cloud.gkehub.configmanagement.v1alpha.MembershipSpec configmanagement = 106; - } -} - -// MembershipFeatureState contains Feature status information for a single -// Membership. -message MembershipFeatureState { - oneof feature_state { - // Service Mesh-specific state. - google.cloud.gkehub.servicemesh.v1alpha.MembershipState servicemesh = 100; - - // Metering-specific spec. - google.cloud.gkehub.metering.v1alpha.MembershipState metering = 104; - - // Config Management-specific state. - google.cloud.gkehub.configmanagement.v1alpha.MembershipState configmanagement = 106; - } - - // The high-level state of this Feature for a single membership. - FeatureState state = 1; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/metering/metering.proto b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/metering/metering.proto deleted file mode 100644 index 6bb7e55a721..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/metering/metering.proto +++ /dev/null @@ -1,38 +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.gkehub.metering.v1alpha; - -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeHub.Metering.V1Alpha"; -option go_package = "cloud.google.com/go/gkehub/metering/apiv1alpha/meteringpb;meteringpb"; -option java_multiple_files = true; -option java_outer_classname = "MeteringProto"; -option java_package = "com.google.cloud.gkehub.metering.v1alpha"; -option php_namespace = "Google\\Cloud\\GkeHub\\Metering\\V1alpha"; -option ruby_package = "Google::Cloud::GkeHub::Metering::V1alpha"; - -// **Metering**: Per-Membership Feature State. -message MembershipState { - // The time stamp of the most recent measurement of the number of vCPUs - // in the cluster. - google.protobuf.Timestamp last_measurement_time = 1; - - // The vCPUs capacity in the cluster according to the most recent - // measurement (1/1000 precision). - float precise_last_measured_cluster_vcpu_capacity = 3; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/multiclusteringress/multiclusteringress.proto b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/multiclusteringress/multiclusteringress.proto deleted file mode 100644 index 2d4ce5c7f2f..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/multiclusteringress/multiclusteringress.proto +++ /dev/null @@ -1,49 +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.gkehub.multiclusteringress.v1alpha; - - -option csharp_namespace = "Google.Cloud.GkeHub.MultiClusterIngress.V1Alpha"; -option go_package = "cloud.google.com/go/gkehub/multiclusteringress/apiv1alpha/multiclusteringresspb;multiclusteringresspb"; -option java_multiple_files = true; -option java_outer_classname = "MultiClusterIngressProto"; -option java_package = "com.google.cloud.gkehub.multiclusteringress.v1alpha"; -option php_namespace = "Google\\Cloud\\GkeHub\\MultiClusterIngress\\V1alpha"; -option ruby_package = "Google::Cloud::GkeHub::MultiClusterIngress::V1alpha"; - -// Billing identifies which billing structure the customer is using. -enum Billing { - // Unknown - BILLING_UNSPECIFIED = 0; - - // User pays a fee per-endpoint. - PAY_AS_YOU_GO = 1; - - // User is paying for Anthos as a whole. - ANTHOS_LICENSE = 2; -} - -// **Multi-cluster Ingress**: The configuration for the MultiClusterIngress -// feature. -message FeatureSpec { - // Fully-qualified Membership name which hosts the MultiClusterIngress CRD. - // Example: `projects/foo-proj/locations/global/memberships/bar` - string config_membership = 1; - - // Customer's billing structure - Billing billing = 2; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/service.proto b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/service.proto deleted file mode 100644 index f90a53a5129..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/service.proto +++ /dev/null @@ -1,280 +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.gkehub.v1alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/gkehub/v1alpha/feature.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeHub.V1Alpha"; -option go_package = "cloud.google.com/go/gkehub/apiv1alpha/gkehubpb;gkehubpb"; -option java_multiple_files = true; -option java_outer_classname = "ServiceProto"; -option java_package = "com.google.cloud.gkehub.v1alpha"; -option php_namespace = "Google\\Cloud\\GkeHub\\V1alpha"; -option ruby_package = "Google::Cloud::GkeHub::V1alpha"; - -// The GKE Hub service handles the registration of many Kubernetes clusters to -// Google Cloud, and the management of multi-cluster features over those -// clusters. -// -// The GKE Hub service operates on the following resources: -// -// * [Membership][google.cloud.gkehub.v1alpha.Membership] -// * [Feature][google.cloud.gkehub.v1alpha.Feature] -// -// GKE Hub is currently only available in the global region. -// -// **Membership management may be non-trivial:** it is recommended to use one -// of the Google-provided client libraries or tools where possible when working -// with Membership resources. -service GkeHub { - option (google.api.default_host) = "gkehub.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists Features in a given project and location. - rpc ListFeatures(ListFeaturesRequest) returns (ListFeaturesResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*/locations/*}/features" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single Feature. - rpc GetFeature(GetFeatureRequest) returns (Feature) { - option (google.api.http) = { - get: "/v1alpha/{name=projects/*/locations/*/features/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Adds a new Feature. - rpc CreateFeature(CreateFeatureRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha/{parent=projects/*/locations/*}/features" - body: "resource" - }; - option (google.api.method_signature) = "parent,resource,feature_id"; - option (google.longrunning.operation_info) = { - response_type: "Feature" - metadata_type: "OperationMetadata" - }; - } - - // Removes a Feature. - rpc DeleteFeature(DeleteFeatureRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1alpha/{name=projects/*/locations/*/features/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Updates an existing Feature. - rpc UpdateFeature(UpdateFeatureRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1alpha/{name=projects/*/locations/*/features/*}" - body: "resource" - }; - option (google.api.method_signature) = "name,resource,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Feature" - metadata_type: "OperationMetadata" - }; - } -} - -// Request message for `GkeHub.ListFeatures` method. -message ListFeaturesRequest { - // The parent (project and location) where the Features will be listed. - // Specified in the format `projects/*/locations/*`. - string parent = 1; - - // When requesting a 'page' of resources, `page_size` specifies number of - // resources to return. If unspecified or set to 0, all resources will - // be returned. - int32 page_size = 2; - - // Token returned by previous call to `ListFeatures` which - // specifies the position in the list from where to continue listing the - // resources. - string page_token = 3; - - // Lists Features that match the filter expression, following the syntax - // outlined in https://google.aip.dev/160. - // - // Examples: - // - // - Feature with the name "servicemesh" in project "foo-proj": - // - // name = "projects/foo-proj/locations/global/features/servicemesh" - // - // - Features that have a label called `foo`: - // - // labels.foo:* - // - // - Features that have a label called `foo` whose value is `bar`: - // - // labels.foo = bar - string filter = 4; - - // One or more fields to compare and use to sort the output. - // See https://google.aip.dev/132#ordering. - string order_by = 5; -} - -// Response message for the `GkeHub.ListFeatures` method. -message ListFeaturesResponse { - // The list of matching Features - repeated Feature resources = 1; - - // A token to request the next page of resources from the - // `ListFeatures` method. The value of an empty string means - // that there are no more resources to return. - string next_page_token = 2; -} - -// Request message for `GkeHub.GetFeature` method. -message GetFeatureRequest { - // The Feature resource name in the format - // `projects/*/locations/*/features/*` - string name = 1; -} - -// Request message for the `GkeHub.CreateFeature` method. -message CreateFeatureRequest { - // The parent (project and location) where the Feature will be created. - // Specified in the format `projects/*/locations/*`. - string parent = 1; - - // The ID of the feature to create. - string feature_id = 2; - - // The Feature resource to create. - Feature resource = 3; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for `GkeHub.DeleteFeature` method. -message DeleteFeatureRequest { - // The Feature resource name in the format - // `projects/*/locations/*/features/*`. - string name = 1; - - // If set to true, the delete will ignore any outstanding resources for - // this Feature (that is, `FeatureState.has_resources` is set to true). These - // resources will NOT be cleaned up or modified in any way. - bool force = 2; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for `GkeHub.UpdateFeature` method. -message UpdateFeatureRequest { - // The Feature resource name in the format - // `projects/*/locations/*/features/*`. - string name = 1; - - // Mask of fields to update. - google.protobuf.FieldMask update_mask = 2; - - // Only fields specified in update_mask are updated. - // If you specify a field in the update_mask but don't specify its value here - // that field will be deleted. - // If you are updating a map field, set the value of a key to null or empty - // string to delete the key from the map. It's not possible to update a key's - // value to the empty string. - // If you specify the update_mask to be a special path "*", fully replaces all - // user-modifiable fields to match `resource`. - Feature resource = 3; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_detail = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/servicemesh/servicemesh.proto b/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/servicemesh/servicemesh.proto deleted file mode 100644 index 927c15a5994..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/protos/google/cloud/gkehub/v1alpha/servicemesh/servicemesh.proto +++ /dev/null @@ -1,114 +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.gkehub.servicemesh.v1alpha; - -import "google/api/field_behavior.proto"; -import "google/protobuf/struct.proto"; - -option csharp_namespace = "Google.Cloud.GkeHub.ServiceMesh.V1Alpha"; -option go_package = "cloud.google.com/go/gkehub/servicemesh/apiv1alpha/servicemeshpb;servicemeshpb"; -option java_multiple_files = true; -option java_outer_classname = "ServiceMeshProto"; -option java_package = "com.google.cloud.gkehub.servicemesh.v1alpha"; -option php_namespace = "Google\\Cloud\\GkeHub\\ServiceMesh\\V1alpha"; -option ruby_package = "Google::Cloud::GkeHub::ServiceMesh::V1alpha"; - -// **Service Mesh**: State for the whole Hub, as analyzed by the Service Mesh -// Hub Controller. -message FeatureState { - // Output only. Results of running Service Mesh analyzers. - repeated AnalysisMessage analysis_messages = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// **Service Mesh**: State for a single Membership, as analyzed by the Service -// Mesh Hub Controller. -message MembershipState { - // Output only. Results of running Service Mesh analyzers. - repeated AnalysisMessage analysis_messages = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// AnalysisMessageBase describes some common information that is -// needed for all messages. -message AnalysisMessageBase { - // A unique identifier for the type of message. Display_name is intended to be - // human-readable, code is intended to be machine readable. There should be a - // one-to-one mapping between display_name and code. (i.e. do not re-use - // display_names or codes between message types.) - // See istio.analysis.v1alpha1.AnalysisMessageBase.Type - message Type { - // A human-readable name for the message type. e.g. "InternalError", - // "PodMissingProxy". This should be the same for all messages of the same - // type. (This corresponds to the `name` field in open-source Istio.) - string display_name = 1; - - // A 7 character code matching `^IST[0-9]{4}$` or `^ASM[0-9]{4}$`, intended - // to uniquely identify the message type. (e.g. "IST0001" is mapped to the - // "InternalError" message type.) - string code = 2; - } - - // The values here are chosen so that more severe messages get sorted higher, - // as well as leaving space in between to add more later - // See istio.analysis.v1alpha1.AnalysisMessageBase.Level - enum Level { - // Illegal. Same istio.analysis.v1alpha1.AnalysisMessageBase.Level.UNKNOWN. - LEVEL_UNSPECIFIED = 0; - - // ERROR represents a misconfiguration that must be fixed. - ERROR = 3; - - // WARNING represents a misconfiguration that should be fixed. - WARNING = 8; - - // INFO represents an informational finding. - INFO = 12; - } - - // Represents the specific type of a message. - Type type = 1; - - // Represents how severe a message is. - Level level = 2; - - // A url pointing to the Service Mesh or Istio documentation for this specific - // error type. - string documentation_url = 3; -} - -// AnalysisMessage is a single message produced by an analyzer, and -// it used to communicate to the end user about the state of their Service -// Mesh configuration. -message AnalysisMessage { - // Details common to all types of Istio and ServiceMesh analysis messages. - AnalysisMessageBase message_base = 1; - - // A human readable description of what the error means. It is suitable for - // non-internationalize display purposes. - string description = 2; - - // A list of strings specifying the resource identifiers that were the cause - // of message generation. - // A "path" here may be: - // * MEMBERSHIP_ID if the cause is a specific member cluster - // * MEMBERSHIP_ID/(NAMESPACE\/)?RESOURCETYPE/NAME if the cause is a resource - // in a cluster - repeated string resource_paths = 3; - - // A UI can combine these args with a template (based on message_base.type) - // to produce an internationalized message. - google.protobuf.Struct args = 4; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.create_feature.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.create_feature.js deleted file mode 100644 index a5845935054..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.create_feature.js +++ /dev/null @@ -1,84 +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() { - // [START gkehub_v1alpha_generated_GkeHub_CreateFeature_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The parent (project and location) where the Feature will be created. - * Specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * The ID of the feature to create. - */ - // const featureId = 'abc123' - /** - * The Feature resource to create. - */ - // const resource = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callCreateFeature() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await gkehubClient.createFeature(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateFeature(); - // [END gkehub_v1alpha_generated_GkeHub_CreateFeature_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-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.delete_feature.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.delete_feature.js deleted file mode 100644 index e6ecc51192f..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.delete_feature.js +++ /dev/null @@ -1,82 +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() { - // [START gkehub_v1alpha_generated_GkeHub_DeleteFeature_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The Feature resource name in the format - * `projects/* /locations/* /features/*`. - */ - // const name = 'abc123' - /** - * If set to true, the delete will ignore any outstanding resources for - * this Feature (that is, `FeatureState.has_resources` is set to true). These - * resources will NOT be cleaned up or modified in any way. - */ - // const force = true - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callDeleteFeature() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await gkehubClient.deleteFeature(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteFeature(); - // [END gkehub_v1alpha_generated_GkeHub_DeleteFeature_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-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.get_feature.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.get_feature.js deleted file mode 100644 index f93adaaa241..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.get_feature.js +++ /dev/null @@ -1,61 +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() { - // [START gkehub_v1alpha_generated_GkeHub_GetFeature_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The Feature resource name in the format - * `projects/* /locations/* /features/*` - */ - // const name = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callGetFeature() { - // Construct request - const request = { - }; - - // Run request - const response = await gkehubClient.getFeature(request); - console.log(response); - } - - callGetFeature(); - // [END gkehub_v1alpha_generated_GkeHub_GetFeature_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-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.list_features.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.list_features.js deleted file mode 100644 index f1ad6170112..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.list_features.js +++ /dev/null @@ -1,92 +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() { - // [START gkehub_v1alpha_generated_GkeHub_ListFeatures_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The parent (project and location) where the Features will be listed. - * Specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * When requesting a 'page' of resources, `page_size` specifies number of - * resources to return. If unspecified or set to 0, all resources will - * be returned. - */ - // const pageSize = 1234 - /** - * Token returned by previous call to `ListFeatures` which - * specifies the position in the list from where to continue listing the - * resources. - */ - // const pageToken = 'abc123' - /** - * Lists Features that match the filter expression, following the syntax - * outlined in https://google.aip.dev/160. - * Examples: - * - Feature with the name "servicemesh" in project "foo-proj": - * name = "projects/foo-proj/locations/global/features/servicemesh" - * - Features that have a label called `foo`: - * labels.foo:* - * - Features that have a label called `foo` whose value is `bar`: - * labels.foo = bar - */ - // const filter = 'abc123' - /** - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - */ - // const orderBy = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callListFeatures() { - // Construct request - const request = { - }; - - // Run request - const iterable = await gkehubClient.listFeaturesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFeatures(); - // [END gkehub_v1alpha_generated_GkeHub_ListFeatures_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-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.update_feature.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.update_feature.js deleted file mode 100644 index 951cd95ffc7..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/gke_hub.update_feature.js +++ /dev/null @@ -1,91 +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() { - // [START gkehub_v1alpha_generated_GkeHub_UpdateFeature_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The Feature resource name in the format - * `projects/* /locations/* /features/*`. - */ - // const name = 'abc123' - /** - * Mask of fields to update. - */ - // const updateMask = {} - /** - * Only fields specified in update_mask are updated. - * If you specify a field in the update_mask but don't specify its value here - * that field will be deleted. - * If you are updating a map field, set the value of a key to null or empty - * string to delete the key from the map. It's not possible to update a key's - * value to the empty string. - * If you specify the update_mask to be a special path "*", fully replaces all - * user-modifiable fields to match `resource`. - */ - // const resource = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callUpdateFeature() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await gkehubClient.updateFeature(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateFeature(); - // [END gkehub_v1alpha_generated_GkeHub_UpdateFeature_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-gkehub/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.gkehub.v1alpha.json b/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.gkehub.v1alpha.json deleted file mode 100644 index f2c6d5fd175..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.gkehub.v1alpha.json +++ /dev/null @@ -1,263 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-gkehub", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.gkehub.v1alpha", - "version": "v1alpha" - } - ] - }, - "snippets": [ - { - "regionTag": "gkehub_v1alpha_generated_GkeHub_ListFeatures_async", - "title": "GkeHub listFeatures Sample", - "origin": "API_DEFINITION", - "description": " Lists Features in a given project and location.", - "canonical": true, - "file": "gke_hub.list_features.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFeatures", - "fullName": "google.cloud.gkehub.v1alpha.GkeHub.ListFeatures", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkehub.v1alpha.ListFeaturesResponse", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1alpha.GkeHubClient" - }, - "method": { - "shortName": "ListFeatures", - "fullName": "google.cloud.gkehub.v1alpha.GkeHub.ListFeatures", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1alpha.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1alpha_generated_GkeHub_GetFeature_async", - "title": "GkeHub getFeature Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single Feature.", - "canonical": true, - "file": "gke_hub.get_feature.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFeature", - "fullName": "google.cloud.gkehub.v1alpha.GkeHub.GetFeature", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkehub.v1alpha.Feature", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1alpha.GkeHubClient" - }, - "method": { - "shortName": "GetFeature", - "fullName": "google.cloud.gkehub.v1alpha.GkeHub.GetFeature", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1alpha.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1alpha_generated_GkeHub_CreateFeature_async", - "title": "GkeHub createFeature Sample", - "origin": "API_DEFINITION", - "description": " Adds a new Feature.", - "canonical": true, - "file": "gke_hub.create_feature.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFeature", - "fullName": "google.cloud.gkehub.v1alpha.GkeHub.CreateFeature", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "feature_id", - "type": "TYPE_STRING" - }, - { - "name": "resource", - "type": ".google.cloud.gkehub.v1alpha.Feature" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1alpha.GkeHubClient" - }, - "method": { - "shortName": "CreateFeature", - "fullName": "google.cloud.gkehub.v1alpha.GkeHub.CreateFeature", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1alpha.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1alpha_generated_GkeHub_DeleteFeature_async", - "title": "GkeHub deleteFeature Sample", - "origin": "API_DEFINITION", - "description": " Removes a Feature.", - "canonical": true, - "file": "gke_hub.delete_feature.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteFeature", - "fullName": "google.cloud.gkehub.v1alpha.GkeHub.DeleteFeature", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1alpha.GkeHubClient" - }, - "method": { - "shortName": "DeleteFeature", - "fullName": "google.cloud.gkehub.v1alpha.GkeHub.DeleteFeature", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1alpha.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1alpha_generated_GkeHub_UpdateFeature_async", - "title": "GkeHub updateFeature Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing Feature.", - "canonical": true, - "file": "gke_hub.update_feature.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFeature", - "fullName": "google.cloud.gkehub.v1alpha.GkeHub.UpdateFeature", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "resource", - "type": ".google.cloud.gkehub.v1alpha.Feature" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1alpha.GkeHubClient" - }, - "method": { - "shortName": "UpdateFeature", - "fullName": "google.cloud.gkehub.v1alpha.GkeHub.UpdateFeature", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1alpha.GkeHub" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha/src/index.ts deleted file mode 100644 index f559a8869eb..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/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 v1alpha from './v1alpha'; -const GkeHubClient = v1alpha.GkeHubClient; -type GkeHubClient = v1alpha.GkeHubClient; -export {v1alpha, GkeHubClient}; -export default {v1alpha, GkeHubClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gapic_metadata.json b/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gapic_metadata.json deleted file mode 100644 index bd65d90c5be..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gapic_metadata.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.gkehub.v1alpha", - "libraryPackage": "@google-cloud/gke-hub", - "services": { - "GkeHub": { - "clients": { - "grpc": { - "libraryClient": "GkeHubClient", - "rpcs": { - "GetFeature": { - "methods": [ - "getFeature" - ] - }, - "CreateFeature": { - "methods": [ - "createFeature" - ] - }, - "DeleteFeature": { - "methods": [ - "deleteFeature" - ] - }, - "UpdateFeature": { - "methods": [ - "updateFeature" - ] - }, - "ListFeatures": { - "methods": [ - "listFeatures", - "listFeaturesStream", - "listFeaturesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "GkeHubClient", - "rpcs": { - "GetFeature": { - "methods": [ - "getFeature" - ] - }, - "CreateFeature": { - "methods": [ - "createFeature" - ] - }, - "DeleteFeature": { - "methods": [ - "deleteFeature" - ] - }, - "UpdateFeature": { - "methods": [ - "updateFeature" - ] - }, - "ListFeatures": { - "methods": [ - "listFeatures", - "listFeaturesStream", - "listFeaturesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_client.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_client.ts deleted file mode 100644 index 7853ea12bf5..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_client.ts +++ /dev/null @@ -1,1084 +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, GrpcClientOptions, LROperation, 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/v1alpha/gke_hub_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './gke_hub_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The GKE Hub service handles the registration of many Kubernetes clusters to - * Google Cloud, and the management of multi-cluster features over those - * clusters. - * - * The GKE Hub service operates on the following resources: - * - * * {@link protos.google.cloud.gkehub.v1alpha.Membership|Membership} - * * {@link protos.google.cloud.gkehub.v1alpha.Feature|Feature} - * - * GKE Hub is currently only available in the global region. - * - * **Membership management may be non-trivial:** it is recommended to use one - * of the Google-provided client libraries or tools where possible when working - * with Membership resources. - * @class - * @memberof v1alpha - */ -export class GkeHubClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - gkeHubStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of GkeHubClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 GkeHubClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof GkeHubClient; - 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 { - 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 = { - featurePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/features/{feature}' - ), - }; - - // 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 = { - listFeatures: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha/{resource=projects/*/locations/*/memberships/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha/{resource=projects/*/locations/*/features/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha/{resource=projects/*/locations/*/memberships/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/features/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha/{resource=projects/*/locations/*/memberships/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/features/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createFeatureResponse = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1alpha.Feature') as gax.protobuf.Type; - const createFeatureMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1alpha.OperationMetadata') as gax.protobuf.Type; - const deleteFeatureResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteFeatureMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1alpha.OperationMetadata') as gax.protobuf.Type; - const updateFeatureResponse = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1alpha.Feature') as gax.protobuf.Type; - const updateFeatureMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1alpha.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createFeature: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createFeatureResponse.decode.bind(createFeatureResponse), - createFeatureMetadata.decode.bind(createFeatureMetadata)), - deleteFeature: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteFeatureResponse.decode.bind(deleteFeatureResponse), - deleteFeatureMetadata.decode.bind(deleteFeatureMetadata)), - updateFeature: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateFeatureResponse.decode.bind(updateFeatureResponse), - updateFeatureMetadata.decode.bind(updateFeatureMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.gkehub.v1alpha.GkeHub', 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.gkeHubStub) { - return this.gkeHubStub; - } - - // Put together the "service stub" for - // google.cloud.gkehub.v1alpha.GkeHub. - this.gkeHubStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.gkehub.v1alpha.GkeHub') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.gkehub.v1alpha.GkeHub, - 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 gkeHubStubMethods = - ['listFeatures', 'getFeature', 'createFeature', 'deleteFeature', 'updateFeature']; - for (const methodName of gkeHubStubMethods) { - const callPromise = this.gkeHubStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.gkeHubStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'gkehub.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 'gkehub.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 -- - // ------------------- -/** - * Gets details of a single Feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The Feature resource name in the format - * `projects/* /locations/* /features/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1alpha.Feature|Feature}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/gke_hub.get_feature.js - * region_tag:gkehub_v1alpha_generated_GkeHub_GetFeature_async - */ - getFeature( - request?: protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1alpha.IFeature, - protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest|undefined, {}|undefined - ]>; - getFeature( - request: protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkehub.v1alpha.IFeature, - protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest|null|undefined, - {}|null|undefined>): void; - getFeature( - request: protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest, - callback: Callback< - protos.google.cloud.gkehub.v1alpha.IFeature, - protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest|null|undefined, - {}|null|undefined>): void; - getFeature( - request?: protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkehub.v1alpha.IFeature, - protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkehub.v1alpha.IFeature, - protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkehub.v1alpha.IFeature, - protos.google.cloud.gkehub.v1alpha.IGetFeatureRequest|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.getFeature(request, options, callback); - } - -/** - * Adds a new Feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent (project and location) where the Feature will be created. - * Specified in the format `projects/* /locations/*`. - * @param {string} request.featureId - * The ID of the feature to create. - * @param {google.cloud.gkehub.v1alpha.Feature} request.resource - * The Feature resource to create. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/gke_hub.create_feature.js - * region_tag:gkehub_v1alpha_generated_GkeHub_CreateFeature_async - */ - createFeature( - request?: protos.google.cloud.gkehub.v1alpha.ICreateFeatureRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createFeature( - request: protos.google.cloud.gkehub.v1alpha.ICreateFeatureRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFeature( - request: protos.google.cloud.gkehub.v1alpha.ICreateFeatureRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFeature( - request?: protos.google.cloud.gkehub.v1alpha.ICreateFeatureRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFeature(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createFeature()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/gke_hub.create_feature.js - * region_tag:gkehub_v1alpha_generated_GkeHub_CreateFeature_async - */ - async checkCreateFeatureProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFeature, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Removes a Feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The Feature resource name in the format - * `projects/* /locations/* /features/*`. - * @param {boolean} request.force - * If set to true, the delete will ignore any outstanding resources for - * this Feature (that is, `FeatureState.has_resources` is set to true). These - * resources will NOT be cleaned up or modified in any way. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/gke_hub.delete_feature.js - * region_tag:gkehub_v1alpha_generated_GkeHub_DeleteFeature_async - */ - deleteFeature( - request?: protos.google.cloud.gkehub.v1alpha.IDeleteFeatureRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteFeature( - request: protos.google.cloud.gkehub.v1alpha.IDeleteFeatureRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFeature( - request: protos.google.cloud.gkehub.v1alpha.IDeleteFeatureRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFeature( - request?: protos.google.cloud.gkehub.v1alpha.IDeleteFeatureRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteFeature(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteFeature()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/gke_hub.delete_feature.js - * region_tag:gkehub_v1alpha_generated_GkeHub_DeleteFeature_async - */ - async checkDeleteFeatureProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFeature, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an existing Feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The Feature resource name in the format - * `projects/* /locations/* /features/*`. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask of fields to update. - * @param {google.cloud.gkehub.v1alpha.Feature} request.resource - * Only fields specified in update_mask are updated. - * If you specify a field in the update_mask but don't specify its value here - * that field will be deleted. - * If you are updating a map field, set the value of a key to null or empty - * string to delete the key from the map. It's not possible to update a key's - * value to the empty string. - * If you specify the update_mask to be a special path "*", fully replaces all - * user-modifiable fields to match `resource`. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/gke_hub.update_feature.js - * region_tag:gkehub_v1alpha_generated_GkeHub_UpdateFeature_async - */ - updateFeature( - request?: protos.google.cloud.gkehub.v1alpha.IUpdateFeatureRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateFeature( - request: protos.google.cloud.gkehub.v1alpha.IUpdateFeatureRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFeature( - request: protos.google.cloud.gkehub.v1alpha.IUpdateFeatureRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFeature( - request?: protos.google.cloud.gkehub.v1alpha.IUpdateFeatureRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFeature(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateFeature()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/gke_hub.update_feature.js - * region_tag:gkehub_v1alpha_generated_GkeHub_UpdateFeature_async - */ - async checkUpdateFeatureProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFeature, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Features in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent (project and location) where the Features will be listed. - * Specified in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * When requesting a 'page' of resources, `page_size` specifies number of - * resources to return. If unspecified or set to 0, all resources will - * be returned. - * @param {string} request.pageToken - * Token returned by previous call to `ListFeatures` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} request.filter - * Lists Features that match the filter expression, following the syntax - * outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Feature with the name "servicemesh" in project "foo-proj": - * - * name = "projects/foo-proj/locations/global/features/servicemesh" - * - * - Features that have a label called `foo`: - * - * labels.foo:* - * - * - Features that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * @param {string} request.orderBy - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1alpha.Feature|Feature}. - * 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 `listFeaturesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFeatures( - request?: protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1alpha.IFeature[], - protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest|null, - protos.google.cloud.gkehub.v1alpha.IListFeaturesResponse - ]>; - listFeatures( - request: protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, - protos.google.cloud.gkehub.v1alpha.IListFeaturesResponse|null|undefined, - protos.google.cloud.gkehub.v1alpha.IFeature>): void; - listFeatures( - request: protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, - callback: PaginationCallback< - protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, - protos.google.cloud.gkehub.v1alpha.IListFeaturesResponse|null|undefined, - protos.google.cloud.gkehub.v1alpha.IFeature>): void; - listFeatures( - request?: protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, - protos.google.cloud.gkehub.v1alpha.IListFeaturesResponse|null|undefined, - protos.google.cloud.gkehub.v1alpha.IFeature>, - callback?: PaginationCallback< - protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, - protos.google.cloud.gkehub.v1alpha.IListFeaturesResponse|null|undefined, - protos.google.cloud.gkehub.v1alpha.IFeature>): - Promise<[ - protos.google.cloud.gkehub.v1alpha.IFeature[], - protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest|null, - protos.google.cloud.gkehub.v1alpha.IListFeaturesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listFeatures(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 - * The parent (project and location) where the Features will be listed. - * Specified in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * When requesting a 'page' of resources, `page_size` specifies number of - * resources to return. If unspecified or set to 0, all resources will - * be returned. - * @param {string} request.pageToken - * Token returned by previous call to `ListFeatures` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} request.filter - * Lists Features that match the filter expression, following the syntax - * outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Feature with the name "servicemesh" in project "foo-proj": - * - * name = "projects/foo-proj/locations/global/features/servicemesh" - * - * - Features that have a label called `foo`: - * - * labels.foo:* - * - * - Features that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * @param {string} request.orderBy - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 protos.google.cloud.gkehub.v1alpha.Feature|Feature} 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 `listFeaturesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFeaturesStream( - request?: protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, - 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['listFeatures']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFeatures.createStream( - this.innerApiCalls.listFeatures as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFeatures`, 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 - * The parent (project and location) where the Features will be listed. - * Specified in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * When requesting a 'page' of resources, `page_size` specifies number of - * resources to return. If unspecified or set to 0, all resources will - * be returned. - * @param {string} request.pageToken - * Token returned by previous call to `ListFeatures` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} request.filter - * Lists Features that match the filter expression, following the syntax - * outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Feature with the name "servicemesh" in project "foo-proj": - * - * name = "projects/foo-proj/locations/global/features/servicemesh" - * - * - Features that have a label called `foo`: - * - * labels.foo:* - * - * - Features that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * @param {string} request.orderBy - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkehub.v1alpha.Feature|Feature}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/gke_hub.list_features.js - * region_tag:gkehub_v1alpha_generated_GkeHub_ListFeatures_async - */ - listFeaturesAsync( - request?: protos.google.cloud.gkehub.v1alpha.IListFeaturesRequest, - 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['listFeatures']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFeatures.asyncIterate( - this.innerApiCalls['listFeatures'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified feature resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} feature - * @returns {string} Resource name string. - */ - featurePath(project:string,location:string,feature:string) { - return this.pathTemplates.featurePathTemplate.render({ - project: project, - location: location, - feature: feature, - }); - } - - /** - * Parse the project from Feature resource. - * - * @param {string} featureName - * A fully-qualified path representing Feature resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFeatureName(featureName: string) { - return this.pathTemplates.featurePathTemplate.match(featureName).project; - } - - /** - * Parse the location from Feature resource. - * - * @param {string} featureName - * A fully-qualified path representing Feature resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFeatureName(featureName: string) { - return this.pathTemplates.featurePathTemplate.match(featureName).location; - } - - /** - * Parse the feature from Feature resource. - * - * @param {string} featureName - * A fully-qualified path representing Feature resource. - * @returns {string} A string representing the feature. - */ - matchFeatureFromFeatureName(featureName: string) { - return this.pathTemplates.featurePathTemplate.match(featureName).feature; - } - - /** - * 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.gkeHubStub && !this._terminated) { - return this.gkeHubStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_client_config.json b/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_client_config.json deleted file mode 100644 index d972b7a4a13..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_client_config.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "interfaces": { - "google.cloud.gkehub.v1alpha.GkeHub": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListFeatures": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetFeature": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateFeature": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteFeature": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UpdateFeature": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_proto_list.json b/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_proto_list.json deleted file mode 100644 index 4b8b6202159..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/gke_hub_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/cloud/gkehub/v1alpha/cloudauditlogging/cloudauditlogging.proto", - "../../protos/google/cloud/gkehub/v1alpha/configmanagement/configmanagement.proto", - "../../protos/google/cloud/gkehub/v1alpha/feature.proto", - "../../protos/google/cloud/gkehub/v1alpha/metering/metering.proto", - "../../protos/google/cloud/gkehub/v1alpha/multiclusteringress/multiclusteringress.proto", - "../../protos/google/cloud/gkehub/v1alpha/service.proto", - "../../protos/google/cloud/gkehub/v1alpha/servicemesh/servicemesh.proto" -] diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/index.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/index.ts deleted file mode 100644 index aaf819215ae..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/src/v1alpha/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 {GkeHubClient} from './gke_hub_client'; diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 723143457a0..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/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 gkehub = require('@google-cloud/gke-hub'); - -function main() { - const gkeHubClient = new gkehub.GkeHubClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 832fe8321c7..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/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 {GkeHubClient} from '@google-cloud/gke-hub'; - -// check that the client class type name can be used -function doStuffWithGkeHubClient(client: GkeHubClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const gkeHubClient = new GkeHubClient(); - doStuffWithGkeHubClient(gkeHubClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/install.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/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-gkehub/v1alpha/test/gapic_gke_hub_v1alpha.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha/test/gapic_gke_hub_v1alpha.ts deleted file mode 100644 index 3bc8ea391b4..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/test/gapic_gke_hub_v1alpha.ts +++ /dev/null @@ -1,1077 +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 gkehubModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1alpha.GkeHubClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = gkehubModule.v1alpha.GkeHubClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = gkehubModule.v1alpha.GkeHubClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = gkehubModule.v1alpha.GkeHubClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new gkehubModule.v1alpha.GkeHubClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.gkeHubStub, undefined); - await client.initialize(); - assert(client.gkeHubStub); - }); - - it('has close method for the initialized client', done => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.gkeHubStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.gkeHubStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new gkehubModule.v1alpha.GkeHubClient({ - 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 gkehubModule.v1alpha.GkeHubClient({ - 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('getFeature', () => { - it('invokes getFeature without error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.GetFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.GetFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.Feature() - ); - client.innerApiCalls.getFeature = stubSimpleCall(expectedResponse); - const [response] = await client.getFeature(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeature without error using callback', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.GetFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.GetFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.Feature() - ); - client.innerApiCalls.getFeature = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFeature( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1alpha.IFeature|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeature with error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.GetFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.GetFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFeature = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFeature(request), expectedError); - const actualRequest = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeature with closed client', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.GetFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.GetFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFeature(request), expectedError); - }); - }); - - describe('createFeature', () => { - it('invokes createFeature without error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.CreateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.CreateFeatureRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFeature = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFeature(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeature without error using callback', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.CreateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.CreateFeatureRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFeature = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFeature( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeature with call error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.CreateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.CreateFeatureRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFeature = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFeature(request), expectedError); - const actualRequest = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeature with LRO error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.CreateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.CreateFeatureRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFeature = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFeature(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateFeatureProgress without error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateFeatureProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateFeatureProgress with error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFeatureProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteFeature', () => { - it('invokes deleteFeature without error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.DeleteFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.DeleteFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFeature = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFeature(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeature without error using callback', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.DeleteFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.DeleteFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFeature = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFeature( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeature with call error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.DeleteFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.DeleteFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFeature = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFeature(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeature with LRO error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.DeleteFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.DeleteFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFeature = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFeature(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteFeatureProgress without error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteFeatureProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteFeatureProgress with error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFeatureProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateFeature', () => { - it('invokes updateFeature without error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.UpdateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.UpdateFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFeature = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFeature(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeature without error using callback', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.UpdateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.UpdateFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFeature = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFeature( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeature with call error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.UpdateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.UpdateFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFeature = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFeature(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeature with LRO error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.UpdateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.UpdateFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFeature = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFeature(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateFeatureProgress without error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateFeatureProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateFeatureProgress with error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFeatureProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listFeatures', () => { - it('invokes listFeatures without error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), - ]; - client.innerApiCalls.listFeatures = stubSimpleCall(expectedResponse); - const [response] = await client.listFeatures(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeatures without error using callback', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), - ]; - client.innerApiCalls.listFeatures = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFeatures( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1alpha.IFeature[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeatures with error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFeatures = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFeatures(request), expectedError); - const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeaturesStream without error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), - ]; - client.descriptors.page.listFeatures.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFeaturesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkehub.v1alpha.Feature[] = []; - stream.on('data', (response: protos.google.cloud.gkehub.v1alpha.Feature) => { - 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.listFeatures.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFeatures, request)); - assert( - (client.descriptors.page.listFeatures.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFeaturesStream with error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFeatures.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFeaturesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkehub.v1alpha.Feature[] = []; - stream.on('data', (response: protos.google.cloud.gkehub.v1alpha.Feature) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFeatures.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFeatures, request)); - assert( - (client.descriptors.page.listFeatures.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFeatures without error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha.Feature()), - ]; - client.descriptors.page.listFeatures.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkehub.v1alpha.IFeature[] = []; - const iterable = client.listFeaturesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFeatures.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFeatures.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFeatures with error', async () => { - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFeatures.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFeaturesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkehub.v1alpha.IFeature[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFeatures.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFeatures.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('feature', () => { - const fakePath = "/rendered/path/feature"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - feature: "featureValue", - }; - const client = new gkehubModule.v1alpha.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.featurePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.featurePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('featurePath', () => { - const result = client.featurePath("projectValue", "locationValue", "featureValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.featurePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFeatureName', () => { - const result = client.matchProjectFromFeatureName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.featurePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFeatureName', () => { - const result = client.matchLocationFromFeatureName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.featurePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFeatureFromFeatureName', () => { - const result = client.matchFeatureFromFeatureName(fakePath); - assert.strictEqual(result, "featureValue"); - assert((client.pathTemplates.featurePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha/tsconfig.json b/owl-bot-staging/google-cloud-gkehub/v1alpha/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/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-gkehub/v1alpha/webpack.config.js b/owl-bot-staging/google-cloud-gkehub/v1alpha/webpack.config.js deleted file mode 100644 index 71afa3a607d..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha/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: 'GkeHub', - filename: './gke-hub.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-gkehub/v1alpha2/.eslintignore b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/.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-gkehub/v1alpha2/.eslintrc.json b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/.gitignore b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/.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-gkehub/v1alpha2/.jsdoc.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.jsdoc.js deleted file mode 100644 index b83282dcebb..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/.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/gke-hub', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/.mocharc.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/.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-gkehub/v1alpha2/.prettierrc.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/.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-gkehub/v1alpha2/README.md b/owl-bot-staging/google-cloud-gkehub/v1alpha2/README.md deleted file mode 100644 index f922950c787..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/README.md +++ /dev/null @@ -1 +0,0 @@ -Gkehub: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/package.json b/owl-bot-staging/google-cloud-gkehub/v1alpha2/package.json deleted file mode 100644 index 25f7a0fc625..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/gke-hub", - "version": "0.1.0", - "description": "Gkehub client for Node.js", - "repository": "googleapis/nodejs-gkehub", - "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 gkehub", - "gkehub", - "gke hub" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/protos/google/cloud/gkehub/v1alpha2/membership.proto b/owl-bot-staging/google-cloud-gkehub/v1alpha2/protos/google/cloud/gkehub/v1alpha2/membership.proto deleted file mode 100644 index 1256ae45e8f..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/protos/google/cloud/gkehub/v1alpha2/membership.proto +++ /dev/null @@ -1,713 +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.gkehub.v1alpha2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeHub.V1Alpha2"; -option go_package = "cloud.google.com/go/gkehub/apiv1alpha2/gkehubpb;gkehubpb"; -option java_multiple_files = true; -option java_outer_classname = "MembershipProto"; -option java_package = "com.google.cloud.gkehub.v1alpha2"; -option php_namespace = "Google\\Cloud\\GkeHub\\V1alpha2"; -option ruby_package = "Google::Cloud::GkeHub::V1alpha2"; - -// The GKE Hub service handles the registration of many Kubernetes -// clusters to Google Cloud, represented with the [Membership][google.cloud.gkehub.v1alpha2.Membership] resource. -// -// GKE Hub is currently only available in the global region. -// -// **Membership management may be non-trivial:** it is recommended to use one -// of the Google-provided client libraries or tools where possible when working -// with Membership resources. -service GkeHub { - option (google.api.default_host) = "gkehub.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists Memberships in a given project and location. - rpc ListMemberships(ListMembershipsRequest) returns (ListMembershipsResponse) { - option (google.api.http) = { - get: "/v1alpha2/{parent=projects/*/locations/*}/memberships" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a Membership. - rpc GetMembership(GetMembershipRequest) returns (Membership) { - option (google.api.http) = { - get: "/v1alpha2/{name=projects/*/locations/*/memberships/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new Membership. - // - // **This is currently only supported for GKE clusters on Google Cloud**. - // To register other clusters, follow the instructions at - // https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster. - rpc CreateMembership(CreateMembershipRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha2/{parent=projects/*/locations/*}/memberships" - body: "resource" - }; - option (google.api.method_signature) = "parent,resource,membership_id"; - option (google.longrunning.operation_info) = { - response_type: "Membership" - metadata_type: "OperationMetadata" - }; - } - - // Removes a Membership. - // - // **This is currently only supported for GKE clusters on Google Cloud**. - // To unregister other clusters, follow the instructions at - // https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. - rpc DeleteMembership(DeleteMembershipRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1alpha2/{name=projects/*/locations/*/memberships/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Updates an existing Membership. - rpc UpdateMembership(UpdateMembershipRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1alpha2/{name=projects/*/locations/*/memberships/*}" - body: "resource" - }; - option (google.api.method_signature) = "name,resource,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Membership" - metadata_type: "OperationMetadata" - }; - } - - // Generates the manifest for deployment of the GKE connect agent. - // - // **This method is used internally by Google-provided libraries.** - // Most clients should not need to call this method directly. - rpc GenerateConnectManifest(GenerateConnectManifestRequest) returns (GenerateConnectManifestResponse) { - option (google.api.http) = { - get: "/v1alpha2/{name=projects/*/locations/*/memberships/*}:generateConnectManifest" - }; - } - - // Initializes the Hub in this project, which includes creating the default - // Hub Service Account and the Hub Workload Identity Pool. Initialization is - // optional, and happens automatically when the first Membership is created. - // - // InitializeHub should be called when the first Membership cannot be - // registered without these resources. A common example is granting the Hub - // Service Account access to another project, which requires the account to - // exist first. - rpc InitializeHub(InitializeHubRequest) returns (InitializeHubResponse) { - option (google.api.http) = { - post: "/v1alpha2/{project=projects/*/locations/global/memberships}:initializeHub" - body: "*" - }; - } -} - -// Membership contains information about a member cluster. -message Membership { - option (google.api.resource) = { - type: "gkehub.googleapis.com/Membership" - pattern: "projects/{project}/locations/{location}/memberships/{membership}" - }; - - // Specifies the infrastructure type of a Membership. Infrastructure type is - // used by Hub to control infrastructure-specific behavior, including pricing. - // - // Each GKE distribution (on-GCP, on-Prem, on-X,...) will set this field - // automatically, but Attached Clusters customers should specify a type - // during registration. - enum InfrastructureType { - // No type was specified. Some Hub functionality may require a type be - // specified, and will not support Memberships with this value. - INFRASTRUCTURE_TYPE_UNSPECIFIED = 0; - - // Private infrastructure that is owned or operated by customer. This - // includes GKE distributions such as GKE-OnPrem and GKE-OnBareMetal. - ON_PREM = 1; - - // Public cloud infrastructure. - MULTI_CLOUD = 2; - } - - // Output only. The full, unique name of this Membership resource in the format - // `projects/*/locations/*/memberships/{membership_id}`, set during creation. - // - // `membership_id` must be a valid RFC 1123 compliant DNS label: - // - // 1. At most 63 characters in length - // 2. It must consist of lower case alphanumeric characters or `-` - // 3. It must start and end with an alphanumeric character - // - // Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, - // with a maximum length of 63 characters. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. GCP labels for this membership. - map labels = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Description of this membership, limited to 63 characters. - // Must match the regex: `[a-zA-Z0-9][a-zA-Z0-9_\-\.\ ]*` - // - // This field is present for legacy purposes. - string description = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Type of resource represented by this Membership - oneof type { - // Optional. Endpoint information to reach this member. - MembershipEndpoint endpoint = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // Output only. State of the Membership resource. - MembershipState state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the Membership was created. - google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the Membership was last updated. - google.protobuf.Timestamp update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the Membership was deleted. - google.protobuf.Timestamp delete_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. An externally-generated and managed ID for this Membership. This ID may - // be modified after creation, but this is not recommended. For GKE clusters, - // external_id is managed by the Hub API and updates will be ignored. - // - // The ID must match the regex: `[a-zA-Z0-9][a-zA-Z0-9_\-\.]*` - // - // If this Membership represents a Kubernetes cluster, this value should be - // set to the UID of the `kube-system` namespace object. - string external_id = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. How to identify workloads from this Membership. - // See the documentation on Workload Identity for more details: - // https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity - Authority authority = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. For clusters using Connect, the timestamp of the most recent connection - // established with Google Cloud. This time is updated every several minutes, - // not continuously. For clusters that do not use GKE Connect, or that have - // never connected successfully, this field will be unset. - google.protobuf.Timestamp last_connection_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Google-generated UUID for this resource. This is unique across all - // Membership resources. If a Membership resource is deleted and another - // resource with the same name is created, it gets a different unique_id. - string unique_id = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The infrastructure type this Membership is running on. - InfrastructureType infrastructure_type = 13 [(google.api.field_behavior) = OPTIONAL]; -} - -// MembershipEndpoint contains information needed to contact a Kubernetes API, -// endpoint and any additional Kubernetes metadata. -message MembershipEndpoint { - // Cluster information of the registered cluster. - oneof type { - // Optional. Specific information for a GKE-on-GCP cluster. - GkeCluster gke_cluster = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specific information for a GKE On-Prem cluster. - OnPremCluster on_prem_cluster = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specific information for a GKE Multi-Cloud cluster. - MultiCloudCluster multi_cloud_cluster = 5 [(google.api.field_behavior) = OPTIONAL]; - } - - // Output only. Useful Kubernetes-specific metadata. - KubernetesMetadata kubernetes_metadata = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The in-cluster Kubernetes Resources that should be applied for a correctly - // registered cluster, in the steady state. These resources: - // - // * Ensure that the cluster is exclusively registered to one and only one - // Hub Membership. - // * Propagate Workload Pool Information available in the Membership - // Authority field. - // * Ensure proper initial configuration of default Hub Features. - KubernetesResource kubernetes_resource = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// KubernetesResource contains the YAML manifests and configuration for -// Membership Kubernetes resources in the cluster. After CreateMembership or -// UpdateMembership, these resources should be re-applied in the cluster. -message KubernetesResource { - // Input only. The YAML representation of the Membership CR. This field is ignored for GKE - // clusters where Hub can read the CR directly. - // - // Callers should provide the CR that is currently present in the cluster - // during Create or Update, or leave this field empty if none exists. The CR - // manifest is used to validate the cluster has not been registered with - // another Membership. - string membership_cr_manifest = 1 [(google.api.field_behavior) = INPUT_ONLY]; - - // Output only. Additional Kubernetes resources that need to be applied to the cluster - // after Membership creation, and after every update. - // - // This field is only populated in the Membership returned from a successful - // long-running operation from CreateMembership or UpdateMembership. It is not - // populated during normal GetMembership or ListMemberships requests. To get - // the resource manifest after the initial registration, the caller should - // make a UpdateMembership call with an empty field mask. - repeated ResourceManifest membership_resources = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The Kubernetes resources for installing the GKE Connect agent. - // - // This field is only populated in the Membership returned from a successful - // long-running operation from CreateMembership or UpdateMembership. It is not - // populated during normal GetMembership or ListMemberships requests. To get - // the resource manifest after the initial registration, the caller should - // make a UpdateMembership call with an empty field mask. - repeated ResourceManifest connect_resources = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Options for Kubernetes resource generation. - ResourceOptions resource_options = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// ResourceOptions represent options for Kubernetes resource generation. -message ResourceOptions { - // Optional. The Connect agent version to use for connect_resources. Defaults to the - // latest GKE Connect version. The version must be a currently supported - // version, obsolete versions will be rejected. - string connect_version = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Use `apiextensions/v1beta1` instead of `apiextensions/v1` for - // CustomResourceDefinition resources. - // This option should be set for clusters with Kubernetes apiserver versions - // <1.16. - bool v1beta1_crd = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Major version of the Kubernetes cluster. This is only used to determine - // which version to use for the CustomResourceDefinition resources, - // `apiextensions/v1beta1` or`apiextensions/v1`. - string k8s_version = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// GkeCluster contains information specific to GKE clusters. -message GkeCluster { - // Immutable. Self-link of the GCP resource for the GKE cluster. For example: - // - // //container.googleapis.com/projects/my-project/locations/us-west1-a/clusters/my-cluster - // - // Zonal clusters are also supported. - string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. If cluster_missing is set then it denotes that the GKE cluster no longer - // exists in the GKE Control Plane. - bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// OnPremCluster contains information specific to GKE On-Prem clusters. -message OnPremCluster { - // Immutable. Self-link of the GCP resource for the GKE On-Prem cluster. For example: - // - // //gkeonprem.googleapis.com/projects/my-project/locations/us-west1-a/vmwareClusters/my-cluster - // //gkeonprem.googleapis.com/projects/my-project/locations/us-west1-a/bareMetalClusters/my-cluster - string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. If cluster_missing is set then it denotes that - // API(gkeonprem.googleapis.com) resource for this GKE On-Prem cluster no - // longer exists. - bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Immutable. Whether the cluster is an admin cluster. - bool admin_cluster = 3 [(google.api.field_behavior) = IMMUTABLE]; -} - -// MultiCloudCluster contains information specific to GKE Multi-Cloud clusters. -message MultiCloudCluster { - // Immutable. Self-link of the GCP resource for the GKE Multi-Cloud cluster. For - // example: - // - // //gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/awsClusters/my-cluster - // //gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/azureClusters/my-cluster - string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. If cluster_missing is set then it denotes that - // API(gkemulticloud.googleapis.com) resource for this GKE Multi-Cloud cluster - // no longer exists. - bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// KubernetesMetadata provides informational metadata for Memberships -// that are created from Kubernetes Endpoints (currently, these are equivalent -// to Kubernetes clusters). -message KubernetesMetadata { - // Output only. Kubernetes API server version string as reported by '/version'. - string kubernetes_api_server_version = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Node providerID as reported by the first node in the list of nodes on - // the Kubernetes endpoint. On Kubernetes platforms that support zero-node - // clusters (like GKE-on-GCP), the node_count will be zero and the - // node_provider_id will be empty. - string node_provider_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Node count as reported by Kubernetes nodes resources. - int32 node_count = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. vCPU count as reported by Kubernetes nodes resources. - int32 vcpu_count = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The total memory capacity as reported by the sum of all Kubernetes nodes - // resources, defined in MB. - int32 memory_mb = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which these details were last updated. This update_time is - // different from the Membership-level update_time since EndpointDetails are - // updated internally for API consumers. - google.protobuf.Timestamp update_time = 100 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Authority encodes how Google will recognize identities from this Membership. -// See the workload identity documentation for more details: -// https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity -message Authority { - // Optional. A JSON Web Token (JWT) issuer URI. `issuer` must start with `https://` and - // be a valid URL with length <2000 characters. - // - // If set, then Google will allow valid OIDC tokens from this issuer to - // authenticate within the workload_identity_pool. OIDC discovery will be - // performed on this URI to validate tokens from the issuer, unless - // `oidc_jwks` is set. - // - // Clearing `issuer` disables Workload Identity. `issuer` cannot be directly - // modified; it must be cleared (and Workload Identity disabled) before using - // a new issuer (and re-enabling Workload Identity). - string issuer = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. OIDC verification keys for this Membership in JWKS format (RFC 7517). - // - // When this field is set, OIDC discovery will NOT be performed on `issuer`, - // and instead OIDC tokens will be validated using this field. - bytes oidc_jwks = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. An identity provider that reflects the `issuer` in the workload identity - // pool. - string identity_provider = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The name of the workload identity pool in which `issuer` will be - // recognized. - // - // There is a single Workload Identity Pool per Hub that is shared - // between all Memberships that belong to that Hub. For a Hub hosted in - // {PROJECT_ID}, the workload pool format is `{PROJECT_ID}.hub.id.goog`, - // although this is subject to change in newer versions of this API. - string workload_identity_pool = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// MembershipState describes the state of a Membership resource. -message MembershipState { - // Code describes the state of a Membership resource. - enum Code { - // The code is not set. - CODE_UNSPECIFIED = 0; - - // The cluster is being registered. - CREATING = 1; - - // The cluster is registered. - READY = 2; - - // The cluster is being unregistered. - DELETING = 3; - - // The Membership is being updated. - UPDATING = 4; - - // The Membership is being updated by the Hub Service. - SERVICE_UPDATING = 5; - } - - // Output only. The current state of the Membership resource. - Code code = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request message for `GkeHub.ListMemberships` method. -message ListMembershipsRequest { - // Required. The parent (project and location) where the Memberships will be listed. - // Specified in the format `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkehub.googleapis.com/Membership" - } - ]; - - // Optional. When requesting a 'page' of resources, `page_size` specifies number of - // resources to return. If unspecified or set to 0, all resources will - // be returned. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Token returned by previous call to `ListMemberships` which - // specifies the position in the list from where to continue listing the - // resources. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Lists Memberships that match the filter expression, following the syntax - // outlined in https://google.aip.dev/160. - // - // Examples: - // - // - Name is `bar` in project `foo-proj` and location `global`: - // - // name = "projects/foo-proj/locations/global/membership/bar" - // - // - Memberships that have a label called `foo`: - // - // labels.foo:* - // - // - Memberships that have a label called `foo` whose value is `bar`: - // - // labels.foo = bar - // - // - Memberships in the CREATING state: - // - // state = CREATING - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. One or more fields to compare and use to sort the output. - // See https://google.aip.dev/132#ordering. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for the `GkeHub.ListMemberships` method. -message ListMembershipsResponse { - // The list of matching Memberships. - repeated Membership resources = 1; - - // A token to request the next page of resources from the - // `ListMemberships` method. The value of an empty string means that - // there are no more resources to return. - string next_page_token = 2; - - // List of locations that could not be reached while fetching this list. - repeated string unreachable = 3; -} - -// Request message for `GkeHub.GetMembership` method. -message GetMembershipRequest { - // Required. The Membership resource name in the format - // `projects/*/locations/*/memberships/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkehub.googleapis.com/Membership" - } - ]; -} - -// Request message for the `GkeHub.CreateMembership` method. -message CreateMembershipRequest { - // Required. The parent (project and location) where the Memberships will be created. - // Specified in the format `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkehub.googleapis.com/Membership" - } - ]; - - // Required. Client chosen ID for the membership. `membership_id` must be a valid RFC - // 1123 compliant DNS label: - // - // 1. At most 63 characters in length - // 2. It must consist of lower case alphanumeric characters or `-` - // 3. It must start and end with an alphanumeric character - // - // Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, - // with a maximum length of 63 characters. - string membership_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The membership to create. - Membership resource = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for `GkeHub.DeleteMembership` method. -message DeleteMembershipRequest { - // Required. The Membership resource name in the format - // `projects/*/locations/*/memberships/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkehub.googleapis.com/Membership" - } - ]; -} - -// Request message for `GkeHub.UpdateMembership` method. -message UpdateMembershipRequest { - // Required. The Membership resource name in the format - // `projects/*/locations/*/memberships/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED]; - - // Required. Mask of fields to update. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Only fields specified in update_mask are updated. - // If you specify a field in the update_mask but don't specify its value here - // that field will be deleted. - // If you are updating a map field, set the value of a key to null or empty - // string to delete the key from the map. It's not possible to update a key's - // value to the empty string. - // If you specify the update_mask to be a special path "*", fully replaces all - // user-modifiable fields to match `resource`. - Membership resource = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for `GkeHub.GenerateConnectManifest` -// method. -// . -message GenerateConnectManifestRequest { - // Required. The Membership resource name the Agent will associate with, in the format - // `projects/*/locations/*/memberships/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED]; - - // Optional. Namespace for GKE Connect agent resources. Defaults to `gke-connect`. - // - // The Connect Agent is authorized automatically when run in the default - // namespace. Otherwise, explicit authorization must be granted with an - // additional IAM binding. - string namespace = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. URI of a proxy if connectivity from the agent to gkeconnect.googleapis.com - // requires the use of a proxy. Format must be in the form - // `http(s)://{proxy_address}`, depending on the HTTP/HTTPS protocol - // supported by the proxy. This will direct the connect agent's outbound - // traffic through a HTTP(S) proxy. - bytes proxy = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Connect agent version to use. Defaults to the most current version. - string version = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true, generate the resources for upgrade only. Some resources - // generated only for installation (e.g. secrets) will be excluded. - bool is_upgrade = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The registry to fetch the connect agent image from. Defaults to - // gcr.io/gkeconnect. - string registry = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The image pull secret content for the registry, if not public. - bytes image_pull_secret_content = 7 [(google.api.field_behavior) = OPTIONAL]; -} - -// GenerateConnectManifestResponse contains manifest information for -// installing/upgrading a Connect agent. -message GenerateConnectManifestResponse { - // The ordered list of Kubernetes resources that need to be applied to the - // cluster for GKE Connect agent installation/upgrade. - repeated ConnectAgentResource manifest = 1; -} - -// ConnectAgentResource represents a Kubernetes resource manifest for Connect -// Agent deployment. -message ConnectAgentResource { - // Kubernetes type of the resource. - TypeMeta type = 1; - - // YAML manifest of the resource. - string manifest = 2; -} - -// ResourceManifest represents a single Kubernetes resource to be applied to -// the cluster. -message ResourceManifest { - // YAML manifest of the resource. - string manifest = 1; - - // Whether the resource provided in the manifest is `cluster_scoped`. - // If unset, the manifest is assumed to be namespace scoped. - // - // This field is used for REST mapping when applying the resource in a - // cluster. - bool cluster_scoped = 2; -} - -// TypeMeta is the type information needed for content unmarshalling of -// Kubernetes resources in the manifest. -message TypeMeta { - // Kind of the resource (e.g. Deployment). - string kind = 1; - - // APIVersion of the resource (e.g. v1). - string api_version = 2; -} - -// Request message for the InitializeHub method. -message InitializeHubRequest { - // Required. The Hub to initialize, in the format - // `projects/*/locations/*/memberships/*`. - string project = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for the InitializeHub method. -message InitializeHubResponse { - // Name of the Hub default service identity, in the format: - // - // service-@gcp-sa-gkehub.iam.gserviceaccount.com - // - // The service account has `roles/gkehub.serviceAgent` in the Hub project. - string service_identity = 1; - - // The Workload Identity Pool used for Workload Identity-enabled clusters - // registered with this Hub. Format: `.hub.id.goog` - string workload_identity_pool = 2; -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_detail = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.create_membership.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.create_membership.js deleted file mode 100644 index b377d1c1c2a..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.create_membership.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, membershipId, resource) { - // [START gkehub_v1alpha2_generated_GkeHub_CreateMembership_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 parent (project and location) where the Memberships will be created. - * Specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Required. Client chosen ID for the membership. `membership_id` must be a valid RFC - * 1123 compliant DNS label: - * 1. At most 63 characters in length - * 2. It must consist of lower case alphanumeric characters or `-` - * 3. It must start and end with an alphanumeric character - * Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, - * with a maximum length of 63 characters. - */ - // const membershipId = 'abc123' - /** - * Required. The membership to create. - */ - // const resource = {} - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha2; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callCreateMembership() { - // Construct request - const request = { - parent, - membershipId, - resource, - }; - - // Run request - const [operation] = await gkehubClient.createMembership(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateMembership(); - // [END gkehub_v1alpha2_generated_GkeHub_CreateMembership_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-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.delete_membership.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.delete_membership.js deleted file mode 100644 index f432295dd1c..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.delete_membership.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 gkehub_v1alpha2_generated_GkeHub_DeleteMembership_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 Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - */ - // const name = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha2; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callDeleteMembership() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await gkehubClient.deleteMembership(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteMembership(); - // [END gkehub_v1alpha2_generated_GkeHub_DeleteMembership_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-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.generate_connect_manifest.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.generate_connect_manifest.js deleted file mode 100644 index 302d3ab69f5..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.generate_connect_manifest.js +++ /dev/null @@ -1,95 +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 gkehub_v1alpha2_generated_GkeHub_GenerateConnectManifest_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 Membership resource name the Agent will associate with, in the format - * `projects/* /locations/* /memberships/*`. - */ - // const name = 'abc123' - /** - * Optional. Namespace for GKE Connect agent resources. Defaults to `gke-connect`. - * The Connect Agent is authorized automatically when run in the default - * namespace. Otherwise, explicit authorization must be granted with an - * additional IAM binding. - */ - // const namespace = 'abc123' - /** - * Optional. URI of a proxy if connectivity from the agent to gkeconnect.googleapis.com - * requires the use of a proxy. Format must be in the form - * `http(s)://{proxy_address}`, depending on the HTTP/HTTPS protocol - * supported by the proxy. This will direct the connect agent's outbound - * traffic through a HTTP(S) proxy. - */ - // const proxy = Buffer.from('string') - /** - * Optional. The Connect agent version to use. Defaults to the most current version. - */ - // const version = 'abc123' - /** - * Optional. If true, generate the resources for upgrade only. Some resources - * generated only for installation (e.g. secrets) will be excluded. - */ - // const isUpgrade = true - /** - * Optional. The registry to fetch the connect agent image from. Defaults to - * gcr.io/gkeconnect. - */ - // const registry = 'abc123' - /** - * Optional. The image pull secret content for the registry, if not public. - */ - // const imagePullSecretContent = Buffer.from('string') - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha2; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callGenerateConnectManifest() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkehubClient.generateConnectManifest(request); - console.log(response); - } - - callGenerateConnectManifest(); - // [END gkehub_v1alpha2_generated_GkeHub_GenerateConnectManifest_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-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.get_membership.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.get_membership.js deleted file mode 100644 index 309d05ae5cf..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.get_membership.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 gkehub_v1alpha2_generated_GkeHub_GetMembership_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 Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - */ - // const name = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha2; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callGetMembership() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkehubClient.getMembership(request); - console.log(response); - } - - callGetMembership(); - // [END gkehub_v1alpha2_generated_GkeHub_GetMembership_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-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.initialize_hub.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.initialize_hub.js deleted file mode 100644 index dc7bd56a719..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.initialize_hub.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(project) { - // [START gkehub_v1alpha2_generated_GkeHub_InitializeHub_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 Hub to initialize, in the format - * `projects/* /locations/* /memberships/*`. - */ - // const project = 'my-project' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha2; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callInitializeHub() { - // Construct request - const request = { - project, - }; - - // Run request - const response = await gkehubClient.initializeHub(request); - console.log(response); - } - - callInitializeHub(); - // [END gkehub_v1alpha2_generated_GkeHub_InitializeHub_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-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.list_memberships.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.list_memberships.js deleted file mode 100644 index d646b42d9c6..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.list_memberships.js +++ /dev/null @@ -1,95 +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 gkehub_v1alpha2_generated_GkeHub_ListMemberships_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 parent (project and location) where the Memberships will be listed. - * Specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Optional. When requesting a 'page' of resources, `page_size` specifies number of - * resources to return. If unspecified or set to 0, all resources will - * be returned. - */ - // const pageSize = 1234 - /** - * Optional. Token returned by previous call to `ListMemberships` which - * specifies the position in the list from where to continue listing the - * resources. - */ - // const pageToken = 'abc123' - /** - * Optional. Lists Memberships that match the filter expression, following the syntax - * outlined in https://google.aip.dev/160. - * Examples: - * - Name is `bar` in project `foo-proj` and location `global`: - * name = "projects/foo-proj/locations/global/membership/bar" - * - Memberships that have a label called `foo`: - * labels.foo:* - * - Memberships that have a label called `foo` whose value is `bar`: - * labels.foo = bar - * - Memberships in the CREATING state: - * state = CREATING - */ - // const filter = 'abc123' - /** - * Optional. One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - */ - // const orderBy = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha2; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callListMemberships() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await gkehubClient.listMembershipsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMemberships(); - // [END gkehub_v1alpha2_generated_GkeHub_ListMemberships_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-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.update_membership.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.update_membership.js deleted file mode 100644 index eb11d2ef91e..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/gke_hub.update_membership.js +++ /dev/null @@ -1,80 +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, updateMask, resource) { - // [START gkehub_v1alpha2_generated_GkeHub_UpdateMembership_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 Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - */ - // const name = 'abc123' - /** - * Required. Mask of fields to update. - */ - // const updateMask = {} - /** - * Required. Only fields specified in update_mask are updated. - * If you specify a field in the update_mask but don't specify its value here - * that field will be deleted. - * If you are updating a map field, set the value of a key to null or empty - * string to delete the key from the map. It's not possible to update a key's - * value to the empty string. - * If you specify the update_mask to be a special path "*", fully replaces all - * user-modifiable fields to match `resource`. - */ - // const resource = {} - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1alpha2; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callUpdateMembership() { - // Construct request - const request = { - name, - updateMask, - resource, - }; - - // Run request - const [operation] = await gkehubClient.updateMembership(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateMembership(); - // [END gkehub_v1alpha2_generated_GkeHub_UpdateMembership_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-gkehub/v1alpha2/samples/generated/v1alpha2/snippet_metadata_google.cloud.gkehub.v1alpha2.json b/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/snippet_metadata_google.cloud.gkehub.v1alpha2.json deleted file mode 100644 index 005ba9fbf95..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/samples/generated/v1alpha2/snippet_metadata_google.cloud.gkehub.v1alpha2.json +++ /dev/null @@ -1,351 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-gkehub", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.gkehub.v1alpha2", - "version": "v1alpha2" - } - ] - }, - "snippets": [ - { - "regionTag": "gkehub_v1alpha2_generated_GkeHub_ListMemberships_async", - "title": "GkeHub listMemberships Sample", - "origin": "API_DEFINITION", - "description": " Lists Memberships in a given project and location.", - "canonical": true, - "file": "gke_hub.list_memberships.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMemberships", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.ListMemberships", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkehub.v1alpha2.ListMembershipsResponse", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHubClient" - }, - "method": { - "shortName": "ListMemberships", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.ListMemberships", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1alpha2_generated_GkeHub_GetMembership_async", - "title": "GkeHub getMembership Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a Membership.", - "canonical": true, - "file": "gke_hub.get_membership.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetMembership", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.GetMembership", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkehub.v1alpha2.Membership", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHubClient" - }, - "method": { - "shortName": "GetMembership", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.GetMembership", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1alpha2_generated_GkeHub_CreateMembership_async", - "title": "GkeHub createMembership Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Membership. **This is currently only supported for GKE clusters on Google Cloud**. To register other clusters, follow the instructions at https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster.", - "canonical": true, - "file": "gke_hub.create_membership.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMembership", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.CreateMembership", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "membership_id", - "type": "TYPE_STRING" - }, - { - "name": "resource", - "type": ".google.cloud.gkehub.v1alpha2.Membership" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHubClient" - }, - "method": { - "shortName": "CreateMembership", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.CreateMembership", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1alpha2_generated_GkeHub_DeleteMembership_async", - "title": "GkeHub deleteMembership Sample", - "origin": "API_DEFINITION", - "description": " Removes a Membership. **This is currently only supported for GKE clusters on Google Cloud**. To unregister other clusters, follow the instructions at https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster.", - "canonical": true, - "file": "gke_hub.delete_membership.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteMembership", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.DeleteMembership", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHubClient" - }, - "method": { - "shortName": "DeleteMembership", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.DeleteMembership", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1alpha2_generated_GkeHub_UpdateMembership_async", - "title": "GkeHub updateMembership Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing Membership.", - "canonical": true, - "file": "gke_hub.update_membership.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateMembership", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.UpdateMembership", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "resource", - "type": ".google.cloud.gkehub.v1alpha2.Membership" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHubClient" - }, - "method": { - "shortName": "UpdateMembership", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.UpdateMembership", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1alpha2_generated_GkeHub_GenerateConnectManifest_async", - "title": "GkeHub generateConnectManifest Sample", - "origin": "API_DEFINITION", - "description": " Generates the manifest for deployment of the GKE connect agent. **This method is used internally by Google-provided libraries.** Most clients should not need to call this method directly.", - "canonical": true, - "file": "gke_hub.generate_connect_manifest.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateConnectManifest", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.GenerateConnectManifest", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "namespace", - "type": "TYPE_STRING" - }, - { - "name": "proxy", - "type": "TYPE_BYTES" - }, - { - "name": "version", - "type": "TYPE_STRING" - }, - { - "name": "is_upgrade", - "type": "TYPE_BOOL" - }, - { - "name": "registry", - "type": "TYPE_STRING" - }, - { - "name": "image_pull_secret_content", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.gkehub.v1alpha2.GenerateConnectManifestResponse", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHubClient" - }, - "method": { - "shortName": "GenerateConnectManifest", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.GenerateConnectManifest", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1alpha2_generated_GkeHub_InitializeHub_async", - "title": "GkeHub initializeHub Sample", - "origin": "API_DEFINITION", - "description": " Initializes the Hub in this project, which includes creating the default Hub Service Account and the Hub Workload Identity Pool. Initialization is optional, and happens automatically when the first Membership is created. InitializeHub should be called when the first Membership cannot be registered without these resources. A common example is granting the Hub Service Account access to another project, which requires the account to exist first.", - "canonical": true, - "file": "gke_hub.initialize_hub.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "InitializeHub", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.InitializeHub", - "async": true, - "parameters": [ - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkehub.v1alpha2.InitializeHubResponse", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHubClient" - }, - "method": { - "shortName": "InitializeHub", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub.InitializeHub", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1alpha2.GkeHub" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/index.ts deleted file mode 100644 index 5c4e8950527..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/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 v1alpha2 from './v1alpha2'; -const GkeHubClient = v1alpha2.GkeHubClient; -type GkeHubClient = v1alpha2.GkeHubClient; -export {v1alpha2, GkeHubClient}; -export default {v1alpha2, GkeHubClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gapic_metadata.json b/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gapic_metadata.json deleted file mode 100644 index 9a8c3d88ba8..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gapic_metadata.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.gkehub.v1alpha2", - "libraryPackage": "@google-cloud/gke-hub", - "services": { - "GkeHub": { - "clients": { - "grpc": { - "libraryClient": "GkeHubClient", - "rpcs": { - "GetMembership": { - "methods": [ - "getMembership" - ] - }, - "GenerateConnectManifest": { - "methods": [ - "generateConnectManifest" - ] - }, - "InitializeHub": { - "methods": [ - "initializeHub" - ] - }, - "CreateMembership": { - "methods": [ - "createMembership" - ] - }, - "DeleteMembership": { - "methods": [ - "deleteMembership" - ] - }, - "UpdateMembership": { - "methods": [ - "updateMembership" - ] - }, - "ListMemberships": { - "methods": [ - "listMemberships", - "listMembershipsStream", - "listMembershipsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "GkeHubClient", - "rpcs": { - "GetMembership": { - "methods": [ - "getMembership" - ] - }, - "GenerateConnectManifest": { - "methods": [ - "generateConnectManifest" - ] - }, - "InitializeHub": { - "methods": [ - "initializeHub" - ] - }, - "CreateMembership": { - "methods": [ - "createMembership" - ] - }, - "DeleteMembership": { - "methods": [ - "deleteMembership" - ] - }, - "UpdateMembership": { - "methods": [ - "updateMembership" - ] - }, - "ListMemberships": { - "methods": [ - "listMemberships", - "listMembershipsStream", - "listMembershipsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_client.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_client.ts deleted file mode 100644 index b7674e073d7..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_client.ts +++ /dev/null @@ -1,1296 +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, GrpcClientOptions, LROperation, 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/v1alpha2/gke_hub_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './gke_hub_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The GKE Hub service handles the registration of many Kubernetes - * clusters to Google Cloud, represented with the {@link protos.google.cloud.gkehub.v1alpha2.Membership|Membership} resource. - * - * GKE Hub is currently only available in the global region. - * - * **Membership management may be non-trivial:** it is recommended to use one - * of the Google-provided client libraries or tools where possible when working - * with Membership resources. - * @class - * @memberof v1alpha2 - */ -export class GkeHubClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - gkeHubStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of GkeHubClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 GkeHubClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof GkeHubClient; - 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 { - 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 = { - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - membershipPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/memberships/{membership}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - }; - - // 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 = { - listMemberships: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha2/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha2/{resource=projects/*/locations/*/memberships/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha2/{resource=projects/*/locations/*/memberships/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha2/{resource=projects/*/locations/*/memberships/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha2/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha2/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha2/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha2/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createMembershipResponse = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1alpha2.Membership') as gax.protobuf.Type; - const createMembershipMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1alpha2.OperationMetadata') as gax.protobuf.Type; - const deleteMembershipResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteMembershipMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1alpha2.OperationMetadata') as gax.protobuf.Type; - const updateMembershipResponse = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1alpha2.Membership') as gax.protobuf.Type; - const updateMembershipMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1alpha2.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createMembership: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createMembershipResponse.decode.bind(createMembershipResponse), - createMembershipMetadata.decode.bind(createMembershipMetadata)), - deleteMembership: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteMembershipResponse.decode.bind(deleteMembershipResponse), - deleteMembershipMetadata.decode.bind(deleteMembershipMetadata)), - updateMembership: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateMembershipResponse.decode.bind(updateMembershipResponse), - updateMembershipMetadata.decode.bind(updateMembershipMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.gkehub.v1alpha2.GkeHub', 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.gkeHubStub) { - return this.gkeHubStub; - } - - // Put together the "service stub" for - // google.cloud.gkehub.v1alpha2.GkeHub. - this.gkeHubStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.gkehub.v1alpha2.GkeHub') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.gkehub.v1alpha2.GkeHub, - 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 gkeHubStubMethods = - ['listMemberships', 'getMembership', 'createMembership', 'deleteMembership', 'updateMembership', 'generateConnectManifest', 'initializeHub']; - for (const methodName of gkeHubStubMethods) { - const callPromise = this.gkeHubStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.gkeHubStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'gkehub.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 'gkehub.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 -- - // ------------------- -/** - * Gets the details of a Membership. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1alpha2.Membership|Membership}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha2/gke_hub.get_membership.js - * region_tag:gkehub_v1alpha2_generated_GkeHub_GetMembership_async - */ - getMembership( - request?: protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1alpha2.IMembership, - protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest|undefined, {}|undefined - ]>; - getMembership( - request: protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkehub.v1alpha2.IMembership, - protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest|null|undefined, - {}|null|undefined>): void; - getMembership( - request: protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest, - callback: Callback< - protos.google.cloud.gkehub.v1alpha2.IMembership, - protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest|null|undefined, - {}|null|undefined>): void; - getMembership( - request?: protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkehub.v1alpha2.IMembership, - protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkehub.v1alpha2.IMembership, - protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkehub.v1alpha2.IMembership, - protos.google.cloud.gkehub.v1alpha2.IGetMembershipRequest|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.getMembership(request, options, callback); - } -/** - * Generates the manifest for deployment of the GKE connect agent. - * - * **This method is used internally by Google-provided libraries.** - * Most clients should not need to call this method directly. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Membership resource name the Agent will associate with, in the format - * `projects/* /locations/* /memberships/*`. - * @param {string} [request.namespace] - * Optional. Namespace for GKE Connect agent resources. Defaults to `gke-connect`. - * - * The Connect Agent is authorized automatically when run in the default - * namespace. Otherwise, explicit authorization must be granted with an - * additional IAM binding. - * @param {Buffer} [request.proxy] - * Optional. URI of a proxy if connectivity from the agent to gkeconnect.googleapis.com - * requires the use of a proxy. Format must be in the form - * `http(s)://{proxy_address}`, depending on the HTTP/HTTPS protocol - * supported by the proxy. This will direct the connect agent's outbound - * traffic through a HTTP(S) proxy. - * @param {string} [request.version] - * Optional. The Connect agent version to use. Defaults to the most current version. - * @param {boolean} [request.isUpgrade] - * Optional. If true, generate the resources for upgrade only. Some resources - * generated only for installation (e.g. secrets) will be excluded. - * @param {string} [request.registry] - * Optional. The registry to fetch the connect agent image from. Defaults to - * gcr.io/gkeconnect. - * @param {Buffer} [request.imagePullSecretContent] - * Optional. The image pull secret content for the registry, if not public. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1alpha2.GenerateConnectManifestResponse|GenerateConnectManifestResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha2/gke_hub.generate_connect_manifest.js - * region_tag:gkehub_v1alpha2_generated_GkeHub_GenerateConnectManifest_async - */ - generateConnectManifest( - request?: protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest|undefined, {}|undefined - ]>; - generateConnectManifest( - request: protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest|null|undefined, - {}|null|undefined>): void; - generateConnectManifest( - request: protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest, - callback: Callback< - protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest|null|undefined, - {}|null|undefined>): void; - generateConnectManifest( - request?: protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestRequest|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.generateConnectManifest(request, options, callback); - } -/** - * Initializes the Hub in this project, which includes creating the default - * Hub Service Account and the Hub Workload Identity Pool. Initialization is - * optional, and happens automatically when the first Membership is created. - * - * InitializeHub should be called when the first Membership cannot be - * registered without these resources. A common example is granting the Hub - * Service Account access to another project, which requires the account to - * exist first. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Required. The Hub to initialize, in the format - * `projects/* /locations/* /memberships/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1alpha2.InitializeHubResponse|InitializeHubResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha2/gke_hub.initialize_hub.js - * region_tag:gkehub_v1alpha2_generated_GkeHub_InitializeHub_async - */ - initializeHub( - request?: protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1alpha2.IInitializeHubResponse, - protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest|undefined, {}|undefined - ]>; - initializeHub( - request: protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkehub.v1alpha2.IInitializeHubResponse, - protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest|null|undefined, - {}|null|undefined>): void; - initializeHub( - request: protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest, - callback: Callback< - protos.google.cloud.gkehub.v1alpha2.IInitializeHubResponse, - protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest|null|undefined, - {}|null|undefined>): void; - initializeHub( - request?: protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkehub.v1alpha2.IInitializeHubResponse, - protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkehub.v1alpha2.IInitializeHubResponse, - protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkehub.v1alpha2.IInitializeHubResponse, - protos.google.cloud.gkehub.v1alpha2.IInitializeHubRequest|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({ - 'project': request.project ?? '', - }); - this.initialize(); - return this.innerApiCalls.initializeHub(request, options, callback); - } - -/** - * Creates a new Membership. - * - * **This is currently only supported for GKE clusters on Google Cloud**. - * To register other clusters, follow the instructions at - * https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) where the Memberships will be created. - * Specified in the format `projects/* /locations/*`. - * @param {string} request.membershipId - * Required. Client chosen ID for the membership. `membership_id` must be a valid RFC - * 1123 compliant DNS label: - * - * 1. At most 63 characters in length - * 2. It must consist of lower case alphanumeric characters or `-` - * 3. It must start and end with an alphanumeric character - * - * Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, - * with a maximum length of 63 characters. - * @param {google.cloud.gkehub.v1alpha2.Membership} request.resource - * Required. The membership to create. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha2/gke_hub.create_membership.js - * region_tag:gkehub_v1alpha2_generated_GkeHub_CreateMembership_async - */ - createMembership( - request?: protos.google.cloud.gkehub.v1alpha2.ICreateMembershipRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createMembership( - request: protos.google.cloud.gkehub.v1alpha2.ICreateMembershipRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMembership( - request: protos.google.cloud.gkehub.v1alpha2.ICreateMembershipRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMembership( - request?: protos.google.cloud.gkehub.v1alpha2.ICreateMembershipRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createMembership(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createMembership()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha2/gke_hub.create_membership.js - * region_tag:gkehub_v1alpha2_generated_GkeHub_CreateMembership_async - */ - async checkCreateMembershipProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMembership, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Removes a Membership. - * - * **This is currently only supported for GKE clusters on Google Cloud**. - * To unregister other clusters, follow the instructions at - * https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha2/gke_hub.delete_membership.js - * region_tag:gkehub_v1alpha2_generated_GkeHub_DeleteMembership_async - */ - deleteMembership( - request?: protos.google.cloud.gkehub.v1alpha2.IDeleteMembershipRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteMembership( - request: protos.google.cloud.gkehub.v1alpha2.IDeleteMembershipRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteMembership( - request: protos.google.cloud.gkehub.v1alpha2.IDeleteMembershipRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteMembership( - request?: protos.google.cloud.gkehub.v1alpha2.IDeleteMembershipRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteMembership(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteMembership()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha2/gke_hub.delete_membership.js - * region_tag:gkehub_v1alpha2_generated_GkeHub_DeleteMembership_async - */ - async checkDeleteMembershipProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteMembership, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an existing Membership. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. - * @param {google.cloud.gkehub.v1alpha2.Membership} request.resource - * Required. Only fields specified in update_mask are updated. - * If you specify a field in the update_mask but don't specify its value here - * that field will be deleted. - * If you are updating a map field, set the value of a key to null or empty - * string to delete the key from the map. It's not possible to update a key's - * value to the empty string. - * If you specify the update_mask to be a special path "*", fully replaces all - * user-modifiable fields to match `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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha2/gke_hub.update_membership.js - * region_tag:gkehub_v1alpha2_generated_GkeHub_UpdateMembership_async - */ - updateMembership( - request?: protos.google.cloud.gkehub.v1alpha2.IUpdateMembershipRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateMembership( - request: protos.google.cloud.gkehub.v1alpha2.IUpdateMembershipRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMembership( - request: protos.google.cloud.gkehub.v1alpha2.IUpdateMembershipRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMembership( - request?: protos.google.cloud.gkehub.v1alpha2.IUpdateMembershipRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateMembership(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateMembership()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha2/gke_hub.update_membership.js - * region_tag:gkehub_v1alpha2_generated_GkeHub_UpdateMembership_async - */ - async checkUpdateMembershipProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMembership, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Memberships in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) where the Memberships will be listed. - * Specified in the format `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. When requesting a 'page' of resources, `page_size` specifies number of - * resources to return. If unspecified or set to 0, all resources will - * be returned. - * @param {string} [request.pageToken] - * Optional. Token returned by previous call to `ListMemberships` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} [request.filter] - * Optional. Lists Memberships that match the filter expression, following the syntax - * outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Name is `bar` in project `foo-proj` and location `global`: - * - * name = "projects/foo-proj/locations/global/membership/bar" - * - * - Memberships that have a label called `foo`: - * - * labels.foo:* - * - * - Memberships that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * - * - Memberships in the CREATING state: - * - * state = CREATING - * @param {string} [request.orderBy] - * Optional. One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1alpha2.Membership|Membership}. - * 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 `listMembershipsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMemberships( - request?: protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1alpha2.IMembership[], - protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest|null, - protos.google.cloud.gkehub.v1alpha2.IListMembershipsResponse - ]>; - listMemberships( - request: protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, - protos.google.cloud.gkehub.v1alpha2.IListMembershipsResponse|null|undefined, - protos.google.cloud.gkehub.v1alpha2.IMembership>): void; - listMemberships( - request: protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, - callback: PaginationCallback< - protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, - protos.google.cloud.gkehub.v1alpha2.IListMembershipsResponse|null|undefined, - protos.google.cloud.gkehub.v1alpha2.IMembership>): void; - listMemberships( - request?: protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, - protos.google.cloud.gkehub.v1alpha2.IListMembershipsResponse|null|undefined, - protos.google.cloud.gkehub.v1alpha2.IMembership>, - callback?: PaginationCallback< - protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, - protos.google.cloud.gkehub.v1alpha2.IListMembershipsResponse|null|undefined, - protos.google.cloud.gkehub.v1alpha2.IMembership>): - Promise<[ - protos.google.cloud.gkehub.v1alpha2.IMembership[], - protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest|null, - protos.google.cloud.gkehub.v1alpha2.IListMembershipsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listMemberships(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) where the Memberships will be listed. - * Specified in the format `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. When requesting a 'page' of resources, `page_size` specifies number of - * resources to return. If unspecified or set to 0, all resources will - * be returned. - * @param {string} [request.pageToken] - * Optional. Token returned by previous call to `ListMemberships` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} [request.filter] - * Optional. Lists Memberships that match the filter expression, following the syntax - * outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Name is `bar` in project `foo-proj` and location `global`: - * - * name = "projects/foo-proj/locations/global/membership/bar" - * - * - Memberships that have a label called `foo`: - * - * labels.foo:* - * - * - Memberships that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * - * - Memberships in the CREATING state: - * - * state = CREATING - * @param {string} [request.orderBy] - * Optional. One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 protos.google.cloud.gkehub.v1alpha2.Membership|Membership} 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 `listMembershipsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMembershipsStream( - request?: protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, - 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['listMemberships']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMemberships.createStream( - this.innerApiCalls.listMemberships as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMemberships`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) where the Memberships will be listed. - * Specified in the format `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. When requesting a 'page' of resources, `page_size` specifies number of - * resources to return. If unspecified or set to 0, all resources will - * be returned. - * @param {string} [request.pageToken] - * Optional. Token returned by previous call to `ListMemberships` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} [request.filter] - * Optional. Lists Memberships that match the filter expression, following the syntax - * outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Name is `bar` in project `foo-proj` and location `global`: - * - * name = "projects/foo-proj/locations/global/membership/bar" - * - * - Memberships that have a label called `foo`: - * - * labels.foo:* - * - * - Memberships that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * - * - Memberships in the CREATING state: - * - * state = CREATING - * @param {string} [request.orderBy] - * Optional. One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkehub.v1alpha2.Membership|Membership}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha2/gke_hub.list_memberships.js - * region_tag:gkehub_v1alpha2_generated_GkeHub_ListMemberships_async - */ - listMembershipsAsync( - request?: protos.google.cloud.gkehub.v1alpha2.IListMembershipsRequest, - 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['listMemberships']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMemberships.asyncIterate( - this.innerApiCalls['listMemberships'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified membership resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} membership - * @returns {string} Resource name string. - */ - membershipPath(project:string,location:string,membership:string) { - return this.pathTemplates.membershipPathTemplate.render({ - project: project, - location: location, - membership: membership, - }); - } - - /** - * Parse the project from Membership resource. - * - * @param {string} membershipName - * A fully-qualified path representing Membership resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMembershipName(membershipName: string) { - return this.pathTemplates.membershipPathTemplate.match(membershipName).project; - } - - /** - * Parse the location from Membership resource. - * - * @param {string} membershipName - * A fully-qualified path representing Membership resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMembershipName(membershipName: string) { - return this.pathTemplates.membershipPathTemplate.match(membershipName).location; - } - - /** - * Parse the membership from Membership resource. - * - * @param {string} membershipName - * A fully-qualified path representing Membership resource. - * @returns {string} A string representing the membership. - */ - matchMembershipFromMembershipName(membershipName: string) { - return this.pathTemplates.membershipPathTemplate.match(membershipName).membership; - } - - /** - * 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; - } - - /** - * 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.gkeHubStub && !this._terminated) { - return this.gkeHubStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_client_config.json b/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_client_config.json deleted file mode 100644 index 67d4326393f..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_client_config.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "interfaces": { - "google.cloud.gkehub.v1alpha2.GkeHub": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListMemberships": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetMembership": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateMembership": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteMembership": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UpdateMembership": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GenerateConnectManifest": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "InitializeHub": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_proto_list.json b/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_proto_list.json deleted file mode 100644 index 1146076265d..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/gke_hub_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/gkehub/v1alpha2/membership.proto" -] diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/index.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/index.ts deleted file mode 100644 index aaf819215ae..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/src/v1alpha2/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 {GkeHubClient} from './gke_hub_client'; diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 723143457a0..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/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 gkehub = require('@google-cloud/gke-hub'); - -function main() { - const gkeHubClient = new gkehub.GkeHubClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 832fe8321c7..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/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 {GkeHubClient} from '@google-cloud/gke-hub'; - -// check that the client class type name can be used -function doStuffWithGkeHubClient(client: GkeHubClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const gkeHubClient = new GkeHubClient(); - doStuffWithGkeHubClient(gkeHubClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/install.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha2/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/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-gkehub/v1alpha2/test/gapic_gke_hub_v1alpha2.ts b/owl-bot-staging/google-cloud-gkehub/v1alpha2/test/gapic_gke_hub_v1alpha2.ts deleted file mode 100644 index 1bdc01eddce..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/test/gapic_gke_hub_v1alpha2.ts +++ /dev/null @@ -1,1361 +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 gkehubModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1alpha2.GkeHubClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = gkehubModule.v1alpha2.GkeHubClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = gkehubModule.v1alpha2.GkeHubClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = gkehubModule.v1alpha2.GkeHubClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new gkehubModule.v1alpha2.GkeHubClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.gkeHubStub, undefined); - await client.initialize(); - assert(client.gkeHubStub); - }); - - it('has close method for the initialized client', done => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.gkeHubStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.gkeHubStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new gkehubModule.v1alpha2.GkeHubClient({ - 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 gkehubModule.v1alpha2.GkeHubClient({ - 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('getMembership', () => { - it('invokes getMembership without error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.GetMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.GetMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.Membership() - ); - client.innerApiCalls.getMembership = stubSimpleCall(expectedResponse); - const [response] = await client.getMembership(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMembership without error using callback', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.GetMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.GetMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.Membership() - ); - client.innerApiCalls.getMembership = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMembership( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1alpha2.IMembership|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMembership with error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.GetMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.GetMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMembership = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMembership(request), expectedError); - const actualRequest = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMembership with closed client', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.GetMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.GetMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getMembership(request), expectedError); - }); - }); - - describe('generateConnectManifest', () => { - it('invokes generateConnectManifest without error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.GenerateConnectManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.GenerateConnectManifestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.GenerateConnectManifestResponse() - ); - client.innerApiCalls.generateConnectManifest = stubSimpleCall(expectedResponse); - const [response] = await client.generateConnectManifest(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateConnectManifest without error using callback', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.GenerateConnectManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.GenerateConnectManifestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.GenerateConnectManifestResponse() - ); - client.innerApiCalls.generateConnectManifest = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateConnectManifest( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1alpha2.IGenerateConnectManifestResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateConnectManifest with error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.GenerateConnectManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.GenerateConnectManifestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateConnectManifest = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateConnectManifest(request), expectedError); - const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateConnectManifest with closed client', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.GenerateConnectManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.GenerateConnectManifestRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateConnectManifest(request), expectedError); - }); - }); - - describe('initializeHub', () => { - it('invokes initializeHub without error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.InitializeHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.InitializeHubRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.InitializeHubResponse() - ); - client.innerApiCalls.initializeHub = stubSimpleCall(expectedResponse); - const [response] = await client.initializeHub(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.initializeHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.initializeHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes initializeHub without error using callback', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.InitializeHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.InitializeHubRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.InitializeHubResponse() - ); - client.innerApiCalls.initializeHub = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.initializeHub( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1alpha2.IInitializeHubResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.initializeHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.initializeHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes initializeHub with error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.InitializeHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.InitializeHubRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.initializeHub = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.initializeHub(request), expectedError); - const actualRequest = (client.innerApiCalls.initializeHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.initializeHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes initializeHub with closed client', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.InitializeHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.InitializeHubRequest', ['project']); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.initializeHub(request), expectedError); - }); - }); - - describe('createMembership', () => { - it('invokes createMembership without error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.CreateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.CreateMembershipRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMembership = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMembership(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMembership without error using callback', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.CreateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.CreateMembershipRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMembership = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMembership( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMembership with call error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.CreateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.CreateMembershipRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMembership = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMembership(request), expectedError); - const actualRequest = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMembership with LRO error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.CreateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.CreateMembershipRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMembership = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMembership(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateMembershipProgress without error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateMembershipProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateMembershipProgress with error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMembershipProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteMembership', () => { - it('invokes deleteMembership without error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.DeleteMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.DeleteMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMembership = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteMembership(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMembership without error using callback', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.DeleteMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.DeleteMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMembership = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMembership( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMembership with call error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.DeleteMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.DeleteMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMembership = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteMembership(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMembership with LRO error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.DeleteMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.DeleteMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMembership = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteMembership(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteMembershipProgress without error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteMembershipProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteMembershipProgress with error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteMembershipProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateMembership', () => { - it('invokes updateMembership without error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.UpdateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.UpdateMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMembership = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMembership(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMembership without error using callback', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.UpdateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.UpdateMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMembership = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMembership( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMembership with call error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.UpdateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.UpdateMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMembership = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMembership(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMembership with LRO error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.UpdateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.UpdateMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMembership = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMembership(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateMembershipProgress without error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateMembershipProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateMembershipProgress with error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMembershipProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listMemberships', () => { - it('invokes listMemberships without error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), - ]; - client.innerApiCalls.listMemberships = stubSimpleCall(expectedResponse); - const [response] = await client.listMemberships(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMemberships without error using callback', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), - ]; - client.innerApiCalls.listMemberships = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMemberships( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1alpha2.IMembership[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMemberships with error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMemberships = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMemberships(request), expectedError); - const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMembershipsStream without error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), - ]; - client.descriptors.page.listMemberships.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMembershipsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkehub.v1alpha2.Membership[] = []; - stream.on('data', (response: protos.google.cloud.gkehub.v1alpha2.Membership) => { - 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.listMemberships.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMemberships, request)); - assert( - (client.descriptors.page.listMemberships.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listMembershipsStream with error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMemberships.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMembershipsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkehub.v1alpha2.Membership[] = []; - stream.on('data', (response: protos.google.cloud.gkehub.v1alpha2.Membership) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMemberships.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMemberships, request)); - assert( - (client.descriptors.page.listMemberships.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMemberships without error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1alpha2.Membership()), - ]; - client.descriptors.page.listMemberships.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkehub.v1alpha2.IMembership[] = []; - const iterable = client.listMembershipsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMemberships.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMemberships.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMemberships with error', async () => { - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1alpha2.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1alpha2.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMemberships.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMembershipsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkehub.v1alpha2.IMembership[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMemberships.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMemberships.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('membership', () => { - const fakePath = "/rendered/path/membership"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - membership: "membershipValue", - }; - const client = new gkehubModule.v1alpha2.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.membershipPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.membershipPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('membershipPath', () => { - const result = client.membershipPath("projectValue", "locationValue", "membershipValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.membershipPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMembershipName', () => { - const result = client.matchProjectFromMembershipName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMembershipName', () => { - const result = client.matchLocationFromMembershipName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMembershipFromMembershipName', () => { - const result = client.matchMembershipFromMembershipName(fakePath); - assert.strictEqual(result, "membershipValue"); - assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new gkehubModule.v1alpha2.GkeHubClient({ - 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)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-gkehub/v1alpha2/tsconfig.json b/owl-bot-staging/google-cloud-gkehub/v1alpha2/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/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-gkehub/v1alpha2/webpack.config.js b/owl-bot-staging/google-cloud-gkehub/v1alpha2/webpack.config.js deleted file mode 100644 index 71afa3a607d..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1alpha2/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: 'GkeHub', - filename: './gke-hub.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-gkehub/v1beta/.eslintignore b/owl-bot-staging/google-cloud-gkehub/v1beta/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/.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-gkehub/v1beta/.eslintrc.json b/owl-bot-staging/google-cloud-gkehub/v1beta/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/.gitignore b/owl-bot-staging/google-cloud-gkehub/v1beta/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/.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-gkehub/v1beta/.jsdoc.js b/owl-bot-staging/google-cloud-gkehub/v1beta/.jsdoc.js deleted file mode 100644 index b83282dcebb..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/.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/gke-hub', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/.mocharc.js b/owl-bot-staging/google-cloud-gkehub/v1beta/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/.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-gkehub/v1beta/.prettierrc.js b/owl-bot-staging/google-cloud-gkehub/v1beta/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/.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-gkehub/v1beta/README.md b/owl-bot-staging/google-cloud-gkehub/v1beta/README.md deleted file mode 100644 index f922950c787..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/README.md +++ /dev/null @@ -1 +0,0 @@ -Gkehub: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/package.json b/owl-bot-staging/google-cloud-gkehub/v1beta/package.json deleted file mode 100644 index 25f7a0fc625..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/gke-hub", - "version": "0.1.0", - "description": "Gkehub client for Node.js", - "repository": "googleapis/nodejs-gkehub", - "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 gkehub", - "gkehub", - "gke hub" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/configmanagement/configmanagement.proto b/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/configmanagement/configmanagement.proto deleted file mode 100644 index 77211d349db..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/configmanagement/configmanagement.proto +++ /dev/null @@ -1,409 +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.gkehub.configmanagement.v1beta; - -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeHub.ConfigManagement.V1Beta"; -option go_package = "cloud.google.com/go/gkehub/configmanagement/apiv1beta/configmanagementpb;configmanagementpb"; -option java_multiple_files = true; -option java_outer_classname = "ConfigManagementProto"; -option java_package = "com.google.cloud.gkehub.configmanagement.v1beta"; -option php_namespace = "Google\\Cloud\\GkeHub\\ConfigManagement\\V1beta"; -option ruby_package = "Google::Cloud::GkeHub::ConfigManagement::V1beta"; - -// Enum representing the state of an ACM's deployment on a cluster -enum DeploymentState { - // Deployment's state cannot be determined - DEPLOYMENT_STATE_UNSPECIFIED = 0; - - // Deployment is not installed - NOT_INSTALLED = 1; - - // Deployment is installed - INSTALLED = 2; - - // Deployment was attempted to be installed, but has errors - ERROR = 3; -} - -// **Anthos Config Management**: State for a single cluster. -message MembershipState { - // The user-defined name for the cluster used by ClusterSelectors to group - // clusters together. This should match Membership's membership_name, - // unless the user installed ACM on the cluster manually prior to enabling - // the ACM hub feature. - // Unique within a Anthos Config Management installation. - string cluster_name = 1; - - // Membership configuration in the cluster. This represents the actual state - // in the cluster, while the MembershipSpec in the FeatureSpec represents - // the intended state - MembershipSpec membership_spec = 2; - - // Current install status of ACM's Operator - OperatorState operator_state = 3; - - // Current sync status - ConfigSyncState config_sync_state = 4; - - // PolicyController status - PolicyControllerState policy_controller_state = 5; - - // Binauthz status - BinauthzState binauthz_state = 6; - - // Hierarchy Controller status - HierarchyControllerState hierarchy_controller_state = 7; -} - -// **Anthos Config Management**: Configuration for a single cluster. -// Intended to parallel the ConfigManagement CR. -message MembershipSpec { - // Config Sync configuration for the cluster. - ConfigSync config_sync = 1; - - // Policy Controller configuration for the cluster. - PolicyController policy_controller = 2; - - // Binauthz conifguration for the cluster. - BinauthzConfig binauthz = 3; - - // Hierarchy Controller configuration for the cluster. - HierarchyControllerConfig hierarchy_controller = 4; - - // Version of ACM installed. - string version = 10; -} - -// Configuration for Config Sync -message ConfigSync { - // Git repo configuration for the cluster. - GitConfig git = 7; - - // Specifies whether the Config Sync Repo is - // in “hierarchical” or “unstructured” mode. - string source_format = 8; -} - -// Git repo configuration for a single cluster. -message GitConfig { - // The URL of the Git repository to use as the source of truth. - string sync_repo = 1; - - // The branch of the repository to sync from. Default: master. - string sync_branch = 2; - - // The path within the Git repository that represents the top level of the - // repo to sync. Default: the root directory of the repository. - string policy_dir = 3; - - // Period in seconds between consecutive syncs. Default: 15. - int64 sync_wait_secs = 4; - - // Git revision (tag or hash) to check out. Default HEAD. - string sync_rev = 5; - - // Type of secret configured for access to the Git repo. - string secret_type = 6; - - // URL for the HTTPS proxy to be used when communicating with the Git repo. - string https_proxy = 7; - - // The GCP Service Account Email used for auth when secret_type is - // gcpServiceAccount. - string gcp_service_account_email = 8; -} - -// Configuration for Policy Controller -message PolicyController { - // Enables the installation of Policy Controller. - // If false, the rest of PolicyController fields take no - // effect. - bool enabled = 1; - - // Installs the default template library along with Policy Controller. - optional bool template_library_installed = 2; - - // Sets the interval for Policy Controller Audit Scans (in seconds). - // When set to 0, this disables audit functionality altogether. - optional int64 audit_interval_seconds = 3; - - // The set of namespaces that are excluded from Policy Controller checks. - // Namespaces do not need to currently exist on the cluster. - repeated string exemptable_namespaces = 4; - - // Enables the ability to use Constraint Templates that reference to objects - // other than the object currently being evaluated. - bool referential_rules_enabled = 5; - - // Logs all denies and dry run failures. - bool log_denies_enabled = 6; -} - -// Configuration for Binauthz -message BinauthzConfig { - // Whether binauthz is enabled in this cluster. - bool enabled = 1; -} - -// Configuration for Hierarchy Controller -message HierarchyControllerConfig { - // Whether Hierarchy Controller is enabled in this cluster. - bool enabled = 1; - - // Whether pod tree labels are enabled in this cluster. - bool enable_pod_tree_labels = 2; - - // Whether hierarchical resource quota is enabled in this cluster. - bool enable_hierarchical_resource_quota = 3; -} - -// Deployment state for Hierarchy Controller -message HierarchyControllerDeploymentState { - // The deployment state for open source HNC (e.g. v0.7.0-hc.0) - DeploymentState hnc = 1; - - // The deployment state for Hierarchy Controller extension (e.g. v0.7.0-hc.1) - DeploymentState extension = 2; -} - -// Version for Hierarchy Controller -message HierarchyControllerVersion { - // Version for open source HNC - string hnc = 1; - - // Version for Hierarchy Controller extension - string extension = 2; -} - -// State for Hierarchy Controller -message HierarchyControllerState { - // The version for Hierarchy Controller - HierarchyControllerVersion version = 1; - - // The deployment state for Hierarchy Controller - HierarchyControllerDeploymentState state = 2; -} - -// State information for an ACM's Operator -message OperatorState { - // The semenatic version number of the operator - string version = 1; - - // The state of the Operator's deployment - DeploymentState deployment_state = 2; - - // Install errors. - repeated InstallError errors = 3; -} - -// Errors pertaining to the installation of ACM -message InstallError { - // A string representing the user facing error message - string error_message = 1; -} - -// State information for ConfigSync -message ConfigSyncState { - // The version of ConfigSync deployed - ConfigSyncVersion version = 1; - - // Information about the deployment of ConfigSync, including the version - // of the various Pods deployed - ConfigSyncDeploymentState deployment_state = 2; - - // The state of ConfigSync's process to sync configs to a cluster - SyncState sync_state = 3; -} - -// Specific versioning information pertaining to ConfigSync's Pods -message ConfigSyncVersion { - // Version of the deployed importer pod - string importer = 1; - - // Version of the deployed syncer pod - string syncer = 2; - - // Version of the deployed git-sync pod - string git_sync = 3; - - // Version of the deployed monitor pod - string monitor = 4; - - // Version of the deployed reconciler-manager pod - string reconciler_manager = 5; - - // Version of the deployed reconciler container in root-reconciler pod - string root_reconciler = 6; -} - -// The state of ConfigSync's deployment on a cluster -message ConfigSyncDeploymentState { - // Deployment state of the importer pod - DeploymentState importer = 1; - - // Deployment state of the syncer pod - DeploymentState syncer = 2; - - // Deployment state of the git-sync pod - DeploymentState git_sync = 3; - - // Deployment state of the monitor pod - DeploymentState monitor = 4; - - // Deployment state of reconciler-manager pod - DeploymentState reconciler_manager = 5; - - // Deployment state of root-reconciler - DeploymentState root_reconciler = 6; -} - -// State indicating an ACM's progress syncing configurations to a cluster -message SyncState { - // An enum representing an ACM's status syncing configs to a cluster - enum SyncCode { - // ACM cannot determine a sync code - SYNC_CODE_UNSPECIFIED = 0; - - // ACM successfully synced the git Repo with the cluster - SYNCED = 1; - - // ACM is in the progress of syncing a new change - PENDING = 2; - - // Indicates an error configuring ACM, and user action is required - ERROR = 3; - - // ACM has been installed (operator manifest deployed), - // but not configured. - NOT_CONFIGURED = 4; - - // ACM has not been installed (no operator pod found) - NOT_INSTALLED = 5; - - // Error authorizing with the cluster - UNAUTHORIZED = 6; - - // Cluster could not be reached - UNREACHABLE = 7; - } - - // Token indicating the state of the repo. - string source_token = 1; - - // Token indicating the state of the importer. - string import_token = 2; - - // Token indicating the state of the syncer. - string sync_token = 3; - - // Deprecated: use last_sync_time instead. - // Timestamp of when ACM last successfully synced the repo - // The time format is specified in https://golang.org/pkg/time/#Time.String - string last_sync = 4 [deprecated = true]; - - // Timestamp type of when ACM last successfully synced the repo - google.protobuf.Timestamp last_sync_time = 7; - - // Sync status code - SyncCode code = 5; - - // A list of errors resulting from problematic configs. - // This list will be truncated after 100 errors, although it is - // unlikely for that many errors to simultaneously exist. - repeated SyncError errors = 6; -} - -// An ACM created error representing a problem syncing configurations -message SyncError { - // An ACM defined error code - string code = 1; - - // A description of the error - string error_message = 2; - - // A list of config(s) associated with the error, if any - repeated ErrorResource error_resources = 3; -} - -// Model for a config file in the git repo with an associated Sync error -message ErrorResource { - // Path in the git repo of the erroneous config - string source_path = 1; - - // Metadata name of the resource that is causing an error - string resource_name = 2; - - // Namespace of the resource that is causing an error - string resource_namespace = 3; - - // Group/version/kind of the resource that is causing an error - GroupVersionKind resource_gvk = 4; -} - -// A Kubernetes object's GVK -message GroupVersionKind { - // Kubernetes Group - string group = 1; - - // Kubernetes Version - string version = 2; - - // Kubernetes Kind - string kind = 3; -} - -// State for PolicyControllerState. -message PolicyControllerState { - // The version of Gatekeeper Policy Controller deployed. - PolicyControllerVersion version = 1; - - // The state about the policy controller installation. - GatekeeperDeploymentState deployment_state = 2; -} - -// The build version of Gatekeeper Policy Controller is using. -message PolicyControllerVersion { - // The gatekeeper image tag that is composed of ACM version, git tag, build - // number. - string version = 1; -} - -// State for Binauthz -message BinauthzState { - // The state of the binauthz webhook. - DeploymentState webhook = 1; - - // The version of binauthz that is installed. - BinauthzVersion version = 2; -} - -// The version of binauthz. -message BinauthzVersion { - // The version of the binauthz webhook. - string webhook_version = 1; -} - -// State of Policy Controller installation. -message GatekeeperDeploymentState { - // Status of gatekeeper-controller-manager pod. - DeploymentState gatekeeper_controller_manager_state = 1; - - // Status of gatekeeper-audit deployment. - DeploymentState gatekeeper_audit = 2; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/feature.proto b/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/feature.proto deleted file mode 100644 index 3655644e6e5..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/feature.proto +++ /dev/null @@ -1,202 +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.gkehub.v1beta; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/gkehub/v1beta/configmanagement/configmanagement.proto"; -import "google/cloud/gkehub/v1beta/metering/metering.proto"; -import "google/cloud/gkehub/v1beta/multiclusteringress/multiclusteringress.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeHub.V1Beta"; -option go_package = "cloud.google.com/go/gkehub/apiv1beta/gkehubpb;gkehubpb"; -option java_multiple_files = true; -option java_outer_classname = "FeatureProto"; -option java_package = "com.google.cloud.gkehub.v1beta"; -option php_namespace = "Google\\Cloud\\GkeHub\\V1beta"; -option ruby_package = "Google::Cloud::GkeHub::V1beta"; - -// Feature represents the settings and status of any Hub Feature. -message Feature { - option (google.api.resource) = { - type: "gkehub.googleapis.com/Feature" - pattern: "projects/{project}/locations/{location}/features/{feature}" - }; - - // Output only. The full, unique name of this Feature resource in the format - // `projects/*/locations/*/features/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // GCP labels for this Feature. - map labels = 2; - - // Output only. State of the Feature resource itself. - FeatureResourceState resource_state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Hub-wide Feature configuration. If this Feature does not support any - // Hub-wide configuration, this field may be unused. - CommonFeatureSpec spec = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Membership-specific configuration for this Feature. If this Feature does - // not support any per-Membership configuration, this field may be unused. - // - // The keys indicate which Membership the configuration is for, in the form: - // - // projects/{p}/locations/{l}/memberships/{m} - // - // Where {p} is the project, {l} is a valid location and {m} is a valid - // Membership in this project at that location. {p} WILL match the Feature's - // project. - // - // {p} will always be returned as the project number, but the project ID is - // also accepted during input. If the same Membership is specified in the map - // twice (using the project ID form, and the project number form), exactly - // ONE of the entries will be saved, with no guarantees as to which. For this - // reason, it is recommended the same format be used for all entries when - // mutating a Feature. - map membership_specs = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The Hub-wide Feature state. - CommonFeatureState state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Membership-specific Feature status. If this Feature does - // report any per-Membership status, this field may be unused. - // - // The keys indicate which Membership the state is for, in the form: - // - // projects/{p}/locations/{l}/memberships/{m} - // - // Where {p} is the project number, {l} is a valid location and {m} is a valid - // Membership in this project at that location. {p} MUST match the Feature's - // project number. - map membership_states = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the Feature resource was created. - google.protobuf.Timestamp create_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the Feature resource was last updated. - google.protobuf.Timestamp update_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the Feature resource was deleted. - google.protobuf.Timestamp delete_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// FeatureResourceState describes the state of a Feature *resource* in the -// GkeHub API. See `FeatureState` for the "running state" of the Feature in the -// Hub and across Memberships. -message FeatureResourceState { - // State describes the lifecycle status of a Feature. - enum State { - // State is unknown or not set. - STATE_UNSPECIFIED = 0; - - // The Feature is being enabled, and the Feature resource is being created. - // Once complete, the corresponding Feature will be enabled in this Hub. - ENABLING = 1; - - // The Feature is enabled in this Hub, and the Feature resource is fully - // available. - ACTIVE = 2; - - // The Feature is being disabled in this Hub, and the Feature resource - // is being deleted. - DISABLING = 3; - - // The Feature resource is being updated. - UPDATING = 4; - - // The Feature resource is being updated by the Hub Service. - SERVICE_UPDATING = 5; - } - - // The current state of the Feature resource in the Hub API. - State state = 1; -} - -// FeatureState describes the high-level state of a Feature. It may be used to -// describe a Feature's state at the environ-level, or per-membershop, depending -// on the context. -message FeatureState { - // Code represents a machine-readable, high-level status of the Feature. - enum Code { - // Unknown or not set. - CODE_UNSPECIFIED = 0; - - // The Feature is operating normally. - OK = 1; - - // The Feature has encountered an issue, and is operating in a degraded - // state. The Feature may need intervention to return to normal operation. - // See the description and any associated Feature-specific details for more - // information. - WARNING = 2; - - // The Feature is not operating or is in a severely degraded state. - // The Feature may need intervention to return to normal operation. - // See the description and any associated Feature-specific details for more - // information. - ERROR = 3; - } - - // The high-level, machine-readable status of this Feature. - Code code = 1; - - // A human-readable description of the current status. - string description = 2; - - // The time this status and any related Feature-specific details were updated. - google.protobuf.Timestamp update_time = 3; -} - -// CommonFeatureSpec contains Hub-wide configuration information -message CommonFeatureSpec { - oneof feature_spec { - // Multicluster Ingress-specific spec. - google.cloud.gkehub.multiclusteringress.v1beta.FeatureSpec multiclusteringress = 102; - } -} - -// CommonFeatureState contains Hub-wide Feature status information. -message CommonFeatureState { - // Output only. The "running state" of the Feature in this Hub. - FeatureState state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// MembershipFeatureSpec contains configuration information for a single -// Membership. -message MembershipFeatureSpec { - oneof feature_spec { - // Config Management-specific spec. - google.cloud.gkehub.configmanagement.v1beta.MembershipSpec configmanagement = 106; - } -} - -// MembershipFeatureState contains Feature status information for a single -// Membership. -message MembershipFeatureState { - oneof feature_state { - // Metering-specific spec. - google.cloud.gkehub.metering.v1beta.MembershipState metering = 104; - - // Config Management-specific state. - google.cloud.gkehub.configmanagement.v1beta.MembershipState configmanagement = 106; - } - - // The high-level state of this Feature for a single membership. - FeatureState state = 1; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/metering/metering.proto b/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/metering/metering.proto deleted file mode 100644 index 3436915d554..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/metering/metering.proto +++ /dev/null @@ -1,38 +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.gkehub.metering.v1beta; - -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeHub.Metering.V1Beta"; -option go_package = "cloud.google.com/go/gkehub/metering/apiv1beta/meteringpb;meteringpb"; -option java_multiple_files = true; -option java_outer_classname = "MeteringProto"; -option java_package = "com.google.cloud.gkehub.metering.v1beta"; -option php_namespace = "Google\\Cloud\\GkeHub\\Metering\\V1beta"; -option ruby_package = "Google::Cloud::GkeHub::Metering::V1beta"; - -// **Metering**: Per-Membership Feature State. -message MembershipState { - // The time stamp of the most recent measurement of the number of vCPUs - // in the cluster. - google.protobuf.Timestamp last_measurement_time = 1; - - // The vCPUs capacity in the cluster according to the most recent - // measurement (1/1000 precision). - float precise_last_measured_cluster_vcpu_capacity = 3; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/multiclusteringress/multiclusteringress.proto b/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/multiclusteringress/multiclusteringress.proto deleted file mode 100644 index 90c483b3bf6..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/multiclusteringress/multiclusteringress.proto +++ /dev/null @@ -1,49 +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.gkehub.multiclusteringress.v1beta; - - -option csharp_namespace = "Google.Cloud.GkeHub.MultiClusterIngress.V1Beta"; -option go_package = "cloud.google.com/go/gkehub/multiclusteringress/apiv1beta/multiclusteringresspb;multiclusteringresspb"; -option java_multiple_files = true; -option java_outer_classname = "MultiClusterIngressProto"; -option java_package = "com.google.cloud.gkehub.multiclusteringress.v1beta"; -option php_namespace = "Google\\Cloud\\GkeHub\\MultiClusterIngress\\V1beta"; -option ruby_package = "Google::Cloud::GkeHub::MultiClusterIngress::V1beta"; - -// Billing identifies which billing structure the customer is using. -enum Billing { - // Unknown - BILLING_UNSPECIFIED = 0; - - // User pays a fee per-endpoint. - PAY_AS_YOU_GO = 1; - - // User is paying for Anthos as a whole. - ANTHOS_LICENSE = 2; -} - -// **Multi-cluster Ingress**: The configuration for the MultiClusterIngress -// feature. -message FeatureSpec { - // Fully-qualified Membership name which hosts the MultiClusterIngress CRD. - // Example: `projects/foo-proj/locations/global/memberships/bar` - string config_membership = 1; - - // Customer's billing structure - Billing billing = 2; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/service.proto b/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/service.proto deleted file mode 100644 index 27640473a6e..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/protos/google/cloud/gkehub/v1beta/service.proto +++ /dev/null @@ -1,280 +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.gkehub.v1beta; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/gkehub/v1beta/feature.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeHub.V1Beta"; -option go_package = "cloud.google.com/go/gkehub/apiv1beta/gkehubpb;gkehubpb"; -option java_multiple_files = true; -option java_outer_classname = "ServiceProto"; -option java_package = "com.google.cloud.gkehub.v1beta"; -option php_namespace = "Google\\Cloud\\GkeHub\\V1beta"; -option ruby_package = "Google::Cloud::GkeHub::V1beta"; - -// The GKE Hub service handles the registration of many Kubernetes clusters to -// Google Cloud, and the management of multi-cluster features over those -// clusters. -// -// The GKE Hub service operates on the following resources: -// -// * [Membership][google.cloud.gkehub.v1beta.Membership] -// * [Feature][google.cloud.gkehub.v1beta.Feature] -// -// GKE Hub is currently only available in the global region. -// -// **Membership management may be non-trivial:** it is recommended to use one -// of the Google-provided client libraries or tools where possible when working -// with Membership resources. -service GkeHub { - option (google.api.default_host) = "gkehub.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists Features in a given project and location. - rpc ListFeatures(ListFeaturesRequest) returns (ListFeaturesResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/locations/*}/features" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single Feature. - rpc GetFeature(GetFeatureRequest) returns (Feature) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/locations/*/features/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Adds a new Feature. - rpc CreateFeature(CreateFeatureRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{parent=projects/*/locations/*}/features" - body: "resource" - }; - option (google.api.method_signature) = "parent,resource,feature_id"; - option (google.longrunning.operation_info) = { - response_type: "Feature" - metadata_type: "OperationMetadata" - }; - } - - // Removes a Feature. - rpc DeleteFeature(DeleteFeatureRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta/{name=projects/*/locations/*/features/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Updates an existing Feature. - rpc UpdateFeature(UpdateFeatureRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta/{name=projects/*/locations/*/features/*}" - body: "resource" - }; - option (google.api.method_signature) = "name,resource,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Feature" - metadata_type: "OperationMetadata" - }; - } -} - -// Request message for `GkeHub.ListFeatures` method. -message ListFeaturesRequest { - // The parent (project and location) where the Features will be listed. - // Specified in the format `projects/*/locations/*`. - string parent = 1; - - // When requesting a 'page' of resources, `page_size` specifies number of - // resources to return. If unspecified or set to 0, all resources will - // be returned. - int32 page_size = 2; - - // Token returned by previous call to `ListFeatures` which - // specifies the position in the list from where to continue listing the - // resources. - string page_token = 3; - - // Lists Features that match the filter expression, following the syntax - // outlined in https://google.aip.dev/160. - // - // Examples: - // - // - Feature with the name "servicemesh" in project "foo-proj": - // - // name = "projects/foo-proj/locations/global/features/servicemesh" - // - // - Features that have a label called `foo`: - // - // labels.foo:* - // - // - Features that have a label called `foo` whose value is `bar`: - // - // labels.foo = bar - string filter = 4; - - // One or more fields to compare and use to sort the output. - // See https://google.aip.dev/132#ordering. - string order_by = 5; -} - -// Response message for the `GkeHub.ListFeatures` method. -message ListFeaturesResponse { - // The list of matching Features - repeated Feature resources = 1; - - // A token to request the next page of resources from the - // `ListFeatures` method. The value of an empty string means - // that there are no more resources to return. - string next_page_token = 2; -} - -// Request message for `GkeHub.GetFeature` method. -message GetFeatureRequest { - // The Feature resource name in the format - // `projects/*/locations/*/features/*` - string name = 1; -} - -// Request message for the `GkeHub.CreateFeature` method. -message CreateFeatureRequest { - // The parent (project and location) where the Feature will be created. - // Specified in the format `projects/*/locations/*`. - string parent = 1; - - // The ID of the feature to create. - string feature_id = 2; - - // The Feature resource to create. - Feature resource = 3; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for `GkeHub.DeleteFeature` method. -message DeleteFeatureRequest { - // The Feature resource name in the format - // `projects/*/locations/*/features/*`. - string name = 1; - - // If set to true, the delete will ignore any outstanding resources for - // this Feature (that is, `FeatureState.has_resources` is set to true). These - // resources will NOT be cleaned up or modified in any way. - bool force = 2; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for `GkeHub.UpdateFeature` method. -message UpdateFeatureRequest { - // The Feature resource name in the format - // `projects/*/locations/*/features/*`. - string name = 1; - - // Mask of fields to update. - google.protobuf.FieldMask update_mask = 2; - - // Only fields specified in update_mask are updated. - // If you specify a field in the update_mask but don't specify its value here - // that field will be deleted. - // If you are updating a map field, set the value of a key to null or empty - // string to delete the key from the map. It's not possible to update a key's - // value to the empty string. - // If you specify the update_mask to be a special path "*", fully replaces all - // user-modifiable fields to match `resource`. - Feature resource = 3; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_detail = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.create_feature.js b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.create_feature.js deleted file mode 100644 index 8bbe450b265..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.create_feature.js +++ /dev/null @@ -1,84 +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() { - // [START gkehub_v1beta_generated_GkeHub_CreateFeature_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The parent (project and location) where the Feature will be created. - * Specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * The ID of the feature to create. - */ - // const featureId = 'abc123' - /** - * The Feature resource to create. - */ - // const resource = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1beta; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callCreateFeature() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await gkehubClient.createFeature(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateFeature(); - // [END gkehub_v1beta_generated_GkeHub_CreateFeature_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-gkehub/v1beta/samples/generated/v1beta/gke_hub.delete_feature.js b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.delete_feature.js deleted file mode 100644 index b5a0d245a2f..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.delete_feature.js +++ /dev/null @@ -1,82 +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() { - // [START gkehub_v1beta_generated_GkeHub_DeleteFeature_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The Feature resource name in the format - * `projects/* /locations/* /features/*`. - */ - // const name = 'abc123' - /** - * If set to true, the delete will ignore any outstanding resources for - * this Feature (that is, `FeatureState.has_resources` is set to true). These - * resources will NOT be cleaned up or modified in any way. - */ - // const force = true - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1beta; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callDeleteFeature() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await gkehubClient.deleteFeature(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteFeature(); - // [END gkehub_v1beta_generated_GkeHub_DeleteFeature_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-gkehub/v1beta/samples/generated/v1beta/gke_hub.get_feature.js b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.get_feature.js deleted file mode 100644 index f41b7363518..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.get_feature.js +++ /dev/null @@ -1,61 +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() { - // [START gkehub_v1beta_generated_GkeHub_GetFeature_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The Feature resource name in the format - * `projects/* /locations/* /features/*` - */ - // const name = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1beta; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callGetFeature() { - // Construct request - const request = { - }; - - // Run request - const response = await gkehubClient.getFeature(request); - console.log(response); - } - - callGetFeature(); - // [END gkehub_v1beta_generated_GkeHub_GetFeature_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-gkehub/v1beta/samples/generated/v1beta/gke_hub.list_features.js b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.list_features.js deleted file mode 100644 index 73d266f5ab3..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.list_features.js +++ /dev/null @@ -1,92 +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() { - // [START gkehub_v1beta_generated_GkeHub_ListFeatures_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The parent (project and location) where the Features will be listed. - * Specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * When requesting a 'page' of resources, `page_size` specifies number of - * resources to return. If unspecified or set to 0, all resources will - * be returned. - */ - // const pageSize = 1234 - /** - * Token returned by previous call to `ListFeatures` which - * specifies the position in the list from where to continue listing the - * resources. - */ - // const pageToken = 'abc123' - /** - * Lists Features that match the filter expression, following the syntax - * outlined in https://google.aip.dev/160. - * Examples: - * - Feature with the name "servicemesh" in project "foo-proj": - * name = "projects/foo-proj/locations/global/features/servicemesh" - * - Features that have a label called `foo`: - * labels.foo:* - * - Features that have a label called `foo` whose value is `bar`: - * labels.foo = bar - */ - // const filter = 'abc123' - /** - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - */ - // const orderBy = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1beta; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callListFeatures() { - // Construct request - const request = { - }; - - // Run request - const iterable = await gkehubClient.listFeaturesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFeatures(); - // [END gkehub_v1beta_generated_GkeHub_ListFeatures_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-gkehub/v1beta/samples/generated/v1beta/gke_hub.update_feature.js b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.update_feature.js deleted file mode 100644 index a80e7184b23..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/gke_hub.update_feature.js +++ /dev/null @@ -1,91 +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() { - // [START gkehub_v1beta_generated_GkeHub_UpdateFeature_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The Feature resource name in the format - * `projects/* /locations/* /features/*`. - */ - // const name = 'abc123' - /** - * Mask of fields to update. - */ - // const updateMask = {} - /** - * Only fields specified in update_mask are updated. - * If you specify a field in the update_mask but don't specify its value here - * that field will be deleted. - * If you are updating a map field, set the value of a key to null or empty - * string to delete the key from the map. It's not possible to update a key's - * value to the empty string. - * If you specify the update_mask to be a special path "*", fully replaces all - * user-modifiable fields to match `resource`. - */ - // const resource = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Gkehub library - const {GkeHubClient} = require('@google-cloud/gke-hub').v1beta; - - // Instantiates a client - const gkehubClient = new GkeHubClient(); - - async function callUpdateFeature() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await gkehubClient.updateFeature(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateFeature(); - // [END gkehub_v1beta_generated_GkeHub_UpdateFeature_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-gkehub/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.gkehub.v1beta.json b/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.gkehub.v1beta.json deleted file mode 100644 index 68cb273223a..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.gkehub.v1beta.json +++ /dev/null @@ -1,263 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-gkehub", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.gkehub.v1beta", - "version": "v1beta" - } - ] - }, - "snippets": [ - { - "regionTag": "gkehub_v1beta_generated_GkeHub_ListFeatures_async", - "title": "GkeHub listFeatures Sample", - "origin": "API_DEFINITION", - "description": " Lists Features in a given project and location.", - "canonical": true, - "file": "gke_hub.list_features.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFeatures", - "fullName": "google.cloud.gkehub.v1beta.GkeHub.ListFeatures", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkehub.v1beta.ListFeaturesResponse", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1beta.GkeHubClient" - }, - "method": { - "shortName": "ListFeatures", - "fullName": "google.cloud.gkehub.v1beta.GkeHub.ListFeatures", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1beta.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1beta_generated_GkeHub_GetFeature_async", - "title": "GkeHub getFeature Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single Feature.", - "canonical": true, - "file": "gke_hub.get_feature.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFeature", - "fullName": "google.cloud.gkehub.v1beta.GkeHub.GetFeature", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkehub.v1beta.Feature", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1beta.GkeHubClient" - }, - "method": { - "shortName": "GetFeature", - "fullName": "google.cloud.gkehub.v1beta.GkeHub.GetFeature", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1beta.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1beta_generated_GkeHub_CreateFeature_async", - "title": "GkeHub createFeature Sample", - "origin": "API_DEFINITION", - "description": " Adds a new Feature.", - "canonical": true, - "file": "gke_hub.create_feature.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFeature", - "fullName": "google.cloud.gkehub.v1beta.GkeHub.CreateFeature", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "feature_id", - "type": "TYPE_STRING" - }, - { - "name": "resource", - "type": ".google.cloud.gkehub.v1beta.Feature" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1beta.GkeHubClient" - }, - "method": { - "shortName": "CreateFeature", - "fullName": "google.cloud.gkehub.v1beta.GkeHub.CreateFeature", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1beta.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1beta_generated_GkeHub_DeleteFeature_async", - "title": "GkeHub deleteFeature Sample", - "origin": "API_DEFINITION", - "description": " Removes a Feature.", - "canonical": true, - "file": "gke_hub.delete_feature.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteFeature", - "fullName": "google.cloud.gkehub.v1beta.GkeHub.DeleteFeature", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1beta.GkeHubClient" - }, - "method": { - "shortName": "DeleteFeature", - "fullName": "google.cloud.gkehub.v1beta.GkeHub.DeleteFeature", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1beta.GkeHub" - } - } - } - }, - { - "regionTag": "gkehub_v1beta_generated_GkeHub_UpdateFeature_async", - "title": "GkeHub updateFeature Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing Feature.", - "canonical": true, - "file": "gke_hub.update_feature.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFeature", - "fullName": "google.cloud.gkehub.v1beta.GkeHub.UpdateFeature", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "resource", - "type": ".google.cloud.gkehub.v1beta.Feature" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubClient", - "fullName": "google.cloud.gkehub.v1beta.GkeHubClient" - }, - "method": { - "shortName": "UpdateFeature", - "fullName": "google.cloud.gkehub.v1beta.GkeHub.UpdateFeature", - "service": { - "shortName": "GkeHub", - "fullName": "google.cloud.gkehub.v1beta.GkeHub" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1beta/src/index.ts deleted file mode 100644 index 2c04b31096b..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/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 v1beta from './v1beta'; -const GkeHubClient = v1beta.GkeHubClient; -type GkeHubClient = v1beta.GkeHubClient; -export {v1beta, GkeHubClient}; -export default {v1beta, GkeHubClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gapic_metadata.json deleted file mode 100644 index adc7122180e..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gapic_metadata.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.gkehub.v1beta", - "libraryPackage": "@google-cloud/gke-hub", - "services": { - "GkeHub": { - "clients": { - "grpc": { - "libraryClient": "GkeHubClient", - "rpcs": { - "GetFeature": { - "methods": [ - "getFeature" - ] - }, - "CreateFeature": { - "methods": [ - "createFeature" - ] - }, - "DeleteFeature": { - "methods": [ - "deleteFeature" - ] - }, - "UpdateFeature": { - "methods": [ - "updateFeature" - ] - }, - "ListFeatures": { - "methods": [ - "listFeatures", - "listFeaturesStream", - "listFeaturesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "GkeHubClient", - "rpcs": { - "GetFeature": { - "methods": [ - "getFeature" - ] - }, - "CreateFeature": { - "methods": [ - "createFeature" - ] - }, - "DeleteFeature": { - "methods": [ - "deleteFeature" - ] - }, - "UpdateFeature": { - "methods": [ - "updateFeature" - ] - }, - "ListFeatures": { - "methods": [ - "listFeatures", - "listFeaturesStream", - "listFeaturesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_client.ts b/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_client.ts deleted file mode 100644 index 19c308e7c2d..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_client.ts +++ /dev/null @@ -1,1084 +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, GrpcClientOptions, LROperation, 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/v1beta/gke_hub_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './gke_hub_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The GKE Hub service handles the registration of many Kubernetes clusters to - * Google Cloud, and the management of multi-cluster features over those - * clusters. - * - * The GKE Hub service operates on the following resources: - * - * * {@link protos.google.cloud.gkehub.v1beta.Membership|Membership} - * * {@link protos.google.cloud.gkehub.v1beta.Feature|Feature} - * - * GKE Hub is currently only available in the global region. - * - * **Membership management may be non-trivial:** it is recommended to use one - * of the Google-provided client libraries or tools where possible when working - * with Membership resources. - * @class - * @memberof v1beta - */ -export class GkeHubClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - gkeHubStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of GkeHubClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 GkeHubClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof GkeHubClient; - 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 { - 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 = { - featurePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/features/{feature}' - ), - }; - - // 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 = { - listFeatures: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta/{resource=projects/*/locations/*/memberships/*}:getIamPolicy',additional_bindings: [{get: '/v1beta/{resource=projects/*/locations/*/features/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta/{resource=projects/*/locations/*/memberships/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/features/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta/{resource=projects/*/locations/*/memberships/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/features/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createFeatureResponse = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1beta.Feature') as gax.protobuf.Type; - const createFeatureMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1beta.OperationMetadata') as gax.protobuf.Type; - const deleteFeatureResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteFeatureMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1beta.OperationMetadata') as gax.protobuf.Type; - const updateFeatureResponse = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1beta.Feature') as gax.protobuf.Type; - const updateFeatureMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1beta.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createFeature: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createFeatureResponse.decode.bind(createFeatureResponse), - createFeatureMetadata.decode.bind(createFeatureMetadata)), - deleteFeature: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteFeatureResponse.decode.bind(deleteFeatureResponse), - deleteFeatureMetadata.decode.bind(deleteFeatureMetadata)), - updateFeature: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateFeatureResponse.decode.bind(updateFeatureResponse), - updateFeatureMetadata.decode.bind(updateFeatureMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.gkehub.v1beta.GkeHub', 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.gkeHubStub) { - return this.gkeHubStub; - } - - // Put together the "service stub" for - // google.cloud.gkehub.v1beta.GkeHub. - this.gkeHubStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.gkehub.v1beta.GkeHub') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.gkehub.v1beta.GkeHub, - 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 gkeHubStubMethods = - ['listFeatures', 'getFeature', 'createFeature', 'deleteFeature', 'updateFeature']; - for (const methodName of gkeHubStubMethods) { - const callPromise = this.gkeHubStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.gkeHubStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'gkehub.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 'gkehub.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 -- - // ------------------- -/** - * Gets details of a single Feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The Feature resource name in the format - * `projects/* /locations/* /features/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1beta.Feature|Feature}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/gke_hub.get_feature.js - * region_tag:gkehub_v1beta_generated_GkeHub_GetFeature_async - */ - getFeature( - request?: protos.google.cloud.gkehub.v1beta.IGetFeatureRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1beta.IFeature, - protos.google.cloud.gkehub.v1beta.IGetFeatureRequest|undefined, {}|undefined - ]>; - getFeature( - request: protos.google.cloud.gkehub.v1beta.IGetFeatureRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkehub.v1beta.IFeature, - protos.google.cloud.gkehub.v1beta.IGetFeatureRequest|null|undefined, - {}|null|undefined>): void; - getFeature( - request: protos.google.cloud.gkehub.v1beta.IGetFeatureRequest, - callback: Callback< - protos.google.cloud.gkehub.v1beta.IFeature, - protos.google.cloud.gkehub.v1beta.IGetFeatureRequest|null|undefined, - {}|null|undefined>): void; - getFeature( - request?: protos.google.cloud.gkehub.v1beta.IGetFeatureRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkehub.v1beta.IFeature, - protos.google.cloud.gkehub.v1beta.IGetFeatureRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkehub.v1beta.IFeature, - protos.google.cloud.gkehub.v1beta.IGetFeatureRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkehub.v1beta.IFeature, - protos.google.cloud.gkehub.v1beta.IGetFeatureRequest|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.getFeature(request, options, callback); - } - -/** - * Adds a new Feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent (project and location) where the Feature will be created. - * Specified in the format `projects/* /locations/*`. - * @param {string} request.featureId - * The ID of the feature to create. - * @param {google.cloud.gkehub.v1beta.Feature} request.resource - * The Feature resource to create. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/gke_hub.create_feature.js - * region_tag:gkehub_v1beta_generated_GkeHub_CreateFeature_async - */ - createFeature( - request?: protos.google.cloud.gkehub.v1beta.ICreateFeatureRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createFeature( - request: protos.google.cloud.gkehub.v1beta.ICreateFeatureRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFeature( - request: protos.google.cloud.gkehub.v1beta.ICreateFeatureRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFeature( - request?: protos.google.cloud.gkehub.v1beta.ICreateFeatureRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFeature(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createFeature()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/gke_hub.create_feature.js - * region_tag:gkehub_v1beta_generated_GkeHub_CreateFeature_async - */ - async checkCreateFeatureProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFeature, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Removes a Feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The Feature resource name in the format - * `projects/* /locations/* /features/*`. - * @param {boolean} request.force - * If set to true, the delete will ignore any outstanding resources for - * this Feature (that is, `FeatureState.has_resources` is set to true). These - * resources will NOT be cleaned up or modified in any way. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/gke_hub.delete_feature.js - * region_tag:gkehub_v1beta_generated_GkeHub_DeleteFeature_async - */ - deleteFeature( - request?: protos.google.cloud.gkehub.v1beta.IDeleteFeatureRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteFeature( - request: protos.google.cloud.gkehub.v1beta.IDeleteFeatureRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFeature( - request: protos.google.cloud.gkehub.v1beta.IDeleteFeatureRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFeature( - request?: protos.google.cloud.gkehub.v1beta.IDeleteFeatureRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteFeature(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteFeature()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/gke_hub.delete_feature.js - * region_tag:gkehub_v1beta_generated_GkeHub_DeleteFeature_async - */ - async checkDeleteFeatureProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFeature, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an existing Feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The Feature resource name in the format - * `projects/* /locations/* /features/*`. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask of fields to update. - * @param {google.cloud.gkehub.v1beta.Feature} request.resource - * Only fields specified in update_mask are updated. - * If you specify a field in the update_mask but don't specify its value here - * that field will be deleted. - * If you are updating a map field, set the value of a key to null or empty - * string to delete the key from the map. It's not possible to update a key's - * value to the empty string. - * If you specify the update_mask to be a special path "*", fully replaces all - * user-modifiable fields to match `resource`. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/gke_hub.update_feature.js - * region_tag:gkehub_v1beta_generated_GkeHub_UpdateFeature_async - */ - updateFeature( - request?: protos.google.cloud.gkehub.v1beta.IUpdateFeatureRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateFeature( - request: protos.google.cloud.gkehub.v1beta.IUpdateFeatureRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFeature( - request: protos.google.cloud.gkehub.v1beta.IUpdateFeatureRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFeature( - request?: protos.google.cloud.gkehub.v1beta.IUpdateFeatureRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFeature(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateFeature()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/gke_hub.update_feature.js - * region_tag:gkehub_v1beta_generated_GkeHub_UpdateFeature_async - */ - async checkUpdateFeatureProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFeature, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Features in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent (project and location) where the Features will be listed. - * Specified in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * When requesting a 'page' of resources, `page_size` specifies number of - * resources to return. If unspecified or set to 0, all resources will - * be returned. - * @param {string} request.pageToken - * Token returned by previous call to `ListFeatures` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} request.filter - * Lists Features that match the filter expression, following the syntax - * outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Feature with the name "servicemesh" in project "foo-proj": - * - * name = "projects/foo-proj/locations/global/features/servicemesh" - * - * - Features that have a label called `foo`: - * - * labels.foo:* - * - * - Features that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * @param {string} request.orderBy - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1beta.Feature|Feature}. - * 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 `listFeaturesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFeatures( - request?: protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1beta.IFeature[], - protos.google.cloud.gkehub.v1beta.IListFeaturesRequest|null, - protos.google.cloud.gkehub.v1beta.IListFeaturesResponse - ]>; - listFeatures( - request: protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, - protos.google.cloud.gkehub.v1beta.IListFeaturesResponse|null|undefined, - protos.google.cloud.gkehub.v1beta.IFeature>): void; - listFeatures( - request: protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, - callback: PaginationCallback< - protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, - protos.google.cloud.gkehub.v1beta.IListFeaturesResponse|null|undefined, - protos.google.cloud.gkehub.v1beta.IFeature>): void; - listFeatures( - request?: protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, - protos.google.cloud.gkehub.v1beta.IListFeaturesResponse|null|undefined, - protos.google.cloud.gkehub.v1beta.IFeature>, - callback?: PaginationCallback< - protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, - protos.google.cloud.gkehub.v1beta.IListFeaturesResponse|null|undefined, - protos.google.cloud.gkehub.v1beta.IFeature>): - Promise<[ - protos.google.cloud.gkehub.v1beta.IFeature[], - protos.google.cloud.gkehub.v1beta.IListFeaturesRequest|null, - protos.google.cloud.gkehub.v1beta.IListFeaturesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listFeatures(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 - * The parent (project and location) where the Features will be listed. - * Specified in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * When requesting a 'page' of resources, `page_size` specifies number of - * resources to return. If unspecified or set to 0, all resources will - * be returned. - * @param {string} request.pageToken - * Token returned by previous call to `ListFeatures` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} request.filter - * Lists Features that match the filter expression, following the syntax - * outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Feature with the name "servicemesh" in project "foo-proj": - * - * name = "projects/foo-proj/locations/global/features/servicemesh" - * - * - Features that have a label called `foo`: - * - * labels.foo:* - * - * - Features that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * @param {string} request.orderBy - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 protos.google.cloud.gkehub.v1beta.Feature|Feature} 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 `listFeaturesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFeaturesStream( - request?: protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, - 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['listFeatures']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFeatures.createStream( - this.innerApiCalls.listFeatures as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFeatures`, 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 - * The parent (project and location) where the Features will be listed. - * Specified in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * When requesting a 'page' of resources, `page_size` specifies number of - * resources to return. If unspecified or set to 0, all resources will - * be returned. - * @param {string} request.pageToken - * Token returned by previous call to `ListFeatures` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} request.filter - * Lists Features that match the filter expression, following the syntax - * outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Feature with the name "servicemesh" in project "foo-proj": - * - * name = "projects/foo-proj/locations/global/features/servicemesh" - * - * - Features that have a label called `foo`: - * - * labels.foo:* - * - * - Features that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * @param {string} request.orderBy - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkehub.v1beta.Feature|Feature}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/gke_hub.list_features.js - * region_tag:gkehub_v1beta_generated_GkeHub_ListFeatures_async - */ - listFeaturesAsync( - request?: protos.google.cloud.gkehub.v1beta.IListFeaturesRequest, - 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['listFeatures']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFeatures.asyncIterate( - this.innerApiCalls['listFeatures'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified feature resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} feature - * @returns {string} Resource name string. - */ - featurePath(project:string,location:string,feature:string) { - return this.pathTemplates.featurePathTemplate.render({ - project: project, - location: location, - feature: feature, - }); - } - - /** - * Parse the project from Feature resource. - * - * @param {string} featureName - * A fully-qualified path representing Feature resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFeatureName(featureName: string) { - return this.pathTemplates.featurePathTemplate.match(featureName).project; - } - - /** - * Parse the location from Feature resource. - * - * @param {string} featureName - * A fully-qualified path representing Feature resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFeatureName(featureName: string) { - return this.pathTemplates.featurePathTemplate.match(featureName).location; - } - - /** - * Parse the feature from Feature resource. - * - * @param {string} featureName - * A fully-qualified path representing Feature resource. - * @returns {string} A string representing the feature. - */ - matchFeatureFromFeatureName(featureName: string) { - return this.pathTemplates.featurePathTemplate.match(featureName).feature; - } - - /** - * 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.gkeHubStub && !this._terminated) { - return this.gkeHubStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_client_config.json b/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_client_config.json deleted file mode 100644 index f7fe709c550..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_client_config.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "interfaces": { - "google.cloud.gkehub.v1beta.GkeHub": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListFeatures": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetFeature": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateFeature": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteFeature": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UpdateFeature": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_proto_list.json b/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_proto_list.json deleted file mode 100644 index 9c152a8109c..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/gke_hub_proto_list.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - "../../protos/google/cloud/gkehub/v1beta/configmanagement/configmanagement.proto", - "../../protos/google/cloud/gkehub/v1beta/feature.proto", - "../../protos/google/cloud/gkehub/v1beta/metering/metering.proto", - "../../protos/google/cloud/gkehub/v1beta/multiclusteringress/multiclusteringress.proto", - "../../protos/google/cloud/gkehub/v1beta/service.proto" -] diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/index.ts b/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/index.ts deleted file mode 100644 index aaf819215ae..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/src/v1beta/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 {GkeHubClient} from './gke_hub_client'; diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gkehub/v1beta/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 723143457a0..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/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 gkehub = require('@google-cloud/gke-hub'); - -function main() { - const gkeHubClient = new gkehub.GkeHubClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1beta/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 832fe8321c7..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/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 {GkeHubClient} from '@google-cloud/gke-hub'; - -// check that the client class type name can be used -function doStuffWithGkeHubClient(client: GkeHubClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const gkeHubClient = new GkeHubClient(); - doStuffWithGkeHubClient(gkeHubClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/system-test/install.ts b/owl-bot-staging/google-cloud-gkehub/v1beta/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/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-gkehub/v1beta/test/gapic_gke_hub_v1beta.ts b/owl-bot-staging/google-cloud-gkehub/v1beta/test/gapic_gke_hub_v1beta.ts deleted file mode 100644 index 534dec765ed..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/test/gapic_gke_hub_v1beta.ts +++ /dev/null @@ -1,1077 +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 gkehubModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta.GkeHubClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = gkehubModule.v1beta.GkeHubClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = gkehubModule.v1beta.GkeHubClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = gkehubModule.v1beta.GkeHubClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new gkehubModule.v1beta.GkeHubClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.gkeHubStub, undefined); - await client.initialize(); - assert(client.gkeHubStub); - }); - - it('has close method for the initialized client', done => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.gkeHubStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.gkeHubStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new gkehubModule.v1beta.GkeHubClient({ - 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 gkehubModule.v1beta.GkeHubClient({ - 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('getFeature', () => { - it('invokes getFeature without error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.GetFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.GetFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.Feature() - ); - client.innerApiCalls.getFeature = stubSimpleCall(expectedResponse); - const [response] = await client.getFeature(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeature without error using callback', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.GetFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.GetFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.Feature() - ); - client.innerApiCalls.getFeature = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFeature( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1beta.IFeature|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeature with error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.GetFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.GetFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFeature = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFeature(request), expectedError); - const actualRequest = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeature with closed client', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.GetFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.GetFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFeature(request), expectedError); - }); - }); - - describe('createFeature', () => { - it('invokes createFeature without error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.CreateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.CreateFeatureRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFeature = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFeature(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeature without error using callback', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.CreateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.CreateFeatureRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFeature = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFeature( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeature with call error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.CreateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.CreateFeatureRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFeature = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFeature(request), expectedError); - const actualRequest = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeature with LRO error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.CreateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.CreateFeatureRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFeature = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFeature(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateFeatureProgress without error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateFeatureProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateFeatureProgress with error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFeatureProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteFeature', () => { - it('invokes deleteFeature without error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.DeleteFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.DeleteFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFeature = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFeature(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeature without error using callback', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.DeleteFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.DeleteFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFeature = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFeature( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeature with call error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.DeleteFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.DeleteFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFeature = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFeature(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeature with LRO error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.DeleteFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.DeleteFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFeature = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFeature(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteFeatureProgress without error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteFeatureProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteFeatureProgress with error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFeatureProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateFeature', () => { - it('invokes updateFeature without error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.UpdateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.UpdateFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFeature = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFeature(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeature without error using callback', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.UpdateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.UpdateFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFeature = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFeature( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeature with call error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.UpdateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.UpdateFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFeature = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFeature(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeature with LRO error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.UpdateFeatureRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.UpdateFeatureRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFeature = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFeature(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeature as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateFeatureProgress without error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateFeatureProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateFeatureProgress with error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFeatureProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listFeatures', () => { - it('invokes listFeatures without error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), - ]; - client.innerApiCalls.listFeatures = stubSimpleCall(expectedResponse); - const [response] = await client.listFeatures(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeatures without error using callback', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), - ]; - client.innerApiCalls.listFeatures = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFeatures( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1beta.IFeature[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeatures with error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFeatures = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFeatures(request), expectedError); - const actualRequest = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeatures as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeaturesStream without error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), - ]; - client.descriptors.page.listFeatures.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFeaturesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkehub.v1beta.Feature[] = []; - stream.on('data', (response: protos.google.cloud.gkehub.v1beta.Feature) => { - 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.listFeatures.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFeatures, request)); - assert( - (client.descriptors.page.listFeatures.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFeaturesStream with error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFeatures.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFeaturesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkehub.v1beta.Feature[] = []; - stream.on('data', (response: protos.google.cloud.gkehub.v1beta.Feature) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFeatures.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFeatures, request)); - assert( - (client.descriptors.page.listFeatures.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFeatures without error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), - generateSampleMessage(new protos.google.cloud.gkehub.v1beta.Feature()), - ]; - client.descriptors.page.listFeatures.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkehub.v1beta.IFeature[] = []; - const iterable = client.listFeaturesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFeatures.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFeatures.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFeatures with error', async () => { - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta.ListFeaturesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta.ListFeaturesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFeatures.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFeaturesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkehub.v1beta.IFeature[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFeatures.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFeatures.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('feature', () => { - const fakePath = "/rendered/path/feature"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - feature: "featureValue", - }; - const client = new gkehubModule.v1beta.GkeHubClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.featurePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.featurePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('featurePath', () => { - const result = client.featurePath("projectValue", "locationValue", "featureValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.featurePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFeatureName', () => { - const result = client.matchProjectFromFeatureName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.featurePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFeatureName', () => { - const result = client.matchLocationFromFeatureName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.featurePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFeatureFromFeatureName', () => { - const result = client.matchFeatureFromFeatureName(fakePath); - assert.strictEqual(result, "featureValue"); - assert((client.pathTemplates.featurePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta/tsconfig.json b/owl-bot-staging/google-cloud-gkehub/v1beta/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/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-gkehub/v1beta/webpack.config.js b/owl-bot-staging/google-cloud-gkehub/v1beta/webpack.config.js deleted file mode 100644 index 71afa3a607d..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta/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: 'GkeHub', - filename: './gke-hub.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-gkehub/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-gkehub/v1beta1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-gkehub/v1beta1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/.gitignore b/owl-bot-staging/google-cloud-gkehub/v1beta1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/.jsdoc.js deleted file mode 100644 index b83282dcebb..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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/gke-hub', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1beta1/README.md b/owl-bot-staging/google-cloud-gkehub/v1beta1/README.md deleted file mode 100644 index f922950c787..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Gkehub: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/package.json b/owl-bot-staging/google-cloud-gkehub/v1beta1/package.json deleted file mode 100644 index a943aca7ef1..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/gke-hub", - "version": "0.1.0", - "description": "Gkehub client for Node.js", - "repository": "googleapis/nodejs-gkehub", - "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 gkehub", - "gkehub", - "gke hub membership service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/protos/google/cloud/gkehub/v1beta1/membership.proto b/owl-bot-staging/google-cloud-gkehub/v1beta1/protos/google/cloud/gkehub/v1beta1/membership.proto deleted file mode 100644 index 020ae85c3b8..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/protos/google/cloud/gkehub/v1beta1/membership.proto +++ /dev/null @@ -1,957 +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 -// -// 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.gkehub.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.GkeHub.V1Beta1"; -option go_package = "cloud.google.com/go/gkehub/apiv1beta1/gkehubpb;gkehubpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.gkehub.v1beta1"; -option php_namespace = "Google\\Cloud\\GkeHub\\V1beta1"; -option ruby_package = "Google::Cloud::GkeHub::V1beta1"; - -// The GKE Hub MembershipService handles the registration of many Kubernetes -// clusters to Google Cloud, represented with the -// [Membership][google.cloud.gkehub.v1beta1.Membership] resource. -// -// GKE Hub is currently available in the global region and all regions in -// https://cloud.google.com/compute/docs/regions-zones. -// -// **Membership management may be non-trivial:** it is recommended to use one -// of the Google-provided client libraries or tools where possible when working -// with Membership resources. -service GkeHubMembershipService { - option (google.api.default_host) = "gkehub.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists Memberships in a given project and location. - rpc ListMemberships(ListMembershipsRequest) - returns (ListMembershipsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/*}/memberships" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a Membership. - rpc GetMembership(GetMembershipRequest) returns (Membership) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*/memberships/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new Membership. - // - // **This is currently only supported for GKE clusters on Google Cloud**. - // To register other clusters, follow the instructions at - // https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster. - rpc CreateMembership(CreateMembershipRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{parent=projects/*/locations/*}/memberships" - body: "resource" - }; - option (google.api.method_signature) = "parent,resource,membership_id"; - option (google.longrunning.operation_info) = { - response_type: "Membership" - metadata_type: "OperationMetadata" - }; - } - - // Removes a Membership. - // - // **This is currently only supported for GKE clusters on Google Cloud**. - // To unregister other clusters, follow the instructions at - // https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. - rpc DeleteMembership(DeleteMembershipRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta1/{name=projects/*/locations/*/memberships/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Updates an existing Membership. - rpc UpdateMembership(UpdateMembershipRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta1/{name=projects/*/locations/*/memberships/*}" - body: "resource" - }; - option (google.api.method_signature) = "name,resource,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Membership" - metadata_type: "OperationMetadata" - }; - } - - // Generates the manifest for deployment of the GKE connect agent. - // - // **This method is used internally by Google-provided libraries.** - // Most clients should not need to call this method directly. - rpc GenerateConnectManifest(GenerateConnectManifestRequest) - returns (GenerateConnectManifestResponse) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*/memberships/*}:generateConnectManifest" - }; - } - - // ValidateExclusivity validates the state of exclusivity in the cluster. - // The validation does not depend on an existing Hub membership resource. - rpc ValidateExclusivity(ValidateExclusivityRequest) - returns (ValidateExclusivityResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/*}/memberships:validateExclusivity" - }; - } - - // GenerateExclusivityManifest generates the manifests to update the - // exclusivity artifacts in the cluster if needed. - // - // Exclusivity artifacts include the Membership custom resource definition - // (CRD) and the singleton Membership custom resource (CR). Combined with - // ValidateExclusivity, exclusivity artifacts guarantee that a Kubernetes - // cluster is only registered to a single GKE Hub. - // - // The Membership CRD is versioned, and may require conversion when the GKE - // Hub API server begins serving a newer version of the CRD and - // corresponding CR. The response will be the converted CRD and CR if there - // are any differences between the versions. - rpc GenerateExclusivityManifest(GenerateExclusivityManifestRequest) - returns (GenerateExclusivityManifestResponse) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*/memberships/*}:generateExclusivityManifest" - }; - } -} - -// Membership contains information about a member cluster. -message Membership { - option (google.api.resource) = { - type: "gkehub.googleapis.com/Membership" - pattern: "projects/{project}/locations/{location}/memberships/{membership}" - }; - - // Specifies the infrastructure type of a Membership. Infrastructure type is - // used by Hub to control infrastructure-specific behavior, including pricing. - // - // Each GKE distribution (on-GCP, on-Prem, on-X,...) will set this field - // automatically, but Attached Clusters customers should specify a type - // during registration. - enum InfrastructureType { - // No type was specified. Some Hub functionality may require a type be - // specified, and will not support Memberships with this value. - INFRASTRUCTURE_TYPE_UNSPECIFIED = 0; - - // Private infrastructure that is owned or operated by customer. This - // includes GKE distributions such as GKE-OnPrem and GKE-OnBareMetal. - ON_PREM = 1; - - // Public cloud infrastructure. - MULTI_CLOUD = 2; - } - - // Output only. The full, unique name of this Membership resource in the - // format `projects/*/locations/*/memberships/{membership_id}`, set during - // creation. - // - // `membership_id` must be a valid RFC 1123 compliant DNS label: - // - // 1. At most 63 characters in length - // 2. It must consist of lower case alphanumeric characters or `-` - // 3. It must start and end with an alphanumeric character - // - // Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, - // with a maximum length of 63 characters. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. GCP labels for this membership. - map labels = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Description of this membership, limited to 63 characters. - // Must match the regex: `[a-zA-Z0-9][a-zA-Z0-9_\-\.\ ]*` - string description = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Type of resource represented by this Membership - oneof type { - // Optional. Endpoint information to reach this member. - MembershipEndpoint endpoint = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // Output only. State of the Membership resource. - MembershipState state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. How to identify workloads from this Membership. - // See the documentation on Workload Identity for more details: - // https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity - Authority authority = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. When the Membership was created. - google.protobuf.Timestamp create_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the Membership was last updated. - google.protobuf.Timestamp update_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the Membership was deleted. - google.protobuf.Timestamp delete_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. An externally-generated and managed ID for this Membership. This - // ID may be modified after creation, but this is not recommended. For GKE - // clusters, external_id is managed by the Hub API and updates will be - // ignored. - // - // The ID must match the regex: `[a-zA-Z0-9][a-zA-Z0-9_\-\.]*` - // - // If this Membership represents a Kubernetes cluster, this value should be - // set to the UID of the `kube-system` namespace object. - string external_id = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. For clusters using Connect, the timestamp of the most recent - // connection established with Google Cloud. This time is updated every - // several minutes, not continuously. For clusters that do not use GKE - // Connect, or that have never connected successfully, this field will be - // unset. - google.protobuf.Timestamp last_connection_time = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Google-generated UUID for this resource. This is unique across - // all Membership resources. If a Membership resource is deleted and another - // resource with the same name is created, it gets a different unique_id. - string unique_id = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The infrastructure type this Membership is running on. - InfrastructureType infrastructure_type = 13 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The monitoring config information for this membership. - MonitoringConfig monitoring_config = 14 - [(google.api.field_behavior) = OPTIONAL]; -} - -// MembershipEndpoint contains information needed to contact a Kubernetes API, -// endpoint and any additional Kubernetes metadata. -message MembershipEndpoint { - // Cluster information of the registered cluster. - oneof type { - // Optional. Specific information for a GKE-on-GCP cluster. - GkeCluster gke_cluster = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specific information for a GKE On-Prem cluster. An onprem - // user-cluster who has no resourceLink is not allowed to use this field, it - // should have a nil "type" instead. - OnPremCluster on_prem_cluster = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specific information for a GKE Multi-Cloud cluster. - MultiCloudCluster multi_cloud_cluster = 8 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specific information for a Google Edge cluster. - EdgeCluster edge_cluster = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specific information for a GDC Edge Appliance cluster. - ApplianceCluster appliance_cluster = 10 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Output only. Useful Kubernetes-specific metadata. - KubernetesMetadata kubernetes_metadata = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The in-cluster Kubernetes Resources that should be applied for a - // correctly registered cluster, in the steady state. These resources: - // - // * Ensure that the cluster is exclusively registered to one and only one - // Hub Membership. - // * Propagate Workload Pool Information available in the Membership - // Authority field. - // * Ensure proper initial configuration of default Hub Features. - KubernetesResource kubernetes_resource = 6 - [(google.api.field_behavior) = OPTIONAL]; -} - -// KubernetesResource contains the YAML manifests and configuration for -// Membership Kubernetes resources in the cluster. After CreateMembership or -// UpdateMembership, these resources should be re-applied in the cluster. -message KubernetesResource { - // Input only. The YAML representation of the Membership CR. This field is - // ignored for GKE clusters where Hub can read the CR directly. - // - // Callers should provide the CR that is currently present in the cluster - // during CreateMembership or UpdateMembership, or leave this field empty if - // none exists. The CR manifest is used to validate the cluster has not been - // registered with another Membership. - string membership_cr_manifest = 1 [(google.api.field_behavior) = INPUT_ONLY]; - - // Output only. Additional Kubernetes resources that need to be applied to the - // cluster after Membership creation, and after every update. - // - // This field is only populated in the Membership returned from a successful - // long-running operation from CreateMembership or UpdateMembership. It is not - // populated during normal GetMembership or ListMemberships requests. To get - // the resource manifest after the initial registration, the caller should - // make a UpdateMembership call with an empty field mask. - repeated ResourceManifest membership_resources = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The Kubernetes resources for installing the GKE Connect agent - // - // This field is only populated in the Membership returned from a successful - // long-running operation from CreateMembership or UpdateMembership. It is not - // populated during normal GetMembership or ListMemberships requests. To get - // the resource manifest after the initial registration, the caller should - // make a UpdateMembership call with an empty field mask. - repeated ResourceManifest connect_resources = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Options for Kubernetes resource generation. - ResourceOptions resource_options = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// ResourceOptions represent options for Kubernetes resource generation. -message ResourceOptions { - // Optional. The Connect agent version to use for connect_resources. Defaults - // to the latest GKE Connect version. The version must be a currently - // supported version, obsolete versions will be rejected. - string connect_version = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Use `apiextensions/v1beta1` instead of `apiextensions/v1` for - // CustomResourceDefinition resources. - // This option should be set for clusters with Kubernetes apiserver versions - // <1.16. - bool v1beta1_crd = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Major version of the Kubernetes cluster. This is only used to - // determine which version to use for the CustomResourceDefinition resources, - // `apiextensions/v1beta1` or`apiextensions/v1`. - string k8s_version = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// ResourceManifest represents a single Kubernetes resource to be applied to -// the cluster. -message ResourceManifest { - // YAML manifest of the resource. - string manifest = 1; - - // Whether the resource provided in the manifest is `cluster_scoped`. - // If unset, the manifest is assumed to be namespace scoped. - // - // This field is used for REST mapping when applying the resource in a - // cluster. - bool cluster_scoped = 2; -} - -// GkeCluster contains information specific to GKE clusters. -message GkeCluster { - // Immutable. Self-link of the GCP resource for the GKE cluster. For example: - // - // //container.googleapis.com/projects/my-project/locations/us-west1-a/clusters/my-cluster - // - // Zonal clusters are also supported. - string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. If cluster_missing is set then it denotes that the GKE cluster - // no longer exists in the GKE Control Plane. - bool cluster_missing = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// OnPremCluster contains information specific to GKE On-Prem clusters. -message OnPremCluster { - // ClusterType describes on prem cluster's type. - enum ClusterType { - // The ClusterType is not set. - CLUSTERTYPE_UNSPECIFIED = 0; - - // The ClusterType is bootstrap cluster. - BOOTSTRAP = 1; - - // The ClusterType is baremetal hybrid cluster. - HYBRID = 2; - - // The ClusterType is baremetal standalone cluster. - STANDALONE = 3; - - // The ClusterType is user cluster. - USER = 4; - } - - // Immutable. Self-link of the GCP resource for the GKE On-Prem cluster. For - // example: - // - // //gkeonprem.googleapis.com/projects/my-project/locations/us-west1-a/vmwareClusters/my-cluster - // //gkeonprem.googleapis.com/projects/my-project/locations/us-west1-a/bareMetalClusters/my-cluster - string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. If cluster_missing is set then it denotes that - // API(gkeonprem.googleapis.com) resource for this GKE On-Prem cluster no - // longer exists. - bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Immutable. Whether the cluster is an admin cluster. - bool admin_cluster = 3 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. The on prem cluster's type. - ClusterType cluster_type = 4 [(google.api.field_behavior) = IMMUTABLE]; -} - -// MultiCloudCluster contains information specific to GKE Multi-Cloud clusters. -message MultiCloudCluster { - // Immutable. Self-link of the GCP resource for the GKE Multi-Cloud cluster. - // For example: - // - // //gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/awsClusters/my-cluster - // //gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/azureClusters/my-cluster - // //gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/attachedClusters/my-cluster - string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. If cluster_missing is set then it denotes that - // API(gkemulticloud.googleapis.com) resource for this GKE Multi-Cloud cluster - // no longer exists. - bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// EdgeCluster contains information specific to Google Edge Clusters. -message EdgeCluster { - // Immutable. Self-link of the GCP resource for the Edge Cluster. For - // example: - // - // //edgecontainer.googleapis.com/projects/my-project/locations/us-west1-a/clusters/my-cluster - string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; -} - -// ApplianceCluster contains information specific to GDC Edge Appliance -// Clusters. -message ApplianceCluster { - // Immutable. Self-link of the GCP resource for the Appliance Cluster. For - // example: - // - // //transferappliance.googleapis.com/projects/my-project/locations/us-west1-a/appliances/my-appliance - string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE]; -} - -// KubernetesMetadata provides informational metadata for Memberships -// representing Kubernetes clusters. -message KubernetesMetadata { - // Output only. Kubernetes API server version string as reported by - // '/version'. - string kubernetes_api_server_version = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Node providerID as reported by the first node in the list of - // nodes on the Kubernetes endpoint. On Kubernetes platforms that support - // zero-node clusters (like GKE-on-GCP), the node_count will be zero and the - // node_provider_id will be empty. - string node_provider_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Node count as reported by Kubernetes nodes resources. - int32 node_count = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. vCPU count as reported by Kubernetes nodes resources. - int32 vcpu_count = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The total memory capacity as reported by the sum of all - // Kubernetes nodes resources, defined in MB. - int32 memory_mb = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which these details were last updated. This - // update_time is different from the Membership-level update_time since - // EndpointDetails are updated internally for API consumers. - google.protobuf.Timestamp update_time = 100 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Authority encodes how Google will recognize identities from this Membership. -// See the workload identity documentation for more details: -// https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity -message Authority { - // Optional. A JSON Web Token (JWT) issuer URI. `issuer` must start with - // `https://` and be a valid URL with length <2000 characters. - // - // If set, then Google will allow valid OIDC tokens from this issuer to - // authenticate within the workload_identity_pool. OIDC discovery will be - // performed on this URI to validate tokens from the issuer. - // - // Clearing `issuer` disables Workload Identity. `issuer` cannot be directly - // modified; it must be cleared (and Workload Identity disabled) before using - // a new issuer (and re-enabling Workload Identity). - string issuer = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The name of the workload identity pool in which `issuer` will - // be recognized. - // - // There is a single Workload Identity Pool per Hub that is shared - // between all Memberships that belong to that Hub. For a Hub hosted in - // {PROJECT_ID}, the workload pool format is `{PROJECT_ID}.hub.id.goog`, - // although this is subject to change in newer versions of this API. - string workload_identity_pool = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. An identity provider that reflects the `issuer` in the - // workload identity pool. - string identity_provider = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. OIDC verification keys for this Membership in JWKS format (RFC - // 7517). - // - // When this field is set, OIDC discovery will NOT be performed on `issuer`, - // and instead OIDC tokens will be validated using this field. - bytes oidc_jwks = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// This field informs Fleet-based applications/services/UIs with the necessary -// information for where each underlying Cluster reports its metrics. -message MonitoringConfig { - // Immutable. Project used to report Metrics - string project_id = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. Location used to report Metrics - string location = 2 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. Cluster name used to report metrics. - // For Anthos on VMWare/Baremetal, it would be in format - // `memberClusters/cluster_name`; And for Anthos on MultiCloud, it would be in - // format - // `{azureClusters, awsClusters}/cluster_name`. - string cluster = 3 [(google.api.field_behavior) = IMMUTABLE]; - - // Kubernetes system metrics, if available, are written to this prefix. - // This defaults to kubernetes.io for GKE, and kubernetes.io/anthos for Anthos - // eventually. Noted: Anthos MultiCloud will have kubernetes.io prefix today - // but will migration to be under kubernetes.io/anthos - string kubernetes_metrics_prefix = 4; - - // Immutable. Cluster hash, this is a unique string generated by google code, - // which does not contain any PII, which we can use to reference the cluster. - // This is expected to be created by the monitoring stack and persisted into - // the Cluster object as well as to GKE-Hub. - string cluster_hash = 5 [(google.api.field_behavior) = IMMUTABLE]; -} - -// State of the Membership resource. -message MembershipState { - // Code describes the state of a Membership resource. - enum Code { - // The code is not set. - CODE_UNSPECIFIED = 0; - - // The cluster is being registered. - CREATING = 1; - - // The cluster is registered. - READY = 2; - - // The cluster is being unregistered. - DELETING = 3; - - // The Membership is being updated. - UPDATING = 4; - - // The Membership is being updated by the Hub Service. - SERVICE_UPDATING = 5; - } - - // Output only. The current state of the Membership resource. - Code code = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // This field is never set by the Hub Service. - string description = 2 [deprecated = true]; - - // This field is never set by the Hub Service. - google.protobuf.Timestamp update_time = 3 [deprecated = true]; -} - -// Request message for `GkeHubMembershipService.ListMemberships` method. -message ListMembershipsRequest { - // Required. The parent (project and location) where the Memberships will be - // listed. Specified in the format `projects/*/locations/*`. - // `projects/*/locations/-` list memberships in all the regions. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkehub.googleapis.com/Membership" - } - ]; - - // Optional. When requesting a 'page' of resources, `page_size` specifies - // number of resources to return. If unspecified or set to 0, all resources - // will be returned. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Token returned by previous call to `ListMemberships` which - // specifies the position in the list from where to continue listing the - // resources. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Lists Memberships that match the filter expression, following the - // syntax outlined in https://google.aip.dev/160. - // - // Examples: - // - // - Name is `bar` in project `foo-proj` and location `global`: - // - // name = "projects/foo-proj/locations/global/membership/bar" - // - // - Memberships that have a label called `foo`: - // - // labels.foo:* - // - // - Memberships that have a label called `foo` whose value is `bar`: - // - // labels.foo = bar - // - // - Memberships in the CREATING state: - // - // state = CREATING - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. One or more fields to compare and use to sort the output. - // See https://google.aip.dev/132#ordering. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for the `GkeHubMembershipService.ListMemberships` method. -message ListMembershipsResponse { - // The list of matching Memberships. - repeated Membership resources = 1; - - // A token to request the next page of resources from the - // `ListMemberships` method. The value of an empty string means that - // there are no more resources to return. - string next_page_token = 2; - - // List of locations that could not be reached while fetching this list. - repeated string unreachable = 3; -} - -// Request message for `GkeHubMembershipService.GetMembership` method. -message GetMembershipRequest { - // Required. The Membership resource name in the format - // `projects/*/locations/*/memberships/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkehub.googleapis.com/Membership" - } - ]; -} - -// Request message for the `GkeHubMembershipService.CreateMembership` method. -message CreateMembershipRequest { - // Required. The parent (project and location) where the Memberships will be - // created. Specified in the format `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkehub.googleapis.com/Membership" - } - ]; - - // Required. Client chosen ID for the membership. `membership_id` must be a - // valid RFC 1123 compliant DNS label: - // - // 1. At most 63 characters in length - // 2. It must consist of lower case alphanumeric characters or `-` - // 3. It must start and end with an alphanumeric character - // - // Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, - // with a maximum length of 63 characters. - string membership_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The membership to create. - Membership resource = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for `GkeHubMembershipService.DeleteMembership` method. -message DeleteMembershipRequest { - // Required. The Membership resource name in the format - // `projects/*/locations/*/memberships/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkehub.googleapis.com/Membership" - } - ]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to true, any subresource from this Membership will also be - // deleted. Otherwise, the request will only work if the Membership has no - // subresource. - bool force = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for `GkeHubMembershipService.UpdateMembership` method. -message UpdateMembershipRequest { - // Required. The membership resource name in the format: - // `projects/[project_id]/locations/global/memberships/[membership_id]` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkehub.googleapis.com/Membership" - } - ]; - - // Required. Mask of fields to update. At least one field path must be - // specified in this mask. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Required. Only fields specified in update_mask are updated. - // If you specify a field in the update_mask but don't specify its value here - // that field will be deleted. - // If you are updating a map field, set the value of a key to null or empty - // string to delete the key from the map. It's not possible to update a key's - // value to the empty string. - // If you specify the update_mask to be a special path "*", fully replaces all - // user-modifiable fields to match `resource`. - Membership resource = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for `GkeHubMembershipService.GenerateConnectManifest` -// method. -message GenerateConnectManifestRequest { - // Required. The Membership resource name the Agent will associate with, in - // the format `projects/*/locations/*/memberships/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkehub.googleapis.com/Membership" - } - ]; - - // Optional. The connect agent to generate manifest for. - ConnectAgent connect_agent = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Connect agent version to use. Defaults to the most current - // version. - string version = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true, generate the resources for upgrade only. Some resources - // generated only for installation (e.g. secrets) will be excluded. - bool is_upgrade = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The registry to fetch the connect agent image from. Defaults to - // gcr.io/gkeconnect. - string registry = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The image pull secret content for the registry, if not public. - bytes image_pull_secret_content = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// GenerateConnectManifestResponse contains manifest information for -// installing/upgrading a Connect agent. -message GenerateConnectManifestResponse { - // The ordered list of Kubernetes resources that need to be applied to the - // cluster for GKE Connect agent installation/upgrade. - repeated ConnectAgentResource manifest = 1; -} - -// ConnectAgentResource represents a Kubernetes resource manifest for Connect -// Agent deployment. -message ConnectAgentResource { - // Kubernetes type of the resource. - TypeMeta type = 1; - - // YAML manifest of the resource. - string manifest = 2; -} - -// TypeMeta is the type information needed for content unmarshalling of -// Kubernetes resources in the manifest. -message TypeMeta { - // Kind of the resource (e.g. Deployment). - string kind = 1; - - // APIVersion of the resource (e.g. v1). - string api_version = 2; -} - -// The information required from end users to use GKE Connect. -message ConnectAgent { - // Do not set. - string name = 1 [deprecated = true]; - - // Optional. URI of a proxy if connectivity from the agent to - // gkeconnect.googleapis.com requires the use of a proxy. Format must be in - // the form `http(s)://{proxy_address}`, depending on the HTTP/HTTPS protocol - // supported by the proxy. This will direct the connect agent's outbound - // traffic through a HTTP(S) proxy. - bytes proxy = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Namespace for GKE Connect agent resources. Defaults to - // `gke-connect`. - // - // The Connect Agent is authorized automatically when run in the default - // namespace. Otherwise, explicit authorization must be granted with an - // additional IAM binding. - string namespace = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request to validate the existing state of the membership CR in the -// cluster. -message ValidateExclusivityRequest { - // Required. The parent (project and location) where the Memberships will be - // created. Specified in the format `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkehub.googleapis.com/Membership" - } - ]; - - // Optional. The YAML of the membership CR in the cluster. Empty if the - // membership CR does not exist. - string cr_manifest = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The intended membership name under the `parent`. This method only - // does validation in anticipation of a CreateMembership call with the same - // name. - string intended_membership = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The response of exclusivity artifacts validation result status. -message ValidateExclusivityResponse { - // The validation result. - // - // * `OK` means that exclusivity is validated, assuming the manifest produced - // by GenerateExclusivityManifest is successfully applied. - // * `ALREADY_EXISTS` means that the Membership CRD is already owned by - // another Hub. See `status.message` for more information. - google.rpc.Status status = 1; -} - -// The request to generate the manifests for exclusivity artifacts. -message GenerateExclusivityManifestRequest { - // Required. The Membership resource name in the format - // `projects/*/locations/*/memberships/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkehub.googleapis.com/Membership" - } - ]; - - // Optional. The YAML manifest of the membership CRD retrieved by - // `kubectl get customresourcedefinitions membership`. - // Leave empty if the resource does not exist. - string crd_manifest = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The YAML manifest of the membership CR retrieved by - // `kubectl get memberships membership`. - // Leave empty if the resource does not exist. - string cr_manifest = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response of the exclusivity artifacts manifests for the client to apply. -message GenerateExclusivityManifestResponse { - // The YAML manifest of the membership CRD to apply if a newer version of the - // CRD is available. Empty if no update needs to be applied. - string crd_manifest = 1; - - // The YAML manifest of the membership CR to apply if a new version of the - // CR is available. Empty if no update needs to be applied. - string cr_manifest = 2; -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_detail = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a - // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - // `Code.CANCELLED`. - bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.create_membership.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.create_membership.js deleted file mode 100644 index eb27b631c61..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.create_membership.js +++ /dev/null @@ -1,93 +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, membershipId, resource) { - // [START gkehub_v1beta1_generated_GkeHubMembershipService_CreateMembership_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 parent (project and location) where the Memberships will be - * created. Specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Required. Client chosen ID for the membership. `membership_id` must be a - * valid RFC 1123 compliant DNS label: - * 1. At most 63 characters in length - * 2. It must consist of lower case alphanumeric characters or `-` - * 3. It must start and end with an alphanumeric character - * Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, - * with a maximum length of 63 characters. - */ - // const membershipId = 'abc123' - /** - * Required. The membership to create. - */ - // const resource = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Gkehub library - const {GkeHubMembershipServiceClient} = require('@google-cloud/gke-hub').v1beta1; - - // Instantiates a client - const gkehubClient = new GkeHubMembershipServiceClient(); - - async function callCreateMembership() { - // Construct request - const request = { - parent, - membershipId, - resource, - }; - - // Run request - const [operation] = await gkehubClient.createMembership(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateMembership(); - // [END gkehub_v1beta1_generated_GkeHubMembershipService_CreateMembership_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-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.delete_membership.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.delete_membership.js deleted file mode 100644 index b2130d83ad8..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.delete_membership.js +++ /dev/null @@ -1,83 +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 gkehub_v1beta1_generated_GkeHubMembershipService_DeleteMembership_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 Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - */ - // const name = 'abc123' - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - /** - * Optional. If set to true, any subresource from this Membership will also be - * deleted. Otherwise, the request will only work if the Membership has no - * subresource. - */ - // const force = true - - // Imports the Gkehub library - const {GkeHubMembershipServiceClient} = require('@google-cloud/gke-hub').v1beta1; - - // Instantiates a client - const gkehubClient = new GkeHubMembershipServiceClient(); - - async function callDeleteMembership() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await gkehubClient.deleteMembership(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteMembership(); - // [END gkehub_v1beta1_generated_GkeHubMembershipService_DeleteMembership_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-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.generate_connect_manifest.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.generate_connect_manifest.js deleted file mode 100644 index 1619ca2c71e..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.generate_connect_manifest.js +++ /dev/null @@ -1,85 +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 gkehub_v1beta1_generated_GkeHubMembershipService_GenerateConnectManifest_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 Membership resource name the Agent will associate with, in - * the format `projects/* /locations/* /memberships/*`. - */ - // const name = 'abc123' - /** - * Optional. The connect agent to generate manifest for. - */ - // const connectAgent = {} - /** - * Optional. The Connect agent version to use. Defaults to the most current - * version. - */ - // const version = 'abc123' - /** - * Optional. If true, generate the resources for upgrade only. Some resources - * generated only for installation (e.g. secrets) will be excluded. - */ - // const isUpgrade = true - /** - * Optional. The registry to fetch the connect agent image from. Defaults to - * gcr.io/gkeconnect. - */ - // const registry = 'abc123' - /** - * Optional. The image pull secret content for the registry, if not public. - */ - // const imagePullSecretContent = Buffer.from('string') - - // Imports the Gkehub library - const {GkeHubMembershipServiceClient} = require('@google-cloud/gke-hub').v1beta1; - - // Instantiates a client - const gkehubClient = new GkeHubMembershipServiceClient(); - - async function callGenerateConnectManifest() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkehubClient.generateConnectManifest(request); - console.log(response); - } - - callGenerateConnectManifest(); - // [END gkehub_v1beta1_generated_GkeHubMembershipService_GenerateConnectManifest_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-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.generate_exclusivity_manifest.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.generate_exclusivity_manifest.js deleted file mode 100644 index 2c59eb90cf7..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.generate_exclusivity_manifest.js +++ /dev/null @@ -1,74 +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 gkehub_v1beta1_generated_GkeHubMembershipService_GenerateExclusivityManifest_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 Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - */ - // const name = 'abc123' - /** - * Optional. The YAML manifest of the membership CRD retrieved by - * `kubectl get customresourcedefinitions membership`. - * Leave empty if the resource does not exist. - */ - // const crdManifest = 'abc123' - /** - * Optional. The YAML manifest of the membership CR retrieved by - * `kubectl get memberships membership`. - * Leave empty if the resource does not exist. - */ - // const crManifest = 'abc123' - - // Imports the Gkehub library - const {GkeHubMembershipServiceClient} = require('@google-cloud/gke-hub').v1beta1; - - // Instantiates a client - const gkehubClient = new GkeHubMembershipServiceClient(); - - async function callGenerateExclusivityManifest() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkehubClient.generateExclusivityManifest(request); - console.log(response); - } - - callGenerateExclusivityManifest(); - // [END gkehub_v1beta1_generated_GkeHubMembershipService_GenerateExclusivityManifest_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-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.get_membership.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.get_membership.js deleted file mode 100644 index 47b4a34e274..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.get_membership.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 gkehub_v1beta1_generated_GkeHubMembershipService_GetMembership_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 Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - */ - // const name = 'abc123' - - // Imports the Gkehub library - const {GkeHubMembershipServiceClient} = require('@google-cloud/gke-hub').v1beta1; - - // Instantiates a client - const gkehubClient = new GkeHubMembershipServiceClient(); - - async function callGetMembership() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkehubClient.getMembership(request); - console.log(response); - } - - callGetMembership(); - // [END gkehub_v1beta1_generated_GkeHubMembershipService_GetMembership_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-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.list_memberships.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.list_memberships.js deleted file mode 100644 index 12583756216..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.list_memberships.js +++ /dev/null @@ -1,96 +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 gkehub_v1beta1_generated_GkeHubMembershipService_ListMemberships_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 parent (project and location) where the Memberships will be - * listed. Specified in the format `projects/* /locations/*`. - * `projects/* /locations/-` list memberships in all the regions. - */ - // const parent = 'abc123' - /** - * Optional. When requesting a 'page' of resources, `page_size` specifies - * number of resources to return. If unspecified or set to 0, all resources - * will be returned. - */ - // const pageSize = 1234 - /** - * Optional. Token returned by previous call to `ListMemberships` which - * specifies the position in the list from where to continue listing the - * resources. - */ - // const pageToken = 'abc123' - /** - * Optional. Lists Memberships that match the filter expression, following the - * syntax outlined in https://google.aip.dev/160. - * Examples: - * - Name is `bar` in project `foo-proj` and location `global`: - * name = "projects/foo-proj/locations/global/membership/bar" - * - Memberships that have a label called `foo`: - * labels.foo:* - * - Memberships that have a label called `foo` whose value is `bar`: - * labels.foo = bar - * - Memberships in the CREATING state: - * state = CREATING - */ - // const filter = 'abc123' - /** - * Optional. One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - */ - // const orderBy = 'abc123' - - // Imports the Gkehub library - const {GkeHubMembershipServiceClient} = require('@google-cloud/gke-hub').v1beta1; - - // Instantiates a client - const gkehubClient = new GkeHubMembershipServiceClient(); - - async function callListMemberships() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await gkehubClient.listMembershipsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMemberships(); - // [END gkehub_v1beta1_generated_GkeHubMembershipService_ListMemberships_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-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.update_membership.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.update_membership.js deleted file mode 100644 index 31bdd476985..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.update_membership.js +++ /dev/null @@ -1,95 +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, updateMask, resource) { - // [START gkehub_v1beta1_generated_GkeHubMembershipService_UpdateMembership_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 membership resource name in the format: - * `projects/[project_id]/locations/global/memberships/[membership_id]` - */ - // const name = 'abc123' - /** - * Required. Mask of fields to update. At least one field path must be - * specified in this mask. - */ - // const updateMask = {} - /** - * Required. Only fields specified in update_mask are updated. - * If you specify a field in the update_mask but don't specify its value here - * that field will be deleted. - * If you are updating a map field, set the value of a key to null or empty - * string to delete the key from the map. It's not possible to update a key's - * value to the empty string. - * If you specify the update_mask to be a special path "*", fully replaces all - * user-modifiable fields to match `resource`. - */ - // const resource = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Gkehub library - const {GkeHubMembershipServiceClient} = require('@google-cloud/gke-hub').v1beta1; - - // Instantiates a client - const gkehubClient = new GkeHubMembershipServiceClient(); - - async function callUpdateMembership() { - // Construct request - const request = { - name, - updateMask, - resource, - }; - - // Run request - const [operation] = await gkehubClient.updateMembership(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateMembership(); - // [END gkehub_v1beta1_generated_GkeHubMembershipService_UpdateMembership_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-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.validate_exclusivity.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.validate_exclusivity.js deleted file mode 100644 index 9246cbeddb0..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/gke_hub_membership_service.validate_exclusivity.js +++ /dev/null @@ -1,74 +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, intendedMembership) { - // [START gkehub_v1beta1_generated_GkeHubMembershipService_ValidateExclusivity_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 parent (project and location) where the Memberships will be - * created. Specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Optional. The YAML of the membership CR in the cluster. Empty if the - * membership CR does not exist. - */ - // const crManifest = 'abc123' - /** - * Required. The intended membership name under the `parent`. This method only - * does validation in anticipation of a CreateMembership call with the same - * name. - */ - // const intendedMembership = 'abc123' - - // Imports the Gkehub library - const {GkeHubMembershipServiceClient} = require('@google-cloud/gke-hub').v1beta1; - - // Instantiates a client - const gkehubClient = new GkeHubMembershipServiceClient(); - - async function callValidateExclusivity() { - // Construct request - const request = { - parent, - intendedMembership, - }; - - // Run request - const response = await gkehubClient.validateExclusivity(request); - console.log(response); - } - - callValidateExclusivity(); - // [END gkehub_v1beta1_generated_GkeHubMembershipService_ValidateExclusivity_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-gkehub/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.gkehub.v1beta1.json b/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.gkehub.v1beta1.json deleted file mode 100644 index 4efbecc60f8..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.gkehub.v1beta1.json +++ /dev/null @@ -1,419 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-gkehub", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.gkehub.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "gkehub_v1beta1_generated_GkeHubMembershipService_ListMemberships_async", - "title": "GkeHubMembershipService listMemberships Sample", - "origin": "API_DEFINITION", - "description": " Lists Memberships in a given project and location.", - "canonical": true, - "file": "gke_hub_membership_service.list_memberships.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 88, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMemberships", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.ListMemberships", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkehub.v1beta1.ListMembershipsResponse", - "client": { - "shortName": "GkeHubMembershipServiceClient", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClient" - }, - "method": { - "shortName": "ListMemberships", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.ListMemberships", - "service": { - "shortName": "GkeHubMembershipService", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService" - } - } - } - }, - { - "regionTag": "gkehub_v1beta1_generated_GkeHubMembershipService_GetMembership_async", - "title": "GkeHubMembershipService getMembership Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a Membership.", - "canonical": true, - "file": "gke_hub_membership_service.get_membership.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetMembership", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.GetMembership", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkehub.v1beta1.Membership", - "client": { - "shortName": "GkeHubMembershipServiceClient", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClient" - }, - "method": { - "shortName": "GetMembership", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.GetMembership", - "service": { - "shortName": "GkeHubMembershipService", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService" - } - } - } - }, - { - "regionTag": "gkehub_v1beta1_generated_GkeHubMembershipService_CreateMembership_async", - "title": "GkeHubMembershipService createMembership Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Membership. **This is currently only supported for GKE clusters on Google Cloud**. To register other clusters, follow the instructions at https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster.", - "canonical": true, - "file": "gke_hub_membership_service.create_membership.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMembership", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.CreateMembership", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "membership_id", - "type": "TYPE_STRING" - }, - { - "name": "resource", - "type": ".google.cloud.gkehub.v1beta1.Membership" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubMembershipServiceClient", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClient" - }, - "method": { - "shortName": "CreateMembership", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.CreateMembership", - "service": { - "shortName": "GkeHubMembershipService", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService" - } - } - } - }, - { - "regionTag": "gkehub_v1beta1_generated_GkeHubMembershipService_DeleteMembership_async", - "title": "GkeHubMembershipService deleteMembership Sample", - "origin": "API_DEFINITION", - "description": " Removes a Membership. **This is currently only supported for GKE clusters on Google Cloud**. To unregister other clusters, follow the instructions at https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster.", - "canonical": true, - "file": "gke_hub_membership_service.delete_membership.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteMembership", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.DeleteMembership", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubMembershipServiceClient", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClient" - }, - "method": { - "shortName": "DeleteMembership", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.DeleteMembership", - "service": { - "shortName": "GkeHubMembershipService", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService" - } - } - } - }, - { - "regionTag": "gkehub_v1beta1_generated_GkeHubMembershipService_UpdateMembership_async", - "title": "GkeHubMembershipService updateMembership Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing Membership.", - "canonical": true, - "file": "gke_hub_membership_service.update_membership.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateMembership", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.UpdateMembership", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "resource", - "type": ".google.cloud.gkehub.v1beta1.Membership" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "GkeHubMembershipServiceClient", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClient" - }, - "method": { - "shortName": "UpdateMembership", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.UpdateMembership", - "service": { - "shortName": "GkeHubMembershipService", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService" - } - } - } - }, - { - "regionTag": "gkehub_v1beta1_generated_GkeHubMembershipService_GenerateConnectManifest_async", - "title": "GkeHubMembershipService generateConnectManifest Sample", - "origin": "API_DEFINITION", - "description": " Generates the manifest for deployment of the GKE connect agent. **This method is used internally by Google-provided libraries.** Most clients should not need to call this method directly.", - "canonical": true, - "file": "gke_hub_membership_service.generate_connect_manifest.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateConnectManifest", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.GenerateConnectManifest", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "connect_agent", - "type": ".google.cloud.gkehub.v1beta1.ConnectAgent" - }, - { - "name": "version", - "type": "TYPE_STRING" - }, - { - "name": "is_upgrade", - "type": "TYPE_BOOL" - }, - { - "name": "registry", - "type": "TYPE_STRING" - }, - { - "name": "image_pull_secret_content", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.gkehub.v1beta1.GenerateConnectManifestResponse", - "client": { - "shortName": "GkeHubMembershipServiceClient", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClient" - }, - "method": { - "shortName": "GenerateConnectManifest", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.GenerateConnectManifest", - "service": { - "shortName": "GkeHubMembershipService", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService" - } - } - } - }, - { - "regionTag": "gkehub_v1beta1_generated_GkeHubMembershipService_ValidateExclusivity_async", - "title": "GkeHubMembershipService validateExclusivity Sample", - "origin": "API_DEFINITION", - "description": " ValidateExclusivity validates the state of exclusivity in the cluster. The validation does not depend on an existing Hub membership resource.", - "canonical": true, - "file": "gke_hub_membership_service.validate_exclusivity.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ValidateExclusivity", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.ValidateExclusivity", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "cr_manifest", - "type": "TYPE_STRING" - }, - { - "name": "intended_membership", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkehub.v1beta1.ValidateExclusivityResponse", - "client": { - "shortName": "GkeHubMembershipServiceClient", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClient" - }, - "method": { - "shortName": "ValidateExclusivity", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.ValidateExclusivity", - "service": { - "shortName": "GkeHubMembershipService", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService" - } - } - } - }, - { - "regionTag": "gkehub_v1beta1_generated_GkeHubMembershipService_GenerateExclusivityManifest_async", - "title": "GkeHubMembershipService generateExclusivityManifest Sample", - "origin": "API_DEFINITION", - "description": " GenerateExclusivityManifest generates the manifests to update the exclusivity artifacts in the cluster if needed. Exclusivity artifacts include the Membership custom resource definition (CRD) and the singleton Membership custom resource (CR). Combined with ValidateExclusivity, exclusivity artifacts guarantee that a Kubernetes cluster is only registered to a single GKE Hub. The Membership CRD is versioned, and may require conversion when the GKE Hub API server begins serving a newer version of the CRD and corresponding CR. The response will be the converted CRD and CR if there are any differences between the versions.", - "canonical": true, - "file": "gke_hub_membership_service.generate_exclusivity_manifest.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateExclusivityManifest", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.GenerateExclusivityManifest", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "crd_manifest", - "type": "TYPE_STRING" - }, - { - "name": "cr_manifest", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkehub.v1beta1.GenerateExclusivityManifestResponse", - "client": { - "shortName": "GkeHubMembershipServiceClient", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClient" - }, - "method": { - "shortName": "GenerateExclusivityManifest", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService.GenerateExclusivityManifest", - "service": { - "shortName": "GkeHubMembershipService", - "fullName": "google.cloud.gkehub.v1beta1.GkeHubMembershipService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1beta1/src/index.ts deleted file mode 100644 index f9d7fdb83fd..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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 GkeHubMembershipServiceClient = v1beta1.GkeHubMembershipServiceClient; -type GkeHubMembershipServiceClient = v1beta1.GkeHubMembershipServiceClient; -export {v1beta1, GkeHubMembershipServiceClient}; -export default {v1beta1, GkeHubMembershipServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gapic_metadata.json deleted file mode 100644 index 71bee1bd2c8..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gapic_metadata.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.gkehub.v1beta1", - "libraryPackage": "@google-cloud/gke-hub", - "services": { - "GkeHubMembershipService": { - "clients": { - "grpc": { - "libraryClient": "GkeHubMembershipServiceClient", - "rpcs": { - "GetMembership": { - "methods": [ - "getMembership" - ] - }, - "GenerateConnectManifest": { - "methods": [ - "generateConnectManifest" - ] - }, - "ValidateExclusivity": { - "methods": [ - "validateExclusivity" - ] - }, - "GenerateExclusivityManifest": { - "methods": [ - "generateExclusivityManifest" - ] - }, - "CreateMembership": { - "methods": [ - "createMembership" - ] - }, - "DeleteMembership": { - "methods": [ - "deleteMembership" - ] - }, - "UpdateMembership": { - "methods": [ - "updateMembership" - ] - }, - "ListMemberships": { - "methods": [ - "listMemberships", - "listMembershipsStream", - "listMembershipsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "GkeHubMembershipServiceClient", - "rpcs": { - "GetMembership": { - "methods": [ - "getMembership" - ] - }, - "GenerateConnectManifest": { - "methods": [ - "generateConnectManifest" - ] - }, - "ValidateExclusivity": { - "methods": [ - "validateExclusivity" - ] - }, - "GenerateExclusivityManifest": { - "methods": [ - "generateExclusivityManifest" - ] - }, - "CreateMembership": { - "methods": [ - "createMembership" - ] - }, - "DeleteMembership": { - "methods": [ - "deleteMembership" - ] - }, - "UpdateMembership": { - "methods": [ - "updateMembership" - ] - }, - "ListMemberships": { - "methods": [ - "listMemberships", - "listMembershipsStream", - "listMembershipsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_client.ts b/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_client.ts deleted file mode 100644 index c46466f8f21..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_client.ts +++ /dev/null @@ -1,1832 +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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/gke_hub_membership_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './gke_hub_membership_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The GKE Hub MembershipService handles the registration of many Kubernetes - * clusters to Google Cloud, represented with the - * {@link protos.google.cloud.gkehub.v1beta1.Membership|Membership} resource. - * - * GKE Hub is currently available in the global region and all regions in - * https://cloud.google.com/compute/docs/regions-zones. - * - * **Membership management may be non-trivial:** it is recommended to use one - * of the Google-provided client libraries or tools where possible when working - * with Membership resources. - * @class - * @memberof v1beta1 - */ -export class GkeHubMembershipServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - gkeHubMembershipServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of GkeHubMembershipServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 GkeHubMembershipServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof GkeHubMembershipServiceClient; - 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; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - 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 = { - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - membershipPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/memberships/{membership}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - }; - - // 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 = { - listMemberships: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta1/{resource=projects/*/locations/*/memberships/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta1/{resource=projects/*/locations/*/memberships/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta1/{resource=projects/*/locations/*/memberships/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createMembershipResponse = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1beta1.Membership') as gax.protobuf.Type; - const createMembershipMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1beta1.OperationMetadata') as gax.protobuf.Type; - const deleteMembershipResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteMembershipMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1beta1.OperationMetadata') as gax.protobuf.Type; - const updateMembershipResponse = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1beta1.Membership') as gax.protobuf.Type; - const updateMembershipMetadata = protoFilesRoot.lookup( - '.google.cloud.gkehub.v1beta1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createMembership: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createMembershipResponse.decode.bind(createMembershipResponse), - createMembershipMetadata.decode.bind(createMembershipMetadata)), - deleteMembership: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteMembershipResponse.decode.bind(deleteMembershipResponse), - deleteMembershipMetadata.decode.bind(deleteMembershipMetadata)), - updateMembership: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateMembershipResponse.decode.bind(updateMembershipResponse), - updateMembershipMetadata.decode.bind(updateMembershipMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.gkehub.v1beta1.GkeHubMembershipService', 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.gkeHubMembershipServiceStub) { - return this.gkeHubMembershipServiceStub; - } - - // Put together the "service stub" for - // google.cloud.gkehub.v1beta1.GkeHubMembershipService. - this.gkeHubMembershipServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.gkehub.v1beta1.GkeHubMembershipService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.gkehub.v1beta1.GkeHubMembershipService, - 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 gkeHubMembershipServiceStubMethods = - ['listMemberships', 'getMembership', 'createMembership', 'deleteMembership', 'updateMembership', 'generateConnectManifest', 'validateExclusivity', 'generateExclusivityManifest']; - for (const methodName of gkeHubMembershipServiceStubMethods) { - const callPromise = this.gkeHubMembershipServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.gkeHubMembershipServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'gkehub.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 'gkehub.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 -- - // ------------------- -/** - * Gets the details of a Membership. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1beta1.Membership|Membership}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/gke_hub_membership_service.get_membership.js - * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_GetMembership_async - */ - getMembership( - request?: protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1beta1.IMembership, - protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest|undefined, {}|undefined - ]>; - getMembership( - request: protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkehub.v1beta1.IMembership, - protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest|null|undefined, - {}|null|undefined>): void; - getMembership( - request: protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest, - callback: Callback< - protos.google.cloud.gkehub.v1beta1.IMembership, - protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest|null|undefined, - {}|null|undefined>): void; - getMembership( - request?: protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkehub.v1beta1.IMembership, - protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkehub.v1beta1.IMembership, - protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkehub.v1beta1.IMembership, - protos.google.cloud.gkehub.v1beta1.IGetMembershipRequest|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.getMembership(request, options, callback); - } -/** - * Generates the manifest for deployment of the GKE connect agent. - * - * **This method is used internally by Google-provided libraries.** - * Most clients should not need to call this method directly. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Membership resource name the Agent will associate with, in - * the format `projects/* /locations/* /memberships/*`. - * @param {google.cloud.gkehub.v1beta1.ConnectAgent} [request.connectAgent] - * Optional. The connect agent to generate manifest for. - * @param {string} [request.version] - * Optional. The Connect agent version to use. Defaults to the most current - * version. - * @param {boolean} [request.isUpgrade] - * Optional. If true, generate the resources for upgrade only. Some resources - * generated only for installation (e.g. secrets) will be excluded. - * @param {string} [request.registry] - * Optional. The registry to fetch the connect agent image from. Defaults to - * gcr.io/gkeconnect. - * @param {Buffer} [request.imagePullSecretContent] - * Optional. The image pull secret content for the registry, if not public. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1beta1.GenerateConnectManifestResponse|GenerateConnectManifestResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/gke_hub_membership_service.generate_connect_manifest.js - * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_GenerateConnectManifest_async - */ - generateConnectManifest( - request?: protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest|undefined, {}|undefined - ]>; - generateConnectManifest( - request: protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest|null|undefined, - {}|null|undefined>): void; - generateConnectManifest( - request: protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest, - callback: Callback< - protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest|null|undefined, - {}|null|undefined>): void; - generateConnectManifest( - request?: protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestResponse, - protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestRequest|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.generateConnectManifest(request, options, callback); - } -/** - * ValidateExclusivity validates the state of exclusivity in the cluster. - * The validation does not depend on an existing Hub membership resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) where the Memberships will be - * created. Specified in the format `projects/* /locations/*`. - * @param {string} [request.crManifest] - * Optional. The YAML of the membership CR in the cluster. Empty if the - * membership CR does not exist. - * @param {string} request.intendedMembership - * Required. The intended membership name under the `parent`. This method only - * does validation in anticipation of a CreateMembership call with the same - * name. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.gkehub.v1beta1.ValidateExclusivityResponse|ValidateExclusivityResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/gke_hub_membership_service.validate_exclusivity.js - * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_ValidateExclusivity_async - */ - validateExclusivity( - request?: protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1beta1.IValidateExclusivityResponse, - protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest|undefined, {}|undefined - ]>; - validateExclusivity( - request: protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkehub.v1beta1.IValidateExclusivityResponse, - protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest|null|undefined, - {}|null|undefined>): void; - validateExclusivity( - request: protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest, - callback: Callback< - protos.google.cloud.gkehub.v1beta1.IValidateExclusivityResponse, - protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest|null|undefined, - {}|null|undefined>): void; - validateExclusivity( - request?: protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkehub.v1beta1.IValidateExclusivityResponse, - protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkehub.v1beta1.IValidateExclusivityResponse, - protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkehub.v1beta1.IValidateExclusivityResponse, - protos.google.cloud.gkehub.v1beta1.IValidateExclusivityRequest|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.validateExclusivity(request, options, callback); - } -/** - * GenerateExclusivityManifest generates the manifests to update the - * exclusivity artifacts in the cluster if needed. - * - * Exclusivity artifacts include the Membership custom resource definition - * (CRD) and the singleton Membership custom resource (CR). Combined with - * ValidateExclusivity, exclusivity artifacts guarantee that a Kubernetes - * cluster is only registered to a single GKE Hub. - * - * The Membership CRD is versioned, and may require conversion when the GKE - * Hub API server begins serving a newer version of the CRD and - * corresponding CR. The response will be the converted CRD and CR if there - * are any differences between the versions. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - * @param {string} [request.crdManifest] - * Optional. The YAML manifest of the membership CRD retrieved by - * `kubectl get customresourcedefinitions membership`. - * Leave empty if the resource does not exist. - * @param {string} [request.crManifest] - * Optional. The YAML manifest of the membership CR retrieved by - * `kubectl get memberships membership`. - * Leave empty if the resource does not exist. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestResponse|GenerateExclusivityManifestResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/gke_hub_membership_service.generate_exclusivity_manifest.js - * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_GenerateExclusivityManifest_async - */ - generateExclusivityManifest( - request?: protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestResponse, - protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest|undefined, {}|undefined - ]>; - generateExclusivityManifest( - request: protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestResponse, - protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest|null|undefined, - {}|null|undefined>): void; - generateExclusivityManifest( - request: protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest, - callback: Callback< - protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestResponse, - protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest|null|undefined, - {}|null|undefined>): void; - generateExclusivityManifest( - request?: protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestResponse, - protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestResponse, - protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestResponse, - protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestRequest|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.generateExclusivityManifest(request, options, callback); - } - -/** - * Creates a new Membership. - * - * **This is currently only supported for GKE clusters on Google Cloud**. - * To register other clusters, follow the instructions at - * https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) where the Memberships will be - * created. Specified in the format `projects/* /locations/*`. - * @param {string} request.membershipId - * Required. Client chosen ID for the membership. `membership_id` must be a - * valid RFC 1123 compliant DNS label: - * - * 1. At most 63 characters in length - * 2. It must consist of lower case alphanumeric characters or `-` - * 3. It must start and end with an alphanumeric character - * - * Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, - * with a maximum length of 63 characters. - * @param {google.cloud.gkehub.v1beta1.Membership} request.resource - * Required. The membership to create. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/gke_hub_membership_service.create_membership.js - * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_CreateMembership_async - */ - createMembership( - request?: protos.google.cloud.gkehub.v1beta1.ICreateMembershipRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createMembership( - request: protos.google.cloud.gkehub.v1beta1.ICreateMembershipRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMembership( - request: protos.google.cloud.gkehub.v1beta1.ICreateMembershipRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMembership( - request?: protos.google.cloud.gkehub.v1beta1.ICreateMembershipRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createMembership(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createMembership()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/gke_hub_membership_service.create_membership.js - * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_CreateMembership_async - */ - async checkCreateMembershipProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMembership, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Removes a Membership. - * - * **This is currently only supported for GKE clusters on Google Cloud**. - * To unregister other clusters, follow the instructions at - * https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Membership resource name in the format - * `projects/* /locations/* /memberships/*`. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.force] - * Optional. If set to true, any subresource from this Membership will also be - * deleted. Otherwise, the request will only work if the Membership has no - * subresource. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/gke_hub_membership_service.delete_membership.js - * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_DeleteMembership_async - */ - deleteMembership( - request?: protos.google.cloud.gkehub.v1beta1.IDeleteMembershipRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteMembership( - request: protos.google.cloud.gkehub.v1beta1.IDeleteMembershipRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteMembership( - request: protos.google.cloud.gkehub.v1beta1.IDeleteMembershipRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteMembership( - request?: protos.google.cloud.gkehub.v1beta1.IDeleteMembershipRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteMembership(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteMembership()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/gke_hub_membership_service.delete_membership.js - * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_DeleteMembership_async - */ - async checkDeleteMembershipProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteMembership, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an existing Membership. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The membership resource name in the format: - * `projects/[project_id]/locations/global/memberships/[membership_id]` - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. At least one field path must be - * specified in this mask. - * @param {google.cloud.gkehub.v1beta1.Membership} request.resource - * Required. Only fields specified in update_mask are updated. - * If you specify a field in the update_mask but don't specify its value here - * that field will be deleted. - * If you are updating a map field, set the value of a key to null or empty - * string to delete the key from the map. It's not possible to update a key's - * value to the empty string. - * If you specify the update_mask to be a special path "*", fully replaces all - * user-modifiable fields to match `resource`. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/gke_hub_membership_service.update_membership.js - * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_UpdateMembership_async - */ - updateMembership( - request?: protos.google.cloud.gkehub.v1beta1.IUpdateMembershipRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateMembership( - request: protos.google.cloud.gkehub.v1beta1.IUpdateMembershipRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMembership( - request: protos.google.cloud.gkehub.v1beta1.IUpdateMembershipRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMembership( - request?: protos.google.cloud.gkehub.v1beta1.IUpdateMembershipRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateMembership(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateMembership()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/gke_hub_membership_service.update_membership.js - * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_UpdateMembership_async - */ - async checkUpdateMembershipProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMembership, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Memberships in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) where the Memberships will be - * listed. Specified in the format `projects/* /locations/*`. - * `projects/* /locations/-` list memberships in all the regions. - * @param {number} [request.pageSize] - * Optional. When requesting a 'page' of resources, `page_size` specifies - * number of resources to return. If unspecified or set to 0, all resources - * will be returned. - * @param {string} [request.pageToken] - * Optional. Token returned by previous call to `ListMemberships` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} [request.filter] - * Optional. Lists Memberships that match the filter expression, following the - * syntax outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Name is `bar` in project `foo-proj` and location `global`: - * - * name = "projects/foo-proj/locations/global/membership/bar" - * - * - Memberships that have a label called `foo`: - * - * labels.foo:* - * - * - Memberships that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * - * - Memberships in the CREATING state: - * - * state = CREATING - * @param {string} [request.orderBy] - * Optional. One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkehub.v1beta1.Membership|Membership}. - * 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 `listMembershipsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMemberships( - request?: protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkehub.v1beta1.IMembership[], - protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest|null, - protos.google.cloud.gkehub.v1beta1.IListMembershipsResponse - ]>; - listMemberships( - request: protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, - protos.google.cloud.gkehub.v1beta1.IListMembershipsResponse|null|undefined, - protos.google.cloud.gkehub.v1beta1.IMembership>): void; - listMemberships( - request: protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, - callback: PaginationCallback< - protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, - protos.google.cloud.gkehub.v1beta1.IListMembershipsResponse|null|undefined, - protos.google.cloud.gkehub.v1beta1.IMembership>): void; - listMemberships( - request?: protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, - protos.google.cloud.gkehub.v1beta1.IListMembershipsResponse|null|undefined, - protos.google.cloud.gkehub.v1beta1.IMembership>, - callback?: PaginationCallback< - protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, - protos.google.cloud.gkehub.v1beta1.IListMembershipsResponse|null|undefined, - protos.google.cloud.gkehub.v1beta1.IMembership>): - Promise<[ - protos.google.cloud.gkehub.v1beta1.IMembership[], - protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest|null, - protos.google.cloud.gkehub.v1beta1.IListMembershipsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listMemberships(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) where the Memberships will be - * listed. Specified in the format `projects/* /locations/*`. - * `projects/* /locations/-` list memberships in all the regions. - * @param {number} [request.pageSize] - * Optional. When requesting a 'page' of resources, `page_size` specifies - * number of resources to return. If unspecified or set to 0, all resources - * will be returned. - * @param {string} [request.pageToken] - * Optional. Token returned by previous call to `ListMemberships` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} [request.filter] - * Optional. Lists Memberships that match the filter expression, following the - * syntax outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Name is `bar` in project `foo-proj` and location `global`: - * - * name = "projects/foo-proj/locations/global/membership/bar" - * - * - Memberships that have a label called `foo`: - * - * labels.foo:* - * - * - Memberships that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * - * - Memberships in the CREATING state: - * - * state = CREATING - * @param {string} [request.orderBy] - * Optional. One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 protos.google.cloud.gkehub.v1beta1.Membership|Membership} 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 `listMembershipsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMembershipsStream( - request?: protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, - 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['listMemberships']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMemberships.createStream( - this.innerApiCalls.listMemberships as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMemberships`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) where the Memberships will be - * listed. Specified in the format `projects/* /locations/*`. - * `projects/* /locations/-` list memberships in all the regions. - * @param {number} [request.pageSize] - * Optional. When requesting a 'page' of resources, `page_size` specifies - * number of resources to return. If unspecified or set to 0, all resources - * will be returned. - * @param {string} [request.pageToken] - * Optional. Token returned by previous call to `ListMemberships` which - * specifies the position in the list from where to continue listing the - * resources. - * @param {string} [request.filter] - * Optional. Lists Memberships that match the filter expression, following the - * syntax outlined in https://google.aip.dev/160. - * - * Examples: - * - * - Name is `bar` in project `foo-proj` and location `global`: - * - * name = "projects/foo-proj/locations/global/membership/bar" - * - * - Memberships that have a label called `foo`: - * - * labels.foo:* - * - * - Memberships that have a label called `foo` whose value is `bar`: - * - * labels.foo = bar - * - * - Memberships in the CREATING state: - * - * state = CREATING - * @param {string} [request.orderBy] - * Optional. One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkehub.v1beta1.Membership|Membership}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/gke_hub_membership_service.list_memberships.js - * region_tag:gkehub_v1beta1_generated_GkeHubMembershipService_ListMemberships_async - */ - listMembershipsAsync( - request?: protos.google.cloud.gkehub.v1beta1.IListMembershipsRequest, - 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['listMemberships']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMemberships.asyncIterate( - this.innerApiCalls['listMemberships'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified membership resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} membership - * @returns {string} Resource name string. - */ - membershipPath(project:string,location:string,membership:string) { - return this.pathTemplates.membershipPathTemplate.render({ - project: project, - location: location, - membership: membership, - }); - } - - /** - * Parse the project from Membership resource. - * - * @param {string} membershipName - * A fully-qualified path representing Membership resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMembershipName(membershipName: string) { - return this.pathTemplates.membershipPathTemplate.match(membershipName).project; - } - - /** - * Parse the location from Membership resource. - * - * @param {string} membershipName - * A fully-qualified path representing Membership resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMembershipName(membershipName: string) { - return this.pathTemplates.membershipPathTemplate.match(membershipName).location; - } - - /** - * Parse the membership from Membership resource. - * - * @param {string} membershipName - * A fully-qualified path representing Membership resource. - * @returns {string} A string representing the membership. - */ - matchMembershipFromMembershipName(membershipName: string) { - return this.pathTemplates.membershipPathTemplate.match(membershipName).membership; - } - - /** - * 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; - } - - /** - * 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.gkeHubMembershipServiceStub && !this._terminated) { - return this.gkeHubMembershipServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_client_config.json b/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_client_config.json deleted file mode 100644 index 2e4ba5b9b3b..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_client_config.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "interfaces": { - "google.cloud.gkehub.v1beta1.GkeHubMembershipService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListMemberships": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetMembership": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateMembership": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteMembership": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UpdateMembership": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GenerateConnectManifest": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ValidateExclusivity": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GenerateExclusivityManifest": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_proto_list.json b/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_proto_list.json deleted file mode 100644 index 7b0d06d80b9..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/gke_hub_membership_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/gkehub/v1beta1/membership.proto" -] diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-gkehub/v1beta1/src/v1beta1/index.ts deleted file mode 100644 index d874e36f1dc..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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 {GkeHubMembershipServiceClient} from './gke_hub_membership_service_client'; diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 633c527623d..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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 gkehub = require('@google-cloud/gke-hub'); - -function main() { - const gkeHubMembershipServiceClient = new gkehub.GkeHubMembershipServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 35038790ed4..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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 {GkeHubMembershipServiceClient} from '@google-cloud/gke-hub'; - -// check that the client class type name can be used -function doStuffWithGkeHubMembershipServiceClient(client: GkeHubMembershipServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const gkeHubMembershipServiceClient = new GkeHubMembershipServiceClient(); - doStuffWithGkeHubMembershipServiceClient(gkeHubMembershipServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-gkehub/v1beta1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1beta1/test/gapic_gke_hub_membership_service_v1beta1.ts b/owl-bot-staging/google-cloud-gkehub/v1beta1/test/gapic_gke_hub_membership_service_v1beta1.ts deleted file mode 100644 index ba8cc5166f2..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/v1beta1/test/gapic_gke_hub_membership_service_v1beta1.ts +++ /dev/null @@ -1,2166 +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 gkehubmembershipserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.GkeHubMembershipServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.gkeHubMembershipServiceStub, undefined); - await client.initialize(); - assert(client.gkeHubMembershipServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.gkeHubMembershipServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.gkeHubMembershipServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - 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 gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - 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('getMembership', () => { - it('invokes getMembership without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.GetMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GetMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.Membership() - ); - client.innerApiCalls.getMembership = stubSimpleCall(expectedResponse); - const [response] = await client.getMembership(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMembership without error using callback', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.GetMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GetMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.Membership() - ); - client.innerApiCalls.getMembership = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMembership( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1beta1.IMembership|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMembership with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.GetMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GetMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMembership = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMembership(request), expectedError); - const actualRequest = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMembership with closed client', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.GetMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GetMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getMembership(request), expectedError); - }); - }); - - describe('generateConnectManifest', () => { - it('invokes generateConnectManifest without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.GenerateConnectManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GenerateConnectManifestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.GenerateConnectManifestResponse() - ); - client.innerApiCalls.generateConnectManifest = stubSimpleCall(expectedResponse); - const [response] = await client.generateConnectManifest(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateConnectManifest without error using callback', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.GenerateConnectManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GenerateConnectManifestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.GenerateConnectManifestResponse() - ); - client.innerApiCalls.generateConnectManifest = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateConnectManifest( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1beta1.IGenerateConnectManifestResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateConnectManifest with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.GenerateConnectManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GenerateConnectManifestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateConnectManifest = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateConnectManifest(request), expectedError); - const actualRequest = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateConnectManifest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateConnectManifest with closed client', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.GenerateConnectManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GenerateConnectManifestRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateConnectManifest(request), expectedError); - }); - }); - - describe('validateExclusivity', () => { - it('invokes validateExclusivity without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.ValidateExclusivityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ValidateExclusivityRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.ValidateExclusivityResponse() - ); - client.innerApiCalls.validateExclusivity = stubSimpleCall(expectedResponse); - const [response] = await client.validateExclusivity(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.validateExclusivity as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.validateExclusivity as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes validateExclusivity without error using callback', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.ValidateExclusivityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ValidateExclusivityRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.ValidateExclusivityResponse() - ); - client.innerApiCalls.validateExclusivity = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.validateExclusivity( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1beta1.IValidateExclusivityResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.validateExclusivity as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.validateExclusivity as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes validateExclusivity with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.ValidateExclusivityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ValidateExclusivityRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.validateExclusivity = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.validateExclusivity(request), expectedError); - const actualRequest = (client.innerApiCalls.validateExclusivity as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.validateExclusivity as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes validateExclusivity with closed client', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.ValidateExclusivityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ValidateExclusivityRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.validateExclusivity(request), expectedError); - }); - }); - - describe('generateExclusivityManifest', () => { - it('invokes generateExclusivityManifest without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestResponse() - ); - client.innerApiCalls.generateExclusivityManifest = stubSimpleCall(expectedResponse); - const [response] = await client.generateExclusivityManifest(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateExclusivityManifest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateExclusivityManifest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateExclusivityManifest without error using callback', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestResponse() - ); - client.innerApiCalls.generateExclusivityManifest = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateExclusivityManifest( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1beta1.IGenerateExclusivityManifestResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateExclusivityManifest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateExclusivityManifest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateExclusivityManifest with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateExclusivityManifest = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateExclusivityManifest(request), expectedError); - const actualRequest = (client.innerApiCalls.generateExclusivityManifest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateExclusivityManifest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateExclusivityManifest with closed client', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.GenerateExclusivityManifestRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateExclusivityManifest(request), expectedError); - }); - }); - - describe('createMembership', () => { - it('invokes createMembership without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.CreateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.CreateMembershipRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMembership = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMembership(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMembership without error using callback', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.CreateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.CreateMembershipRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMembership = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMembership( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMembership with call error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.CreateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.CreateMembershipRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMembership = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMembership(request), expectedError); - const actualRequest = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMembership with LRO error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.CreateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.CreateMembershipRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMembership = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMembership(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateMembershipProgress without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateMembershipProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateMembershipProgress with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMembershipProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteMembership', () => { - it('invokes deleteMembership without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.DeleteMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.DeleteMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMembership = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteMembership(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMembership without error using callback', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.DeleteMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.DeleteMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMembership = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMembership( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMembership with call error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.DeleteMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.DeleteMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMembership = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteMembership(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMembership with LRO error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.DeleteMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.DeleteMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMembership = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteMembership(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteMembershipProgress without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteMembershipProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteMembershipProgress with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteMembershipProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateMembership', () => { - it('invokes updateMembership without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.UpdateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.UpdateMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMembership = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMembership(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMembership without error using callback', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.UpdateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.UpdateMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMembership = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMembership( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMembership with call error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.UpdateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.UpdateMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMembership = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMembership(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMembership with LRO error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.UpdateMembershipRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.UpdateMembershipRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMembership = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMembership(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMembership as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateMembershipProgress without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateMembershipProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateMembershipProgress with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMembershipProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listMemberships', () => { - it('invokes listMemberships without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), - ]; - client.innerApiCalls.listMemberships = stubSimpleCall(expectedResponse); - const [response] = await client.listMemberships(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMemberships without error using callback', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), - ]; - client.innerApiCalls.listMemberships = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMemberships( - request, - (err?: Error|null, result?: protos.google.cloud.gkehub.v1beta1.IMembership[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMemberships with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMemberships = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMemberships(request), expectedError); - const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMembershipsStream without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), - ]; - client.descriptors.page.listMemberships.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMembershipsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkehub.v1beta1.Membership[] = []; - stream.on('data', (response: protos.google.cloud.gkehub.v1beta1.Membership) => { - 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.listMemberships.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMemberships, request)); - assert( - (client.descriptors.page.listMemberships.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listMembershipsStream with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMemberships.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMembershipsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkehub.v1beta1.Membership[] = []; - stream.on('data', (response: protos.google.cloud.gkehub.v1beta1.Membership) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMemberships.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMemberships, request)); - assert( - (client.descriptors.page.listMemberships.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMemberships without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), - generateSampleMessage(new protos.google.cloud.gkehub.v1beta1.Membership()), - ]; - client.descriptors.page.listMemberships.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkehub.v1beta1.IMembership[] = []; - const iterable = client.listMembershipsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMemberships.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMemberships.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMemberships with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkehub.v1beta1.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkehub.v1beta1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMemberships.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMembershipsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkehub.v1beta1.IMembership[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMemberships.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMemberships.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('membership', () => { - const fakePath = "/rendered/path/membership"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - membership: "membershipValue", - }; - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.membershipPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.membershipPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('membershipPath', () => { - const result = client.membershipPath("projectValue", "locationValue", "membershipValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.membershipPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMembershipName', () => { - const result = client.matchProjectFromMembershipName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMembershipName', () => { - const result = client.matchLocationFromMembershipName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMembershipFromMembershipName', () => { - const result = client.matchMembershipFromMembershipName(fakePath); - assert.strictEqual(result, "membershipValue"); - assert((client.pathTemplates.membershipPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new gkehubmembershipserviceModule.v1beta1.GkeHubMembershipServiceClient({ - 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)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-gkehub/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-gkehub/v1beta1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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-gkehub/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-gkehub/v1beta1/webpack.config.js deleted file mode 100644 index 24ccc7dadcc..00000000000 --- a/owl-bot-staging/google-cloud-gkehub/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: 'GkeHubMembershipService', - filename: './gke-hub-membership-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-gkemulticloud/v1/.eslintignore b/owl-bot-staging/google-cloud-gkemulticloud/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/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-gkemulticloud/v1/.eslintrc.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/.gitignore b/owl-bot-staging/google-cloud-gkemulticloud/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/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-gkemulticloud/v1/.jsdoc.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/.jsdoc.js deleted file mode 100644 index 01cb6ab3fa1..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/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/gkemulticloud', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/.mocharc.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/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-gkemulticloud/v1/.prettierrc.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/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-gkemulticloud/v1/README.md b/owl-bot-staging/google-cloud-gkemulticloud/v1/README.md deleted file mode 100644 index 2e8a88145db..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Gkemulticloud: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/package.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/package.json deleted file mode 100644 index 132b8effb6a..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "@google-cloud/gkemulticloud", - "version": "0.1.0", - "description": "Gkemulticloud client for Node.js", - "repository": "googleapis/nodejs-gkemulticloud", - "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 gkemulticloud", - "gkemulticloud", - "attached clusters", - "aws clusters", - "azure clusters" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/attached_resources.proto b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/attached_resources.proto deleted file mode 100644 index adca2ee9027..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/attached_resources.proto +++ /dev/null @@ -1,230 +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.gkemulticloud.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/gkemulticloud/v1/common_resources.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeMultiCloud.V1"; -option go_package = "cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb;gkemulticloudpb"; -option java_multiple_files = true; -option java_outer_classname = "AttachedResourcesProto"; -option java_package = "com.google.cloud.gkemulticloud.v1"; -option php_namespace = "Google\\Cloud\\GkeMultiCloud\\V1"; -option ruby_package = "Google::Cloud::GkeMultiCloud::V1"; - -// An Anthos cluster running on customer own infrastructure. -message AttachedCluster { - option (google.api.resource) = { - type: "gkemulticloud.googleapis.com/AttachedCluster" - pattern: "projects/{project}/locations/{location}/attachedClusters/{attached_cluster}" - }; - - // The lifecycle state of the cluster. - enum State { - // Not set. - STATE_UNSPECIFIED = 0; - - // The PROVISIONING state indicates the cluster is being registered. - PROVISIONING = 1; - - // The RUNNING state indicates the cluster has been register and is fully - // usable. - RUNNING = 2; - - // The RECONCILING state indicates that some work is actively being done on - // the cluster, such as upgrading software components. - RECONCILING = 3; - - // The STOPPING state indicates the cluster is being de-registered. - STOPPING = 4; - - // The ERROR state indicates the cluster is in a broken unrecoverable - // state. - ERROR = 5; - - // The DEGRADED state indicates the cluster requires user action to - // restore full functionality. - DEGRADED = 6; - } - - // The name of this resource. - // - // Cluster names are formatted as - // `projects//locations//attachedClusters/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud Platform resource names. - string name = 1; - - // Optional. A human readable description of this cluster. - // Cannot be longer than 255 UTF-8 encoded bytes. - string description = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. OpenID Connect (OIDC) configuration for the cluster. - AttachedOidcConfig oidc_config = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). - // - // You can list all supported versions on a given Google Cloud region by - // calling - // [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. - string platform_version = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Kubernetes distribution of the underlying attached cluster. - // - // Supported values: ["eks", "aks"]. - string distribution = 16 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The region where this cluster runs. - // - // For EKS clusters, this is a AWS region. For AKS clusters, - // this is an Azure region. - string cluster_region = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Fleet configuration. - Fleet fleet = 5 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The current state of the cluster. - State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A globally unique identifier for the cluster. - string uid = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If set, there are currently changes in flight to the cluster. - bool reconciling = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this cluster was registered. - google.protobuf.Timestamp create_time = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this cluster was last updated. - google.protobuf.Timestamp update_time = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Allows clients to perform consistent read-modify-writes - // through optimistic concurrency control. - // - // Can be sent on update and delete requests to ensure the - // client has an up-to-date value before proceeding. - string etag = 11; - - // Output only. The Kubernetes version of the cluster. - string kubernetes_version = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Annotations on the cluster. - // - // This field has the same restrictions as Kubernetes annotations. - // The total size of all keys and values combined is limited to 256k. - // Key can have 2 segments: prefix (optional) and name (required), - // separated by a slash (/). - // Prefix must be a DNS subdomain. - // Name must be 63 characters or less, begin and end with alphanumerics, - // with dashes (-), underscores (_), dots (.), and alphanumerics between. - map annotations = 13 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Workload Identity settings. - WorkloadIdentityConfig workload_identity_config = 14 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Logging configuration for this cluster. - LoggingConfig logging_config = 15 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. A set of errors found in the cluster. - repeated AttachedClusterError errors = 20 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Configuration related to the cluster RBAC settings. - AttachedClustersAuthorization authorization = 21 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Monitoring configuration for this cluster. - MonitoringConfig monitoring_config = 23 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Configuration related to the cluster RBAC settings. -message AttachedClustersAuthorization { - // Required. Users that can perform operations as a cluster admin. A managed - // ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole - // to the users. Up to ten admin users can be provided. - // - // For more info on RBAC, see - // https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles - repeated AttachedClusterUser admin_users = 1 - [(google.api.field_behavior) = REQUIRED]; -} - -// Identities of a user-type subject for Attached clusters. -message AttachedClusterUser { - // Required. The name of the user, e.g. `my-gcp-id@gmail.com`. - string username = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// OIDC discovery information of the target cluster. -// -// Kubernetes Service Account (KSA) tokens are JWT tokens signed by the cluster -// API server. This fields indicates how Google Cloud Platform services -// validate KSA tokens in order to allow system workloads (such as GKE Connect -// and telemetry agents) to authenticate back to Google Cloud Platform. -// -// Both clusters with public and private issuer URLs are supported. -// Clusters with public issuers only need to specify the `issuer_url` field -// while clusters with private issuers need to provide both -// `issuer_url` and `oidc_jwks`. -message AttachedOidcConfig { - // A JSON Web Token (JWT) issuer URI. `issuer` must start with `https://`. - string issuer_url = 1; - - // Optional. OIDC verification keys in JWKS format (RFC 7517). - // It contains a list of OIDC verification keys that can be used to verify - // OIDC JWTs. - // - // This field is required for cluster that doesn't have a publicly available - // discovery endpoint. When provided, it will be directly used - // to verify the OIDC JWT asserted by the IDP. - bytes jwks = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// AttachedServerConfig provides information about supported -// Kubernetes versions -message AttachedServerConfig { - option (google.api.resource) = { - type: "gkemulticloud.googleapis.com/AttachedServerConfig" - pattern: "projects/{project}/locations/{location}/attachedServerConfig" - }; - - // The resource name of the config. - string name = 1; - - // List of valid platform versions. - repeated AttachedPlatformVersionInfo valid_versions = 2; -} - -// Information about a supported Attached Clusters platform version. -message AttachedPlatformVersionInfo { - // Platform version name. - string version = 1; -} - -// AttachedClusterError describes errors found on attached clusters. -message AttachedClusterError { - // Human-friendly description of the error. - string message = 1; -} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/attached_service.proto b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/attached_service.proto deleted file mode 100644 index 175be6d4e44..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/attached_service.proto +++ /dev/null @@ -1,432 +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.gkemulticloud.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/gkemulticloud/v1/attached_resources.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.GkeMultiCloud.V1"; -option go_package = "cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb;gkemulticloudpb"; -option java_multiple_files = true; -option java_outer_classname = "AttachedServiceProto"; -option java_package = "com.google.cloud.gkemulticloud.v1"; -option php_namespace = "Google\\Cloud\\GkeMultiCloud\\V1"; -option ruby_package = "Google::Cloud::GkeMultiCloud::V1"; - -// The AttachedClusters API provides a single centrally managed service -// to register and manage Anthos attached clusters that run on customer's owned -// infrastructure. -service AttachedClusters { - option (google.api.default_host) = "gkemulticloud.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a new - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - // on a given Google Cloud Platform project and region. - // - // If successful, the response contains a newly created - // [Operation][google.longrunning.Operation] resource that can be - // described to track the status of the operation. - rpc CreateAttachedCluster(CreateAttachedClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/attachedClusters" - body: "attached_cluster" - }; - option (google.api.method_signature) = - "parent,attached_cluster,attached_cluster_id"; - option (google.longrunning.operation_info) = { - response_type: "AttachedCluster" - metadata_type: "OperationMetadata" - }; - } - - // Updates an - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]. - rpc UpdateAttachedCluster(UpdateAttachedClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{attached_cluster.name=projects/*/locations/*/attachedClusters/*}" - body: "attached_cluster" - }; - option (google.api.method_signature) = "attached_cluster,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "AttachedCluster" - metadata_type: "OperationMetadata" - }; - } - - // Imports creates a new - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - // by importing an existing Fleet Membership resource. - // - // Attached Clusters created before the introduction of the Anthos Multi-Cloud - // API can be imported through this method. - // - // If successful, the response contains a newly created - // [Operation][google.longrunning.Operation] resource that can be - // described to track the status of the operation. - rpc ImportAttachedCluster(ImportAttachedClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/attachedClusters:import" - body: "*" - }; - option (google.api.method_signature) = "parent,fleet_membership"; - option (google.longrunning.operation_info) = { - response_type: "AttachedCluster" - metadata_type: "OperationMetadata" - }; - } - - // Describes a specific - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource. - rpc GetAttachedCluster(GetAttachedClusterRequest) returns (AttachedCluster) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/attachedClusters/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] - // resources on a given Google Cloud project and region. - rpc ListAttachedClusters(ListAttachedClustersRequest) - returns (ListAttachedClustersResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/attachedClusters" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a specific - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource. - // - // If successful, the response contains a newly created - // [Operation][google.longrunning.Operation] resource that can be - // described to track the status of the operation. - rpc DeleteAttachedCluster(DeleteAttachedClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/attachedClusters/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Returns information, such as supported Kubernetes versions, on a given - // Google Cloud location. - rpc GetAttachedServerConfig(GetAttachedServerConfigRequest) - returns (AttachedServerConfig) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/attachedServerConfig}" - }; - option (google.api.method_signature) = "name"; - } - - // Generates the install manifest to be installed on the target cluster. - rpc GenerateAttachedClusterInstallManifest( - GenerateAttachedClusterInstallManifestRequest) - returns (GenerateAttachedClusterInstallManifestResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}:generateAttachedClusterInstallManifest" - }; - option (google.api.method_signature) = "parent,attached_cluster_id"; - } -} - -// Request message for `AttachedClusters.GenerateAttachedClusterInstallManifest` -// method. -message GenerateAttachedClusterInstallManifestRequest { - // Required. The parent location where this - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - // will be created. - // - // Location names are formatted as `projects//locations/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkemulticloud.googleapis.com/AttachedCluster" - } - ]; - - // Required. A client provided ID of the resource. Must be unique within the - // parent resource. - // - // The provided ID will be part of the - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - // name formatted as - // `projects//locations//attachedClusters/`. - // - // Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - // - // When generating an install manifest for importing an existing Membership - // resource, the attached_cluster_id field must be the Membership id. - // - // Membership names are formatted as - // `projects//locations//memberships/`. - string attached_cluster_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). - // - // You can list all supported versions on a given Google Cloud region by - // calling - // [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. - string platform_version = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for -// `AttachedClusters.GenerateAttachedClusterInstallManifest` method. -message GenerateAttachedClusterInstallManifestResponse { - // A set of Kubernetes resources (in YAML format) to be applied - // to the cluster to be attached. - string manifest = 1; -} - -// Request message for `AttachedClusters.CreateAttachedCluster` method. -message CreateAttachedClusterRequest { - // Required. The parent location where this - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - // will be created. - // - // Location names are formatted as `projects//locations/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkemulticloud.googleapis.com/AttachedCluster" - } - ]; - - // Required. The specification of the - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to create. - AttachedCluster attached_cluster = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A client provided ID the resource. Must be unique within the - // parent resource. - // - // The provided ID will be part of the - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - // name formatted as - // `projects//locations//attachedClusters/`. - // - // Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - string attached_cluster_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // If set, only validate the request, but do not actually create the cluster. - bool validate_only = 4; -} - -// Request message for `AttachedClusters.ImportAttachedCluster` method. -message ImportAttachedClusterRequest { - // Required. The parent location where this - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - // will be created. - // - // Location names are formatted as `projects//locations/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkemulticloud.googleapis.com/AttachedCluster" - } - ]; - - // If set, only validate the request, but do not actually import the cluster. - bool validate_only = 2; - - // Required. The name of the fleet membership resource to import. - string fleet_membership = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). - // - // You can list all supported versions on a given Google Cloud region by - // calling - // [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. - string platform_version = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Kubernetes distribution of the underlying attached cluster. - // - // Supported values: ["eks", "aks"]. - string distribution = 5 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for `AttachedClusters.UpdateAttachedCluster` method. -message UpdateAttachedClusterRequest { - // Required. The - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - // to update. - AttachedCluster attached_cluster = 1 [(google.api.field_behavior) = REQUIRED]; - - // If set, only validate the request, but do not actually update the cluster. - bool validate_only = 2; - - // Required. Mask of fields to update. At least one path must be supplied in - // this field. The elements of the repeated paths field can only include these - // fields from - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]: - // - // * `description`. - // * `annotations`. - // * `platform_version`. - // * `authorization.admin_users`. - // * `logging_config.component_config.enable_components`. - // * `monitoring_config.managed_prometheus_config.enabled`. - google.protobuf.FieldMask update_mask = 3 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for `AttachedClusters.GetAttachedCluster` method. -message GetAttachedClusterRequest { - // Required. The name of the - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - // to describe. - // - // `AttachedCluster` names are formatted as - // `projects//locations//attachedClusters/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud Platform resource names. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkemulticloud.googleapis.com/AttachedCluster" - } - ]; -} - -// Request message for `AttachedClusters.ListAttachedClusters` method. -message ListAttachedClustersRequest { - // Required. The parent location which owns this collection of - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resources. - // - // Location names are formatted as `projects//locations/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud Platform resource names. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkemulticloud.googleapis.com/AttachedCluster" - } - ]; - - // The maximum number of items to return. - // - // If not specified, a default value of 50 will be used by the service. - // Regardless of the pageSize value, the response can include a partial list - // and a caller should only rely on response's - // [nextPageToken][google.cloud.gkemulticloud.v1.ListAttachedClustersResponse.next_page_token] - // to determine if there are more instances left to be queried. - int32 page_size = 2; - - // The `nextPageToken` value returned from a previous - // [attachedClusters.list][google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters] - // request, if any. - string page_token = 3; -} - -// Response message for `AttachedClusters.ListAttachedClusters` method. -message ListAttachedClustersResponse { - // A list of [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] - // resources in the specified Google Cloud Platform project and region region. - repeated AttachedCluster attached_clusters = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; -} - -// Request message for `AttachedClusters.DeleteAttachedCluster` method. -message DeleteAttachedClusterRequest { - // Required. The resource name the - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to delete. - // - // `AttachedCluster` names are formatted as - // `projects//locations//attachedClusters/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud Platform resource names. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkemulticloud.googleapis.com/AttachedCluster" - } - ]; - - // If set, only validate the request, but do not actually delete the resource. - bool validate_only = 2; - - // If set to true, and the - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - // is not found, the request will succeed but no action will be taken on the - // server and a completed [Operation][google.longrunning.Operation] will be - // returned. - // - // Useful for idempotent deletion. - bool allow_missing = 3; - - // If set to true, the deletion of - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - // will succeed even if errors occur during deleting in cluster resources. - // Using this parameter may result in orphaned resources in the cluster. - bool ignore_errors = 5; - - // The current etag of the - // [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]. - // - // Allows clients to perform deletions through optimistic concurrency control. - // - // If the provided etag does not match the current etag of the cluster, - // the request will fail and an ABORTED error will be returned. - string etag = 4; -} - -// GetAttachedServerConfigRequest gets the server config for attached -// clusters. -message GetAttachedServerConfigRequest { - // Required. The name of the - // [AttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedServerConfig] - // resource to describe. - // - // `AttachedServerConfig` names are formatted as - // `projects//locations//attachedServerConfig`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkemulticloud.googleapis.com/AttachedServerConfig" - } - ]; -} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/aws_resources.proto b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/aws_resources.proto deleted file mode 100644 index 8989cd8643d..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/aws_resources.proto +++ /dev/null @@ -1,627 +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.gkemulticloud.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/gkemulticloud/v1/common_resources.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeMultiCloud.V1"; -option go_package = "cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb;gkemulticloudpb"; -option java_multiple_files = true; -option java_outer_classname = "AwsResourcesProto"; -option java_package = "com.google.cloud.gkemulticloud.v1"; -option php_namespace = "Google\\Cloud\\GkeMultiCloud\\V1"; -option ruby_package = "Google::Cloud::GkeMultiCloud::V1"; - -// An Anthos cluster running on AWS. -message AwsCluster { - option (google.api.resource) = { - type: "gkemulticloud.googleapis.com/AwsCluster" - pattern: "projects/{project}/locations/{location}/awsClusters/{aws_cluster}" - }; - - // The lifecycle state of the cluster. - enum State { - // Not set. - STATE_UNSPECIFIED = 0; - - // The PROVISIONING state indicates the cluster is being created. - PROVISIONING = 1; - - // The RUNNING state indicates the cluster has been created and is fully - // usable. - RUNNING = 2; - - // The RECONCILING state indicates that some work is actively being done on - // the cluster, such as upgrading the control plane replicas. - RECONCILING = 3; - - // The STOPPING state indicates the cluster is being deleted. - STOPPING = 4; - - // The ERROR state indicates the cluster is in a broken unrecoverable - // state. - ERROR = 5; - - // The DEGRADED state indicates the cluster requires user action to - // restore full functionality. - DEGRADED = 6; - } - - // The name of this resource. - // - // Cluster names are formatted as - // `projects//locations//awsClusters/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud Platform resource names. - string name = 1; - - // Optional. A human readable description of this cluster. - // Cannot be longer than 255 UTF-8 encoded bytes. - string description = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Cluster-wide networking configuration. - AwsClusterNetworking networking = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The AWS region where the cluster runs. - // - // Each Google Cloud region supports a subset of nearby AWS regions. - // You can call - // [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig] - // to list all supported AWS regions within a given Google Cloud region. - string aws_region = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. Configuration related to the cluster control plane. - AwsControlPlane control_plane = 5 [(google.api.field_behavior) = REQUIRED]; - - // Required. Configuration related to the cluster RBAC settings. - AwsAuthorization authorization = 15 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The current state of the cluster. - State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The endpoint of the cluster's API server. - string endpoint = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A globally unique identifier for the cluster. - string uid = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If set, there are currently changes in flight to the cluster. - bool reconciling = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this cluster was created. - google.protobuf.Timestamp create_time = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this cluster was last updated. - google.protobuf.Timestamp update_time = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Allows clients to perform consistent read-modify-writes - // through optimistic concurrency control. - // - // Can be sent on update and delete requests to ensure the - // client has an up-to-date value before proceeding. - string etag = 13; - - // Optional. Annotations on the cluster. - // - // This field has the same restrictions as Kubernetes annotations. - // The total size of all keys and values combined is limited to 256k. - // Key can have 2 segments: prefix (optional) and name (required), - // separated by a slash (/). - // Prefix must be a DNS subdomain. - // Name must be 63 characters or less, begin and end with alphanumerics, - // with dashes (-), underscores (_), dots (.), and alphanumerics between. - map annotations = 14 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Workload Identity settings. - WorkloadIdentityConfig workload_identity_config = 16 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. PEM encoded x509 certificate of the cluster root of trust. - string cluster_ca_certificate = 17 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Fleet configuration. - Fleet fleet = 18 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Logging configuration for this cluster. - LoggingConfig logging_config = 19 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. A set of errors found in the cluster. - repeated AwsClusterError errors = 20 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Monitoring configuration for this cluster. - MonitoringConfig monitoring_config = 21 - [(google.api.field_behavior) = OPTIONAL]; -} - -// ControlPlane defines common parameters between control plane nodes. -message AwsControlPlane { - // Required. The Kubernetes version to run on control plane replicas - // (e.g. `1.19.10-gke.1000`). - // - // You can list all supported versions on a given Google Cloud region by - // calling - // [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig]. - string version = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The AWS instance type. - // - // When unspecified, it uses a default based on the cluster's version. - string instance_type = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. SSH configuration for how to access the underlying control plane - // machines. - AwsSshConfig ssh_config = 14 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The list of subnets where control plane replicas will run. - // A replica will be provisioned on each subnet and up to three values - // can be provided. - // Each subnet must be in a different AWS Availability Zone (AZ). - repeated string subnet_ids = 4 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The IDs of additional security groups to add to control plane - // replicas. The Anthos Multi-Cloud API will automatically create and manage - // security groups with the minimum rules needed for a functioning cluster. - repeated string security_group_ids = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Required. The name or ARN of the AWS IAM instance profile to assign to each - // control plane replica. - string iam_instance_profile = 7 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Configuration related to the root volume provisioned for each - // control plane replica. - // - // Volumes will be provisioned in the availability zone associated - // with the corresponding subnet. - // - // When unspecified, it defaults to 32 GiB with the GP2 volume type. - AwsVolumeTemplate root_volume = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Configuration related to the main volume provisioned for each - // control plane replica. - // The main volume is in charge of storing all of the cluster's etcd state. - // - // Volumes will be provisioned in the availability zone associated - // with the corresponding subnet. - // - // When unspecified, it defaults to 8 GiB with the GP2 volume type. - AwsVolumeTemplate main_volume = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The ARN of the AWS KMS key used to encrypt cluster secrets. - AwsDatabaseEncryption database_encryption = 10 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. A set of AWS resource tags to propagate to all underlying managed - // AWS resources. - // - // Specify at most 50 pairs containing alphanumerics, spaces, and symbols - // (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to - // 255 Unicode characters. - map tags = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Authentication configuration for management of AWS resources. - AwsServicesAuthentication aws_services_authentication = 12 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. Proxy configuration for outbound HTTP(S) traffic. - AwsProxyConfig proxy_config = 16 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Config encryption for user data. - AwsConfigEncryption config_encryption = 17 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. The placement to use on control plane instances. - // When unspecified, the VPC's default tenancy will be used. - AwsInstancePlacement instance_placement = 18 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Authentication configuration for the management of AWS resources. -message AwsServicesAuthentication { - // Required. The Amazon Resource Name (ARN) of the role that the Anthos - // Multi-Cloud API will assume when managing AWS resources on your account. - string role_arn = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An identifier for the assumed role session. - // - // When unspecified, it defaults to `multicloud-service-agent`. - string role_session_name = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Configuration related to the cluster RBAC settings. -message AwsAuthorization { - // Required. Users that can perform operations as a cluster admin. A managed - // ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole - // to the users. Up to ten admin users can be provided. - // - // For more info on RBAC, see - // https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles - repeated AwsClusterUser admin_users = 1 - [(google.api.field_behavior) = REQUIRED]; -} - -// Identities of a user-type subject for AWS clusters. -message AwsClusterUser { - // Required. The name of the user, e.g. `my-gcp-id@gmail.com`. - string username = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Configuration related to application-layer secrets encryption. -message AwsDatabaseEncryption { - // Required. The ARN of the AWS KMS key used to encrypt cluster secrets. - string kms_key_arn = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Configuration template for AWS EBS volumes. -message AwsVolumeTemplate { - // Types of supported EBS volumes. We currently only support GP2 or GP3 - // volumes. - // See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html - // for more information. - enum VolumeType { - // Not set. - VOLUME_TYPE_UNSPECIFIED = 0; - - // GP2 (General Purpose SSD volume type). - GP2 = 1; - - // GP3 (General Purpose SSD volume type). - GP3 = 2; - } - - // Optional. The size of the volume, in GiBs. - // - // When unspecified, a default value is provided. See the specific reference - // in the parent resource. - int32 size_gib = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Type of the EBS volume. - // - // When unspecified, it defaults to GP2 volume. - VolumeType volume_type = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The number of I/O operations per second (IOPS) to provision for - // GP3 volume. - int32 iops = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Amazon Resource Name (ARN) of the Customer Managed Key (CMK) - // used to encrypt AWS EBS volumes. - // - // If not specified, the default Amazon managed key associated to - // the AWS region where this cluster runs will be used. - string kms_key_arn = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// ClusterNetworking defines cluster-wide networking configuration. -// -// Anthos clusters on AWS run on a single VPC. This includes control -// plane replicas and node pool nodes. -message AwsClusterNetworking { - // Required. The VPC associated with the cluster. All component clusters - // (i.e. control plane and node pools) run on a single VPC. - // - // This field cannot be changed after creation. - string vpc_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. All pods in the cluster are assigned an IPv4 address from these - // ranges. Only a single range is supported. This field cannot be changed - // after creation. - repeated string pod_address_cidr_blocks = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Required. All services in the cluster are assigned an IPv4 address from - // these ranges. Only a single range is supported. This field cannot be - // changed after creation. - repeated string service_address_cidr_blocks = 3 - [(google.api.field_behavior) = REQUIRED]; -} - -// An Anthos node pool running on AWS. -message AwsNodePool { - option (google.api.resource) = { - type: "gkemulticloud.googleapis.com/AwsNodePool" - pattern: "projects/{project}/locations/{location}/awsClusters/{aws_cluster}/awsNodePools/{aws_node_pool}" - }; - - // The lifecycle state of the node pool. - enum State { - // Not set. - STATE_UNSPECIFIED = 0; - - // The PROVISIONING state indicates the node pool is being created. - PROVISIONING = 1; - - // The RUNNING state indicates the node pool has been created - // and is fully usable. - RUNNING = 2; - - // The RECONCILING state indicates that the node pool is being reconciled. - RECONCILING = 3; - - // The STOPPING state indicates the node pool is being deleted. - STOPPING = 4; - - // The ERROR state indicates the node pool is in a broken unrecoverable - // state. - ERROR = 5; - - // The DEGRADED state indicates the node pool requires user action to - // restore full functionality. - DEGRADED = 6; - } - - // The name of this resource. - // - // Node pool names are formatted as - // `projects//locations//awsClusters//awsNodePools/`. - // - // For more details on Google Cloud resource names, - // see [Resource Names](https://cloud.google.com/apis/design/resource_names) - string name = 1; - - // Required. The Kubernetes version to run on this node pool (e.g. - // `1.19.10-gke.1000`). - // - // You can list all supported versions on a given Google Cloud region by - // calling - // [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig]. - string version = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The configuration of the node pool. - AwsNodeConfig config = 28 [(google.api.field_behavior) = REQUIRED]; - - // Required. Autoscaler configuration for this node pool. - AwsNodePoolAutoscaling autoscaling = 25 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The subnet where the node pool node run. - string subnet_id = 6 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The lifecycle state of the node pool. - State state = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A globally unique identifier for the node pool. - string uid = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If set, there are currently changes in flight to the node - // pool. - bool reconciling = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this node pool was created. - google.protobuf.Timestamp create_time = 19 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this node pool was last updated. - google.protobuf.Timestamp update_time = 20 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Allows clients to perform consistent read-modify-writes - // through optimistic concurrency control. - // - // Can be sent on update and delete requests to ensure the - // client has an up-to-date value before proceeding. - string etag = 21; - - // Optional. Annotations on the node pool. - // - // This field has the same restrictions as Kubernetes annotations. - // The total size of all keys and values combined is limited to 256k. - // Key can have 2 segments: prefix (optional) and name (required), - // separated by a slash (/). - // Prefix must be a DNS subdomain. - // Name must be 63 characters or less, begin and end with alphanumerics, - // with dashes (-), underscores (_), dots (.), and alphanumerics between. - map annotations = 22 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The constraint on the maximum number of pods that can be run - // simultaneously on a node in the node pool. - MaxPodsConstraint max_pods_constraint = 27 - [(google.api.field_behavior) = REQUIRED]; - - // Output only. A set of errors found in the node pool. - repeated AwsNodePoolError errors = 29 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Parameters that describe the nodes in a cluster. -message AwsNodeConfig { - // Optional. The AWS instance type. - // - // When unspecified, it uses a default based on the node pool's version. - string instance_type = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Template for the root volume provisioned for node pool nodes. - // Volumes will be provisioned in the availability zone assigned - // to the node pool subnet. - // - // When unspecified, it defaults to 32 GiB with the GP2 volume type. - AwsVolumeTemplate root_volume = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The initial taints assigned to nodes of this node pool. - repeated NodeTaint taints = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The initial labels assigned to nodes of this node pool. An object - // containing a list of "key": value pairs. Example: { "name": "wrench", - // "mass": "1.3kg", "count": "3" }. - map labels = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Key/value metadata to assign to each underlying AWS resource. - // Specify at most 50 pairs containing alphanumerics, spaces, and symbols - // (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to - // 255 Unicode characters. - map tags = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The name or ARN of the AWS IAM role assigned to nodes in the - // pool. - string iam_instance_profile = 6 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The OS image type to use on node pool instances. - // Can have a value of `ubuntu`, or `windows` if the cluster enables - // the Windows node pool preview feature. - // - // When unspecified, it defaults to `ubuntu`. - string image_type = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The SSH configuration. - AwsSshConfig ssh_config = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The IDs of additional security groups to add to nodes in this - // pool. The manager will automatically create security groups with minimum - // rules needed for a functioning cluster. - repeated string security_group_ids = 10 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Proxy configuration for outbound HTTP(S) traffic. - AwsProxyConfig proxy_config = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Config encryption for user data. - AwsConfigEncryption config_encryption = 13 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. Placement related info for this node. - // When unspecified, the VPC's default tenancy will be used. - AwsInstancePlacement instance_placement = 14 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Configuration related to CloudWatch metrics collection on the - // Auto Scaling group of the node pool. - // - // When unspecified, metrics collection is disabled. - AwsAutoscalingGroupMetricsCollection autoscaling_metrics_collection = 15 - [(google.api.field_behavior) = OPTIONAL]; -} - -// AwsNodePoolAutoscaling contains information required by cluster autoscaler -// to adjust the size of the node pool to the current cluster usage. -message AwsNodePoolAutoscaling { - // Required. Minimum number of nodes in the node pool. Must be greater than or - // equal to 1 and less than or equal to max_node_count. - int32 min_node_count = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Maximum number of nodes in the node pool. Must be greater than or - // equal to min_node_count and less than or equal to 50. - int32 max_node_count = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// AwsServerConfig is the configuration of GKE cluster on AWS. -message AwsServerConfig { - option (google.api.resource) = { - type: "gkemulticloud.googleapis.com/AwsServerConfig" - pattern: "projects/{project}/locations/{location}/awsServerConfig" - }; - - // The resource name of the config. - string name = 1; - - // List of valid Kubernetes versions. - repeated AwsK8sVersionInfo valid_versions = 2; - - // The list of supported AWS regions. - repeated string supported_aws_regions = 3; -} - -// Kubernetes version information of GKE cluster on AWS. -message AwsK8sVersionInfo { - // Kubernetes version name. - string version = 1; -} - -// SSH configuration for AWS resources. -message AwsSshConfig { - // Required. The name of the EC2 key pair used to login into cluster machines. - string ec2_key_pair = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Details of a proxy config stored in AWS Secret Manager. -message AwsProxyConfig { - // The ARN of the AWS Secret Manager secret that contains the HTTP(S) proxy - // configuration. - // - // The secret must be a JSON encoded proxy configuration - // as described in - // https://cloud.google.com/anthos/clusters/docs/multi-cloud/aws/how-to/use-a-proxy#create_a_proxy_configuration_file - string secret_arn = 1; - - // The version string of the AWS Secret Manager secret that contains the - // HTTP(S) proxy configuration. - string secret_version = 2; -} - -// Config encryption for user data. -message AwsConfigEncryption { - // Required. The ARN of the AWS KMS key used to encrypt user data. - string kms_key_arn = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Details of placement information for an instance. -// Limitations for using the `host` tenancy: -// -// * T3 instances that use the unlimited CPU credit option don't support host -// tenancy. -message AwsInstancePlacement { - // Tenancy defines how EC2 instances are distributed across physical hardware. - enum Tenancy { - // Not set. - TENANCY_UNSPECIFIED = 0; - - // Use default VPC tenancy. - DEFAULT = 1; - - // Run a dedicated instance. - DEDICATED = 2; - - // Launch this instance to a dedicated host. - HOST = 3; - } - - // Required. The tenancy for instance. - Tenancy tenancy = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Configuration related to CloudWatch metrics collection in an AWS -// Auto Scaling group. -message AwsAutoscalingGroupMetricsCollection { - // Required. The frequency at which EC2 Auto Scaling sends aggregated data to - // AWS CloudWatch. The only valid value is "1Minute". - string granularity = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The metrics to enable. For a list of valid metrics, see - // https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_EnableMetricsCollection.html. - // If you specify Granularity and don't specify any metrics, all metrics are - // enabled. - repeated string metrics = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// AwsClusterError describes errors found on AWS clusters. -message AwsClusterError { - // Human-friendly description of the error. - string message = 1; -} - -// AwsNodePoolError describes errors found on AWS node pools. -message AwsNodePoolError { - // Human-friendly description of the error. - string message = 1; -} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/aws_service.proto b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/aws_service.proto deleted file mode 100644 index 874f4df58e1..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/aws_service.proto +++ /dev/null @@ -1,605 +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.gkemulticloud.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/gkemulticloud/v1/aws_resources.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeMultiCloud.V1"; -option go_package = "cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb;gkemulticloudpb"; -option java_multiple_files = true; -option java_outer_classname = "AwsServiceProto"; -option java_package = "com.google.cloud.gkemulticloud.v1"; -option php_namespace = "Google\\Cloud\\GkeMultiCloud\\V1"; -option ruby_package = "Google::Cloud::GkeMultiCloud::V1"; - -// The AwsClusters API provides a single centrally managed service -// to create and manage Anthos clusters that run on AWS infrastructure. -service AwsClusters { - option (google.api.default_host) = "gkemulticloud.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a new [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] - // resource on a given Google Cloud Platform project and region. - // - // If successful, the response contains a newly created - // [Operation][google.longrunning.Operation] resource that can be - // described to track the status of the operation. - rpc CreateAwsCluster(CreateAwsClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/awsClusters" - body: "aws_cluster" - }; - option (google.api.method_signature) = "parent,aws_cluster,aws_cluster_id"; - option (google.longrunning.operation_info) = { - response_type: "AwsCluster" - metadata_type: "OperationMetadata" - }; - } - - // Updates an [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. - rpc UpdateAwsCluster(UpdateAwsClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{aws_cluster.name=projects/*/locations/*/awsClusters/*}" - body: "aws_cluster" - }; - option (google.api.method_signature) = "aws_cluster,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "AwsCluster" - metadata_type: "OperationMetadata" - }; - } - - // Describes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] - // resource. - rpc GetAwsCluster(GetAwsClusterRequest) returns (AwsCluster) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/awsClusters/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources - // on a given Google Cloud project and region. - rpc ListAwsClusters(ListAwsClustersRequest) - returns (ListAwsClustersResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/awsClusters" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] - // resource. - // - // Fails if the cluster has one or more associated - // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. - // - // If successful, the response contains a newly created - // [Operation][google.longrunning.Operation] resource that can be - // described to track the status of the operation. - rpc DeleteAwsCluster(DeleteAwsClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/awsClusters/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Generates a short-lived access token to authenticate to a given - // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource. - rpc GenerateAwsAccessToken(GenerateAwsAccessTokenRequest) - returns (GenerateAwsAccessTokenResponse) { - option (google.api.http) = { - get: "/v1/{aws_cluster=projects/*/locations/*/awsClusters/*}:generateAwsAccessToken" - }; - } - - // Creates a new [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool], - // attached to a given [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. - // - // If successful, the response contains a newly created - // [Operation][google.longrunning.Operation] resource that can be - // described to track the status of the operation. - rpc CreateAwsNodePool(CreateAwsNodePoolRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/awsClusters/*}/awsNodePools" - body: "aws_node_pool" - }; - option (google.api.method_signature) = - "parent,aws_node_pool,aws_node_pool_id"; - option (google.longrunning.operation_info) = { - response_type: "AwsNodePool" - metadata_type: "OperationMetadata" - }; - } - - // Updates an [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]. - rpc UpdateAwsNodePool(UpdateAwsNodePoolRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{aws_node_pool.name=projects/*/locations/*/awsClusters/*/awsNodePools/*}" - body: "aws_node_pool" - }; - option (google.api.method_signature) = "aws_node_pool,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "AwsNodePool" - metadata_type: "OperationMetadata" - }; - } - - // Describes a specific - // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource. - rpc GetAwsNodePool(GetAwsNodePoolRequest) returns (AwsNodePool) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/awsClusters/*/awsNodePools/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] - // resources on a given - // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. - rpc ListAwsNodePools(ListAwsNodePoolsRequest) - returns (ListAwsNodePoolsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/awsClusters/*}/awsNodePools" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a specific [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] - // resource. - // - // If successful, the response contains a newly created - // [Operation][google.longrunning.Operation] resource that can be - // described to track the status of the operation. - rpc DeleteAwsNodePool(DeleteAwsNodePoolRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/awsClusters/*/awsNodePools/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Returns information, such as supported AWS regions and Kubernetes - // versions, on a given Google Cloud location. - rpc GetAwsServerConfig(GetAwsServerConfigRequest) returns (AwsServerConfig) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/awsServerConfig}" - }; - option (google.api.method_signature) = "name"; - } -} - -// Request message for `AwsClusters.CreateAwsCluster` method. -message CreateAwsClusterRequest { - // Required. The parent location where this - // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource will be - // created. - // - // Location names are formatted as `projects//locations/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkemulticloud.googleapis.com/AwsCluster" - } - ]; - - // Required. The specification of the - // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to create. - AwsCluster aws_cluster = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A client provided ID the resource. Must be unique within the - // parent resource. - // - // The provided ID will be part of the - // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource name - // formatted as - // `projects//locations//awsClusters/`. - // - // Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - string aws_cluster_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // If set, only validate the request, but do not actually create the cluster. - bool validate_only = 4; -} - -// Request message for `AwsClusters.UpdateAwsCluster` method. -message UpdateAwsClusterRequest { - // Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] - // resource to update. - AwsCluster aws_cluster = 1 [(google.api.field_behavior) = REQUIRED]; - - // If set, only validate the request, but do not actually update the cluster. - bool validate_only = 2; - - // Required. Mask of fields to update. At least one path must be supplied in - // this field. The elements of the repeated paths field can only include these - // fields from [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]: - // - // * `description`. - // * `annotations`. - // * `control_plane.version`. - // * `authorization.admin_users`. - // * `control_plane.aws_services_authentication.role_arn`. - // * `control_plane.aws_services_authentication.role_session_name`. - // * `control_plane.config_encryption.kms_key_arn`. - // * `control_plane.instance_type`. - // * `control_plane.security_group_ids`. - // * `control_plane.proxy_config`. - // * `control_plane.proxy_config.secret_arn`. - // * `control_plane.proxy_config.secret_version`. - // * `control_plane.root_volume.size_gib`. - // * `control_plane.root_volume.volume_type`. - // * `control_plane.root_volume.iops`. - // * `control_plane.root_volume.kms_key_arn`. - // * `control_plane.ssh_config`. - // * `control_plane.ssh_config.ec2_key_pair`. - // * `control_plane.instance_placement.tenancy`. - // * `control_plane.iam_instance_profile`. - // * `logging_config.component_config.enable_components`. - // * `control_plane.tags`. - // * `monitoring_config.managed_prometheus_config.enabled`. - google.protobuf.FieldMask update_mask = 4 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for `AwsClusters.GetAwsCluster` method. -message GetAwsClusterRequest { - // Required. The name of the - // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to - // describe. - // - // `AwsCluster` names are formatted as - // `projects//locations//awsClusters/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud Platform resource names. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkemulticloud.googleapis.com/AwsCluster" - } - ]; -} - -// Request message for `AwsClusters.ListAwsClusters` method. -message ListAwsClustersRequest { - // Required. The parent location which owns this collection of - // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources. - // - // Location names are formatted as `projects//locations/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud Platform resource names. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkemulticloud.googleapis.com/AwsCluster" - } - ]; - - // The maximum number of items to return. - // - // If not specified, a default value of 50 will be used by the service. - // Regardless of the pageSize value, the response can include a partial list - // and a caller should only rely on response's - // [nextPageToken][google.cloud.gkemulticloud.v1.ListAwsClustersResponse.next_page_token] - // to determine if there are more instances left to be queried. - int32 page_size = 2; - - // The `nextPageToken` value returned from a previous - // [awsClusters.list][google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters] - // request, if any. - string page_token = 3; -} - -// Response message for `AwsClusters.ListAwsClusters` method. -message ListAwsClustersResponse { - // A list of [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources - // in the specified Google Cloud Platform project and region region. - repeated AwsCluster aws_clusters = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; -} - -// Request message for `AwsClusters.DeleteAwsCluster` method. -message DeleteAwsClusterRequest { - // Required. The resource name the - // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to delete. - // - // `AwsCluster` names are formatted as - // `projects//locations//awsClusters/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud Platform resource names. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkemulticloud.googleapis.com/AwsCluster" - } - ]; - - // If set, only validate the request, but do not actually delete the resource. - bool validate_only = 2; - - // If set to true, and the - // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource is not - // found, the request will succeed but no action will be taken on the server - // and a completed [Operation][google.longrunning.Operation] will be returned. - // - // Useful for idempotent deletion. - bool allow_missing = 3; - - // The current etag of the - // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. - // - // Allows clients to perform deletions through optimistic concurrency control. - // - // If the provided etag does not match the current etag of the cluster, - // the request will fail and an ABORTED error will be returned. - string etag = 4; -} - -// Response message for `AwsClusters.CreateAwsNodePool` method. -message CreateAwsNodePoolRequest { - // Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] - // resource where this node pool will be created. - // - // `AwsCluster` names are formatted as - // `projects//locations//awsClusters/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkemulticloud.googleapis.com/AwsNodePool" - } - ]; - - // Required. The specification of the - // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to create. - AwsNodePool aws_node_pool = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A client provided ID the resource. Must be unique within the - // parent resource. - // - // The provided ID will be part of the - // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource name - // formatted as - // `projects//locations//awsClusters//awsNodePools/`. - // - // Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - string aws_node_pool_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // If set, only validate the request, but do not actually create the node - // pool. - bool validate_only = 4; -} - -// Request message for `AwsClusters.UpdateAwsNodePool` method. -message UpdateAwsNodePoolRequest { - // Required. The [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] - // resource to update. - AwsNodePool aws_node_pool = 1 [(google.api.field_behavior) = REQUIRED]; - - // If set, only validate the request, but don't actually update the node pool. - bool validate_only = 2; - - // Required. Mask of fields to update. At least one path must be supplied in - // this field. The elements of the repeated paths field can only include these - // fields from [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]: - // - // * `annotations`. - // * `version`. - // * `autoscaling.min_node_count`. - // * `autoscaling.max_node_count`. - // * `config.config_encryption.kms_key_arn`. - // * `config.security_group_ids`. - // * `config.root_volume.iops`. - // * `config.root_volume.kms_key_arn`. - // * `config.root_volume.volume_type`. - // * `config.root_volume.size_gib`. - // * `config.proxy_config`. - // * `config.proxy_config.secret_arn`. - // * `config.proxy_config.secret_version`. - // * `config.ssh_config`. - // * `config.ssh_config.ec2_key_pair`. - // * `config.instance_placement.tenancy`. - // * `config.iam_instance_profile`. - // * `config.labels`. - // * `config.tags`. - // * `config.autoscaling_metrics_collection`. - // * `config.autoscaling_metrics_collection.granularity`. - // * `config.autoscaling_metrics_collection.metrics`. - google.protobuf.FieldMask update_mask = 3 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for `AwsClusters.GetAwsNodePool` method. -message GetAwsNodePoolRequest { - // Required. The name of the - // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource to - // describe. - // - // `AwsNodePool` names are formatted as - // `projects//locations//awsClusters//awsNodePools/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkemulticloud.googleapis.com/AwsNodePool" - } - ]; -} - -// Request message for `AwsClusters.ListAwsNodePools` method. -message ListAwsNodePoolsRequest { - // Required. The parent `AwsCluster` which owns this collection of - // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. - // - // `AwsCluster` names are formatted as - // `projects//locations//awsClusters/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkemulticloud.googleapis.com/AwsNodePool" - } - ]; - - // The maximum number of items to return. - // - // If not specified, a default value of 50 will be used by the service. - // Regardless of the pageSize value, the response can include a partial list - // and a caller should only rely on response's - // [nextPageToken][google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse.next_page_token] - // to determine if there are more instances left to be queried. - int32 page_size = 2; - - // The `nextPageToken` value returned from a previous - // [awsNodePools.list][google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools] - // request, if any. - string page_token = 3; -} - -// Response message for `AwsClusters.ListAwsNodePools` method. -message ListAwsNodePoolsResponse { - // A list of [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] - // resources in the specified `AwsCluster`. - repeated AwsNodePool aws_node_pools = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; -} - -// Request message for `AwsClusters.DeleteAwsNodePool` method. -message DeleteAwsNodePoolRequest { - // Required. The resource name the - // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to delete. - // - // `AwsNodePool` names are formatted as - // `projects//locations//awsClusters//awsNodePools/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkemulticloud.googleapis.com/AwsNodePool" - } - ]; - - // If set, only validate the request, but do not actually delete the node - // pool. - bool validate_only = 2; - - // If set to true, and the - // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource is not - // found, the request will succeed but no action will be taken on the server - // and a completed [Operation][google.longrunning.Operation] will be returned. - // - // Useful for idempotent deletion. - bool allow_missing = 3; - - // The current ETag of the - // [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]. - // - // Allows clients to perform deletions through optimistic concurrency control. - // - // If the provided ETag does not match the current etag of the node pool, - // the request will fail and an ABORTED error will be returned. - string etag = 4; -} - -// GetAwsServerConfigRequest gets the server config of GKE cluster on AWS. -message GetAwsServerConfigRequest { - // Required. The name of the - // [AwsServerConfig][google.cloud.gkemulticloud.v1.AwsServerConfig] resource - // to describe. - // - // `AwsServerConfig` names are formatted as - // `projects//locations//awsServerConfig`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkemulticloud.googleapis.com/AwsServerConfig" - } - ]; -} - -// Request message for `AwsClusters.GenerateAwsAccessToken` method. -message GenerateAwsAccessTokenRequest { - // Required. The name of the - // [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to - // authenticate to. - // - // `AwsCluster` names are formatted as - // `projects//locations//awsClusters/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string aws_cluster = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkemulticloud.googleapis.com/AwsCluster" - } - ]; -} - -// Response message for `AwsClusters.GenerateAwsAccessToken` method. -message GenerateAwsAccessTokenResponse { - // Output only. Access token to authenticate to k8s api-server. - string access_token = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Timestamp at which the token will expire. - google.protobuf.Timestamp expiration_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/azure_resources.proto b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/azure_resources.proto deleted file mode 100644 index d7b6fc19e2d..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/azure_resources.proto +++ /dev/null @@ -1,708 +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.gkemulticloud.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/gkemulticloud/v1/common_resources.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeMultiCloud.V1"; -option go_package = "cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb;gkemulticloudpb"; -option java_multiple_files = true; -option java_outer_classname = "AzureResourcesProto"; -option java_package = "com.google.cloud.gkemulticloud.v1"; -option php_namespace = "Google\\Cloud\\GkeMultiCloud\\V1"; -option ruby_package = "Google::Cloud::GkeMultiCloud::V1"; - -// An Anthos cluster running on Azure. -message AzureCluster { - option (google.api.resource) = { - type: "gkemulticloud.googleapis.com/AzureCluster" - pattern: "projects/{project}/locations/{location}/azureClusters/{azure_cluster}" - }; - - // The lifecycle state of the cluster. - enum State { - // Not set. - STATE_UNSPECIFIED = 0; - - // The PROVISIONING state indicates the cluster is being created. - PROVISIONING = 1; - - // The RUNNING state indicates the cluster has been created and is fully - // usable. - RUNNING = 2; - - // The RECONCILING state indicates that some work is actively being done on - // the cluster, such as upgrading the control plane replicas. - RECONCILING = 3; - - // The STOPPING state indicates the cluster is being deleted. - STOPPING = 4; - - // The ERROR state indicates the cluster is in a broken unrecoverable - // state. - ERROR = 5; - - // The DEGRADED state indicates the cluster requires user action to - // restore full functionality. - DEGRADED = 6; - } - - // The name of this resource. - // - // Cluster names are formatted as - // `projects//locations//azureClusters/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud Platform resource names. - string name = 1; - - // Optional. A human readable description of this cluster. - // Cannot be longer than 255 UTF-8 encoded bytes. - string description = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The Azure region where the cluster runs. - // - // Each Google Cloud region supports a subset of nearby Azure regions. - // You can call - // [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig] - // to list all supported Azure regions within a given Google Cloud region. - string azure_region = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ARM ID of the resource group where the cluster resources are - // deployed. For example: - // `/subscriptions//resourceGroups/` - string resource_group_id = 17 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Name of the - // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] that contains - // authentication configuration for how the Anthos Multi-Cloud API connects to - // Azure APIs. - // - // The `AzureClient` resource must reside on the same Google Cloud Platform - // project and region as the `AzureCluster`. - // - // `AzureClient` names are formatted as - // `projects//locations//azureClients/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string azure_client = 16 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Cluster-wide networking configuration. - AzureClusterNetworking networking = 4 - [(google.api.field_behavior) = REQUIRED]; - - // Required. Configuration related to the cluster control plane. - AzureControlPlane control_plane = 5 [(google.api.field_behavior) = REQUIRED]; - - // Required. Configuration related to the cluster RBAC settings. - AzureAuthorization authorization = 6 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Authentication configuration for management of Azure resources. - AzureServicesAuthentication azure_services_authentication = 22 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The current state of the cluster. - State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The endpoint of the cluster's API server. - string endpoint = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A globally unique identifier for the cluster. - string uid = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If set, there are currently changes in flight to the cluster. - bool reconciling = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this cluster was created. - google.protobuf.Timestamp create_time = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this cluster was last updated. - google.protobuf.Timestamp update_time = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Allows clients to perform consistent read-modify-writes - // through optimistic concurrency control. - // - // Can be sent on update and delete requests to ensure the - // client has an up-to-date value before proceeding. - string etag = 13; - - // Optional. Annotations on the cluster. - // - // This field has the same restrictions as Kubernetes annotations. - // The total size of all keys and values combined is limited to 256k. - // Keys can have 2 segments: prefix (optional) and name (required), - // separated by a slash (/). - // Prefix must be a DNS subdomain. - // Name must be 63 characters or less, begin and end with alphanumerics, - // with dashes (-), underscores (_), dots (.), and alphanumerics between. - map annotations = 14 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Workload Identity settings. - WorkloadIdentityConfig workload_identity_config = 18 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. PEM encoded x509 certificate of the cluster root of trust. - string cluster_ca_certificate = 19 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Fleet configuration. - Fleet fleet = 20 [(google.api.field_behavior) = REQUIRED]; - - // Output only. Managed Azure resources for this cluster. - AzureClusterResources managed_resources = 21 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Logging configuration for this cluster. - LoggingConfig logging_config = 23 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. A set of errors found in the cluster. - repeated AzureClusterError errors = 24 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Monitoring configuration for this cluster. - MonitoringConfig monitoring_config = 25 - [(google.api.field_behavior) = OPTIONAL]; -} - -// ClusterNetworking contains cluster-wide networking configuration. -message AzureClusterNetworking { - // Required. The Azure Resource Manager (ARM) ID of the VNet associated with - // your cluster. - // - // All components in the cluster (i.e. control plane and node pools) run on a - // single VNet. - // - // Example: - // `/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks/` - // - // This field cannot be changed after creation. - string virtual_network_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The IP address range of the pods in this cluster, in CIDR - // notation (e.g. `10.96.0.0/14`). - // - // All pods in the cluster get assigned a unique IPv4 address from these - // ranges. Only a single range is supported. - // - // This field cannot be changed after creation. - repeated string pod_address_cidr_blocks = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The IP address range for services in this cluster, in CIDR - // notation (e.g. `10.96.0.0/14`). - // - // All services in the cluster get assigned a unique IPv4 address from these - // ranges. Only a single range is supported. - // - // This field cannot be changed after creating a cluster. - repeated string service_address_cidr_blocks = 3 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. The ARM ID of the subnet where Kubernetes private service type - // load balancers are deployed. When unspecified, it defaults to - // AzureControlPlane.subnet_id. - // - // Example: - // "/subscriptions/d00494d6-6f3c-4280-bbb2-899e163d1d30/resourceGroups/anthos_cluster_gkeust4/providers/Microsoft.Network/virtualNetworks/gke-vnet-gkeust4/subnets/subnetid456" - string service_load_balancer_subnet_id = 5 - [(google.api.field_behavior) = OPTIONAL]; -} - -// AzureControlPlane represents the control plane configurations. -message AzureControlPlane { - // Required. The Kubernetes version to run on control plane replicas - // (e.g. `1.19.10-gke.1000`). - // - // You can list all supported versions on a given Google Cloud region by - // calling - // [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig]. - string version = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The ARM ID of the default subnet for the control plane. The - // control plane VMs are deployed in this subnet, unless - // `AzureControlPlane.replica_placements` is specified. This subnet will also - // be used as default for `AzureControlPlane.endpoint_subnet_id` if - // `AzureControlPlane.endpoint_subnet_id` is not specified. Similarly it will - // be used as default for - // `AzureClusterNetworking.service_load_balancer_subnet_id`. - // - // Example: - // `/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/default`. - string subnet_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Azure VM size name. Example: `Standard_DS2_v2`. - // - // For available VM sizes, see - // https://docs.microsoft.com/en-us/azure/virtual-machines/vm-naming-conventions. - // - // When unspecified, it defaults to `Standard_DS2_v2`. - string vm_size = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Required. SSH configuration for how to access the underlying control plane - // machines. - AzureSshConfig ssh_config = 11 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Configuration related to the root volume provisioned for each - // control plane replica. - // - // When unspecified, it defaults to 32-GiB Azure Disk. - AzureDiskTemplate root_volume = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Configuration related to the main volume provisioned for each - // control plane replica. - // The main volume is in charge of storing all of the cluster's etcd state. - // - // When unspecified, it defaults to a 8-GiB Azure Disk. - AzureDiskTemplate main_volume = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Configuration related to application-layer secrets encryption. - AzureDatabaseEncryption database_encryption = 10 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Proxy configuration for outbound HTTP(S) traffic. - AzureProxyConfig proxy_config = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Configuration related to vm config encryption. - AzureConfigEncryption config_encryption = 14 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A set of tags to apply to all underlying control plane Azure - // resources. - map tags = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Configuration for where to place the control plane replicas. - // - // Up to three replica placement instances can be specified. If - // replica_placements is set, the replica placement instances will be applied - // to the three control plane replicas as evenly as possible. - repeated ReplicaPlacement replica_placements = 13 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The ARM ID of the subnet where the control plane load balancer is - // deployed. When unspecified, it defaults to AzureControlPlane.subnet_id. - // - // Example: - // "/subscriptions/d00494d6-6f3c-4280-bbb2-899e163d1d30/resourceGroups/anthos_cluster_gkeust4/providers/Microsoft.Network/virtualNetworks/gke-vnet-gkeust4/subnets/subnetid123" - string endpoint_subnet_id = 15 [(google.api.field_behavior) = OPTIONAL]; -} - -// Configuration for the placement of a control plane replica. -message ReplicaPlacement { - // Required. For a given replica, the ARM ID of the subnet where the control - // plane VM is deployed. Make sure it's a subnet under the virtual network in - // the cluster configuration. - string subnet_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. For a given replica, the Azure availability zone where to - // provision the control plane VM and the ETCD disk. - string azure_availability_zone = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Details of a proxy config stored in Azure Key Vault. -message AzureProxyConfig { - // The ARM ID the of the resource group containing proxy keyvault. - // - // Resource group ids are formatted as - // `/subscriptions//resourceGroups/`. - string resource_group_id = 1; - - // The URL the of the proxy setting secret with its version. - // - // The secret must be a JSON encoded proxy configuration - // as described in - // https://cloud.google.com/anthos/clusters/docs/multi-cloud/azure/how-to/use-a-proxy#create_a_proxy_configuration_file - // - // Secret ids are formatted as - // `https://.vault.azure.net/secrets//`. - string secret_id = 2; -} - -// Configuration related to application-layer secrets encryption. -// -// Anthos clusters on Azure encrypts your Kubernetes data at rest -// in etcd using Azure Key Vault. -message AzureDatabaseEncryption { - // Required. The ARM ID of the Azure Key Vault key to encrypt / decrypt data. - // - // For example: - // `/subscriptions//resourceGroups//providers/Microsoft.KeyVault/vaults//keys/` - // Encryption will always take the latest version of the key and hence - // specific version is not supported. - string key_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Configuration related to config data encryption. -// -// Azure VM bootstrap secret is envelope encrypted with the provided key vault -// key. -message AzureConfigEncryption { - // Required. The ARM ID of the Azure Key Vault key to encrypt / decrypt config - // data. - // - // For example: - // `/subscriptions//resourceGroups//providers/Microsoft.KeyVault/vaults//keys/` - string key_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. RSA key of the Azure Key Vault public key to use for encrypting - // the data. - // - // This key must be formatted as a PEM-encoded SubjectPublicKeyInfo (RFC 5280) - // in ASN.1 DER form. The string must be comprised of a single PEM block of - // type "PUBLIC KEY". - string public_key = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Configuration for Azure Disks. -message AzureDiskTemplate { - // Optional. The size of the disk, in GiBs. - // - // When unspecified, a default value is provided. See the specific reference - // in the parent resource. - int32 size_gib = 1 [(google.api.field_behavior) = OPTIONAL]; -} - -// `AzureClient` resources hold client authentication information needed by the -// Anthos Multi-Cloud API to manage Azure resources on your Azure subscription. -// -// When an [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] is -// created, an `AzureClient` resource needs to be provided and all operations on -// Azure resources associated to that cluster will authenticate to Azure -// services using the given client. -// -// `AzureClient` resources are immutable and cannot be modified upon creation. -// -// Each `AzureClient` resource is bound to a single Azure Active Directory -// Application and tenant. -message AzureClient { - option (google.api.resource) = { - type: "gkemulticloud.googleapis.com/AzureClient" - pattern: "projects/{project}/locations/{location}/azureClients/{azure_client}" - }; - - // The name of this resource. - // - // `AzureClient` resource names are formatted as - // `projects//locations//azureClients/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string name = 1; - - // Required. The Azure Active Directory Tenant ID. - string tenant_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Azure Active Directory Application ID. - string application_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Output only. If set, there are currently pending changes to the client. - bool reconciling = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Annotations on the resource. - // - // This field has the same restrictions as Kubernetes annotations. - // The total size of all keys and values combined is limited to 256k. - // Keys can have 2 segments: prefix (optional) and name (required), - // separated by a slash (/). - // Prefix must be a DNS subdomain. - // Name must be 63 characters or less, begin and end with alphanumerics, - // with dashes (-), underscores (_), dots (.), and alphanumerics between. - map annotations = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The PEM encoded x509 certificate. - string pem_certificate = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A globally unique identifier for the client. - string uid = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this resource was created. - google.protobuf.Timestamp create_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this client was last updated. - google.protobuf.Timestamp update_time = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Configuration related to the cluster RBAC settings. -message AzureAuthorization { - // Required. Users that can perform operations as a cluster admin. A managed - // ClusterRoleBinding will be created to grant the `cluster-admin` ClusterRole - // to the users. Up to ten admin users can be provided. - // - // For more info on RBAC, see - // https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles - repeated AzureClusterUser admin_users = 1 - [(google.api.field_behavior) = REQUIRED]; -} - -// Authentication configuration for the management of Azure resources. -message AzureServicesAuthentication { - // Required. The Azure Active Directory Tenant ID. - string tenant_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Azure Active Directory Application ID. - string application_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Identities of a user-type subject for Azure clusters. -message AzureClusterUser { - // Required. The name of the user, e.g. `my-gcp-id@gmail.com`. - string username = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// An Anthos node pool running on Azure. -message AzureNodePool { - option (google.api.resource) = { - type: "gkemulticloud.googleapis.com/AzureNodePool" - pattern: "projects/{project}/locations/{location}/azureClusters/{azure_cluster}/azureNodePools/{azure_node_pool}" - }; - - // The lifecycle state of the node pool. - enum State { - // Not set. - STATE_UNSPECIFIED = 0; - - // The PROVISIONING state indicates the node pool is being created. - PROVISIONING = 1; - - // The RUNNING state indicates the node pool has been created and is fully - // usable. - RUNNING = 2; - - // The RECONCILING state indicates that the node pool is being reconciled. - RECONCILING = 3; - - // The STOPPING state indicates the node pool is being deleted. - STOPPING = 4; - - // The ERROR state indicates the node pool is in a broken unrecoverable - // state. - ERROR = 5; - - // The DEGRADED state indicates the node pool requires user action to - // restore full functionality. - DEGRADED = 6; - } - - // The name of this resource. - // - // Node pool names are formatted as - // `projects//locations//azureClusters//azureNodePools/`. - // - // For more details on Google Cloud resource names, - // see [Resource Names](https://cloud.google.com/apis/design/resource_names) - string name = 1; - - // Required. The Kubernetes version (e.g. `1.19.10-gke.1000`) running on this - // node pool. - string version = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The node configuration of the node pool. - AzureNodeConfig config = 22 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ARM ID of the subnet where the node pool VMs run. Make sure - // it's a subnet under the virtual network in the cluster configuration. - string subnet_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Autoscaler configuration for this node pool. - AzureNodePoolAutoscaling autoscaling = 4 - [(google.api.field_behavior) = REQUIRED]; - - // Output only. The current state of the node pool. - State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A globally unique identifier for the node pool. - string uid = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If set, there are currently pending changes to the node - // pool. - bool reconciling = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this node pool was created. - google.protobuf.Timestamp create_time = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this node pool was last updated. - google.protobuf.Timestamp update_time = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Allows clients to perform consistent read-modify-writes - // through optimistic concurrency control. - // - // Can be sent on update and delete requests to ensure the - // client has an up-to-date value before proceeding. - string etag = 12; - - // Optional. Annotations on the node pool. - // - // This field has the same restrictions as Kubernetes annotations. - // The total size of all keys and values combined is limited to 256k. - // Keys can have 2 segments: prefix (optional) and name (required), - // separated by a slash (/). - // Prefix must be a DNS subdomain. - // Name must be 63 characters or less, begin and end with alphanumerics, - // with dashes (-), underscores (_), dots (.), and alphanumerics between. - map annotations = 13 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The constraint on the maximum number of pods that can be run - // simultaneously on a node in the node pool. - MaxPodsConstraint max_pods_constraint = 21 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. The Azure availability zone of the nodes in this nodepool. - // - // When unspecified, it defaults to `1`. - string azure_availability_zone = 23 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. A set of errors found in the node pool. - repeated AzureNodePoolError errors = 29 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Parameters that describe the configuration of all node machines -// on a given node pool. -message AzureNodeConfig { - // Optional. The Azure VM size name. Example: `Standard_DS2_v2`. - // - // See [Supported VM - // sizes](/anthos/clusters/docs/azure/reference/supported-vms) for options. - // - // When unspecified, it defaults to `Standard_DS2_v2`. - string vm_size = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Configuration related to the root volume provisioned for each - // node pool machine. - // - // When unspecified, it defaults to a 32-GiB Azure Disk. - AzureDiskTemplate root_volume = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A set of tags to apply to all underlying Azure resources for this - // node pool. This currently only includes Virtual Machine Scale Sets. - // - // Specify at most 50 pairs containing alphanumerics, spaces, and symbols - // (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to - // 255 Unicode characters. - map tags = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The OS image type to use on node pool instances. - // Can have a value of `ubuntu`, or `windows` if the cluster enables - // the Windows node pool preview feature. - // - // When unspecified, it defaults to `ubuntu`. - string image_type = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Required. SSH configuration for how to access the node pool machines. - AzureSshConfig ssh_config = 7 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Proxy configuration for outbound HTTP(S) traffic. - AzureProxyConfig proxy_config = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Configuration related to vm config encryption. - AzureConfigEncryption config_encryption = 12 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The initial taints assigned to nodes of this node pool. - repeated NodeTaint taints = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The initial labels assigned to nodes of this node pool. An object - // containing a list of "key": value pairs. Example: { "name": "wrench", - // "mass": "1.3kg", "count": "3" }. - map labels = 11 [(google.api.field_behavior) = OPTIONAL]; -} - -// Configuration related to Kubernetes cluster autoscaler. -// -// The Kubernetes cluster autoscaler will automatically adjust the -// size of the node pool based on the cluster load. -message AzureNodePoolAutoscaling { - // Required. Minimum number of nodes in the node pool. Must be greater than or - // equal to 1 and less than or equal to max_node_count. - int32 min_node_count = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Maximum number of nodes in the node pool. Must be greater than or - // equal to min_node_count and less than or equal to 50. - int32 max_node_count = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// AzureServerConfig contains information about a Google Cloud location, such as -// supported Azure regions and Kubernetes versions. -message AzureServerConfig { - option (google.api.resource) = { - type: "gkemulticloud.googleapis.com/AzureServerConfig" - pattern: "projects/{project}/locations/{location}/azureServerConfig" - }; - - // The `AzureServerConfig` resource name. - // - // `AzureServerConfig` names are formatted as - // `projects//locations//azureServerConfig`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud Platform resource names. - string name = 1; - - // List of valid Kubernetes versions. - repeated AzureK8sVersionInfo valid_versions = 2; - - // The list of supported Azure regions. - repeated string supported_azure_regions = 3; -} - -// Information about a supported Kubernetes version. -message AzureK8sVersionInfo { - // A supported Kubernetes version (for example, `1.19.10-gke.1000`) - string version = 1; -} - -// SSH configuration for Azure resources. -message AzureSshConfig { - // Required. The SSH public key data for VMs managed by Anthos. This accepts - // the authorized_keys file format used in OpenSSH according to the sshd(8) - // manual page. - string authorized_key = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Managed Azure resources for the cluster. -// -// The values could change and be empty, depending on the state of the cluster. -message AzureClusterResources { - // Output only. The ARM ID of the cluster network security group. - string network_security_group_id = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The ARM ID of the control plane application security group. - string control_plane_application_security_group_id = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// AzureClusterError describes errors found on Azure clusters. -message AzureClusterError { - // Human-friendly description of the error. - string message = 1; -} - -// AzureNodePoolError describes errors found on Azure node pools. -message AzureNodePoolError { - // Human-friendly description of the error. - string message = 1; -} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/azure_service.proto b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/azure_service.proto deleted file mode 100644 index d39e9dd63b5..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/azure_service.proto +++ /dev/null @@ -1,776 +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.gkemulticloud.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/gkemulticloud/v1/azure_resources.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeMultiCloud.V1"; -option go_package = "cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb;gkemulticloudpb"; -option java_multiple_files = true; -option java_outer_classname = "AzureServiceProto"; -option java_package = "com.google.cloud.gkemulticloud.v1"; -option php_namespace = "Google\\Cloud\\GkeMultiCloud\\V1"; -option ruby_package = "Google::Cloud::GkeMultiCloud::V1"; - -// The AzureClusters API provides a single centrally managed service -// to create and manage Anthos clusters that run on Azure infrastructure. -service AzureClusters { - option (google.api.default_host) = "gkemulticloud.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a new [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] - // resource on a given Google Cloud project and region. - // - // `AzureClient` resources hold client authentication - // information needed by the Anthos Multicloud API to manage Azure resources - // on your Azure subscription on your behalf. - // - // If successful, the response contains a newly created - // [Operation][google.longrunning.Operation] resource that can be - // described to track the status of the operation. - rpc CreateAzureClient(CreateAzureClientRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/azureClients" - body: "azure_client" - }; - option (google.api.method_signature) = - "parent,azure_client,azure_client_id"; - option (google.longrunning.operation_info) = { - response_type: "AzureClient" - metadata_type: "OperationMetadata" - }; - } - - // Describes a specific - // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource. - rpc GetAzureClient(GetAzureClientRequest) returns (AzureClient) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/azureClients/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] - // resources on a given Google Cloud project and region. - rpc ListAzureClients(ListAzureClientsRequest) - returns (ListAzureClientsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/azureClients" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a specific [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] - // resource. - // - // If the client is used by one or more clusters, deletion will - // fail and a `FAILED_PRECONDITION` error will be returned. - // - // If successful, the response contains a newly created - // [Operation][google.longrunning.Operation] resource that can be - // described to track the status of the operation. - rpc DeleteAzureClient(DeleteAzureClientRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/azureClients/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Creates a new [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] - // resource on a given Google Cloud Platform project and region. - // - // If successful, the response contains a newly created - // [Operation][google.longrunning.Operation] resource that can be - // described to track the status of the operation. - rpc CreateAzureCluster(CreateAzureClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/azureClusters" - body: "azure_cluster" - }; - option (google.api.method_signature) = - "parent,azure_cluster,azure_cluster_id"; - option (google.longrunning.operation_info) = { - response_type: "AzureCluster" - metadata_type: "OperationMetadata" - }; - } - - // Updates an [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. - rpc UpdateAzureCluster(UpdateAzureClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{azure_cluster.name=projects/*/locations/*/azureClusters/*}" - body: "azure_cluster" - }; - option (google.api.method_signature) = "azure_cluster,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "AzureCluster" - metadata_type: "OperationMetadata" - }; - } - - // Describes a specific - // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. - rpc GetAzureCluster(GetAzureClusterRequest) returns (AzureCluster) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/azureClusters/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] - // resources on a given Google Cloud project and region. - rpc ListAzureClusters(ListAzureClustersRequest) - returns (ListAzureClustersResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/azureClusters" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a specific - // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. - // - // Fails if the cluster has one or more associated - // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. - // - // If successful, the response contains a newly created - // [Operation][google.longrunning.Operation] resource that can be - // described to track the status of the operation. - rpc DeleteAzureCluster(DeleteAzureClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/azureClusters/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Generates a short-lived access token to authenticate to a given - // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. - rpc GenerateAzureAccessToken(GenerateAzureAccessTokenRequest) - returns (GenerateAzureAccessTokenResponse) { - option (google.api.http) = { - get: "/v1/{azure_cluster=projects/*/locations/*/azureClusters/*}:generateAzureAccessToken" - }; - } - - // Creates a new [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool], - // attached to a given - // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. - // - // If successful, the response contains a newly created - // [Operation][google.longrunning.Operation] resource that can be - // described to track the status of the operation. - rpc CreateAzureNodePool(CreateAzureNodePoolRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/azureClusters/*}/azureNodePools" - body: "azure_node_pool" - }; - option (google.api.method_signature) = - "parent,azure_node_pool,azure_node_pool_id"; - option (google.longrunning.operation_info) = { - response_type: "AzureNodePool" - metadata_type: "OperationMetadata" - }; - } - - // Updates an [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]. - rpc UpdateAzureNodePool(UpdateAzureNodePoolRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{azure_node_pool.name=projects/*/locations/*/azureClusters/*/azureNodePools/*}" - body: "azure_node_pool" - }; - option (google.api.method_signature) = "azure_node_pool,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "AzureNodePool" - metadata_type: "OperationMetadata" - }; - } - - // Describes a specific - // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource. - rpc GetAzureNodePool(GetAzureNodePoolRequest) returns (AzureNodePool) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/azureClusters/*/azureNodePools/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] - // resources on a given - // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. - rpc ListAzureNodePools(ListAzureNodePoolsRequest) - returns (ListAzureNodePoolsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/azureClusters/*}/azureNodePools" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a specific - // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource. - // - // If successful, the response contains a newly created - // [Operation][google.longrunning.Operation] resource that can be - // described to track the status of the operation. - rpc DeleteAzureNodePool(DeleteAzureNodePoolRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/azureClusters/*/azureNodePools/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Returns information, such as supported Azure regions and Kubernetes - // versions, on a given Google Cloud location. - rpc GetAzureServerConfig(GetAzureServerConfigRequest) - returns (AzureServerConfig) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/azureServerConfig}" - }; - option (google.api.method_signature) = "name"; - } -} - -// Request message for `AzureClusters.CreateAzureCluster` method. -message CreateAzureClusterRequest { - // Required. The parent location where this - // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource will be - // created. - // - // Location names are formatted as `projects//locations/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkemulticloud.googleapis.com/AzureCluster" - } - ]; - - // Required. The specification of the - // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to create. - AzureCluster azure_cluster = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A client provided ID the resource. Must be unique within the - // parent resource. - // - // The provided ID will be part of the - // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource name - // formatted as - // `projects//locations//azureClusters/`. - // - // Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - string azure_cluster_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // If set, only validate the request, but do not actually create the cluster. - bool validate_only = 4; -} - -// Request message for `AzureClusters.UpdateAzureCluster` method. -message UpdateAzureClusterRequest { - // Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] - // resource to update. - AzureCluster azure_cluster = 1 [(google.api.field_behavior) = REQUIRED]; - - // If set, only validate the request, but do not actually update the cluster. - bool validate_only = 2; - - // Required. Mask of fields to update. At least one path must be supplied in - // this field. The elements of the repeated paths field can only include these - // fields from [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]: - // - // * `description`. - // * `azureClient`. - // * `control_plane.version`. - // * `control_plane.vm_size`. - // * `annotations`. - // * `authorization.admin_users`. - // * `control_plane.root_volume.size_gib`. - // * `azure_services_authentication`. - // * `azure_services_authentication.tenant_id`. - // * `azure_services_authentication.application_id`. - // * `control_plane.proxy_config`. - // * `control_plane.proxy_config.resource_group_id`. - // * `control_plane.proxy_config.secret_id`. - // * `control_plane.ssh_config.authorized_key`. - // * `logging_config.component_config.enable_components` - // * `monitoring_config.managed_prometheus_config.enabled`. - google.protobuf.FieldMask update_mask = 4 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for `AzureClusters.GetAzureCluster` method. -message GetAzureClusterRequest { - // Required. The name of the - // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to - // describe. - // - // `AzureCluster` names are formatted as - // `projects//locations//azureClusters/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud Platform resource names. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkemulticloud.googleapis.com/AzureCluster" - } - ]; -} - -// Request message for `AzureClusters.ListAzureClusters` method. -message ListAzureClustersRequest { - // Required. The parent location which owns this collection of - // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resources. - // - // Location names are formatted as `projects//locations/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud Platform resource names. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkemulticloud.googleapis.com/AzureCluster" - } - ]; - - // The maximum number of items to return. - // - // If not specified, a default value of 50 will be used by the service. - // Regardless of the pageSize value, the response can include a partial list - // and a caller should only rely on response's - // [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureClustersResponse.next_page_token] - // to determine if there are more instances left to be queried. - int32 page_size = 2; - - // The `nextPageToken` value returned from a previous - // [azureClusters.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters] - // request, if any. - string page_token = 3; -} - -// Response message for `AzureClusters.ListAzureClusters` method. -message ListAzureClustersResponse { - // A list of [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] - // resources in the specified Google Cloud Platform project and region region. - repeated AzureCluster azure_clusters = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; -} - -// Request message for `Clusters.DeleteAzureCluster` method. -message DeleteAzureClusterRequest { - // Required. The resource name the - // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to delete. - // - // `AzureCluster` names are formatted as - // `projects//locations//azureClusters/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud Platform resource names. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkemulticloud.googleapis.com/AzureCluster" - } - ]; - - // If set to true, and the - // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource is not - // found, the request will succeed but no action will be taken on the server - // and a completed [Operation][google.longrunning.Operation] will be returned. - // - // Useful for idempotent deletion. - bool allow_missing = 2; - - // If set, only validate the request, but do not actually delete the resource. - bool validate_only = 3; - - // The current etag of the - // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. - // - // Allows clients to perform deletions through optimistic concurrency control. - // - // If the provided etag does not match the current etag of the cluster, - // the request will fail and an ABORTED error will be returned. - string etag = 4; -} - -// Response message for `AzureClusters.CreateAzureNodePool` method. -message CreateAzureNodePoolRequest { - // Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] - // resource where this node pool will be created. - // - // Location names are formatted as `projects//locations/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkemulticloud.googleapis.com/AzureNodePool" - } - ]; - - // Required. The specification of the - // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to create. - AzureNodePool azure_node_pool = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A client provided ID the resource. Must be unique within the - // parent resource. - // - // The provided ID will be part of the - // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource name - // formatted as - // `projects//locations//azureClusters//azureNodePools/`. - // - // Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - string azure_node_pool_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // If set, only validate the request, but do not actually create the node - // pool. - bool validate_only = 4; -} - -// Request message for `AzureClusters.UpdateAzureNodePool` method. -message UpdateAzureNodePoolRequest { - // Required. The [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] - // resource to update. - AzureNodePool azure_node_pool = 1 [(google.api.field_behavior) = REQUIRED]; - - // If set, only validate the request, but don't actually update the node pool. - bool validate_only = 2; - - // Required. Mask of fields to update. At least one path must be supplied in - // this field. The elements of the repeated paths field can only include these - // fields from [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]: - // - // *. `annotations`. - // * `version`. - // * `autoscaling.min_node_count`. - // * `autoscaling.max_node_count`. - // * `config.ssh_config.authorized_key`. - google.protobuf.FieldMask update_mask = 3 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for `AzureClusters.GetAzureNodePool` method. -message GetAzureNodePoolRequest { - // Required. The name of the - // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource to - // describe. - // - // `AzureNodePool` names are formatted as - // `projects//locations//azureClusters//azureNodePools/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkemulticloud.googleapis.com/AzureNodePool" - } - ]; -} - -// Request message for `AzureClusters.ListAzureNodePools` method. -message ListAzureNodePoolsRequest { - // Required. The parent `AzureCluster` which owns this collection of - // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. - // - // `AzureCluster` names are formatted as - // `projects//locations//azureClusters/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkemulticloud.googleapis.com/AzureNodePool" - } - ]; - - // The maximum number of items to return. - // - // If not specified, a default value of 50 will be used by the service. - // Regardless of the pageSize value, the response can include a partial list - // and a caller should only rely on response's - // [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse.next_page_token] - // to determine if there are more instances left to be queried. - int32 page_size = 2; - - // The `nextPageToken` value returned from a previous - // [azureNodePools.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools] - // request, if any. - string page_token = 3; -} - -// Response message for `AzureClusters.ListAzureNodePools` method. -message ListAzureNodePoolsResponse { - // A list of [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] - // resources in the specified `AzureCluster`. - repeated AzureNodePool azure_node_pools = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; -} - -// Delete message for `AzureClusters.DeleteAzureNodePool` method. -message DeleteAzureNodePoolRequest { - // Required. The resource name the - // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to delete. - // - // `AzureNodePool` names are formatted as - // `projects//locations//azureClusters//azureNodePools/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkemulticloud.googleapis.com/AzureNodePool" - } - ]; - - // If set, only validate the request, but do not actually delete the node - // pool. - bool validate_only = 2; - - // If set to true, and the - // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource is - // not found, the request will succeed but no action will be taken on the - // server and a completed [Operation][google.longrunning.Operation] will be - // returned. - // - // Useful for idempotent deletion. - bool allow_missing = 3; - - // The current ETag of the - // [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]. - // - // Allows clients to perform deletions through optimistic concurrency control. - // - // If the provided ETag does not match the current etag of the node pool, - // the request will fail and an ABORTED error will be returned. - string etag = 4; -} - -// GetAzureServerConfigRequest gets the server config of GKE cluster on Azure. -message GetAzureServerConfigRequest { - // Required. The name of the - // [AzureServerConfig][google.cloud.gkemulticloud.v1.AzureServerConfig] - // resource to describe. - // - // `AzureServerConfig` names are formatted as - // `projects//locations//azureServerConfig`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkemulticloud.googleapis.com/AzureServerConfig" - } - ]; -} - -// Request message for `AzureClusters.CreateAzureClient` method. -message CreateAzureClientRequest { - // Required. The parent location where this - // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource will be - // created. - // - // Location names are formatted as `projects//locations/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkemulticloud.googleapis.com/AzureClient" - } - ]; - - // Required. The specification of the - // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to create. - AzureClient azure_client = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A client provided ID the resource. Must be unique within the - // parent resource. - // - // The provided ID will be part of the - // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource name - // formatted as - // `projects//locations//azureClients/`. - // - // Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - string azure_client_id = 4 [(google.api.field_behavior) = REQUIRED]; - - // If set, only validate the request, but do not actually create the client. - bool validate_only = 3; -} - -// Request message for `AzureClusters.GetAzureClient` method. -message GetAzureClientRequest { - // Required. The name of the - // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource to - // describe. - // - // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are - // formatted as - // `projects//locations//azureClients/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkemulticloud.googleapis.com/AzureClient" - } - ]; -} - -// Request message for `AzureClusters.ListAzureClients` method. -message ListAzureClientsRequest { - // Required. The parent location which owns this collection of - // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resources. - // - // Location names are formatted as `projects//locations/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud Platform resource names. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "gkemulticloud.googleapis.com/AzureClient" - } - ]; - - // The maximum number of items to return. - // - // If not specified, a default value of 50 will be used by the service. - // Regardless of the pageSize value, the response can include a partial list - // and a caller should only rely on response's - // [nextPageToken][google.cloud.gkemulticloud.v1.ListAzureClientsResponse.next_page_token] - // to determine if there are more instances left to be queried. - int32 page_size = 2; - - // The `nextPageToken` value returned from a previous - // [azureClients.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients] - // request, if any. - string page_token = 3; -} - -// Response message for `AzureClusters.ListAzureClients` method. -message ListAzureClientsResponse { - // A list of [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] - // resources in the specified Google Cloud project and region region. - repeated AzureClient azure_clients = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; -} - -// Request message for `AzureClusters.DeleteAzureClient` method. -message DeleteAzureClientRequest { - // Required. The resource name the - // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to delete. - // - // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are - // formatted as - // `projects//locations//azureClients/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkemulticloud.googleapis.com/AzureClient" - } - ]; - - // If set to true, and the - // [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource is not - // found, the request will succeed but no action will be taken on the server - // and a completed [Operation][google.longrunning.Operation] will be returned. - // - // Useful for idempotent deletion. - bool allow_missing = 2; - - // If set, only validate the request, but do not actually delete the resource. - bool validate_only = 3; -} - -// Request message for `AzureClusters.GenerateAzureAccessToken` method. -message GenerateAzureAccessTokenRequest { - // Required. The name of the - // [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to - // authenticate to. - // - // `AzureCluster` names are formatted as - // `projects//locations//AzureClusters/`. - // - // See [Resource Names](https://cloud.google.com/apis/design/resource_names) - // for more details on Google Cloud resource names. - string azure_cluster = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gkemulticloud.googleapis.com/AzureCluster" - } - ]; -} - -// Response message for `AzureClusters.GenerateAzureAccessToken` method. -message GenerateAzureAccessTokenResponse { - // Output only. Access token to authenticate to k8s api-server. - string access_token = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Timestamp at which the token will expire. - google.protobuf.Timestamp expiration_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/common_resources.proto b/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/common_resources.proto deleted file mode 100644 index a39cb813e21..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/protos/google/cloud/gkemulticloud/v1/common_resources.proto +++ /dev/null @@ -1,174 +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.gkemulticloud.v1; - -import "google/api/field_behavior.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.GkeMultiCloud.V1"; -option go_package = "cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb;gkemulticloudpb"; -option java_multiple_files = true; -option java_outer_classname = "CommonResourcesProto"; -option java_package = "com.google.cloud.gkemulticloud.v1"; -option php_namespace = "Google\\Cloud\\GkeMultiCloud\\V1"; -option ruby_package = "Google::Cloud::GkeMultiCloud::V1"; - -// Workload Identity settings. -message WorkloadIdentityConfig { - // The OIDC issuer URL for this cluster. - string issuer_uri = 1; - - // The Workload Identity Pool associated to the cluster. - string workload_pool = 2; - - // The ID of the OIDC Identity Provider (IdP) associated to the Workload - // Identity Pool. - string identity_provider = 3; -} - -// Constraints applied to pods. -message MaxPodsConstraint { - // Required. The maximum number of pods to schedule on a single node. - int64 max_pods_per_node = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Metadata about a long-running operation. -message OperationMetadata { - // Output only. The time at which this operation was created. - google.protobuf.Timestamp create_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this operation was completed. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The name of the resource associated to this operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_detail = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of any error that occurred during the - // operation. - string error_detail = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The verb associated with the API method which triggered this - // operation. Possible values are "create", "delete", "update" and "import". - string verb = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether it has been requested cancellation - // for the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a - // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - // `Code.CANCELLED`. - bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The taint content for the node taint. -message NodeTaint { - // The taint effect. - enum Effect { - // Not set. - EFFECT_UNSPECIFIED = 0; - - // Do not allow new pods to schedule onto the node unless they tolerate the - // taint, but allow all pods submitted to Kubelet without going through the - // scheduler to start, and allow all already-running pods to continue - // running. Enforced by the scheduler. - NO_SCHEDULE = 1; - - // Like TaintEffectNoSchedule, but the scheduler tries not to schedule - // new pods onto the node, rather than prohibiting new pods from scheduling - // onto the node entirely. Enforced by the scheduler. - PREFER_NO_SCHEDULE = 2; - - // Evict any already-running pods that do not tolerate the taint. - // Currently enforced by NodeController. - NO_EXECUTE = 3; - } - - // Required. Key for the taint. - string key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Value for the taint. - string value = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The taint effect. - Effect effect = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Fleet related configuration. -// -// Fleets are a Google Cloud concept for logically organizing clusters, -// letting you use and manage multi-cluster capabilities and apply -// consistent policies across your systems. -// -// See [Anthos -// Fleets](https://cloud.google.com/anthos/multicluster-management/fleets) for -// more details on Anthos multi-cluster capabilities using Fleets. -message Fleet { - // Required. The name of the Fleet host project where this cluster will be - // registered. - // - // Project names are formatted as - // `projects/`. - string project = 1 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The name of the managed Hub Membership resource associated to - // this cluster. - // - // Membership names are formatted as - // `projects//locations/global/membership/`. - string membership = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Parameters that describe the Logging configuration in a cluster. -message LoggingConfig { - // The configuration of the logging components; - LoggingComponentConfig component_config = 1; -} - -// Parameters that describe the Logging component configuration in a cluster. -message LoggingComponentConfig { - // The components of the logging configuration; - enum Component { - // No component is specified - COMPONENT_UNSPECIFIED = 0; - - // This indicates that system logging components is enabled. - SYSTEM_COMPONENTS = 1; - - // This indicates that user workload logging component is enabled. - WORKLOADS = 2; - } - - // The components to be enabled. - repeated Component enable_components = 1; -} - -// Parameters that describe the Monitoring configuration in a cluster. -message MonitoringConfig { - // Enable Google Cloud Managed Service for Prometheus in the cluster. - ManagedPrometheusConfig managed_prometheus_config = 2; -} - -// ManagedPrometheusConfig defines the configuration for -// Google Cloud Managed Service for Prometheus. -message ManagedPrometheusConfig { - // Enable Managed Collection. - bool enabled = 1; -} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.create_attached_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.create_attached_cluster.js deleted file mode 100644 index 09243b47191..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.create_attached_cluster.js +++ /dev/null @@ -1,88 +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, attachedCluster, attachedClusterId) { - // [START gkemulticloud_v1_generated_AttachedClusters_CreateAttachedCluster_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 parent location where this - * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource - * will be created. - * Location names are formatted as `projects//locations/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const parent = 'abc123' - /** - * Required. The specification of the - * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster to create. - */ - // const attachedCluster = {} - /** - * Required. A client provided ID the resource. Must be unique within the - * parent resource. - * The provided ID will be part of the - * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource - * name formatted as - * `projects//locations//attachedClusters/`. - * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - */ - // const attachedClusterId = 'abc123' - /** - * If set, only validate the request, but do not actually create the cluster. - */ - // const validateOnly = true - - // Imports the Gkemulticloud library - const {AttachedClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AttachedClustersClient(); - - async function callCreateAttachedCluster() { - // Construct request - const request = { - parent, - attachedCluster, - attachedClusterId, - }; - - // Run request - const [operation] = await gkemulticloudClient.createAttachedCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateAttachedCluster(); - // [END gkemulticloud_v1_generated_AttachedClusters_CreateAttachedCluster_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-gkemulticloud/v1/samples/generated/v1/attached_clusters.delete_attached_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.delete_attached_cluster.js deleted file mode 100644 index 8fdb0ae29fe..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.delete_attached_cluster.js +++ /dev/null @@ -1,95 +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 gkemulticloud_v1_generated_AttachedClusters_DeleteAttachedCluster_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 the - * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster to delete. - * `AttachedCluster` names are formatted as - * `projects//locations//attachedClusters/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - */ - // const name = 'abc123' - /** - * If set, only validate the request, but do not actually delete the resource. - */ - // const validateOnly = true - /** - * If set to true, and the - * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource - * is not found, the request will succeed but no action will be taken on the - * server and a completed Operation google.longrunning.Operation will be - * returned. - * Useful for idempotent deletion. - */ - // const allowMissing = true - /** - * If set to true, the deletion of - * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource - * will succeed even if errors occur during deleting in cluster resources. - * Using this parameter may result in orphaned resources in the cluster. - */ - // const ignoreErrors = true - /** - * The current etag of the - * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster. - * Allows clients to perform deletions through optimistic concurrency control. - * If the provided etag does not match the current etag of the cluster, - * the request will fail and an ABORTED error will be returned. - */ - // const etag = 'abc123' - - // Imports the Gkemulticloud library - const {AttachedClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AttachedClustersClient(); - - async function callDeleteAttachedCluster() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await gkemulticloudClient.deleteAttachedCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteAttachedCluster(); - // [END gkemulticloud_v1_generated_AttachedClusters_DeleteAttachedCluster_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-gkemulticloud/v1/samples/generated/v1/attached_clusters.generate_attached_cluster_install_manifest.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.generate_attached_cluster_install_manifest.js deleted file mode 100644 index cc1f1e59083..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.generate_attached_cluster_install_manifest.js +++ /dev/null @@ -1,89 +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, attachedClusterId, platformVersion) { - // [START gkemulticloud_v1_generated_AttachedClusters_GenerateAttachedClusterInstallManifest_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 parent location where this - * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource - * will be created. - * Location names are formatted as `projects//locations/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const parent = 'abc123' - /** - * Required. A client provided ID of the resource. Must be unique within the - * parent resource. - * The provided ID will be part of the - * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource - * name formatted as - * `projects//locations//attachedClusters/`. - * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - * When generating an install manifest for importing an existing Membership - * resource, the attached_cluster_id field must be the Membership id. - * Membership names are formatted as - * `projects//locations//memberships/`. - */ - // const attachedClusterId = 'abc123' - /** - * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). - * You can list all supported versions on a given Google Cloud region by - * calling - * GetAttachedServerConfig google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig. - */ - // const platformVersion = 'abc123' - - // Imports the Gkemulticloud library - const {AttachedClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AttachedClustersClient(); - - async function callGenerateAttachedClusterInstallManifest() { - // Construct request - const request = { - parent, - attachedClusterId, - platformVersion, - }; - - // Run request - const response = await gkemulticloudClient.generateAttachedClusterInstallManifest(request); - console.log(response); - } - - callGenerateAttachedClusterInstallManifest(); - // [END gkemulticloud_v1_generated_AttachedClusters_GenerateAttachedClusterInstallManifest_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-gkemulticloud/v1/samples/generated/v1/attached_clusters.get_attached_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.get_attached_cluster.js deleted file mode 100644 index 5e265334d16..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.get_attached_cluster.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(name) { - // [START gkemulticloud_v1_generated_AttachedClusters_GetAttachedCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the - * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource - * to describe. - * `AttachedCluster` names are formatted as - * `projects//locations//attachedClusters/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - */ - // const name = 'abc123' - - // Imports the Gkemulticloud library - const {AttachedClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AttachedClustersClient(); - - async function callGetAttachedCluster() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkemulticloudClient.getAttachedCluster(request); - console.log(response); - } - - callGetAttachedCluster(); - // [END gkemulticloud_v1_generated_AttachedClusters_GetAttachedCluster_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-gkemulticloud/v1/samples/generated/v1/attached_clusters.get_attached_server_config.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.get_attached_server_config.js deleted file mode 100644 index 5c26aee502d..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.get_attached_server_config.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(name) { - // [START gkemulticloud_v1_generated_AttachedClusters_GetAttachedServerConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the - * AttachedServerConfig google.cloud.gkemulticloud.v1.AttachedServerConfig - * resource to describe. - * `AttachedServerConfig` names are formatted as - * `projects//locations//attachedServerConfig`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const name = 'abc123' - - // Imports the Gkemulticloud library - const {AttachedClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AttachedClustersClient(); - - async function callGetAttachedServerConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkemulticloudClient.getAttachedServerConfig(request); - console.log(response); - } - - callGetAttachedServerConfig(); - // [END gkemulticloud_v1_generated_AttachedClusters_GetAttachedServerConfig_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-gkemulticloud/v1/samples/generated/v1/attached_clusters.import_attached_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.import_attached_cluster.js deleted file mode 100644 index 72750afcabb..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.import_attached_cluster.js +++ /dev/null @@ -1,90 +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, fleetMembership, platformVersion, distribution) { - // [START gkemulticloud_v1_generated_AttachedClusters_ImportAttachedCluster_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 parent location where this - * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource - * will be created. - * Location names are formatted as `projects//locations/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const parent = 'abc123' - /** - * If set, only validate the request, but do not actually import the cluster. - */ - // const validateOnly = true - /** - * Required. The name of the fleet membership resource to import. - */ - // const fleetMembership = 'abc123' - /** - * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). - * You can list all supported versions on a given Google Cloud region by - * calling - * GetAttachedServerConfig google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig. - */ - // const platformVersion = 'abc123' - /** - * Required. The Kubernetes distribution of the underlying attached cluster. - * Supported values: "eks", "aks". - */ - // const distribution = 'abc123' - - // Imports the Gkemulticloud library - const {AttachedClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AttachedClustersClient(); - - async function callImportAttachedCluster() { - // Construct request - const request = { - parent, - fleetMembership, - platformVersion, - distribution, - }; - - // Run request - const [operation] = await gkemulticloudClient.importAttachedCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportAttachedCluster(); - // [END gkemulticloud_v1_generated_AttachedClusters_ImportAttachedCluster_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-gkemulticloud/v1/samples/generated/v1/attached_clusters.list_attached_clusters.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.list_attached_clusters.js deleted file mode 100644 index 86d76f8626c..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.list_attached_clusters.js +++ /dev/null @@ -1,82 +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 gkemulticloud_v1_generated_AttachedClusters_ListAttachedClusters_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 parent location which owns this collection of - * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resources. - * Location names are formatted as `projects//locations/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * nextPageToken google.cloud.gkemulticloud.v1.ListAttachedClustersResponse.next_page_token - * to determine if there are more instances left to be queried. - */ - // const pageSize = 1234 - /** - * The `nextPageToken` value returned from a previous - * attachedClusters.list google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters - * request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Gkemulticloud library - const {AttachedClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AttachedClustersClient(); - - async function callListAttachedClusters() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await gkemulticloudClient.listAttachedClustersAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAttachedClusters(); - // [END gkemulticloud_v1_generated_AttachedClusters_ListAttachedClusters_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-gkemulticloud/v1/samples/generated/v1/attached_clusters.update_attached_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.update_attached_cluster.js deleted file mode 100644 index 95fea7087d0..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/attached_clusters.update_attached_cluster.js +++ /dev/null @@ -1,82 +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(attachedCluster, updateMask) { - // [START gkemulticloud_v1_generated_AttachedClusters_UpdateAttachedCluster_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 - * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster resource - * to update. - */ - // const attachedCluster = {} - /** - * If set, only validate the request, but do not actually update the cluster. - */ - // const validateOnly = true - /** - * Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field can only include these - * fields from - * AttachedCluster google.cloud.gkemulticloud.v1.AttachedCluster: - * * `description`. - * * `annotations`. - * * `platform_version`. - * * `authorization.admin_users`. - * * `logging_config.component_config.enable_components`. - * * `monitoring_config.managed_prometheus_config.enabled`. - */ - // const updateMask = {} - - // Imports the Gkemulticloud library - const {AttachedClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AttachedClustersClient(); - - async function callUpdateAttachedCluster() { - // Construct request - const request = { - attachedCluster, - updateMask, - }; - - // Run request - const [operation] = await gkemulticloudClient.updateAttachedCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateAttachedCluster(); - // [END gkemulticloud_v1_generated_AttachedClusters_UpdateAttachedCluster_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.create_aws_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.create_aws_cluster.js deleted file mode 100644 index bebf61185d5..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.create_aws_cluster.js +++ /dev/null @@ -1,88 +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, awsCluster, awsClusterId) { - // [START gkemulticloud_v1_generated_AwsClusters_CreateAwsCluster_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 parent location where this - * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster resource will be - * created. - * Location names are formatted as `projects//locations/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const parent = 'abc123' - /** - * Required. The specification of the - * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster to create. - */ - // const awsCluster = {} - /** - * Required. A client provided ID the resource. Must be unique within the - * parent resource. - * The provided ID will be part of the - * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster resource name - * formatted as - * `projects//locations//awsClusters/`. - * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - */ - // const awsClusterId = 'abc123' - /** - * If set, only validate the request, but do not actually create the cluster. - */ - // const validateOnly = true - - // Imports the Gkemulticloud library - const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AwsClustersClient(); - - async function callCreateAwsCluster() { - // Construct request - const request = { - parent, - awsCluster, - awsClusterId, - }; - - // Run request - const [operation] = await gkemulticloudClient.createAwsCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateAwsCluster(); - // [END gkemulticloud_v1_generated_AwsClusters_CreateAwsCluster_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.create_aws_node_pool.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.create_aws_node_pool.js deleted file mode 100644 index 60915a0e8fd..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.create_aws_node_pool.js +++ /dev/null @@ -1,89 +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, awsNodePool, awsNodePoolId) { - // [START gkemulticloud_v1_generated_AwsClusters_CreateAwsNodePool_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 AwsCluster google.cloud.gkemulticloud.v1.AwsCluster - * resource where this node pool will be created. - * `AwsCluster` names are formatted as - * `projects//locations//awsClusters/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const parent = 'abc123' - /** - * Required. The specification of the - * AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool to create. - */ - // const awsNodePool = {} - /** - * Required. A client provided ID the resource. Must be unique within the - * parent resource. - * The provided ID will be part of the - * AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool resource name - * formatted as - * `projects//locations//awsClusters//awsNodePools/`. - * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - */ - // const awsNodePoolId = 'abc123' - /** - * If set, only validate the request, but do not actually create the node - * pool. - */ - // const validateOnly = true - - // Imports the Gkemulticloud library - const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AwsClustersClient(); - - async function callCreateAwsNodePool() { - // Construct request - const request = { - parent, - awsNodePool, - awsNodePoolId, - }; - - // Run request - const [operation] = await gkemulticloudClient.createAwsNodePool(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateAwsNodePool(); - // [END gkemulticloud_v1_generated_AwsClusters_CreateAwsNodePool_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.delete_aws_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.delete_aws_cluster.js deleted file mode 100644 index 9059ef97090..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.delete_aws_cluster.js +++ /dev/null @@ -1,87 +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 gkemulticloud_v1_generated_AwsClusters_DeleteAwsCluster_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 the - * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster to delete. - * `AwsCluster` names are formatted as - * `projects//locations//awsClusters/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - */ - // const name = 'abc123' - /** - * If set, only validate the request, but do not actually delete the resource. - */ - // const validateOnly = true - /** - * If set to true, and the - * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster resource is not - * found, the request will succeed but no action will be taken on the server - * and a completed Operation google.longrunning.Operation will be returned. - * Useful for idempotent deletion. - */ - // const allowMissing = true - /** - * The current etag of the - * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster. - * Allows clients to perform deletions through optimistic concurrency control. - * If the provided etag does not match the current etag of the cluster, - * the request will fail and an ABORTED error will be returned. - */ - // const etag = 'abc123' - - // Imports the Gkemulticloud library - const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AwsClustersClient(); - - async function callDeleteAwsCluster() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await gkemulticloudClient.deleteAwsCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteAwsCluster(); - // [END gkemulticloud_v1_generated_AwsClusters_DeleteAwsCluster_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.delete_aws_node_pool.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.delete_aws_node_pool.js deleted file mode 100644 index c0e11f27e76..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.delete_aws_node_pool.js +++ /dev/null @@ -1,88 +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 gkemulticloud_v1_generated_AwsClusters_DeleteAwsNodePool_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 the - * AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool to delete. - * `AwsNodePool` names are formatted as - * `projects//locations//awsClusters//awsNodePools/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const name = 'abc123' - /** - * If set, only validate the request, but do not actually delete the node - * pool. - */ - // const validateOnly = true - /** - * If set to true, and the - * AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool resource is not - * found, the request will succeed but no action will be taken on the server - * and a completed Operation google.longrunning.Operation will be returned. - * Useful for idempotent deletion. - */ - // const allowMissing = true - /** - * The current ETag of the - * AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool. - * Allows clients to perform deletions through optimistic concurrency control. - * If the provided ETag does not match the current etag of the node pool, - * the request will fail and an ABORTED error will be returned. - */ - // const etag = 'abc123' - - // Imports the Gkemulticloud library - const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AwsClustersClient(); - - async function callDeleteAwsNodePool() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await gkemulticloudClient.deleteAwsNodePool(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteAwsNodePool(); - // [END gkemulticloud_v1_generated_AwsClusters_DeleteAwsNodePool_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.generate_aws_access_token.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.generate_aws_access_token.js deleted file mode 100644 index 253bbe923f7..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.generate_aws_access_token.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(awsCluster) { - // [START gkemulticloud_v1_generated_AwsClusters_GenerateAwsAccessToken_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the - * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster resource to - * authenticate to. - * `AwsCluster` names are formatted as - * `projects//locations//awsClusters/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const awsCluster = 'abc123' - - // Imports the Gkemulticloud library - const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AwsClustersClient(); - - async function callGenerateAwsAccessToken() { - // Construct request - const request = { - awsCluster, - }; - - // Run request - const response = await gkemulticloudClient.generateAwsAccessToken(request); - console.log(response); - } - - callGenerateAwsAccessToken(); - // [END gkemulticloud_v1_generated_AwsClusters_GenerateAwsAccessToken_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_cluster.js deleted file mode 100644 index a8bb79ab935..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_cluster.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(name) { - // [START gkemulticloud_v1_generated_AwsClusters_GetAwsCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the - * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster resource to - * describe. - * `AwsCluster` names are formatted as - * `projects//locations//awsClusters/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - */ - // const name = 'abc123' - - // Imports the Gkemulticloud library - const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AwsClustersClient(); - - async function callGetAwsCluster() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkemulticloudClient.getAwsCluster(request); - console.log(response); - } - - callGetAwsCluster(); - // [END gkemulticloud_v1_generated_AwsClusters_GetAwsCluster_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_node_pool.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_node_pool.js deleted file mode 100644 index 5ed5aabf0d7..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_node_pool.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(name) { - // [START gkemulticloud_v1_generated_AwsClusters_GetAwsNodePool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the - * AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool resource to - * describe. - * `AwsNodePool` names are formatted as - * `projects//locations//awsClusters//awsNodePools/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const name = 'abc123' - - // Imports the Gkemulticloud library - const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AwsClustersClient(); - - async function callGetAwsNodePool() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkemulticloudClient.getAwsNodePool(request); - console.log(response); - } - - callGetAwsNodePool(); - // [END gkemulticloud_v1_generated_AwsClusters_GetAwsNodePool_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_server_config.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_server_config.js deleted file mode 100644 index 46187c7ab8f..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.get_aws_server_config.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(name) { - // [START gkemulticloud_v1_generated_AwsClusters_GetAwsServerConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the - * AwsServerConfig google.cloud.gkemulticloud.v1.AwsServerConfig resource - * to describe. - * `AwsServerConfig` names are formatted as - * `projects//locations//awsServerConfig`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const name = 'abc123' - - // Imports the Gkemulticloud library - const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AwsClustersClient(); - - async function callGetAwsServerConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkemulticloudClient.getAwsServerConfig(request); - console.log(response); - } - - callGetAwsServerConfig(); - // [END gkemulticloud_v1_generated_AwsClusters_GetAwsServerConfig_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.list_aws_clusters.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.list_aws_clusters.js deleted file mode 100644 index af8dedecf15..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.list_aws_clusters.js +++ /dev/null @@ -1,82 +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 gkemulticloud_v1_generated_AwsClusters_ListAwsClusters_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 parent location which owns this collection of - * AwsCluster google.cloud.gkemulticloud.v1.AwsCluster resources. - * Location names are formatted as `projects//locations/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * nextPageToken google.cloud.gkemulticloud.v1.ListAwsClustersResponse.next_page_token - * to determine if there are more instances left to be queried. - */ - // const pageSize = 1234 - /** - * The `nextPageToken` value returned from a previous - * awsClusters.list google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters - * request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Gkemulticloud library - const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AwsClustersClient(); - - async function callListAwsClusters() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await gkemulticloudClient.listAwsClustersAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAwsClusters(); - // [END gkemulticloud_v1_generated_AwsClusters_ListAwsClusters_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.list_aws_node_pools.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.list_aws_node_pools.js deleted file mode 100644 index d4077ddfd7f..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.list_aws_node_pools.js +++ /dev/null @@ -1,83 +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 gkemulticloud_v1_generated_AwsClusters_ListAwsNodePools_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 parent `AwsCluster` which owns this collection of - * AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool resources. - * `AwsCluster` names are formatted as - * `projects//locations//awsClusters/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * nextPageToken google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse.next_page_token - * to determine if there are more instances left to be queried. - */ - // const pageSize = 1234 - /** - * The `nextPageToken` value returned from a previous - * awsNodePools.list google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools - * request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Gkemulticloud library - const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AwsClustersClient(); - - async function callListAwsNodePools() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await gkemulticloudClient.listAwsNodePoolsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAwsNodePools(); - // [END gkemulticloud_v1_generated_AwsClusters_ListAwsNodePools_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.update_aws_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.update_aws_cluster.js deleted file mode 100644 index 02bf2990fb2..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.update_aws_cluster.js +++ /dev/null @@ -1,97 +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(awsCluster, updateMask) { - // [START gkemulticloud_v1_generated_AwsClusters_UpdateAwsCluster_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 AwsCluster google.cloud.gkemulticloud.v1.AwsCluster - * resource to update. - */ - // const awsCluster = {} - /** - * If set, only validate the request, but do not actually update the cluster. - */ - // const validateOnly = true - /** - * Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field can only include these - * fields from AwsCluster google.cloud.gkemulticloud.v1.AwsCluster: - * * `description`. - * * `annotations`. - * * `control_plane.version`. - * * `authorization.admin_users`. - * * `control_plane.aws_services_authentication.role_arn`. - * * `control_plane.aws_services_authentication.role_session_name`. - * * `control_plane.config_encryption.kms_key_arn`. - * * `control_plane.instance_type`. - * * `control_plane.security_group_ids`. - * * `control_plane.proxy_config`. - * * `control_plane.proxy_config.secret_arn`. - * * `control_plane.proxy_config.secret_version`. - * * `control_plane.root_volume.size_gib`. - * * `control_plane.root_volume.volume_type`. - * * `control_plane.root_volume.iops`. - * * `control_plane.root_volume.kms_key_arn`. - * * `control_plane.ssh_config`. - * * `control_plane.ssh_config.ec2_key_pair`. - * * `control_plane.instance_placement.tenancy`. - * * `control_plane.iam_instance_profile`. - * * `logging_config.component_config.enable_components`. - * * `control_plane.tags`. - * * `monitoring_config.managed_prometheus_config.enabled`. - */ - // const updateMask = {} - - // Imports the Gkemulticloud library - const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AwsClustersClient(); - - async function callUpdateAwsCluster() { - // Construct request - const request = { - awsCluster, - updateMask, - }; - - // Run request - const [operation] = await gkemulticloudClient.updateAwsCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateAwsCluster(); - // [END gkemulticloud_v1_generated_AwsClusters_UpdateAwsCluster_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-gkemulticloud/v1/samples/generated/v1/aws_clusters.update_aws_node_pool.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.update_aws_node_pool.js deleted file mode 100644 index f5022f1c180..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/aws_clusters.update_aws_node_pool.js +++ /dev/null @@ -1,96 +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(awsNodePool, updateMask) { - // [START gkemulticloud_v1_generated_AwsClusters_UpdateAwsNodePool_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 AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool - * resource to update. - */ - // const awsNodePool = {} - /** - * If set, only validate the request, but don't actually update the node pool. - */ - // const validateOnly = true - /** - * Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field can only include these - * fields from AwsNodePool google.cloud.gkemulticloud.v1.AwsNodePool: - * * `annotations`. - * * `version`. - * * `autoscaling.min_node_count`. - * * `autoscaling.max_node_count`. - * * `config.config_encryption.kms_key_arn`. - * * `config.security_group_ids`. - * * `config.root_volume.iops`. - * * `config.root_volume.kms_key_arn`. - * * `config.root_volume.volume_type`. - * * `config.root_volume.size_gib`. - * * `config.proxy_config`. - * * `config.proxy_config.secret_arn`. - * * `config.proxy_config.secret_version`. - * * `config.ssh_config`. - * * `config.ssh_config.ec2_key_pair`. - * * `config.instance_placement.tenancy`. - * * `config.iam_instance_profile`. - * * `config.labels`. - * * `config.tags`. - * * `config.autoscaling_metrics_collection`. - * * `config.autoscaling_metrics_collection.granularity`. - * * `config.autoscaling_metrics_collection.metrics`. - */ - // const updateMask = {} - - // Imports the Gkemulticloud library - const {AwsClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AwsClustersClient(); - - async function callUpdateAwsNodePool() { - // Construct request - const request = { - awsNodePool, - updateMask, - }; - - // Run request - const [operation] = await gkemulticloudClient.updateAwsNodePool(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateAwsNodePool(); - // [END gkemulticloud_v1_generated_AwsClusters_UpdateAwsNodePool_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_client.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_client.js deleted file mode 100644 index 5a380a742fd..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_client.js +++ /dev/null @@ -1,88 +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, azureClient, azureClientId) { - // [START gkemulticloud_v1_generated_AzureClusters_CreateAzureClient_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 parent location where this - * AzureClient google.cloud.gkemulticloud.v1.AzureClient resource will be - * created. - * Location names are formatted as `projects//locations/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const parent = 'abc123' - /** - * Required. The specification of the - * AzureClient google.cloud.gkemulticloud.v1.AzureClient to create. - */ - // const azureClient = {} - /** - * Required. A client provided ID the resource. Must be unique within the - * parent resource. - * The provided ID will be part of the - * AzureClient google.cloud.gkemulticloud.v1.AzureClient resource name - * formatted as - * `projects//locations//azureClients/`. - * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - */ - // const azureClientId = 'abc123' - /** - * If set, only validate the request, but do not actually create the client. - */ - // const validateOnly = true - - // Imports the Gkemulticloud library - const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AzureClustersClient(); - - async function callCreateAzureClient() { - // Construct request - const request = { - parent, - azureClient, - azureClientId, - }; - - // Run request - const [operation] = await gkemulticloudClient.createAzureClient(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateAzureClient(); - // [END gkemulticloud_v1_generated_AzureClusters_CreateAzureClient_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_cluster.js deleted file mode 100644 index 9e580122fd6..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_cluster.js +++ /dev/null @@ -1,88 +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, azureCluster, azureClusterId) { - // [START gkemulticloud_v1_generated_AzureClusters_CreateAzureCluster_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 parent location where this - * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster resource will be - * created. - * Location names are formatted as `projects//locations/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const parent = 'abc123' - /** - * Required. The specification of the - * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster to create. - */ - // const azureCluster = {} - /** - * Required. A client provided ID the resource. Must be unique within the - * parent resource. - * The provided ID will be part of the - * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster resource name - * formatted as - * `projects//locations//azureClusters/`. - * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - */ - // const azureClusterId = 'abc123' - /** - * If set, only validate the request, but do not actually create the cluster. - */ - // const validateOnly = true - - // Imports the Gkemulticloud library - const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AzureClustersClient(); - - async function callCreateAzureCluster() { - // Construct request - const request = { - parent, - azureCluster, - azureClusterId, - }; - - // Run request - const [operation] = await gkemulticloudClient.createAzureCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateAzureCluster(); - // [END gkemulticloud_v1_generated_AzureClusters_CreateAzureCluster_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_node_pool.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_node_pool.js deleted file mode 100644 index a9884c7d5cb..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.create_azure_node_pool.js +++ /dev/null @@ -1,88 +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, azureNodePool, azureNodePoolId) { - // [START gkemulticloud_v1_generated_AzureClusters_CreateAzureNodePool_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 AzureCluster google.cloud.gkemulticloud.v1.AzureCluster - * resource where this node pool will be created. - * Location names are formatted as `projects//locations/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const parent = 'abc123' - /** - * Required. The specification of the - * AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool to create. - */ - // const azureNodePool = {} - /** - * Required. A client provided ID the resource. Must be unique within the - * parent resource. - * The provided ID will be part of the - * AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool resource name - * formatted as - * `projects//locations//azureClusters//azureNodePools/`. - * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - */ - // const azureNodePoolId = 'abc123' - /** - * If set, only validate the request, but do not actually create the node - * pool. - */ - // const validateOnly = true - - // Imports the Gkemulticloud library - const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AzureClustersClient(); - - async function callCreateAzureNodePool() { - // Construct request - const request = { - parent, - azureNodePool, - azureNodePoolId, - }; - - // Run request - const [operation] = await gkemulticloudClient.createAzureNodePool(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateAzureNodePool(); - // [END gkemulticloud_v1_generated_AzureClusters_CreateAzureNodePool_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_client.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_client.js deleted file mode 100644 index 45f7cc1653a..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_client.js +++ /dev/null @@ -1,80 +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 gkemulticloud_v1_generated_AzureClusters_DeleteAzureClient_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 the - * AzureClient google.cloud.gkemulticloud.v1.AzureClient to delete. - * AzureClient google.cloud.gkemulticloud.v1.AzureClient names are - * formatted as - * `projects//locations//azureClients/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const name = 'abc123' - /** - * If set to true, and the - * AzureClient google.cloud.gkemulticloud.v1.AzureClient resource is not - * found, the request will succeed but no action will be taken on the server - * and a completed Operation google.longrunning.Operation will be returned. - * Useful for idempotent deletion. - */ - // const allowMissing = true - /** - * If set, only validate the request, but do not actually delete the resource. - */ - // const validateOnly = true - - // Imports the Gkemulticloud library - const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AzureClustersClient(); - - async function callDeleteAzureClient() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await gkemulticloudClient.deleteAzureClient(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteAzureClient(); - // [END gkemulticloud_v1_generated_AzureClusters_DeleteAzureClient_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_cluster.js deleted file mode 100644 index b2dbf072f6f..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_cluster.js +++ /dev/null @@ -1,87 +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 gkemulticloud_v1_generated_AzureClusters_DeleteAzureCluster_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 the - * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster to delete. - * `AzureCluster` names are formatted as - * `projects//locations//azureClusters/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - */ - // const name = 'abc123' - /** - * If set to true, and the - * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster resource is not - * found, the request will succeed but no action will be taken on the server - * and a completed Operation google.longrunning.Operation will be returned. - * Useful for idempotent deletion. - */ - // const allowMissing = true - /** - * If set, only validate the request, but do not actually delete the resource. - */ - // const validateOnly = true - /** - * The current etag of the - * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster. - * Allows clients to perform deletions through optimistic concurrency control. - * If the provided etag does not match the current etag of the cluster, - * the request will fail and an ABORTED error will be returned. - */ - // const etag = 'abc123' - - // Imports the Gkemulticloud library - const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AzureClustersClient(); - - async function callDeleteAzureCluster() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await gkemulticloudClient.deleteAzureCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteAzureCluster(); - // [END gkemulticloud_v1_generated_AzureClusters_DeleteAzureCluster_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_node_pool.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_node_pool.js deleted file mode 100644 index dcc3b121b25..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.delete_azure_node_pool.js +++ /dev/null @@ -1,89 +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 gkemulticloud_v1_generated_AzureClusters_DeleteAzureNodePool_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 the - * AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool to delete. - * `AzureNodePool` names are formatted as - * `projects//locations//azureClusters//azureNodePools/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const name = 'abc123' - /** - * If set, only validate the request, but do not actually delete the node - * pool. - */ - // const validateOnly = true - /** - * If set to true, and the - * AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool resource is - * not found, the request will succeed but no action will be taken on the - * server and a completed Operation google.longrunning.Operation will be - * returned. - * Useful for idempotent deletion. - */ - // const allowMissing = true - /** - * The current ETag of the - * AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool. - * Allows clients to perform deletions through optimistic concurrency control. - * If the provided ETag does not match the current etag of the node pool, - * the request will fail and an ABORTED error will be returned. - */ - // const etag = 'abc123' - - // Imports the Gkemulticloud library - const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AzureClustersClient(); - - async function callDeleteAzureNodePool() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await gkemulticloudClient.deleteAzureNodePool(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteAzureNodePool(); - // [END gkemulticloud_v1_generated_AzureClusters_DeleteAzureNodePool_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.generate_azure_access_token.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.generate_azure_access_token.js deleted file mode 100644 index 0a27cfcbd3d..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.generate_azure_access_token.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(azureCluster) { - // [START gkemulticloud_v1_generated_AzureClusters_GenerateAzureAccessToken_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the - * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster resource to - * authenticate to. - * `AzureCluster` names are formatted as - * `projects//locations//AzureClusters/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const azureCluster = 'abc123' - - // Imports the Gkemulticloud library - const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AzureClustersClient(); - - async function callGenerateAzureAccessToken() { - // Construct request - const request = { - azureCluster, - }; - - // Run request - const response = await gkemulticloudClient.generateAzureAccessToken(request); - console.log(response); - } - - callGenerateAzureAccessToken(); - // [END gkemulticloud_v1_generated_AzureClusters_GenerateAzureAccessToken_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_client.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_client.js deleted file mode 100644 index 10ee35f4cbf..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_client.js +++ /dev/null @@ -1,68 +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 gkemulticloud_v1_generated_AzureClusters_GetAzureClient_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the - * AzureClient google.cloud.gkemulticloud.v1.AzureClient resource to - * describe. - * AzureClient google.cloud.gkemulticloud.v1.AzureClient names are - * formatted as - * `projects//locations//azureClients/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const name = 'abc123' - - // Imports the Gkemulticloud library - const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AzureClustersClient(); - - async function callGetAzureClient() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkemulticloudClient.getAzureClient(request); - console.log(response); - } - - callGetAzureClient(); - // [END gkemulticloud_v1_generated_AzureClusters_GetAzureClient_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_cluster.js deleted file mode 100644 index f575dfb7fef..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_cluster.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(name) { - // [START gkemulticloud_v1_generated_AzureClusters_GetAzureCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the - * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster resource to - * describe. - * `AzureCluster` names are formatted as - * `projects//locations//azureClusters/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - */ - // const name = 'abc123' - - // Imports the Gkemulticloud library - const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AzureClustersClient(); - - async function callGetAzureCluster() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkemulticloudClient.getAzureCluster(request); - console.log(response); - } - - callGetAzureCluster(); - // [END gkemulticloud_v1_generated_AzureClusters_GetAzureCluster_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_node_pool.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_node_pool.js deleted file mode 100644 index 8472d29a058..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_node_pool.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(name) { - // [START gkemulticloud_v1_generated_AzureClusters_GetAzureNodePool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the - * AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool resource to - * describe. - * `AzureNodePool` names are formatted as - * `projects//locations//azureClusters//azureNodePools/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const name = 'abc123' - - // Imports the Gkemulticloud library - const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AzureClustersClient(); - - async function callGetAzureNodePool() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkemulticloudClient.getAzureNodePool(request); - console.log(response); - } - - callGetAzureNodePool(); - // [END gkemulticloud_v1_generated_AzureClusters_GetAzureNodePool_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_server_config.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_server_config.js deleted file mode 100644 index 946ca8fcee8..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.get_azure_server_config.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(name) { - // [START gkemulticloud_v1_generated_AzureClusters_GetAzureServerConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the - * AzureServerConfig google.cloud.gkemulticloud.v1.AzureServerConfig - * resource to describe. - * `AzureServerConfig` names are formatted as - * `projects//locations//azureServerConfig`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const name = 'abc123' - - // Imports the Gkemulticloud library - const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AzureClustersClient(); - - async function callGetAzureServerConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gkemulticloudClient.getAzureServerConfig(request); - console.log(response); - } - - callGetAzureServerConfig(); - // [END gkemulticloud_v1_generated_AzureClusters_GetAzureServerConfig_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_clients.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_clients.js deleted file mode 100644 index 15ce045ff7e..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_clients.js +++ /dev/null @@ -1,82 +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 gkemulticloud_v1_generated_AzureClusters_ListAzureClients_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 parent location which owns this collection of - * AzureClient google.cloud.gkemulticloud.v1.AzureClient resources. - * Location names are formatted as `projects//locations/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * nextPageToken google.cloud.gkemulticloud.v1.ListAzureClientsResponse.next_page_token - * to determine if there are more instances left to be queried. - */ - // const pageSize = 1234 - /** - * The `nextPageToken` value returned from a previous - * azureClients.list google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients - * request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Gkemulticloud library - const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AzureClustersClient(); - - async function callListAzureClients() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await gkemulticloudClient.listAzureClientsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAzureClients(); - // [END gkemulticloud_v1_generated_AzureClusters_ListAzureClients_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_clusters.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_clusters.js deleted file mode 100644 index 61ee406c1ee..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_clusters.js +++ /dev/null @@ -1,82 +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 gkemulticloud_v1_generated_AzureClusters_ListAzureClusters_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 parent location which owns this collection of - * AzureCluster google.cloud.gkemulticloud.v1.AzureCluster resources. - * Location names are formatted as `projects//locations/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * nextPageToken google.cloud.gkemulticloud.v1.ListAzureClustersResponse.next_page_token - * to determine if there are more instances left to be queried. - */ - // const pageSize = 1234 - /** - * The `nextPageToken` value returned from a previous - * azureClusters.list google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters - * request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Gkemulticloud library - const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AzureClustersClient(); - - async function callListAzureClusters() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await gkemulticloudClient.listAzureClustersAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAzureClusters(); - // [END gkemulticloud_v1_generated_AzureClusters_ListAzureClusters_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_node_pools.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_node_pools.js deleted file mode 100644 index 8300eef3848..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.list_azure_node_pools.js +++ /dev/null @@ -1,83 +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 gkemulticloud_v1_generated_AzureClusters_ListAzureNodePools_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 parent `AzureCluster` which owns this collection of - * AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool resources. - * `AzureCluster` names are formatted as - * `projects//locations//azureClusters/`. - * See Resource Names (https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * nextPageToken google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse.next_page_token - * to determine if there are more instances left to be queried. - */ - // const pageSize = 1234 - /** - * The `nextPageToken` value returned from a previous - * azureNodePools.list google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools - * request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Gkemulticloud library - const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AzureClustersClient(); - - async function callListAzureNodePools() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await gkemulticloudClient.listAzureNodePoolsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAzureNodePools(); - // [END gkemulticloud_v1_generated_AzureClusters_ListAzureNodePools_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.update_azure_cluster.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.update_azure_cluster.js deleted file mode 100644 index f506e9ee86b..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.update_azure_cluster.js +++ /dev/null @@ -1,90 +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(azureCluster, updateMask) { - // [START gkemulticloud_v1_generated_AzureClusters_UpdateAzureCluster_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 AzureCluster google.cloud.gkemulticloud.v1.AzureCluster - * resource to update. - */ - // const azureCluster = {} - /** - * If set, only validate the request, but do not actually update the cluster. - */ - // const validateOnly = true - /** - * Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field can only include these - * fields from AzureCluster google.cloud.gkemulticloud.v1.AzureCluster: - * * `description`. - * * `azureClient`. - * * `control_plane.version`. - * * `control_plane.vm_size`. - * * `annotations`. - * * `authorization.admin_users`. - * * `control_plane.root_volume.size_gib`. - * * `azure_services_authentication`. - * * `azure_services_authentication.tenant_id`. - * * `azure_services_authentication.application_id`. - * * `control_plane.proxy_config`. - * * `control_plane.proxy_config.resource_group_id`. - * * `control_plane.proxy_config.secret_id`. - * * `control_plane.ssh_config.authorized_key`. - * * `logging_config.component_config.enable_components` - * * `monitoring_config.managed_prometheus_config.enabled`. - */ - // const updateMask = {} - - // Imports the Gkemulticloud library - const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AzureClustersClient(); - - async function callUpdateAzureCluster() { - // Construct request - const request = { - azureCluster, - updateMask, - }; - - // Run request - const [operation] = await gkemulticloudClient.updateAzureCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateAzureCluster(); - // [END gkemulticloud_v1_generated_AzureClusters_UpdateAzureCluster_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-gkemulticloud/v1/samples/generated/v1/azure_clusters.update_azure_node_pool.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.update_azure_node_pool.js deleted file mode 100644 index 9e28c7e11eb..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/azure_clusters.update_azure_node_pool.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(azureNodePool, updateMask) { - // [START gkemulticloud_v1_generated_AzureClusters_UpdateAzureNodePool_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 AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool - * resource to update. - */ - // const azureNodePool = {} - /** - * If set, only validate the request, but don't actually update the node pool. - */ - // const validateOnly = true - /** - * Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field can only include these - * fields from AzureNodePool google.cloud.gkemulticloud.v1.AzureNodePool: - * *. `annotations`. - * * `version`. - * * `autoscaling.min_node_count`. - * * `autoscaling.max_node_count`. - * * `config.ssh_config.authorized_key`. - */ - // const updateMask = {} - - // Imports the Gkemulticloud library - const {AzureClustersClient} = require('@google-cloud/gkemulticloud').v1; - - // Instantiates a client - const gkemulticloudClient = new AzureClustersClient(); - - async function callUpdateAzureNodePool() { - // Construct request - const request = { - azureNodePool, - updateMask, - }; - - // Run request - const [operation] = await gkemulticloudClient.updateAzureNodePool(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateAzureNodePool(); - // [END gkemulticloud_v1_generated_AzureClusters_UpdateAzureNodePool_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-gkemulticloud/v1/samples/generated/v1/snippet_metadata_google.cloud.gkemulticloud.v1.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/snippet_metadata_google.cloud.gkemulticloud.v1.json deleted file mode 100644 index d49a78ae902..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/samples/generated/v1/snippet_metadata_google.cloud.gkemulticloud.v1.json +++ /dev/null @@ -1,1711 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-gkemulticloud", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.gkemulticloud.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "gkemulticloud_v1_generated_AttachedClusters_CreateAttachedCluster_async", - "title": "AttachedClusters createAttachedCluster Sample", - "origin": "API_DEFINITION", - "description": " Creates a new [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource on a given Google Cloud Platform project and region. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", - "canonical": true, - "file": "attached_clusters.create_attached_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateAttachedCluster", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.CreateAttachedCluster", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "attached_cluster", - "type": ".google.cloud.gkemulticloud.v1.AttachedCluster" - }, - { - "name": "attached_cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AttachedClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClustersClient" - }, - "method": { - "shortName": "CreateAttachedCluster", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.CreateAttachedCluster", - "service": { - "shortName": "AttachedClusters", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AttachedClusters_UpdateAttachedCluster_async", - "title": "AttachedClusters updateAttachedCluster Sample", - "origin": "API_DEFINITION", - "description": " Updates an [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster].", - "canonical": true, - "file": "attached_clusters.update_attached_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAttachedCluster", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.UpdateAttachedCluster", - "async": true, - "parameters": [ - { - "name": "attached_cluster", - "type": ".google.cloud.gkemulticloud.v1.AttachedCluster" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AttachedClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClustersClient" - }, - "method": { - "shortName": "UpdateAttachedCluster", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.UpdateAttachedCluster", - "service": { - "shortName": "AttachedClusters", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AttachedClusters_ImportAttachedCluster_async", - "title": "AttachedClusters importAttachedCluster Sample", - "origin": "API_DEFINITION", - "description": " Imports creates a new [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource by importing an existing Fleet Membership resource. Attached Clusters created before the introduction of the Anthos Multi-Cloud API can be imported through this method. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", - "canonical": true, - "file": "attached_clusters.import_attached_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportAttachedCluster", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.ImportAttachedCluster", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "fleet_membership", - "type": "TYPE_STRING" - }, - { - "name": "platform_version", - "type": "TYPE_STRING" - }, - { - "name": "distribution", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AttachedClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClustersClient" - }, - "method": { - "shortName": "ImportAttachedCluster", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.ImportAttachedCluster", - "service": { - "shortName": "AttachedClusters", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AttachedClusters_GetAttachedCluster_async", - "title": "AttachedClusters getAttachedCluster Sample", - "origin": "API_DEFINITION", - "description": " Describes a specific [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource.", - "canonical": true, - "file": "attached_clusters.get_attached_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAttachedCluster", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedCluster", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.AttachedCluster", - "client": { - "shortName": "AttachedClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClustersClient" - }, - "method": { - "shortName": "GetAttachedCluster", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedCluster", - "service": { - "shortName": "AttachedClusters", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AttachedClusters_ListAttachedClusters_async", - "title": "AttachedClusters listAttachedClusters Sample", - "origin": "API_DEFINITION", - "description": " Lists all [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resources on a given Google Cloud project and region.", - "canonical": true, - "file": "attached_clusters.list_attached_clusters.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAttachedClusters", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.ListAttachedClustersResponse", - "client": { - "shortName": "AttachedClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClustersClient" - }, - "method": { - "shortName": "ListAttachedClusters", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters", - "service": { - "shortName": "AttachedClusters", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AttachedClusters_DeleteAttachedCluster_async", - "title": "AttachedClusters deleteAttachedCluster Sample", - "origin": "API_DEFINITION", - "description": " Deletes a specific [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", - "canonical": true, - "file": "attached_clusters.delete_attached_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAttachedCluster", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.DeleteAttachedCluster", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - }, - { - "name": "ignore_errors", - "type": "TYPE_BOOL" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AttachedClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClustersClient" - }, - "method": { - "shortName": "DeleteAttachedCluster", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.DeleteAttachedCluster", - "service": { - "shortName": "AttachedClusters", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AttachedClusters_GetAttachedServerConfig_async", - "title": "AttachedClusters getAttachedServerConfig Sample", - "origin": "API_DEFINITION", - "description": " Returns information, such as supported Kubernetes versions, on a given Google Cloud location.", - "canonical": true, - "file": "attached_clusters.get_attached_server_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAttachedServerConfig", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.AttachedServerConfig", - "client": { - "shortName": "AttachedClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClustersClient" - }, - "method": { - "shortName": "GetAttachedServerConfig", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig", - "service": { - "shortName": "AttachedClusters", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AttachedClusters_GenerateAttachedClusterInstallManifest_async", - "title": "AttachedClusters generateAttachedClusterInstallManifest Sample", - "origin": "API_DEFINITION", - "description": " Generates the install manifest to be installed on the target cluster.", - "canonical": true, - "file": "attached_clusters.generate_attached_cluster_install_manifest.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 81, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateAttachedClusterInstallManifest", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.GenerateAttachedClusterInstallManifest", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "attached_cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "platform_version", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestResponse", - "client": { - "shortName": "AttachedClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClustersClient" - }, - "method": { - "shortName": "GenerateAttachedClusterInstallManifest", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters.GenerateAttachedClusterInstallManifest", - "service": { - "shortName": "AttachedClusters", - "fullName": "google.cloud.gkemulticloud.v1.AttachedClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AwsClusters_CreateAwsCluster_async", - "title": "AttachedClusters createAwsCluster Sample", - "origin": "API_DEFINITION", - "description": " Creates a new [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource on a given Google Cloud Platform project and region. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", - "canonical": true, - "file": "aws_clusters.create_aws_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateAwsCluster", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.CreateAwsCluster", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "aws_cluster", - "type": ".google.cloud.gkemulticloud.v1.AwsCluster" - }, - { - "name": "aws_cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AwsClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" - }, - "method": { - "shortName": "CreateAwsCluster", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.CreateAwsCluster", - "service": { - "shortName": "AwsClusters", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AwsClusters_UpdateAwsCluster_async", - "title": "AttachedClusters updateAwsCluster Sample", - "origin": "API_DEFINITION", - "description": " Updates an [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster].", - "canonical": true, - "file": "aws_clusters.update_aws_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 89, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAwsCluster", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.UpdateAwsCluster", - "async": true, - "parameters": [ - { - "name": "aws_cluster", - "type": ".google.cloud.gkemulticloud.v1.AwsCluster" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AwsClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" - }, - "method": { - "shortName": "UpdateAwsCluster", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.UpdateAwsCluster", - "service": { - "shortName": "AwsClusters", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AwsClusters_GetAwsCluster_async", - "title": "AttachedClusters getAwsCluster Sample", - "origin": "API_DEFINITION", - "description": " Describes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource.", - "canonical": true, - "file": "aws_clusters.get_aws_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAwsCluster", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.GetAwsCluster", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.AwsCluster", - "client": { - "shortName": "AwsClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" - }, - "method": { - "shortName": "GetAwsCluster", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.GetAwsCluster", - "service": { - "shortName": "AwsClusters", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AwsClusters_ListAwsClusters_async", - "title": "AttachedClusters listAwsClusters Sample", - "origin": "API_DEFINITION", - "description": " Lists all [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources on a given Google Cloud project and region.", - "canonical": true, - "file": "aws_clusters.list_aws_clusters.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAwsClusters", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.ListAwsClustersResponse", - "client": { - "shortName": "AwsClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" - }, - "method": { - "shortName": "ListAwsClusters", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters", - "service": { - "shortName": "AwsClusters", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AwsClusters_DeleteAwsCluster_async", - "title": "AttachedClusters deleteAwsCluster Sample", - "origin": "API_DEFINITION", - "description": " Deletes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource. Fails if the cluster has one or more associated [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", - "canonical": true, - "file": "aws_clusters.delete_aws_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAwsCluster", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.DeleteAwsCluster", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AwsClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" - }, - "method": { - "shortName": "DeleteAwsCluster", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.DeleteAwsCluster", - "service": { - "shortName": "AwsClusters", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AwsClusters_GenerateAwsAccessToken_async", - "title": "AttachedClusters generateAwsAccessToken Sample", - "origin": "API_DEFINITION", - "description": " Generates a short-lived access token to authenticate to a given [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource.", - "canonical": true, - "file": "aws_clusters.generate_aws_access_token.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateAwsAccessToken", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.GenerateAwsAccessToken", - "async": true, - "parameters": [ - { - "name": "aws_cluster", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenResponse", - "client": { - "shortName": "AwsClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" - }, - "method": { - "shortName": "GenerateAwsAccessToken", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.GenerateAwsAccessToken", - "service": { - "shortName": "AwsClusters", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AwsClusters_CreateAwsNodePool_async", - "title": "AttachedClusters createAwsNodePool Sample", - "origin": "API_DEFINITION", - "description": " Creates a new [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool], attached to a given [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", - "canonical": true, - "file": "aws_clusters.create_aws_node_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 81, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateAwsNodePool", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.CreateAwsNodePool", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "aws_node_pool", - "type": ".google.cloud.gkemulticloud.v1.AwsNodePool" - }, - { - "name": "aws_node_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AwsClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" - }, - "method": { - "shortName": "CreateAwsNodePool", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.CreateAwsNodePool", - "service": { - "shortName": "AwsClusters", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AwsClusters_UpdateAwsNodePool_async", - "title": "AttachedClusters updateAwsNodePool Sample", - "origin": "API_DEFINITION", - "description": " Updates an [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool].", - "canonical": true, - "file": "aws_clusters.update_aws_node_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 88, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAwsNodePool", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.UpdateAwsNodePool", - "async": true, - "parameters": [ - { - "name": "aws_node_pool", - "type": ".google.cloud.gkemulticloud.v1.AwsNodePool" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AwsClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" - }, - "method": { - "shortName": "UpdateAwsNodePool", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.UpdateAwsNodePool", - "service": { - "shortName": "AwsClusters", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AwsClusters_GetAwsNodePool_async", - "title": "AttachedClusters getAwsNodePool Sample", - "origin": "API_DEFINITION", - "description": " Describes a specific [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource.", - "canonical": true, - "file": "aws_clusters.get_aws_node_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAwsNodePool", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.GetAwsNodePool", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.AwsNodePool", - "client": { - "shortName": "AwsClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" - }, - "method": { - "shortName": "GetAwsNodePool", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.GetAwsNodePool", - "service": { - "shortName": "AwsClusters", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AwsClusters_ListAwsNodePools_async", - "title": "AttachedClusters listAwsNodePools Sample", - "origin": "API_DEFINITION", - "description": " Lists all [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources on a given [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster].", - "canonical": true, - "file": "aws_clusters.list_aws_node_pools.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAwsNodePools", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse", - "client": { - "shortName": "AwsClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" - }, - "method": { - "shortName": "ListAwsNodePools", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools", - "service": { - "shortName": "AwsClusters", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AwsClusters_DeleteAwsNodePool_async", - "title": "AttachedClusters deleteAwsNodePool Sample", - "origin": "API_DEFINITION", - "description": " Deletes a specific [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", - "canonical": true, - "file": "aws_clusters.delete_aws_node_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAwsNodePool", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.DeleteAwsNodePool", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AwsClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" - }, - "method": { - "shortName": "DeleteAwsNodePool", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.DeleteAwsNodePool", - "service": { - "shortName": "AwsClusters", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AwsClusters_GetAwsServerConfig_async", - "title": "AttachedClusters getAwsServerConfig Sample", - "origin": "API_DEFINITION", - "description": " Returns information, such as supported AWS regions and Kubernetes versions, on a given Google Cloud location.", - "canonical": true, - "file": "aws_clusters.get_aws_server_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAwsServerConfig", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.AwsServerConfig", - "client": { - "shortName": "AwsClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AwsClustersClient" - }, - "method": { - "shortName": "GetAwsServerConfig", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig", - "service": { - "shortName": "AwsClusters", - "fullName": "google.cloud.gkemulticloud.v1.AwsClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AzureClusters_CreateAzureClient_async", - "title": "AttachedClusters createAzureClient Sample", - "origin": "API_DEFINITION", - "description": " Creates a new [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource on a given Google Cloud project and region. `AzureClient` resources hold client authentication information needed by the Anthos Multicloud API to manage Azure resources on your Azure subscription on your behalf. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", - "canonical": true, - "file": "azure_clusters.create_azure_client.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateAzureClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.CreateAzureClient", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "azure_client", - "type": ".google.cloud.gkemulticloud.v1.AzureClient" - }, - { - "name": "azure_client_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AzureClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" - }, - "method": { - "shortName": "CreateAzureClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.CreateAzureClient", - "service": { - "shortName": "AzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AzureClusters_GetAzureClient_async", - "title": "AttachedClusters getAzureClient Sample", - "origin": "API_DEFINITION", - "description": " Describes a specific [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource.", - "canonical": true, - "file": "azure_clusters.get_azure_client.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAzureClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GetAzureClient", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.AzureClient", - "client": { - "shortName": "AzureClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" - }, - "method": { - "shortName": "GetAzureClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GetAzureClient", - "service": { - "shortName": "AzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AzureClusters_ListAzureClients_async", - "title": "AttachedClusters listAzureClients Sample", - "origin": "API_DEFINITION", - "description": " Lists all [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resources on a given Google Cloud project and region.", - "canonical": true, - "file": "azure_clusters.list_azure_clients.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAzureClients", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.ListAzureClientsResponse", - "client": { - "shortName": "AzureClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" - }, - "method": { - "shortName": "ListAzureClients", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients", - "service": { - "shortName": "AzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AzureClusters_DeleteAzureClient_async", - "title": "AttachedClusters deleteAzureClient Sample", - "origin": "API_DEFINITION", - "description": " Deletes a specific [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource. If the client is used by one or more clusters, deletion will fail and a `FAILED_PRECONDITION` error will be returned. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", - "canonical": true, - "file": "azure_clusters.delete_azure_client.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAzureClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.DeleteAzureClient", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AzureClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" - }, - "method": { - "shortName": "DeleteAzureClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.DeleteAzureClient", - "service": { - "shortName": "AzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AzureClusters_CreateAzureCluster_async", - "title": "AttachedClusters createAzureCluster Sample", - "origin": "API_DEFINITION", - "description": " Creates a new [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource on a given Google Cloud Platform project and region. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", - "canonical": true, - "file": "azure_clusters.create_azure_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateAzureCluster", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.CreateAzureCluster", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "azure_cluster", - "type": ".google.cloud.gkemulticloud.v1.AzureCluster" - }, - { - "name": "azure_cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AzureClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" - }, - "method": { - "shortName": "CreateAzureCluster", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.CreateAzureCluster", - "service": { - "shortName": "AzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AzureClusters_UpdateAzureCluster_async", - "title": "AttachedClusters updateAzureCluster Sample", - "origin": "API_DEFINITION", - "description": " Updates an [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster].", - "canonical": true, - "file": "azure_clusters.update_azure_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAzureCluster", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.UpdateAzureCluster", - "async": true, - "parameters": [ - { - "name": "azure_cluster", - "type": ".google.cloud.gkemulticloud.v1.AzureCluster" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AzureClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" - }, - "method": { - "shortName": "UpdateAzureCluster", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.UpdateAzureCluster", - "service": { - "shortName": "AzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AzureClusters_GetAzureCluster_async", - "title": "AttachedClusters getAzureCluster Sample", - "origin": "API_DEFINITION", - "description": " Describes a specific [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource.", - "canonical": true, - "file": "azure_clusters.get_azure_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAzureCluster", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GetAzureCluster", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.AzureCluster", - "client": { - "shortName": "AzureClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" - }, - "method": { - "shortName": "GetAzureCluster", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GetAzureCluster", - "service": { - "shortName": "AzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AzureClusters_ListAzureClusters_async", - "title": "AttachedClusters listAzureClusters Sample", - "origin": "API_DEFINITION", - "description": " Lists all [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resources on a given Google Cloud project and region.", - "canonical": true, - "file": "azure_clusters.list_azure_clusters.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.ListAzureClustersResponse", - "client": { - "shortName": "AzureClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" - }, - "method": { - "shortName": "ListAzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters", - "service": { - "shortName": "AzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AzureClusters_DeleteAzureCluster_async", - "title": "AttachedClusters deleteAzureCluster Sample", - "origin": "API_DEFINITION", - "description": " Deletes a specific [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. Fails if the cluster has one or more associated [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", - "canonical": true, - "file": "azure_clusters.delete_azure_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAzureCluster", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.DeleteAzureCluster", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AzureClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" - }, - "method": { - "shortName": "DeleteAzureCluster", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.DeleteAzureCluster", - "service": { - "shortName": "AzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AzureClusters_GenerateAzureAccessToken_async", - "title": "AttachedClusters generateAzureAccessToken Sample", - "origin": "API_DEFINITION", - "description": " Generates a short-lived access token to authenticate to a given [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource.", - "canonical": true, - "file": "azure_clusters.generate_azure_access_token.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateAzureAccessToken", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GenerateAzureAccessToken", - "async": true, - "parameters": [ - { - "name": "azure_cluster", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenResponse", - "client": { - "shortName": "AzureClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" - }, - "method": { - "shortName": "GenerateAzureAccessToken", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GenerateAzureAccessToken", - "service": { - "shortName": "AzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AzureClusters_CreateAzureNodePool_async", - "title": "AttachedClusters createAzureNodePool Sample", - "origin": "API_DEFINITION", - "description": " Creates a new [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool], attached to a given [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", - "canonical": true, - "file": "azure_clusters.create_azure_node_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateAzureNodePool", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.CreateAzureNodePool", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "azure_node_pool", - "type": ".google.cloud.gkemulticloud.v1.AzureNodePool" - }, - { - "name": "azure_node_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AzureClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" - }, - "method": { - "shortName": "CreateAzureNodePool", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.CreateAzureNodePool", - "service": { - "shortName": "AzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AzureClusters_UpdateAzureNodePool_async", - "title": "AttachedClusters updateAzureNodePool Sample", - "origin": "API_DEFINITION", - "description": " Updates an [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool].", - "canonical": true, - "file": "azure_clusters.update_azure_node_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAzureNodePool", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.UpdateAzureNodePool", - "async": true, - "parameters": [ - { - "name": "azure_node_pool", - "type": ".google.cloud.gkemulticloud.v1.AzureNodePool" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AzureClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" - }, - "method": { - "shortName": "UpdateAzureNodePool", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.UpdateAzureNodePool", - "service": { - "shortName": "AzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AzureClusters_GetAzureNodePool_async", - "title": "AttachedClusters getAzureNodePool Sample", - "origin": "API_DEFINITION", - "description": " Describes a specific [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource.", - "canonical": true, - "file": "azure_clusters.get_azure_node_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAzureNodePool", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GetAzureNodePool", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.AzureNodePool", - "client": { - "shortName": "AzureClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" - }, - "method": { - "shortName": "GetAzureNodePool", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GetAzureNodePool", - "service": { - "shortName": "AzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AzureClusters_ListAzureNodePools_async", - "title": "AttachedClusters listAzureNodePools Sample", - "origin": "API_DEFINITION", - "description": " Lists all [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources on a given [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster].", - "canonical": true, - "file": "azure_clusters.list_azure_node_pools.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAzureNodePools", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse", - "client": { - "shortName": "AzureClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" - }, - "method": { - "shortName": "ListAzureNodePools", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools", - "service": { - "shortName": "AzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AzureClusters_DeleteAzureNodePool_async", - "title": "AttachedClusters deleteAzureNodePool Sample", - "origin": "API_DEFINITION", - "description": " Deletes a specific [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource. If successful, the response contains a newly created [Operation][google.longrunning.Operation] resource that can be described to track the status of the operation.", - "canonical": true, - "file": "azure_clusters.delete_azure_node_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 81, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAzureNodePool", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.DeleteAzureNodePool", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AzureClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" - }, - "method": { - "shortName": "DeleteAzureNodePool", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.DeleteAzureNodePool", - "service": { - "shortName": "AzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" - } - } - } - }, - { - "regionTag": "gkemulticloud_v1_generated_AzureClusters_GetAzureServerConfig_async", - "title": "AttachedClusters getAzureServerConfig Sample", - "origin": "API_DEFINITION", - "description": " Returns information, such as supported Azure regions and Kubernetes versions, on a given Google Cloud location.", - "canonical": true, - "file": "azure_clusters.get_azure_server_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAzureServerConfig", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gkemulticloud.v1.AzureServerConfig", - "client": { - "shortName": "AzureClustersClient", - "fullName": "google.cloud.gkemulticloud.v1.AzureClustersClient" - }, - "method": { - "shortName": "GetAzureServerConfig", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig", - "service": { - "shortName": "AzureClusters", - "fullName": "google.cloud.gkemulticloud.v1.AzureClusters" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/index.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/index.ts deleted file mode 100644 index 157c1d271d5..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/index.ts +++ /dev/null @@ -1,29 +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 AttachedClustersClient = v1.AttachedClustersClient; -type AttachedClustersClient = v1.AttachedClustersClient; -const AwsClustersClient = v1.AwsClustersClient; -type AwsClustersClient = v1.AwsClustersClient; -const AzureClustersClient = v1.AzureClustersClient; -type AzureClustersClient = v1.AzureClustersClient; -export {v1, AttachedClustersClient, AwsClustersClient, AzureClustersClient}; -export default {v1, AttachedClustersClient, AwsClustersClient, AzureClustersClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_client.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_client.ts deleted file mode 100644 index e09c5bf05b3..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_client.ts +++ /dev/null @@ -1,2007 +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, GrpcClientOptions, LROperation, 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/attached_clusters_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './attached_clusters_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The AttachedClusters API provides a single centrally managed service - * to register and manage Anthos attached clusters that run on customer's owned - * infrastructure. - * @class - * @memberof v1 - */ -export class AttachedClustersClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - attachedClustersStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AttachedClustersClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 AttachedClustersClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AttachedClustersClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // 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 { - 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 = { - attachedClusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/attachedClusters/{attached_cluster}' - ), - attachedServerConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/attachedServerConfig' - ), - awsClusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/awsClusters/{aws_cluster}' - ), - awsNodePoolPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/awsClusters/{aws_cluster}/awsNodePools/{aws_node_pool}' - ), - awsServerConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/awsServerConfig' - ), - azureClientPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/azureClients/{azure_client}' - ), - azureClusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/azureClusters/{azure_cluster}' - ), - azureNodePoolPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/azureClusters/{azure_cluster}/azureNodePools/{azure_node_pool}' - ), - azureServerConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/azureServerConfig' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - }; - - // 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 = { - listAttachedClusters: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'attachedClusters') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createAttachedClusterResponse = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.AttachedCluster') as gax.protobuf.Type; - const createAttachedClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - const updateAttachedClusterResponse = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.AttachedCluster') as gax.protobuf.Type; - const updateAttachedClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - const importAttachedClusterResponse = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.AttachedCluster') as gax.protobuf.Type; - const importAttachedClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - const deleteAttachedClusterResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteAttachedClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createAttachedCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createAttachedClusterResponse.decode.bind(createAttachedClusterResponse), - createAttachedClusterMetadata.decode.bind(createAttachedClusterMetadata)), - updateAttachedCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateAttachedClusterResponse.decode.bind(updateAttachedClusterResponse), - updateAttachedClusterMetadata.decode.bind(updateAttachedClusterMetadata)), - importAttachedCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importAttachedClusterResponse.decode.bind(importAttachedClusterResponse), - importAttachedClusterMetadata.decode.bind(importAttachedClusterMetadata)), - deleteAttachedCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteAttachedClusterResponse.decode.bind(deleteAttachedClusterResponse), - deleteAttachedClusterMetadata.decode.bind(deleteAttachedClusterMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.gkemulticloud.v1.AttachedClusters', 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.attachedClustersStub) { - return this.attachedClustersStub; - } - - // Put together the "service stub" for - // google.cloud.gkemulticloud.v1.AttachedClusters. - this.attachedClustersStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.gkemulticloud.v1.AttachedClusters') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.gkemulticloud.v1.AttachedClusters, - 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 attachedClustersStubMethods = - ['createAttachedCluster', 'updateAttachedCluster', 'importAttachedCluster', 'getAttachedCluster', 'listAttachedClusters', 'deleteAttachedCluster', 'getAttachedServerConfig', 'generateAttachedClusterInstallManifest']; - for (const methodName of attachedClustersStubMethods) { - const callPromise = this.attachedClustersStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.attachedClustersStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'gkemulticloud.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 'gkemulticloud.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 -- - // ------------------- -/** - * Describes a specific - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource - * to describe. - * - * `AttachedCluster` names are formatted as - * `projects//locations//attachedClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/attached_clusters.get_attached_cluster.js - * region_tag:gkemulticloud_v1_generated_AttachedClusters_GetAttachedCluster_async - */ - getAttachedCluster( - request?: protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAttachedCluster, - protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest|undefined, {}|undefined - ]>; - getAttachedCluster( - request: protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAttachedCluster, - protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest|null|undefined, - {}|null|undefined>): void; - getAttachedCluster( - request: protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAttachedCluster, - protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest|null|undefined, - {}|null|undefined>): void; - getAttachedCluster( - request?: protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkemulticloud.v1.IAttachedCluster, - protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkemulticloud.v1.IAttachedCluster, - protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAttachedCluster, - protos.google.cloud.gkemulticloud.v1.IGetAttachedClusterRequest|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.getAttachedCluster(request, options, callback); - } -/** - * Returns information, such as supported Kubernetes versions, on a given - * Google Cloud location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the - * {@link protos.google.cloud.gkemulticloud.v1.AttachedServerConfig|AttachedServerConfig} - * resource to describe. - * - * `AttachedServerConfig` names are formatted as - * `projects//locations//attachedServerConfig`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AttachedServerConfig|AttachedServerConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/attached_clusters.get_attached_server_config.js - * region_tag:gkemulticloud_v1_generated_AttachedClusters_GetAttachedServerConfig_async - */ - getAttachedServerConfig( - request?: protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAttachedServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest|undefined, {}|undefined - ]>; - getAttachedServerConfig( - request: protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAttachedServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest|null|undefined, - {}|null|undefined>): void; - getAttachedServerConfig( - request: protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAttachedServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest|null|undefined, - {}|null|undefined>): void; - getAttachedServerConfig( - request?: protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkemulticloud.v1.IAttachedServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkemulticloud.v1.IAttachedServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAttachedServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAttachedServerConfigRequest|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.getAttachedServerConfig(request, options, callback); - } -/** - * Generates the install manifest to be installed on the target cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location where this - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource - * will be created. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {string} request.attachedClusterId - * Required. A client provided ID of the resource. Must be unique within the - * parent resource. - * - * The provided ID will be part of the - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource - * name formatted as - * `projects//locations//attachedClusters/`. - * - * Valid characters are `/{@link protos.0-9|a-z}-/`. Cannot be longer than 63 characters. - * - * When generating an install manifest for importing an existing Membership - * resource, the attached_cluster_id field must be the Membership id. - * - * Membership names are formatted as - * `projects//locations//memberships/`. - * @param {string} request.platformVersion - * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). - * - * You can list all supported versions on a given Google Cloud region by - * calling - * {@link protos.google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig|GetAttachedServerConfig}. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestResponse|GenerateAttachedClusterInstallManifestResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/attached_clusters.generate_attached_cluster_install_manifest.js - * region_tag:gkemulticloud_v1_generated_AttachedClusters_GenerateAttachedClusterInstallManifest_async - */ - generateAttachedClusterInstallManifest( - request?: protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest|undefined, {}|undefined - ]>; - generateAttachedClusterInstallManifest( - request: protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest|null|undefined, - {}|null|undefined>): void; - generateAttachedClusterInstallManifest( - request: protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest|null|undefined, - {}|null|undefined>): void; - generateAttachedClusterInstallManifest( - request?: protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestRequest|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.generateAttachedClusterInstallManifest(request, options, callback); - } - -/** - * Creates a new - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource - * on a given Google Cloud Platform project and region. - * - * If successful, the response contains a newly created - * {@link protos.google.longrunning.Operation|Operation} resource that can be - * described to track the status of the operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location where this - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource - * will be created. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {google.cloud.gkemulticloud.v1.AttachedCluster} request.attachedCluster - * Required. The specification of the - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} to create. - * @param {string} request.attachedClusterId - * Required. A client provided ID the resource. Must be unique within the - * parent resource. - * - * The provided ID will be part of the - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource - * name formatted as - * `projects//locations//attachedClusters/`. - * - * Valid characters are `/{@link protos.0-9|a-z}-/`. Cannot be longer than 63 characters. - * @param {boolean} request.validateOnly - * If set, only validate the request, but do not actually create the cluster. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/attached_clusters.create_attached_cluster.js - * region_tag:gkemulticloud_v1_generated_AttachedClusters_CreateAttachedCluster_async - */ - createAttachedCluster( - request?: protos.google.cloud.gkemulticloud.v1.ICreateAttachedClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createAttachedCluster( - request: protos.google.cloud.gkemulticloud.v1.ICreateAttachedClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAttachedCluster( - request: protos.google.cloud.gkemulticloud.v1.ICreateAttachedClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAttachedCluster( - request?: protos.google.cloud.gkemulticloud.v1.ICreateAttachedClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createAttachedCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createAttachedCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/attached_clusters.create_attached_cluster.js - * region_tag:gkemulticloud_v1_generated_AttachedClusters_CreateAttachedCluster_async - */ - async checkCreateAttachedClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAttachedCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster}. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.gkemulticloud.v1.AttachedCluster} request.attachedCluster - * Required. The - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource - * to update. - * @param {boolean} request.validateOnly - * If set, only validate the request, but do not actually update the cluster. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field can only include these - * fields from - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster}: - * - * * `description`. - * * `annotations`. - * * `platform_version`. - * * `authorization.admin_users`. - * * `logging_config.component_config.enable_components`. - * * `monitoring_config.managed_prometheus_config.enabled`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/attached_clusters.update_attached_cluster.js - * region_tag:gkemulticloud_v1_generated_AttachedClusters_UpdateAttachedCluster_async - */ - updateAttachedCluster( - request?: protos.google.cloud.gkemulticloud.v1.IUpdateAttachedClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateAttachedCluster( - request: protos.google.cloud.gkemulticloud.v1.IUpdateAttachedClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateAttachedCluster( - request: protos.google.cloud.gkemulticloud.v1.IUpdateAttachedClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateAttachedCluster( - request?: protos.google.cloud.gkemulticloud.v1.IUpdateAttachedClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'attached_cluster.name': request.attachedCluster!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateAttachedCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateAttachedCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/attached_clusters.update_attached_cluster.js - * region_tag:gkemulticloud_v1_generated_AttachedClusters_UpdateAttachedCluster_async - */ - async checkUpdateAttachedClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateAttachedCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Imports creates a new - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource - * by importing an existing Fleet Membership resource. - * - * Attached Clusters created before the introduction of the Anthos Multi-Cloud - * API can be imported through this method. - * - * If successful, the response contains a newly created - * {@link protos.google.longrunning.Operation|Operation} resource that can be - * described to track the status of the operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location where this - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource - * will be created. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {boolean} request.validateOnly - * If set, only validate the request, but do not actually import the cluster. - * @param {string} request.fleetMembership - * Required. The name of the fleet membership resource to import. - * @param {string} request.platformVersion - * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). - * - * You can list all supported versions on a given Google Cloud region by - * calling - * {@link protos.google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig|GetAttachedServerConfig}. - * @param {string} request.distribution - * Required. The Kubernetes distribution of the underlying attached cluster. - * - * Supported values: ["eks", "aks"]. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/attached_clusters.import_attached_cluster.js - * region_tag:gkemulticloud_v1_generated_AttachedClusters_ImportAttachedCluster_async - */ - importAttachedCluster( - request?: protos.google.cloud.gkemulticloud.v1.IImportAttachedClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importAttachedCluster( - request: protos.google.cloud.gkemulticloud.v1.IImportAttachedClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importAttachedCluster( - request: protos.google.cloud.gkemulticloud.v1.IImportAttachedClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importAttachedCluster( - request?: protos.google.cloud.gkemulticloud.v1.IImportAttachedClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.importAttachedCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `importAttachedCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/attached_clusters.import_attached_cluster.js - * region_tag:gkemulticloud_v1_generated_AttachedClusters_ImportAttachedCluster_async - */ - async checkImportAttachedClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importAttachedCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a specific - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource. - * - * If successful, the response contains a newly created - * {@link protos.google.longrunning.Operation|Operation} resource that can be - * described to track the status of the operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name the - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} to delete. - * - * `AttachedCluster` names are formatted as - * `projects//locations//attachedClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {boolean} request.validateOnly - * If set, only validate the request, but do not actually delete the resource. - * @param {boolean} request.allowMissing - * If set to true, and the - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource - * is not found, the request will succeed but no action will be taken on the - * server and a completed {@link protos.google.longrunning.Operation|Operation} will be - * returned. - * - * Useful for idempotent deletion. - * @param {boolean} request.ignoreErrors - * If set to true, the deletion of - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resource - * will succeed even if errors occur during deleting in cluster resources. - * Using this parameter may result in orphaned resources in the cluster. - * @param {string} request.etag - * The current etag of the - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster}. - * - * Allows clients to perform deletions through optimistic concurrency control. - * - * If the provided etag does not match the current etag of the cluster, - * the request will fail and an ABORTED error will be returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/attached_clusters.delete_attached_cluster.js - * region_tag:gkemulticloud_v1_generated_AttachedClusters_DeleteAttachedCluster_async - */ - deleteAttachedCluster( - request?: protos.google.cloud.gkemulticloud.v1.IDeleteAttachedClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteAttachedCluster( - request: protos.google.cloud.gkemulticloud.v1.IDeleteAttachedClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteAttachedCluster( - request: protos.google.cloud.gkemulticloud.v1.IDeleteAttachedClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteAttachedCluster( - request?: protos.google.cloud.gkemulticloud.v1.IDeleteAttachedClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteAttachedCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteAttachedCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/attached_clusters.delete_attached_cluster.js - * region_tag:gkemulticloud_v1_generated_AttachedClusters_DeleteAttachedCluster_async - */ - async checkDeleteAttachedClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAttachedCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} - * resources on a given Google Cloud project and region. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resources. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAttachedClustersResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters|attachedClusters.list} - * request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster}. - * 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 `listAttachedClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAttachedClusters( - request?: protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAttachedCluster[], - protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest|null, - protos.google.cloud.gkemulticloud.v1.IListAttachedClustersResponse - ]>; - listAttachedClusters( - request: protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, - protos.google.cloud.gkemulticloud.v1.IListAttachedClustersResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAttachedCluster>): void; - listAttachedClusters( - request: protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, - callback: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, - protos.google.cloud.gkemulticloud.v1.IListAttachedClustersResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAttachedCluster>): void; - listAttachedClusters( - request?: protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, - protos.google.cloud.gkemulticloud.v1.IListAttachedClustersResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAttachedCluster>, - callback?: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, - protos.google.cloud.gkemulticloud.v1.IListAttachedClustersResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAttachedCluster>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAttachedCluster[], - protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest|null, - protos.google.cloud.gkemulticloud.v1.IListAttachedClustersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listAttachedClusters(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resources. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAttachedClustersResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters|attachedClusters.list} - * request, if any. - * @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 protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} 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 `listAttachedClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAttachedClustersStream( - request?: protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, - 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['listAttachedClusters']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAttachedClusters.createStream( - this.innerApiCalls.listAttachedClusters as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAttachedClusters`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster} resources. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAttachedClustersResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters|attachedClusters.list} - * request, if any. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkemulticloud.v1.AttachedCluster|AttachedCluster}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/attached_clusters.list_attached_clusters.js - * region_tag:gkemulticloud_v1_generated_AttachedClusters_ListAttachedClusters_async - */ - listAttachedClustersAsync( - request?: protos.google.cloud.gkemulticloud.v1.IListAttachedClustersRequest, - 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['listAttachedClusters']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAttachedClusters.asyncIterate( - this.innerApiCalls['listAttachedClusters'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified attachedCluster resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} attached_cluster - * @returns {string} Resource name string. - */ - attachedClusterPath(project:string,location:string,attachedCluster:string) { - return this.pathTemplates.attachedClusterPathTemplate.render({ - project: project, - location: location, - attached_cluster: attachedCluster, - }); - } - - /** - * Parse the project from AttachedCluster resource. - * - * @param {string} attachedClusterName - * A fully-qualified path representing AttachedCluster resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttachedClusterName(attachedClusterName: string) { - return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).project; - } - - /** - * Parse the location from AttachedCluster resource. - * - * @param {string} attachedClusterName - * A fully-qualified path representing AttachedCluster resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttachedClusterName(attachedClusterName: string) { - return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).location; - } - - /** - * Parse the attached_cluster from AttachedCluster resource. - * - * @param {string} attachedClusterName - * A fully-qualified path representing AttachedCluster resource. - * @returns {string} A string representing the attached_cluster. - */ - matchAttachedClusterFromAttachedClusterName(attachedClusterName: string) { - return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).attached_cluster; - } - - /** - * Return a fully-qualified attachedServerConfig resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - attachedServerConfigPath(project:string,location:string) { - return this.pathTemplates.attachedServerConfigPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from AttachedServerConfig resource. - * - * @param {string} attachedServerConfigName - * A fully-qualified path representing AttachedServerConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttachedServerConfigName(attachedServerConfigName: string) { - return this.pathTemplates.attachedServerConfigPathTemplate.match(attachedServerConfigName).project; - } - - /** - * Parse the location from AttachedServerConfig resource. - * - * @param {string} attachedServerConfigName - * A fully-qualified path representing AttachedServerConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttachedServerConfigName(attachedServerConfigName: string) { - return this.pathTemplates.attachedServerConfigPathTemplate.match(attachedServerConfigName).location; - } - - /** - * Return a fully-qualified awsCluster resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} aws_cluster - * @returns {string} Resource name string. - */ - awsClusterPath(project:string,location:string,awsCluster:string) { - return this.pathTemplates.awsClusterPathTemplate.render({ - project: project, - location: location, - aws_cluster: awsCluster, - }); - } - - /** - * Parse the project from AwsCluster resource. - * - * @param {string} awsClusterName - * A fully-qualified path representing AwsCluster resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAwsClusterName(awsClusterName: string) { - return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).project; - } - - /** - * Parse the location from AwsCluster resource. - * - * @param {string} awsClusterName - * A fully-qualified path representing AwsCluster resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAwsClusterName(awsClusterName: string) { - return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).location; - } - - /** - * Parse the aws_cluster from AwsCluster resource. - * - * @param {string} awsClusterName - * A fully-qualified path representing AwsCluster resource. - * @returns {string} A string representing the aws_cluster. - */ - matchAwsClusterFromAwsClusterName(awsClusterName: string) { - return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).aws_cluster; - } - - /** - * Return a fully-qualified awsNodePool resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} aws_cluster - * @param {string} aws_node_pool - * @returns {string} Resource name string. - */ - awsNodePoolPath(project:string,location:string,awsCluster:string,awsNodePool:string) { - return this.pathTemplates.awsNodePoolPathTemplate.render({ - project: project, - location: location, - aws_cluster: awsCluster, - aws_node_pool: awsNodePool, - }); - } - - /** - * Parse the project from AwsNodePool resource. - * - * @param {string} awsNodePoolName - * A fully-qualified path representing AwsNodePool resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAwsNodePoolName(awsNodePoolName: string) { - return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).project; - } - - /** - * Parse the location from AwsNodePool resource. - * - * @param {string} awsNodePoolName - * A fully-qualified path representing AwsNodePool resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAwsNodePoolName(awsNodePoolName: string) { - return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).location; - } - - /** - * Parse the aws_cluster from AwsNodePool resource. - * - * @param {string} awsNodePoolName - * A fully-qualified path representing AwsNodePool resource. - * @returns {string} A string representing the aws_cluster. - */ - matchAwsClusterFromAwsNodePoolName(awsNodePoolName: string) { - return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).aws_cluster; - } - - /** - * Parse the aws_node_pool from AwsNodePool resource. - * - * @param {string} awsNodePoolName - * A fully-qualified path representing AwsNodePool resource. - * @returns {string} A string representing the aws_node_pool. - */ - matchAwsNodePoolFromAwsNodePoolName(awsNodePoolName: string) { - return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).aws_node_pool; - } - - /** - * Return a fully-qualified awsServerConfig resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - awsServerConfigPath(project:string,location:string) { - return this.pathTemplates.awsServerConfigPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from AwsServerConfig resource. - * - * @param {string} awsServerConfigName - * A fully-qualified path representing AwsServerConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAwsServerConfigName(awsServerConfigName: string) { - return this.pathTemplates.awsServerConfigPathTemplate.match(awsServerConfigName).project; - } - - /** - * Parse the location from AwsServerConfig resource. - * - * @param {string} awsServerConfigName - * A fully-qualified path representing AwsServerConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAwsServerConfigName(awsServerConfigName: string) { - return this.pathTemplates.awsServerConfigPathTemplate.match(awsServerConfigName).location; - } - - /** - * Return a fully-qualified azureClient resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} azure_client - * @returns {string} Resource name string. - */ - azureClientPath(project:string,location:string,azureClient:string) { - return this.pathTemplates.azureClientPathTemplate.render({ - project: project, - location: location, - azure_client: azureClient, - }); - } - - /** - * Parse the project from AzureClient resource. - * - * @param {string} azureClientName - * A fully-qualified path representing AzureClient resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAzureClientName(azureClientName: string) { - return this.pathTemplates.azureClientPathTemplate.match(azureClientName).project; - } - - /** - * Parse the location from AzureClient resource. - * - * @param {string} azureClientName - * A fully-qualified path representing AzureClient resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAzureClientName(azureClientName: string) { - return this.pathTemplates.azureClientPathTemplate.match(azureClientName).location; - } - - /** - * Parse the azure_client from AzureClient resource. - * - * @param {string} azureClientName - * A fully-qualified path representing AzureClient resource. - * @returns {string} A string representing the azure_client. - */ - matchAzureClientFromAzureClientName(azureClientName: string) { - return this.pathTemplates.azureClientPathTemplate.match(azureClientName).azure_client; - } - - /** - * Return a fully-qualified azureCluster resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} azure_cluster - * @returns {string} Resource name string. - */ - azureClusterPath(project:string,location:string,azureCluster:string) { - return this.pathTemplates.azureClusterPathTemplate.render({ - project: project, - location: location, - azure_cluster: azureCluster, - }); - } - - /** - * Parse the project from AzureCluster resource. - * - * @param {string} azureClusterName - * A fully-qualified path representing AzureCluster resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAzureClusterName(azureClusterName: string) { - return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).project; - } - - /** - * Parse the location from AzureCluster resource. - * - * @param {string} azureClusterName - * A fully-qualified path representing AzureCluster resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAzureClusterName(azureClusterName: string) { - return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).location; - } - - /** - * Parse the azure_cluster from AzureCluster resource. - * - * @param {string} azureClusterName - * A fully-qualified path representing AzureCluster resource. - * @returns {string} A string representing the azure_cluster. - */ - matchAzureClusterFromAzureClusterName(azureClusterName: string) { - return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).azure_cluster; - } - - /** - * Return a fully-qualified azureNodePool resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} azure_cluster - * @param {string} azure_node_pool - * @returns {string} Resource name string. - */ - azureNodePoolPath(project:string,location:string,azureCluster:string,azureNodePool:string) { - return this.pathTemplates.azureNodePoolPathTemplate.render({ - project: project, - location: location, - azure_cluster: azureCluster, - azure_node_pool: azureNodePool, - }); - } - - /** - * Parse the project from AzureNodePool resource. - * - * @param {string} azureNodePoolName - * A fully-qualified path representing AzureNodePool resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAzureNodePoolName(azureNodePoolName: string) { - return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).project; - } - - /** - * Parse the location from AzureNodePool resource. - * - * @param {string} azureNodePoolName - * A fully-qualified path representing AzureNodePool resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAzureNodePoolName(azureNodePoolName: string) { - return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).location; - } - - /** - * Parse the azure_cluster from AzureNodePool resource. - * - * @param {string} azureNodePoolName - * A fully-qualified path representing AzureNodePool resource. - * @returns {string} A string representing the azure_cluster. - */ - matchAzureClusterFromAzureNodePoolName(azureNodePoolName: string) { - return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).azure_cluster; - } - - /** - * Parse the azure_node_pool from AzureNodePool resource. - * - * @param {string} azureNodePoolName - * A fully-qualified path representing AzureNodePool resource. - * @returns {string} A string representing the azure_node_pool. - */ - matchAzureNodePoolFromAzureNodePoolName(azureNodePoolName: string) { - return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).azure_node_pool; - } - - /** - * Return a fully-qualified azureServerConfig resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - azureServerConfigPath(project:string,location:string) { - return this.pathTemplates.azureServerConfigPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from AzureServerConfig resource. - * - * @param {string} azureServerConfigName - * A fully-qualified path representing AzureServerConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAzureServerConfigName(azureServerConfigName: string) { - return this.pathTemplates.azureServerConfigPathTemplate.match(azureServerConfigName).project; - } - - /** - * Parse the location from AzureServerConfig resource. - * - * @param {string} azureServerConfigName - * A fully-qualified path representing AzureServerConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAzureServerConfigName(azureServerConfigName: string) { - return this.pathTemplates.azureServerConfigPathTemplate.match(azureServerConfigName).location; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified 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; - } - - /** - * 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.attachedClustersStub && !this._terminated) { - return this.attachedClustersStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_client_config.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_client_config.json deleted file mode 100644 index 476c8e0d695..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_client_config.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "interfaces": { - "google.cloud.gkemulticloud.v1.AttachedClusters": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateAttachedCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateAttachedCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ImportAttachedCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetAttachedCluster": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListAttachedClusters": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteAttachedCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetAttachedServerConfig": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GenerateAttachedClusterInstallManifest": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_proto_list.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_proto_list.json deleted file mode 100644 index 288ec0e3d51..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/attached_clusters_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/cloud/gkemulticloud/v1/attached_resources.proto", - "../../protos/google/cloud/gkemulticloud/v1/attached_service.proto", - "../../protos/google/cloud/gkemulticloud/v1/aws_resources.proto", - "../../protos/google/cloud/gkemulticloud/v1/aws_service.proto", - "../../protos/google/cloud/gkemulticloud/v1/azure_resources.proto", - "../../protos/google/cloud/gkemulticloud/v1/azure_service.proto", - "../../protos/google/cloud/gkemulticloud/v1/common_resources.proto" -] diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_client.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_client.ts deleted file mode 100644 index b768baab906..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_client.ts +++ /dev/null @@ -1,2546 +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, GrpcClientOptions, LROperation, 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/aws_clusters_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './aws_clusters_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The AwsClusters API provides a single centrally managed service - * to create and manage Anthos clusters that run on AWS infrastructure. - * @class - * @memberof v1 - */ -export class AwsClustersClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - awsClustersStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AwsClustersClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 AwsClustersClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AwsClustersClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // 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 { - 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 = { - attachedClusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/attachedClusters/{attached_cluster}' - ), - attachedServerConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/attachedServerConfig' - ), - awsClusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/awsClusters/{aws_cluster}' - ), - awsNodePoolPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/awsClusters/{aws_cluster}/awsNodePools/{aws_node_pool}' - ), - awsServerConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/awsServerConfig' - ), - azureClientPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/azureClients/{azure_client}' - ), - azureClusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/azureClusters/{azure_cluster}' - ), - azureNodePoolPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/azureClusters/{azure_cluster}/azureNodePools/{azure_node_pool}' - ), - azureServerConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/azureServerConfig' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - }; - - // 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 = { - listAwsClusters: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'awsClusters'), - listAwsNodePools: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'awsNodePools') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createAwsClusterResponse = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.AwsCluster') as gax.protobuf.Type; - const createAwsClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - const updateAwsClusterResponse = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.AwsCluster') as gax.protobuf.Type; - const updateAwsClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - const deleteAwsClusterResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteAwsClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - const createAwsNodePoolResponse = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.AwsNodePool') as gax.protobuf.Type; - const createAwsNodePoolMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - const updateAwsNodePoolResponse = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.AwsNodePool') as gax.protobuf.Type; - const updateAwsNodePoolMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - const deleteAwsNodePoolResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteAwsNodePoolMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createAwsCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createAwsClusterResponse.decode.bind(createAwsClusterResponse), - createAwsClusterMetadata.decode.bind(createAwsClusterMetadata)), - updateAwsCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateAwsClusterResponse.decode.bind(updateAwsClusterResponse), - updateAwsClusterMetadata.decode.bind(updateAwsClusterMetadata)), - deleteAwsCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteAwsClusterResponse.decode.bind(deleteAwsClusterResponse), - deleteAwsClusterMetadata.decode.bind(deleteAwsClusterMetadata)), - createAwsNodePool: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createAwsNodePoolResponse.decode.bind(createAwsNodePoolResponse), - createAwsNodePoolMetadata.decode.bind(createAwsNodePoolMetadata)), - updateAwsNodePool: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateAwsNodePoolResponse.decode.bind(updateAwsNodePoolResponse), - updateAwsNodePoolMetadata.decode.bind(updateAwsNodePoolMetadata)), - deleteAwsNodePool: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteAwsNodePoolResponse.decode.bind(deleteAwsNodePoolResponse), - deleteAwsNodePoolMetadata.decode.bind(deleteAwsNodePoolMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.gkemulticloud.v1.AwsClusters', 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.awsClustersStub) { - return this.awsClustersStub; - } - - // Put together the "service stub" for - // google.cloud.gkemulticloud.v1.AwsClusters. - this.awsClustersStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.gkemulticloud.v1.AwsClusters') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.gkemulticloud.v1.AwsClusters, - 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 awsClustersStubMethods = - ['createAwsCluster', 'updateAwsCluster', 'getAwsCluster', 'listAwsClusters', 'deleteAwsCluster', 'generateAwsAccessToken', 'createAwsNodePool', 'updateAwsNodePool', 'getAwsNodePool', 'listAwsNodePools', 'deleteAwsNodePool', 'getAwsServerConfig']; - for (const methodName of awsClustersStubMethods) { - const callPromise = this.awsClustersStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.awsClustersStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'gkemulticloud.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 'gkemulticloud.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 -- - // ------------------- -/** - * Describes a specific {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} - * resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the - * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resource to - * describe. - * - * `AwsCluster` names are formatted as - * `projects//locations//awsClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.get_aws_cluster.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_GetAwsCluster_async - */ - getAwsCluster( - request?: protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAwsCluster, - protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest|undefined, {}|undefined - ]>; - getAwsCluster( - request: protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAwsCluster, - protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest|null|undefined, - {}|null|undefined>): void; - getAwsCluster( - request: protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAwsCluster, - protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest|null|undefined, - {}|null|undefined>): void; - getAwsCluster( - request?: protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkemulticloud.v1.IAwsCluster, - protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkemulticloud.v1.IAwsCluster, - protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAwsCluster, - protos.google.cloud.gkemulticloud.v1.IGetAwsClusterRequest|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.getAwsCluster(request, options, callback); - } -/** - * Generates a short-lived access token to authenticate to a given - * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.awsCluster - * Required. The name of the - * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resource to - * authenticate to. - * - * `AwsCluster` names are formatted as - * `projects//locations//awsClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenResponse|GenerateAwsAccessTokenResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.generate_aws_access_token.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_GenerateAwsAccessToken_async - */ - generateAwsAccessToken( - request?: protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest|undefined, {}|undefined - ]>; - generateAwsAccessToken( - request: protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest|null|undefined, - {}|null|undefined>): void; - generateAwsAccessToken( - request: protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest|null|undefined, - {}|null|undefined>): void; - generateAwsAccessToken( - request?: protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenRequest|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({ - 'aws_cluster': request.awsCluster ?? '', - }); - this.initialize(); - return this.innerApiCalls.generateAwsAccessToken(request, options, callback); - } -/** - * Describes a specific - * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the - * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} resource to - * describe. - * - * `AwsNodePool` names are formatted as - * `projects//locations//awsClusters//awsNodePools/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.get_aws_node_pool.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_GetAwsNodePool_async - */ - getAwsNodePool( - request?: protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAwsNodePool, - protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest|undefined, {}|undefined - ]>; - getAwsNodePool( - request: protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAwsNodePool, - protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest|null|undefined, - {}|null|undefined>): void; - getAwsNodePool( - request: protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAwsNodePool, - protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest|null|undefined, - {}|null|undefined>): void; - getAwsNodePool( - request?: protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkemulticloud.v1.IAwsNodePool, - protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkemulticloud.v1.IAwsNodePool, - protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAwsNodePool, - protos.google.cloud.gkemulticloud.v1.IGetAwsNodePoolRequest|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.getAwsNodePool(request, options, callback); - } -/** - * Returns information, such as supported AWS regions and Kubernetes - * versions, on a given Google Cloud location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the - * {@link protos.google.cloud.gkemulticloud.v1.AwsServerConfig|AwsServerConfig} resource - * to describe. - * - * `AwsServerConfig` names are formatted as - * `projects//locations//awsServerConfig`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AwsServerConfig|AwsServerConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.get_aws_server_config.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_GetAwsServerConfig_async - */ - getAwsServerConfig( - request?: protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAwsServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest|undefined, {}|undefined - ]>; - getAwsServerConfig( - request: protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAwsServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest|null|undefined, - {}|null|undefined>): void; - getAwsServerConfig( - request: protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAwsServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest|null|undefined, - {}|null|undefined>): void; - getAwsServerConfig( - request?: protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkemulticloud.v1.IAwsServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkemulticloud.v1.IAwsServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAwsServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAwsServerConfigRequest|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.getAwsServerConfig(request, options, callback); - } - -/** - * Creates a new {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} - * resource on a given Google Cloud Platform project and region. - * - * If successful, the response contains a newly created - * {@link protos.google.longrunning.Operation|Operation} resource that can be - * described to track the status of the operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location where this - * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resource will be - * created. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {google.cloud.gkemulticloud.v1.AwsCluster} request.awsCluster - * Required. The specification of the - * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} to create. - * @param {string} request.awsClusterId - * Required. A client provided ID the resource. Must be unique within the - * parent resource. - * - * The provided ID will be part of the - * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resource name - * formatted as - * `projects//locations//awsClusters/`. - * - * Valid characters are `/{@link protos.0-9|a-z}-/`. Cannot be longer than 63 characters. - * @param {boolean} request.validateOnly - * If set, only validate the request, but do not actually create the cluster. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.create_aws_cluster.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_CreateAwsCluster_async - */ - createAwsCluster( - request?: protos.google.cloud.gkemulticloud.v1.ICreateAwsClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createAwsCluster( - request: protos.google.cloud.gkemulticloud.v1.ICreateAwsClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAwsCluster( - request: protos.google.cloud.gkemulticloud.v1.ICreateAwsClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAwsCluster( - request?: protos.google.cloud.gkemulticloud.v1.ICreateAwsClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createAwsCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createAwsCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.create_aws_cluster.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_CreateAwsCluster_async - */ - async checkCreateAwsClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAwsCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster}. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.gkemulticloud.v1.AwsCluster} request.awsCluster - * Required. The {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} - * resource to update. - * @param {boolean} request.validateOnly - * If set, only validate the request, but do not actually update the cluster. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field can only include these - * fields from {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster}: - * - * * `description`. - * * `annotations`. - * * `control_plane.version`. - * * `authorization.admin_users`. - * * `control_plane.aws_services_authentication.role_arn`. - * * `control_plane.aws_services_authentication.role_session_name`. - * * `control_plane.config_encryption.kms_key_arn`. - * * `control_plane.instance_type`. - * * `control_plane.security_group_ids`. - * * `control_plane.proxy_config`. - * * `control_plane.proxy_config.secret_arn`. - * * `control_plane.proxy_config.secret_version`. - * * `control_plane.root_volume.size_gib`. - * * `control_plane.root_volume.volume_type`. - * * `control_plane.root_volume.iops`. - * * `control_plane.root_volume.kms_key_arn`. - * * `control_plane.ssh_config`. - * * `control_plane.ssh_config.ec2_key_pair`. - * * `control_plane.instance_placement.tenancy`. - * * `control_plane.iam_instance_profile`. - * * `logging_config.component_config.enable_components`. - * * `control_plane.tags`. - * * `monitoring_config.managed_prometheus_config.enabled`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.update_aws_cluster.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_UpdateAwsCluster_async - */ - updateAwsCluster( - request?: protos.google.cloud.gkemulticloud.v1.IUpdateAwsClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateAwsCluster( - request: protos.google.cloud.gkemulticloud.v1.IUpdateAwsClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateAwsCluster( - request: protos.google.cloud.gkemulticloud.v1.IUpdateAwsClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateAwsCluster( - request?: protos.google.cloud.gkemulticloud.v1.IUpdateAwsClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'aws_cluster.name': request.awsCluster!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateAwsCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateAwsCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.update_aws_cluster.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_UpdateAwsCluster_async - */ - async checkUpdateAwsClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateAwsCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a specific {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} - * resource. - * - * Fails if the cluster has one or more associated - * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} resources. - * - * If successful, the response contains a newly created - * {@link protos.google.longrunning.Operation|Operation} resource that can be - * described to track the status of the operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name the - * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} to delete. - * - * `AwsCluster` names are formatted as - * `projects//locations//awsClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {boolean} request.validateOnly - * If set, only validate the request, but do not actually delete the resource. - * @param {boolean} request.allowMissing - * If set to true, and the - * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resource is not - * found, the request will succeed but no action will be taken on the server - * and a completed {@link protos.google.longrunning.Operation|Operation} will be returned. - * - * Useful for idempotent deletion. - * @param {string} request.etag - * The current etag of the - * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster}. - * - * Allows clients to perform deletions through optimistic concurrency control. - * - * If the provided etag does not match the current etag of the cluster, - * the request will fail and an ABORTED error will be returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.delete_aws_cluster.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_DeleteAwsCluster_async - */ - deleteAwsCluster( - request?: protos.google.cloud.gkemulticloud.v1.IDeleteAwsClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteAwsCluster( - request: protos.google.cloud.gkemulticloud.v1.IDeleteAwsClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteAwsCluster( - request: protos.google.cloud.gkemulticloud.v1.IDeleteAwsClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteAwsCluster( - request?: protos.google.cloud.gkemulticloud.v1.IDeleteAwsClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteAwsCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteAwsCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.delete_aws_cluster.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_DeleteAwsCluster_async - */ - async checkDeleteAwsClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAwsCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool}, - * attached to a given {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster}. - * - * If successful, the response contains a newly created - * {@link protos.google.longrunning.Operation|Operation} resource that can be - * described to track the status of the operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} - * resource where this node pool will be created. - * - * `AwsCluster` names are formatted as - * `projects//locations//awsClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {google.cloud.gkemulticloud.v1.AwsNodePool} request.awsNodePool - * Required. The specification of the - * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} to create. - * @param {string} request.awsNodePoolId - * Required. A client provided ID the resource. Must be unique within the - * parent resource. - * - * The provided ID will be part of the - * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} resource name - * formatted as - * `projects//locations//awsClusters//awsNodePools/`. - * - * Valid characters are `/{@link protos.0-9|a-z}-/`. Cannot be longer than 63 characters. - * @param {boolean} request.validateOnly - * If set, only validate the request, but do not actually create the node - * pool. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.create_aws_node_pool.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_CreateAwsNodePool_async - */ - createAwsNodePool( - request?: protos.google.cloud.gkemulticloud.v1.ICreateAwsNodePoolRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createAwsNodePool( - request: protos.google.cloud.gkemulticloud.v1.ICreateAwsNodePoolRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAwsNodePool( - request: protos.google.cloud.gkemulticloud.v1.ICreateAwsNodePoolRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAwsNodePool( - request?: protos.google.cloud.gkemulticloud.v1.ICreateAwsNodePoolRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createAwsNodePool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createAwsNodePool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.create_aws_node_pool.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_CreateAwsNodePool_async - */ - async checkCreateAwsNodePoolProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAwsNodePool, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool}. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.gkemulticloud.v1.AwsNodePool} request.awsNodePool - * Required. The {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} - * resource to update. - * @param {boolean} request.validateOnly - * If set, only validate the request, but don't actually update the node pool. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field can only include these - * fields from {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool}: - * - * * `annotations`. - * * `version`. - * * `autoscaling.min_node_count`. - * * `autoscaling.max_node_count`. - * * `config.config_encryption.kms_key_arn`. - * * `config.security_group_ids`. - * * `config.root_volume.iops`. - * * `config.root_volume.kms_key_arn`. - * * `config.root_volume.volume_type`. - * * `config.root_volume.size_gib`. - * * `config.proxy_config`. - * * `config.proxy_config.secret_arn`. - * * `config.proxy_config.secret_version`. - * * `config.ssh_config`. - * * `config.ssh_config.ec2_key_pair`. - * * `config.instance_placement.tenancy`. - * * `config.iam_instance_profile`. - * * `config.labels`. - * * `config.tags`. - * * `config.autoscaling_metrics_collection`. - * * `config.autoscaling_metrics_collection.granularity`. - * * `config.autoscaling_metrics_collection.metrics`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.update_aws_node_pool.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_UpdateAwsNodePool_async - */ - updateAwsNodePool( - request?: protos.google.cloud.gkemulticloud.v1.IUpdateAwsNodePoolRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateAwsNodePool( - request: protos.google.cloud.gkemulticloud.v1.IUpdateAwsNodePoolRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateAwsNodePool( - request: protos.google.cloud.gkemulticloud.v1.IUpdateAwsNodePoolRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateAwsNodePool( - request?: protos.google.cloud.gkemulticloud.v1.IUpdateAwsNodePoolRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'aws_node_pool.name': request.awsNodePool!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateAwsNodePool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateAwsNodePool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.update_aws_node_pool.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_UpdateAwsNodePool_async - */ - async checkUpdateAwsNodePoolProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateAwsNodePool, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a specific {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} - * resource. - * - * If successful, the response contains a newly created - * {@link protos.google.longrunning.Operation|Operation} resource that can be - * described to track the status of the operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name the - * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} to delete. - * - * `AwsNodePool` names are formatted as - * `projects//locations//awsClusters//awsNodePools/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {boolean} request.validateOnly - * If set, only validate the request, but do not actually delete the node - * pool. - * @param {boolean} request.allowMissing - * If set to true, and the - * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} resource is not - * found, the request will succeed but no action will be taken on the server - * and a completed {@link protos.google.longrunning.Operation|Operation} will be returned. - * - * Useful for idempotent deletion. - * @param {string} request.etag - * The current ETag of the - * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool}. - * - * Allows clients to perform deletions through optimistic concurrency control. - * - * If the provided ETag does not match the current etag of the node pool, - * the request will fail and an ABORTED error will be returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.delete_aws_node_pool.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_DeleteAwsNodePool_async - */ - deleteAwsNodePool( - request?: protos.google.cloud.gkemulticloud.v1.IDeleteAwsNodePoolRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteAwsNodePool( - request: protos.google.cloud.gkemulticloud.v1.IDeleteAwsNodePoolRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteAwsNodePool( - request: protos.google.cloud.gkemulticloud.v1.IDeleteAwsNodePoolRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteAwsNodePool( - request?: protos.google.cloud.gkemulticloud.v1.IDeleteAwsNodePoolRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteAwsNodePool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteAwsNodePool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.delete_aws_node_pool.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_DeleteAwsNodePool_async - */ - async checkDeleteAwsNodePoolProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAwsNodePool, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resources - * on a given Google Cloud project and region. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resources. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAwsClustersResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters|awsClusters.list} - * request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster}. - * 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 `listAwsClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAwsClusters( - request?: protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAwsCluster[], - protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest|null, - protos.google.cloud.gkemulticloud.v1.IListAwsClustersResponse - ]>; - listAwsClusters( - request: protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, - protos.google.cloud.gkemulticloud.v1.IListAwsClustersResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAwsCluster>): void; - listAwsClusters( - request: protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, - callback: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, - protos.google.cloud.gkemulticloud.v1.IListAwsClustersResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAwsCluster>): void; - listAwsClusters( - request?: protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, - protos.google.cloud.gkemulticloud.v1.IListAwsClustersResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAwsCluster>, - callback?: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, - protos.google.cloud.gkemulticloud.v1.IListAwsClustersResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAwsCluster>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAwsCluster[], - protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest|null, - protos.google.cloud.gkemulticloud.v1.IListAwsClustersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listAwsClusters(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resources. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAwsClustersResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters|awsClusters.list} - * request, if any. - * @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 protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} 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 `listAwsClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAwsClustersStream( - request?: protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, - 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['listAwsClusters']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAwsClusters.createStream( - this.innerApiCalls.listAwsClusters as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAwsClusters`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster} resources. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAwsClustersResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters|awsClusters.list} - * request, if any. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.list_aws_clusters.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_ListAwsClusters_async - */ - listAwsClustersAsync( - request?: protos.google.cloud.gkemulticloud.v1.IListAwsClustersRequest, - 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['listAwsClusters']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAwsClusters.asyncIterate( - this.innerApiCalls['listAwsClusters'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} - * resources on a given - * {@link protos.google.cloud.gkemulticloud.v1.AwsCluster|AwsCluster}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent `AwsCluster` which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} resources. - * - * `AwsCluster` names are formatted as - * `projects//locations//awsClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools|awsNodePools.list} - * request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool}. - * 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 `listAwsNodePoolsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAwsNodePools( - request?: protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAwsNodePool[], - protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest|null, - protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsResponse - ]>; - listAwsNodePools( - request: protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, - protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAwsNodePool>): void; - listAwsNodePools( - request: protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, - callback: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, - protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAwsNodePool>): void; - listAwsNodePools( - request?: protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, - protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAwsNodePool>, - callback?: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, - protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAwsNodePool>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAwsNodePool[], - protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest|null, - protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listAwsNodePools(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent `AwsCluster` which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} resources. - * - * `AwsCluster` names are formatted as - * `projects//locations//awsClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools|awsNodePools.list} - * request, if any. - * @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 protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} 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 `listAwsNodePoolsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAwsNodePoolsStream( - request?: protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, - 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['listAwsNodePools']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAwsNodePools.createStream( - this.innerApiCalls.listAwsNodePools as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAwsNodePools`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent `AwsCluster` which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool} resources. - * - * `AwsCluster` names are formatted as - * `projects//locations//awsClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools|awsNodePools.list} - * request, if any. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkemulticloud.v1.AwsNodePool|AwsNodePool}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/aws_clusters.list_aws_node_pools.js - * region_tag:gkemulticloud_v1_generated_AwsClusters_ListAwsNodePools_async - */ - listAwsNodePoolsAsync( - request?: protos.google.cloud.gkemulticloud.v1.IListAwsNodePoolsRequest, - 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['listAwsNodePools']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAwsNodePools.asyncIterate( - this.innerApiCalls['listAwsNodePools'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified attachedCluster resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} attached_cluster - * @returns {string} Resource name string. - */ - attachedClusterPath(project:string,location:string,attachedCluster:string) { - return this.pathTemplates.attachedClusterPathTemplate.render({ - project: project, - location: location, - attached_cluster: attachedCluster, - }); - } - - /** - * Parse the project from AttachedCluster resource. - * - * @param {string} attachedClusterName - * A fully-qualified path representing AttachedCluster resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttachedClusterName(attachedClusterName: string) { - return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).project; - } - - /** - * Parse the location from AttachedCluster resource. - * - * @param {string} attachedClusterName - * A fully-qualified path representing AttachedCluster resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttachedClusterName(attachedClusterName: string) { - return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).location; - } - - /** - * Parse the attached_cluster from AttachedCluster resource. - * - * @param {string} attachedClusterName - * A fully-qualified path representing AttachedCluster resource. - * @returns {string} A string representing the attached_cluster. - */ - matchAttachedClusterFromAttachedClusterName(attachedClusterName: string) { - return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).attached_cluster; - } - - /** - * Return a fully-qualified attachedServerConfig resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - attachedServerConfigPath(project:string,location:string) { - return this.pathTemplates.attachedServerConfigPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from AttachedServerConfig resource. - * - * @param {string} attachedServerConfigName - * A fully-qualified path representing AttachedServerConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttachedServerConfigName(attachedServerConfigName: string) { - return this.pathTemplates.attachedServerConfigPathTemplate.match(attachedServerConfigName).project; - } - - /** - * Parse the location from AttachedServerConfig resource. - * - * @param {string} attachedServerConfigName - * A fully-qualified path representing AttachedServerConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttachedServerConfigName(attachedServerConfigName: string) { - return this.pathTemplates.attachedServerConfigPathTemplate.match(attachedServerConfigName).location; - } - - /** - * Return a fully-qualified awsCluster resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} aws_cluster - * @returns {string} Resource name string. - */ - awsClusterPath(project:string,location:string,awsCluster:string) { - return this.pathTemplates.awsClusterPathTemplate.render({ - project: project, - location: location, - aws_cluster: awsCluster, - }); - } - - /** - * Parse the project from AwsCluster resource. - * - * @param {string} awsClusterName - * A fully-qualified path representing AwsCluster resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAwsClusterName(awsClusterName: string) { - return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).project; - } - - /** - * Parse the location from AwsCluster resource. - * - * @param {string} awsClusterName - * A fully-qualified path representing AwsCluster resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAwsClusterName(awsClusterName: string) { - return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).location; - } - - /** - * Parse the aws_cluster from AwsCluster resource. - * - * @param {string} awsClusterName - * A fully-qualified path representing AwsCluster resource. - * @returns {string} A string representing the aws_cluster. - */ - matchAwsClusterFromAwsClusterName(awsClusterName: string) { - return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).aws_cluster; - } - - /** - * Return a fully-qualified awsNodePool resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} aws_cluster - * @param {string} aws_node_pool - * @returns {string} Resource name string. - */ - awsNodePoolPath(project:string,location:string,awsCluster:string,awsNodePool:string) { - return this.pathTemplates.awsNodePoolPathTemplate.render({ - project: project, - location: location, - aws_cluster: awsCluster, - aws_node_pool: awsNodePool, - }); - } - - /** - * Parse the project from AwsNodePool resource. - * - * @param {string} awsNodePoolName - * A fully-qualified path representing AwsNodePool resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAwsNodePoolName(awsNodePoolName: string) { - return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).project; - } - - /** - * Parse the location from AwsNodePool resource. - * - * @param {string} awsNodePoolName - * A fully-qualified path representing AwsNodePool resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAwsNodePoolName(awsNodePoolName: string) { - return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).location; - } - - /** - * Parse the aws_cluster from AwsNodePool resource. - * - * @param {string} awsNodePoolName - * A fully-qualified path representing AwsNodePool resource. - * @returns {string} A string representing the aws_cluster. - */ - matchAwsClusterFromAwsNodePoolName(awsNodePoolName: string) { - return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).aws_cluster; - } - - /** - * Parse the aws_node_pool from AwsNodePool resource. - * - * @param {string} awsNodePoolName - * A fully-qualified path representing AwsNodePool resource. - * @returns {string} A string representing the aws_node_pool. - */ - matchAwsNodePoolFromAwsNodePoolName(awsNodePoolName: string) { - return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).aws_node_pool; - } - - /** - * Return a fully-qualified awsServerConfig resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - awsServerConfigPath(project:string,location:string) { - return this.pathTemplates.awsServerConfigPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from AwsServerConfig resource. - * - * @param {string} awsServerConfigName - * A fully-qualified path representing AwsServerConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAwsServerConfigName(awsServerConfigName: string) { - return this.pathTemplates.awsServerConfigPathTemplate.match(awsServerConfigName).project; - } - - /** - * Parse the location from AwsServerConfig resource. - * - * @param {string} awsServerConfigName - * A fully-qualified path representing AwsServerConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAwsServerConfigName(awsServerConfigName: string) { - return this.pathTemplates.awsServerConfigPathTemplate.match(awsServerConfigName).location; - } - - /** - * Return a fully-qualified azureClient resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} azure_client - * @returns {string} Resource name string. - */ - azureClientPath(project:string,location:string,azureClient:string) { - return this.pathTemplates.azureClientPathTemplate.render({ - project: project, - location: location, - azure_client: azureClient, - }); - } - - /** - * Parse the project from AzureClient resource. - * - * @param {string} azureClientName - * A fully-qualified path representing AzureClient resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAzureClientName(azureClientName: string) { - return this.pathTemplates.azureClientPathTemplate.match(azureClientName).project; - } - - /** - * Parse the location from AzureClient resource. - * - * @param {string} azureClientName - * A fully-qualified path representing AzureClient resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAzureClientName(azureClientName: string) { - return this.pathTemplates.azureClientPathTemplate.match(azureClientName).location; - } - - /** - * Parse the azure_client from AzureClient resource. - * - * @param {string} azureClientName - * A fully-qualified path representing AzureClient resource. - * @returns {string} A string representing the azure_client. - */ - matchAzureClientFromAzureClientName(azureClientName: string) { - return this.pathTemplates.azureClientPathTemplate.match(azureClientName).azure_client; - } - - /** - * Return a fully-qualified azureCluster resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} azure_cluster - * @returns {string} Resource name string. - */ - azureClusterPath(project:string,location:string,azureCluster:string) { - return this.pathTemplates.azureClusterPathTemplate.render({ - project: project, - location: location, - azure_cluster: azureCluster, - }); - } - - /** - * Parse the project from AzureCluster resource. - * - * @param {string} azureClusterName - * A fully-qualified path representing AzureCluster resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAzureClusterName(azureClusterName: string) { - return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).project; - } - - /** - * Parse the location from AzureCluster resource. - * - * @param {string} azureClusterName - * A fully-qualified path representing AzureCluster resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAzureClusterName(azureClusterName: string) { - return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).location; - } - - /** - * Parse the azure_cluster from AzureCluster resource. - * - * @param {string} azureClusterName - * A fully-qualified path representing AzureCluster resource. - * @returns {string} A string representing the azure_cluster. - */ - matchAzureClusterFromAzureClusterName(azureClusterName: string) { - return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).azure_cluster; - } - - /** - * Return a fully-qualified azureNodePool resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} azure_cluster - * @param {string} azure_node_pool - * @returns {string} Resource name string. - */ - azureNodePoolPath(project:string,location:string,azureCluster:string,azureNodePool:string) { - return this.pathTemplates.azureNodePoolPathTemplate.render({ - project: project, - location: location, - azure_cluster: azureCluster, - azure_node_pool: azureNodePool, - }); - } - - /** - * Parse the project from AzureNodePool resource. - * - * @param {string} azureNodePoolName - * A fully-qualified path representing AzureNodePool resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAzureNodePoolName(azureNodePoolName: string) { - return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).project; - } - - /** - * Parse the location from AzureNodePool resource. - * - * @param {string} azureNodePoolName - * A fully-qualified path representing AzureNodePool resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAzureNodePoolName(azureNodePoolName: string) { - return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).location; - } - - /** - * Parse the azure_cluster from AzureNodePool resource. - * - * @param {string} azureNodePoolName - * A fully-qualified path representing AzureNodePool resource. - * @returns {string} A string representing the azure_cluster. - */ - matchAzureClusterFromAzureNodePoolName(azureNodePoolName: string) { - return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).azure_cluster; - } - - /** - * Parse the azure_node_pool from AzureNodePool resource. - * - * @param {string} azureNodePoolName - * A fully-qualified path representing AzureNodePool resource. - * @returns {string} A string representing the azure_node_pool. - */ - matchAzureNodePoolFromAzureNodePoolName(azureNodePoolName: string) { - return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).azure_node_pool; - } - - /** - * Return a fully-qualified azureServerConfig resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - azureServerConfigPath(project:string,location:string) { - return this.pathTemplates.azureServerConfigPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from AzureServerConfig resource. - * - * @param {string} azureServerConfigName - * A fully-qualified path representing AzureServerConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAzureServerConfigName(azureServerConfigName: string) { - return this.pathTemplates.azureServerConfigPathTemplate.match(azureServerConfigName).project; - } - - /** - * Parse the location from AzureServerConfig resource. - * - * @param {string} azureServerConfigName - * A fully-qualified path representing AzureServerConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAzureServerConfigName(azureServerConfigName: string) { - return this.pathTemplates.azureServerConfigPathTemplate.match(azureServerConfigName).location; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified 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; - } - - /** - * 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.awsClustersStub && !this._terminated) { - return this.awsClustersStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_client_config.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_client_config.json deleted file mode 100644 index 714cb1ace74..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_client_config.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "interfaces": { - "google.cloud.gkemulticloud.v1.AwsClusters": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateAwsCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateAwsCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetAwsCluster": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListAwsClusters": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteAwsCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GenerateAwsAccessToken": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateAwsNodePool": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateAwsNodePool": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetAwsNodePool": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListAwsNodePools": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteAwsNodePool": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetAwsServerConfig": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_proto_list.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_proto_list.json deleted file mode 100644 index 288ec0e3d51..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/aws_clusters_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/cloud/gkemulticloud/v1/attached_resources.proto", - "../../protos/google/cloud/gkemulticloud/v1/attached_service.proto", - "../../protos/google/cloud/gkemulticloud/v1/aws_resources.proto", - "../../protos/google/cloud/gkemulticloud/v1/aws_service.proto", - "../../protos/google/cloud/gkemulticloud/v1/azure_resources.proto", - "../../protos/google/cloud/gkemulticloud/v1/azure_service.proto", - "../../protos/google/cloud/gkemulticloud/v1/common_resources.proto" -] diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_client.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_client.ts deleted file mode 100644 index 9491005ed10..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_client.ts +++ /dev/null @@ -1,3068 +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, GrpcClientOptions, LROperation, 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/azure_clusters_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './azure_clusters_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The AzureClusters API provides a single centrally managed service - * to create and manage Anthos clusters that run on Azure infrastructure. - * @class - * @memberof v1 - */ -export class AzureClustersClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - azureClustersStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AzureClustersClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 AzureClustersClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AzureClustersClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // 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 { - 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 = { - attachedClusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/attachedClusters/{attached_cluster}' - ), - attachedServerConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/attachedServerConfig' - ), - awsClusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/awsClusters/{aws_cluster}' - ), - awsNodePoolPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/awsClusters/{aws_cluster}/awsNodePools/{aws_node_pool}' - ), - awsServerConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/awsServerConfig' - ), - azureClientPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/azureClients/{azure_client}' - ), - azureClusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/azureClusters/{azure_cluster}' - ), - azureNodePoolPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/azureClusters/{azure_cluster}/azureNodePools/{azure_node_pool}' - ), - azureServerConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/azureServerConfig' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - }; - - // 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 = { - listAzureClients: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'azureClients'), - listAzureClusters: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'azureClusters'), - listAzureNodePools: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'azureNodePools') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createAzureClientResponse = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.AzureClient') as gax.protobuf.Type; - const createAzureClientMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - const deleteAzureClientResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteAzureClientMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - const createAzureClusterResponse = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.AzureCluster') as gax.protobuf.Type; - const createAzureClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - const updateAzureClusterResponse = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.AzureCluster') as gax.protobuf.Type; - const updateAzureClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - const deleteAzureClusterResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteAzureClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - const createAzureNodePoolResponse = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.AzureNodePool') as gax.protobuf.Type; - const createAzureNodePoolMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - const updateAzureNodePoolResponse = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.AzureNodePool') as gax.protobuf.Type; - const updateAzureNodePoolMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - const deleteAzureNodePoolResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteAzureNodePoolMetadata = protoFilesRoot.lookup( - '.google.cloud.gkemulticloud.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createAzureClient: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createAzureClientResponse.decode.bind(createAzureClientResponse), - createAzureClientMetadata.decode.bind(createAzureClientMetadata)), - deleteAzureClient: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteAzureClientResponse.decode.bind(deleteAzureClientResponse), - deleteAzureClientMetadata.decode.bind(deleteAzureClientMetadata)), - createAzureCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createAzureClusterResponse.decode.bind(createAzureClusterResponse), - createAzureClusterMetadata.decode.bind(createAzureClusterMetadata)), - updateAzureCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateAzureClusterResponse.decode.bind(updateAzureClusterResponse), - updateAzureClusterMetadata.decode.bind(updateAzureClusterMetadata)), - deleteAzureCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteAzureClusterResponse.decode.bind(deleteAzureClusterResponse), - deleteAzureClusterMetadata.decode.bind(deleteAzureClusterMetadata)), - createAzureNodePool: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createAzureNodePoolResponse.decode.bind(createAzureNodePoolResponse), - createAzureNodePoolMetadata.decode.bind(createAzureNodePoolMetadata)), - updateAzureNodePool: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateAzureNodePoolResponse.decode.bind(updateAzureNodePoolResponse), - updateAzureNodePoolMetadata.decode.bind(updateAzureNodePoolMetadata)), - deleteAzureNodePool: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteAzureNodePoolResponse.decode.bind(deleteAzureNodePoolResponse), - deleteAzureNodePoolMetadata.decode.bind(deleteAzureNodePoolMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.gkemulticloud.v1.AzureClusters', 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.azureClustersStub) { - return this.azureClustersStub; - } - - // Put together the "service stub" for - // google.cloud.gkemulticloud.v1.AzureClusters. - this.azureClustersStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.gkemulticloud.v1.AzureClusters') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.gkemulticloud.v1.AzureClusters, - 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 azureClustersStubMethods = - ['createAzureClient', 'getAzureClient', 'listAzureClients', 'deleteAzureClient', 'createAzureCluster', 'updateAzureCluster', 'getAzureCluster', 'listAzureClusters', 'deleteAzureCluster', 'generateAzureAccessToken', 'createAzureNodePool', 'updateAzureNodePool', 'getAzureNodePool', 'listAzureNodePools', 'deleteAzureNodePool', 'getAzureServerConfig']; - for (const methodName of azureClustersStubMethods) { - const callPromise = this.azureClustersStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.azureClustersStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'gkemulticloud.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 'gkemulticloud.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 -- - // ------------------- -/** - * Describes a specific - * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the - * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} resource to - * describe. - * - * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} names are - * formatted as - * `projects//locations//azureClients/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.get_azure_client.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_GetAzureClient_async - */ - getAzureClient( - request?: protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAzureClient, - protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest|undefined, {}|undefined - ]>; - getAzureClient( - request: protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAzureClient, - protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest|null|undefined, - {}|null|undefined>): void; - getAzureClient( - request: protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAzureClient, - protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest|null|undefined, - {}|null|undefined>): void; - getAzureClient( - request?: protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkemulticloud.v1.IAzureClient, - protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkemulticloud.v1.IAzureClient, - protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAzureClient, - protos.google.cloud.gkemulticloud.v1.IGetAzureClientRequest|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.getAzureClient(request, options, callback); - } -/** - * Describes a specific - * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the - * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resource to - * describe. - * - * `AzureCluster` names are formatted as - * `projects//locations//azureClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.get_azure_cluster.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_GetAzureCluster_async - */ - getAzureCluster( - request?: protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAzureCluster, - protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest|undefined, {}|undefined - ]>; - getAzureCluster( - request: protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAzureCluster, - protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest|null|undefined, - {}|null|undefined>): void; - getAzureCluster( - request: protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAzureCluster, - protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest|null|undefined, - {}|null|undefined>): void; - getAzureCluster( - request?: protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkemulticloud.v1.IAzureCluster, - protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkemulticloud.v1.IAzureCluster, - protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAzureCluster, - protos.google.cloud.gkemulticloud.v1.IGetAzureClusterRequest|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.getAzureCluster(request, options, callback); - } -/** - * Generates a short-lived access token to authenticate to a given - * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.azureCluster - * Required. The name of the - * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resource to - * authenticate to. - * - * `AzureCluster` names are formatted as - * `projects//locations//AzureClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenResponse|GenerateAzureAccessTokenResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.generate_azure_access_token.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_GenerateAzureAccessToken_async - */ - generateAzureAccessToken( - request?: protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest|undefined, {}|undefined - ]>; - generateAzureAccessToken( - request: protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest|null|undefined, - {}|null|undefined>): void; - generateAzureAccessToken( - request: protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest|null|undefined, - {}|null|undefined>): void; - generateAzureAccessToken( - request?: protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenResponse, - protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenRequest|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({ - 'azure_cluster': request.azureCluster ?? '', - }); - this.initialize(); - return this.innerApiCalls.generateAzureAccessToken(request, options, callback); - } -/** - * Describes a specific - * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the - * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resource to - * describe. - * - * `AzureNodePool` names are formatted as - * `projects//locations//azureClusters//azureNodePools/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.get_azure_node_pool.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_GetAzureNodePool_async - */ - getAzureNodePool( - request?: protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAzureNodePool, - protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest|undefined, {}|undefined - ]>; - getAzureNodePool( - request: protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAzureNodePool, - protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest|null|undefined, - {}|null|undefined>): void; - getAzureNodePool( - request: protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAzureNodePool, - protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest|null|undefined, - {}|null|undefined>): void; - getAzureNodePool( - request?: protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkemulticloud.v1.IAzureNodePool, - protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkemulticloud.v1.IAzureNodePool, - protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAzureNodePool, - protos.google.cloud.gkemulticloud.v1.IGetAzureNodePoolRequest|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.getAzureNodePool(request, options, callback); - } -/** - * Returns information, such as supported Azure regions and Kubernetes - * versions, on a given Google Cloud location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the - * {@link protos.google.cloud.gkemulticloud.v1.AzureServerConfig|AzureServerConfig} - * resource to describe. - * - * `AzureServerConfig` names are formatted as - * `projects//locations//azureServerConfig`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AzureServerConfig|AzureServerConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.get_azure_server_config.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_GetAzureServerConfig_async - */ - getAzureServerConfig( - request?: protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAzureServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest|undefined, {}|undefined - ]>; - getAzureServerConfig( - request: protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAzureServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest|null|undefined, - {}|null|undefined>): void; - getAzureServerConfig( - request: protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest, - callback: Callback< - protos.google.cloud.gkemulticloud.v1.IAzureServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest|null|undefined, - {}|null|undefined>): void; - getAzureServerConfig( - request?: protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gkemulticloud.v1.IAzureServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gkemulticloud.v1.IAzureServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAzureServerConfig, - protos.google.cloud.gkemulticloud.v1.IGetAzureServerConfigRequest|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.getAzureServerConfig(request, options, callback); - } - -/** - * Creates a new {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} - * resource on a given Google Cloud project and region. - * - * `AzureClient` resources hold client authentication - * information needed by the Anthos Multicloud API to manage Azure resources - * on your Azure subscription on your behalf. - * - * If successful, the response contains a newly created - * {@link protos.google.longrunning.Operation|Operation} resource that can be - * described to track the status of the operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location where this - * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} resource will be - * created. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {google.cloud.gkemulticloud.v1.AzureClient} request.azureClient - * Required. The specification of the - * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} to create. - * @param {string} request.azureClientId - * Required. A client provided ID the resource. Must be unique within the - * parent resource. - * - * The provided ID will be part of the - * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} resource name - * formatted as - * `projects//locations//azureClients/`. - * - * Valid characters are `/{@link protos.0-9|a-z}-/`. Cannot be longer than 63 characters. - * @param {boolean} request.validateOnly - * If set, only validate the request, but do not actually create the client. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.create_azure_client.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_CreateAzureClient_async - */ - createAzureClient( - request?: protos.google.cloud.gkemulticloud.v1.ICreateAzureClientRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createAzureClient( - request: protos.google.cloud.gkemulticloud.v1.ICreateAzureClientRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAzureClient( - request: protos.google.cloud.gkemulticloud.v1.ICreateAzureClientRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAzureClient( - request?: protos.google.cloud.gkemulticloud.v1.ICreateAzureClientRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createAzureClient(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createAzureClient()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.create_azure_client.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_CreateAzureClient_async - */ - async checkCreateAzureClientProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAzureClient, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a specific {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} - * resource. - * - * If the client is used by one or more clusters, deletion will - * fail and a `FAILED_PRECONDITION` error will be returned. - * - * If successful, the response contains a newly created - * {@link protos.google.longrunning.Operation|Operation} resource that can be - * described to track the status of the operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name the - * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} to delete. - * - * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} names are - * formatted as - * `projects//locations//azureClients/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {boolean} request.allowMissing - * If set to true, and the - * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} resource is not - * found, the request will succeed but no action will be taken on the server - * and a completed {@link protos.google.longrunning.Operation|Operation} will be returned. - * - * Useful for idempotent deletion. - * @param {boolean} request.validateOnly - * If set, only validate the request, but do not actually delete the 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.delete_azure_client.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_DeleteAzureClient_async - */ - deleteAzureClient( - request?: protos.google.cloud.gkemulticloud.v1.IDeleteAzureClientRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteAzureClient( - request: protos.google.cloud.gkemulticloud.v1.IDeleteAzureClientRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteAzureClient( - request: protos.google.cloud.gkemulticloud.v1.IDeleteAzureClientRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteAzureClient( - request?: protos.google.cloud.gkemulticloud.v1.IDeleteAzureClientRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteAzureClient(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteAzureClient()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.delete_azure_client.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_DeleteAzureClient_async - */ - async checkDeleteAzureClientProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAzureClient, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} - * resource on a given Google Cloud Platform project and region. - * - * If successful, the response contains a newly created - * {@link protos.google.longrunning.Operation|Operation} resource that can be - * described to track the status of the operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location where this - * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resource will be - * created. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {google.cloud.gkemulticloud.v1.AzureCluster} request.azureCluster - * Required. The specification of the - * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} to create. - * @param {string} request.azureClusterId - * Required. A client provided ID the resource. Must be unique within the - * parent resource. - * - * The provided ID will be part of the - * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resource name - * formatted as - * `projects//locations//azureClusters/`. - * - * Valid characters are `/{@link protos.0-9|a-z}-/`. Cannot be longer than 63 characters. - * @param {boolean} request.validateOnly - * If set, only validate the request, but do not actually create the cluster. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.create_azure_cluster.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_CreateAzureCluster_async - */ - createAzureCluster( - request?: protos.google.cloud.gkemulticloud.v1.ICreateAzureClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createAzureCluster( - request: protos.google.cloud.gkemulticloud.v1.ICreateAzureClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAzureCluster( - request: protos.google.cloud.gkemulticloud.v1.ICreateAzureClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAzureCluster( - request?: protos.google.cloud.gkemulticloud.v1.ICreateAzureClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createAzureCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createAzureCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.create_azure_cluster.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_CreateAzureCluster_async - */ - async checkCreateAzureClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAzureCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster}. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.gkemulticloud.v1.AzureCluster} request.azureCluster - * Required. The {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} - * resource to update. - * @param {boolean} request.validateOnly - * If set, only validate the request, but do not actually update the cluster. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field can only include these - * fields from {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster}: - * - * * `description`. - * * `azureClient`. - * * `control_plane.version`. - * * `control_plane.vm_size`. - * * `annotations`. - * * `authorization.admin_users`. - * * `control_plane.root_volume.size_gib`. - * * `azure_services_authentication`. - * * `azure_services_authentication.tenant_id`. - * * `azure_services_authentication.application_id`. - * * `control_plane.proxy_config`. - * * `control_plane.proxy_config.resource_group_id`. - * * `control_plane.proxy_config.secret_id`. - * * `control_plane.ssh_config.authorized_key`. - * * `logging_config.component_config.enable_components` - * * `monitoring_config.managed_prometheus_config.enabled`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.update_azure_cluster.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_UpdateAzureCluster_async - */ - updateAzureCluster( - request?: protos.google.cloud.gkemulticloud.v1.IUpdateAzureClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateAzureCluster( - request: protos.google.cloud.gkemulticloud.v1.IUpdateAzureClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateAzureCluster( - request: protos.google.cloud.gkemulticloud.v1.IUpdateAzureClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateAzureCluster( - request?: protos.google.cloud.gkemulticloud.v1.IUpdateAzureClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'azure_cluster.name': request.azureCluster!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateAzureCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateAzureCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.update_azure_cluster.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_UpdateAzureCluster_async - */ - async checkUpdateAzureClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateAzureCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a specific - * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resource. - * - * Fails if the cluster has one or more associated - * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resources. - * - * If successful, the response contains a newly created - * {@link protos.google.longrunning.Operation|Operation} resource that can be - * described to track the status of the operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name the - * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} to delete. - * - * `AzureCluster` names are formatted as - * `projects//locations//azureClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {boolean} request.allowMissing - * If set to true, and the - * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resource is not - * found, the request will succeed but no action will be taken on the server - * and a completed {@link protos.google.longrunning.Operation|Operation} will be returned. - * - * Useful for idempotent deletion. - * @param {boolean} request.validateOnly - * If set, only validate the request, but do not actually delete the resource. - * @param {string} request.etag - * The current etag of the - * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster}. - * - * Allows clients to perform deletions through optimistic concurrency control. - * - * If the provided etag does not match the current etag of the cluster, - * the request will fail and an ABORTED error will be returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.delete_azure_cluster.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_DeleteAzureCluster_async - */ - deleteAzureCluster( - request?: protos.google.cloud.gkemulticloud.v1.IDeleteAzureClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteAzureCluster( - request: protos.google.cloud.gkemulticloud.v1.IDeleteAzureClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteAzureCluster( - request: protos.google.cloud.gkemulticloud.v1.IDeleteAzureClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteAzureCluster( - request?: protos.google.cloud.gkemulticloud.v1.IDeleteAzureClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteAzureCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteAzureCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.delete_azure_cluster.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_DeleteAzureCluster_async - */ - async checkDeleteAzureClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAzureCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool}, - * attached to a given - * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster}. - * - * If successful, the response contains a newly created - * {@link protos.google.longrunning.Operation|Operation} resource that can be - * described to track the status of the operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} - * resource where this node pool will be created. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {google.cloud.gkemulticloud.v1.AzureNodePool} request.azureNodePool - * Required. The specification of the - * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} to create. - * @param {string} request.azureNodePoolId - * Required. A client provided ID the resource. Must be unique within the - * parent resource. - * - * The provided ID will be part of the - * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resource name - * formatted as - * `projects//locations//azureClusters//azureNodePools/`. - * - * Valid characters are `/{@link protos.0-9|a-z}-/`. Cannot be longer than 63 characters. - * @param {boolean} request.validateOnly - * If set, only validate the request, but do not actually create the node - * pool. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.create_azure_node_pool.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_CreateAzureNodePool_async - */ - createAzureNodePool( - request?: protos.google.cloud.gkemulticloud.v1.ICreateAzureNodePoolRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createAzureNodePool( - request: protos.google.cloud.gkemulticloud.v1.ICreateAzureNodePoolRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAzureNodePool( - request: protos.google.cloud.gkemulticloud.v1.ICreateAzureNodePoolRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAzureNodePool( - request?: protos.google.cloud.gkemulticloud.v1.ICreateAzureNodePoolRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createAzureNodePool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createAzureNodePool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.create_azure_node_pool.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_CreateAzureNodePool_async - */ - async checkCreateAzureNodePoolProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAzureNodePool, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool}. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.gkemulticloud.v1.AzureNodePool} request.azureNodePool - * Required. The {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} - * resource to update. - * @param {boolean} request.validateOnly - * If set, only validate the request, but don't actually update the node pool. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field can only include these - * fields from {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool}: - * - * *. `annotations`. - * * `version`. - * * `autoscaling.min_node_count`. - * * `autoscaling.max_node_count`. - * * `config.ssh_config.authorized_key`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.update_azure_node_pool.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_UpdateAzureNodePool_async - */ - updateAzureNodePool( - request?: protos.google.cloud.gkemulticloud.v1.IUpdateAzureNodePoolRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateAzureNodePool( - request: protos.google.cloud.gkemulticloud.v1.IUpdateAzureNodePoolRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateAzureNodePool( - request: protos.google.cloud.gkemulticloud.v1.IUpdateAzureNodePoolRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateAzureNodePool( - request?: protos.google.cloud.gkemulticloud.v1.IUpdateAzureNodePoolRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'azure_node_pool.name': request.azureNodePool!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateAzureNodePool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateAzureNodePool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.update_azure_node_pool.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_UpdateAzureNodePool_async - */ - async checkUpdateAzureNodePoolProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateAzureNodePool, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a specific - * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resource. - * - * If successful, the response contains a newly created - * {@link protos.google.longrunning.Operation|Operation} resource that can be - * described to track the status of the operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name the - * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} to delete. - * - * `AzureNodePool` names are formatted as - * `projects//locations//azureClusters//azureNodePools/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {boolean} request.validateOnly - * If set, only validate the request, but do not actually delete the node - * pool. - * @param {boolean} request.allowMissing - * If set to true, and the - * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resource is - * not found, the request will succeed but no action will be taken on the - * server and a completed {@link protos.google.longrunning.Operation|Operation} will be - * returned. - * - * Useful for idempotent deletion. - * @param {string} request.etag - * The current ETag of the - * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool}. - * - * Allows clients to perform deletions through optimistic concurrency control. - * - * If the provided ETag does not match the current etag of the node pool, - * the request will fail and an ABORTED error will be returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.delete_azure_node_pool.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_DeleteAzureNodePool_async - */ - deleteAzureNodePool( - request?: protos.google.cloud.gkemulticloud.v1.IDeleteAzureNodePoolRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteAzureNodePool( - request: protos.google.cloud.gkemulticloud.v1.IDeleteAzureNodePoolRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteAzureNodePool( - request: protos.google.cloud.gkemulticloud.v1.IDeleteAzureNodePoolRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteAzureNodePool( - request?: protos.google.cloud.gkemulticloud.v1.IDeleteAzureNodePoolRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteAzureNodePool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteAzureNodePool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.delete_azure_node_pool.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_DeleteAzureNodePool_async - */ - async checkDeleteAzureNodePoolProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAzureNodePool, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} - * resources on a given Google Cloud project and region. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} resources. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAzureClientsResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients|azureClients.list} - * request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient}. - * 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 `listAzureClientsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAzureClients( - request?: protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAzureClient[], - protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest|null, - protos.google.cloud.gkemulticloud.v1.IListAzureClientsResponse - ]>; - listAzureClients( - request: protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, - protos.google.cloud.gkemulticloud.v1.IListAzureClientsResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAzureClient>): void; - listAzureClients( - request: protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, - callback: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, - protos.google.cloud.gkemulticloud.v1.IListAzureClientsResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAzureClient>): void; - listAzureClients( - request?: protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, - protos.google.cloud.gkemulticloud.v1.IListAzureClientsResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAzureClient>, - callback?: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, - protos.google.cloud.gkemulticloud.v1.IListAzureClientsResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAzureClient>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAzureClient[], - protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest|null, - protos.google.cloud.gkemulticloud.v1.IListAzureClientsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listAzureClients(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} resources. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAzureClientsResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients|azureClients.list} - * request, if any. - * @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 protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} 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 `listAzureClientsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAzureClientsStream( - request?: protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, - 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['listAzureClients']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAzureClients.createStream( - this.innerApiCalls.listAzureClients as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAzureClients`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient} resources. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAzureClientsResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients|azureClients.list} - * request, if any. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkemulticloud.v1.AzureClient|AzureClient}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.list_azure_clients.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_ListAzureClients_async - */ - listAzureClientsAsync( - request?: protos.google.cloud.gkemulticloud.v1.IListAzureClientsRequest, - 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['listAzureClients']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAzureClients.asyncIterate( - this.innerApiCalls['listAzureClients'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} - * resources on a given Google Cloud project and region. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resources. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAzureClustersResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters|azureClusters.list} - * request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster}. - * 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 `listAzureClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAzureClusters( - request?: protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAzureCluster[], - protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest|null, - protos.google.cloud.gkemulticloud.v1.IListAzureClustersResponse - ]>; - listAzureClusters( - request: protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, - protos.google.cloud.gkemulticloud.v1.IListAzureClustersResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAzureCluster>): void; - listAzureClusters( - request: protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, - callback: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, - protos.google.cloud.gkemulticloud.v1.IListAzureClustersResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAzureCluster>): void; - listAzureClusters( - request?: protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, - protos.google.cloud.gkemulticloud.v1.IListAzureClustersResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAzureCluster>, - callback?: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, - protos.google.cloud.gkemulticloud.v1.IListAzureClustersResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAzureCluster>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAzureCluster[], - protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest|null, - protos.google.cloud.gkemulticloud.v1.IListAzureClustersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listAzureClusters(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resources. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAzureClustersResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters|azureClusters.list} - * request, if any. - * @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 protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} 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 `listAzureClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAzureClustersStream( - request?: protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, - 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['listAzureClusters']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAzureClusters.createStream( - this.innerApiCalls.listAzureClusters as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAzureClusters`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster} resources. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAzureClustersResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters|azureClusters.list} - * request, if any. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.list_azure_clusters.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_ListAzureClusters_async - */ - listAzureClustersAsync( - request?: protos.google.cloud.gkemulticloud.v1.IListAzureClustersRequest, - 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['listAzureClusters']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAzureClusters.asyncIterate( - this.innerApiCalls['listAzureClusters'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} - * resources on a given - * {@link protos.google.cloud.gkemulticloud.v1.AzureCluster|AzureCluster}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent `AzureCluster` which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resources. - * - * `AzureCluster` names are formatted as - * `projects//locations//azureClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools|azureNodePools.list} - * request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool}. - * 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 `listAzureNodePoolsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAzureNodePools( - request?: protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAzureNodePool[], - protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest|null, - protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsResponse - ]>; - listAzureNodePools( - request: protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, - protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAzureNodePool>): void; - listAzureNodePools( - request: protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, - callback: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, - protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAzureNodePool>): void; - listAzureNodePools( - request?: protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, - protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAzureNodePool>, - callback?: PaginationCallback< - protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, - protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsResponse|null|undefined, - protos.google.cloud.gkemulticloud.v1.IAzureNodePool>): - Promise<[ - protos.google.cloud.gkemulticloud.v1.IAzureNodePool[], - protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest|null, - protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listAzureNodePools(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent `AzureCluster` which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resources. - * - * `AzureCluster` names are formatted as - * `projects//locations//azureClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools|azureNodePools.list} - * request, if any. - * @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 protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} 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 `listAzureNodePoolsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAzureNodePoolsStream( - request?: protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, - 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['listAzureNodePools']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAzureNodePools.createStream( - this.innerApiCalls.listAzureNodePools as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAzureNodePools`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent `AzureCluster` which owns this collection of - * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool} resources. - * - * `AzureCluster` names are formatted as - * `projects//locations//azureClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 50 will be used by the service. - * Regardless of the pageSize value, the response can include a partial list - * and a caller should only rely on response's - * {@link protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse.next_page_token|nextPageToken} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `nextPageToken` value returned from a previous - * {@link protos.google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools|azureNodePools.list} - * request, if any. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gkemulticloud.v1.AzureNodePool|AzureNodePool}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/azure_clusters.list_azure_node_pools.js - * region_tag:gkemulticloud_v1_generated_AzureClusters_ListAzureNodePools_async - */ - listAzureNodePoolsAsync( - request?: protos.google.cloud.gkemulticloud.v1.IListAzureNodePoolsRequest, - 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['listAzureNodePools']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAzureNodePools.asyncIterate( - this.innerApiCalls['listAzureNodePools'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified attachedCluster resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} attached_cluster - * @returns {string} Resource name string. - */ - attachedClusterPath(project:string,location:string,attachedCluster:string) { - return this.pathTemplates.attachedClusterPathTemplate.render({ - project: project, - location: location, - attached_cluster: attachedCluster, - }); - } - - /** - * Parse the project from AttachedCluster resource. - * - * @param {string} attachedClusterName - * A fully-qualified path representing AttachedCluster resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttachedClusterName(attachedClusterName: string) { - return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).project; - } - - /** - * Parse the location from AttachedCluster resource. - * - * @param {string} attachedClusterName - * A fully-qualified path representing AttachedCluster resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttachedClusterName(attachedClusterName: string) { - return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).location; - } - - /** - * Parse the attached_cluster from AttachedCluster resource. - * - * @param {string} attachedClusterName - * A fully-qualified path representing AttachedCluster resource. - * @returns {string} A string representing the attached_cluster. - */ - matchAttachedClusterFromAttachedClusterName(attachedClusterName: string) { - return this.pathTemplates.attachedClusterPathTemplate.match(attachedClusterName).attached_cluster; - } - - /** - * Return a fully-qualified attachedServerConfig resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - attachedServerConfigPath(project:string,location:string) { - return this.pathTemplates.attachedServerConfigPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from AttachedServerConfig resource. - * - * @param {string} attachedServerConfigName - * A fully-qualified path representing AttachedServerConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttachedServerConfigName(attachedServerConfigName: string) { - return this.pathTemplates.attachedServerConfigPathTemplate.match(attachedServerConfigName).project; - } - - /** - * Parse the location from AttachedServerConfig resource. - * - * @param {string} attachedServerConfigName - * A fully-qualified path representing AttachedServerConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttachedServerConfigName(attachedServerConfigName: string) { - return this.pathTemplates.attachedServerConfigPathTemplate.match(attachedServerConfigName).location; - } - - /** - * Return a fully-qualified awsCluster resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} aws_cluster - * @returns {string} Resource name string. - */ - awsClusterPath(project:string,location:string,awsCluster:string) { - return this.pathTemplates.awsClusterPathTemplate.render({ - project: project, - location: location, - aws_cluster: awsCluster, - }); - } - - /** - * Parse the project from AwsCluster resource. - * - * @param {string} awsClusterName - * A fully-qualified path representing AwsCluster resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAwsClusterName(awsClusterName: string) { - return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).project; - } - - /** - * Parse the location from AwsCluster resource. - * - * @param {string} awsClusterName - * A fully-qualified path representing AwsCluster resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAwsClusterName(awsClusterName: string) { - return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).location; - } - - /** - * Parse the aws_cluster from AwsCluster resource. - * - * @param {string} awsClusterName - * A fully-qualified path representing AwsCluster resource. - * @returns {string} A string representing the aws_cluster. - */ - matchAwsClusterFromAwsClusterName(awsClusterName: string) { - return this.pathTemplates.awsClusterPathTemplate.match(awsClusterName).aws_cluster; - } - - /** - * Return a fully-qualified awsNodePool resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} aws_cluster - * @param {string} aws_node_pool - * @returns {string} Resource name string. - */ - awsNodePoolPath(project:string,location:string,awsCluster:string,awsNodePool:string) { - return this.pathTemplates.awsNodePoolPathTemplate.render({ - project: project, - location: location, - aws_cluster: awsCluster, - aws_node_pool: awsNodePool, - }); - } - - /** - * Parse the project from AwsNodePool resource. - * - * @param {string} awsNodePoolName - * A fully-qualified path representing AwsNodePool resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAwsNodePoolName(awsNodePoolName: string) { - return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).project; - } - - /** - * Parse the location from AwsNodePool resource. - * - * @param {string} awsNodePoolName - * A fully-qualified path representing AwsNodePool resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAwsNodePoolName(awsNodePoolName: string) { - return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).location; - } - - /** - * Parse the aws_cluster from AwsNodePool resource. - * - * @param {string} awsNodePoolName - * A fully-qualified path representing AwsNodePool resource. - * @returns {string} A string representing the aws_cluster. - */ - matchAwsClusterFromAwsNodePoolName(awsNodePoolName: string) { - return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).aws_cluster; - } - - /** - * Parse the aws_node_pool from AwsNodePool resource. - * - * @param {string} awsNodePoolName - * A fully-qualified path representing AwsNodePool resource. - * @returns {string} A string representing the aws_node_pool. - */ - matchAwsNodePoolFromAwsNodePoolName(awsNodePoolName: string) { - return this.pathTemplates.awsNodePoolPathTemplate.match(awsNodePoolName).aws_node_pool; - } - - /** - * Return a fully-qualified awsServerConfig resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - awsServerConfigPath(project:string,location:string) { - return this.pathTemplates.awsServerConfigPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from AwsServerConfig resource. - * - * @param {string} awsServerConfigName - * A fully-qualified path representing AwsServerConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAwsServerConfigName(awsServerConfigName: string) { - return this.pathTemplates.awsServerConfigPathTemplate.match(awsServerConfigName).project; - } - - /** - * Parse the location from AwsServerConfig resource. - * - * @param {string} awsServerConfigName - * A fully-qualified path representing AwsServerConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAwsServerConfigName(awsServerConfigName: string) { - return this.pathTemplates.awsServerConfigPathTemplate.match(awsServerConfigName).location; - } - - /** - * Return a fully-qualified azureClient resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} azure_client - * @returns {string} Resource name string. - */ - azureClientPath(project:string,location:string,azureClient:string) { - return this.pathTemplates.azureClientPathTemplate.render({ - project: project, - location: location, - azure_client: azureClient, - }); - } - - /** - * Parse the project from AzureClient resource. - * - * @param {string} azureClientName - * A fully-qualified path representing AzureClient resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAzureClientName(azureClientName: string) { - return this.pathTemplates.azureClientPathTemplate.match(azureClientName).project; - } - - /** - * Parse the location from AzureClient resource. - * - * @param {string} azureClientName - * A fully-qualified path representing AzureClient resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAzureClientName(azureClientName: string) { - return this.pathTemplates.azureClientPathTemplate.match(azureClientName).location; - } - - /** - * Parse the azure_client from AzureClient resource. - * - * @param {string} azureClientName - * A fully-qualified path representing AzureClient resource. - * @returns {string} A string representing the azure_client. - */ - matchAzureClientFromAzureClientName(azureClientName: string) { - return this.pathTemplates.azureClientPathTemplate.match(azureClientName).azure_client; - } - - /** - * Return a fully-qualified azureCluster resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} azure_cluster - * @returns {string} Resource name string. - */ - azureClusterPath(project:string,location:string,azureCluster:string) { - return this.pathTemplates.azureClusterPathTemplate.render({ - project: project, - location: location, - azure_cluster: azureCluster, - }); - } - - /** - * Parse the project from AzureCluster resource. - * - * @param {string} azureClusterName - * A fully-qualified path representing AzureCluster resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAzureClusterName(azureClusterName: string) { - return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).project; - } - - /** - * Parse the location from AzureCluster resource. - * - * @param {string} azureClusterName - * A fully-qualified path representing AzureCluster resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAzureClusterName(azureClusterName: string) { - return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).location; - } - - /** - * Parse the azure_cluster from AzureCluster resource. - * - * @param {string} azureClusterName - * A fully-qualified path representing AzureCluster resource. - * @returns {string} A string representing the azure_cluster. - */ - matchAzureClusterFromAzureClusterName(azureClusterName: string) { - return this.pathTemplates.azureClusterPathTemplate.match(azureClusterName).azure_cluster; - } - - /** - * Return a fully-qualified azureNodePool resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} azure_cluster - * @param {string} azure_node_pool - * @returns {string} Resource name string. - */ - azureNodePoolPath(project:string,location:string,azureCluster:string,azureNodePool:string) { - return this.pathTemplates.azureNodePoolPathTemplate.render({ - project: project, - location: location, - azure_cluster: azureCluster, - azure_node_pool: azureNodePool, - }); - } - - /** - * Parse the project from AzureNodePool resource. - * - * @param {string} azureNodePoolName - * A fully-qualified path representing AzureNodePool resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAzureNodePoolName(azureNodePoolName: string) { - return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).project; - } - - /** - * Parse the location from AzureNodePool resource. - * - * @param {string} azureNodePoolName - * A fully-qualified path representing AzureNodePool resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAzureNodePoolName(azureNodePoolName: string) { - return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).location; - } - - /** - * Parse the azure_cluster from AzureNodePool resource. - * - * @param {string} azureNodePoolName - * A fully-qualified path representing AzureNodePool resource. - * @returns {string} A string representing the azure_cluster. - */ - matchAzureClusterFromAzureNodePoolName(azureNodePoolName: string) { - return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).azure_cluster; - } - - /** - * Parse the azure_node_pool from AzureNodePool resource. - * - * @param {string} azureNodePoolName - * A fully-qualified path representing AzureNodePool resource. - * @returns {string} A string representing the azure_node_pool. - */ - matchAzureNodePoolFromAzureNodePoolName(azureNodePoolName: string) { - return this.pathTemplates.azureNodePoolPathTemplate.match(azureNodePoolName).azure_node_pool; - } - - /** - * Return a fully-qualified azureServerConfig resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - azureServerConfigPath(project:string,location:string) { - return this.pathTemplates.azureServerConfigPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from AzureServerConfig resource. - * - * @param {string} azureServerConfigName - * A fully-qualified path representing AzureServerConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAzureServerConfigName(azureServerConfigName: string) { - return this.pathTemplates.azureServerConfigPathTemplate.match(azureServerConfigName).project; - } - - /** - * Parse the location from AzureServerConfig resource. - * - * @param {string} azureServerConfigName - * A fully-qualified path representing AzureServerConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAzureServerConfigName(azureServerConfigName: string) { - return this.pathTemplates.azureServerConfigPathTemplate.match(azureServerConfigName).location; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified 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; - } - - /** - * 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.azureClustersStub && !this._terminated) { - return this.azureClustersStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_client_config.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_client_config.json deleted file mode 100644 index 7467958f0d9..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_client_config.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "interfaces": { - "google.cloud.gkemulticloud.v1.AzureClusters": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateAzureClient": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetAzureClient": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListAzureClients": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteAzureClient": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateAzureCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateAzureCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetAzureCluster": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListAzureClusters": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteAzureCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GenerateAzureAccessToken": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateAzureNodePool": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateAzureNodePool": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetAzureNodePool": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListAzureNodePools": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteAzureNodePool": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetAzureServerConfig": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_proto_list.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_proto_list.json deleted file mode 100644 index 288ec0e3d51..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/azure_clusters_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/cloud/gkemulticloud/v1/attached_resources.proto", - "../../protos/google/cloud/gkemulticloud/v1/attached_service.proto", - "../../protos/google/cloud/gkemulticloud/v1/aws_resources.proto", - "../../protos/google/cloud/gkemulticloud/v1/aws_service.proto", - "../../protos/google/cloud/gkemulticloud/v1/azure_resources.proto", - "../../protos/google/cloud/gkemulticloud/v1/azure_service.proto", - "../../protos/google/cloud/gkemulticloud/v1/common_resources.proto" -] diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 11d19e83fb6..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,435 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.gkemulticloud.v1", - "libraryPackage": "@google-cloud/gkemulticloud", - "services": { - "AttachedClusters": { - "clients": { - "grpc": { - "libraryClient": "AttachedClustersClient", - "rpcs": { - "GetAttachedCluster": { - "methods": [ - "getAttachedCluster" - ] - }, - "GetAttachedServerConfig": { - "methods": [ - "getAttachedServerConfig" - ] - }, - "GenerateAttachedClusterInstallManifest": { - "methods": [ - "generateAttachedClusterInstallManifest" - ] - }, - "CreateAttachedCluster": { - "methods": [ - "createAttachedCluster" - ] - }, - "UpdateAttachedCluster": { - "methods": [ - "updateAttachedCluster" - ] - }, - "ImportAttachedCluster": { - "methods": [ - "importAttachedCluster" - ] - }, - "DeleteAttachedCluster": { - "methods": [ - "deleteAttachedCluster" - ] - }, - "ListAttachedClusters": { - "methods": [ - "listAttachedClusters", - "listAttachedClustersStream", - "listAttachedClustersAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "AttachedClustersClient", - "rpcs": { - "GetAttachedCluster": { - "methods": [ - "getAttachedCluster" - ] - }, - "GetAttachedServerConfig": { - "methods": [ - "getAttachedServerConfig" - ] - }, - "GenerateAttachedClusterInstallManifest": { - "methods": [ - "generateAttachedClusterInstallManifest" - ] - }, - "CreateAttachedCluster": { - "methods": [ - "createAttachedCluster" - ] - }, - "UpdateAttachedCluster": { - "methods": [ - "updateAttachedCluster" - ] - }, - "ImportAttachedCluster": { - "methods": [ - "importAttachedCluster" - ] - }, - "DeleteAttachedCluster": { - "methods": [ - "deleteAttachedCluster" - ] - }, - "ListAttachedClusters": { - "methods": [ - "listAttachedClusters", - "listAttachedClustersStream", - "listAttachedClustersAsync" - ] - } - } - } - } - }, - "AwsClusters": { - "clients": { - "grpc": { - "libraryClient": "AwsClustersClient", - "rpcs": { - "GetAwsCluster": { - "methods": [ - "getAwsCluster" - ] - }, - "GenerateAwsAccessToken": { - "methods": [ - "generateAwsAccessToken" - ] - }, - "GetAwsNodePool": { - "methods": [ - "getAwsNodePool" - ] - }, - "GetAwsServerConfig": { - "methods": [ - "getAwsServerConfig" - ] - }, - "CreateAwsCluster": { - "methods": [ - "createAwsCluster" - ] - }, - "UpdateAwsCluster": { - "methods": [ - "updateAwsCluster" - ] - }, - "DeleteAwsCluster": { - "methods": [ - "deleteAwsCluster" - ] - }, - "CreateAwsNodePool": { - "methods": [ - "createAwsNodePool" - ] - }, - "UpdateAwsNodePool": { - "methods": [ - "updateAwsNodePool" - ] - }, - "DeleteAwsNodePool": { - "methods": [ - "deleteAwsNodePool" - ] - }, - "ListAwsClusters": { - "methods": [ - "listAwsClusters", - "listAwsClustersStream", - "listAwsClustersAsync" - ] - }, - "ListAwsNodePools": { - "methods": [ - "listAwsNodePools", - "listAwsNodePoolsStream", - "listAwsNodePoolsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "AwsClustersClient", - "rpcs": { - "GetAwsCluster": { - "methods": [ - "getAwsCluster" - ] - }, - "GenerateAwsAccessToken": { - "methods": [ - "generateAwsAccessToken" - ] - }, - "GetAwsNodePool": { - "methods": [ - "getAwsNodePool" - ] - }, - "GetAwsServerConfig": { - "methods": [ - "getAwsServerConfig" - ] - }, - "CreateAwsCluster": { - "methods": [ - "createAwsCluster" - ] - }, - "UpdateAwsCluster": { - "methods": [ - "updateAwsCluster" - ] - }, - "DeleteAwsCluster": { - "methods": [ - "deleteAwsCluster" - ] - }, - "CreateAwsNodePool": { - "methods": [ - "createAwsNodePool" - ] - }, - "UpdateAwsNodePool": { - "methods": [ - "updateAwsNodePool" - ] - }, - "DeleteAwsNodePool": { - "methods": [ - "deleteAwsNodePool" - ] - }, - "ListAwsClusters": { - "methods": [ - "listAwsClusters", - "listAwsClustersStream", - "listAwsClustersAsync" - ] - }, - "ListAwsNodePools": { - "methods": [ - "listAwsNodePools", - "listAwsNodePoolsStream", - "listAwsNodePoolsAsync" - ] - } - } - } - } - }, - "AzureClusters": { - "clients": { - "grpc": { - "libraryClient": "AzureClustersClient", - "rpcs": { - "GetAzureClient": { - "methods": [ - "getAzureClient" - ] - }, - "GetAzureCluster": { - "methods": [ - "getAzureCluster" - ] - }, - "GenerateAzureAccessToken": { - "methods": [ - "generateAzureAccessToken" - ] - }, - "GetAzureNodePool": { - "methods": [ - "getAzureNodePool" - ] - }, - "GetAzureServerConfig": { - "methods": [ - "getAzureServerConfig" - ] - }, - "CreateAzureClient": { - "methods": [ - "createAzureClient" - ] - }, - "DeleteAzureClient": { - "methods": [ - "deleteAzureClient" - ] - }, - "CreateAzureCluster": { - "methods": [ - "createAzureCluster" - ] - }, - "UpdateAzureCluster": { - "methods": [ - "updateAzureCluster" - ] - }, - "DeleteAzureCluster": { - "methods": [ - "deleteAzureCluster" - ] - }, - "CreateAzureNodePool": { - "methods": [ - "createAzureNodePool" - ] - }, - "UpdateAzureNodePool": { - "methods": [ - "updateAzureNodePool" - ] - }, - "DeleteAzureNodePool": { - "methods": [ - "deleteAzureNodePool" - ] - }, - "ListAzureClients": { - "methods": [ - "listAzureClients", - "listAzureClientsStream", - "listAzureClientsAsync" - ] - }, - "ListAzureClusters": { - "methods": [ - "listAzureClusters", - "listAzureClustersStream", - "listAzureClustersAsync" - ] - }, - "ListAzureNodePools": { - "methods": [ - "listAzureNodePools", - "listAzureNodePoolsStream", - "listAzureNodePoolsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "AzureClustersClient", - "rpcs": { - "GetAzureClient": { - "methods": [ - "getAzureClient" - ] - }, - "GetAzureCluster": { - "methods": [ - "getAzureCluster" - ] - }, - "GenerateAzureAccessToken": { - "methods": [ - "generateAzureAccessToken" - ] - }, - "GetAzureNodePool": { - "methods": [ - "getAzureNodePool" - ] - }, - "GetAzureServerConfig": { - "methods": [ - "getAzureServerConfig" - ] - }, - "CreateAzureClient": { - "methods": [ - "createAzureClient" - ] - }, - "DeleteAzureClient": { - "methods": [ - "deleteAzureClient" - ] - }, - "CreateAzureCluster": { - "methods": [ - "createAzureCluster" - ] - }, - "UpdateAzureCluster": { - "methods": [ - "updateAzureCluster" - ] - }, - "DeleteAzureCluster": { - "methods": [ - "deleteAzureCluster" - ] - }, - "CreateAzureNodePool": { - "methods": [ - "createAzureNodePool" - ] - }, - "UpdateAzureNodePool": { - "methods": [ - "updateAzureNodePool" - ] - }, - "DeleteAzureNodePool": { - "methods": [ - "deleteAzureNodePool" - ] - }, - "ListAzureClients": { - "methods": [ - "listAzureClients", - "listAzureClientsStream", - "listAzureClientsAsync" - ] - }, - "ListAzureClusters": { - "methods": [ - "listAzureClusters", - "listAzureClustersStream", - "listAzureClustersAsync" - ] - }, - "ListAzureNodePools": { - "methods": [ - "listAzureNodePools", - "listAzureNodePoolsStream", - "listAzureNodePoolsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/index.ts deleted file mode 100644 index 7d68ee2a9e2..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/src/v1/index.ts +++ /dev/null @@ -1,21 +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 {AttachedClustersClient} from './attached_clusters_client'; -export {AwsClustersClient} from './aws_clusters_client'; -export {AzureClustersClient} from './azure_clusters_client'; diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 479f9ed9f9a..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,29 +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 gkemulticloud = require('@google-cloud/gkemulticloud'); - -function main() { - const attachedClustersClient = new gkemulticloud.AttachedClustersClient(); - const awsClustersClient = new gkemulticloud.AwsClustersClient(); - const azureClustersClient = new gkemulticloud.AzureClustersClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index ff4612bf063..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,44 +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 {AttachedClustersClient, AwsClustersClient, AzureClustersClient} from '@google-cloud/gkemulticloud'; - -// check that the client class type name can be used -function doStuffWithAttachedClustersClient(client: AttachedClustersClient) { - client.close(); -} -function doStuffWithAwsClustersClient(client: AwsClustersClient) { - client.close(); -} -function doStuffWithAzureClustersClient(client: AzureClustersClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const attachedClustersClient = new AttachedClustersClient(); - doStuffWithAttachedClustersClient(attachedClustersClient); - // check that the client instance can be created - const awsClustersClient = new AwsClustersClient(); - doStuffWithAwsClustersClient(awsClustersClient); - // check that the client instance can be created - const azureClustersClient = new AzureClustersClient(); - doStuffWithAzureClustersClient(azureClustersClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/install.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/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-gkemulticloud/v1/test/gapic_attached_clusters_v1.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_attached_clusters_v1.ts deleted file mode 100644 index 5b47c9d22e9..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_attached_clusters_v1.ts +++ /dev/null @@ -1,2134 +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 attachedclustersModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.AttachedClustersClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = attachedclustersModule.v1.AttachedClustersClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = attachedclustersModule.v1.AttachedClustersClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = attachedclustersModule.v1.AttachedClustersClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new attachedclustersModule.v1.AttachedClustersClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.attachedClustersStub, undefined); - await client.initialize(); - assert(client.attachedClustersStub); - }); - - it('has close method for the initialized client', done => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.attachedClustersStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.attachedClustersStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new attachedclustersModule.v1.AttachedClustersClient({ - 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 attachedclustersModule.v1.AttachedClustersClient({ - 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('getAttachedCluster', () => { - it('invokes getAttachedCluster without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAttachedClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAttachedClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AttachedCluster() - ); - client.innerApiCalls.getAttachedCluster = stubSimpleCall(expectedResponse); - const [response] = await client.getAttachedCluster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAttachedCluster without error using callback', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAttachedClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAttachedClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AttachedCluster() - ); - client.innerApiCalls.getAttachedCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAttachedCluster( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAttachedCluster|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAttachedCluster with error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAttachedClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAttachedClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAttachedCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAttachedCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.getAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAttachedCluster with closed client', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAttachedClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAttachedClusterRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAttachedCluster(request), expectedError); - }); - }); - - describe('getAttachedServerConfig', () => { - it('invokes getAttachedServerConfig without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AttachedServerConfig() - ); - client.innerApiCalls.getAttachedServerConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getAttachedServerConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAttachedServerConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAttachedServerConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAttachedServerConfig without error using callback', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AttachedServerConfig() - ); - client.innerApiCalls.getAttachedServerConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAttachedServerConfig( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAttachedServerConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAttachedServerConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAttachedServerConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAttachedServerConfig with error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAttachedServerConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAttachedServerConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getAttachedServerConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAttachedServerConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAttachedServerConfig with closed client', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAttachedServerConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAttachedServerConfig(request), expectedError); - }); - }); - - describe('generateAttachedClusterInstallManifest', () => { - it('invokes generateAttachedClusterInstallManifest without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestResponse() - ); - client.innerApiCalls.generateAttachedClusterInstallManifest = stubSimpleCall(expectedResponse); - const [response] = await client.generateAttachedClusterInstallManifest(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateAttachedClusterInstallManifest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAttachedClusterInstallManifest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAttachedClusterInstallManifest without error using callback', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestResponse() - ); - client.innerApiCalls.generateAttachedClusterInstallManifest = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateAttachedClusterInstallManifest( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IGenerateAttachedClusterInstallManifestResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateAttachedClusterInstallManifest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAttachedClusterInstallManifest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAttachedClusterInstallManifest with error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateAttachedClusterInstallManifest = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateAttachedClusterInstallManifest(request), expectedError); - const actualRequest = (client.innerApiCalls.generateAttachedClusterInstallManifest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAttachedClusterInstallManifest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAttachedClusterInstallManifest with closed client', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAttachedClusterInstallManifestRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateAttachedClusterInstallManifest(request), expectedError); - }); - }); - - describe('createAttachedCluster', () => { - it('invokes createAttachedCluster without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAttachedCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.createAttachedCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAttachedCluster without error using callback', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAttachedCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAttachedCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAttachedCluster with call error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAttachedCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createAttachedCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.createAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAttachedCluster with LRO error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAttachedClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAttachedCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createAttachedCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateAttachedClusterProgress without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateAttachedClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateAttachedClusterProgress with error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateAttachedClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateAttachedCluster', () => { - it('invokes updateAttachedCluster without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest() - ); - request.attachedCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest', ['attachedCluster', 'name']); - request.attachedCluster.name = defaultValue1; - const expectedHeaderRequestParams = `attached_cluster.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAttachedCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateAttachedCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAttachedCluster without error using callback', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest() - ); - request.attachedCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest', ['attachedCluster', 'name']); - request.attachedCluster.name = defaultValue1; - const expectedHeaderRequestParams = `attached_cluster.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAttachedCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAttachedCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAttachedCluster with call error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest() - ); - request.attachedCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest', ['attachedCluster', 'name']); - request.attachedCluster.name = defaultValue1; - const expectedHeaderRequestParams = `attached_cluster.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAttachedCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateAttachedCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAttachedCluster with LRO error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest() - ); - request.attachedCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAttachedClusterRequest', ['attachedCluster', 'name']); - request.attachedCluster.name = defaultValue1; - const expectedHeaderRequestParams = `attached_cluster.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAttachedCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateAttachedCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateAttachedClusterProgress without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateAttachedClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateAttachedClusterProgress with error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateAttachedClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('importAttachedCluster', () => { - it('invokes importAttachedCluster without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importAttachedCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.importAttachedCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importAttachedCluster without error using callback', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importAttachedCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importAttachedCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importAttachedCluster with call error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importAttachedCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importAttachedCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.importAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importAttachedCluster with LRO error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ImportAttachedClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importAttachedCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importAttachedCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportAttachedClusterProgress without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportAttachedClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportAttachedClusterProgress with error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkImportAttachedClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteAttachedCluster', () => { - it('invokes deleteAttachedCluster without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAttachedCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteAttachedCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAttachedCluster without error using callback', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAttachedCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAttachedCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAttachedCluster with call error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAttachedCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteAttachedCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAttachedCluster with LRO error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAttachedClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAttachedCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteAttachedCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteAttachedCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAttachedCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteAttachedClusterProgress without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteAttachedClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteAttachedClusterProgress with error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteAttachedClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listAttachedClusters', () => { - it('invokes listAttachedClusters without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), - ]; - client.innerApiCalls.listAttachedClusters = stubSimpleCall(expectedResponse); - const [response] = await client.listAttachedClusters(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAttachedClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAttachedClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAttachedClusters without error using callback', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), - ]; - client.innerApiCalls.listAttachedClusters = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAttachedClusters( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAttachedCluster[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAttachedClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAttachedClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAttachedClusters with error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAttachedClusters = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAttachedClusters(request), expectedError); - const actualRequest = (client.innerApiCalls.listAttachedClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAttachedClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAttachedClustersStream without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), - ]; - client.descriptors.page.listAttachedClusters.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAttachedClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkemulticloud.v1.AttachedCluster[] = []; - stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AttachedCluster) => { - 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.listAttachedClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAttachedClusters, request)); - assert( - (client.descriptors.page.listAttachedClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAttachedClustersStream with error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAttachedClusters.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAttachedClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkemulticloud.v1.AttachedCluster[] = []; - stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AttachedCluster) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAttachedClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAttachedClusters, request)); - assert( - (client.descriptors.page.listAttachedClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAttachedClusters without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AttachedCluster()), - ]; - client.descriptors.page.listAttachedClusters.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkemulticloud.v1.IAttachedCluster[] = []; - const iterable = client.listAttachedClustersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAttachedClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAttachedClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAttachedClusters with error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAttachedClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAttachedClusters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAttachedClustersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkemulticloud.v1.IAttachedCluster[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAttachedClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAttachedClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('attachedCluster', () => { - const fakePath = "/rendered/path/attachedCluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - attached_cluster: "attachedClusterValue", - }; - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.attachedClusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attachedClusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attachedClusterPath', () => { - const result = client.attachedClusterPath("projectValue", "locationValue", "attachedClusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attachedClusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttachedClusterName', () => { - const result = client.matchProjectFromAttachedClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttachedClusterName', () => { - const result = client.matchLocationFromAttachedClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAttachedClusterFromAttachedClusterName', () => { - const result = client.matchAttachedClusterFromAttachedClusterName(fakePath); - assert.strictEqual(result, "attachedClusterValue"); - assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attachedServerConfig', () => { - const fakePath = "/rendered/path/attachedServerConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.attachedServerConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attachedServerConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attachedServerConfigPath', () => { - const result = client.attachedServerConfigPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attachedServerConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttachedServerConfigName', () => { - const result = client.matchProjectFromAttachedServerConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attachedServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttachedServerConfigName', () => { - const result = client.matchLocationFromAttachedServerConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attachedServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('awsCluster', () => { - const fakePath = "/rendered/path/awsCluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - aws_cluster: "awsClusterValue", - }; - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.awsClusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.awsClusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('awsClusterPath', () => { - const result = client.awsClusterPath("projectValue", "locationValue", "awsClusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.awsClusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAwsClusterName', () => { - const result = client.matchProjectFromAwsClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAwsClusterName', () => { - const result = client.matchLocationFromAwsClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAwsClusterFromAwsClusterName', () => { - const result = client.matchAwsClusterFromAwsClusterName(fakePath); - assert.strictEqual(result, "awsClusterValue"); - assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('awsNodePool', () => { - const fakePath = "/rendered/path/awsNodePool"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - aws_cluster: "awsClusterValue", - aws_node_pool: "awsNodePoolValue", - }; - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.awsNodePoolPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.awsNodePoolPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('awsNodePoolPath', () => { - const result = client.awsNodePoolPath("projectValue", "locationValue", "awsClusterValue", "awsNodePoolValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.awsNodePoolPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAwsNodePoolName', () => { - const result = client.matchProjectFromAwsNodePoolName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAwsNodePoolName', () => { - const result = client.matchLocationFromAwsNodePoolName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAwsClusterFromAwsNodePoolName', () => { - const result = client.matchAwsClusterFromAwsNodePoolName(fakePath); - assert.strictEqual(result, "awsClusterValue"); - assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAwsNodePoolFromAwsNodePoolName', () => { - const result = client.matchAwsNodePoolFromAwsNodePoolName(fakePath); - assert.strictEqual(result, "awsNodePoolValue"); - assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('awsServerConfig', () => { - const fakePath = "/rendered/path/awsServerConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.awsServerConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.awsServerConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('awsServerConfigPath', () => { - const result = client.awsServerConfigPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.awsServerConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAwsServerConfigName', () => { - const result = client.matchProjectFromAwsServerConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.awsServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAwsServerConfigName', () => { - const result = client.matchLocationFromAwsServerConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.awsServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('azureClient', () => { - const fakePath = "/rendered/path/azureClient"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - azure_client: "azureClientValue", - }; - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.azureClientPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.azureClientPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('azureClientPath', () => { - const result = client.azureClientPath("projectValue", "locationValue", "azureClientValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.azureClientPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAzureClientName', () => { - const result = client.matchProjectFromAzureClientName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAzureClientName', () => { - const result = client.matchLocationFromAzureClientName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAzureClientFromAzureClientName', () => { - const result = client.matchAzureClientFromAzureClientName(fakePath); - assert.strictEqual(result, "azureClientValue"); - assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('azureCluster', () => { - const fakePath = "/rendered/path/azureCluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - azure_cluster: "azureClusterValue", - }; - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.azureClusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.azureClusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('azureClusterPath', () => { - const result = client.azureClusterPath("projectValue", "locationValue", "azureClusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.azureClusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAzureClusterName', () => { - const result = client.matchProjectFromAzureClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAzureClusterName', () => { - const result = client.matchLocationFromAzureClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAzureClusterFromAzureClusterName', () => { - const result = client.matchAzureClusterFromAzureClusterName(fakePath); - assert.strictEqual(result, "azureClusterValue"); - assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('azureNodePool', () => { - const fakePath = "/rendered/path/azureNodePool"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - azure_cluster: "azureClusterValue", - azure_node_pool: "azureNodePoolValue", - }; - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.azureNodePoolPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.azureNodePoolPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('azureNodePoolPath', () => { - const result = client.azureNodePoolPath("projectValue", "locationValue", "azureClusterValue", "azureNodePoolValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.azureNodePoolPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAzureNodePoolName', () => { - const result = client.matchProjectFromAzureNodePoolName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAzureNodePoolName', () => { - const result = client.matchLocationFromAzureNodePoolName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAzureClusterFromAzureNodePoolName', () => { - const result = client.matchAzureClusterFromAzureNodePoolName(fakePath); - assert.strictEqual(result, "azureClusterValue"); - assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAzureNodePoolFromAzureNodePoolName', () => { - const result = client.matchAzureNodePoolFromAzureNodePoolName(fakePath); - assert.strictEqual(result, "azureNodePoolValue"); - assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('azureServerConfig', () => { - const fakePath = "/rendered/path/azureServerConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.azureServerConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.azureServerConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('azureServerConfigPath', () => { - const result = client.azureServerConfigPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.azureServerConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAzureServerConfigName', () => { - const result = client.matchProjectFromAzureServerConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.azureServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAzureServerConfigName', () => { - const result = client.matchLocationFromAzureServerConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.azureServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new attachedclustersModule.v1.AttachedClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new attachedclustersModule.v1.AttachedClustersClient({ - 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)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_aws_clusters_v1.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_aws_clusters_v1.ts deleted file mode 100644 index eb384142cbf..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_aws_clusters_v1.ts +++ /dev/null @@ -1,2799 +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 awsclustersModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.AwsClustersClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = awsclustersModule.v1.AwsClustersClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = awsclustersModule.v1.AwsClustersClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = awsclustersModule.v1.AwsClustersClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new awsclustersModule.v1.AwsClustersClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.awsClustersStub, undefined); - await client.initialize(); - assert(client.awsClustersStub); - }); - - it('has close method for the initialized client', done => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.awsClustersStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.awsClustersStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new awsclustersModule.v1.AwsClustersClient({ - 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 awsclustersModule.v1.AwsClustersClient({ - 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('getAwsCluster', () => { - it('invokes getAwsCluster without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAwsClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AwsCluster() - ); - client.innerApiCalls.getAwsCluster = stubSimpleCall(expectedResponse); - const [response] = await client.getAwsCluster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAwsCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAwsCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAwsCluster without error using callback', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAwsClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AwsCluster() - ); - client.innerApiCalls.getAwsCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAwsCluster( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAwsCluster|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAwsCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAwsCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAwsCluster with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAwsClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAwsCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAwsCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.getAwsCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAwsCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAwsCluster with closed client', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAwsClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsClusterRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAwsCluster(request), expectedError); - }); - }); - - describe('generateAwsAccessToken', () => { - it('invokes generateAwsAccessToken without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest', ['awsCluster']); - request.awsCluster = defaultValue1; - const expectedHeaderRequestParams = `aws_cluster=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenResponse() - ); - client.innerApiCalls.generateAwsAccessToken = stubSimpleCall(expectedResponse); - const [response] = await client.generateAwsAccessToken(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateAwsAccessToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAwsAccessToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAwsAccessToken without error using callback', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest', ['awsCluster']); - request.awsCluster = defaultValue1; - const expectedHeaderRequestParams = `aws_cluster=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenResponse() - ); - client.innerApiCalls.generateAwsAccessToken = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateAwsAccessToken( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IGenerateAwsAccessTokenResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateAwsAccessToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAwsAccessToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAwsAccessToken with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest', ['awsCluster']); - request.awsCluster = defaultValue1; - const expectedHeaderRequestParams = `aws_cluster=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateAwsAccessToken = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateAwsAccessToken(request), expectedError); - const actualRequest = (client.innerApiCalls.generateAwsAccessToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAwsAccessToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAwsAccessToken with closed client', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest', ['awsCluster']); - request.awsCluster = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateAwsAccessToken(request), expectedError); - }); - }); - - describe('getAwsNodePool', () => { - it('invokes getAwsNodePool without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AwsNodePool() - ); - client.innerApiCalls.getAwsNodePool = stubSimpleCall(expectedResponse); - const [response] = await client.getAwsNodePool(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAwsNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAwsNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAwsNodePool without error using callback', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AwsNodePool() - ); - client.innerApiCalls.getAwsNodePool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAwsNodePool( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAwsNodePool|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAwsNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAwsNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAwsNodePool with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAwsNodePool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAwsNodePool(request), expectedError); - const actualRequest = (client.innerApiCalls.getAwsNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAwsNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAwsNodePool with closed client', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAwsNodePool(request), expectedError); - }); - }); - - describe('getAwsServerConfig', () => { - it('invokes getAwsServerConfig without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AwsServerConfig() - ); - client.innerApiCalls.getAwsServerConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getAwsServerConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAwsServerConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAwsServerConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAwsServerConfig without error using callback', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AwsServerConfig() - ); - client.innerApiCalls.getAwsServerConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAwsServerConfig( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAwsServerConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAwsServerConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAwsServerConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAwsServerConfig with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAwsServerConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAwsServerConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getAwsServerConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAwsServerConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAwsServerConfig with closed client', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAwsServerConfig(request), expectedError); - }); - }); - - describe('createAwsCluster', () => { - it('invokes createAwsCluster without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAwsCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.createAwsCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAwsCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAwsCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAwsCluster without error using callback', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAwsCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAwsCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAwsCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAwsCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAwsCluster with call error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAwsCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createAwsCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.createAwsCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAwsCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAwsCluster with LRO error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAwsCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createAwsCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createAwsCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAwsCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateAwsClusterProgress without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateAwsClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateAwsClusterProgress with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateAwsClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateAwsCluster', () => { - it('invokes updateAwsCluster without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest() - ); - request.awsCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest', ['awsCluster', 'name']); - request.awsCluster.name = defaultValue1; - const expectedHeaderRequestParams = `aws_cluster.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAwsCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateAwsCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAwsCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAwsCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAwsCluster without error using callback', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest() - ); - request.awsCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest', ['awsCluster', 'name']); - request.awsCluster.name = defaultValue1; - const expectedHeaderRequestParams = `aws_cluster.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAwsCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAwsCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAwsCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAwsCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAwsCluster with call error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest() - ); - request.awsCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest', ['awsCluster', 'name']); - request.awsCluster.name = defaultValue1; - const expectedHeaderRequestParams = `aws_cluster.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAwsCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateAwsCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAwsCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAwsCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAwsCluster with LRO error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest() - ); - request.awsCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest', ['awsCluster', 'name']); - request.awsCluster.name = defaultValue1; - const expectedHeaderRequestParams = `aws_cluster.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAwsCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateAwsCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateAwsCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAwsCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateAwsClusterProgress without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateAwsClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateAwsClusterProgress with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateAwsClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteAwsCluster', () => { - it('invokes deleteAwsCluster without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAwsCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteAwsCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAwsCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAwsCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAwsCluster without error using callback', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAwsCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAwsCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAwsCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAwsCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAwsCluster with call error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAwsCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteAwsCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAwsCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAwsCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAwsCluster with LRO error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAwsCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteAwsCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteAwsCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAwsCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteAwsClusterProgress without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteAwsClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteAwsClusterProgress with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteAwsClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createAwsNodePool', () => { - it('invokes createAwsNodePool without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAwsNodePool = stubLongRunningCall(expectedResponse); - const [operation] = await client.createAwsNodePool(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAwsNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAwsNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAwsNodePool without error using callback', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAwsNodePool = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAwsNodePool( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAwsNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAwsNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAwsNodePool with call error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAwsNodePool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createAwsNodePool(request), expectedError); - const actualRequest = (client.innerApiCalls.createAwsNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAwsNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAwsNodePool with LRO error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAwsNodePool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createAwsNodePool(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createAwsNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAwsNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateAwsNodePoolProgress without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateAwsNodePoolProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateAwsNodePoolProgress with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateAwsNodePoolProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateAwsNodePool', () => { - it('invokes updateAwsNodePool without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest() - ); - request.awsNodePool ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest', ['awsNodePool', 'name']); - request.awsNodePool.name = defaultValue1; - const expectedHeaderRequestParams = `aws_node_pool.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAwsNodePool = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateAwsNodePool(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAwsNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAwsNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAwsNodePool without error using callback', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest() - ); - request.awsNodePool ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest', ['awsNodePool', 'name']); - request.awsNodePool.name = defaultValue1; - const expectedHeaderRequestParams = `aws_node_pool.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAwsNodePool = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAwsNodePool( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAwsNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAwsNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAwsNodePool with call error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest() - ); - request.awsNodePool ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest', ['awsNodePool', 'name']); - request.awsNodePool.name = defaultValue1; - const expectedHeaderRequestParams = `aws_node_pool.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAwsNodePool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateAwsNodePool(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAwsNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAwsNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAwsNodePool with LRO error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest() - ); - request.awsNodePool ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest', ['awsNodePool', 'name']); - request.awsNodePool.name = defaultValue1; - const expectedHeaderRequestParams = `aws_node_pool.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAwsNodePool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateAwsNodePool(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateAwsNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAwsNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateAwsNodePoolProgress without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateAwsNodePoolProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateAwsNodePoolProgress with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateAwsNodePoolProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteAwsNodePool', () => { - it('invokes deleteAwsNodePool without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAwsNodePool = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteAwsNodePool(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAwsNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAwsNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAwsNodePool without error using callback', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAwsNodePool = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAwsNodePool( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAwsNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAwsNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAwsNodePool with call error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAwsNodePool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteAwsNodePool(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAwsNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAwsNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAwsNodePool with LRO error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAwsNodePool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteAwsNodePool(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteAwsNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAwsNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteAwsNodePoolProgress without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteAwsNodePoolProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteAwsNodePoolProgress with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteAwsNodePoolProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listAwsClusters', () => { - it('invokes listAwsClusters without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAwsClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), - ]; - client.innerApiCalls.listAwsClusters = stubSimpleCall(expectedResponse); - const [response] = await client.listAwsClusters(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAwsClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAwsClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAwsClusters without error using callback', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAwsClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), - ]; - client.innerApiCalls.listAwsClusters = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAwsClusters( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAwsCluster[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAwsClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAwsClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAwsClusters with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAwsClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAwsClusters = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAwsClusters(request), expectedError); - const actualRequest = (client.innerApiCalls.listAwsClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAwsClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAwsClustersStream without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAwsClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), - ]; - client.descriptors.page.listAwsClusters.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAwsClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkemulticloud.v1.AwsCluster[] = []; - stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AwsCluster) => { - 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.listAwsClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAwsClusters, request)); - assert( - (client.descriptors.page.listAwsClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAwsClustersStream with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAwsClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAwsClusters.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAwsClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkemulticloud.v1.AwsCluster[] = []; - stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AwsCluster) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAwsClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAwsClusters, request)); - assert( - (client.descriptors.page.listAwsClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAwsClusters without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAwsClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsCluster()), - ]; - client.descriptors.page.listAwsClusters.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkemulticloud.v1.IAwsCluster[] = []; - const iterable = client.listAwsClustersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAwsClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAwsClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAwsClusters with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAwsClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAwsClusters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAwsClustersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkemulticloud.v1.IAwsCluster[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAwsClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAwsClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listAwsNodePools', () => { - it('invokes listAwsNodePools without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), - ]; - client.innerApiCalls.listAwsNodePools = stubSimpleCall(expectedResponse); - const [response] = await client.listAwsNodePools(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAwsNodePools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAwsNodePools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAwsNodePools without error using callback', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), - ]; - client.innerApiCalls.listAwsNodePools = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAwsNodePools( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAwsNodePool[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAwsNodePools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAwsNodePools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAwsNodePools with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAwsNodePools = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAwsNodePools(request), expectedError); - const actualRequest = (client.innerApiCalls.listAwsNodePools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAwsNodePools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAwsNodePoolsStream without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), - ]; - client.descriptors.page.listAwsNodePools.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAwsNodePoolsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkemulticloud.v1.AwsNodePool[] = []; - stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AwsNodePool) => { - 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.listAwsNodePools.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAwsNodePools, request)); - assert( - (client.descriptors.page.listAwsNodePools.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAwsNodePoolsStream with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAwsNodePools.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAwsNodePoolsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkemulticloud.v1.AwsNodePool[] = []; - stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AwsNodePool) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAwsNodePools.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAwsNodePools, request)); - assert( - (client.descriptors.page.listAwsNodePools.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAwsNodePools without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AwsNodePool()), - ]; - client.descriptors.page.listAwsNodePools.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkemulticloud.v1.IAwsNodePool[] = []; - const iterable = client.listAwsNodePoolsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAwsNodePools.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAwsNodePools.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAwsNodePools with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAwsNodePools.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAwsNodePoolsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkemulticloud.v1.IAwsNodePool[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAwsNodePools.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAwsNodePools.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('attachedCluster', () => { - const fakePath = "/rendered/path/attachedCluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - attached_cluster: "attachedClusterValue", - }; - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.attachedClusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attachedClusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attachedClusterPath', () => { - const result = client.attachedClusterPath("projectValue", "locationValue", "attachedClusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attachedClusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttachedClusterName', () => { - const result = client.matchProjectFromAttachedClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttachedClusterName', () => { - const result = client.matchLocationFromAttachedClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAttachedClusterFromAttachedClusterName', () => { - const result = client.matchAttachedClusterFromAttachedClusterName(fakePath); - assert.strictEqual(result, "attachedClusterValue"); - assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attachedServerConfig', () => { - const fakePath = "/rendered/path/attachedServerConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.attachedServerConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attachedServerConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attachedServerConfigPath', () => { - const result = client.attachedServerConfigPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attachedServerConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttachedServerConfigName', () => { - const result = client.matchProjectFromAttachedServerConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attachedServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttachedServerConfigName', () => { - const result = client.matchLocationFromAttachedServerConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attachedServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('awsCluster', () => { - const fakePath = "/rendered/path/awsCluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - aws_cluster: "awsClusterValue", - }; - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.awsClusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.awsClusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('awsClusterPath', () => { - const result = client.awsClusterPath("projectValue", "locationValue", "awsClusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.awsClusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAwsClusterName', () => { - const result = client.matchProjectFromAwsClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAwsClusterName', () => { - const result = client.matchLocationFromAwsClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAwsClusterFromAwsClusterName', () => { - const result = client.matchAwsClusterFromAwsClusterName(fakePath); - assert.strictEqual(result, "awsClusterValue"); - assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('awsNodePool', () => { - const fakePath = "/rendered/path/awsNodePool"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - aws_cluster: "awsClusterValue", - aws_node_pool: "awsNodePoolValue", - }; - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.awsNodePoolPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.awsNodePoolPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('awsNodePoolPath', () => { - const result = client.awsNodePoolPath("projectValue", "locationValue", "awsClusterValue", "awsNodePoolValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.awsNodePoolPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAwsNodePoolName', () => { - const result = client.matchProjectFromAwsNodePoolName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAwsNodePoolName', () => { - const result = client.matchLocationFromAwsNodePoolName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAwsClusterFromAwsNodePoolName', () => { - const result = client.matchAwsClusterFromAwsNodePoolName(fakePath); - assert.strictEqual(result, "awsClusterValue"); - assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAwsNodePoolFromAwsNodePoolName', () => { - const result = client.matchAwsNodePoolFromAwsNodePoolName(fakePath); - assert.strictEqual(result, "awsNodePoolValue"); - assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('awsServerConfig', () => { - const fakePath = "/rendered/path/awsServerConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.awsServerConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.awsServerConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('awsServerConfigPath', () => { - const result = client.awsServerConfigPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.awsServerConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAwsServerConfigName', () => { - const result = client.matchProjectFromAwsServerConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.awsServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAwsServerConfigName', () => { - const result = client.matchLocationFromAwsServerConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.awsServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('azureClient', () => { - const fakePath = "/rendered/path/azureClient"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - azure_client: "azureClientValue", - }; - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.azureClientPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.azureClientPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('azureClientPath', () => { - const result = client.azureClientPath("projectValue", "locationValue", "azureClientValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.azureClientPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAzureClientName', () => { - const result = client.matchProjectFromAzureClientName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAzureClientName', () => { - const result = client.matchLocationFromAzureClientName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAzureClientFromAzureClientName', () => { - const result = client.matchAzureClientFromAzureClientName(fakePath); - assert.strictEqual(result, "azureClientValue"); - assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('azureCluster', () => { - const fakePath = "/rendered/path/azureCluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - azure_cluster: "azureClusterValue", - }; - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.azureClusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.azureClusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('azureClusterPath', () => { - const result = client.azureClusterPath("projectValue", "locationValue", "azureClusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.azureClusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAzureClusterName', () => { - const result = client.matchProjectFromAzureClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAzureClusterName', () => { - const result = client.matchLocationFromAzureClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAzureClusterFromAzureClusterName', () => { - const result = client.matchAzureClusterFromAzureClusterName(fakePath); - assert.strictEqual(result, "azureClusterValue"); - assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('azureNodePool', () => { - const fakePath = "/rendered/path/azureNodePool"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - azure_cluster: "azureClusterValue", - azure_node_pool: "azureNodePoolValue", - }; - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.azureNodePoolPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.azureNodePoolPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('azureNodePoolPath', () => { - const result = client.azureNodePoolPath("projectValue", "locationValue", "azureClusterValue", "azureNodePoolValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.azureNodePoolPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAzureNodePoolName', () => { - const result = client.matchProjectFromAzureNodePoolName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAzureNodePoolName', () => { - const result = client.matchLocationFromAzureNodePoolName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAzureClusterFromAzureNodePoolName', () => { - const result = client.matchAzureClusterFromAzureNodePoolName(fakePath); - assert.strictEqual(result, "azureClusterValue"); - assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAzureNodePoolFromAzureNodePoolName', () => { - const result = client.matchAzureNodePoolFromAzureNodePoolName(fakePath); - assert.strictEqual(result, "azureNodePoolValue"); - assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('azureServerConfig', () => { - const fakePath = "/rendered/path/azureServerConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.azureServerConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.azureServerConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('azureServerConfigPath', () => { - const result = client.azureServerConfigPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.azureServerConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAzureServerConfigName', () => { - const result = client.matchProjectFromAzureServerConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.azureServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAzureServerConfigName', () => { - const result = client.matchLocationFromAzureServerConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.azureServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new awsclustersModule.v1.AwsClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new awsclustersModule.v1.AwsClustersClient({ - 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)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_azure_clusters_v1.ts b/owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_azure_clusters_v1.ts deleted file mode 100644 index 463151c94a0..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/v1/test/gapic_azure_clusters_v1.ts +++ /dev/null @@ -1,3460 +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 azureclustersModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.AzureClustersClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = azureclustersModule.v1.AzureClustersClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = azureclustersModule.v1.AzureClustersClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = azureclustersModule.v1.AzureClustersClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new azureclustersModule.v1.AzureClustersClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.azureClustersStub, undefined); - await client.initialize(); - assert(client.azureClustersStub); - }); - - it('has close method for the initialized client', done => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.azureClustersStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.azureClustersStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new azureclustersModule.v1.AzureClustersClient({ - 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 azureclustersModule.v1.AzureClustersClient({ - 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('getAzureClient', () => { - it('invokes getAzureClient without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAzureClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureClientRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AzureClient() - ); - client.innerApiCalls.getAzureClient = stubSimpleCall(expectedResponse); - const [response] = await client.getAzureClient(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAzureClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAzureClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAzureClient without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAzureClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureClientRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AzureClient() - ); - client.innerApiCalls.getAzureClient = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAzureClient( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAzureClient|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAzureClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAzureClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAzureClient with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAzureClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureClientRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAzureClient = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAzureClient(request), expectedError); - const actualRequest = (client.innerApiCalls.getAzureClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAzureClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAzureClient with closed client', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAzureClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureClientRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAzureClient(request), expectedError); - }); - }); - - describe('getAzureCluster', () => { - it('invokes getAzureCluster without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAzureClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AzureCluster() - ); - client.innerApiCalls.getAzureCluster = stubSimpleCall(expectedResponse); - const [response] = await client.getAzureCluster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAzureCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAzureCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAzureCluster without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAzureClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AzureCluster() - ); - client.innerApiCalls.getAzureCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAzureCluster( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAzureCluster|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAzureCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAzureCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAzureCluster with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAzureClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAzureCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAzureCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.getAzureCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAzureCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAzureCluster with closed client', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAzureClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureClusterRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAzureCluster(request), expectedError); - }); - }); - - describe('generateAzureAccessToken', () => { - it('invokes generateAzureAccessToken without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest', ['azureCluster']); - request.azureCluster = defaultValue1; - const expectedHeaderRequestParams = `azure_cluster=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenResponse() - ); - client.innerApiCalls.generateAzureAccessToken = stubSimpleCall(expectedResponse); - const [response] = await client.generateAzureAccessToken(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateAzureAccessToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAzureAccessToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAzureAccessToken without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest', ['azureCluster']); - request.azureCluster = defaultValue1; - const expectedHeaderRequestParams = `azure_cluster=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenResponse() - ); - client.innerApiCalls.generateAzureAccessToken = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateAzureAccessToken( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IGenerateAzureAccessTokenResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateAzureAccessToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAzureAccessToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAzureAccessToken with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest', ['azureCluster']); - request.azureCluster = defaultValue1; - const expectedHeaderRequestParams = `azure_cluster=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateAzureAccessToken = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateAzureAccessToken(request), expectedError); - const actualRequest = (client.innerApiCalls.generateAzureAccessToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAzureAccessToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAzureAccessToken with closed client', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest', ['azureCluster']); - request.azureCluster = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateAzureAccessToken(request), expectedError); - }); - }); - - describe('getAzureNodePool', () => { - it('invokes getAzureNodePool without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AzureNodePool() - ); - client.innerApiCalls.getAzureNodePool = stubSimpleCall(expectedResponse); - const [response] = await client.getAzureNodePool(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAzureNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAzureNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAzureNodePool without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AzureNodePool() - ); - client.innerApiCalls.getAzureNodePool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAzureNodePool( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAzureNodePool|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAzureNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAzureNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAzureNodePool with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAzureNodePool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAzureNodePool(request), expectedError); - const actualRequest = (client.innerApiCalls.getAzureNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAzureNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAzureNodePool with closed client', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAzureNodePool(request), expectedError); - }); - }); - - describe('getAzureServerConfig', () => { - it('invokes getAzureServerConfig without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AzureServerConfig() - ); - client.innerApiCalls.getAzureServerConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getAzureServerConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAzureServerConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAzureServerConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAzureServerConfig without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.AzureServerConfig() - ); - client.innerApiCalls.getAzureServerConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAzureServerConfig( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAzureServerConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAzureServerConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAzureServerConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAzureServerConfig with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAzureServerConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAzureServerConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getAzureServerConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAzureServerConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAzureServerConfig with closed client', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAzureServerConfig(request), expectedError); - }); - }); - - describe('createAzureClient', () => { - it('invokes createAzureClient without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAzureClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureClientRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAzureClient = stubLongRunningCall(expectedResponse); - const [operation] = await client.createAzureClient(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAzureClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAzureClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAzureClient without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAzureClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureClientRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAzureClient = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAzureClient( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAzureClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAzureClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAzureClient with call error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAzureClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureClientRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAzureClient = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createAzureClient(request), expectedError); - const actualRequest = (client.innerApiCalls.createAzureClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAzureClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAzureClient with LRO error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAzureClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureClientRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAzureClient = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createAzureClient(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createAzureClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAzureClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateAzureClientProgress without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateAzureClientProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateAzureClientProgress with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateAzureClientProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteAzureClient', () => { - it('invokes deleteAzureClient without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAzureClient = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteAzureClient(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAzureClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAzureClient without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAzureClient = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAzureClient( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAzureClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAzureClient with call error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAzureClient = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteAzureClient(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAzureClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAzureClient with LRO error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAzureClient = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteAzureClient(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteAzureClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteAzureClientProgress without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteAzureClientProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteAzureClientProgress with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteAzureClientProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createAzureCluster', () => { - it('invokes createAzureCluster without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAzureCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.createAzureCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAzureCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAzureCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAzureCluster without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAzureCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAzureCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAzureCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAzureCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAzureCluster with call error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAzureCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createAzureCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.createAzureCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAzureCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAzureCluster with LRO error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAzureCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createAzureCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createAzureCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAzureCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateAzureClusterProgress without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateAzureClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateAzureClusterProgress with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateAzureClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateAzureCluster', () => { - it('invokes updateAzureCluster without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest() - ); - request.azureCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest', ['azureCluster', 'name']); - request.azureCluster.name = defaultValue1; - const expectedHeaderRequestParams = `azure_cluster.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAzureCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateAzureCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAzureCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAzureCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAzureCluster without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest() - ); - request.azureCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest', ['azureCluster', 'name']); - request.azureCluster.name = defaultValue1; - const expectedHeaderRequestParams = `azure_cluster.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAzureCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAzureCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAzureCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAzureCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAzureCluster with call error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest() - ); - request.azureCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest', ['azureCluster', 'name']); - request.azureCluster.name = defaultValue1; - const expectedHeaderRequestParams = `azure_cluster.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAzureCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateAzureCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAzureCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAzureCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAzureCluster with LRO error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest() - ); - request.azureCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest', ['azureCluster', 'name']); - request.azureCluster.name = defaultValue1; - const expectedHeaderRequestParams = `azure_cluster.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAzureCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateAzureCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateAzureCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAzureCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateAzureClusterProgress without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateAzureClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateAzureClusterProgress with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateAzureClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteAzureCluster', () => { - it('invokes deleteAzureCluster without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAzureCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteAzureCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAzureCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAzureCluster without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAzureCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAzureCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAzureCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAzureCluster with call error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAzureCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteAzureCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAzureCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAzureCluster with LRO error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAzureCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteAzureCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteAzureCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteAzureClusterProgress without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteAzureClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteAzureClusterProgress with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteAzureClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createAzureNodePool', () => { - it('invokes createAzureNodePool without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAzureNodePool = stubLongRunningCall(expectedResponse); - const [operation] = await client.createAzureNodePool(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAzureNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAzureNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAzureNodePool without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAzureNodePool = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAzureNodePool( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAzureNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAzureNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAzureNodePool with call error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAzureNodePool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createAzureNodePool(request), expectedError); - const actualRequest = (client.innerApiCalls.createAzureNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAzureNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAzureNodePool with LRO error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAzureNodePool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createAzureNodePool(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createAzureNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAzureNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateAzureNodePoolProgress without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateAzureNodePoolProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateAzureNodePoolProgress with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateAzureNodePoolProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateAzureNodePool', () => { - it('invokes updateAzureNodePool without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest() - ); - request.azureNodePool ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest', ['azureNodePool', 'name']); - request.azureNodePool.name = defaultValue1; - const expectedHeaderRequestParams = `azure_node_pool.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAzureNodePool = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateAzureNodePool(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAzureNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAzureNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAzureNodePool without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest() - ); - request.azureNodePool ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest', ['azureNodePool', 'name']); - request.azureNodePool.name = defaultValue1; - const expectedHeaderRequestParams = `azure_node_pool.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAzureNodePool = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAzureNodePool( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAzureNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAzureNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAzureNodePool with call error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest() - ); - request.azureNodePool ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest', ['azureNodePool', 'name']); - request.azureNodePool.name = defaultValue1; - const expectedHeaderRequestParams = `azure_node_pool.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAzureNodePool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateAzureNodePool(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAzureNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAzureNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAzureNodePool with LRO error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest() - ); - request.azureNodePool ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest', ['azureNodePool', 'name']); - request.azureNodePool.name = defaultValue1; - const expectedHeaderRequestParams = `azure_node_pool.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAzureNodePool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateAzureNodePool(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateAzureNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAzureNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateAzureNodePoolProgress without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateAzureNodePoolProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateAzureNodePoolProgress with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateAzureNodePoolProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteAzureNodePool', () => { - it('invokes deleteAzureNodePool without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAzureNodePool = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteAzureNodePool(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAzureNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAzureNodePool without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAzureNodePool = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAzureNodePool( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAzureNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAzureNodePool with call error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAzureNodePool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteAzureNodePool(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAzureNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAzureNodePool with LRO error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAzureNodePool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteAzureNodePool(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteAzureNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAzureNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteAzureNodePoolProgress without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteAzureNodePoolProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteAzureNodePoolProgress with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteAzureNodePoolProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listAzureClients', () => { - it('invokes listAzureClients without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureClientsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClientsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), - ]; - client.innerApiCalls.listAzureClients = stubSimpleCall(expectedResponse); - const [response] = await client.listAzureClients(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAzureClients as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAzureClients as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAzureClients without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureClientsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClientsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), - ]; - client.innerApiCalls.listAzureClients = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAzureClients( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAzureClient[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAzureClients as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAzureClients as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAzureClients with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureClientsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClientsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAzureClients = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAzureClients(request), expectedError); - const actualRequest = (client.innerApiCalls.listAzureClients as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAzureClients as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAzureClientsStream without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureClientsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClientsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), - ]; - client.descriptors.page.listAzureClients.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAzureClientsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkemulticloud.v1.AzureClient[] = []; - stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AzureClient) => { - 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.listAzureClients.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAzureClients, request)); - assert( - (client.descriptors.page.listAzureClients.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAzureClientsStream with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureClientsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClientsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAzureClients.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAzureClientsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkemulticloud.v1.AzureClient[] = []; - stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AzureClient) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAzureClients.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAzureClients, request)); - assert( - (client.descriptors.page.listAzureClients.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAzureClients without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureClientsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClientsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureClient()), - ]; - client.descriptors.page.listAzureClients.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkemulticloud.v1.IAzureClient[] = []; - const iterable = client.listAzureClientsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAzureClients.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAzureClients.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAzureClients with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureClientsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClientsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAzureClients.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAzureClientsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkemulticloud.v1.IAzureClient[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAzureClients.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAzureClients.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listAzureClusters', () => { - it('invokes listAzureClusters without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), - ]; - client.innerApiCalls.listAzureClusters = stubSimpleCall(expectedResponse); - const [response] = await client.listAzureClusters(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAzureClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAzureClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAzureClusters without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), - ]; - client.innerApiCalls.listAzureClusters = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAzureClusters( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAzureCluster[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAzureClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAzureClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAzureClusters with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAzureClusters = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAzureClusters(request), expectedError); - const actualRequest = (client.innerApiCalls.listAzureClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAzureClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAzureClustersStream without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), - ]; - client.descriptors.page.listAzureClusters.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAzureClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkemulticloud.v1.AzureCluster[] = []; - stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AzureCluster) => { - 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.listAzureClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAzureClusters, request)); - assert( - (client.descriptors.page.listAzureClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAzureClustersStream with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAzureClusters.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAzureClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkemulticloud.v1.AzureCluster[] = []; - stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AzureCluster) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAzureClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAzureClusters, request)); - assert( - (client.descriptors.page.listAzureClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAzureClusters without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureCluster()), - ]; - client.descriptors.page.listAzureClusters.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkemulticloud.v1.IAzureCluster[] = []; - const iterable = client.listAzureClustersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAzureClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAzureClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAzureClusters with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAzureClusters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAzureClustersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkemulticloud.v1.IAzureCluster[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAzureClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAzureClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listAzureNodePools', () => { - it('invokes listAzureNodePools without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), - ]; - client.innerApiCalls.listAzureNodePools = stubSimpleCall(expectedResponse); - const [response] = await client.listAzureNodePools(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAzureNodePools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAzureNodePools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAzureNodePools without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), - ]; - client.innerApiCalls.listAzureNodePools = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAzureNodePools( - request, - (err?: Error|null, result?: protos.google.cloud.gkemulticloud.v1.IAzureNodePool[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAzureNodePools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAzureNodePools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAzureNodePools with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAzureNodePools = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAzureNodePools(request), expectedError); - const actualRequest = (client.innerApiCalls.listAzureNodePools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAzureNodePools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAzureNodePoolsStream without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), - ]; - client.descriptors.page.listAzureNodePools.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAzureNodePoolsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkemulticloud.v1.AzureNodePool[] = []; - stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AzureNodePool) => { - 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.listAzureNodePools.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAzureNodePools, request)); - assert( - (client.descriptors.page.listAzureNodePools.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAzureNodePoolsStream with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAzureNodePools.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAzureNodePoolsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gkemulticloud.v1.AzureNodePool[] = []; - stream.on('data', (response: protos.google.cloud.gkemulticloud.v1.AzureNodePool) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAzureNodePools.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAzureNodePools, request)); - assert( - (client.descriptors.page.listAzureNodePools.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAzureNodePools without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), - generateSampleMessage(new protos.google.cloud.gkemulticloud.v1.AzureNodePool()), - ]; - client.descriptors.page.listAzureNodePools.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gkemulticloud.v1.IAzureNodePool[] = []; - const iterable = client.listAzureNodePoolsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAzureNodePools.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAzureNodePools.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAzureNodePools with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAzureNodePools.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAzureNodePoolsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gkemulticloud.v1.IAzureNodePool[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAzureNodePools.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAzureNodePools.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('attachedCluster', () => { - const fakePath = "/rendered/path/attachedCluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - attached_cluster: "attachedClusterValue", - }; - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.attachedClusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attachedClusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attachedClusterPath', () => { - const result = client.attachedClusterPath("projectValue", "locationValue", "attachedClusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attachedClusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttachedClusterName', () => { - const result = client.matchProjectFromAttachedClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttachedClusterName', () => { - const result = client.matchLocationFromAttachedClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAttachedClusterFromAttachedClusterName', () => { - const result = client.matchAttachedClusterFromAttachedClusterName(fakePath); - assert.strictEqual(result, "attachedClusterValue"); - assert((client.pathTemplates.attachedClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attachedServerConfig', () => { - const fakePath = "/rendered/path/attachedServerConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.attachedServerConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attachedServerConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attachedServerConfigPath', () => { - const result = client.attachedServerConfigPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attachedServerConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttachedServerConfigName', () => { - const result = client.matchProjectFromAttachedServerConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attachedServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttachedServerConfigName', () => { - const result = client.matchLocationFromAttachedServerConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attachedServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('awsCluster', () => { - const fakePath = "/rendered/path/awsCluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - aws_cluster: "awsClusterValue", - }; - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.awsClusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.awsClusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('awsClusterPath', () => { - const result = client.awsClusterPath("projectValue", "locationValue", "awsClusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.awsClusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAwsClusterName', () => { - const result = client.matchProjectFromAwsClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAwsClusterName', () => { - const result = client.matchLocationFromAwsClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAwsClusterFromAwsClusterName', () => { - const result = client.matchAwsClusterFromAwsClusterName(fakePath); - assert.strictEqual(result, "awsClusterValue"); - assert((client.pathTemplates.awsClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('awsNodePool', () => { - const fakePath = "/rendered/path/awsNodePool"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - aws_cluster: "awsClusterValue", - aws_node_pool: "awsNodePoolValue", - }; - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.awsNodePoolPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.awsNodePoolPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('awsNodePoolPath', () => { - const result = client.awsNodePoolPath("projectValue", "locationValue", "awsClusterValue", "awsNodePoolValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.awsNodePoolPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAwsNodePoolName', () => { - const result = client.matchProjectFromAwsNodePoolName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAwsNodePoolName', () => { - const result = client.matchLocationFromAwsNodePoolName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAwsClusterFromAwsNodePoolName', () => { - const result = client.matchAwsClusterFromAwsNodePoolName(fakePath); - assert.strictEqual(result, "awsClusterValue"); - assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAwsNodePoolFromAwsNodePoolName', () => { - const result = client.matchAwsNodePoolFromAwsNodePoolName(fakePath); - assert.strictEqual(result, "awsNodePoolValue"); - assert((client.pathTemplates.awsNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('awsServerConfig', () => { - const fakePath = "/rendered/path/awsServerConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.awsServerConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.awsServerConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('awsServerConfigPath', () => { - const result = client.awsServerConfigPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.awsServerConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAwsServerConfigName', () => { - const result = client.matchProjectFromAwsServerConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.awsServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAwsServerConfigName', () => { - const result = client.matchLocationFromAwsServerConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.awsServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('azureClient', () => { - const fakePath = "/rendered/path/azureClient"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - azure_client: "azureClientValue", - }; - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.azureClientPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.azureClientPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('azureClientPath', () => { - const result = client.azureClientPath("projectValue", "locationValue", "azureClientValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.azureClientPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAzureClientName', () => { - const result = client.matchProjectFromAzureClientName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAzureClientName', () => { - const result = client.matchLocationFromAzureClientName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAzureClientFromAzureClientName', () => { - const result = client.matchAzureClientFromAzureClientName(fakePath); - assert.strictEqual(result, "azureClientValue"); - assert((client.pathTemplates.azureClientPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('azureCluster', () => { - const fakePath = "/rendered/path/azureCluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - azure_cluster: "azureClusterValue", - }; - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.azureClusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.azureClusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('azureClusterPath', () => { - const result = client.azureClusterPath("projectValue", "locationValue", "azureClusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.azureClusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAzureClusterName', () => { - const result = client.matchProjectFromAzureClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAzureClusterName', () => { - const result = client.matchLocationFromAzureClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAzureClusterFromAzureClusterName', () => { - const result = client.matchAzureClusterFromAzureClusterName(fakePath); - assert.strictEqual(result, "azureClusterValue"); - assert((client.pathTemplates.azureClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('azureNodePool', () => { - const fakePath = "/rendered/path/azureNodePool"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - azure_cluster: "azureClusterValue", - azure_node_pool: "azureNodePoolValue", - }; - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.azureNodePoolPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.azureNodePoolPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('azureNodePoolPath', () => { - const result = client.azureNodePoolPath("projectValue", "locationValue", "azureClusterValue", "azureNodePoolValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.azureNodePoolPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAzureNodePoolName', () => { - const result = client.matchProjectFromAzureNodePoolName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAzureNodePoolName', () => { - const result = client.matchLocationFromAzureNodePoolName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAzureClusterFromAzureNodePoolName', () => { - const result = client.matchAzureClusterFromAzureNodePoolName(fakePath); - assert.strictEqual(result, "azureClusterValue"); - assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAzureNodePoolFromAzureNodePoolName', () => { - const result = client.matchAzureNodePoolFromAzureNodePoolName(fakePath); - assert.strictEqual(result, "azureNodePoolValue"); - assert((client.pathTemplates.azureNodePoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('azureServerConfig', () => { - const fakePath = "/rendered/path/azureServerConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.azureServerConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.azureServerConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('azureServerConfigPath', () => { - const result = client.azureServerConfigPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.azureServerConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAzureServerConfigName', () => { - const result = client.matchProjectFromAzureServerConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.azureServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAzureServerConfigName', () => { - const result = client.matchLocationFromAzureServerConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.azureServerConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new azureclustersModule.v1.AzureClustersClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new azureclustersModule.v1.AzureClustersClient({ - 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)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-gkemulticloud/v1/tsconfig.json b/owl-bot-staging/google-cloud-gkemulticloud/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/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-gkemulticloud/v1/webpack.config.js b/owl-bot-staging/google-cloud-gkemulticloud/v1/webpack.config.js deleted file mode 100644 index 01b1c9f6e02..00000000000 --- a/owl-bot-staging/google-cloud-gkemulticloud/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: 'AttachedClusters', - filename: './attached-clusters.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-gsuiteaddons/v1/.eslintignore b/owl-bot-staging/google-cloud-gsuiteaddons/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/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-gsuiteaddons/v1/.eslintrc.json b/owl-bot-staging/google-cloud-gsuiteaddons/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/.gitignore b/owl-bot-staging/google-cloud-gsuiteaddons/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/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-gsuiteaddons/v1/.jsdoc.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/.jsdoc.js deleted file mode 100644 index 0ba8d0588e9..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/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/gsuiteaddons', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/.mocharc.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/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-gsuiteaddons/v1/.prettierrc.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/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-gsuiteaddons/v1/README.md b/owl-bot-staging/google-cloud-gsuiteaddons/v1/README.md deleted file mode 100644 index ce9c84e8053..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Gsuiteaddons: Nodejs Client diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/package.json b/owl-bot-staging/google-cloud-gsuiteaddons/v1/package.json deleted file mode 100644 index d96967268b9..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/gsuiteaddons", - "version": "0.1.0", - "description": "Gsuiteaddons client for Node.js", - "repository": "googleapis/nodejs-gsuiteaddons", - "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 gsuiteaddons", - "gsuiteaddons", - "g suite add ons" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/addon_widget_set.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/addon_widget_set.proto deleted file mode 100644 index 477ff90f7d4..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/addon_widget_set.proto +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.apps.script.type; - -option csharp_namespace = "Google.Apps.Script.Type"; -option go_package = "google.golang.org/genproto/googleapis/apps/script/type"; -option java_multiple_files = true; -option java_outer_classname = "AddOnWidgetSetProto"; -option java_package = "com.google.apps.script.type"; -option php_namespace = "Google\\Apps\\Script\\Type"; -option ruby_package = "Google::Apps::Script::Type"; - -// The widget subset used by an add-on. -message AddOnWidgetSet { - // The Widget type. DEFAULT is the basic widget set. - enum WidgetType { - // The default widget set. - WIDGET_TYPE_UNSPECIFIED = 0; - - // The date picker. - DATE_PICKER = 1; - - // Styled buttons include filled buttons and disabled buttons. - STYLED_BUTTONS = 2; - - // Persistent forms allow persisting form values during actions. - PERSISTENT_FORMS = 3; - - // Fixed footer in card. - FIXED_FOOTER = 4; - - // Update the subject and recipients of a draft. - UPDATE_SUBJECT_AND_RECIPIENTS = 5; - - // The grid widget. - GRID_WIDGET = 6; - - // A Gmail add-on action that applies to the addon compose UI. - ADDON_COMPOSE_UI_ACTION = 7; - } - - // The list of widgets used in an add-on. - repeated WidgetType used_widgets = 1; -} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/calendar/calendar_addon_manifest.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/calendar/calendar_addon_manifest.proto deleted file mode 100644 index 3d21cd28ca6..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/calendar/calendar_addon_manifest.proto +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.apps.script.type.calendar; - -import "google/api/field_behavior.proto"; -import "google/apps/script/type/extension_point.proto"; - -option csharp_namespace = "Google.Apps.Script.Type.Calendar"; -option go_package = "google.golang.org/genproto/googleapis/apps/script/type/calendar"; -option java_multiple_files = true; -option java_outer_classname = "CalendarAddOnManifestProto"; -option java_package = "com.google.apps.script.type.calendar"; -option php_namespace = "Google\\Apps\\Script\\Type\\Calendar"; -option ruby_package = "Google::Apps::Script::Type::Calendar"; - -// Manifest section specific to Calendar Add-ons. - -// Calendar add-on manifest. -message CalendarAddOnManifest { - // An enum defining the level of data access event triggers require. - enum EventAccess { - // Default value when nothing is set for EventAccess. - UNSPECIFIED = 0; - - // METADATA gives event triggers the permission to access the metadata of - // events such as event id and calendar id. - METADATA = 1; - - // READ gives event triggers access to all provided event fields including - // the metadata, attendees, and conference data. - READ = 3; - - // WRITE gives event triggers access to the metadata of events and the - // ability to perform all actions, including adding attendees and setting - // conference data. - WRITE = 4; - - // READ_WRITE gives event triggers access to all provided event fields - // including the metadata, attendees, and conference data and the ability to - // perform all actions. - READ_WRITE = 5; - } - - // Defines an endpoint that will be executed contexts that don't - // match a declared contextual trigger. Any cards generated by this function - // will always be available to the user, but may be eclipsed by contextual - // content when this add-on declares more targeted triggers. - // - // If present, this overrides the configuration from - // `addOns.common.homepageTrigger`. - google.apps.script.type.HomepageExtensionPoint homepage_trigger = 6; - - // Defines conference solutions provided by this add-on. - repeated ConferenceSolution conference_solution = 3; - - // An endpoint to execute that creates a URL to the add-on's settings page. - string create_settings_url_function = 5; - - // An endpoint to trigger when an event is opened (viewed/edited). - CalendarExtensionPoint event_open_trigger = 10; - - // An endpoint to trigger when the open event is updated. - CalendarExtensionPoint event_update_trigger = 11; - - // Define the level of data access when an event addon is triggered. - EventAccess current_event_access = 12; -} - -// Defines conference related values. -message ConferenceSolution { - // Required. The endpoint to call when ConferenceData should be created. - string on_create_function = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. IDs should be unique across ConferenceSolutions within one - // add-on, but this is not strictly enforced. It is up to the add-on developer - // to assign them uniquely, otherwise the wrong ConferenceSolution may be - // used when the add-on is triggered. While the developer may change the - // display name of an add-on, the ID should not be changed. - string id = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. The display name of the ConferenceSolution. - string name = 5 [(google.api.field_behavior) = REQUIRED]; - - // Required. The URL for the logo image of the ConferenceSolution. - string logo_url = 6 [(google.api.field_behavior) = REQUIRED]; -} - -// Common format for declaring a calendar add-on's triggers. -message CalendarExtensionPoint { - // Required. The endpoint to execute when this extension point is - // activated. - string run_function = 1 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/docs/docs_addon_manifest.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/docs/docs_addon_manifest.proto deleted file mode 100644 index 395523be5ee..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/docs/docs_addon_manifest.proto +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.apps.script.type.docs; - -import "google/api/field_behavior.proto"; -import "google/apps/script/type/extension_point.proto"; - -option csharp_namespace = "Google.Apps.Script.Type.Docs"; -option go_package = "google.golang.org/genproto/googleapis/apps/script/type/docs"; -option java_multiple_files = true; -option java_outer_classname = "DocsAddOnManifestProto"; -option java_package = "com.google.apps.script.type.docs"; -option php_namespace = "Google\\Apps\\Script\\Type\\Docs"; -option ruby_package = "Google::Apps::Script::Type::Docs"; - -// Manifest section specific to Docs Add-ons. - -// Docs add-on manifest. -message DocsAddOnManifest { - // If present, this overrides the configuration from - // `addOns.common.homepageTrigger`. - google.apps.script.type.HomepageExtensionPoint homepage_trigger = 1; - - // Endpoint to execute when file scope authorization is granted - // for this document/user pair. - DocsExtensionPoint on_file_scope_granted_trigger = 2; -} - -// Common format for declaring a Docs add-on's triggers. -message DocsExtensionPoint { - // Required. The endpoint to execute when this extension point is activated. - string run_function = 1 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/drive/drive_addon_manifest.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/drive/drive_addon_manifest.proto deleted file mode 100644 index 55da161cfd6..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/drive/drive_addon_manifest.proto +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.apps.script.type.drive; - -import "google/apps/script/type/extension_point.proto"; - -option csharp_namespace = "Google.Apps.Script.Type.Drive"; -option go_package = "google.golang.org/genproto/googleapis/apps/script/type/drive"; -option java_multiple_files = true; -option java_outer_classname = "DriveAddOnManifestProto"; -option java_package = "com.google.apps.script.type.drive"; -option php_namespace = "Google\\Apps\\Script\\Type\\Drive"; -option ruby_package = "Google::Apps::Script::Type::Drive"; - -// Manifest section specific to Drive Add-ons. - -// Drive add-on manifest. -message DriveAddOnManifest { - // If present, this overrides the configuration from - // `addOns.common.homepageTrigger`. - google.apps.script.type.HomepageExtensionPoint homepage_trigger = 1; - - // Corresponds to behvior that should execute when items are selected - // in relevant Drive view (e.g. the My Drive Doclist). - DriveExtensionPoint on_items_selected_trigger = 2; -} - -// A generic extension point with common features, e.g. something that simply -// needs a corresponding run function to work. -message DriveExtensionPoint { - // Required. The endpoint to execute when this extension point is - // activated. - string run_function = 1; -} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/extension_point.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/extension_point.proto deleted file mode 100644 index f387c86423c..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/extension_point.proto +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.apps.script.type; - -import "google/protobuf/wrappers.proto"; - -option csharp_namespace = "Google.Apps.Script.Type"; -option go_package = "google.golang.org/genproto/googleapis/apps/script/type"; -option java_multiple_files = true; -option java_package = "com.google.apps.script.type"; -option php_namespace = "Google\\Apps\\Script\\Type"; -option ruby_package = "Google::Apps::Script::Type"; - -// Common Manifest protos for G Suite extension-point configuration. - -// Common format for declaring a menu item, or button, that appears within a -// host app. -message MenuItemExtensionPoint { - // Required. The endpoint to execute when this extension point is - // activated. - string run_function = 1; - - // Required. User-visible text describing the action taken by activating this - // extension point. For example, "Insert invoice". - string label = 2; - - // The URL for the logo image shown in the add-on toolbar. - // - // If not set, defaults to the add-on's primary logo URL. - string logo_url = 3; -} - -// Common format for declaring an add-on's home-page view. -message HomepageExtensionPoint { - // Required. The endpoint to execute when this extension point is - // activated. - string run_function = 1; - - // Optional. If set to `false`, disable the home-page view in this context. - // - // Defaults to `true` if unset. - // - // If an add-ons custom home-page view is disabled, an autogenerated overview - // card will be provided for users instead. - google.protobuf.BoolValue enabled = 2; -} - -// Format for declaring a universal action menu item extension point. -message UniversalActionExtensionPoint { - // Required. User-visible text describing the action taken by activating this - // extension point, for example, "Add a new contact". - string label = 1; - - // Required. The action type supported on a universal action menu item. It - // could be either a link to open or an endpoint to execute. - oneof action_type { - // URL to be opened by the UniversalAction. - string open_link = 2; - - // Endpoint to be run by the UniversalAction. - string run_function = 3; - } -} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/gmail/gmail_addon_manifest.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/gmail/gmail_addon_manifest.proto deleted file mode 100644 index eda200782c8..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/gmail/gmail_addon_manifest.proto +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.apps.script.type.gmail; - -import "google/apps/script/type/addon_widget_set.proto"; -import "google/apps/script/type/extension_point.proto"; - -option csharp_namespace = "Google.Apps.Script.Type.Gmail"; -option go_package = "google.golang.org/genproto/googleapis/apps/script/type/gmail"; -option java_multiple_files = true; -option java_outer_classname = "GmailAddOnManifestProto"; -option java_package = "com.google.apps.script.type.gmail"; -option php_namespace = "Google\\Apps\\Script\\Type\\Gmail"; -option ruby_package = "Google::Apps::Script::Type::Gmail"; - -// Properties customizing the appearance and execution of a Gmail add-on. -message GmailAddOnManifest { - // Defines an endpoint that will be executed in contexts that don't - // match a declared contextual trigger. Any cards generated by this function - // will always be available to the user, but may be eclipsed by contextual - // content when this add-on declares more targeted triggers. - // - // If present, this overrides the configuration from - // `addOns.common.homepageTrigger`. - google.apps.script.type.HomepageExtensionPoint homepage_trigger = 14; - - // Defines the set of conditions that trigger the add-on. - repeated ContextualTrigger contextual_triggers = 3; - - // Defines set of [universal - // actions](/gmail/add-ons/how-tos/universal-actions) for the add-on. The user - // triggers universal actions from the add-on toolbar menu. - repeated UniversalAction universal_actions = 4; - - // Defines the compose time trigger for a compose time add-on. This is the - // trigger that causes an add-on to take action when the user is composing an - // email. - // All compose time addons are required to have the - // gmail.addons.current.action.compose scope even though it might not edit the - // draft. - ComposeTrigger compose_trigger = 12; - - // The name of an endpoint that verifies that the add-on has - // all the required third-party authorizations, by probing the third-party - // APIs. If the probe fails, the function should throw an exception to - // initiate the authorization flow. This function is called before each - // invocation of the add-on, in order to ensure a smooth user experience. - string authorization_check_function = 7; -} - -// An action that is always available in the add-on toolbar menu regardless of -// message context. -message UniversalAction { - // Required. User-visible text describing the action, for example, "Add a new - // contact." - string text = 1; - - // The type of the action determines the behavior of Gmail when the user - // invokes the action. - oneof action_type { - // A link that is opened by Gmail when the user triggers the action. - string open_link = 2; - - // An endpoint that is called when the user triggers the - // action. See the [universal actions - // guide](/gmail/add-ons/how-tos/universal-actions) for details. - string run_function = 3; - } -} - -// A trigger that activates when user is composing an email. -message ComposeTrigger { - // An enum defining the level of data access this compose trigger requires. - enum DraftAccess { - // Default value when nothing is set for DraftAccess. - UNSPECIFIED = 0; - - // NONE means compose trigger won't be able to access any data of the draft - // when a compose addon is triggered. - NONE = 1; - - // METADATA gives compose trigger the permission to access the metadata of - // the draft when a compose addon is triggered. This includes the audience - // list (To/cc list) of a draft message. - METADATA = 2; - } - - // Defines the set of actions for compose time add-on. These are actions - // that user can trigger on a compose time addon. - repeated google.apps.script.type.MenuItemExtensionPoint actions = 5; - - // Define the level of data access when a compose time addon is triggered. - DraftAccess draft_access = 4; -} - -// Defines a trigger that fires when the open email meets a specific criteria. -// When the trigger fires, it executes a specific endpoint, usually -// in order to create new cards and update the UI. -message ContextualTrigger { - // The type of trigger determines the conditions Gmail uses to show the - // add-on. - oneof trigger { - // UnconditionalTriggers are executed when any mail message is opened. - UnconditionalTrigger unconditional = 1; - } - - // Required. The name of the endpoint to call when a message matches the - // trigger. - string on_trigger_function = 4; -} - -// A trigger that fires when any email message is opened. -message UnconditionalTrigger {} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/script_manifest.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/script_manifest.proto deleted file mode 100644 index 572d5da98ce..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/script_manifest.proto +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.apps.script.type; - -import "google/apps/script/type/addon_widget_set.proto"; -import "google/apps/script/type/extension_point.proto"; -import "google/protobuf/struct.proto"; - -option csharp_namespace = "Google.Apps.Script.Type"; -option go_package = "google.golang.org/genproto/googleapis/apps/script/type"; -option java_multiple_files = true; -option java_package = "com.google.apps.script.type"; -option php_namespace = "Google\\Apps\\Script\\Type"; -option ruby_package = "Google::Apps::Script::Type"; - -// Add-on configuration that is shared across all add-on host applications. -message CommonAddOnManifest { - // Required. The display name of the add-on. - string name = 1; - - // Required. The URL for the logo image shown in the add-on toolbar. - string logo_url = 2; - - // Common layout properties for the add-on cards. - LayoutProperties layout_properties = 3; - - // The widgets used in the add-on. If this field is not specified, - // it indicates that default set is used. - AddOnWidgetSet add_on_widget_set = 4; - - // Whether to pass locale information from host app. - bool use_locale_from_app = 5; - - // Defines an endpoint that will be executed in any context, in - // any host. Any cards generated by this function will always be available to - // the user, but may be eclipsed by contextual content when this add-on - // declares more targeted triggers. - HomepageExtensionPoint homepage_trigger = 6; - - // Defines a list of extension points in the universal action menu which - // serves as a setting menu for the add-on. The extension point can be - // link URL to open or an endpoint to execute as a form - // submission. - repeated UniversalActionExtensionPoint universal_actions = 7; - - // An OpenLink action - // can only use a URL with an HTTPS, MAILTO or TEL scheme. For HTTPS links, - // the URL must also - // [match](/gmail/add-ons/concepts/manifests#whitelisting_urls) one of the - // prefixes specified in this whitelist. If the prefix omits the scheme, HTTPS - // is assumed. Notice that HTTP links are automatically rewritten to HTTPS - // links. - google.protobuf.ListValue open_link_url_prefixes = 8; -} - -// Card layout properties shared across all add-on host applications. -message LayoutProperties { - // The primary color of the add-on. It sets the color of toolbar. If no - // primary color is set explicitly, the default value provided by the - // framework is used. - string primary_color = 1; - - // The secondary color of the add-on. It sets the color of buttons. - // If primary color is set but no secondary color is set, the - // secondary color is the same as the primary color. If neither primary - // color nor secondary color is set, the default value provided by the - // framework is used. - string secondary_color = 2; -} - -// Options for sending requests to add-on HTTP endpoints -message HttpOptions { - // Configuration for the token sent in the HTTP Authorization header - HttpAuthorizationHeader authorization_header = 1; -} - -// Authorization header sent in add-on HTTP requests -enum HttpAuthorizationHeader { - // Default value, equivalent to `SYSTEM_ID_TOKEN` - HTTP_AUTHORIZATION_HEADER_UNSPECIFIED = 0; - - // Send an ID token for the project-specific Google Workspace Add-ons system - // service account (default) - SYSTEM_ID_TOKEN = 1; - - // Send an ID token for the end user - USER_ID_TOKEN = 2; - - // Do not send an Authentication header - NONE = 3; -} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/sheets/sheets_addon_manifest.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/sheets/sheets_addon_manifest.proto deleted file mode 100644 index c34bca71fcc..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/sheets/sheets_addon_manifest.proto +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.apps.script.type.sheets; - -import "google/api/field_behavior.proto"; -import "google/apps/script/type/extension_point.proto"; - -option csharp_namespace = "Google.Apps.Script.Type.Sheets"; -option go_package = "google.golang.org/genproto/googleapis/apps/script/type/sheets"; -option java_multiple_files = true; -option java_outer_classname = "SheetsAddOnManifestProto"; -option java_package = "com.google.apps.script.type.sheets"; -option php_namespace = "Google\\Apps\\Script\\Type\\Sheets"; -option ruby_package = "Google::Apps::Script::Type::Sheets"; - -// Manifest section specific to Sheets Add-ons. - -// Sheets add-on manifest. -message SheetsAddOnManifest { - // If present, this overrides the configuration from - // `addOns.common.homepageTrigger`. - google.apps.script.type.HomepageExtensionPoint homepage_trigger = 3; - - // Endpoint to execute when file scope authorization is granted - // for this document/user pair. - SheetsExtensionPoint on_file_scope_granted_trigger = 5; -} - -// Common format for declaring a Sheets add-on's triggers. -message SheetsExtensionPoint { - // Required. The endpoint to execute when this extension point is activated. - string run_function = 1 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/slides/slides_addon_manifest.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/slides/slides_addon_manifest.proto deleted file mode 100644 index 6a51bb2f46b..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/apps/script/type/slides/slides_addon_manifest.proto +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.apps.script.type.slides; - -import "google/api/field_behavior.proto"; -import "google/apps/script/type/extension_point.proto"; - -option csharp_namespace = "Google.Apps.Script.Type.Slides"; -option go_package = "google.golang.org/genproto/googleapis/apps/script/type/slides"; -option java_multiple_files = true; -option java_outer_classname = "SlidesAddOnManifestProto"; -option java_package = "com.google.apps.script.type.slides"; -option php_namespace = "Google\\Apps\\Script\\Type\\Slides"; -option ruby_package = "Google::Apps::Script::Type::Slides"; - -// Manifest section specific to Slides Add-ons. - -// Slides add-on manifest. -message SlidesAddOnManifest { - // If present, this overrides the configuration from - // `addOns.common.homepageTrigger`. - google.apps.script.type.HomepageExtensionPoint homepage_trigger = 1; - - // Endpoint to execute when file scope authorization is granted - // for this document/user pair. - SlidesExtensionPoint on_file_scope_granted_trigger = 2; -} - -// Common format for declaring a Slides add-on's triggers. -message SlidesExtensionPoint { - // Required. The endpoint to execute when this extension point is activated. - string run_function = 1 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/cloud/gsuiteaddons/v1/gsuiteaddons.proto b/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/cloud/gsuiteaddons/v1/gsuiteaddons.proto deleted file mode 100644 index 8d557ca5f8a..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/protos/google/cloud/gsuiteaddons/v1/gsuiteaddons.proto +++ /dev/null @@ -1,389 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.gsuiteaddons.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/apps/script/type/calendar/calendar_addon_manifest.proto"; -import "google/apps/script/type/docs/docs_addon_manifest.proto"; -import "google/apps/script/type/drive/drive_addon_manifest.proto"; -import "google/apps/script/type/gmail/gmail_addon_manifest.proto"; -import "google/apps/script/type/script_manifest.proto"; -import "google/apps/script/type/sheets/sheets_addon_manifest.proto"; -import "google/apps/script/type/slides/slides_addon_manifest.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/wrappers.proto"; - -option csharp_namespace = "Google.Cloud.GSuiteAddOns.V1"; -option go_package = "cloud.google.com/go/gsuiteaddons/apiv1/gsuiteaddonspb;gsuiteaddonspb"; -option java_multiple_files = true; -option java_outer_classname = "GSuiteAddOnsProto"; -option java_package = "com.google.cloud.gsuiteaddons.v1"; -option php_namespace = "Google\\Cloud\\GSuiteAddOns\\V1"; -option ruby_package = "Google::Cloud::GSuiteAddOns::V1"; - -// A service for managing Google Workspace Add-ons deployments. -// -// A Google Workspace Add-on is a third-party embedded component that can be -// installed in Google Workspace Applications like Gmail, Calendar, Drive, and -// the Google Docs, Sheets, and Slides editors. Google Workspace Add-ons can -// display UI cards, receive contextual information from the host application, -// and perform actions in the host application (See: -// https://developers.google.com/gsuite/add-ons/overview for more information). -// -// A Google Workspace Add-on deployment resource specifies metadata about the -// add-on, including a specification of the entry points in the host application -// that trigger add-on executions (see: -// https://developers.google.com/gsuite/add-ons/concepts/gsuite-manifests). -// Add-on deployments defined via the Google Workspace Add-ons API define their -// entrypoints using HTTPS URLs (See: -// https://developers.google.com/gsuite/add-ons/guides/alternate-runtimes), -// -// A Google Workspace Add-on deployment can be installed in developer mode, -// which allows an add-on developer to test the experience an end-user would see -// when installing and running the add-on in their G Suite applications. When -// running in developer mode, more detailed error messages are exposed in the -// add-on UI to aid in debugging. -// -// A Google Workspace Add-on deployment can be published to Google Workspace -// Marketplace, which allows other Google Workspace users to discover and -// install the add-on. See: -// https://developers.google.com/gsuite/add-ons/how-tos/publish-add-on-overview -// for details. -service GSuiteAddOns { - option (google.api.default_host) = "gsuiteaddons.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Gets the authorization information for deployments in a given project. - rpc GetAuthorization(GetAuthorizationRequest) returns (Authorization) { - option (google.api.http) = { - get: "/v1/{name=projects/*/authorization}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a deployment with the specified name and configuration. - rpc CreateDeployment(CreateDeploymentRequest) returns (Deployment) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/deployments" - body: "deployment" - }; - option (google.api.method_signature) = "parent,deployment,deployment_id"; - } - - // Creates or replaces a deployment with the specified name. - rpc ReplaceDeployment(ReplaceDeploymentRequest) returns (Deployment) { - option (google.api.http) = { - put: "/v1/{deployment.name=projects/*/deployments/*}" - body: "deployment" - }; - option (google.api.method_signature) = "deployment"; - } - - // Gets the deployment with the specified name. - rpc GetDeployment(GetDeploymentRequest) returns (Deployment) { - option (google.api.http) = { - get: "/v1/{name=projects/*/deployments/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all deployments in a particular project. - rpc ListDeployments(ListDeploymentsRequest) - returns (ListDeploymentsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/deployments" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes the deployment with the given name. - rpc DeleteDeployment(DeleteDeploymentRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/deployments/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Installs a deployment in developer mode. - // See: - // https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons. - rpc InstallDeployment(InstallDeploymentRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{name=projects/*/deployments/*}:install" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Uninstalls a developer mode deployment. - // See: - // https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons. - rpc UninstallDeployment(UninstallDeploymentRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{name=projects/*/deployments/*}:uninstall" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Fetches the install status of a developer mode deployment. - rpc GetInstallStatus(GetInstallStatusRequest) returns (InstallStatus) { - option (google.api.http) = { - get: "/v1/{name=projects/*/deployments/*/installStatus}" - }; - option (google.api.method_signature) = "name"; - } -} - -// Request message to get Google Workspace Add-ons authorization information. -message GetAuthorizationRequest { - // Required. Name of the project for which to get the Google Workspace Add-ons - // authorization information. - // - // Example: `projects/my_project/authorization`. - string name = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gsuiteaddons.googleapis.com/Authorization" - } - ]; -} - -// The authorization information used when invoking deployment endpoints. -message Authorization { - option (google.api.resource) = { - type: "gsuiteaddons.googleapis.com/Authorization" - pattern: "projects/{project}/authorization" - }; - - // The canonical full name of this resource. - // Example: `projects/123/authorization` - string name = 1; - - // The email address of the service account used to authenticate requests to - // add-on callback endpoints. - string service_account_email = 2; - - // The OAuth client ID used to obtain OAuth access tokens for a user on the - // add-on's behalf. - string oauth_client_id = 3; -} - -// Request message to create a deployment. -message CreateDeploymentRequest { - // Required. Name of the project in which to create the deployment. - // - // Example: `projects/my_project`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. The id to use for this deployment. The full name of the created - // resource will be `projects//deployments/`. - string deployment_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The deployment to create (deployment.name cannot be set). - Deployment deployment = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message to create or replace a deployment. -message ReplaceDeploymentRequest { - // Required. The deployment to create or replace. - Deployment deployment = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message to get a deployment. -message GetDeploymentRequest { - // Required. The full resource name of the deployment to get. - // - // Example: `projects/my_project/deployments/my_deployment`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gsuiteaddons.googleapis.com/Deployment" - } - ]; -} - -// Request message to list deployments for a project. -message ListDeploymentsRequest { - // Required. Name of the project in which to create the deployment. - // - // Example: `projects/my_project`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // The maximum number of deployments to return. The service may return fewer - // than this value. - // If unspecified, at most 1000 deployments 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 `ListDeployments` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListDeployments` must - // match the call that provided the page token. - string page_token = 3; -} - -// Response message to list deployments. -message ListDeploymentsResponse { - // The list of deployments for the given project. - repeated Deployment deployments = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message to delete a deployment. -message DeleteDeploymentRequest { - // Required. The full resource name of the deployment to delete. - // - // Example: `projects/my_project/deployments/my_deployment`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gsuiteaddons.googleapis.com/Deployment" - } - ]; - - // The etag of the deployment to delete. - // If this is provided, it must match the server's etag. - string etag = 2; -} - -// Request message to install a developer mode deployment. -message InstallDeploymentRequest { - // Required. The full resource name of the deployment to install. - // - // Example: `projects/my_project/deployments/my_deployment`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gsuiteaddons.googleapis.com/Deployment" - } - ]; -} - -// Request message to uninstall a developer mode deployment. -message UninstallDeploymentRequest { - // Required. The full resource name of the deployment to install. - // - // Example: `projects/my_project/deployments/my_deployment`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gsuiteaddons.googleapis.com/Deployment" - } - ]; -} - -// Request message to get the install status of a developer mode deployment. -message GetInstallStatusRequest { - // Required. The full resource name of the deployment. - // - // Example: `projects/my_project/deployments/my_deployment/installStatus`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "gsuiteaddons.googleapis.com/InstallStatus" - } - ]; -} - -// Developer mode install status of a deployment -message InstallStatus { - option (google.api.resource) = { - type: "gsuiteaddons.googleapis.com/InstallStatus" - pattern: "projects/{project}/deployments/{deployment}/installStatus" - }; - - // The canonical full resource name of the deployment install status. - // - // Example: `projects/123/deployments/my_deployment/installStatus`. - string name = 1; - - // True if the deployment is installed for the user - google.protobuf.BoolValue installed = 2; -} - -// A Google Workspace Add-on deployment -message Deployment { - option (google.api.resource) = { - type: "gsuiteaddons.googleapis.com/Deployment" - pattern: "projects/{project}/deployments/{deployment}" - }; - - // The deployment resource name. - // Example: projects/123/deployments/my_deployment. - string name = 1; - - // The list of Google OAuth scopes for which to request consent from the end - // user before executing an add-on endpoint. - repeated string oauth_scopes = 2; - - // The Google Workspace Add-on configuration. - AddOns add_ons = 3; - - // This value is computed by the server based on the version of the - // deployment in storage, and may be sent on update and delete requests to - // ensure the client has an up-to-date value before proceeding. - string etag = 5; -} - -// A Google Workspace Add-on configuration. -message AddOns { - // Configuration that is common across all Google Workspace Add-ons. - google.apps.script.type.CommonAddOnManifest common = 1; - - // Gmail add-on configuration. - google.apps.script.type.gmail.GmailAddOnManifest gmail = 2; - - // Drive add-on configuration. - google.apps.script.type.drive.DriveAddOnManifest drive = 5; - - // Calendar add-on configuration. - google.apps.script.type.calendar.CalendarAddOnManifest calendar = 6; - - // Docs add-on configuration. - google.apps.script.type.docs.DocsAddOnManifest docs = 7; - - // Sheets add-on configuration. - google.apps.script.type.sheets.SheetsAddOnManifest sheets = 8; - - // Slides add-on configuration. - google.apps.script.type.slides.SlidesAddOnManifest slides = 10; - - // Options for sending requests to add-on HTTP endpoints - google.apps.script.type.HttpOptions http_options = 15; -} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.create_deployment.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.create_deployment.js deleted file mode 100644 index fa9eecd7eb5..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.create_deployment.js +++ /dev/null @@ -1,73 +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, deploymentId, deployment) { - // [START gsuiteaddons_v1_generated_GSuiteAddOns_CreateDeployment_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 project in which to create the deployment. - * Example: `projects/my_project`. - */ - // const parent = 'abc123' - /** - * Required. The id to use for this deployment. The full name of the created - * resource will be `projects//deployments/`. - */ - // const deploymentId = 'abc123' - /** - * Required. The deployment to create (deployment.name cannot be set). - */ - // const deployment = {} - - // Imports the Gsuiteaddons library - const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; - - // Instantiates a client - const gsuiteaddonsClient = new GSuiteAddOnsClient(); - - async function callCreateDeployment() { - // Construct request - const request = { - parent, - deploymentId, - deployment, - }; - - // Run request - const response = await gsuiteaddonsClient.createDeployment(request); - console.log(response); - } - - callCreateDeployment(); - // [END gsuiteaddons_v1_generated_GSuiteAddOns_CreateDeployment_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-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.delete_deployment.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.delete_deployment.js deleted file mode 100644 index 126a4ffccf7..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.delete_deployment.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(name) { - // [START gsuiteaddons_v1_generated_GSuiteAddOns_DeleteDeployment_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 full resource name of the deployment to delete. - * Example: `projects/my_project/deployments/my_deployment`. - */ - // const name = 'abc123' - /** - * The etag of the deployment to delete. - * If this is provided, it must match the server's etag. - */ - // const etag = 'abc123' - - // Imports the Gsuiteaddons library - const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; - - // Instantiates a client - const gsuiteaddonsClient = new GSuiteAddOnsClient(); - - async function callDeleteDeployment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gsuiteaddonsClient.deleteDeployment(request); - console.log(response); - } - - callDeleteDeployment(); - // [END gsuiteaddons_v1_generated_GSuiteAddOns_DeleteDeployment_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-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_authorization.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_authorization.js deleted file mode 100644 index 36b8296534e..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_authorization.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 gsuiteaddons_v1_generated_GSuiteAddOns_GetAuthorization_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 project for which to get the Google Workspace Add-ons - * authorization information. - * Example: `projects/my_project/authorization`. - */ - // const name = 'abc123' - - // Imports the Gsuiteaddons library - const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; - - // Instantiates a client - const gsuiteaddonsClient = new GSuiteAddOnsClient(); - - async function callGetAuthorization() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gsuiteaddonsClient.getAuthorization(request); - console.log(response); - } - - callGetAuthorization(); - // [END gsuiteaddons_v1_generated_GSuiteAddOns_GetAuthorization_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-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_deployment.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_deployment.js deleted file mode 100644 index f50131ff357..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_deployment.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 gsuiteaddons_v1_generated_GSuiteAddOns_GetDeployment_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 full resource name of the deployment to get. - * Example: `projects/my_project/deployments/my_deployment`. - */ - // const name = 'abc123' - - // Imports the Gsuiteaddons library - const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; - - // Instantiates a client - const gsuiteaddonsClient = new GSuiteAddOnsClient(); - - async function callGetDeployment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gsuiteaddonsClient.getDeployment(request); - console.log(response); - } - - callGetDeployment(); - // [END gsuiteaddons_v1_generated_GSuiteAddOns_GetDeployment_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-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_install_status.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_install_status.js deleted file mode 100644 index bed246f9f5d..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.get_install_status.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 gsuiteaddons_v1_generated_GSuiteAddOns_GetInstallStatus_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 full resource name of the deployment. - * Example: `projects/my_project/deployments/my_deployment/installStatus`. - */ - // const name = 'abc123' - - // Imports the Gsuiteaddons library - const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; - - // Instantiates a client - const gsuiteaddonsClient = new GSuiteAddOnsClient(); - - async function callGetInstallStatus() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gsuiteaddonsClient.getInstallStatus(request); - console.log(response); - } - - callGetInstallStatus(); - // [END gsuiteaddons_v1_generated_GSuiteAddOns_GetInstallStatus_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-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.install_deployment.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.install_deployment.js deleted file mode 100644 index ecfb281157f..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.install_deployment.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 gsuiteaddons_v1_generated_GSuiteAddOns_InstallDeployment_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 full resource name of the deployment to install. - * Example: `projects/my_project/deployments/my_deployment`. - */ - // const name = 'abc123' - - // Imports the Gsuiteaddons library - const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; - - // Instantiates a client - const gsuiteaddonsClient = new GSuiteAddOnsClient(); - - async function callInstallDeployment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gsuiteaddonsClient.installDeployment(request); - console.log(response); - } - - callInstallDeployment(); - // [END gsuiteaddons_v1_generated_GSuiteAddOns_InstallDeployment_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-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.list_deployments.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.list_deployments.js deleted file mode 100644 index df7b8f978b4..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.list_deployments.js +++ /dev/null @@ -1,78 +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 gsuiteaddons_v1_generated_GSuiteAddOns_ListDeployments_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 project in which to create the deployment. - * Example: `projects/my_project`. - */ - // const parent = 'abc123' - /** - * The maximum number of deployments to return. The service may return fewer - * than this value. - * If unspecified, at most 1000 deployments 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 `ListDeployments` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListDeployments` must - * match the call that provided the page token. - */ - // const pageToken = 'abc123' - - // Imports the Gsuiteaddons library - const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; - - // Instantiates a client - const gsuiteaddonsClient = new GSuiteAddOnsClient(); - - async function callListDeployments() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await gsuiteaddonsClient.listDeploymentsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDeployments(); - // [END gsuiteaddons_v1_generated_GSuiteAddOns_ListDeployments_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-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.replace_deployment.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.replace_deployment.js deleted file mode 100644 index d697b80a7fa..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.replace_deployment.js +++ /dev/null @@ -1,61 +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(deployment) { - // [START gsuiteaddons_v1_generated_GSuiteAddOns_ReplaceDeployment_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 deployment to create or replace. - */ - // const deployment = {} - - // Imports the Gsuiteaddons library - const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; - - // Instantiates a client - const gsuiteaddonsClient = new GSuiteAddOnsClient(); - - async function callReplaceDeployment() { - // Construct request - const request = { - deployment, - }; - - // Run request - const response = await gsuiteaddonsClient.replaceDeployment(request); - console.log(response); - } - - callReplaceDeployment(); - // [END gsuiteaddons_v1_generated_GSuiteAddOns_ReplaceDeployment_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-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.uninstall_deployment.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.uninstall_deployment.js deleted file mode 100644 index e879887a9c3..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/g_suite_add_ons.uninstall_deployment.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 gsuiteaddons_v1_generated_GSuiteAddOns_UninstallDeployment_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 full resource name of the deployment to install. - * Example: `projects/my_project/deployments/my_deployment`. - */ - // const name = 'abc123' - - // Imports the Gsuiteaddons library - const {GSuiteAddOnsClient} = require('@google-cloud/gsuiteaddons').v1; - - // Instantiates a client - const gsuiteaddonsClient = new GSuiteAddOnsClient(); - - async function callUninstallDeployment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await gsuiteaddonsClient.uninstallDeployment(request); - console.log(response); - } - - callUninstallDeployment(); - // [END gsuiteaddons_v1_generated_GSuiteAddOns_UninstallDeployment_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-gsuiteaddons/v1/samples/generated/v1/snippet_metadata_google.cloud.gsuiteaddons.v1.json b/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/snippet_metadata_google.cloud.gsuiteaddons.v1.json deleted file mode 100644 index 027ba5bc688..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/samples/generated/v1/snippet_metadata_google.cloud.gsuiteaddons.v1.json +++ /dev/null @@ -1,395 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-gsuiteaddons", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.gsuiteaddons.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_GetAuthorization_async", - "title": "GSuiteAddOns getAuthorization Sample", - "origin": "API_DEFINITION", - "description": " Gets the authorization information for deployments in a given project.", - "canonical": true, - "file": "g_suite_add_ons.get_authorization.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAuthorization", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.GetAuthorization", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gsuiteaddons.v1.Authorization", - "client": { - "shortName": "GSuiteAddOnsClient", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" - }, - "method": { - "shortName": "GetAuthorization", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.GetAuthorization", - "service": { - "shortName": "GSuiteAddOns", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" - } - } - } - }, - { - "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_CreateDeployment_async", - "title": "GSuiteAddOns createDeployment Sample", - "origin": "API_DEFINITION", - "description": " Creates a deployment with the specified name and configuration.", - "canonical": true, - "file": "g_suite_add_ons.create_deployment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateDeployment", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.CreateDeployment", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "deployment_id", - "type": "TYPE_STRING" - }, - { - "name": "deployment", - "type": ".google.cloud.gsuiteaddons.v1.Deployment" - } - ], - "resultType": ".google.cloud.gsuiteaddons.v1.Deployment", - "client": { - "shortName": "GSuiteAddOnsClient", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" - }, - "method": { - "shortName": "CreateDeployment", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.CreateDeployment", - "service": { - "shortName": "GSuiteAddOns", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" - } - } - } - }, - { - "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_ReplaceDeployment_async", - "title": "GSuiteAddOns replaceDeployment Sample", - "origin": "API_DEFINITION", - "description": " Creates or replaces a deployment with the specified name.", - "canonical": true, - "file": "g_suite_add_ons.replace_deployment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReplaceDeployment", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.ReplaceDeployment", - "async": true, - "parameters": [ - { - "name": "deployment", - "type": ".google.cloud.gsuiteaddons.v1.Deployment" - } - ], - "resultType": ".google.cloud.gsuiteaddons.v1.Deployment", - "client": { - "shortName": "GSuiteAddOnsClient", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" - }, - "method": { - "shortName": "ReplaceDeployment", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.ReplaceDeployment", - "service": { - "shortName": "GSuiteAddOns", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" - } - } - } - }, - { - "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_GetDeployment_async", - "title": "GSuiteAddOns getDeployment Sample", - "origin": "API_DEFINITION", - "description": " Gets the deployment with the specified name.", - "canonical": true, - "file": "g_suite_add_ons.get_deployment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDeployment", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.GetDeployment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gsuiteaddons.v1.Deployment", - "client": { - "shortName": "GSuiteAddOnsClient", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" - }, - "method": { - "shortName": "GetDeployment", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.GetDeployment", - "service": { - "shortName": "GSuiteAddOns", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" - } - } - } - }, - { - "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_ListDeployments_async", - "title": "GSuiteAddOns listDeployments Sample", - "origin": "API_DEFINITION", - "description": " Lists all deployments in a particular project.", - "canonical": true, - "file": "g_suite_add_ons.list_deployments.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDeployments", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.ListDeployments", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gsuiteaddons.v1.ListDeploymentsResponse", - "client": { - "shortName": "GSuiteAddOnsClient", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" - }, - "method": { - "shortName": "ListDeployments", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.ListDeployments", - "service": { - "shortName": "GSuiteAddOns", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" - } - } - } - }, - { - "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_DeleteDeployment_async", - "title": "GSuiteAddOns deleteDeployment Sample", - "origin": "API_DEFINITION", - "description": " Deletes the deployment with the given name.", - "canonical": true, - "file": "g_suite_add_ons.delete_deployment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDeployment", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.DeleteDeployment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "GSuiteAddOnsClient", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" - }, - "method": { - "shortName": "DeleteDeployment", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.DeleteDeployment", - "service": { - "shortName": "GSuiteAddOns", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" - } - } - } - }, - { - "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_InstallDeployment_async", - "title": "GSuiteAddOns installDeployment Sample", - "origin": "API_DEFINITION", - "description": " Installs a deployment in developer mode. See: https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons.", - "canonical": true, - "file": "g_suite_add_ons.install_deployment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "InstallDeployment", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.InstallDeployment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "GSuiteAddOnsClient", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" - }, - "method": { - "shortName": "InstallDeployment", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.InstallDeployment", - "service": { - "shortName": "GSuiteAddOns", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" - } - } - } - }, - { - "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_UninstallDeployment_async", - "title": "GSuiteAddOns uninstallDeployment Sample", - "origin": "API_DEFINITION", - "description": " Uninstalls a developer mode deployment. See: https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons.", - "canonical": true, - "file": "g_suite_add_ons.uninstall_deployment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UninstallDeployment", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.UninstallDeployment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "GSuiteAddOnsClient", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" - }, - "method": { - "shortName": "UninstallDeployment", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.UninstallDeployment", - "service": { - "shortName": "GSuiteAddOns", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" - } - } - } - }, - { - "regionTag": "gsuiteaddons_v1_generated_GSuiteAddOns_GetInstallStatus_async", - "title": "GSuiteAddOns getInstallStatus Sample", - "origin": "API_DEFINITION", - "description": " Fetches the install status of a developer mode deployment.", - "canonical": true, - "file": "g_suite_add_ons.get_install_status.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetInstallStatus", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.GetInstallStatus", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.gsuiteaddons.v1.InstallStatus", - "client": { - "shortName": "GSuiteAddOnsClient", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOnsClient" - }, - "method": { - "shortName": "GetInstallStatus", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns.GetInstallStatus", - "service": { - "shortName": "GSuiteAddOns", - "fullName": "google.cloud.gsuiteaddons.v1.GSuiteAddOns" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/index.ts b/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/index.ts deleted file mode 100644 index 9af1817a2fc..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/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 v1 from './v1'; -const GSuiteAddOnsClient = v1.GSuiteAddOnsClient; -type GSuiteAddOnsClient = v1.GSuiteAddOnsClient; -export {v1, GSuiteAddOnsClient}; -export default {v1, GSuiteAddOnsClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_client.ts b/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_client.ts deleted file mode 100644 index 276cf72461e..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_client.ts +++ /dev/null @@ -1,1266 +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/g_suite_add_ons_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './g_suite_add_ons_client_config.json'; -const version = require('../../../package.json').version; - -/** - * A service for managing Google Workspace Add-ons deployments. - * - * A Google Workspace Add-on is a third-party embedded component that can be - * installed in Google Workspace Applications like Gmail, Calendar, Drive, and - * the Google Docs, Sheets, and Slides editors. Google Workspace Add-ons can - * display UI cards, receive contextual information from the host application, - * and perform actions in the host application (See: - * https://developers.google.com/gsuite/add-ons/overview for more information). - * - * A Google Workspace Add-on deployment resource specifies metadata about the - * add-on, including a specification of the entry points in the host application - * that trigger add-on executions (see: - * https://developers.google.com/gsuite/add-ons/concepts/gsuite-manifests). - * Add-on deployments defined via the Google Workspace Add-ons API define their - * entrypoints using HTTPS URLs (See: - * https://developers.google.com/gsuite/add-ons/guides/alternate-runtimes), - * - * A Google Workspace Add-on deployment can be installed in developer mode, - * which allows an add-on developer to test the experience an end-user would see - * when installing and running the add-on in their G Suite applications. When - * running in developer mode, more detailed error messages are exposed in the - * add-on UI to aid in debugging. - * - * A Google Workspace Add-on deployment can be published to Google Workspace - * Marketplace, which allows other Google Workspace users to discover and - * install the add-on. See: - * https://developers.google.com/gsuite/add-ons/how-tos/publish-add-on-overview - * for details. - * @class - * @memberof v1 - */ -export class GSuiteAddOnsClient { - 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}; - gSuiteAddOnsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of GSuiteAddOnsClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 GSuiteAddOnsClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof GSuiteAddOnsClient; - 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 { - 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 = { - authorizationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/authorization' - ), - deploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/deployments/{deployment}' - ), - installStatusPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/deployments/{deployment}/installStatus' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - }; - - // 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 = { - listDeployments: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'deployments') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.gsuiteaddons.v1.GSuiteAddOns', 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.gSuiteAddOnsStub) { - return this.gSuiteAddOnsStub; - } - - // Put together the "service stub" for - // google.cloud.gsuiteaddons.v1.GSuiteAddOns. - this.gSuiteAddOnsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.gsuiteaddons.v1.GSuiteAddOns') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.gsuiteaddons.v1.GSuiteAddOns, - 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 gSuiteAddOnsStubMethods = - ['getAuthorization', 'createDeployment', 'replaceDeployment', 'getDeployment', 'listDeployments', 'deleteDeployment', 'installDeployment', 'uninstallDeployment', 'getInstallStatus']; - for (const methodName of gSuiteAddOnsStubMethods) { - const callPromise = this.gSuiteAddOnsStub.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.gSuiteAddOnsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'gsuiteaddons.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 'gsuiteaddons.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 -- - // ------------------- -/** - * Gets the authorization information for deployments in a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the project for which to get the Google Workspace Add-ons - * authorization information. - * - * Example: `projects/my_project/authorization`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gsuiteaddons.v1.Authorization|Authorization}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/g_suite_add_ons.get_authorization.js - * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_GetAuthorization_async - */ - getAuthorization( - request?: protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gsuiteaddons.v1.IAuthorization, - protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest|undefined, {}|undefined - ]>; - getAuthorization( - request: protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gsuiteaddons.v1.IAuthorization, - protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest|null|undefined, - {}|null|undefined>): void; - getAuthorization( - request: protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest, - callback: Callback< - protos.google.cloud.gsuiteaddons.v1.IAuthorization, - protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest|null|undefined, - {}|null|undefined>): void; - getAuthorization( - request?: protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gsuiteaddons.v1.IAuthorization, - protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gsuiteaddons.v1.IAuthorization, - protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gsuiteaddons.v1.IAuthorization, - protos.google.cloud.gsuiteaddons.v1.IGetAuthorizationRequest|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.getAuthorization(request, options, callback); - } -/** - * Creates a deployment with the specified name and configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the project in which to create the deployment. - * - * Example: `projects/my_project`. - * @param {string} request.deploymentId - * Required. The id to use for this deployment. The full name of the created - * resource will be `projects//deployments/`. - * @param {google.cloud.gsuiteaddons.v1.Deployment} request.deployment - * Required. The deployment to create (deployment.name cannot be set). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gsuiteaddons.v1.Deployment|Deployment}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/g_suite_add_ons.create_deployment.js - * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_CreateDeployment_async - */ - createDeployment( - request?: protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest|undefined, {}|undefined - ]>; - createDeployment( - request: protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest|null|undefined, - {}|null|undefined>): void; - createDeployment( - request: protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest, - callback: Callback< - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest|null|undefined, - {}|null|undefined>): void; - createDeployment( - request?: protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.ICreateDeploymentRequest|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.createDeployment(request, options, callback); - } -/** - * Creates or replaces a deployment with the specified name. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.gsuiteaddons.v1.Deployment} request.deployment - * Required. The deployment to create or replace. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gsuiteaddons.v1.Deployment|Deployment}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/g_suite_add_ons.replace_deployment.js - * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_ReplaceDeployment_async - */ - replaceDeployment( - request?: protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest|undefined, {}|undefined - ]>; - replaceDeployment( - request: protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest|null|undefined, - {}|null|undefined>): void; - replaceDeployment( - request: protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest, - callback: Callback< - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest|null|undefined, - {}|null|undefined>): void; - replaceDeployment( - request?: protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.IReplaceDeploymentRequest|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({ - 'deployment.name': request.deployment!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.replaceDeployment(request, options, callback); - } -/** - * Gets the deployment with the specified name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the deployment to get. - * - * Example: `projects/my_project/deployments/my_deployment`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gsuiteaddons.v1.Deployment|Deployment}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/g_suite_add_ons.get_deployment.js - * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_GetDeployment_async - */ - getDeployment( - request?: protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest|undefined, {}|undefined - ]>; - getDeployment( - request: protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest|null|undefined, - {}|null|undefined>): void; - getDeployment( - request: protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest, - callback: Callback< - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest|null|undefined, - {}|null|undefined>): void; - getDeployment( - request?: protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gsuiteaddons.v1.IDeployment, - protos.google.cloud.gsuiteaddons.v1.IGetDeploymentRequest|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.getDeployment(request, options, callback); - } -/** - * Deletes the deployment with the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the deployment to delete. - * - * Example: `projects/my_project/deployments/my_deployment`. - * @param {string} request.etag - * The etag of the deployment to delete. - * If this is provided, it must match the server's 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 protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/g_suite_add_ons.delete_deployment.js - * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_DeleteDeployment_async - */ - deleteDeployment( - request?: protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest|undefined, {}|undefined - ]>; - deleteDeployment( - request: protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest|null|undefined, - {}|null|undefined>): void; - deleteDeployment( - request: protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest|null|undefined, - {}|null|undefined>): void; - deleteDeployment( - request?: protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IDeleteDeploymentRequest|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.deleteDeployment(request, options, callback); - } -/** - * Installs a deployment in developer mode. - * See: - * https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the deployment to install. - * - * Example: `projects/my_project/deployments/my_deployment`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/g_suite_add_ons.install_deployment.js - * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_InstallDeployment_async - */ - installDeployment( - request?: protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest|undefined, {}|undefined - ]>; - installDeployment( - request: protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest|null|undefined, - {}|null|undefined>): void; - installDeployment( - request: protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest|null|undefined, - {}|null|undefined>): void; - installDeployment( - request?: protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IInstallDeploymentRequest|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.installDeployment(request, options, callback); - } -/** - * Uninstalls a developer mode deployment. - * See: - * https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the deployment to install. - * - * Example: `projects/my_project/deployments/my_deployment`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/g_suite_add_ons.uninstall_deployment.js - * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_UninstallDeployment_async - */ - uninstallDeployment( - request?: protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest|undefined, {}|undefined - ]>; - uninstallDeployment( - request: protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest|null|undefined, - {}|null|undefined>): void; - uninstallDeployment( - request: protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest|null|undefined, - {}|null|undefined>): void; - uninstallDeployment( - request?: protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.gsuiteaddons.v1.IUninstallDeploymentRequest|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.uninstallDeployment(request, options, callback); - } -/** - * Fetches the install status of a developer mode deployment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the deployment. - * - * Example: `projects/my_project/deployments/my_deployment/installStatus`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.gsuiteaddons.v1.InstallStatus|InstallStatus}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/g_suite_add_ons.get_install_status.js - * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_GetInstallStatus_async - */ - getInstallStatus( - request?: protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gsuiteaddons.v1.IInstallStatus, - protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest|undefined, {}|undefined - ]>; - getInstallStatus( - request: protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.gsuiteaddons.v1.IInstallStatus, - protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest|null|undefined, - {}|null|undefined>): void; - getInstallStatus( - request: protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest, - callback: Callback< - protos.google.cloud.gsuiteaddons.v1.IInstallStatus, - protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest|null|undefined, - {}|null|undefined>): void; - getInstallStatus( - request?: protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.gsuiteaddons.v1.IInstallStatus, - protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.gsuiteaddons.v1.IInstallStatus, - protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.gsuiteaddons.v1.IInstallStatus, - protos.google.cloud.gsuiteaddons.v1.IGetInstallStatusRequest|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.getInstallStatus(request, options, callback); - } - - /** - * Lists all deployments in a particular project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the project in which to create the deployment. - * - * Example: `projects/my_project`. - * @param {number} request.pageSize - * The maximum number of deployments to return. The service may return fewer - * than this value. - * If unspecified, at most 1000 deployments 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 `ListDeployments` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListDeployments` 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 protos.google.cloud.gsuiteaddons.v1.Deployment|Deployment}. - * 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 `listDeploymentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDeployments( - request?: protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.gsuiteaddons.v1.IDeployment[], - protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest|null, - protos.google.cloud.gsuiteaddons.v1.IListDeploymentsResponse - ]>; - listDeployments( - request: protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, - protos.google.cloud.gsuiteaddons.v1.IListDeploymentsResponse|null|undefined, - protos.google.cloud.gsuiteaddons.v1.IDeployment>): void; - listDeployments( - request: protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, - callback: PaginationCallback< - protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, - protos.google.cloud.gsuiteaddons.v1.IListDeploymentsResponse|null|undefined, - protos.google.cloud.gsuiteaddons.v1.IDeployment>): void; - listDeployments( - request?: protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, - protos.google.cloud.gsuiteaddons.v1.IListDeploymentsResponse|null|undefined, - protos.google.cloud.gsuiteaddons.v1.IDeployment>, - callback?: PaginationCallback< - protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, - protos.google.cloud.gsuiteaddons.v1.IListDeploymentsResponse|null|undefined, - protos.google.cloud.gsuiteaddons.v1.IDeployment>): - Promise<[ - protos.google.cloud.gsuiteaddons.v1.IDeployment[], - protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest|null, - protos.google.cloud.gsuiteaddons.v1.IListDeploymentsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listDeployments(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. Name of the project in which to create the deployment. - * - * Example: `projects/my_project`. - * @param {number} request.pageSize - * The maximum number of deployments to return. The service may return fewer - * than this value. - * If unspecified, at most 1000 deployments 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 `ListDeployments` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListDeployments` 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 protos.google.cloud.gsuiteaddons.v1.Deployment|Deployment} 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 `listDeploymentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDeploymentsStream( - request?: protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, - 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['listDeployments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDeployments.createStream( - this.innerApiCalls.listDeployments as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDeployments`, 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. Name of the project in which to create the deployment. - * - * Example: `projects/my_project`. - * @param {number} request.pageSize - * The maximum number of deployments to return. The service may return fewer - * than this value. - * If unspecified, at most 1000 deployments 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 `ListDeployments` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListDeployments` 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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.gsuiteaddons.v1.Deployment|Deployment}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/g_suite_add_ons.list_deployments.js - * region_tag:gsuiteaddons_v1_generated_GSuiteAddOns_ListDeployments_async - */ - listDeploymentsAsync( - request?: protos.google.cloud.gsuiteaddons.v1.IListDeploymentsRequest, - 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['listDeployments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDeployments.asyncIterate( - this.innerApiCalls['listDeployments'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified authorization resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - authorizationPath(project:string) { - return this.pathTemplates.authorizationPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Authorization resource. - * - * @param {string} authorizationName - * A fully-qualified path representing Authorization resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAuthorizationName(authorizationName: string) { - return this.pathTemplates.authorizationPathTemplate.match(authorizationName).project; - } - - /** - * Return a fully-qualified deployment resource name string. - * - * @param {string} project - * @param {string} deployment - * @returns {string} Resource name string. - */ - deploymentPath(project:string,deployment:string) { - return this.pathTemplates.deploymentPathTemplate.render({ - project: project, - deployment: deployment, - }); - } - - /** - * Parse the project from Deployment resource. - * - * @param {string} deploymentName - * A fully-qualified path representing Deployment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDeploymentName(deploymentName: string) { - return this.pathTemplates.deploymentPathTemplate.match(deploymentName).project; - } - - /** - * Parse the deployment from Deployment resource. - * - * @param {string} deploymentName - * A fully-qualified path representing Deployment resource. - * @returns {string} A string representing the deployment. - */ - matchDeploymentFromDeploymentName(deploymentName: string) { - return this.pathTemplates.deploymentPathTemplate.match(deploymentName).deployment; - } - - /** - * Return a fully-qualified installStatus resource name string. - * - * @param {string} project - * @param {string} deployment - * @returns {string} Resource name string. - */ - installStatusPath(project:string,deployment:string) { - return this.pathTemplates.installStatusPathTemplate.render({ - project: project, - deployment: deployment, - }); - } - - /** - * Parse the project from InstallStatus resource. - * - * @param {string} installStatusName - * A fully-qualified path representing InstallStatus resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstallStatusName(installStatusName: string) { - return this.pathTemplates.installStatusPathTemplate.match(installStatusName).project; - } - - /** - * Parse the deployment from InstallStatus resource. - * - * @param {string} installStatusName - * A fully-qualified path representing InstallStatus resource. - * @returns {string} A string representing the deployment. - */ - matchDeploymentFromInstallStatusName(installStatusName: string) { - return this.pathTemplates.installStatusPathTemplate.match(installStatusName).deployment; - } - - /** - * 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; - } - - /** - * 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.gSuiteAddOnsStub && !this._terminated) { - return this.gSuiteAddOnsStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_client_config.json b/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_client_config.json deleted file mode 100644 index 94cbce58751..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_client_config.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "interfaces": { - "google.cloud.gsuiteaddons.v1.GSuiteAddOns": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unknown_unavailable": [ - "UNKNOWN", - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetAuthorization": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateDeployment": { - "timeout_millis": 10000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReplaceDeployment": { - "timeout_millis": 10000, - "retry_codes_name": "unknown_unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetDeployment": { - "timeout_millis": 10000, - "retry_codes_name": "unknown_unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListDeployments": { - "timeout_millis": 10000, - "retry_codes_name": "unknown_unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteDeployment": { - "timeout_millis": 10000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "InstallDeployment": { - "timeout_millis": 10000, - "retry_codes_name": "unknown_unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UninstallDeployment": { - "timeout_millis": 10000, - "retry_codes_name": "unknown_unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetInstallStatus": { - "timeout_millis": 10000, - "retry_codes_name": "unknown_unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_proto_list.json b/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_proto_list.json deleted file mode 100644 index 754b641cc0b..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/g_suite_add_ons_proto_list.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - "../../protos/google/apps/script/type/addon_widget_set.proto", - "../../protos/google/apps/script/type/calendar/calendar_addon_manifest.proto", - "../../protos/google/apps/script/type/docs/docs_addon_manifest.proto", - "../../protos/google/apps/script/type/drive/drive_addon_manifest.proto", - "../../protos/google/apps/script/type/extension_point.proto", - "../../protos/google/apps/script/type/gmail/gmail_addon_manifest.proto", - "../../protos/google/apps/script/type/script_manifest.proto", - "../../protos/google/apps/script/type/sheets/sheets_addon_manifest.proto", - "../../protos/google/apps/script/type/slides/slides_addon_manifest.proto", - "../../protos/google/cloud/gsuiteaddons/v1/gsuiteaddons.proto" -] diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/gapic_metadata.json deleted file mode 100644 index acc05a47b13..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.gsuiteaddons.v1", - "libraryPackage": "@google-cloud/gsuiteaddons", - "services": { - "GSuiteAddOns": { - "clients": { - "grpc": { - "libraryClient": "GSuiteAddOnsClient", - "rpcs": { - "GetAuthorization": { - "methods": [ - "getAuthorization" - ] - }, - "CreateDeployment": { - "methods": [ - "createDeployment" - ] - }, - "ReplaceDeployment": { - "methods": [ - "replaceDeployment" - ] - }, - "GetDeployment": { - "methods": [ - "getDeployment" - ] - }, - "DeleteDeployment": { - "methods": [ - "deleteDeployment" - ] - }, - "InstallDeployment": { - "methods": [ - "installDeployment" - ] - }, - "UninstallDeployment": { - "methods": [ - "uninstallDeployment" - ] - }, - "GetInstallStatus": { - "methods": [ - "getInstallStatus" - ] - }, - "ListDeployments": { - "methods": [ - "listDeployments", - "listDeploymentsStream", - "listDeploymentsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "GSuiteAddOnsClient", - "rpcs": { - "GetAuthorization": { - "methods": [ - "getAuthorization" - ] - }, - "CreateDeployment": { - "methods": [ - "createDeployment" - ] - }, - "ReplaceDeployment": { - "methods": [ - "replaceDeployment" - ] - }, - "GetDeployment": { - "methods": [ - "getDeployment" - ] - }, - "DeleteDeployment": { - "methods": [ - "deleteDeployment" - ] - }, - "InstallDeployment": { - "methods": [ - "installDeployment" - ] - }, - "UninstallDeployment": { - "methods": [ - "uninstallDeployment" - ] - }, - "GetInstallStatus": { - "methods": [ - "getInstallStatus" - ] - }, - "ListDeployments": { - "methods": [ - "listDeployments", - "listDeploymentsStream", - "listDeploymentsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/index.ts deleted file mode 100644 index 36f1fdcb19a..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/src/v1/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 {GSuiteAddOnsClient} from './g_suite_add_ons_client'; diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 96d5d6843a3..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/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 gsuiteaddons = require('@google-cloud/gsuiteaddons'); - -function main() { - const gSuiteAddOnsClient = new gsuiteaddons.GSuiteAddOnsClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 681a0d8e56d..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/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 {GSuiteAddOnsClient} from '@google-cloud/gsuiteaddons'; - -// check that the client class type name can be used -function doStuffWithGSuiteAddOnsClient(client: GSuiteAddOnsClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const gSuiteAddOnsClient = new GSuiteAddOnsClient(); - doStuffWithGSuiteAddOnsClient(gSuiteAddOnsClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/install.ts b/owl-bot-staging/google-cloud-gsuiteaddons/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/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-gsuiteaddons/v1/test/gapic_g_suite_add_ons_v1.ts b/owl-bot-staging/google-cloud-gsuiteaddons/v1/test/gapic_g_suite_add_ons_v1.ts deleted file mode 100644 index 0fce254e3fb..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/v1/test/gapic_g_suite_add_ons_v1.ts +++ /dev/null @@ -1,1449 +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 gsuiteaddonsModule 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.GSuiteAddOnsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = gsuiteaddonsModule.v1.GSuiteAddOnsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = gsuiteaddonsModule.v1.GSuiteAddOnsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = gsuiteaddonsModule.v1.GSuiteAddOnsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.gSuiteAddOnsStub, undefined); - await client.initialize(); - assert(client.gSuiteAddOnsStub); - }); - - it('has close method for the initialized client', done => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.gSuiteAddOnsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.gSuiteAddOnsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - 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 gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - 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('getAuthorization', () => { - it('invokes getAuthorization without error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.GetAuthorizationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetAuthorizationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.Authorization() - ); - client.innerApiCalls.getAuthorization = stubSimpleCall(expectedResponse); - const [response] = await client.getAuthorization(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAuthorization as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthorization as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAuthorization without error using callback', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.GetAuthorizationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetAuthorizationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.Authorization() - ); - client.innerApiCalls.getAuthorization = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAuthorization( - request, - (err?: Error|null, result?: protos.google.cloud.gsuiteaddons.v1.IAuthorization|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAuthorization as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthorization as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAuthorization with error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.GetAuthorizationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetAuthorizationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAuthorization = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAuthorization(request), expectedError); - const actualRequest = (client.innerApiCalls.getAuthorization as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthorization as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAuthorization with closed client', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.GetAuthorizationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetAuthorizationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAuthorization(request), expectedError); - }); - }); - - describe('createDeployment', () => { - it('invokes createDeployment without error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.CreateDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.CreateDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.Deployment() - ); - client.innerApiCalls.createDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.createDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDeployment without error using callback', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.CreateDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.CreateDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.Deployment() - ); - client.innerApiCalls.createDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDeployment( - request, - (err?: Error|null, result?: protos.google.cloud.gsuiteaddons.v1.IDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDeployment with error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.CreateDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.CreateDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.createDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDeployment with closed client', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.CreateDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.CreateDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createDeployment(request), expectedError); - }); - }); - - describe('replaceDeployment', () => { - it('invokes replaceDeployment without error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest() - ); - request.deployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest', ['deployment', 'name']); - request.deployment.name = defaultValue1; - const expectedHeaderRequestParams = `deployment.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.Deployment() - ); - client.innerApiCalls.replaceDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.replaceDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.replaceDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceDeployment without error using callback', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest() - ); - request.deployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest', ['deployment', 'name']); - request.deployment.name = defaultValue1; - const expectedHeaderRequestParams = `deployment.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.Deployment() - ); - client.innerApiCalls.replaceDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.replaceDeployment( - request, - (err?: Error|null, result?: protos.google.cloud.gsuiteaddons.v1.IDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.replaceDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceDeployment with error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest() - ); - request.deployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest', ['deployment', 'name']); - request.deployment.name = defaultValue1; - const expectedHeaderRequestParams = `deployment.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.replaceDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.replaceDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.replaceDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceDeployment with closed client', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest() - ); - request.deployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ReplaceDeploymentRequest', ['deployment', 'name']); - request.deployment.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.replaceDeployment(request), expectedError); - }); - }); - - describe('getDeployment', () => { - it('invokes getDeployment without error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.GetDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.Deployment() - ); - client.innerApiCalls.getDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.getDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDeployment without error using callback', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.GetDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.Deployment() - ); - client.innerApiCalls.getDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDeployment( - request, - (err?: Error|null, result?: protos.google.cloud.gsuiteaddons.v1.IDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDeployment with error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.GetDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.getDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDeployment with closed client', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.GetDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getDeployment(request), expectedError); - }); - }); - - describe('deleteDeployment', () => { - it('invokes deleteDeployment without error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDeployment without error using callback', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDeployment( - 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.deleteDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDeployment with error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDeployment with closed client', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.DeleteDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteDeployment(request), expectedError); - }); - }); - - describe('installDeployment', () => { - it('invokes installDeployment without error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.InstallDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.InstallDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.installDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.installDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.installDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.installDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes installDeployment without error using callback', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.InstallDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.InstallDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.installDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.installDeployment( - 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.installDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.installDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes installDeployment with error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.InstallDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.InstallDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.installDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.installDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.installDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.installDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes installDeployment with closed client', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.InstallDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.InstallDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.installDeployment(request), expectedError); - }); - }); - - describe('uninstallDeployment', () => { - it('invokes uninstallDeployment without error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.uninstallDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.uninstallDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.uninstallDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.uninstallDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes uninstallDeployment without error using callback', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.uninstallDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.uninstallDeployment( - 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.uninstallDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.uninstallDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes uninstallDeployment with error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.uninstallDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.uninstallDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.uninstallDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.uninstallDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes uninstallDeployment with closed client', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.UninstallDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.uninstallDeployment(request), expectedError); - }); - }); - - describe('getInstallStatus', () => { - it('invokes getInstallStatus without error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.GetInstallStatusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetInstallStatusRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.InstallStatus() - ); - client.innerApiCalls.getInstallStatus = stubSimpleCall(expectedResponse); - const [response] = await client.getInstallStatus(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInstallStatus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstallStatus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstallStatus without error using callback', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.GetInstallStatusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetInstallStatusRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.InstallStatus() - ); - client.innerApiCalls.getInstallStatus = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInstallStatus( - request, - (err?: Error|null, result?: protos.google.cloud.gsuiteaddons.v1.IInstallStatus|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInstallStatus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstallStatus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstallStatus with error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.GetInstallStatusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetInstallStatusRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInstallStatus = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInstallStatus(request), expectedError); - const actualRequest = (client.innerApiCalls.getInstallStatus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstallStatus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstallStatus with closed client', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.GetInstallStatusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.GetInstallStatusRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getInstallStatus(request), expectedError); - }); - }); - - describe('listDeployments', () => { - it('invokes listDeployments without error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), - generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), - generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), - ]; - client.innerApiCalls.listDeployments = stubSimpleCall(expectedResponse); - const [response] = await client.listDeployments(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeployments without error using callback', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), - generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), - generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), - ]; - client.innerApiCalls.listDeployments = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDeployments( - request, - (err?: Error|null, result?: protos.google.cloud.gsuiteaddons.v1.IDeployment[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeployments with error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDeployments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDeployments(request), expectedError); - const actualRequest = (client.innerApiCalls.listDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeploymentsStream without error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), - generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), - generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), - ]; - client.descriptors.page.listDeployments.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDeploymentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gsuiteaddons.v1.Deployment[] = []; - stream.on('data', (response: protos.google.cloud.gsuiteaddons.v1.Deployment) => { - 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.listDeployments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDeployments, request)); - assert( - (client.descriptors.page.listDeployments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDeploymentsStream with error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDeployments.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDeploymentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.gsuiteaddons.v1.Deployment[] = []; - stream.on('data', (response: protos.google.cloud.gsuiteaddons.v1.Deployment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDeployments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDeployments, request)); - assert( - (client.descriptors.page.listDeployments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDeployments without error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), - generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), - generateSampleMessage(new protos.google.cloud.gsuiteaddons.v1.Deployment()), - ]; - client.descriptors.page.listDeployments.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.gsuiteaddons.v1.IDeployment[] = []; - const iterable = client.listDeploymentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDeployments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDeployments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDeployments with error', async () => { - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.gsuiteaddons.v1.ListDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDeployments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDeploymentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.gsuiteaddons.v1.IDeployment[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDeployments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDeployments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('authorization', () => { - const fakePath = "/rendered/path/authorization"; - const expectedParameters = { - project: "projectValue", - }; - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.authorizationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPath', () => { - const result = client.authorizationPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthorizationName', () => { - const result = client.matchProjectFromAuthorizationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('deployment', () => { - const fakePath = "/rendered/path/deployment"; - const expectedParameters = { - project: "projectValue", - deployment: "deploymentValue", - }; - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.deploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.deploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('deploymentPath', () => { - const result = client.deploymentPath("projectValue", "deploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.deploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDeploymentName', () => { - const result = client.matchProjectFromDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.deploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeploymentFromDeploymentName', () => { - const result = client.matchDeploymentFromDeploymentName(fakePath); - assert.strictEqual(result, "deploymentValue"); - assert((client.pathTemplates.deploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('installStatus', () => { - const fakePath = "/rendered/path/installStatus"; - const expectedParameters = { - project: "projectValue", - deployment: "deploymentValue", - }; - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.installStatusPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.installStatusPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('installStatusPath', () => { - const result = client.installStatusPath("projectValue", "deploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.installStatusPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstallStatusName', () => { - const result = client.matchProjectFromInstallStatusName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.installStatusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeploymentFromInstallStatusName', () => { - const result = client.matchDeploymentFromInstallStatusName(fakePath); - assert.strictEqual(result, "deploymentValue"); - assert((client.pathTemplates.installStatusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new gsuiteaddonsModule.v1.GSuiteAddOnsClient({ - 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)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-gsuiteaddons/v1/tsconfig.json b/owl-bot-staging/google-cloud-gsuiteaddons/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/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-gsuiteaddons/v1/webpack.config.js b/owl-bot-staging/google-cloud-gsuiteaddons/v1/webpack.config.js deleted file mode 100644 index b973152f807..00000000000 --- a/owl-bot-staging/google-cloud-gsuiteaddons/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: 'GSuiteAddOns', - filename: './g-suite-add-ons.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/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/package.json b/owl-bot-staging/google-cloud-iap/v1/package.json deleted file mode 100644 index d623366fc39..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/package.json +++ /dev/null @@ -1,59 +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", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} 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 dd14ced3422..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/protos/google/cloud/iap/v1/service.proto +++ /dev/null @@ -1,736 +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 -// -// 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; - - 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 { - // An output credential is required. - 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. A maximum of - // 45 attributes can be selected. Expressions can select different attribute - // types from `attributes`: `attributes.saml_attributes`, - // `attributes.iap_attributes`. The following 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()`: Ignores the `x-goog-iap-attr-` prefix - // for the provided `` when propagating with the `HEADER` output - // credential, such as request headers. - // - // - append `.append()` OR - // `.append()`: Appends the provided `` or - // `` to 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 a2a0397c665..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 = ['abc','def'] - - // 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 ab25f4ea6ea..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client.ts +++ /dev/null @@ -1,1338 +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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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: true}, 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 { - 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 protos.google.iam.v1.Policy|Policy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.google.iam.v1.Policy|Policy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.google.iam.v1.TestIamPermissionsResponse|TestIamPermissionsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.google.cloud.iap.v1.IapSettings|IapSettings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.google.cloud.iap.v1.IapSettings|IapSettings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.google.cloud.iap.v1.TunnelDestGroup|TunnelDestGroup}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.google.cloud.iap.v1.TunnelDestGroup|TunnelDestGroup}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.google.cloud.iap.v1.TunnelDestGroup|TunnelDestGroup}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * 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 protos.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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * 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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * 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 c4f456a6460..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client.ts +++ /dev/null @@ -1,1160 +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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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: true}, 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 { - 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 protos.google.cloud.iap.v1.ListBrandsResponse|ListBrandsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.google.cloud.iap.v1.Brand|Brand}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.google.cloud.iap.v1.Brand|Brand}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.google.cloud.iap.v1.IdentityAwareProxyClient|IdentityAwareProxyClient}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.google.cloud.iap.v1.IdentityAwareProxyClient|IdentityAwareProxyClient}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.google.cloud.iap.v1.IdentityAwareProxyClient|IdentityAwareProxyClient}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * 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 protos.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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * 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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * 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/package.json b/owl-bot-staging/google-cloud-iap/v1beta1/package.json deleted file mode 100644 index 08796e790aa..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/package.json +++ /dev/null @@ -1,58 +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", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} 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 2254f97144e..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 = ['abc','def'] - - // 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 22063c6f014..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts +++ /dev/null @@ -1,549 +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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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: true}, 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 { - 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 protos.google.iam.v1.Policy|Policy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.google.iam.v1.Policy|Policy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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 protos.google.iam.v1.TestIamPermissionsResponse|TestIamPermissionsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * 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/owl-bot-staging/google-cloud-ids/v1/.eslintignore b/owl-bot-staging/google-cloud-ids/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-ids/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-ids/v1/.eslintrc.json b/owl-bot-staging/google-cloud-ids/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-ids/v1/.gitignore b/owl-bot-staging/google-cloud-ids/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-ids/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-ids/v1/.jsdoc.js b/owl-bot-staging/google-cloud-ids/v1/.jsdoc.js deleted file mode 100644 index baabf743820..00000000000 --- a/owl-bot-staging/google-cloud-ids/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/ids', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-ids/v1/.mocharc.js b/owl-bot-staging/google-cloud-ids/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-ids/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-ids/v1/.prettierrc.js b/owl-bot-staging/google-cloud-ids/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-ids/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-ids/v1/README.md b/owl-bot-staging/google-cloud-ids/v1/README.md deleted file mode 100644 index d6b39ef50b6..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Ids: Nodejs Client diff --git a/owl-bot-staging/google-cloud-ids/v1/package.json b/owl-bot-staging/google-cloud-ids/v1/package.json deleted file mode 100644 index 8dedb766e3a..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/ids", - "version": "0.1.0", - "description": "Ids client for Node.js", - "repository": "googleapis/nodejs-ids", - "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 ids", - "ids", - "i d s" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-ids/v1/protos/google/cloud/ids/v1/ids.proto b/owl-bot-staging/google-cloud-ids/v1/protos/google/cloud/ids/v1/ids.proto deleted file mode 100644 index bad61be32e0..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/protos/google/cloud/ids/v1/ids.proto +++ /dev/null @@ -1,296 +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.ids.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/ids/apiv1/idspb;idspb"; -option java_multiple_files = true; -option java_outer_classname = "IdsProto"; -option java_package = "com.google.cloud.ids.v1"; -option ruby_package = "Google::Cloud::IDS::V1"; - -// The IDS Service -service IDS { - option (google.api.default_host) = "ids.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists Endpoints in a given project and location. - rpc ListEndpoints(ListEndpointsRequest) returns (ListEndpointsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/endpoints" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single Endpoint. - rpc GetEndpoint(GetEndpointRequest) returns (Endpoint) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/endpoints/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new Endpoint in a given project and location. - rpc CreateEndpoint(CreateEndpointRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/endpoints" - body: "endpoint" - }; - option (google.api.method_signature) = "parent,endpoint,endpoint_id"; - option (google.longrunning.operation_info) = { - response_type: "Endpoint" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a single Endpoint. - rpc DeleteEndpoint(DeleteEndpointRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/endpoints/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } -} - -// Endpoint describes a single IDS endpoint. It defines a forwarding rule to -// which packets can be sent for IDS inspection. -message Endpoint { - option (google.api.resource) = { - type: "ids.googleapis.com/Endpoint" - pattern: "projects/{project}/locations/{location}/endpoints/{endpoint}" - }; - - // Threat severity levels. - enum Severity { - // Not set. - SEVERITY_UNSPECIFIED = 0; - - // Informational alerts. - INFORMATIONAL = 1; - - // Low severity alerts. - LOW = 2; - - // Medium severity alerts. - MEDIUM = 3; - - // High severity alerts. - HIGH = 4; - - // Critical severity alerts. - CRITICAL = 5; - } - - // Endpoint state - enum State { - // Not set. - STATE_UNSPECIFIED = 0; - - // Being created. - CREATING = 1; - - // Active and ready for traffic. - READY = 2; - - // Being deleted. - DELETING = 3; - } - - // Output only. The name of the endpoint. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The create time timestamp. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The update time timestamp. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The labels of the endpoint. - map labels = 4; - - // Required. The fully qualified URL of the network to which the IDS Endpoint is - // attached. - string network = 5 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The fully qualified URL of the endpoint's ILB Forwarding Rule. - string endpoint_forwarding_rule = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The IP address of the IDS Endpoint's ILB. - string endpoint_ip = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-provided description of the endpoint - string description = 8; - - // Required. Lowest threat severity that this endpoint will alert on. - Severity severity = 9 [(google.api.field_behavior) = REQUIRED]; - - // Output only. Current state of the endpoint. - State state = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Whether the endpoint should report traffic logs in addition to threat logs. - bool traffic_logs = 13; -} - -message ListEndpointsRequest { - // Required. The parent, which owns this collection of endpoints. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "ids.googleapis.com/Endpoint" - } - ]; - - // Optional. The maximum number of endpoints to return. The service may return fewer - // than this value. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous `ListEndpoints` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListEndpoints` must - // match the call that provided the page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter expression, following the syntax outlined in - // https://google.aip.dev/160. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. One or more fields to compare and use to sort the output. - // See https://google.aip.dev/132#ordering. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -message ListEndpointsResponse { - // The list of endpoints response. - repeated Endpoint endpoints = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -message GetEndpointRequest { - // Required. The name of the endpoint to retrieve. - // Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "ids.googleapis.com/Endpoint" - } - ]; -} - -message CreateEndpointRequest { - // Required. The endpoint's parent. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "ids.googleapis.com/Endpoint" - } - ]; - - // Required. The endpoint identifier. This will be part of the endpoint's - // resource name. - // This value must start with a lowercase letter followed by up to 62 - // lowercase letters, numbers, or hyphens, and cannot end with a hyphen. - // Values that do not match this pattern will trigger an INVALID_ARGUMENT - // error. - string endpoint_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The endpoint to create. - Endpoint endpoint = 3 [(google.api.field_behavior) = REQUIRED]; - - // An optional request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4; -} - -message DeleteEndpointRequest { - // Required. The name of the endpoint to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "ids.googleapis.com/Endpoint" - } - ]; - - // An optional request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2; -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.create_endpoint.js b/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.create_endpoint.js deleted file mode 100644 index c4dd1ed5bcf..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.create_endpoint.js +++ /dev/null @@ -1,91 +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, endpointId, endpoint) { - // [START ids_v1_generated_IDS_CreateEndpoint_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 endpoint's parent. - */ - // const parent = 'abc123' - /** - * Required. The endpoint identifier. This will be part of the endpoint's - * resource name. - * This value must start with a lowercase letter followed by up to 62 - * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. - * Values that do not match this pattern will trigger an INVALID_ARGUMENT - * error. - */ - // const endpointId = 'abc123' - /** - * Required. The endpoint to create. - */ - // const endpoint = {} - /** - * An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Ids library - const {IDSClient} = require('@google-cloud/ids').v1; - - // Instantiates a client - const idsClient = new IDSClient(); - - async function callCreateEndpoint() { - // Construct request - const request = { - parent, - endpointId, - endpoint, - }; - - // Run request - const [operation] = await idsClient.createEndpoint(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateEndpoint(); - // [END ids_v1_generated_IDS_CreateEndpoint_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-ids/v1/samples/generated/v1/i_d_s.delete_endpoint.js b/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.delete_endpoint.js deleted file mode 100644 index 39e6c5fd000..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.delete_endpoint.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(name) { - // [START ids_v1_generated_IDS_DeleteEndpoint_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the endpoint to delete. - */ - // const name = 'abc123' - /** - * An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Ids library - const {IDSClient} = require('@google-cloud/ids').v1; - - // Instantiates a client - const idsClient = new IDSClient(); - - async function callDeleteEndpoint() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await idsClient.deleteEndpoint(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteEndpoint(); - // [END ids_v1_generated_IDS_DeleteEndpoint_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-ids/v1/samples/generated/v1/i_d_s.get_endpoint.js b/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.get_endpoint.js deleted file mode 100644 index 172d33a99a6..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.get_endpoint.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 ids_v1_generated_IDS_GetEndpoint_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the endpoint to retrieve. - * Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` - */ - // const name = 'abc123' - - // Imports the Ids library - const {IDSClient} = require('@google-cloud/ids').v1; - - // Instantiates a client - const idsClient = new IDSClient(); - - async function callGetEndpoint() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await idsClient.getEndpoint(request); - console.log(response); - } - - callGetEndpoint(); - // [END ids_v1_generated_IDS_GetEndpoint_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-ids/v1/samples/generated/v1/i_d_s.list_endpoints.js b/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.list_endpoints.js deleted file mode 100644 index b4f663ba94d..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/i_d_s.list_endpoints.js +++ /dev/null @@ -1,85 +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 ids_v1_generated_IDS_ListEndpoints_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 parent, which owns this collection of endpoints. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of endpoints to return. The service may return fewer - * than this value. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous `ListEndpoints` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListEndpoints` must - * match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter expression, following the syntax outlined in - * https://google.aip.dev/160. - */ - // const filter = 'abc123' - /** - * Optional. One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - */ - // const orderBy = 'abc123' - - // Imports the Ids library - const {IDSClient} = require('@google-cloud/ids').v1; - - // Instantiates a client - const idsClient = new IDSClient(); - - async function callListEndpoints() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await idsClient.listEndpointsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListEndpoints(); - // [END ids_v1_generated_IDS_ListEndpoints_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-ids/v1/samples/generated/v1/snippet_metadata_google.cloud.ids.v1.json b/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/snippet_metadata_google.cloud.ids.v1.json deleted file mode 100644 index d9ec4a34a9a..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/samples/generated/v1/snippet_metadata_google.cloud.ids.v1.json +++ /dev/null @@ -1,207 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-ids", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.ids.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "ids_v1_generated_IDS_ListEndpoints_async", - "title": "IDS listEndpoints Sample", - "origin": "API_DEFINITION", - "description": " Lists Endpoints in a given project and location.", - "canonical": true, - "file": "i_d_s.list_endpoints.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListEndpoints", - "fullName": "google.cloud.ids.v1.IDS.ListEndpoints", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.ids.v1.ListEndpointsResponse", - "client": { - "shortName": "IDSClient", - "fullName": "google.cloud.ids.v1.IDSClient" - }, - "method": { - "shortName": "ListEndpoints", - "fullName": "google.cloud.ids.v1.IDS.ListEndpoints", - "service": { - "shortName": "IDS", - "fullName": "google.cloud.ids.v1.IDS" - } - } - } - }, - { - "regionTag": "ids_v1_generated_IDS_GetEndpoint_async", - "title": "IDS getEndpoint Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single Endpoint.", - "canonical": true, - "file": "i_d_s.get_endpoint.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetEndpoint", - "fullName": "google.cloud.ids.v1.IDS.GetEndpoint", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.ids.v1.Endpoint", - "client": { - "shortName": "IDSClient", - "fullName": "google.cloud.ids.v1.IDSClient" - }, - "method": { - "shortName": "GetEndpoint", - "fullName": "google.cloud.ids.v1.IDS.GetEndpoint", - "service": { - "shortName": "IDS", - "fullName": "google.cloud.ids.v1.IDS" - } - } - } - }, - { - "regionTag": "ids_v1_generated_IDS_CreateEndpoint_async", - "title": "IDS createEndpoint Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Endpoint in a given project and location.", - "canonical": true, - "file": "i_d_s.create_endpoint.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateEndpoint", - "fullName": "google.cloud.ids.v1.IDS.CreateEndpoint", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "endpoint_id", - "type": "TYPE_STRING" - }, - { - "name": "endpoint", - "type": ".google.cloud.ids.v1.Endpoint" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "IDSClient", - "fullName": "google.cloud.ids.v1.IDSClient" - }, - "method": { - "shortName": "CreateEndpoint", - "fullName": "google.cloud.ids.v1.IDS.CreateEndpoint", - "service": { - "shortName": "IDS", - "fullName": "google.cloud.ids.v1.IDS" - } - } - } - }, - { - "regionTag": "ids_v1_generated_IDS_DeleteEndpoint_async", - "title": "IDS deleteEndpoint Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single Endpoint.", - "canonical": true, - "file": "i_d_s.delete_endpoint.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteEndpoint", - "fullName": "google.cloud.ids.v1.IDS.DeleteEndpoint", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "IDSClient", - "fullName": "google.cloud.ids.v1.IDSClient" - }, - "method": { - "shortName": "DeleteEndpoint", - "fullName": "google.cloud.ids.v1.IDS.DeleteEndpoint", - "service": { - "shortName": "IDS", - "fullName": "google.cloud.ids.v1.IDS" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-ids/v1/src/index.ts b/owl-bot-staging/google-cloud-ids/v1/src/index.ts deleted file mode 100644 index f7d9e1396da..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/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 v1 from './v1'; -const IDSClient = v1.IDSClient; -type IDSClient = v1.IDSClient; -export {v1, IDSClient}; -export default {v1, IDSClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-ids/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-ids/v1/src/v1/gapic_metadata.json deleted file mode 100644 index e41ca3d5ed9..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.ids.v1", - "libraryPackage": "@google-cloud/ids", - "services": { - "IDS": { - "clients": { - "grpc": { - "libraryClient": "IDSClient", - "rpcs": { - "GetEndpoint": { - "methods": [ - "getEndpoint" - ] - }, - "CreateEndpoint": { - "methods": [ - "createEndpoint" - ] - }, - "DeleteEndpoint": { - "methods": [ - "deleteEndpoint" - ] - }, - "ListEndpoints": { - "methods": [ - "listEndpoints", - "listEndpointsStream", - "listEndpointsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "IDSClient", - "rpcs": { - "GetEndpoint": { - "methods": [ - "getEndpoint" - ] - }, - "CreateEndpoint": { - "methods": [ - "createEndpoint" - ] - }, - "DeleteEndpoint": { - "methods": [ - "deleteEndpoint" - ] - }, - "ListEndpoints": { - "methods": [ - "listEndpoints", - "listEndpointsStream", - "listEndpointsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_client.ts b/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_client.ts deleted file mode 100644 index 7ffa25c39fc..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_client.ts +++ /dev/null @@ -1,967 +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, GrpcClientOptions, LROperation, 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/i_d_s_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './i_d_s_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The IDS Service - * @class - * @memberof v1 - */ -export class IDSClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - iDSStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of IDSClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 IDSClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof IDSClient; - 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 { - 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 = { - endpointPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/endpoints/{endpoint}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - }; - - // 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 = { - listEndpoints: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'endpoints') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/endpoints/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/endpoints/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/endpoints/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createEndpointResponse = protoFilesRoot.lookup( - '.google.cloud.ids.v1.Endpoint') as gax.protobuf.Type; - const createEndpointMetadata = protoFilesRoot.lookup( - '.google.cloud.ids.v1.OperationMetadata') as gax.protobuf.Type; - const deleteEndpointResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteEndpointMetadata = protoFilesRoot.lookup( - '.google.cloud.ids.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createEndpoint: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createEndpointResponse.decode.bind(createEndpointResponse), - createEndpointMetadata.decode.bind(createEndpointMetadata)), - deleteEndpoint: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteEndpointResponse.decode.bind(deleteEndpointResponse), - deleteEndpointMetadata.decode.bind(deleteEndpointMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.ids.v1.IDS', 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.iDSStub) { - return this.iDSStub; - } - - // Put together the "service stub" for - // google.cloud.ids.v1.IDS. - this.iDSStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.ids.v1.IDS') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.ids.v1.IDS, - 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 iDSStubMethods = - ['listEndpoints', 'getEndpoint', 'createEndpoint', 'deleteEndpoint']; - for (const methodName of iDSStubMethods) { - const callPromise = this.iDSStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.iDSStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'ids.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 'ids.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 -- - // ------------------- -/** - * Gets details of a single Endpoint. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the endpoint to retrieve. - * Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.ids.v1.Endpoint|Endpoint}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/i_d_s.get_endpoint.js - * region_tag:ids_v1_generated_IDS_GetEndpoint_async - */ - getEndpoint( - request?: protos.google.cloud.ids.v1.IGetEndpointRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.ids.v1.IEndpoint, - protos.google.cloud.ids.v1.IGetEndpointRequest|undefined, {}|undefined - ]>; - getEndpoint( - request: protos.google.cloud.ids.v1.IGetEndpointRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.ids.v1.IEndpoint, - protos.google.cloud.ids.v1.IGetEndpointRequest|null|undefined, - {}|null|undefined>): void; - getEndpoint( - request: protos.google.cloud.ids.v1.IGetEndpointRequest, - callback: Callback< - protos.google.cloud.ids.v1.IEndpoint, - protos.google.cloud.ids.v1.IGetEndpointRequest|null|undefined, - {}|null|undefined>): void; - getEndpoint( - request?: protos.google.cloud.ids.v1.IGetEndpointRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.ids.v1.IEndpoint, - protos.google.cloud.ids.v1.IGetEndpointRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.ids.v1.IEndpoint, - protos.google.cloud.ids.v1.IGetEndpointRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.ids.v1.IEndpoint, - protos.google.cloud.ids.v1.IGetEndpointRequest|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.getEndpoint(request, options, callback); - } - -/** - * Creates a new Endpoint in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The endpoint's parent. - * @param {string} request.endpointId - * Required. The endpoint identifier. This will be part of the endpoint's - * resource name. - * This value must start with a lowercase letter followed by up to 62 - * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. - * Values that do not match this pattern will trigger an INVALID_ARGUMENT - * error. - * @param {google.cloud.ids.v1.Endpoint} request.endpoint - * Required. The endpoint to create. - * @param {string} request.requestId - * An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/i_d_s.create_endpoint.js - * region_tag:ids_v1_generated_IDS_CreateEndpoint_async - */ - createEndpoint( - request?: protos.google.cloud.ids.v1.ICreateEndpointRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createEndpoint( - request: protos.google.cloud.ids.v1.ICreateEndpointRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createEndpoint( - request: protos.google.cloud.ids.v1.ICreateEndpointRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createEndpoint( - request?: protos.google.cloud.ids.v1.ICreateEndpointRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createEndpoint(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createEndpoint()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/i_d_s.create_endpoint.js - * region_tag:ids_v1_generated_IDS_CreateEndpoint_async - */ - async checkCreateEndpointProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createEndpoint, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single Endpoint. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the endpoint to delete. - * @param {string} request.requestId - * An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/i_d_s.delete_endpoint.js - * region_tag:ids_v1_generated_IDS_DeleteEndpoint_async - */ - deleteEndpoint( - request?: protos.google.cloud.ids.v1.IDeleteEndpointRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteEndpoint( - request: protos.google.cloud.ids.v1.IDeleteEndpointRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteEndpoint( - request: protos.google.cloud.ids.v1.IDeleteEndpointRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteEndpoint( - request?: protos.google.cloud.ids.v1.IDeleteEndpointRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteEndpoint(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteEndpoint()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/i_d_s.delete_endpoint.js - * region_tag:ids_v1_generated_IDS_DeleteEndpoint_async - */ - async checkDeleteEndpointProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteEndpoint, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Endpoints in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of endpoints. - * @param {number} [request.pageSize] - * Optional. The maximum number of endpoints to return. The service may return fewer - * than this value. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListEndpoints` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListEndpoints` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter expression, following the syntax outlined in - * https://google.aip.dev/160. - * @param {string} [request.orderBy] - * Optional. One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.ids.v1.Endpoint|Endpoint}. - * 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 `listEndpointsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listEndpoints( - request?: protos.google.cloud.ids.v1.IListEndpointsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.ids.v1.IEndpoint[], - protos.google.cloud.ids.v1.IListEndpointsRequest|null, - protos.google.cloud.ids.v1.IListEndpointsResponse - ]>; - listEndpoints( - request: protos.google.cloud.ids.v1.IListEndpointsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.ids.v1.IListEndpointsRequest, - protos.google.cloud.ids.v1.IListEndpointsResponse|null|undefined, - protos.google.cloud.ids.v1.IEndpoint>): void; - listEndpoints( - request: protos.google.cloud.ids.v1.IListEndpointsRequest, - callback: PaginationCallback< - protos.google.cloud.ids.v1.IListEndpointsRequest, - protos.google.cloud.ids.v1.IListEndpointsResponse|null|undefined, - protos.google.cloud.ids.v1.IEndpoint>): void; - listEndpoints( - request?: protos.google.cloud.ids.v1.IListEndpointsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.ids.v1.IListEndpointsRequest, - protos.google.cloud.ids.v1.IListEndpointsResponse|null|undefined, - protos.google.cloud.ids.v1.IEndpoint>, - callback?: PaginationCallback< - protos.google.cloud.ids.v1.IListEndpointsRequest, - protos.google.cloud.ids.v1.IListEndpointsResponse|null|undefined, - protos.google.cloud.ids.v1.IEndpoint>): - Promise<[ - protos.google.cloud.ids.v1.IEndpoint[], - protos.google.cloud.ids.v1.IListEndpointsRequest|null, - protos.google.cloud.ids.v1.IListEndpointsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listEndpoints(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of endpoints. - * @param {number} [request.pageSize] - * Optional. The maximum number of endpoints to return. The service may return fewer - * than this value. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListEndpoints` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListEndpoints` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter expression, following the syntax outlined in - * https://google.aip.dev/160. - * @param {string} [request.orderBy] - * Optional. One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 protos.google.cloud.ids.v1.Endpoint|Endpoint} 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 `listEndpointsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listEndpointsStream( - request?: protos.google.cloud.ids.v1.IListEndpointsRequest, - 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['listEndpoints']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listEndpoints.createStream( - this.innerApiCalls.listEndpoints as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listEndpoints`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of endpoints. - * @param {number} [request.pageSize] - * Optional. The maximum number of endpoints to return. The service may return fewer - * than this value. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListEndpoints` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListEndpoints` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter expression, following the syntax outlined in - * https://google.aip.dev/160. - * @param {string} [request.orderBy] - * Optional. One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.ids.v1.Endpoint|Endpoint}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/i_d_s.list_endpoints.js - * region_tag:ids_v1_generated_IDS_ListEndpoints_async - */ - listEndpointsAsync( - request?: protos.google.cloud.ids.v1.IListEndpointsRequest, - 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['listEndpoints']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listEndpoints.asyncIterate( - this.innerApiCalls['listEndpoints'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified endpoint resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} endpoint - * @returns {string} Resource name string. - */ - endpointPath(project:string,location:string,endpoint:string) { - return this.pathTemplates.endpointPathTemplate.render({ - project: project, - location: location, - endpoint: endpoint, - }); - } - - /** - * Parse the project from Endpoint resource. - * - * @param {string} endpointName - * A fully-qualified path representing Endpoint resource. - * @returns {string} A string representing the project. - */ - matchProjectFromEndpointName(endpointName: string) { - return this.pathTemplates.endpointPathTemplate.match(endpointName).project; - } - - /** - * Parse the location from Endpoint resource. - * - * @param {string} endpointName - * A fully-qualified path representing Endpoint resource. - * @returns {string} A string representing the location. - */ - matchLocationFromEndpointName(endpointName: string) { - return this.pathTemplates.endpointPathTemplate.match(endpointName).location; - } - - /** - * Parse the endpoint from Endpoint resource. - * - * @param {string} endpointName - * A fully-qualified path representing Endpoint resource. - * @returns {string} A string representing the endpoint. - */ - matchEndpointFromEndpointName(endpointName: string) { - return this.pathTemplates.endpointPathTemplate.match(endpointName).endpoint; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified 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; - } - - /** - * 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.iDSStub && !this._terminated) { - return this.iDSStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_client_config.json b/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_client_config.json deleted file mode 100644 index 2e35dcd818b..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_client_config.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "interfaces": { - "google.cloud.ids.v1.IDS": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "9442ca297df43f7314712e1a19d003838e738a45": { - "initial_retry_delay_millis": 250, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 32000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListEndpoints": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" - }, - "GetEndpoint": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" - }, - "CreateEndpoint": { - "timeout_millis": 3600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteEndpoint": { - "timeout_millis": 3600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_proto_list.json b/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_proto_list.json deleted file mode 100644 index fcaebb7564e..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/src/v1/i_d_s_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/ids/v1/ids.proto" -] diff --git a/owl-bot-staging/google-cloud-ids/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-ids/v1/src/v1/index.ts deleted file mode 100644 index 4b4cfd637a6..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/src/v1/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 {IDSClient} from './i_d_s_client'; diff --git a/owl-bot-staging/google-cloud-ids/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-ids/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 3df6eab4b7b..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/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 ids = require('@google-cloud/ids'); - -function main() { - const iDSClient = new ids.IDSClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-ids/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-ids/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 0b4b581b456..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/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 {IDSClient} from '@google-cloud/ids'; - -// check that the client class type name can be used -function doStuffWithIDSClient(client: IDSClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const iDSClient = new IDSClient(); - doStuffWithIDSClient(iDSClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-ids/v1/system-test/install.ts b/owl-bot-staging/google-cloud-ids/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-ids/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-ids/v1/test/gapic_i_d_s_v1.ts b/owl-bot-staging/google-cloud-ids/v1/test/gapic_i_d_s_v1.ts deleted file mode 100644 index 32da81ddd45..00000000000 --- a/owl-bot-staging/google-cloud-ids/v1/test/gapic_i_d_s_v1.ts +++ /dev/null @@ -1,991 +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 idsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.IDSClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = idsModule.v1.IDSClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = idsModule.v1.IDSClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = idsModule.v1.IDSClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new idsModule.v1.IDSClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new idsModule.v1.IDSClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.iDSStub, undefined); - await client.initialize(); - assert(client.iDSStub); - }); - - it('has close method for the initialized client', done => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.iDSStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.iDSStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new idsModule.v1.IDSClient({ - 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 idsModule.v1.IDSClient({ - 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('getEndpoint', () => { - it('invokes getEndpoint without error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.GetEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.GetEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.ids.v1.Endpoint() - ); - client.innerApiCalls.getEndpoint = stubSimpleCall(expectedResponse); - const [response] = await client.getEndpoint(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getEndpoint without error using callback', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.GetEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.GetEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.ids.v1.Endpoint() - ); - client.innerApiCalls.getEndpoint = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getEndpoint( - request, - (err?: Error|null, result?: protos.google.cloud.ids.v1.IEndpoint|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getEndpoint with error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.GetEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.GetEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getEndpoint = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEndpoint(request), expectedError); - const actualRequest = (client.innerApiCalls.getEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getEndpoint with closed client', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.GetEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.GetEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getEndpoint(request), expectedError); - }); - }); - - describe('createEndpoint', () => { - it('invokes createEndpoint without error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.CreateEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.CreateEndpointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createEndpoint = stubLongRunningCall(expectedResponse); - const [operation] = await client.createEndpoint(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEndpoint without error using callback', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.CreateEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.CreateEndpointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createEndpoint = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createEndpoint( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEndpoint with call error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.CreateEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.CreateEndpointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createEndpoint = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createEndpoint(request), expectedError); - const actualRequest = (client.innerApiCalls.createEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEndpoint with LRO error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.CreateEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.CreateEndpointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createEndpoint = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createEndpoint(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateEndpointProgress without error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateEndpointProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateEndpointProgress with error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateEndpointProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteEndpoint', () => { - it('invokes deleteEndpoint without error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.DeleteEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.DeleteEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteEndpoint = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteEndpoint(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteEndpoint without error using callback', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.DeleteEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.DeleteEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteEndpoint = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteEndpoint( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteEndpoint with call error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.DeleteEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.DeleteEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteEndpoint = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteEndpoint(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteEndpoint with LRO error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.DeleteEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.DeleteEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteEndpoint = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteEndpoint(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteEndpointProgress without error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteEndpointProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteEndpointProgress with error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteEndpointProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listEndpoints', () => { - it('invokes listEndpoints without error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.ListEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.ListEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), - generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), - generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), - ]; - client.innerApiCalls.listEndpoints = stubSimpleCall(expectedResponse); - const [response] = await client.listEndpoints(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEndpoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEndpoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEndpoints without error using callback', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.ListEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.ListEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), - generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), - generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), - ]; - client.innerApiCalls.listEndpoints = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listEndpoints( - request, - (err?: Error|null, result?: protos.google.cloud.ids.v1.IEndpoint[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEndpoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEndpoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEndpoints with error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.ListEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.ListEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listEndpoints = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listEndpoints(request), expectedError); - const actualRequest = (client.innerApiCalls.listEndpoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEndpoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEndpointsStream without error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.ListEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.ListEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), - generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), - generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), - ]; - client.descriptors.page.listEndpoints.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listEndpointsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.ids.v1.Endpoint[] = []; - stream.on('data', (response: protos.google.cloud.ids.v1.Endpoint) => { - 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.listEndpoints.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEndpoints, request)); - assert( - (client.descriptors.page.listEndpoints.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listEndpointsStream with error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.ListEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.ListEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listEndpoints.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listEndpointsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.ids.v1.Endpoint[] = []; - stream.on('data', (response: protos.google.cloud.ids.v1.Endpoint) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listEndpoints.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEndpoints, request)); - assert( - (client.descriptors.page.listEndpoints.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listEndpoints without error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.ListEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.ListEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), - generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), - generateSampleMessage(new protos.google.cloud.ids.v1.Endpoint()), - ]; - client.descriptors.page.listEndpoints.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.ids.v1.IEndpoint[] = []; - const iterable = client.listEndpointsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listEndpoints.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listEndpoints.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listEndpoints with error', async () => { - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.ids.v1.ListEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.ids.v1.ListEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listEndpoints.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listEndpointsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.ids.v1.IEndpoint[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listEndpoints.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listEndpoints.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('endpoint', () => { - const fakePath = "/rendered/path/endpoint"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - endpoint: "endpointValue", - }; - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.endpointPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.endpointPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('endpointPath', () => { - const result = client.endpointPath("projectValue", "locationValue", "endpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.endpointPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromEndpointName', () => { - const result = client.matchProjectFromEndpointName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.endpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromEndpointName', () => { - const result = client.matchLocationFromEndpointName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.endpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEndpointFromEndpointName', () => { - const result = client.matchEndpointFromEndpointName(fakePath); - assert.strictEqual(result, "endpointValue"); - assert((client.pathTemplates.endpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new idsModule.v1.IDSClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new idsModule.v1.IDSClient({ - 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)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-ids/v1/tsconfig.json b/owl-bot-staging/google-cloud-ids/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-ids/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-ids/v1/webpack.config.js b/owl-bot-staging/google-cloud-ids/v1/webpack.config.js deleted file mode 100644 index 6a2bec3e34a..00000000000 --- a/owl-bot-staging/google-cloud-ids/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: 'IDS', - filename: './i-d-s.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-iot/v1/.eslintignore b/owl-bot-staging/google-cloud-iot/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-iot/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-iot/v1/.eslintrc.json b/owl-bot-staging/google-cloud-iot/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-iot/v1/.gitignore b/owl-bot-staging/google-cloud-iot/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-iot/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-iot/v1/.jsdoc.js b/owl-bot-staging/google-cloud-iot/v1/.jsdoc.js deleted file mode 100644 index bb9dd1668bd..00000000000 --- a/owl-bot-staging/google-cloud-iot/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/iot', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-iot/v1/.mocharc.js b/owl-bot-staging/google-cloud-iot/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-iot/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-iot/v1/.prettierrc.js b/owl-bot-staging/google-cloud-iot/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-iot/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-iot/v1/README.md b/owl-bot-staging/google-cloud-iot/v1/README.md deleted file mode 100644 index e9217498f1c..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Iot: Nodejs Client diff --git a/owl-bot-staging/google-cloud-iot/v1/package.json b/owl-bot-staging/google-cloud-iot/v1/package.json deleted file mode 100644 index cef6c6e1056..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/iot", - "version": "0.1.0", - "description": "Iot client for Node.js", - "repository": "googleapis/nodejs-iot", - "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 iot", - "iot", - "device manager" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-iot/v1/protos/google/cloud/iot/v1/device_manager.proto b/owl-bot-staging/google-cloud-iot/v1/protos/google/cloud/iot/v1/device_manager.proto deleted file mode 100644 index 121bcdeefca..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/protos/google/cloud/iot/v1/device_manager.proto +++ /dev/null @@ -1,651 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.iot.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/iot/v1/resources.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option cc_enable_arenas = true; -option go_package = "cloud.google.com/go/iot/apiv1/iotpb;iotpb"; -option java_multiple_files = true; -option java_outer_classname = "DeviceManagerProto"; -option java_package = "com.google.cloud.iot.v1"; - -// Internet of Things (IoT) service. Securely connect and manage IoT devices. -service DeviceManager { - option (google.api.default_host) = "cloudiot.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloudiot"; - - // Creates a device registry that contains devices. - rpc CreateDeviceRegistry(CreateDeviceRegistryRequest) returns (DeviceRegistry) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/registries" - body: "device_registry" - }; - option (google.api.method_signature) = "parent,device_registry"; - } - - // Gets a device registry configuration. - rpc GetDeviceRegistry(GetDeviceRegistryRequest) returns (DeviceRegistry) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/registries/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a device registry configuration. - rpc UpdateDeviceRegistry(UpdateDeviceRegistryRequest) returns (DeviceRegistry) { - option (google.api.http) = { - patch: "/v1/{device_registry.name=projects/*/locations/*/registries/*}" - body: "device_registry" - }; - option (google.api.method_signature) = "device_registry,update_mask"; - } - - // Deletes a device registry configuration. - rpc DeleteDeviceRegistry(DeleteDeviceRegistryRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/registries/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists device registries. - rpc ListDeviceRegistries(ListDeviceRegistriesRequest) returns (ListDeviceRegistriesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/registries" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a device in a device registry. - rpc CreateDevice(CreateDeviceRequest) returns (Device) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/registries/*}/devices" - body: "device" - }; - option (google.api.method_signature) = "parent,device"; - } - - // Gets details about a device. - rpc GetDevice(GetDeviceRequest) returns (Device) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/registries/*/devices/*}" - additional_bindings { - get: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Updates a device. - rpc UpdateDevice(UpdateDeviceRequest) returns (Device) { - option (google.api.http) = { - patch: "/v1/{device.name=projects/*/locations/*/registries/*/devices/*}" - body: "device" - additional_bindings { - patch: "/v1/{device.name=projects/*/locations/*/registries/*/groups/*/devices/*}" - body: "device" - } - }; - option (google.api.method_signature) = "device,update_mask"; - } - - // Deletes a device. - rpc DeleteDevice(DeleteDeviceRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/registries/*/devices/*}" - }; - option (google.api.method_signature) = "name"; - } - - // List devices in a device registry. - rpc ListDevices(ListDevicesRequest) returns (ListDevicesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/registries/*}/devices" - additional_bindings { - get: "/v1/{parent=projects/*/locations/*/registries/*/groups/*}/devices" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Modifies the configuration for the device, which is eventually sent from - // the Cloud IoT Core servers. Returns the modified configuration version and - // its metadata. - rpc ModifyCloudToDeviceConfig(ModifyCloudToDeviceConfigRequest) returns (DeviceConfig) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/registries/*/devices/*}:modifyCloudToDeviceConfig" - body: "*" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}:modifyCloudToDeviceConfig" - body: "*" - } - }; - option (google.api.method_signature) = "name,binary_data"; - } - - // Lists the last few versions of the device configuration in descending - // order (i.e.: newest first). - rpc ListDeviceConfigVersions(ListDeviceConfigVersionsRequest) returns (ListDeviceConfigVersionsResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/registries/*/devices/*}/configVersions" - additional_bindings { - get: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}/configVersions" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists the last few versions of the device state in descending order (i.e.: - // newest first). - rpc ListDeviceStates(ListDeviceStatesRequest) returns (ListDeviceStatesResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/registries/*/devices/*}/states" - additional_bindings { - get: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}/states" - } - }; - option (google.api.method_signature) = "name"; - } - - // Sets the access control policy on the specified resource. Replaces any - // existing policy. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1/{resource=projects/*/locations/*/registries/*}:setIamPolicy" - body: "*" - additional_bindings { - post: "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:setIamPolicy" - body: "*" - } - }; - option (google.api.method_signature) = "resource,policy"; - } - - // Gets the access control policy for a resource. - // Returns an empty policy if the resource exists and does not have a policy - // set. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1/{resource=projects/*/locations/*/registries/*}:getIamPolicy" - body: "*" - additional_bindings { - post: "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:getIamPolicy" - body: "*" - } - }; - option (google.api.method_signature) = "resource"; - } - - // Returns permissions that a caller has on the specified resource. - // If the resource does not exist, this will return an empty set of - // permissions, not a NOT_FOUND error. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1/{resource=projects/*/locations/*/registries/*}:testIamPermissions" - body: "*" - additional_bindings { - post: "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:testIamPermissions" - body: "*" - } - }; - option (google.api.method_signature) = "resource,permissions"; - } - - // Sends a command to the specified device. In order for a device to be able - // to receive commands, it must: - // 1) be connected to Cloud IoT Core using the MQTT protocol, and - // 2) be subscribed to the group of MQTT topics specified by - // /devices/{device-id}/commands/#. This subscription will receive commands - // at the top-level topic /devices/{device-id}/commands as well as commands - // for subfolders, like /devices/{device-id}/commands/subfolder. - // Note that subscribing to specific subfolders is not supported. - // If the command could not be delivered to the device, this method will - // return an error; in particular, if the device is not subscribed, this - // method will return FAILED_PRECONDITION. Otherwise, this method will - // return OK. If the subscription is QoS 1, at least once delivery will be - // guaranteed; for QoS 0, no acknowledgment will be expected from the device. - rpc SendCommandToDevice(SendCommandToDeviceRequest) returns (SendCommandToDeviceResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/registries/*/devices/*}:sendCommandToDevice" - body: "*" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}:sendCommandToDevice" - body: "*" - } - }; - option (google.api.method_signature) = "name,binary_data"; - option (google.api.method_signature) = "name,binary_data,subfolder"; - } - - // Associates the device with the gateway. - rpc BindDeviceToGateway(BindDeviceToGatewayRequest) returns (BindDeviceToGatewayResponse) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/registries/*}:bindDeviceToGateway" - body: "*" - additional_bindings { - post: "/v1/{parent=projects/*/locations/*/registries/*/groups/*}:bindDeviceToGateway" - body: "*" - } - }; - option (google.api.method_signature) = "parent,gateway_id,device_id"; - } - - // Deletes the association between the device and the gateway. - rpc UnbindDeviceFromGateway(UnbindDeviceFromGatewayRequest) returns (UnbindDeviceFromGatewayResponse) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/registries/*}:unbindDeviceFromGateway" - body: "*" - additional_bindings { - post: "/v1/{parent=projects/*/locations/*/registries/*/groups/*}:unbindDeviceFromGateway" - body: "*" - } - }; - option (google.api.method_signature) = "parent,gateway_id,device_id"; - } -} - -// Request for `CreateDeviceRegistry`. -message CreateDeviceRegistryRequest { - // Required. The project and cloud region where this device registry must be created. - // For example, `projects/example-project/locations/us-central1`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The device registry. The field `name` must be empty. The server will - // generate that field from the device registry `id` provided and the - // `parent` field. - DeviceRegistry device_registry = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for `GetDeviceRegistry`. -message GetDeviceRegistryRequest { - // Required. The name of the device registry. For example, - // `projects/example-project/locations/us-central1/registries/my-registry`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Registry" - } - ]; -} - -// Request for `DeleteDeviceRegistry`. -message DeleteDeviceRegistryRequest { - // Required. The name of the device registry. For example, - // `projects/example-project/locations/us-central1/registries/my-registry`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Registry" - } - ]; -} - -// Request for `UpdateDeviceRegistry`. -message UpdateDeviceRegistryRequest { - // Required. The new values for the device registry. The `id` field must be empty, and - // the `name` field must indicate the path of the resource. For example, - // `projects/example-project/locations/us-central1/registries/my-registry`. - DeviceRegistry device_registry = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Only updates the `device_registry` fields indicated by this mask. - // The field mask must not be empty, and it must not contain fields that - // are immutable or only set by the server. - // Mutable top-level fields: `event_notification_config`, `http_config`, - // `mqtt_config`, and `state_notification_config`. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for `ListDeviceRegistries`. -message ListDeviceRegistriesRequest { - // Required. The project and cloud region path. For example, - // `projects/example-project/locations/us-central1`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of registries to return in the response. If this value - // is zero, the service will select a default size. A call may return fewer - // objects than requested. A non-empty `next_page_token` in the response - // indicates that more data is available. - int32 page_size = 2; - - // The value returned by the last `ListDeviceRegistriesResponse`; indicates - // that this is a continuation of a prior `ListDeviceRegistries` call and - // the system should return the next page of data. - string page_token = 3; -} - -// Response for `ListDeviceRegistries`. -message ListDeviceRegistriesResponse { - // The registries that matched the query. - repeated DeviceRegistry device_registries = 1; - - // If not empty, indicates that there may be more registries that match the - // request; this value should be passed in a new - // `ListDeviceRegistriesRequest`. - string next_page_token = 2; -} - -// Request for `CreateDevice`. -message CreateDeviceRequest { - // Required. The name of the device registry where this device should be created. - // For example, - // `projects/example-project/locations/us-central1/registries/my-registry`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Registry" - } - ]; - - // Required. The device registration details. The field `name` must be empty. The server - // generates `name` from the device registry `id` and the - // `parent` field. - Device device = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for `GetDevice`. -message GetDeviceRequest { - // Required. The name of the device. For example, - // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Device" - } - ]; - - // The fields of the `Device` resource to be returned in the response. If the - // field mask is unset or empty, all fields are returned. Fields have to be - // provided in snake_case format, for example: `last_heartbeat_time`. - google.protobuf.FieldMask field_mask = 2; -} - -// Request for `UpdateDevice`. -message UpdateDeviceRequest { - // Required. The new values for the device. The `id` and `num_id` fields must - // be empty, and the field `name` must specify the name path. For example, - // `projects/p0/locations/us-central1/registries/registry0/devices/device0`or - // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - Device device = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Only updates the `device` fields indicated by this mask. - // The field mask must not be empty, and it must not contain fields that - // are immutable or only set by the server. - // Mutable top-level fields: `credentials`, `blocked`, and `metadata` - google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for `DeleteDevice`. -message DeleteDeviceRequest { - // Required. The name of the device. For example, - // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Device" - } - ]; -} - -// Request for `ListDevices`. -message ListDevicesRequest { - // Required. The device registry path. Required. For example, - // `projects/my-project/locations/us-central1/registries/my-registry`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Registry" - } - ]; - - // A list of device numeric IDs. If empty, this field is ignored. Maximum - // IDs: 10,000. - repeated uint64 device_num_ids = 2; - - // A list of device string IDs. For example, `['device0', 'device12']`. - // If empty, this field is ignored. Maximum IDs: 10,000 - repeated string device_ids = 3; - - // The fields of the `Device` resource to be returned in the response. The - // fields `id` and `num_id` are always returned, along with any - // other fields specified in snake_case format, for example: - // `last_heartbeat_time`. - google.protobuf.FieldMask field_mask = 4; - - // Options related to gateways. - GatewayListOptions gateway_list_options = 6; - - // The maximum number of devices to return in the response. If this value - // is zero, the service will select a default size. A call may return fewer - // objects than requested. A non-empty `next_page_token` in the response - // indicates that more data is available. - int32 page_size = 100; - - // The value returned by the last `ListDevicesResponse`; indicates - // that this is a continuation of a prior `ListDevices` call and - // the system should return the next page of data. - string page_token = 101; -} - -// Options for limiting the list based on gateway type and associations. -message GatewayListOptions { - // If not set, all devices and gateways are returned. If set, the list is - // filtered based on gateway type and associations. - oneof filter { - // If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY` - // is specified, only non-gateway devices are returned. If - // `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned. - GatewayType gateway_type = 1; - - // If set, only devices associated with the specified gateway are returned. - // The gateway ID can be numeric (`num_id`) or the user-defined string - // (`id`). For example, if `123` is specified, only devices bound to the - // gateway with `num_id` 123 are returned. - string associations_gateway_id = 2; - - // If set, returns only the gateways with which the specified device is - // associated. The device ID can be numeric (`num_id`) or the user-defined - // string (`id`). For example, if `456` is specified, returns only the - // gateways to which the device with `num_id` 456 is bound. - string associations_device_id = 3; - } -} - -// Response for `ListDevices`. -message ListDevicesResponse { - // The devices that match the request. - repeated Device devices = 1; - - // If not empty, indicates that there may be more devices that match the - // request; this value should be passed in a new `ListDevicesRequest`. - string next_page_token = 2; -} - -// Request for `ModifyCloudToDeviceConfig`. -message ModifyCloudToDeviceConfigRequest { - // Required. The name of the device. For example, - // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Device" - } - ]; - - // The version number to update. If this value is zero, it will not check the - // version number of the server and will always update the current version; - // otherwise, this update will fail if the version number found on the server - // does not match this version number. This is used to support multiple - // simultaneous updates without losing data. - int64 version_to_update = 2; - - // Required. The configuration data for the device. - bytes binary_data = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for `ListDeviceConfigVersions`. -message ListDeviceConfigVersionsRequest { - // Required. The name of the device. For example, - // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Device" - } - ]; - - // The number of versions to list. Versions are listed in decreasing order of - // the version number. The maximum number of versions retained is 10. If this - // value is zero, it will return all the versions available. - int32 num_versions = 2; -} - -// Response for `ListDeviceConfigVersions`. -message ListDeviceConfigVersionsResponse { - // The device configuration for the last few versions. Versions are listed - // in decreasing order, starting from the most recent one. - repeated DeviceConfig device_configs = 1; -} - -// Request for `ListDeviceStates`. -message ListDeviceStatesRequest { - // Required. The name of the device. For example, - // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Device" - } - ]; - - // The number of states to list. States are listed in descending order of - // update time. The maximum number of states retained is 10. If this - // value is zero, it will return all the states available. - int32 num_states = 2; -} - -// Response for `ListDeviceStates`. -message ListDeviceStatesResponse { - // The last few device states. States are listed in descending order of server - // update time, starting from the most recent one. - repeated DeviceState device_states = 1; -} - -// Request for `SendCommandToDevice`. -message SendCommandToDeviceRequest { - // Required. The name of the device. For example, - // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Device" - } - ]; - - // Required. The command data to send to the device. - bytes binary_data = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional subfolder for the command. If empty, the command will be delivered - // to the /devices/{device-id}/commands topic, otherwise it will be delivered - // to the /devices/{device-id}/commands/{subfolder} topic. Multi-level - // subfolders are allowed. This field must not have more than 256 characters, - // and must not contain any MQTT wildcards ("+" or "#") or null characters. - string subfolder = 3; -} - -// Response for `SendCommandToDevice`. -message SendCommandToDeviceResponse { - -} - -// Request for `BindDeviceToGateway`. -message BindDeviceToGatewayRequest { - // Required. The name of the registry. For example, - // `projects/example-project/locations/us-central1/registries/my-registry`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Registry" - } - ]; - - // Required. The value of `gateway_id` can be either the device numeric ID or the - // user-defined device identifier. - string gateway_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The device to associate with the specified gateway. The value of - // `device_id` can be either the device numeric ID or the user-defined device - // identifier. - string device_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for `BindDeviceToGateway`. -message BindDeviceToGatewayResponse { - -} - -// Request for `UnbindDeviceFromGateway`. -message UnbindDeviceFromGatewayRequest { - // Required. The name of the registry. For example, - // `projects/example-project/locations/us-central1/registries/my-registry`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Registry" - } - ]; - - // Required. The value of `gateway_id` can be either the device numeric ID or the - // user-defined device identifier. - string gateway_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The device to disassociate from the specified gateway. The value of - // `device_id` can be either the device numeric ID or the user-defined device - // identifier. - string device_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for `UnbindDeviceFromGateway`. -message UnbindDeviceFromGatewayResponse { - -} diff --git a/owl-bot-staging/google-cloud-iot/v1/protos/google/cloud/iot/v1/resources.proto b/owl-bot-staging/google-cloud-iot/v1/protos/google/cloud/iot/v1/resources.proto deleted file mode 100644 index d08d268b024..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/protos/google/cloud/iot/v1/resources.proto +++ /dev/null @@ -1,483 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.iot.v1; - -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option go_package = "cloud.google.com/go/iot/apiv1/iotpb;iotpb"; -option java_multiple_files = true; -option java_outer_classname = "ResourcesProto"; -option java_package = "com.google.cloud.iot.v1"; - -// The device resource. -message Device { - option (google.api.resource) = { - type: "cloudiot.googleapis.com/Device" - pattern: "projects/{project}/locations/{location}/registries/{registry}/devices/{device}" - }; - - // The user-defined device identifier. The device ID must be unique - // within a device registry. - string id = 1; - - // The resource path name. For example, - // `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or - // `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`. - // When `name` is populated as a response from the service, it always ends - // in the device numeric ID. - string name = 2; - - // [Output only] A server-defined unique numeric ID for the device. This is a - // more compact way to identify devices, and it is globally unique. - uint64 num_id = 3; - - // The credentials used to authenticate this device. To allow credential - // rotation without interruption, multiple device credentials can be bound to - // this device. No more than 3 credentials can be bound to a single device at - // a time. When new credentials are added to a device, they are verified - // against the registry credentials. For details, see the description of the - // `DeviceRegistry.credentials` field. - repeated DeviceCredential credentials = 12; - - // [Output only] The last time an MQTT `PINGREQ` was received. This field - // applies only to devices connecting through MQTT. MQTT clients usually only - // send `PINGREQ` messages if the connection is idle, and no other messages - // have been sent. Timestamps are periodically collected and written to - // storage; they may be stale by a few minutes. - google.protobuf.Timestamp last_heartbeat_time = 7; - - // [Output only] The last time a telemetry event was received. Timestamps are - // periodically collected and written to storage; they may be stale by a few - // minutes. - google.protobuf.Timestamp last_event_time = 8; - - // [Output only] The last time a state event was received. Timestamps are - // periodically collected and written to storage; they may be stale by a few - // minutes. - google.protobuf.Timestamp last_state_time = 20; - - // [Output only] The last time a cloud-to-device config version acknowledgment - // was received from the device. This field is only for configurations - // sent through MQTT. - google.protobuf.Timestamp last_config_ack_time = 14; - - // [Output only] The last time a cloud-to-device config version was sent to - // the device. - google.protobuf.Timestamp last_config_send_time = 18; - - // If a device is blocked, connections or requests from this device will fail. - // Can be used to temporarily prevent the device from connecting if, for - // example, the sensor is generating bad data and needs maintenance. - bool blocked = 19; - - // [Output only] The time the most recent error occurred, such as a failure to - // publish to Cloud Pub/Sub. This field is the timestamp of - // 'last_error_status'. - google.protobuf.Timestamp last_error_time = 10; - - // [Output only] The error message of the most recent error, such as a failure - // to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this - // field. If no errors have occurred, this field has an empty message - // and the status code 0 == OK. Otherwise, this field is expected to have a - // status code other than OK. - google.rpc.Status last_error_status = 11; - - // The most recent device configuration, which is eventually sent from - // Cloud IoT Core to the device. If not present on creation, the - // configuration will be initialized with an empty payload and version value - // of `1`. To update this field after creation, use the - // `DeviceManager.ModifyCloudToDeviceConfig` method. - DeviceConfig config = 13; - - // [Output only] The state most recently received from the device. If no state - // has been reported, this field is not present. - DeviceState state = 16; - - // **Beta Feature** - // - // The logging verbosity for device activity. If unspecified, - // DeviceRegistry.log_level will be used. - LogLevel log_level = 21; - - // The metadata key-value pairs assigned to the device. This metadata is not - // interpreted or indexed by Cloud IoT Core. It can be used to add contextual - // information for the device. - // - // Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and - // be less than 128 bytes in length. - // - // Values are free-form strings. Each value must be less than or equal to 32 - // KB in size. - // - // The total size of all keys and values must be less than 256 KB, and the - // maximum number of key-value pairs is 500. - map metadata = 17; - - // Gateway-related configuration and state. - GatewayConfig gateway_config = 24; -} - -// Gateway-related configuration and state. -message GatewayConfig { - // Indicates whether the device is a gateway. - GatewayType gateway_type = 1; - - // Indicates how to authorize and/or authenticate devices to access the - // gateway. - GatewayAuthMethod gateway_auth_method = 2; - - // [Output only] The ID of the gateway the device accessed most recently. - string last_accessed_gateway_id = 3; - - // [Output only] The most recent time at which the device accessed the gateway - // specified in `last_accessed_gateway`. - google.protobuf.Timestamp last_accessed_gateway_time = 4; -} - -// A container for a group of devices. -message DeviceRegistry { - option (google.api.resource) = { - type: "cloudiot.googleapis.com/Registry" - pattern: "projects/{project}/locations/{location}/registries/{registry}" - }; - - // The identifier of this device registry. For example, `myRegistry`. - string id = 1; - - // The resource path name. For example, - // `projects/example-project/locations/us-central1/registries/my-registry`. - string name = 2; - - // The configuration for notification of telemetry events received from the - // device. All telemetry events that were successfully published by the - // device and acknowledged by Cloud IoT Core are guaranteed to be - // delivered to Cloud Pub/Sub. If multiple configurations match a message, - // only the first matching configuration is used. If you try to publish a - // device telemetry event using MQTT without specifying a Cloud Pub/Sub topic - // for the device's registry, the connection closes automatically. If you try - // to do so using an HTTP connection, an error is returned. Up to 10 - // configurations may be provided. - repeated EventNotificationConfig event_notification_configs = 10; - - // The configuration for notification of new states received from the device. - // State updates are guaranteed to be stored in the state history, but - // notifications to Cloud Pub/Sub are not guaranteed. For example, if - // permissions are misconfigured or the specified topic doesn't exist, no - // notification will be published but the state will still be stored in Cloud - // IoT Core. - StateNotificationConfig state_notification_config = 7; - - // The MQTT configuration for this device registry. - MqttConfig mqtt_config = 4; - - // The DeviceService (HTTP) configuration for this device registry. - HttpConfig http_config = 9; - - // **Beta Feature** - // - // The default logging verbosity for activity from devices in this registry. - // The verbosity level can be overridden by Device.log_level. - LogLevel log_level = 11; - - // The credentials used to verify the device credentials. No more than 10 - // credentials can be bound to a single registry at a time. The verification - // process occurs at the time of device creation or update. If this field is - // empty, no verification is performed. Otherwise, the credentials of a newly - // created device or added credentials of an updated device should be signed - // with one of these registry credentials. - // - // Note, however, that existing devices will never be affected by - // modifications to this list of credentials: after a device has been - // successfully created in a registry, it should be able to connect even if - // its registry credentials are revoked, deleted, or modified. - repeated RegistryCredential credentials = 8; -} - -// The configuration of MQTT for a device registry. -message MqttConfig { - // If enabled, allows connections using the MQTT protocol. Otherwise, MQTT - // connections to this registry will fail. - MqttState mqtt_enabled_state = 1; -} - -// Indicates whether an MQTT connection is enabled or disabled. See the field -// description for details. -enum MqttState { - // No MQTT state specified. If not specified, MQTT will be enabled by default. - MQTT_STATE_UNSPECIFIED = 0; - - // Enables a MQTT connection. - MQTT_ENABLED = 1; - - // Disables a MQTT connection. - MQTT_DISABLED = 2; -} - -// The configuration of the HTTP bridge for a device registry. -message HttpConfig { - // If enabled, allows devices to use DeviceService via the HTTP protocol. - // Otherwise, any requests to DeviceService will fail for this registry. - HttpState http_enabled_state = 1; -} - -// Indicates whether DeviceService (HTTP) is enabled or disabled for the -// registry. See the field description for details. -enum HttpState { - // No HTTP state specified. If not specified, DeviceService will be - // enabled by default. - HTTP_STATE_UNSPECIFIED = 0; - - // Enables DeviceService (HTTP) service for the registry. - HTTP_ENABLED = 1; - - // Disables DeviceService (HTTP) service for the registry. - HTTP_DISABLED = 2; -} - -// **Beta Feature** -// -// The logging verbosity for device activity. Specifies which events should be -// written to logs. For example, if the LogLevel is ERROR, only events that -// terminate in errors will be logged. LogLevel is inclusive; enabling INFO -// logging will also enable ERROR logging. -enum LogLevel { - // No logging specified. If not specified, logging will be disabled. - LOG_LEVEL_UNSPECIFIED = 0; - - // Disables logging. - NONE = 10; - - // Error events will be logged. - ERROR = 20; - - // Informational events will be logged, such as connections and - // disconnections. - INFO = 30; - - // All events will be logged. - DEBUG = 40; -} - -// Gateway type. -enum GatewayType { - // If unspecified, the device is considered a non-gateway device. - GATEWAY_TYPE_UNSPECIFIED = 0; - - // The device is a gateway. - GATEWAY = 1; - - // The device is not a gateway. - NON_GATEWAY = 2; -} - -// The gateway authorization/authentication method. This setting determines how -// Cloud IoT Core authorizes/authenticate devices to access the gateway. -enum GatewayAuthMethod { - // No authentication/authorization method specified. No devices are allowed to - // access the gateway. - GATEWAY_AUTH_METHOD_UNSPECIFIED = 0; - - // The device is authenticated through the gateway association only. Device - // credentials are ignored even if provided. - ASSOCIATION_ONLY = 1; - - // The device is authenticated through its own credentials. Gateway - // association is not checked. - DEVICE_AUTH_TOKEN_ONLY = 2; - - // The device is authenticated through both device credentials and gateway - // association. The device must be bound to the gateway and must provide its - // own credentials. - ASSOCIATION_AND_DEVICE_AUTH_TOKEN = 3; -} - -// The configuration for forwarding telemetry events. -message EventNotificationConfig { - // If the subfolder name matches this string exactly, this configuration will - // be used. The string must not include the leading '/' character. If empty, - // all strings are matched. This field is used only for telemetry events; - // subfolders are not supported for state changes. - string subfolder_matches = 2; - - // A Cloud Pub/Sub topic name. For example, - // `projects/myProject/topics/deviceEvents`. - string pubsub_topic_name = 1; -} - -// The configuration for notification of new states received from the device. -message StateNotificationConfig { - // A Cloud Pub/Sub topic name. For example, - // `projects/myProject/topics/deviceEvents`. - string pubsub_topic_name = 1; -} - -// A server-stored registry credential used to validate device credentials. -message RegistryCredential { - // The credential data. Reserved for expansion in the future. - oneof credential { - // A public key certificate used to verify the device credentials. - PublicKeyCertificate public_key_certificate = 1; - } -} - -// Details of an X.509 certificate. For informational purposes only. -message X509CertificateDetails { - // The entity that signed the certificate. - string issuer = 1; - - // The entity the certificate and public key belong to. - string subject = 2; - - // The time the certificate becomes valid. - google.protobuf.Timestamp start_time = 3; - - // The time the certificate becomes invalid. - google.protobuf.Timestamp expiry_time = 4; - - // The algorithm used to sign the certificate. - string signature_algorithm = 5; - - // The type of public key in the certificate. - string public_key_type = 6; -} - -// A public key certificate format and data. -message PublicKeyCertificate { - // The certificate format. - PublicKeyCertificateFormat format = 1; - - // The certificate data. - string certificate = 2; - - // [Output only] The certificate details. Used only for X.509 certificates. - X509CertificateDetails x509_details = 3; -} - -// The supported formats for the public key. -enum PublicKeyCertificateFormat { - // The format has not been specified. This is an invalid default value and - // must not be used. - UNSPECIFIED_PUBLIC_KEY_CERTIFICATE_FORMAT = 0; - - // An X.509v3 certificate ([RFC5280](https://www.ietf.org/rfc/rfc5280.txt)), - // encoded in base64, and wrapped by `-----BEGIN CERTIFICATE-----` and - // `-----END CERTIFICATE-----`. - X509_CERTIFICATE_PEM = 1; -} - -// A server-stored device credential used for authentication. -message DeviceCredential { - // The credential data. Reserved for expansion in the future. - oneof credential { - // A public key used to verify the signature of JSON Web Tokens (JWTs). - // When adding a new device credential, either via device creation or via - // modifications, this public key credential may be required to be signed by - // one of the registry level certificates. More specifically, if the - // registry contains at least one certificate, any new device credential - // must be signed by one of the registry certificates. As a result, - // when the registry contains certificates, only X.509 certificates are - // accepted as device credentials. However, if the registry does - // not contain a certificate, self-signed certificates and public keys will - // be accepted. New device credentials must be different from every - // registry-level certificate. - PublicKeyCredential public_key = 2; - } - - // [Optional] The time at which this credential becomes invalid. This - // credential will be ignored for new client authentication requests after - // this timestamp; however, it will not be automatically deleted. - google.protobuf.Timestamp expiration_time = 6; -} - -// A public key format and data. -message PublicKeyCredential { - // The format of the key. - PublicKeyFormat format = 1; - - // The key data. - string key = 2; -} - -// The supported formats for the public key. -enum PublicKeyFormat { - // The format has not been specified. This is an invalid default value and - // must not be used. - UNSPECIFIED_PUBLIC_KEY_FORMAT = 0; - - // An RSA public key encoded in base64, and wrapped by - // `-----BEGIN PUBLIC KEY-----` and `-----END PUBLIC KEY-----`. This can be - // used to verify `RS256` signatures in JWT tokens ([RFC7518]( - // https://www.ietf.org/rfc/rfc7518.txt)). - RSA_PEM = 3; - - // As RSA_PEM, but wrapped in an X.509v3 certificate ([RFC5280]( - // https://www.ietf.org/rfc/rfc5280.txt)), encoded in base64, and wrapped by - // `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`. - RSA_X509_PEM = 1; - - // Public key for the ECDSA algorithm using P-256 and SHA-256, encoded in - // base64, and wrapped by `-----BEGIN PUBLIC KEY-----` and `-----END - // PUBLIC KEY-----`. This can be used to verify JWT tokens with the `ES256` - // algorithm ([RFC7518](https://www.ietf.org/rfc/rfc7518.txt)). This curve is - // defined in [OpenSSL](https://www.openssl.org/) as the `prime256v1` curve. - ES256_PEM = 2; - - // As ES256_PEM, but wrapped in an X.509v3 certificate ([RFC5280]( - // https://www.ietf.org/rfc/rfc5280.txt)), encoded in base64, and wrapped by - // `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`. - ES256_X509_PEM = 4; -} - -// The device configuration. Eventually delivered to devices. -message DeviceConfig { - // [Output only] The version of this update. The version number is assigned by - // the server, and is always greater than 0 after device creation. The - // version must be 0 on the `CreateDevice` request if a `config` is - // specified; the response of `CreateDevice` will always have a value of 1. - int64 version = 1; - - // [Output only] The time at which this configuration version was updated in - // Cloud IoT Core. This timestamp is set by the server. - google.protobuf.Timestamp cloud_update_time = 2; - - // [Output only] The time at which Cloud IoT Core received the - // acknowledgment from the device, indicating that the device has received - // this configuration version. If this field is not present, the device has - // not yet acknowledged that it received this version. Note that when - // the config was sent to the device, many config versions may have been - // available in Cloud IoT Core while the device was disconnected, and on - // connection, only the latest version is sent to the device. Some - // versions may never be sent to the device, and therefore are never - // acknowledged. This timestamp is set by Cloud IoT Core. - google.protobuf.Timestamp device_ack_time = 3; - - // The device configuration data. - bytes binary_data = 4; -} - -// The device state, as reported by the device. -message DeviceState { - // [Output only] The time at which this state version was updated in Cloud - // IoT Core. - google.protobuf.Timestamp update_time = 1; - - // The device state data. - bytes binary_data = 2; -} diff --git a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.bind_device_to_gateway.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.bind_device_to_gateway.js deleted file mode 100644 index f13595f0b2d..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.bind_device_to_gateway.js +++ /dev/null @@ -1,75 +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, gatewayId, deviceId) { - // [START cloudiot_v1_generated_DeviceManager_BindDeviceToGateway_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the registry. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - */ - // const parent = 'abc123' - /** - * Required. The value of `gateway_id` can be either the device numeric ID or the - * user-defined device identifier. - */ - // const gatewayId = 'abc123' - /** - * Required. The device to associate with the specified gateway. The value of - * `device_id` can be either the device numeric ID or the user-defined device - * identifier. - */ - // const deviceId = 'abc123' - - // Imports the Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callBindDeviceToGateway() { - // Construct request - const request = { - parent, - gatewayId, - deviceId, - }; - - // Run request - const response = await iotClient.bindDeviceToGateway(request); - console.log(response); - } - - callBindDeviceToGateway(); - // [END cloudiot_v1_generated_DeviceManager_BindDeviceToGateway_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-iot/v1/samples/generated/v1/device_manager.create_device.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.create_device.js deleted file mode 100644 index 741d645c885..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.create_device.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(parent, device) { - // [START cloudiot_v1_generated_DeviceManager_CreateDevice_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the device registry where this device should be created. - * For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - */ - // const parent = 'abc123' - /** - * Required. The device registration details. The field `name` must be empty. The server - * generates `name` from the device registry `id` and the - * `parent` field. - */ - // const device = {} - - // Imports the Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callCreateDevice() { - // Construct request - const request = { - parent, - device, - }; - - // Run request - const response = await iotClient.createDevice(request); - console.log(response); - } - - callCreateDevice(); - // [END cloudiot_v1_generated_DeviceManager_CreateDevice_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-iot/v1/samples/generated/v1/device_manager.create_device_registry.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.create_device_registry.js deleted file mode 100644 index d4091ed537c..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.create_device_registry.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, deviceRegistry) { - // [START cloudiot_v1_generated_DeviceManager_CreateDeviceRegistry_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 project and cloud region where this device registry must be created. - * For example, `projects/example-project/locations/us-central1`. - */ - // const parent = 'abc123' - /** - * Required. The device registry. The field `name` must be empty. The server will - * generate that field from the device registry `id` provided and the - * `parent` field. - */ - // const deviceRegistry = {} - - // Imports the Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callCreateDeviceRegistry() { - // Construct request - const request = { - parent, - deviceRegistry, - }; - - // Run request - const response = await iotClient.createDeviceRegistry(request); - console.log(response); - } - - callCreateDeviceRegistry(); - // [END cloudiot_v1_generated_DeviceManager_CreateDeviceRegistry_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-iot/v1/samples/generated/v1/device_manager.delete_device.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.delete_device.js deleted file mode 100644 index 9310f9a315a..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.delete_device.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 cloudiot_v1_generated_DeviceManager_DeleteDevice_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - */ - // const name = 'abc123' - - // Imports the Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callDeleteDevice() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await iotClient.deleteDevice(request); - console.log(response); - } - - callDeleteDevice(); - // [END cloudiot_v1_generated_DeviceManager_DeleteDevice_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-iot/v1/samples/generated/v1/device_manager.delete_device_registry.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.delete_device_registry.js deleted file mode 100644 index 0715e141059..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.delete_device_registry.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 cloudiot_v1_generated_DeviceManager_DeleteDeviceRegistry_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the device registry. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - */ - // const name = 'abc123' - - // Imports the Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callDeleteDeviceRegistry() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await iotClient.deleteDeviceRegistry(request); - console.log(response); - } - - callDeleteDeviceRegistry(); - // [END cloudiot_v1_generated_DeviceManager_DeleteDeviceRegistry_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-iot/v1/samples/generated/v1/device_manager.get_device.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.get_device.js deleted file mode 100644 index 1902c278b19..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.get_device.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(name) { - // [START cloudiot_v1_generated_DeviceManager_GetDevice_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - */ - // const name = 'abc123' - /** - * The fields of the `Device` resource to be returned in the response. If the - * field mask is unset or empty, all fields are returned. Fields have to be - * provided in snake_case format, for example: `last_heartbeat_time`. - */ - // const fieldMask = {} - - // Imports the Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callGetDevice() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await iotClient.getDevice(request); - console.log(response); - } - - callGetDevice(); - // [END cloudiot_v1_generated_DeviceManager_GetDevice_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-iot/v1/samples/generated/v1/device_manager.get_device_registry.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.get_device_registry.js deleted file mode 100644 index 3c52776fa45..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.get_device_registry.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 cloudiot_v1_generated_DeviceManager_GetDeviceRegistry_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the device registry. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - */ - // const name = 'abc123' - - // Imports the Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callGetDeviceRegistry() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await iotClient.getDeviceRegistry(request); - console.log(response); - } - - callGetDeviceRegistry(); - // [END cloudiot_v1_generated_DeviceManager_GetDeviceRegistry_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-iot/v1/samples/generated/v1/device_manager.get_iam_policy.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.get_iam_policy.js deleted file mode 100644 index 0c6e74dc00c..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.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 cloudiot_v1_generated_DeviceManager_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 Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await iotClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END cloudiot_v1_generated_DeviceManager_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-iot/v1/samples/generated/v1/device_manager.list_device_config_versions.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_config_versions.js deleted file mode 100644 index b05df977974..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_config_versions.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(name) { - // [START cloudiot_v1_generated_DeviceManager_ListDeviceConfigVersions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - */ - // const name = 'abc123' - /** - * The number of versions to list. Versions are listed in decreasing order of - * the version number. The maximum number of versions retained is 10. If this - * value is zero, it will return all the versions available. - */ - // const numVersions = 1234 - - // Imports the Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callListDeviceConfigVersions() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await iotClient.listDeviceConfigVersions(request); - console.log(response); - } - - callListDeviceConfigVersions(); - // [END cloudiot_v1_generated_DeviceManager_ListDeviceConfigVersions_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-iot/v1/samples/generated/v1/device_manager.list_device_registries.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_registries.js deleted file mode 100644 index 8113099817d..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_registries.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(parent) { - // [START cloudiot_v1_generated_DeviceManager_ListDeviceRegistries_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 project and cloud region path. For example, - * `projects/example-project/locations/us-central1`. - */ - // const parent = 'abc123' - /** - * The maximum number of registries to return in the response. If this value - * is zero, the service will select a default size. A call may return fewer - * objects than requested. A non-empty `next_page_token` in the response - * indicates that more data is available. - */ - // const pageSize = 1234 - /** - * The value returned by the last `ListDeviceRegistriesResponse`; indicates - * that this is a continuation of a prior `ListDeviceRegistries` call and - * the system should return the next page of data. - */ - // const pageToken = 'abc123' - - // Imports the Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callListDeviceRegistries() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await iotClient.listDeviceRegistriesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDeviceRegistries(); - // [END cloudiot_v1_generated_DeviceManager_ListDeviceRegistries_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-iot/v1/samples/generated/v1/device_manager.list_device_states.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_states.js deleted file mode 100644 index b6a045202a9..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_device_states.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(name) { - // [START cloudiot_v1_generated_DeviceManager_ListDeviceStates_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - */ - // const name = 'abc123' - /** - * The number of states to list. States are listed in descending order of - * update time. The maximum number of states retained is 10. If this - * value is zero, it will return all the states available. - */ - // const numStates = 1234 - - // Imports the Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callListDeviceStates() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await iotClient.listDeviceStates(request); - console.log(response); - } - - callListDeviceStates(); - // [END cloudiot_v1_generated_DeviceManager_ListDeviceStates_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-iot/v1/samples/generated/v1/device_manager.list_devices.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_devices.js deleted file mode 100644 index 828440610a0..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.list_devices.js +++ /dev/null @@ -1,98 +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 cloudiot_v1_generated_DeviceManager_ListDevices_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 device registry path. Required. For example, - * `projects/my-project/locations/us-central1/registries/my-registry`. - */ - // const parent = 'abc123' - /** - * A list of device numeric IDs. If empty, this field is ignored. Maximum - * IDs: 10,000. - */ - // const deviceNumIds = [1,2,3,4] - /** - * A list of device string IDs. For example, `['device0', 'device12']`. - * If empty, this field is ignored. Maximum IDs: 10,000 - */ - // const deviceIds = ['abc','def'] - /** - * The fields of the `Device` resource to be returned in the response. The - * fields `id` and `num_id` are always returned, along with any - * other fields specified in snake_case format, for example: - * `last_heartbeat_time`. - */ - // const fieldMask = {} - /** - * Options related to gateways. - */ - // const gatewayListOptions = {} - /** - * The maximum number of devices to return in the response. If this value - * is zero, the service will select a default size. A call may return fewer - * objects than requested. A non-empty `next_page_token` in the response - * indicates that more data is available. - */ - // const pageSize = 1234 - /** - * The value returned by the last `ListDevicesResponse`; indicates - * that this is a continuation of a prior `ListDevices` call and - * the system should return the next page of data. - */ - // const pageToken = 'abc123' - - // Imports the Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callListDevices() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await iotClient.listDevicesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDevices(); - // [END cloudiot_v1_generated_DeviceManager_ListDevices_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-iot/v1/samples/generated/v1/device_manager.modify_cloud_to_device_config.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.modify_cloud_to_device_config.js deleted file mode 100644 index 7d3c56ef10e..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.modify_cloud_to_device_config.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(name, binaryData) { - // [START cloudiot_v1_generated_DeviceManager_ModifyCloudToDeviceConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - */ - // const name = 'abc123' - /** - * The version number to update. If this value is zero, it will not check the - * version number of the server and will always update the current version; - * otherwise, this update will fail if the version number found on the server - * does not match this version number. This is used to support multiple - * simultaneous updates without losing data. - */ - // const versionToUpdate = 1234 - /** - * Required. The configuration data for the device. - */ - // const binaryData = Buffer.from('string') - - // Imports the Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callModifyCloudToDeviceConfig() { - // Construct request - const request = { - name, - binaryData, - }; - - // Run request - const response = await iotClient.modifyCloudToDeviceConfig(request); - console.log(response); - } - - callModifyCloudToDeviceConfig(); - // [END cloudiot_v1_generated_DeviceManager_ModifyCloudToDeviceConfig_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-iot/v1/samples/generated/v1/device_manager.send_command_to_device.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.send_command_to_device.js deleted file mode 100644 index 17ff1fb910f..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.send_command_to_device.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(name, binaryData) { - // [START cloudiot_v1_generated_DeviceManager_SendCommandToDevice_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - */ - // const name = 'abc123' - /** - * Required. The command data to send to the device. - */ - // const binaryData = Buffer.from('string') - /** - * Optional subfolder for the command. If empty, the command will be delivered - * to the /devices/{device-id}/commands topic, otherwise it will be delivered - * to the /devices/{device-id}/commands/{subfolder} topic. Multi-level - * subfolders are allowed. This field must not have more than 256 characters, - * and must not contain any MQTT wildcards ("+" or "#") or null characters. - */ - // const subfolder = 'abc123' - - // Imports the Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callSendCommandToDevice() { - // Construct request - const request = { - name, - binaryData, - }; - - // Run request - const response = await iotClient.sendCommandToDevice(request); - console.log(response); - } - - callSendCommandToDevice(); - // [END cloudiot_v1_generated_DeviceManager_SendCommandToDevice_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-iot/v1/samples/generated/v1/device_manager.set_iam_policy.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.set_iam_policy.js deleted file mode 100644 index 90929109ff5..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.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 cloudiot_v1_generated_DeviceManager_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 Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await iotClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END cloudiot_v1_generated_DeviceManager_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-iot/v1/samples/generated/v1/device_manager.test_iam_permissions.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.test_iam_permissions.js deleted file mode 100644 index 172366bab63..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.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 cloudiot_v1_generated_DeviceManager_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 = ['abc','def'] - - // Imports the Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await iotClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END cloudiot_v1_generated_DeviceManager_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-iot/v1/samples/generated/v1/device_manager.unbind_device_from_gateway.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.unbind_device_from_gateway.js deleted file mode 100644 index 63fbe572f83..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.unbind_device_from_gateway.js +++ /dev/null @@ -1,75 +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, gatewayId, deviceId) { - // [START cloudiot_v1_generated_DeviceManager_UnbindDeviceFromGateway_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the registry. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - */ - // const parent = 'abc123' - /** - * Required. The value of `gateway_id` can be either the device numeric ID or the - * user-defined device identifier. - */ - // const gatewayId = 'abc123' - /** - * Required. The device to disassociate from the specified gateway. The value of - * `device_id` can be either the device numeric ID or the user-defined device - * identifier. - */ - // const deviceId = 'abc123' - - // Imports the Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callUnbindDeviceFromGateway() { - // Construct request - const request = { - parent, - gatewayId, - deviceId, - }; - - // Run request - const response = await iotClient.unbindDeviceFromGateway(request); - console.log(response); - } - - callUnbindDeviceFromGateway(); - // [END cloudiot_v1_generated_DeviceManager_UnbindDeviceFromGateway_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-iot/v1/samples/generated/v1/device_manager.update_device.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.update_device.js deleted file mode 100644 index d3eba4d0888..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.update_device.js +++ /dev/null @@ -1,72 +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(device, updateMask) { - // [START cloudiot_v1_generated_DeviceManager_UpdateDevice_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 device. The `id` and `num_id` fields must - * be empty, and the field `name` must specify the name path. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - */ - // const device = {} - /** - * Required. Only updates the `device` fields indicated by this mask. - * The field mask must not be empty, and it must not contain fields that - * are immutable or only set by the server. - * Mutable top-level fields: `credentials`, `blocked`, and `metadata` - */ - // const updateMask = {} - - // Imports the Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callUpdateDevice() { - // Construct request - const request = { - device, - updateMask, - }; - - // Run request - const response = await iotClient.updateDevice(request); - console.log(response); - } - - callUpdateDevice(); - // [END cloudiot_v1_generated_DeviceManager_UpdateDevice_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-iot/v1/samples/generated/v1/device_manager.update_device_registry.js b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.update_device_registry.js deleted file mode 100644 index b21e9bff56a..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/device_manager.update_device_registry.js +++ /dev/null @@ -1,72 +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(deviceRegistry, updateMask) { - // [START cloudiot_v1_generated_DeviceManager_UpdateDeviceRegistry_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 device registry. The `id` field must be empty, and - * the `name` field must indicate the path of the resource. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - */ - // const deviceRegistry = {} - /** - * Required. Only updates the `device_registry` fields indicated by this mask. - * The field mask must not be empty, and it must not contain fields that - * are immutable or only set by the server. - * Mutable top-level fields: `event_notification_config`, `http_config`, - * `mqtt_config`, and `state_notification_config`. - */ - // const updateMask = {} - - // Imports the Iot library - const {DeviceManagerClient} = require('@google-cloud/iot').v1; - - // Instantiates a client - const iotClient = new DeviceManagerClient(); - - async function callUpdateDeviceRegistry() { - // Construct request - const request = { - deviceRegistry, - updateMask, - }; - - // Run request - const response = await iotClient.updateDeviceRegistry(request); - console.log(response); - } - - callUpdateDeviceRegistry(); - // [END cloudiot_v1_generated_DeviceManager_UpdateDeviceRegistry_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-iot/v1/samples/generated/v1/snippet_metadata_google.cloud.iot.v1.json b/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/snippet_metadata_google.cloud.iot.v1.json deleted file mode 100644 index 30986a77500..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/samples/generated/v1/snippet_metadata_google.cloud.iot.v1.json +++ /dev/null @@ -1,883 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-iot", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.iot.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudiot_v1_generated_DeviceManager_CreateDeviceRegistry_async", - "title": "iot createDeviceRegistry Sample", - "origin": "API_DEFINITION", - "description": " Creates a device registry that contains devices.", - "canonical": true, - "file": "device_manager.create_device_registry.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateDeviceRegistry", - "fullName": "google.cloud.iot.v1.DeviceManager.CreateDeviceRegistry", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "device_registry", - "type": ".google.cloud.iot.v1.DeviceRegistry" - } - ], - "resultType": ".google.cloud.iot.v1.DeviceRegistry", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "CreateDeviceRegistry", - "fullName": "google.cloud.iot.v1.DeviceManager.CreateDeviceRegistry", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_GetDeviceRegistry_async", - "title": "iot getDeviceRegistry Sample", - "origin": "API_DEFINITION", - "description": " Gets a device registry configuration.", - "canonical": true, - "file": "device_manager.get_device_registry.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDeviceRegistry", - "fullName": "google.cloud.iot.v1.DeviceManager.GetDeviceRegistry", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.iot.v1.DeviceRegistry", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "GetDeviceRegistry", - "fullName": "google.cloud.iot.v1.DeviceManager.GetDeviceRegistry", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_UpdateDeviceRegistry_async", - "title": "iot updateDeviceRegistry Sample", - "origin": "API_DEFINITION", - "description": " Updates a device registry configuration.", - "canonical": true, - "file": "device_manager.update_device_registry.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateDeviceRegistry", - "fullName": "google.cloud.iot.v1.DeviceManager.UpdateDeviceRegistry", - "async": true, - "parameters": [ - { - "name": "device_registry", - "type": ".google.cloud.iot.v1.DeviceRegistry" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.iot.v1.DeviceRegistry", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "UpdateDeviceRegistry", - "fullName": "google.cloud.iot.v1.DeviceManager.UpdateDeviceRegistry", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_DeleteDeviceRegistry_async", - "title": "iot deleteDeviceRegistry Sample", - "origin": "API_DEFINITION", - "description": " Deletes a device registry configuration.", - "canonical": true, - "file": "device_manager.delete_device_registry.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDeviceRegistry", - "fullName": "google.cloud.iot.v1.DeviceManager.DeleteDeviceRegistry", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "DeleteDeviceRegistry", - "fullName": "google.cloud.iot.v1.DeviceManager.DeleteDeviceRegistry", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_ListDeviceRegistries_async", - "title": "iot listDeviceRegistries Sample", - "origin": "API_DEFINITION", - "description": " Lists device registries.", - "canonical": true, - "file": "device_manager.list_device_registries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDeviceRegistries", - "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceRegistries", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.iot.v1.ListDeviceRegistriesResponse", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "ListDeviceRegistries", - "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceRegistries", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_CreateDevice_async", - "title": "iot createDevice Sample", - "origin": "API_DEFINITION", - "description": " Creates a device in a device registry.", - "canonical": true, - "file": "device_manager.create_device.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateDevice", - "fullName": "google.cloud.iot.v1.DeviceManager.CreateDevice", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "device", - "type": ".google.cloud.iot.v1.Device" - } - ], - "resultType": ".google.cloud.iot.v1.Device", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "CreateDevice", - "fullName": "google.cloud.iot.v1.DeviceManager.CreateDevice", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_GetDevice_async", - "title": "iot getDevice Sample", - "origin": "API_DEFINITION", - "description": " Gets details about a device.", - "canonical": true, - "file": "device_manager.get_device.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDevice", - "fullName": "google.cloud.iot.v1.DeviceManager.GetDevice", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "field_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.iot.v1.Device", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "GetDevice", - "fullName": "google.cloud.iot.v1.DeviceManager.GetDevice", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_UpdateDevice_async", - "title": "iot updateDevice Sample", - "origin": "API_DEFINITION", - "description": " Updates a device.", - "canonical": true, - "file": "device_manager.update_device.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateDevice", - "fullName": "google.cloud.iot.v1.DeviceManager.UpdateDevice", - "async": true, - "parameters": [ - { - "name": "device", - "type": ".google.cloud.iot.v1.Device" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.iot.v1.Device", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "UpdateDevice", - "fullName": "google.cloud.iot.v1.DeviceManager.UpdateDevice", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_DeleteDevice_async", - "title": "iot deleteDevice Sample", - "origin": "API_DEFINITION", - "description": " Deletes a device.", - "canonical": true, - "file": "device_manager.delete_device.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDevice", - "fullName": "google.cloud.iot.v1.DeviceManager.DeleteDevice", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "DeleteDevice", - "fullName": "google.cloud.iot.v1.DeviceManager.DeleteDevice", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_ListDevices_async", - "title": "iot listDevices Sample", - "origin": "API_DEFINITION", - "description": " List devices in a device registry.", - "canonical": true, - "file": "device_manager.list_devices.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 90, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDevices", - "fullName": "google.cloud.iot.v1.DeviceManager.ListDevices", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "device_num_ids", - "type": "TYPE_UINT64[]" - }, - { - "name": "device_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "field_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "gateway_list_options", - "type": ".google.cloud.iot.v1.GatewayListOptions" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.iot.v1.ListDevicesResponse", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "ListDevices", - "fullName": "google.cloud.iot.v1.DeviceManager.ListDevices", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_ModifyCloudToDeviceConfig_async", - "title": "iot modifyCloudToDeviceConfig Sample", - "origin": "API_DEFINITION", - "description": " Modifies the configuration for the device, which is eventually sent from the Cloud IoT Core servers. Returns the modified configuration version and its metadata.", - "canonical": true, - "file": "device_manager.modify_cloud_to_device_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ModifyCloudToDeviceConfig", - "fullName": "google.cloud.iot.v1.DeviceManager.ModifyCloudToDeviceConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "version_to_update", - "type": "TYPE_INT64" - }, - { - "name": "binary_data", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.iot.v1.DeviceConfig", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "ModifyCloudToDeviceConfig", - "fullName": "google.cloud.iot.v1.DeviceManager.ModifyCloudToDeviceConfig", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_ListDeviceConfigVersions_async", - "title": "iot listDeviceConfigVersions Sample", - "origin": "API_DEFINITION", - "description": " Lists the last few versions of the device configuration in descending order (i.e.: newest first).", - "canonical": true, - "file": "device_manager.list_device_config_versions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDeviceConfigVersions", - "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceConfigVersions", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "num_versions", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.iot.v1.ListDeviceConfigVersionsResponse", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "ListDeviceConfigVersions", - "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceConfigVersions", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_ListDeviceStates_async", - "title": "iot listDeviceStates Sample", - "origin": "API_DEFINITION", - "description": " Lists the last few versions of the device state in descending order (i.e.: newest first).", - "canonical": true, - "file": "device_manager.list_device_states.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDeviceStates", - "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceStates", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "num_states", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.iot.v1.ListDeviceStatesResponse", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "ListDeviceStates", - "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceStates", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_SetIamPolicy_async", - "title": "iot setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the access control policy on the specified resource. Replaces any existing policy.", - "canonical": true, - "file": "device_manager.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.iot.v1.DeviceManager.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": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.iot.v1.DeviceManager.SetIamPolicy", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_GetIamPolicy_async", - "title": "iot getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.", - "canonical": true, - "file": "device_manager.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.iot.v1.DeviceManager.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.iot.v1.DeviceManager.GetIamPolicy", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_TestIamPermissions_async", - "title": "iot testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.", - "canonical": true, - "file": "device_manager.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.iot.v1.DeviceManager.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.iot.v1.DeviceManager.TestIamPermissions", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_SendCommandToDevice_async", - "title": "iot sendCommandToDevice Sample", - "origin": "API_DEFINITION", - "description": " Sends a command to the specified device. In order for a device to be able to receive commands, it must: 1) be connected to Cloud IoT Core using the MQTT protocol, and 2) be subscribed to the group of MQTT topics specified by /devices/{device-id}/commands/#. This subscription will receive commands at the top-level topic /devices/{device-id}/commands as well as commands for subfolders, like /devices/{device-id}/commands/subfolder. Note that subscribing to specific subfolders is not supported. If the command could not be delivered to the device, this method will return an error; in particular, if the device is not subscribed, this method will return FAILED_PRECONDITION. Otherwise, this method will return OK. If the subscription is QoS 1, at least once delivery will be guaranteed; for QoS 0, no acknowledgment will be expected from the device.", - "canonical": true, - "file": "device_manager.send_command_to_device.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SendCommandToDevice", - "fullName": "google.cloud.iot.v1.DeviceManager.SendCommandToDevice", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "binary_data", - "type": "TYPE_BYTES" - }, - { - "name": "subfolder", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.iot.v1.SendCommandToDeviceResponse", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "SendCommandToDevice", - "fullName": "google.cloud.iot.v1.DeviceManager.SendCommandToDevice", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_BindDeviceToGateway_async", - "title": "iot bindDeviceToGateway Sample", - "origin": "API_DEFINITION", - "description": " Associates the device with the gateway.", - "canonical": true, - "file": "device_manager.bind_device_to_gateway.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BindDeviceToGateway", - "fullName": "google.cloud.iot.v1.DeviceManager.BindDeviceToGateway", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "gateway_id", - "type": "TYPE_STRING" - }, - { - "name": "device_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.iot.v1.BindDeviceToGatewayResponse", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "BindDeviceToGateway", - "fullName": "google.cloud.iot.v1.DeviceManager.BindDeviceToGateway", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - }, - { - "regionTag": "cloudiot_v1_generated_DeviceManager_UnbindDeviceFromGateway_async", - "title": "iot unbindDeviceFromGateway Sample", - "origin": "API_DEFINITION", - "description": " Deletes the association between the device and the gateway.", - "canonical": true, - "file": "device_manager.unbind_device_from_gateway.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UnbindDeviceFromGateway", - "fullName": "google.cloud.iot.v1.DeviceManager.UnbindDeviceFromGateway", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "gateway_id", - "type": "TYPE_STRING" - }, - { - "name": "device_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.iot.v1.UnbindDeviceFromGatewayResponse", - "client": { - "shortName": "DeviceManagerClient", - "fullName": "google.cloud.iot.v1.DeviceManagerClient" - }, - "method": { - "shortName": "UnbindDeviceFromGateway", - "fullName": "google.cloud.iot.v1.DeviceManager.UnbindDeviceFromGateway", - "service": { - "shortName": "DeviceManager", - "fullName": "google.cloud.iot.v1.DeviceManager" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-iot/v1/src/index.ts b/owl-bot-staging/google-cloud-iot/v1/src/index.ts deleted file mode 100644 index 2990876398f..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/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 v1 from './v1'; -const DeviceManagerClient = v1.DeviceManagerClient; -type DeviceManagerClient = v1.DeviceManagerClient; -export {v1, DeviceManagerClient}; -export default {v1, DeviceManagerClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_client.ts b/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_client.ts deleted file mode 100644 index 1fe4c8729e6..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_client.ts +++ /dev/null @@ -1,2217 +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/device_manager_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './device_manager_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Internet of Things (IoT) service. Securely connect and manage IoT devices. - * @class - * @memberof v1 - */ -export class DeviceManagerClient { - 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}; - deviceManagerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DeviceManagerClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 DeviceManagerClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DeviceManagerClient; - 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 { - 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 = { - devicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/registries/{registry}/devices/{device}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - registryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/registries/{registry}' - ), - }; - - // 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 = { - listDeviceRegistries: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'deviceRegistries'), - listDevices: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'devices') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.iot.v1.DeviceManager', 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.deviceManagerStub) { - return this.deviceManagerStub; - } - - // Put together the "service stub" for - // google.cloud.iot.v1.DeviceManager. - this.deviceManagerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.iot.v1.DeviceManager') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.iot.v1.DeviceManager, - 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 deviceManagerStubMethods = - ['createDeviceRegistry', 'getDeviceRegistry', 'updateDeviceRegistry', 'deleteDeviceRegistry', 'listDeviceRegistries', 'createDevice', 'getDevice', 'updateDevice', 'deleteDevice', 'listDevices', 'modifyCloudToDeviceConfig', 'listDeviceConfigVersions', 'listDeviceStates', 'setIamPolicy', 'getIamPolicy', 'testIamPermissions', 'sendCommandToDevice', 'bindDeviceToGateway', 'unbindDeviceFromGateway']; - for (const methodName of deviceManagerStubMethods) { - const callPromise = this.deviceManagerStub.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.deviceManagerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'cloudiot.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 'cloudiot.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloudiot' - ]; - } - - 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 -- - // ------------------- -/** - * Creates a device registry that contains devices. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and cloud region where this device registry must be created. - * For example, `projects/example-project/locations/us-central1`. - * @param {google.cloud.iot.v1.DeviceRegistry} request.deviceRegistry - * Required. The device registry. The field `name` must be empty. The server will - * generate that field from the device registry `id` provided and the - * `parent` field. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.DeviceRegistry|DeviceRegistry}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.create_device_registry.js - * region_tag:cloudiot_v1_generated_DeviceManager_CreateDeviceRegistry_async - */ - createDeviceRegistry( - request?: protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest|undefined, {}|undefined - ]>; - createDeviceRegistry( - request: protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest|null|undefined, - {}|null|undefined>): void; - createDeviceRegistry( - request: protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest, - callback: Callback< - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest|null|undefined, - {}|null|undefined>): void; - createDeviceRegistry( - request?: protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.ICreateDeviceRegistryRequest|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.createDeviceRegistry(request, options, callback); - } -/** - * Gets a device registry configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the device registry. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.DeviceRegistry|DeviceRegistry}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.get_device_registry.js - * region_tag:cloudiot_v1_generated_DeviceManager_GetDeviceRegistry_async - */ - getDeviceRegistry( - request?: protos.google.cloud.iot.v1.IGetDeviceRegistryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.IGetDeviceRegistryRequest|undefined, {}|undefined - ]>; - getDeviceRegistry( - request: protos.google.cloud.iot.v1.IGetDeviceRegistryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.IGetDeviceRegistryRequest|null|undefined, - {}|null|undefined>): void; - getDeviceRegistry( - request: protos.google.cloud.iot.v1.IGetDeviceRegistryRequest, - callback: Callback< - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.IGetDeviceRegistryRequest|null|undefined, - {}|null|undefined>): void; - getDeviceRegistry( - request?: protos.google.cloud.iot.v1.IGetDeviceRegistryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.IGetDeviceRegistryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.IGetDeviceRegistryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.IGetDeviceRegistryRequest|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.getDeviceRegistry(request, options, callback); - } -/** - * Updates a device registry configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.iot.v1.DeviceRegistry} request.deviceRegistry - * Required. The new values for the device registry. The `id` field must be empty, and - * the `name` field must indicate the path of the resource. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Only updates the `device_registry` fields indicated by this mask. - * The field mask must not be empty, and it must not contain fields that - * are immutable or only set by the server. - * Mutable top-level fields: `event_notification_config`, `http_config`, - * `mqtt_config`, and `state_notification_config`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.DeviceRegistry|DeviceRegistry}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.update_device_registry.js - * region_tag:cloudiot_v1_generated_DeviceManager_UpdateDeviceRegistry_async - */ - updateDeviceRegistry( - request?: protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest|undefined, {}|undefined - ]>; - updateDeviceRegistry( - request: protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest|null|undefined, - {}|null|undefined>): void; - updateDeviceRegistry( - request: protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest, - callback: Callback< - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest|null|undefined, - {}|null|undefined>): void; - updateDeviceRegistry( - request?: protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iot.v1.IDeviceRegistry, - protos.google.cloud.iot.v1.IUpdateDeviceRegistryRequest|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({ - 'device_registry.name': request.deviceRegistry!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateDeviceRegistry(request, options, callback); - } -/** - * Deletes a device registry configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the device registry. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.delete_device_registry.js - * region_tag:cloudiot_v1_generated_DeviceManager_DeleteDeviceRegistry_async - */ - deleteDeviceRegistry( - request?: protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest|undefined, {}|undefined - ]>; - deleteDeviceRegistry( - request: protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest|null|undefined, - {}|null|undefined>): void; - deleteDeviceRegistry( - request: protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest|null|undefined, - {}|null|undefined>): void; - deleteDeviceRegistry( - request?: protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.iot.v1.IDeleteDeviceRegistryRequest|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.deleteDeviceRegistry(request, options, callback); - } -/** - * Creates a device in a device registry. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the device registry where this device should be created. - * For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - * @param {google.cloud.iot.v1.Device} request.device - * Required. The device registration details. The field `name` must be empty. The server - * generates `name` from the device registry `id` and the - * `parent` field. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.Device|Device}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.create_device.js - * region_tag:cloudiot_v1_generated_DeviceManager_CreateDevice_async - */ - createDevice( - request?: protos.google.cloud.iot.v1.ICreateDeviceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.ICreateDeviceRequest|undefined, {}|undefined - ]>; - createDevice( - request: protos.google.cloud.iot.v1.ICreateDeviceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.ICreateDeviceRequest|null|undefined, - {}|null|undefined>): void; - createDevice( - request: protos.google.cloud.iot.v1.ICreateDeviceRequest, - callback: Callback< - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.ICreateDeviceRequest|null|undefined, - {}|null|undefined>): void; - createDevice( - request?: protos.google.cloud.iot.v1.ICreateDeviceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.ICreateDeviceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.ICreateDeviceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.ICreateDeviceRequest|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.createDevice(request, options, callback); - } -/** - * Gets details about a device. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @param {google.protobuf.FieldMask} request.fieldMask - * The fields of the `Device` resource to be returned in the response. If the - * field mask is unset or empty, all fields are returned. Fields have to be - * provided in snake_case format, for example: `last_heartbeat_time`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.Device|Device}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.get_device.js - * region_tag:cloudiot_v1_generated_DeviceManager_GetDevice_async - */ - getDevice( - request?: protos.google.cloud.iot.v1.IGetDeviceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.IGetDeviceRequest|undefined, {}|undefined - ]>; - getDevice( - request: protos.google.cloud.iot.v1.IGetDeviceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.IGetDeviceRequest|null|undefined, - {}|null|undefined>): void; - getDevice( - request: protos.google.cloud.iot.v1.IGetDeviceRequest, - callback: Callback< - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.IGetDeviceRequest|null|undefined, - {}|null|undefined>): void; - getDevice( - request?: protos.google.cloud.iot.v1.IGetDeviceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.IGetDeviceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.IGetDeviceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.IGetDeviceRequest|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.getDevice(request, options, callback); - } -/** - * Updates a device. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.iot.v1.Device} request.device - * Required. The new values for the device. The `id` and `num_id` fields must - * be empty, and the field `name` must specify the name path. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Only updates the `device` fields indicated by this mask. - * The field mask must not be empty, and it must not contain fields that - * are immutable or only set by the server. - * Mutable top-level fields: `credentials`, `blocked`, and `metadata` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.Device|Device}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.update_device.js - * region_tag:cloudiot_v1_generated_DeviceManager_UpdateDevice_async - */ - updateDevice( - request?: protos.google.cloud.iot.v1.IUpdateDeviceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.IUpdateDeviceRequest|undefined, {}|undefined - ]>; - updateDevice( - request: protos.google.cloud.iot.v1.IUpdateDeviceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.IUpdateDeviceRequest|null|undefined, - {}|null|undefined>): void; - updateDevice( - request: protos.google.cloud.iot.v1.IUpdateDeviceRequest, - callback: Callback< - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.IUpdateDeviceRequest|null|undefined, - {}|null|undefined>): void; - updateDevice( - request?: protos.google.cloud.iot.v1.IUpdateDeviceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.IUpdateDeviceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.IUpdateDeviceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iot.v1.IDevice, - protos.google.cloud.iot.v1.IUpdateDeviceRequest|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({ - 'device.name': request.device!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateDevice(request, options, callback); - } -/** - * Deletes a device. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_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 protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.delete_device.js - * region_tag:cloudiot_v1_generated_DeviceManager_DeleteDevice_async - */ - deleteDevice( - request?: protos.google.cloud.iot.v1.IDeleteDeviceRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.iot.v1.IDeleteDeviceRequest|undefined, {}|undefined - ]>; - deleteDevice( - request: protos.google.cloud.iot.v1.IDeleteDeviceRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.iot.v1.IDeleteDeviceRequest|null|undefined, - {}|null|undefined>): void; - deleteDevice( - request: protos.google.cloud.iot.v1.IDeleteDeviceRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.iot.v1.IDeleteDeviceRequest|null|undefined, - {}|null|undefined>): void; - deleteDevice( - request?: protos.google.cloud.iot.v1.IDeleteDeviceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.iot.v1.IDeleteDeviceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.iot.v1.IDeleteDeviceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.iot.v1.IDeleteDeviceRequest|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.deleteDevice(request, options, callback); - } -/** - * Modifies the configuration for the device, which is eventually sent from - * the Cloud IoT Core servers. Returns the modified configuration version and - * its metadata. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @param {number} request.versionToUpdate - * The version number to update. If this value is zero, it will not check the - * version number of the server and will always update the current version; - * otherwise, this update will fail if the version number found on the server - * does not match this version number. This is used to support multiple - * simultaneous updates without losing data. - * @param {Buffer} request.binaryData - * Required. The configuration data for the device. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.DeviceConfig|DeviceConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.modify_cloud_to_device_config.js - * region_tag:cloudiot_v1_generated_DeviceManager_ModifyCloudToDeviceConfig_async - */ - modifyCloudToDeviceConfig( - request?: protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iot.v1.IDeviceConfig, - protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest|undefined, {}|undefined - ]>; - modifyCloudToDeviceConfig( - request: protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iot.v1.IDeviceConfig, - protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest|null|undefined, - {}|null|undefined>): void; - modifyCloudToDeviceConfig( - request: protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest, - callback: Callback< - protos.google.cloud.iot.v1.IDeviceConfig, - protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest|null|undefined, - {}|null|undefined>): void; - modifyCloudToDeviceConfig( - request?: protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iot.v1.IDeviceConfig, - protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iot.v1.IDeviceConfig, - protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iot.v1.IDeviceConfig, - protos.google.cloud.iot.v1.IModifyCloudToDeviceConfigRequest|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.modifyCloudToDeviceConfig(request, options, callback); - } -/** - * Lists the last few versions of the device configuration in descending - * order (i.e.: newest first). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @param {number} request.numVersions - * The number of versions to list. Versions are listed in decreasing order of - * the version number. The maximum number of versions retained is 10. If this - * value is zero, it will return all the versions available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.ListDeviceConfigVersionsResponse|ListDeviceConfigVersionsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.list_device_config_versions.js - * region_tag:cloudiot_v1_generated_DeviceManager_ListDeviceConfigVersions_async - */ - listDeviceConfigVersions( - request?: protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iot.v1.IListDeviceConfigVersionsResponse, - protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest|undefined, {}|undefined - ]>; - listDeviceConfigVersions( - request: protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iot.v1.IListDeviceConfigVersionsResponse, - protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest|null|undefined, - {}|null|undefined>): void; - listDeviceConfigVersions( - request: protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest, - callback: Callback< - protos.google.cloud.iot.v1.IListDeviceConfigVersionsResponse, - protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest|null|undefined, - {}|null|undefined>): void; - listDeviceConfigVersions( - request?: protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iot.v1.IListDeviceConfigVersionsResponse, - protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iot.v1.IListDeviceConfigVersionsResponse, - protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iot.v1.IListDeviceConfigVersionsResponse, - protos.google.cloud.iot.v1.IListDeviceConfigVersionsRequest|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.listDeviceConfigVersions(request, options, callback); - } -/** - * Lists the last few versions of the device state in descending order (i.e.: - * newest first). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @param {number} request.numStates - * The number of states to list. States are listed in descending order of - * update time. The maximum number of states retained is 10. If this - * value is zero, it will return all the states available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.ListDeviceStatesResponse|ListDeviceStatesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.list_device_states.js - * region_tag:cloudiot_v1_generated_DeviceManager_ListDeviceStates_async - */ - listDeviceStates( - request?: protos.google.cloud.iot.v1.IListDeviceStatesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iot.v1.IListDeviceStatesResponse, - protos.google.cloud.iot.v1.IListDeviceStatesRequest|undefined, {}|undefined - ]>; - listDeviceStates( - request: protos.google.cloud.iot.v1.IListDeviceStatesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iot.v1.IListDeviceStatesResponse, - protos.google.cloud.iot.v1.IListDeviceStatesRequest|null|undefined, - {}|null|undefined>): void; - listDeviceStates( - request: protos.google.cloud.iot.v1.IListDeviceStatesRequest, - callback: Callback< - protos.google.cloud.iot.v1.IListDeviceStatesResponse, - protos.google.cloud.iot.v1.IListDeviceStatesRequest|null|undefined, - {}|null|undefined>): void; - listDeviceStates( - request?: protos.google.cloud.iot.v1.IListDeviceStatesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iot.v1.IListDeviceStatesResponse, - protos.google.cloud.iot.v1.IListDeviceStatesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iot.v1.IListDeviceStatesResponse, - protos.google.cloud.iot.v1.IListDeviceStatesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iot.v1.IListDeviceStatesResponse, - protos.google.cloud.iot.v1.IListDeviceStatesRequest|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.listDeviceStates(request, options, callback); - } -/** - * Sets the access control policy on the specified resource. Replaces any - * existing policy. - * - * @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 protos.google.iam.v1.Policy|Policy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.set_iam_policy.js - * region_tag:cloudiot_v1_generated_DeviceManager_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 a resource. - * Returns an empty policy if the resource exists and does not have a policy - * set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {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 protos.google.iam.v1.Policy|Policy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.get_iam_policy.js - * region_tag:cloudiot_v1_generated_DeviceManager_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 specified resource. - * If the resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * @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 protos.google.iam.v1.TestIamPermissionsResponse|TestIamPermissionsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.test_iam_permissions.js - * region_tag:cloudiot_v1_generated_DeviceManager_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); - } -/** - * Sends a command to the specified device. In order for a device to be able - * to receive commands, it must: - * 1) be connected to Cloud IoT Core using the MQTT protocol, and - * 2) be subscribed to the group of MQTT topics specified by - * /devices/{device-id}/commands/#. This subscription will receive commands - * at the top-level topic /devices/{device-id}/commands as well as commands - * for subfolders, like /devices/{device-id}/commands/subfolder. - * Note that subscribing to specific subfolders is not supported. - * If the command could not be delivered to the device, this method will - * return an error; in particular, if the device is not subscribed, this - * method will return FAILED_PRECONDITION. Otherwise, this method will - * return OK. If the subscription is QoS 1, at least once delivery will be - * guaranteed; for QoS 0, no acknowledgment will be expected from the device. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @param {Buffer} request.binaryData - * Required. The command data to send to the device. - * @param {string} request.subfolder - * Optional subfolder for the command. If empty, the command will be delivered - * to the /devices/{device-id}/commands topic, otherwise it will be delivered - * to the /devices/{device-id}/commands/{subfolder} topic. Multi-level - * subfolders are allowed. This field must not have more than 256 characters, - * and must not contain any MQTT wildcards ("+" or "#") or null characters. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.SendCommandToDeviceResponse|SendCommandToDeviceResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.send_command_to_device.js - * region_tag:cloudiot_v1_generated_DeviceManager_SendCommandToDevice_async - */ - sendCommandToDevice( - request?: protos.google.cloud.iot.v1.ISendCommandToDeviceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iot.v1.ISendCommandToDeviceResponse, - protos.google.cloud.iot.v1.ISendCommandToDeviceRequest|undefined, {}|undefined - ]>; - sendCommandToDevice( - request: protos.google.cloud.iot.v1.ISendCommandToDeviceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iot.v1.ISendCommandToDeviceResponse, - protos.google.cloud.iot.v1.ISendCommandToDeviceRequest|null|undefined, - {}|null|undefined>): void; - sendCommandToDevice( - request: protos.google.cloud.iot.v1.ISendCommandToDeviceRequest, - callback: Callback< - protos.google.cloud.iot.v1.ISendCommandToDeviceResponse, - protos.google.cloud.iot.v1.ISendCommandToDeviceRequest|null|undefined, - {}|null|undefined>): void; - sendCommandToDevice( - request?: protos.google.cloud.iot.v1.ISendCommandToDeviceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iot.v1.ISendCommandToDeviceResponse, - protos.google.cloud.iot.v1.ISendCommandToDeviceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iot.v1.ISendCommandToDeviceResponse, - protos.google.cloud.iot.v1.ISendCommandToDeviceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iot.v1.ISendCommandToDeviceResponse, - protos.google.cloud.iot.v1.ISendCommandToDeviceRequest|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.sendCommandToDevice(request, options, callback); - } -/** - * Associates the device with the gateway. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the registry. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - * @param {string} request.gatewayId - * Required. The value of `gateway_id` can be either the device numeric ID or the - * user-defined device identifier. - * @param {string} request.deviceId - * Required. The device to associate with the specified gateway. The value of - * `device_id` can be either the device numeric ID or the user-defined device - * identifier. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.BindDeviceToGatewayResponse|BindDeviceToGatewayResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.bind_device_to_gateway.js - * region_tag:cloudiot_v1_generated_DeviceManager_BindDeviceToGateway_async - */ - bindDeviceToGateway( - request?: protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iot.v1.IBindDeviceToGatewayResponse, - protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest|undefined, {}|undefined - ]>; - bindDeviceToGateway( - request: protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iot.v1.IBindDeviceToGatewayResponse, - protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest|null|undefined, - {}|null|undefined>): void; - bindDeviceToGateway( - request: protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest, - callback: Callback< - protos.google.cloud.iot.v1.IBindDeviceToGatewayResponse, - protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest|null|undefined, - {}|null|undefined>): void; - bindDeviceToGateway( - request?: protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iot.v1.IBindDeviceToGatewayResponse, - protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iot.v1.IBindDeviceToGatewayResponse, - protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iot.v1.IBindDeviceToGatewayResponse, - protos.google.cloud.iot.v1.IBindDeviceToGatewayRequest|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.bindDeviceToGateway(request, options, callback); - } -/** - * Deletes the association between the device and the gateway. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the registry. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - * @param {string} request.gatewayId - * Required. The value of `gateway_id` can be either the device numeric ID or the - * user-defined device identifier. - * @param {string} request.deviceId - * Required. The device to disassociate from the specified gateway. The value of - * `device_id` can be either the device numeric ID or the user-defined device - * identifier. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse|UnbindDeviceFromGatewayResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.unbind_device_from_gateway.js - * region_tag:cloudiot_v1_generated_DeviceManager_UnbindDeviceFromGateway_async - */ - unbindDeviceFromGateway( - request?: protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayResponse, - protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest|undefined, {}|undefined - ]>; - unbindDeviceFromGateway( - request: protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayResponse, - protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest|null|undefined, - {}|null|undefined>): void; - unbindDeviceFromGateway( - request: protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest, - callback: Callback< - protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayResponse, - protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest|null|undefined, - {}|null|undefined>): void; - unbindDeviceFromGateway( - request?: protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayResponse, - protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayResponse, - protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayResponse, - protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayRequest|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.unbindDeviceFromGateway(request, options, callback); - } - - /** - * Lists device registries. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and cloud region path. For example, - * `projects/example-project/locations/us-central1`. - * @param {number} request.pageSize - * The maximum number of registries to return in the response. If this value - * is zero, the service will select a default size. A call may return fewer - * objects than requested. A non-empty `next_page_token` in the response - * indicates that more data is available. - * @param {string} request.pageToken - * The value returned by the last `ListDeviceRegistriesResponse`; indicates - * that this is a continuation of a prior `ListDeviceRegistries` call and - * the system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.DeviceRegistry|DeviceRegistry}. - * 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 `listDeviceRegistriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDeviceRegistries( - request?: protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iot.v1.IDeviceRegistry[], - protos.google.cloud.iot.v1.IListDeviceRegistriesRequest|null, - protos.google.cloud.iot.v1.IListDeviceRegistriesResponse - ]>; - listDeviceRegistries( - request: protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, - protos.google.cloud.iot.v1.IListDeviceRegistriesResponse|null|undefined, - protos.google.cloud.iot.v1.IDeviceRegistry>): void; - listDeviceRegistries( - request: protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, - callback: PaginationCallback< - protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, - protos.google.cloud.iot.v1.IListDeviceRegistriesResponse|null|undefined, - protos.google.cloud.iot.v1.IDeviceRegistry>): void; - listDeviceRegistries( - request?: protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, - protos.google.cloud.iot.v1.IListDeviceRegistriesResponse|null|undefined, - protos.google.cloud.iot.v1.IDeviceRegistry>, - callback?: PaginationCallback< - protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, - protos.google.cloud.iot.v1.IListDeviceRegistriesResponse|null|undefined, - protos.google.cloud.iot.v1.IDeviceRegistry>): - Promise<[ - protos.google.cloud.iot.v1.IDeviceRegistry[], - protos.google.cloud.iot.v1.IListDeviceRegistriesRequest|null, - protos.google.cloud.iot.v1.IListDeviceRegistriesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listDeviceRegistries(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and cloud region path. For example, - * `projects/example-project/locations/us-central1`. - * @param {number} request.pageSize - * The maximum number of registries to return in the response. If this value - * is zero, the service will select a default size. A call may return fewer - * objects than requested. A non-empty `next_page_token` in the response - * indicates that more data is available. - * @param {string} request.pageToken - * The value returned by the last `ListDeviceRegistriesResponse`; indicates - * that this is a continuation of a prior `ListDeviceRegistries` call and - * the system should return the next page of data. - * @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 protos.google.cloud.iot.v1.DeviceRegistry|DeviceRegistry} 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 `listDeviceRegistriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDeviceRegistriesStream( - request?: protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, - 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['listDeviceRegistries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDeviceRegistries.createStream( - this.innerApiCalls.listDeviceRegistries as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDeviceRegistries`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and cloud region path. For example, - * `projects/example-project/locations/us-central1`. - * @param {number} request.pageSize - * The maximum number of registries to return in the response. If this value - * is zero, the service will select a default size. A call may return fewer - * objects than requested. A non-empty `next_page_token` in the response - * indicates that more data is available. - * @param {string} request.pageToken - * The value returned by the last `ListDeviceRegistriesResponse`; indicates - * that this is a continuation of a prior `ListDeviceRegistries` call and - * the system should return the next page of data. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.iot.v1.DeviceRegistry|DeviceRegistry}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.list_device_registries.js - * region_tag:cloudiot_v1_generated_DeviceManager_ListDeviceRegistries_async - */ - listDeviceRegistriesAsync( - request?: protos.google.cloud.iot.v1.IListDeviceRegistriesRequest, - 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['listDeviceRegistries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDeviceRegistries.asyncIterate( - this.innerApiCalls['listDeviceRegistries'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * List devices in a device registry. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The device registry path. Required. For example, - * `projects/my-project/locations/us-central1/registries/my-registry`. - * @param {number[]} request.deviceNumIds - * A list of device numeric IDs. If empty, this field is ignored. Maximum - * IDs: 10,000. - * @param {string[]} request.deviceIds - * A list of device string IDs. For example, `['device0', 'device12']`. - * If empty, this field is ignored. Maximum IDs: 10,000 - * @param {google.protobuf.FieldMask} request.fieldMask - * The fields of the `Device` resource to be returned in the response. The - * fields `id` and `num_id` are always returned, along with any - * other fields specified in snake_case format, for example: - * `last_heartbeat_time`. - * @param {google.cloud.iot.v1.GatewayListOptions} request.gatewayListOptions - * Options related to gateways. - * @param {number} request.pageSize - * The maximum number of devices to return in the response. If this value - * is zero, the service will select a default size. A call may return fewer - * objects than requested. A non-empty `next_page_token` in the response - * indicates that more data is available. - * @param {string} request.pageToken - * The value returned by the last `ListDevicesResponse`; indicates - * that this is a continuation of a prior `ListDevices` call and - * the system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.iot.v1.Device|Device}. - * 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 `listDevicesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDevices( - request?: protos.google.cloud.iot.v1.IListDevicesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iot.v1.IDevice[], - protos.google.cloud.iot.v1.IListDevicesRequest|null, - protos.google.cloud.iot.v1.IListDevicesResponse - ]>; - listDevices( - request: protos.google.cloud.iot.v1.IListDevicesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.iot.v1.IListDevicesRequest, - protos.google.cloud.iot.v1.IListDevicesResponse|null|undefined, - protos.google.cloud.iot.v1.IDevice>): void; - listDevices( - request: protos.google.cloud.iot.v1.IListDevicesRequest, - callback: PaginationCallback< - protos.google.cloud.iot.v1.IListDevicesRequest, - protos.google.cloud.iot.v1.IListDevicesResponse|null|undefined, - protos.google.cloud.iot.v1.IDevice>): void; - listDevices( - request?: protos.google.cloud.iot.v1.IListDevicesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.iot.v1.IListDevicesRequest, - protos.google.cloud.iot.v1.IListDevicesResponse|null|undefined, - protos.google.cloud.iot.v1.IDevice>, - callback?: PaginationCallback< - protos.google.cloud.iot.v1.IListDevicesRequest, - protos.google.cloud.iot.v1.IListDevicesResponse|null|undefined, - protos.google.cloud.iot.v1.IDevice>): - Promise<[ - protos.google.cloud.iot.v1.IDevice[], - protos.google.cloud.iot.v1.IListDevicesRequest|null, - protos.google.cloud.iot.v1.IListDevicesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listDevices(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The device registry path. Required. For example, - * `projects/my-project/locations/us-central1/registries/my-registry`. - * @param {number[]} request.deviceNumIds - * A list of device numeric IDs. If empty, this field is ignored. Maximum - * IDs: 10,000. - * @param {string[]} request.deviceIds - * A list of device string IDs. For example, `['device0', 'device12']`. - * If empty, this field is ignored. Maximum IDs: 10,000 - * @param {google.protobuf.FieldMask} request.fieldMask - * The fields of the `Device` resource to be returned in the response. The - * fields `id` and `num_id` are always returned, along with any - * other fields specified in snake_case format, for example: - * `last_heartbeat_time`. - * @param {google.cloud.iot.v1.GatewayListOptions} request.gatewayListOptions - * Options related to gateways. - * @param {number} request.pageSize - * The maximum number of devices to return in the response. If this value - * is zero, the service will select a default size. A call may return fewer - * objects than requested. A non-empty `next_page_token` in the response - * indicates that more data is available. - * @param {string} request.pageToken - * The value returned by the last `ListDevicesResponse`; indicates - * that this is a continuation of a prior `ListDevices` call and - * the system should return the next page of data. - * @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 protos.google.cloud.iot.v1.Device|Device} 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 `listDevicesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDevicesStream( - request?: protos.google.cloud.iot.v1.IListDevicesRequest, - 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['listDevices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDevices.createStream( - this.innerApiCalls.listDevices as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDevices`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The device registry path. Required. For example, - * `projects/my-project/locations/us-central1/registries/my-registry`. - * @param {number[]} request.deviceNumIds - * A list of device numeric IDs. If empty, this field is ignored. Maximum - * IDs: 10,000. - * @param {string[]} request.deviceIds - * A list of device string IDs. For example, `['device0', 'device12']`. - * If empty, this field is ignored. Maximum IDs: 10,000 - * @param {google.protobuf.FieldMask} request.fieldMask - * The fields of the `Device` resource to be returned in the response. The - * fields `id` and `num_id` are always returned, along with any - * other fields specified in snake_case format, for example: - * `last_heartbeat_time`. - * @param {google.cloud.iot.v1.GatewayListOptions} request.gatewayListOptions - * Options related to gateways. - * @param {number} request.pageSize - * The maximum number of devices to return in the response. If this value - * is zero, the service will select a default size. A call may return fewer - * objects than requested. A non-empty `next_page_token` in the response - * indicates that more data is available. - * @param {string} request.pageToken - * The value returned by the last `ListDevicesResponse`; indicates - * that this is a continuation of a prior `ListDevices` call and - * the system should return the next page of data. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.iot.v1.Device|Device}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/device_manager.list_devices.js - * region_tag:cloudiot_v1_generated_DeviceManager_ListDevices_async - */ - listDevicesAsync( - request?: protos.google.cloud.iot.v1.IListDevicesRequest, - 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['listDevices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDevices.asyncIterate( - this.innerApiCalls['listDevices'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified device resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} registry - * @param {string} device - * @returns {string} Resource name string. - */ - devicePath(project:string,location:string,registry:string,device:string) { - return this.pathTemplates.devicePathTemplate.render({ - project: project, - location: location, - registry: registry, - device: device, - }); - } - - /** - * Parse the project from Device resource. - * - * @param {string} deviceName - * A fully-qualified path representing Device resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDeviceName(deviceName: string) { - return this.pathTemplates.devicePathTemplate.match(deviceName).project; - } - - /** - * Parse the location from Device resource. - * - * @param {string} deviceName - * A fully-qualified path representing Device resource. - * @returns {string} A string representing the location. - */ - matchLocationFromDeviceName(deviceName: string) { - return this.pathTemplates.devicePathTemplate.match(deviceName).location; - } - - /** - * Parse the registry from Device resource. - * - * @param {string} deviceName - * A fully-qualified path representing Device resource. - * @returns {string} A string representing the registry. - */ - matchRegistryFromDeviceName(deviceName: string) { - return this.pathTemplates.devicePathTemplate.match(deviceName).registry; - } - - /** - * Parse the device from Device resource. - * - * @param {string} deviceName - * A fully-qualified path representing Device resource. - * @returns {string} A string representing the device. - */ - matchDeviceFromDeviceName(deviceName: string) { - return this.pathTemplates.devicePathTemplate.match(deviceName).device; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified registry resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} registry - * @returns {string} Resource name string. - */ - registryPath(project:string,location:string,registry:string) { - return this.pathTemplates.registryPathTemplate.render({ - project: project, - location: location, - registry: registry, - }); - } - - /** - * Parse the project from Registry resource. - * - * @param {string} registryName - * A fully-qualified path representing Registry resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRegistryName(registryName: string) { - return this.pathTemplates.registryPathTemplate.match(registryName).project; - } - - /** - * Parse the location from Registry resource. - * - * @param {string} registryName - * A fully-qualified path representing Registry resource. - * @returns {string} A string representing the location. - */ - matchLocationFromRegistryName(registryName: string) { - return this.pathTemplates.registryPathTemplate.match(registryName).location; - } - - /** - * Parse the registry from Registry resource. - * - * @param {string} registryName - * A fully-qualified path representing Registry resource. - * @returns {string} A string representing the registry. - */ - matchRegistryFromRegistryName(registryName: string) { - return this.pathTemplates.registryPathTemplate.match(registryName).registry; - } - - /** - * 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.deviceManagerStub && !this._terminated) { - return this.deviceManagerStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_client_config.json b/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_client_config.json deleted file mode 100644 index 5ded0fd1cb3..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_client_config.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "interfaces": { - "google.cloud.iot.v1.DeviceManager": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "deadline_exceeded_resource_exhausted_unavailable": [ - "DEADLINE_EXCEEDED", - "RESOURCE_EXHAUSTED", - "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 - }, - "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c": { - "initial_retry_delay_millis": 1000, - "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": { - "CreateDeviceRegistry": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetDeviceRegistry": { - "timeout_millis": 120000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateDeviceRegistry": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteDeviceRegistry": { - "timeout_millis": 120000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListDeviceRegistries": { - "timeout_millis": 120000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateDevice": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetDevice": { - "timeout_millis": 120000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateDevice": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteDevice": { - "timeout_millis": 120000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListDevices": { - "timeout_millis": 120000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ModifyCloudToDeviceConfig": { - "timeout_millis": 120000, - "retry_codes_name": "deadline_exceeded_resource_exhausted_unavailable", - "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" - }, - "ListDeviceConfigVersions": { - "timeout_millis": 120000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListDeviceStates": { - "timeout_millis": 120000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "SetIamPolicy": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIamPolicy": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "TestIamPermissions": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SendCommandToDevice": { - "timeout_millis": 120000, - "retry_codes_name": "deadline_exceeded_resource_exhausted_unavailable", - "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" - }, - "BindDeviceToGateway": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UnbindDeviceFromGateway": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_proto_list.json b/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_proto_list.json deleted file mode 100644 index 95cf55973ec..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/src/v1/device_manager_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/iot/v1/device_manager.proto", - "../../protos/google/cloud/iot/v1/resources.proto" -] diff --git a/owl-bot-staging/google-cloud-iot/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-iot/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 28ab3c5db9b..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,221 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.iot.v1", - "libraryPackage": "@google-cloud/iot", - "services": { - "DeviceManager": { - "clients": { - "grpc": { - "libraryClient": "DeviceManagerClient", - "rpcs": { - "CreateDeviceRegistry": { - "methods": [ - "createDeviceRegistry" - ] - }, - "GetDeviceRegistry": { - "methods": [ - "getDeviceRegistry" - ] - }, - "UpdateDeviceRegistry": { - "methods": [ - "updateDeviceRegistry" - ] - }, - "DeleteDeviceRegistry": { - "methods": [ - "deleteDeviceRegistry" - ] - }, - "CreateDevice": { - "methods": [ - "createDevice" - ] - }, - "GetDevice": { - "methods": [ - "getDevice" - ] - }, - "UpdateDevice": { - "methods": [ - "updateDevice" - ] - }, - "DeleteDevice": { - "methods": [ - "deleteDevice" - ] - }, - "ModifyCloudToDeviceConfig": { - "methods": [ - "modifyCloudToDeviceConfig" - ] - }, - "ListDeviceConfigVersions": { - "methods": [ - "listDeviceConfigVersions" - ] - }, - "ListDeviceStates": { - "methods": [ - "listDeviceStates" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "SendCommandToDevice": { - "methods": [ - "sendCommandToDevice" - ] - }, - "BindDeviceToGateway": { - "methods": [ - "bindDeviceToGateway" - ] - }, - "UnbindDeviceFromGateway": { - "methods": [ - "unbindDeviceFromGateway" - ] - }, - "ListDeviceRegistries": { - "methods": [ - "listDeviceRegistries", - "listDeviceRegistriesStream", - "listDeviceRegistriesAsync" - ] - }, - "ListDevices": { - "methods": [ - "listDevices", - "listDevicesStream", - "listDevicesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "DeviceManagerClient", - "rpcs": { - "CreateDeviceRegistry": { - "methods": [ - "createDeviceRegistry" - ] - }, - "GetDeviceRegistry": { - "methods": [ - "getDeviceRegistry" - ] - }, - "UpdateDeviceRegistry": { - "methods": [ - "updateDeviceRegistry" - ] - }, - "DeleteDeviceRegistry": { - "methods": [ - "deleteDeviceRegistry" - ] - }, - "CreateDevice": { - "methods": [ - "createDevice" - ] - }, - "GetDevice": { - "methods": [ - "getDevice" - ] - }, - "UpdateDevice": { - "methods": [ - "updateDevice" - ] - }, - "DeleteDevice": { - "methods": [ - "deleteDevice" - ] - }, - "ModifyCloudToDeviceConfig": { - "methods": [ - "modifyCloudToDeviceConfig" - ] - }, - "ListDeviceConfigVersions": { - "methods": [ - "listDeviceConfigVersions" - ] - }, - "ListDeviceStates": { - "methods": [ - "listDeviceStates" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "SendCommandToDevice": { - "methods": [ - "sendCommandToDevice" - ] - }, - "BindDeviceToGateway": { - "methods": [ - "bindDeviceToGateway" - ] - }, - "UnbindDeviceFromGateway": { - "methods": [ - "unbindDeviceFromGateway" - ] - }, - "ListDeviceRegistries": { - "methods": [ - "listDeviceRegistries", - "listDeviceRegistriesStream", - "listDeviceRegistriesAsync" - ] - }, - "ListDevices": { - "methods": [ - "listDevices", - "listDevicesStream", - "listDevicesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-iot/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-iot/v1/src/v1/index.ts deleted file mode 100644 index 3a9c53a4c21..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/src/v1/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 {DeviceManagerClient} from './device_manager_client'; diff --git a/owl-bot-staging/google-cloud-iot/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-iot/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 5f9fa318176..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/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 iot = require('@google-cloud/iot'); - -function main() { - const deviceManagerClient = new iot.DeviceManagerClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-iot/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-iot/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index a5837baba06..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/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 {DeviceManagerClient} from '@google-cloud/iot'; - -// check that the client class type name can be used -function doStuffWithDeviceManagerClient(client: DeviceManagerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const deviceManagerClient = new DeviceManagerClient(); - doStuffWithDeviceManagerClient(deviceManagerClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-iot/v1/system-test/install.ts b/owl-bot-staging/google-cloud-iot/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-iot/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-iot/v1/test/gapic_device_manager_v1.ts b/owl-bot-staging/google-cloud-iot/v1/test/gapic_device_manager_v1.ts deleted file mode 100644 index 9aefcb760ce..00000000000 --- a/owl-bot-staging/google-cloud-iot/v1/test/gapic_device_manager_v1.ts +++ /dev/null @@ -1,2672 +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 devicemanagerModule 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.DeviceManagerClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = devicemanagerModule.v1.DeviceManagerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = devicemanagerModule.v1.DeviceManagerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = devicemanagerModule.v1.DeviceManagerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new devicemanagerModule.v1.DeviceManagerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.deviceManagerStub, undefined); - await client.initialize(); - assert(client.deviceManagerStub); - }); - - it('has close method for the initialized client', done => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.deviceManagerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.deviceManagerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new devicemanagerModule.v1.DeviceManagerClient({ - 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 devicemanagerModule.v1.DeviceManagerClient({ - 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('createDeviceRegistry', () => { - it('invokes createDeviceRegistry without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.CreateDeviceRegistryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.CreateDeviceRegistryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.DeviceRegistry() - ); - client.innerApiCalls.createDeviceRegistry = stubSimpleCall(expectedResponse); - const [response] = await client.createDeviceRegistry(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDeviceRegistry as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDeviceRegistry as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDeviceRegistry without error using callback', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.CreateDeviceRegistryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.CreateDeviceRegistryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.DeviceRegistry() - ); - client.innerApiCalls.createDeviceRegistry = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDeviceRegistry( - request, - (err?: Error|null, result?: protos.google.cloud.iot.v1.IDeviceRegistry|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDeviceRegistry as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDeviceRegistry as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDeviceRegistry with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.CreateDeviceRegistryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.CreateDeviceRegistryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDeviceRegistry = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createDeviceRegistry(request), expectedError); - const actualRequest = (client.innerApiCalls.createDeviceRegistry as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDeviceRegistry as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDeviceRegistry with closed client', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.CreateDeviceRegistryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.CreateDeviceRegistryRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createDeviceRegistry(request), expectedError); - }); - }); - - describe('getDeviceRegistry', () => { - it('invokes getDeviceRegistry without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.GetDeviceRegistryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.GetDeviceRegistryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.DeviceRegistry() - ); - client.innerApiCalls.getDeviceRegistry = stubSimpleCall(expectedResponse); - const [response] = await client.getDeviceRegistry(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDeviceRegistry as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDeviceRegistry as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDeviceRegistry without error using callback', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.GetDeviceRegistryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.GetDeviceRegistryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.DeviceRegistry() - ); - client.innerApiCalls.getDeviceRegistry = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDeviceRegistry( - request, - (err?: Error|null, result?: protos.google.cloud.iot.v1.IDeviceRegistry|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDeviceRegistry as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDeviceRegistry as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDeviceRegistry with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.GetDeviceRegistryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.GetDeviceRegistryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDeviceRegistry = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDeviceRegistry(request), expectedError); - const actualRequest = (client.innerApiCalls.getDeviceRegistry as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDeviceRegistry as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDeviceRegistry with closed client', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.GetDeviceRegistryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.GetDeviceRegistryRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getDeviceRegistry(request), expectedError); - }); - }); - - describe('updateDeviceRegistry', () => { - it('invokes updateDeviceRegistry without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.UpdateDeviceRegistryRequest() - ); - request.deviceRegistry ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.UpdateDeviceRegistryRequest', ['deviceRegistry', 'name']); - request.deviceRegistry.name = defaultValue1; - const expectedHeaderRequestParams = `device_registry.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.DeviceRegistry() - ); - client.innerApiCalls.updateDeviceRegistry = stubSimpleCall(expectedResponse); - const [response] = await client.updateDeviceRegistry(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDeviceRegistry as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDeviceRegistry as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDeviceRegistry without error using callback', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.UpdateDeviceRegistryRequest() - ); - request.deviceRegistry ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.UpdateDeviceRegistryRequest', ['deviceRegistry', 'name']); - request.deviceRegistry.name = defaultValue1; - const expectedHeaderRequestParams = `device_registry.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.DeviceRegistry() - ); - client.innerApiCalls.updateDeviceRegistry = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDeviceRegistry( - request, - (err?: Error|null, result?: protos.google.cloud.iot.v1.IDeviceRegistry|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDeviceRegistry as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDeviceRegistry as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDeviceRegistry with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.UpdateDeviceRegistryRequest() - ); - request.deviceRegistry ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.UpdateDeviceRegistryRequest', ['deviceRegistry', 'name']); - request.deviceRegistry.name = defaultValue1; - const expectedHeaderRequestParams = `device_registry.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDeviceRegistry = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateDeviceRegistry(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDeviceRegistry as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDeviceRegistry as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDeviceRegistry with closed client', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.UpdateDeviceRegistryRequest() - ); - request.deviceRegistry ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.UpdateDeviceRegistryRequest', ['deviceRegistry', 'name']); - request.deviceRegistry.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateDeviceRegistry(request), expectedError); - }); - }); - - describe('deleteDeviceRegistry', () => { - it('invokes deleteDeviceRegistry without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.DeleteDeviceRegistryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.DeleteDeviceRegistryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDeviceRegistry = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDeviceRegistry(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDeviceRegistry as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDeviceRegistry as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDeviceRegistry without error using callback', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.DeleteDeviceRegistryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.DeleteDeviceRegistryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDeviceRegistry = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDeviceRegistry( - 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.deleteDeviceRegistry as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDeviceRegistry as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDeviceRegistry with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.DeleteDeviceRegistryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.DeleteDeviceRegistryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDeviceRegistry = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDeviceRegistry(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDeviceRegistry as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDeviceRegistry as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDeviceRegistry with closed client', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.DeleteDeviceRegistryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.DeleteDeviceRegistryRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteDeviceRegistry(request), expectedError); - }); - }); - - describe('createDevice', () => { - it('invokes createDevice without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.CreateDeviceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.CreateDeviceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.Device() - ); - client.innerApiCalls.createDevice = stubSimpleCall(expectedResponse); - const [response] = await client.createDevice(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDevice as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDevice as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDevice without error using callback', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.CreateDeviceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.CreateDeviceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.Device() - ); - client.innerApiCalls.createDevice = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDevice( - request, - (err?: Error|null, result?: protos.google.cloud.iot.v1.IDevice|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDevice as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDevice as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDevice with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.CreateDeviceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.CreateDeviceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDevice = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createDevice(request), expectedError); - const actualRequest = (client.innerApiCalls.createDevice as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDevice as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDevice with closed client', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.CreateDeviceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.CreateDeviceRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createDevice(request), expectedError); - }); - }); - - describe('getDevice', () => { - it('invokes getDevice without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.GetDeviceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.GetDeviceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.Device() - ); - client.innerApiCalls.getDevice = stubSimpleCall(expectedResponse); - const [response] = await client.getDevice(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDevice as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDevice as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDevice without error using callback', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.GetDeviceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.GetDeviceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.Device() - ); - client.innerApiCalls.getDevice = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDevice( - request, - (err?: Error|null, result?: protos.google.cloud.iot.v1.IDevice|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDevice as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDevice as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDevice with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.GetDeviceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.GetDeviceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDevice = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDevice(request), expectedError); - const actualRequest = (client.innerApiCalls.getDevice as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDevice as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDevice with closed client', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.GetDeviceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.GetDeviceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getDevice(request), expectedError); - }); - }); - - describe('updateDevice', () => { - it('invokes updateDevice without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.UpdateDeviceRequest() - ); - request.device ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.UpdateDeviceRequest', ['device', 'name']); - request.device.name = defaultValue1; - const expectedHeaderRequestParams = `device.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.Device() - ); - client.innerApiCalls.updateDevice = stubSimpleCall(expectedResponse); - const [response] = await client.updateDevice(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDevice as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDevice as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDevice without error using callback', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.UpdateDeviceRequest() - ); - request.device ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.UpdateDeviceRequest', ['device', 'name']); - request.device.name = defaultValue1; - const expectedHeaderRequestParams = `device.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.Device() - ); - client.innerApiCalls.updateDevice = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDevice( - request, - (err?: Error|null, result?: protos.google.cloud.iot.v1.IDevice|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDevice as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDevice as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDevice with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.UpdateDeviceRequest() - ); - request.device ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.UpdateDeviceRequest', ['device', 'name']); - request.device.name = defaultValue1; - const expectedHeaderRequestParams = `device.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDevice = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateDevice(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDevice as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDevice as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDevice with closed client', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.UpdateDeviceRequest() - ); - request.device ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.UpdateDeviceRequest', ['device', 'name']); - request.device.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateDevice(request), expectedError); - }); - }); - - describe('deleteDevice', () => { - it('invokes deleteDevice without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.DeleteDeviceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.DeleteDeviceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDevice = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDevice(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDevice as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDevice as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDevice without error using callback', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.DeleteDeviceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.DeleteDeviceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDevice = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDevice( - 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.deleteDevice as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDevice as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDevice with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.DeleteDeviceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.DeleteDeviceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDevice = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDevice(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDevice as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDevice as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDevice with closed client', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.DeleteDeviceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.DeleteDeviceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteDevice(request), expectedError); - }); - }); - - describe('modifyCloudToDeviceConfig', () => { - it('invokes modifyCloudToDeviceConfig without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.DeviceConfig() - ); - client.innerApiCalls.modifyCloudToDeviceConfig = stubSimpleCall(expectedResponse); - const [response] = await client.modifyCloudToDeviceConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.modifyCloudToDeviceConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.modifyCloudToDeviceConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes modifyCloudToDeviceConfig without error using callback', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.DeviceConfig() - ); - client.innerApiCalls.modifyCloudToDeviceConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.modifyCloudToDeviceConfig( - request, - (err?: Error|null, result?: protos.google.cloud.iot.v1.IDeviceConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.modifyCloudToDeviceConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.modifyCloudToDeviceConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes modifyCloudToDeviceConfig with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.modifyCloudToDeviceConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.modifyCloudToDeviceConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.modifyCloudToDeviceConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.modifyCloudToDeviceConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes modifyCloudToDeviceConfig with closed client', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.modifyCloudToDeviceConfig(request), expectedError); - }); - }); - - describe('listDeviceConfigVersions', () => { - it('invokes listDeviceConfigVersions without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceConfigVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceConfigVersionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceConfigVersionsResponse() - ); - client.innerApiCalls.listDeviceConfigVersions = stubSimpleCall(expectedResponse); - const [response] = await client.listDeviceConfigVersions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDeviceConfigVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeviceConfigVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeviceConfigVersions without error using callback', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceConfigVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceConfigVersionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceConfigVersionsResponse() - ); - client.innerApiCalls.listDeviceConfigVersions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDeviceConfigVersions( - request, - (err?: Error|null, result?: protos.google.cloud.iot.v1.IListDeviceConfigVersionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDeviceConfigVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeviceConfigVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeviceConfigVersions with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceConfigVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceConfigVersionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDeviceConfigVersions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDeviceConfigVersions(request), expectedError); - const actualRequest = (client.innerApiCalls.listDeviceConfigVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeviceConfigVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeviceConfigVersions with closed client', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceConfigVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceConfigVersionsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listDeviceConfigVersions(request), expectedError); - }); - }); - - describe('listDeviceStates', () => { - it('invokes listDeviceStates without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceStatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceStatesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceStatesResponse() - ); - client.innerApiCalls.listDeviceStates = stubSimpleCall(expectedResponse); - const [response] = await client.listDeviceStates(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDeviceStates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeviceStates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeviceStates without error using callback', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceStatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceStatesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceStatesResponse() - ); - client.innerApiCalls.listDeviceStates = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDeviceStates( - request, - (err?: Error|null, result?: protos.google.cloud.iot.v1.IListDeviceStatesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDeviceStates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeviceStates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeviceStates with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceStatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceStatesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDeviceStates = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDeviceStates(request), expectedError); - const actualRequest = (client.innerApiCalls.listDeviceStates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeviceStates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeviceStates with closed client', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceStatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceStatesRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listDeviceStates(request), expectedError); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - 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 devicemanagerModule.v1.DeviceManagerClient({ - 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 devicemanagerModule.v1.DeviceManagerClient({ - 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 devicemanagerModule.v1.DeviceManagerClient({ - 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 devicemanagerModule.v1.DeviceManagerClient({ - 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 devicemanagerModule.v1.DeviceManagerClient({ - 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 devicemanagerModule.v1.DeviceManagerClient({ - 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 devicemanagerModule.v1.DeviceManagerClient({ - 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 devicemanagerModule.v1.DeviceManagerClient({ - 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 devicemanagerModule.v1.DeviceManagerClient({ - 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 devicemanagerModule.v1.DeviceManagerClient({ - 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 devicemanagerModule.v1.DeviceManagerClient({ - 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('sendCommandToDevice', () => { - it('invokes sendCommandToDevice without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.SendCommandToDeviceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.SendCommandToDeviceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.SendCommandToDeviceResponse() - ); - client.innerApiCalls.sendCommandToDevice = stubSimpleCall(expectedResponse); - const [response] = await client.sendCommandToDevice(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.sendCommandToDevice as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.sendCommandToDevice as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes sendCommandToDevice without error using callback', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.SendCommandToDeviceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.SendCommandToDeviceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.SendCommandToDeviceResponse() - ); - client.innerApiCalls.sendCommandToDevice = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.sendCommandToDevice( - request, - (err?: Error|null, result?: protos.google.cloud.iot.v1.ISendCommandToDeviceResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.sendCommandToDevice as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.sendCommandToDevice as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes sendCommandToDevice with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.SendCommandToDeviceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.SendCommandToDeviceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.sendCommandToDevice = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.sendCommandToDevice(request), expectedError); - const actualRequest = (client.innerApiCalls.sendCommandToDevice as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.sendCommandToDevice as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes sendCommandToDevice with closed client', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.SendCommandToDeviceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.SendCommandToDeviceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.sendCommandToDevice(request), expectedError); - }); - }); - - describe('bindDeviceToGateway', () => { - it('invokes bindDeviceToGateway without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.BindDeviceToGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.BindDeviceToGatewayRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.BindDeviceToGatewayResponse() - ); - client.innerApiCalls.bindDeviceToGateway = stubSimpleCall(expectedResponse); - const [response] = await client.bindDeviceToGateway(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.bindDeviceToGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.bindDeviceToGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes bindDeviceToGateway without error using callback', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.BindDeviceToGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.BindDeviceToGatewayRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.BindDeviceToGatewayResponse() - ); - client.innerApiCalls.bindDeviceToGateway = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.bindDeviceToGateway( - request, - (err?: Error|null, result?: protos.google.cloud.iot.v1.IBindDeviceToGatewayResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.bindDeviceToGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.bindDeviceToGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes bindDeviceToGateway with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.BindDeviceToGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.BindDeviceToGatewayRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.bindDeviceToGateway = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.bindDeviceToGateway(request), expectedError); - const actualRequest = (client.innerApiCalls.bindDeviceToGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.bindDeviceToGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes bindDeviceToGateway with closed client', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.BindDeviceToGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.BindDeviceToGatewayRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.bindDeviceToGateway(request), expectedError); - }); - }); - - describe('unbindDeviceFromGateway', () => { - it('invokes unbindDeviceFromGateway without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse() - ); - client.innerApiCalls.unbindDeviceFromGateway = stubSimpleCall(expectedResponse); - const [response] = await client.unbindDeviceFromGateway(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.unbindDeviceFromGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.unbindDeviceFromGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes unbindDeviceFromGateway without error using callback', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse() - ); - client.innerApiCalls.unbindDeviceFromGateway = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.unbindDeviceFromGateway( - request, - (err?: Error|null, result?: protos.google.cloud.iot.v1.IUnbindDeviceFromGatewayResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.unbindDeviceFromGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.unbindDeviceFromGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes unbindDeviceFromGateway with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.unbindDeviceFromGateway = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.unbindDeviceFromGateway(request), expectedError); - const actualRequest = (client.innerApiCalls.unbindDeviceFromGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.unbindDeviceFromGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes unbindDeviceFromGateway with closed client', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.unbindDeviceFromGateway(request), expectedError); - }); - }); - - describe('listDeviceRegistries', () => { - it('invokes listDeviceRegistries without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceRegistriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceRegistriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), - generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), - generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), - ]; - client.innerApiCalls.listDeviceRegistries = stubSimpleCall(expectedResponse); - const [response] = await client.listDeviceRegistries(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDeviceRegistries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeviceRegistries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeviceRegistries without error using callback', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceRegistriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceRegistriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), - generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), - generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), - ]; - client.innerApiCalls.listDeviceRegistries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDeviceRegistries( - request, - (err?: Error|null, result?: protos.google.cloud.iot.v1.IDeviceRegistry[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDeviceRegistries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeviceRegistries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeviceRegistries with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceRegistriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceRegistriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDeviceRegistries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDeviceRegistries(request), expectedError); - const actualRequest = (client.innerApiCalls.listDeviceRegistries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeviceRegistries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeviceRegistriesStream without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceRegistriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceRegistriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), - generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), - generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), - ]; - client.descriptors.page.listDeviceRegistries.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDeviceRegistriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.iot.v1.DeviceRegistry[] = []; - stream.on('data', (response: protos.google.cloud.iot.v1.DeviceRegistry) => { - 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.listDeviceRegistries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDeviceRegistries, request)); - assert( - (client.descriptors.page.listDeviceRegistries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDeviceRegistriesStream with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceRegistriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceRegistriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDeviceRegistries.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDeviceRegistriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.iot.v1.DeviceRegistry[] = []; - stream.on('data', (response: protos.google.cloud.iot.v1.DeviceRegistry) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDeviceRegistries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDeviceRegistries, request)); - assert( - (client.descriptors.page.listDeviceRegistries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDeviceRegistries without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceRegistriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceRegistriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), - generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), - generateSampleMessage(new protos.google.cloud.iot.v1.DeviceRegistry()), - ]; - client.descriptors.page.listDeviceRegistries.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.iot.v1.IDeviceRegistry[] = []; - const iterable = client.listDeviceRegistriesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDeviceRegistries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDeviceRegistries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDeviceRegistries with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDeviceRegistriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDeviceRegistriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDeviceRegistries.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDeviceRegistriesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.iot.v1.IDeviceRegistry[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDeviceRegistries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDeviceRegistries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listDevices', () => { - it('invokes listDevices without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDevicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDevicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.iot.v1.Device()), - generateSampleMessage(new protos.google.cloud.iot.v1.Device()), - generateSampleMessage(new protos.google.cloud.iot.v1.Device()), - ]; - client.innerApiCalls.listDevices = stubSimpleCall(expectedResponse); - const [response] = await client.listDevices(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDevices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDevices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDevices without error using callback', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDevicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDevicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.iot.v1.Device()), - generateSampleMessage(new protos.google.cloud.iot.v1.Device()), - generateSampleMessage(new protos.google.cloud.iot.v1.Device()), - ]; - client.innerApiCalls.listDevices = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDevices( - request, - (err?: Error|null, result?: protos.google.cloud.iot.v1.IDevice[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDevices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDevices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDevices with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDevicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDevicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDevices = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDevices(request), expectedError); - const actualRequest = (client.innerApiCalls.listDevices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDevices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDevicesStream without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDevicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDevicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.iot.v1.Device()), - generateSampleMessage(new protos.google.cloud.iot.v1.Device()), - generateSampleMessage(new protos.google.cloud.iot.v1.Device()), - ]; - client.descriptors.page.listDevices.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDevicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.iot.v1.Device[] = []; - stream.on('data', (response: protos.google.cloud.iot.v1.Device) => { - 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.listDevices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDevices, request)); - assert( - (client.descriptors.page.listDevices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDevicesStream with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDevicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDevicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDevices.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDevicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.iot.v1.Device[] = []; - stream.on('data', (response: protos.google.cloud.iot.v1.Device) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDevices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDevices, request)); - assert( - (client.descriptors.page.listDevices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDevices without error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDevicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDevicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.iot.v1.Device()), - generateSampleMessage(new protos.google.cloud.iot.v1.Device()), - generateSampleMessage(new protos.google.cloud.iot.v1.Device()), - ]; - client.descriptors.page.listDevices.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.iot.v1.IDevice[] = []; - const iterable = client.listDevicesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDevices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDevices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDevices with error', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iot.v1.ListDevicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iot.v1.ListDevicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDevices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDevicesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.iot.v1.IDevice[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDevices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDevices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('device', () => { - const fakePath = "/rendered/path/device"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - registry: "registryValue", - device: "deviceValue", - }; - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.devicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.devicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('devicePath', () => { - const result = client.devicePath("projectValue", "locationValue", "registryValue", "deviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.devicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDeviceName', () => { - const result = client.matchProjectFromDeviceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.devicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDeviceName', () => { - const result = client.matchLocationFromDeviceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.devicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegistryFromDeviceName', () => { - const result = client.matchRegistryFromDeviceName(fakePath); - assert.strictEqual(result, "registryValue"); - assert((client.pathTemplates.devicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeviceFromDeviceName', () => { - const result = client.matchDeviceFromDeviceName(fakePath); - assert.strictEqual(result, "deviceValue"); - assert((client.pathTemplates.devicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('registry', () => { - const fakePath = "/rendered/path/registry"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - registry: "registryValue", - }; - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.registryPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.registryPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('registryPath', () => { - const result = client.registryPath("projectValue", "locationValue", "registryValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.registryPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRegistryName', () => { - const result = client.matchProjectFromRegistryName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.registryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromRegistryName', () => { - const result = client.matchLocationFromRegistryName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.registryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegistryFromRegistryName', () => { - const result = client.matchRegistryFromRegistryName(fakePath); - assert.strictEqual(result, "registryValue"); - assert((client.pathTemplates.registryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-iot/v1/tsconfig.json b/owl-bot-staging/google-cloud-iot/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-iot/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-iot/v1/webpack.config.js b/owl-bot-staging/google-cloud-iot/v1/webpack.config.js deleted file mode 100644 index 7f6d8159f34..00000000000 --- a/owl-bot-staging/google-cloud-iot/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: 'iot', - filename: './iot.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-kms-inventory/v1/.eslintignore b/owl-bot-staging/google-cloud-kms-inventory/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/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-kms-inventory/v1/.eslintrc.json b/owl-bot-staging/google-cloud-kms-inventory/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/.gitignore b/owl-bot-staging/google-cloud-kms-inventory/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/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-kms-inventory/v1/.jsdoc.js b/owl-bot-staging/google-cloud-kms-inventory/v1/.jsdoc.js deleted file mode 100644 index 7167b7e596e..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/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/kms-inventory', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/.mocharc.js b/owl-bot-staging/google-cloud-kms-inventory/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/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-kms-inventory/v1/.prettierrc.js b/owl-bot-staging/google-cloud-kms-inventory/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/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-kms-inventory/v1/README.md b/owl-bot-staging/google-cloud-kms-inventory/v1/README.md deleted file mode 100644 index e25299a6861..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Inventory: Nodejs Client diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/package.json b/owl-bot-staging/google-cloud-kms-inventory/v1/package.json deleted file mode 100644 index bb515340cc8..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "@google-cloud/kms-inventory", - "version": "0.1.0", - "description": "Inventory client for Node.js", - "repository": "googleapis/nodejs-inventory", - "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 inventory", - "inventory", - "key dashboard service", - "key tracking service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/protos/google/cloud/kms/inventory/v1/key_dashboard_service.proto b/owl-bot-staging/google-cloud-kms-inventory/v1/protos/google/cloud/kms/inventory/v1/key_dashboard_service.proto deleted file mode 100644 index fe6353e44cd..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/protos/google/cloud/kms/inventory/v1/key_dashboard_service.proto +++ /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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.kms.inventory.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/kms/v1/resources.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Kms.Inventory.V1"; -option go_package = "cloud.google.com/go/kms/inventory/apiv1/inventorypb;inventorypb"; -option java_multiple_files = true; -option java_outer_classname = "KeyDashboardServiceProto"; -option java_package = "com.google.cloud.kms.inventory.v1"; -option php_namespace = "Google\\Cloud\\Kms\\Inventory\\V1"; - -// Provides a cross-region view of all Cloud KMS keys in a given Cloud project. -service KeyDashboardService { - option (google.api.default_host) = "kmsinventory.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Returns cryptographic keys managed by Cloud KMS in a given Cloud project. - // Note that this data is sourced from snapshots, meaning it may not - // completely reflect the actual state of key metadata at call time. - rpc ListCryptoKeys(ListCryptoKeysRequest) returns (ListCryptoKeysResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/cryptoKeys" - }; - option (google.api.method_signature) = "parent"; - } -} - -// Request message for -// [KeyDashboardService.ListCryptoKeys][google.cloud.kms.inventory.v1.KeyDashboardService.ListCryptoKeys]. -message ListCryptoKeysRequest { - // Required. The Google Cloud project for which to retrieve key metadata, in - // the format `projects/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Optional. The maximum number of keys to return. The service may return - // fewer than this value. If unspecified, at most 1000 keys will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Pass this into a subsequent request in order to receive the next - // page of results. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [KeyDashboardService.ListCryptoKeys][google.cloud.kms.inventory.v1.KeyDashboardService.ListCryptoKeys]. -message ListCryptoKeysResponse { - // The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. - repeated google.cloud.kms.v1.CryptoKey crypto_keys = 1; - - // The page token returned from the previous response if the next page is - // desired. - string next_page_token = 2; -} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/protos/google/cloud/kms/inventory/v1/key_tracking_service.proto b/owl-bot-staging/google-cloud-kms-inventory/v1/protos/google/cloud/kms/inventory/v1/key_tracking_service.proto deleted file mode 100644 index fa324fd7815..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/protos/google/cloud/kms/inventory/v1/key_tracking_service.proto +++ /dev/null @@ -1,228 +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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.kms.inventory.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Kms.Inventory.V1"; -option go_package = "cloud.google.com/go/kms/inventory/apiv1/inventorypb;inventorypb"; -option java_multiple_files = true; -option java_outer_classname = "KeyTrackingServiceProto"; -option java_package = "com.google.cloud.kms.inventory.v1"; -option php_namespace = "Google\\Cloud\\Kms\\Inventory\\V1"; - -// Returns information about the resources in an org that are protected by a -// given Cloud KMS key via CMEK. -service KeyTrackingService { - option (google.api.default_host) = "kmsinventory.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Returns aggregate information about the resources protected by the given - // Cloud KMS [CryptoKey][google.cloud.kms.v1.CryptoKey]. Only resources within - // the same Cloud organization as the key will be returned. The project that - // holds the key must be part of an organization in order for this call to - // succeed. - rpc GetProtectedResourcesSummary(GetProtectedResourcesSummaryRequest) - returns (ProtectedResourcesSummary) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/**}/protectedResourcesSummary" - }; - option (google.api.method_signature) = "name"; - } - - // Returns metadata about the resources protected by the given Cloud KMS - // [CryptoKey][google.cloud.kms.v1.CryptoKey] in the given Cloud organization. - rpc SearchProtectedResources(SearchProtectedResourcesRequest) - returns (SearchProtectedResourcesResponse) { - option (google.api.http) = { - get: "/v1/{scope=organizations/*}/protectedResources:search" - }; - option (google.api.method_signature) = "scope, crypto_key"; - } -} - -// Request message for -// [KeyTrackingService.GetProtectedResourcesSummary][google.cloud.kms.inventory.v1.KeyTrackingService.GetProtectedResourcesSummary]. -message GetProtectedResourcesSummaryRequest { - // Required. The resource name of the - // [CryptoKey][google.cloud.kms.v1.CryptoKey]. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "kmsinventory.googleapis.com/ProtectedResourcesSummary" - } - ]; -} - -// Aggregate information about the resources protected by a Cloud KMS key in the -// same Cloud organization as the key. -message ProtectedResourcesSummary { - option (google.api.resource) = { - type: "kmsinventory.googleapis.com/ProtectedResourcesSummary" - pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/protectedResourcesSummary" - pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/protectedResourcesSummary" - }; - - // The full name of the ProtectedResourcesSummary resource. - // Example: - // projects/test-project/locations/us/keyRings/test-keyring/cryptoKeys/test-key/protectedResourcesSummary - string name = 5; - - // The total number of protected resources in the same Cloud organization as - // the key. - int64 resource_count = 1; - - // The number of distinct Cloud projects in the same Cloud organization as the - // key that have resources protected by the key. - int32 project_count = 2; - - // The number of resources protected by the key grouped by resource type. - map resource_types = 3; - - // The number of resources protected by the key grouped by Cloud product. - map cloud_products = 6; - - // The number of resources protected by the key grouped by region. - map locations = 4; -} - -// Request message for -// [KeyTrackingService.SearchProtectedResources][google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources]. -message SearchProtectedResourcesRequest { - // Required. Resource name of the organization. - // Example: organizations/123 - string scope = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // Required. The resource name of the - // [CryptoKey][google.cloud.kms.v1.CryptoKey]. - string crypto_key = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "*" } - ]; - - // The maximum number of resources to return. The service may return fewer - // than this value. - // If unspecified, at most 500 resources will be returned. - // The maximum value is 500; values above 500 will be coerced to 500. - int32 page_size = 3; - - // A page token, received from a previous - // [KeyTrackingService.SearchProtectedResources][google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources] - // call. Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // [KeyTrackingService.SearchProtectedResources][google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources] - // must match the call that provided the page token. - string page_token = 4; - - // Optional. A list of resource types that this request searches for. If - // empty, it will search all the [trackable resource - // types](https://cloud.google.com/kms/docs/view-key-usage#tracked-resource-types). - // - // Regular expressions are also supported. For example: - // - // * `compute.googleapis.com.*` snapshots resources whose type starts - // with `compute.googleapis.com`. - // * `.*Image` snapshots resources whose type ends with `Image`. - // * `.*Image.*` snapshots resources whose type contains `Image`. - // - // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - // regular expression syntax. If the regular expression does not match any - // supported resource type, an INVALID_ARGUMENT error will be returned. - repeated string resource_types = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [KeyTrackingService.SearchProtectedResources][google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources]. -message SearchProtectedResourcesResponse { - // Protected resources for this page. - repeated ProtectedResource protected_resources = 1; - - // A token that can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Metadata about a resource protected by a Cloud KMS key. -message ProtectedResource { - option (google.api.resource) = { - type: "cloudasset.googleapis.com/Asset" - pattern: "*" - }; - - // The full resource name of the resource. - // Example: - // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - string name = 1; - - // Format: `projects/{PROJECT_NUMBER}`. - string project = 2; - - // The ID of the project that owns the resource. - string project_id = 9; - - // The Cloud product that owns the resource. - // Example: `compute` - string cloud_product = 8; - - // Example: `compute.googleapis.com/Disk` - string resource_type = 3; - - // Location can be `global`, regional like `us-east1`, or zonal like - // `us-west1-b`. - string location = 4; - - // A key-value pair of the resource's labels (v1) to their values. - map labels = 5; - - // The name of the Cloud KMS - // [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions?hl=en) - // used to protect this resource via CMEK. This field is empty if the - // Google Cloud product owning the resource does not provide key version data - // to Asset Inventory. If there are multiple key versions protecting the - // resource, then this is same value as the first element of - // crypto_key_versions. - string crypto_key_version = 6 [(google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKeyVersion" - }]; - - // The names of the Cloud KMS - // [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions?hl=en) - // used to protect this resource via CMEK. This field is empty if the - // Google Cloud product owning the resource does not provide key versions data - // to Asset Inventory. The first element of this field is stored in - // crypto_key_version. - repeated string crypto_key_versions = 10 [(google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKeyVersion" - }]; - - // Output only. The time at which this resource was created. The granularity - // is in seconds. Timestamp.nanos will always be 0. - google.protobuf.Timestamp create_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_dashboard_service.list_crypto_keys.js b/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_dashboard_service.list_crypto_keys.js deleted file mode 100644 index cb7e3900a54..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_dashboard_service.list_crypto_keys.js +++ /dev/null @@ -1,75 +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 kmsinventory_v1_generated_KeyDashboardService_ListCryptoKeys_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Google Cloud project for which to retrieve key metadata, in - * the format `projects/*` - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of keys to return. The service may return - * fewer than this value. If unspecified, at most 1000 keys will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * Optional. Pass this into a subsequent request in order to receive the next - * page of results. - */ - // const pageToken = 'abc123' - - // Imports the Inventory library - const {KeyDashboardServiceClient} = require('@google-cloud/kms-inventory').v1; - - // Instantiates a client - const inventoryClient = new KeyDashboardServiceClient(); - - async function callListCryptoKeys() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await inventoryClient.listCryptoKeysAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCryptoKeys(); - // [END kmsinventory_v1_generated_KeyDashboardService_ListCryptoKeys_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-kms-inventory/v1/samples/generated/v1/key_tracking_service.get_protected_resources_summary.js b/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_tracking_service.get_protected_resources_summary.js deleted file mode 100644 index c0ad1d0f3bd..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_tracking_service.get_protected_resources_summary.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 kmsinventory_v1_generated_KeyTrackingService_GetProtectedResourcesSummary_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the - * CryptoKey google.cloud.kms.v1.CryptoKey. - */ - // const name = 'abc123' - - // Imports the Inventory library - const {KeyTrackingServiceClient} = require('@google-cloud/kms-inventory').v1; - - // Instantiates a client - const inventoryClient = new KeyTrackingServiceClient(); - - async function callGetProtectedResourcesSummary() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await inventoryClient.getProtectedResourcesSummary(request); - console.log(response); - } - - callGetProtectedResourcesSummary(); - // [END kmsinventory_v1_generated_KeyTrackingService_GetProtectedResourcesSummary_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-kms-inventory/v1/samples/generated/v1/key_tracking_service.search_protected_resources.js b/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_tracking_service.search_protected_resources.js deleted file mode 100644 index 4744dc757c3..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/key_tracking_service.search_protected_resources.js +++ /dev/null @@ -1,100 +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(scope, cryptoKey) { - // [START kmsinventory_v1_generated_KeyTrackingService_SearchProtectedResources_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. Resource name of the organization. - * Example: organizations/123 - */ - // const scope = 'abc123' - /** - * Required. The resource name of the - * CryptoKey google.cloud.kms.v1.CryptoKey. - */ - // const cryptoKey = 'abc123' - /** - * The maximum number of resources to return. The service may return fewer - * than this value. - * If unspecified, at most 500 resources will be returned. - * The maximum value is 500; values above 500 will be coerced to 500. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous - * KeyTrackingService.SearchProtectedResources google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources - * call. Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * KeyTrackingService.SearchProtectedResources google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. A list of resource types that this request searches for. If - * empty, it will search all the trackable resource - * types (https://cloud.google.com/kms/docs/view-key-usage#tracked-resource-types). - * Regular expressions are also supported. For example: - * * `compute.googleapis.com.*` snapshots resources whose type starts - * with `compute.googleapis.com`. - * * `.*Image` snapshots resources whose type ends with `Image`. - * * `.*Image.*` snapshots resources whose type contains `Image`. - * See RE2 (https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported resource type, an INVALID_ARGUMENT error will be returned. - */ - // const resourceTypes = ['abc','def'] - - // Imports the Inventory library - const {KeyTrackingServiceClient} = require('@google-cloud/kms-inventory').v1; - - // Instantiates a client - const inventoryClient = new KeyTrackingServiceClient(); - - async function callSearchProtectedResources() { - // Construct request - const request = { - scope, - cryptoKey, - }; - - // Run request - const iterable = await inventoryClient.searchProtectedResourcesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callSearchProtectedResources(); - // [END kmsinventory_v1_generated_KeyTrackingService_SearchProtectedResources_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-kms-inventory/v1/samples/generated/v1/snippet_metadata_google.cloud.kms.inventory.v1.json b/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/snippet_metadata_google.cloud.kms.inventory.v1.json deleted file mode 100644 index 9dd2b499dd2..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/samples/generated/v1/snippet_metadata_google.cloud.kms.inventory.v1.json +++ /dev/null @@ -1,159 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-inventory", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.kms.inventory.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "kmsinventory_v1_generated_KeyDashboardService_ListCryptoKeys_async", - "title": "KeyDashboardService listCryptoKeys Sample", - "origin": "API_DEFINITION", - "description": " Returns cryptographic keys managed by Cloud KMS in a given Cloud project. Note that this data is sourced from snapshots, meaning it may not completely reflect the actual state of key metadata at call time.", - "canonical": true, - "file": "key_dashboard_service.list_crypto_keys.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCryptoKeys", - "fullName": "google.cloud.kms.inventory.v1.KeyDashboardService.ListCryptoKeys", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.inventory.v1.ListCryptoKeysResponse", - "client": { - "shortName": "KeyDashboardServiceClient", - "fullName": "google.cloud.kms.inventory.v1.KeyDashboardServiceClient" - }, - "method": { - "shortName": "ListCryptoKeys", - "fullName": "google.cloud.kms.inventory.v1.KeyDashboardService.ListCryptoKeys", - "service": { - "shortName": "KeyDashboardService", - "fullName": "google.cloud.kms.inventory.v1.KeyDashboardService" - } - } - } - }, - { - "regionTag": "kmsinventory_v1_generated_KeyTrackingService_GetProtectedResourcesSummary_async", - "title": "KeyDashboardService getProtectedResourcesSummary Sample", - "origin": "API_DEFINITION", - "description": " Returns aggregate information about the resources protected by the given Cloud KMS [CryptoKey][google.cloud.kms.v1.CryptoKey]. Only resources within the same Cloud organization as the key will be returned. The project that holds the key must be part of an organization in order for this call to succeed.", - "canonical": true, - "file": "key_tracking_service.get_protected_resources_summary.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetProtectedResourcesSummary", - "fullName": "google.cloud.kms.inventory.v1.KeyTrackingService.GetProtectedResourcesSummary", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.inventory.v1.ProtectedResourcesSummary", - "client": { - "shortName": "KeyTrackingServiceClient", - "fullName": "google.cloud.kms.inventory.v1.KeyTrackingServiceClient" - }, - "method": { - "shortName": "GetProtectedResourcesSummary", - "fullName": "google.cloud.kms.inventory.v1.KeyTrackingService.GetProtectedResourcesSummary", - "service": { - "shortName": "KeyTrackingService", - "fullName": "google.cloud.kms.inventory.v1.KeyTrackingService" - } - } - } - }, - { - "regionTag": "kmsinventory_v1_generated_KeyTrackingService_SearchProtectedResources_async", - "title": "KeyDashboardService searchProtectedResources Sample", - "origin": "API_DEFINITION", - "description": " Returns metadata about the resources protected by the given Cloud KMS [CryptoKey][google.cloud.kms.v1.CryptoKey] in the given Cloud organization.", - "canonical": true, - "file": "key_tracking_service.search_protected_resources.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 92, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SearchProtectedResources", - "fullName": "google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources", - "async": true, - "parameters": [ - { - "name": "scope", - "type": "TYPE_STRING" - }, - { - "name": "crypto_key", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "resource_types", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.cloud.kms.inventory.v1.SearchProtectedResourcesResponse", - "client": { - "shortName": "KeyTrackingServiceClient", - "fullName": "google.cloud.kms.inventory.v1.KeyTrackingServiceClient" - }, - "method": { - "shortName": "SearchProtectedResources", - "fullName": "google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources", - "service": { - "shortName": "KeyTrackingService", - "fullName": "google.cloud.kms.inventory.v1.KeyTrackingService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/index.ts b/owl-bot-staging/google-cloud-kms-inventory/v1/src/index.ts deleted file mode 100644 index 17a2b3aaaa7..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/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 KeyDashboardServiceClient = v1.KeyDashboardServiceClient; -type KeyDashboardServiceClient = v1.KeyDashboardServiceClient; -const KeyTrackingServiceClient = v1.KeyTrackingServiceClient; -type KeyTrackingServiceClient = v1.KeyTrackingServiceClient; -export {v1, KeyDashboardServiceClient, KeyTrackingServiceClient}; -export default {v1, KeyDashboardServiceClient, KeyTrackingServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 27e965465e6..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.kms.inventory.v1", - "libraryPackage": "@google-cloud/kms-inventory", - "services": { - "KeyDashboardService": { - "clients": { - "grpc": { - "libraryClient": "KeyDashboardServiceClient", - "rpcs": { - "ListCryptoKeys": { - "methods": [ - "listCryptoKeys", - "listCryptoKeysStream", - "listCryptoKeysAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "KeyDashboardServiceClient", - "rpcs": { - "ListCryptoKeys": { - "methods": [ - "listCryptoKeys", - "listCryptoKeysStream", - "listCryptoKeysAsync" - ] - } - } - } - } - }, - "KeyTrackingService": { - "clients": { - "grpc": { - "libraryClient": "KeyTrackingServiceClient", - "rpcs": { - "GetProtectedResourcesSummary": { - "methods": [ - "getProtectedResourcesSummary" - ] - }, - "SearchProtectedResources": { - "methods": [ - "searchProtectedResources", - "searchProtectedResourcesStream", - "searchProtectedResourcesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "KeyTrackingServiceClient", - "rpcs": { - "GetProtectedResourcesSummary": { - "methods": [ - "getProtectedResourcesSummary" - ] - }, - "SearchProtectedResources": { - "methods": [ - "searchProtectedResources", - "searchProtectedResourcesStream", - "searchProtectedResourcesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/index.ts deleted file mode 100644 index 3f97e3eb8e7..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/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 {KeyDashboardServiceClient} from './key_dashboard_service_client'; -export {KeyTrackingServiceClient} from './key_tracking_service_client'; diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_client.ts b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_client.ts deleted file mode 100644 index 51f93d8a73b..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_client.ts +++ /dev/null @@ -1,1016 +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/key_dashboard_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './key_dashboard_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Provides a cross-region view of all Cloud KMS keys in a given Cloud project. - * @class - * @memberof v1 - */ -export class KeyDashboardServiceClient { - 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}; - keyDashboardServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of KeyDashboardServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 KeyDashboardServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof KeyDashboardServiceClient; - 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 { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' - ), - cryptoKeyVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}' - ), - importJobPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}' - ), - keyRingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/protectedResourcesSummary' - ), - projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/protectedResourcesSummary' - ), - publicKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/publicKey' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listCryptoKeys: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'cryptoKeys') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.kms.inventory.v1.KeyDashboardService', 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.keyDashboardServiceStub) { - return this.keyDashboardServiceStub; - } - - // Put together the "service stub" for - // google.cloud.kms.inventory.v1.KeyDashboardService. - this.keyDashboardServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.kms.inventory.v1.KeyDashboardService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.kms.inventory.v1.KeyDashboardService, - 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 keyDashboardServiceStubMethods = - ['listCryptoKeys']; - for (const methodName of keyDashboardServiceStubMethods) { - const callPromise = this.keyDashboardServiceStub.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.keyDashboardServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'kmsinventory.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 'kmsinventory.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 -- - // ------------------- - - /** - * Returns cryptographic keys managed by Cloud KMS in a given Cloud project. - * Note that this data is sourced from snapshots, meaning it may not - * completely reflect the actual state of key metadata at call time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The Google Cloud project for which to retrieve key metadata, in - * the format `projects/*` - * @param {number} [request.pageSize] - * Optional. The maximum number of keys to return. The service may return - * fewer than this value. If unspecified, at most 1000 keys will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} [request.pageToken] - * Optional. Pass this into a subsequent request in order to receive the next - * page of results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listCryptoKeysAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listCryptoKeys( - request?: protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey[], - protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest|null, - protos.google.cloud.kms.inventory.v1.IListCryptoKeysResponse - ]>; - listCryptoKeys( - request: protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.inventory.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>): void; - listCryptoKeys( - request: protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, - callback: PaginationCallback< - protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.inventory.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>): void; - listCryptoKeys( - request?: protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.inventory.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>, - callback?: PaginationCallback< - protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.inventory.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey[], - protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest|null, - protos.google.cloud.kms.inventory.v1.IListCryptoKeysResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listCryptoKeys(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The Google Cloud project for which to retrieve key metadata, in - * the format `projects/*` - * @param {number} [request.pageSize] - * Optional. The maximum number of keys to return. The service may return - * fewer than this value. If unspecified, at most 1000 keys will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} [request.pageToken] - * Optional. Pass this into a subsequent request in order to receive the next - * page of results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listCryptoKeysAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listCryptoKeysStream( - request?: protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCryptoKeys']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCryptoKeys.createStream( - this.innerApiCalls.listCryptoKeys as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCryptoKeys`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The Google Cloud project for which to retrieve key metadata, in - * the format `projects/*` - * @param {number} [request.pageSize] - * Optional. The maximum number of keys to return. The service may return - * fewer than this value. If unspecified, at most 1000 keys will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} [request.pageToken] - * Optional. Pass this into a subsequent request in order to receive the next - * page of results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_dashboard_service.list_crypto_keys.js - * region_tag:kmsinventory_v1_generated_KeyDashboardService_ListCryptoKeys_async - */ - listCryptoKeysAsync( - request?: protos.google.cloud.kms.inventory.v1.IListCryptoKeysRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCryptoKeys']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCryptoKeys.asyncIterate( - this.innerApiCalls['listCryptoKeys'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified cryptoKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @returns {string} Resource name string. - */ - cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { - return this.pathTemplates.cryptoKeyPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - }); - } - - /** - * Parse the project from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; - } - - /** - * Parse the location from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; - } - - /** - * Parse the key_ring from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; - } - - /** - * Parse the crypto_key from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; - } - - /** - * Return a fully-qualified cryptoKeyVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @param {string} crypto_key_version - * @returns {string} Resource name string. - */ - cryptoKeyVersionPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - crypto_key_version: cryptoKeyVersion, - }); - } - - /** - * Parse the project from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).project; - } - - /** - * Parse the location from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).location; - } - - /** - * Parse the key_ring from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).key_ring; - } - - /** - * Parse the crypto_key from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).crypto_key; - } - - /** - * Parse the crypto_key_version from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the crypto_key_version. - */ - matchCryptoKeyVersionFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).crypto_key_version; - } - - /** - * Return a fully-qualified importJob resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} import_job - * @returns {string} Resource name string. - */ - importJobPath(project:string,location:string,keyRing:string,importJob:string) { - return this.pathTemplates.importJobPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - import_job: importJob, - }); - } - - /** - * Parse the project from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the project. - */ - matchProjectFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).project; - } - - /** - * Parse the location from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the location. - */ - matchLocationFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).location; - } - - /** - * Parse the key_ring from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).key_ring; - } - - /** - * Parse the import_job from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the import_job. - */ - matchImportJobFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).import_job; - } - - /** - * Return a fully-qualified keyRing resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @returns {string} Resource name string. - */ - keyRingPath(project:string,location:string,keyRing:string) { - return this.pathTemplates.keyRingPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - }); - } - - /** - * Parse the project from KeyRing resource. - * - * @param {string} keyRingName - * A fully-qualified path representing KeyRing resource. - * @returns {string} A string representing the project. - */ - matchProjectFromKeyRingName(keyRingName: string) { - return this.pathTemplates.keyRingPathTemplate.match(keyRingName).project; - } - - /** - * Parse the location from KeyRing resource. - * - * @param {string} keyRingName - * A fully-qualified path representing KeyRing resource. - * @returns {string} A string representing the location. - */ - matchLocationFromKeyRingName(keyRingName: string) { - return this.pathTemplates.keyRingPathTemplate.match(keyRingName).location; - } - - /** - * Parse the key_ring from KeyRing resource. - * - * @param {string} keyRingName - * A fully-qualified path representing KeyRing resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromKeyRingName(keyRingName: string) { - return this.pathTemplates.keyRingPathTemplate.match(keyRingName).key_ring; - } - - /** - * Return a fully-qualified 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 projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @param {string} crypto_key_version - * @returns {string} Resource name string. - */ - projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - crypto_key_version: cryptoKeyVersion, - }); - } - - /** - * Parse the project from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).project; - } - - /** - * Parse the location from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).location; - } - - /** - * Parse the key_ring from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).key_ring; - } - - /** - * Parse the crypto_key from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).crypto_key; - } - - /** - * Parse the crypto_key_version from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. - * @returns {string} A string representing the crypto_key_version. - */ - matchCryptoKeyVersionFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).crypto_key_version; - } - - /** - * Return a fully-qualified projectLocationKeyRingCryptoKeyProtectedResourcesSummary resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @returns {string} Resource name string. - */ - projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPath(project:string,location:string,keyRing:string,cryptoKey:string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - }); - } - - /** - * Parse the project from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName).project; - } - - /** - * Parse the location from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName).location; - } - - /** - * Parse the key_ring from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName).key_ring; - } - - /** - * Parse the crypto_key from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName).crypto_key; - } - - /** - * Return a fully-qualified publicKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @param {string} crypto_key_version - * @returns {string} Resource name string. - */ - publicKeyPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { - return this.pathTemplates.publicKeyPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - crypto_key_version: cryptoKeyVersion, - }); - } - - /** - * Parse the project from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the project. - */ - matchProjectFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).project; - } - - /** - * Parse the location from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the location. - */ - matchLocationFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).location; - } - - /** - * Parse the key_ring from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).key_ring; - } - - /** - * Parse the crypto_key from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).crypto_key; - } - - /** - * Parse the crypto_key_version from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the crypto_key_version. - */ - matchCryptoKeyVersionFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).crypto_key_version; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.keyDashboardServiceStub && !this._terminated) { - return this.keyDashboardServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_client_config.json b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_client_config.json deleted file mode 100644 index 2b60e8b9192..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_client_config.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "interfaces": { - "google.cloud.kms.inventory.v1.KeyDashboardService": { - "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": { - "ListCryptoKeys": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_proto_list.json b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_proto_list.json deleted file mode 100644 index c3534b31a62..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_dashboard_service_proto_list.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "../../protos/google/cloud/kms/inventory/v1/key_dashboard_service.proto", - "../../protos/google/cloud/kms/inventory/v1/key_tracking_service.proto", - "../../protos/google/cloud/kms/v1/resources.proto" -] diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_client.ts b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_client.ts deleted file mode 100644 index 22fa732c327..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_client.ts +++ /dev/null @@ -1,1163 +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/key_tracking_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './key_tracking_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Returns information about the resources in an org that are protected by a - * given Cloud KMS key via CMEK. - * @class - * @memberof v1 - */ -export class KeyTrackingServiceClient { - 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}; - keyTrackingServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of KeyTrackingServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 KeyTrackingServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof KeyTrackingServiceClient; - 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 { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' - ), - cryptoKeyVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}' - ), - importJobPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}' - ), - keyRingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}' - ), - organizationPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}' - ), - projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/protectedResourcesSummary' - ), - projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/protectedResourcesSummary' - ), - publicKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/publicKey' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - searchProtectedResources: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'protectedResources') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.kms.inventory.v1.KeyTrackingService', 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.keyTrackingServiceStub) { - return this.keyTrackingServiceStub; - } - - // Put together the "service stub" for - // google.cloud.kms.inventory.v1.KeyTrackingService. - this.keyTrackingServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.kms.inventory.v1.KeyTrackingService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.kms.inventory.v1.KeyTrackingService, - 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 keyTrackingServiceStubMethods = - ['getProtectedResourcesSummary', 'searchProtectedResources']; - for (const methodName of keyTrackingServiceStubMethods) { - const callPromise = this.keyTrackingServiceStub.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.keyTrackingServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'kmsinventory.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 'kmsinventory.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 -- - // ------------------- -/** - * Returns aggregate information about the resources protected by the given - * Cloud KMS {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. Only resources within - * the same Cloud organization as the key will be returned. The project that - * holds the key must be part of an organization in order for this call to - * succeed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.inventory.v1.ProtectedResourcesSummary|ProtectedResourcesSummary}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_tracking_service.get_protected_resources_summary.js - * region_tag:kmsinventory_v1_generated_KeyTrackingService_GetProtectedResourcesSummary_async - */ - getProtectedResourcesSummary( - request?: protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary, - protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest|undefined, {}|undefined - ]>; - getProtectedResourcesSummary( - request: protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary, - protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest|null|undefined, - {}|null|undefined>): void; - getProtectedResourcesSummary( - request: protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest, - callback: Callback< - protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary, - protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest|null|undefined, - {}|null|undefined>): void; - getProtectedResourcesSummary( - request?: protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary, - protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary, - protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary, - protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest|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.getProtectedResourcesSummary(request, options, callback); - } - - /** - * Returns metadata about the resources protected by the given Cloud KMS - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} in the given Cloud organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.scope - * Required. Resource name of the organization. - * Example: organizations/123 - * @param {string} request.cryptoKey - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * @param {number} request.pageSize - * The maximum number of resources to return. The service may return fewer - * than this value. - * If unspecified, at most 500 resources will be returned. - * The maximum value is 500; values above 500 will be coerced to 500. - * @param {string} request.pageToken - * A page token, received from a previous - * {@link protos.google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources|KeyTrackingService.SearchProtectedResources} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources|KeyTrackingService.SearchProtectedResources} - * must match the call that provided the page token. - * @param {string[]} [request.resourceTypes] - * Optional. A list of resource types that this request searches for. If - * empty, it will search all the [trackable resource - * types](https://cloud.google.com/kms/docs/view-key-usage#tracked-resource-types). - * - * Regular expressions are also supported. For example: - * - * * `compute.googleapis.com.*` snapshots resources whose type starts - * with `compute.googleapis.com`. - * * `.*Image` snapshots resources whose type ends with `Image`. - * * `.*Image.*` snapshots resources whose type contains `Image`. - * - * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported resource type, an INVALID_ARGUMENT error will be returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.kms.inventory.v1.ProtectedResource|ProtectedResource}. - * 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 `searchProtectedResourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - searchProtectedResources( - request?: protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.inventory.v1.IProtectedResource[], - protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest|null, - protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse - ]>; - searchProtectedResources( - request: protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, - protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse|null|undefined, - protos.google.cloud.kms.inventory.v1.IProtectedResource>): void; - searchProtectedResources( - request: protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, - callback: PaginationCallback< - protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, - protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse|null|undefined, - protos.google.cloud.kms.inventory.v1.IProtectedResource>): void; - searchProtectedResources( - request?: protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, - protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse|null|undefined, - protos.google.cloud.kms.inventory.v1.IProtectedResource>, - callback?: PaginationCallback< - protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, - protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse|null|undefined, - protos.google.cloud.kms.inventory.v1.IProtectedResource>): - Promise<[ - protos.google.cloud.kms.inventory.v1.IProtectedResource[], - protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest|null, - protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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({ - 'scope': request.scope ?? '', - }); - this.initialize(); - return this.innerApiCalls.searchProtectedResources(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.scope - * Required. Resource name of the organization. - * Example: organizations/123 - * @param {string} request.cryptoKey - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * @param {number} request.pageSize - * The maximum number of resources to return. The service may return fewer - * than this value. - * If unspecified, at most 500 resources will be returned. - * The maximum value is 500; values above 500 will be coerced to 500. - * @param {string} request.pageToken - * A page token, received from a previous - * {@link protos.google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources|KeyTrackingService.SearchProtectedResources} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources|KeyTrackingService.SearchProtectedResources} - * must match the call that provided the page token. - * @param {string[]} [request.resourceTypes] - * Optional. A list of resource types that this request searches for. If - * empty, it will search all the [trackable resource - * types](https://cloud.google.com/kms/docs/view-key-usage#tracked-resource-types). - * - * Regular expressions are also supported. For example: - * - * * `compute.googleapis.com.*` snapshots resources whose type starts - * with `compute.googleapis.com`. - * * `.*Image` snapshots resources whose type ends with `Image`. - * * `.*Image.*` snapshots resources whose type contains `Image`. - * - * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported resource type, an INVALID_ARGUMENT error will be returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.kms.inventory.v1.ProtectedResource|ProtectedResource} 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 `searchProtectedResourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - searchProtectedResourcesStream( - request?: protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, - 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({ - 'scope': request.scope ?? '', - }); - const defaultCallSettings = this._defaults['searchProtectedResources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.searchProtectedResources.createStream( - this.innerApiCalls.searchProtectedResources as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `searchProtectedResources`, 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.scope - * Required. Resource name of the organization. - * Example: organizations/123 - * @param {string} request.cryptoKey - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * @param {number} request.pageSize - * The maximum number of resources to return. The service may return fewer - * than this value. - * If unspecified, at most 500 resources will be returned. - * The maximum value is 500; values above 500 will be coerced to 500. - * @param {string} request.pageToken - * A page token, received from a previous - * {@link protos.google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources|KeyTrackingService.SearchProtectedResources} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources|KeyTrackingService.SearchProtectedResources} - * must match the call that provided the page token. - * @param {string[]} [request.resourceTypes] - * Optional. A list of resource types that this request searches for. If - * empty, it will search all the [trackable resource - * types](https://cloud.google.com/kms/docs/view-key-usage#tracked-resource-types). - * - * Regular expressions are also supported. For example: - * - * * `compute.googleapis.com.*` snapshots resources whose type starts - * with `compute.googleapis.com`. - * * `.*Image` snapshots resources whose type ends with `Image`. - * * `.*Image.*` snapshots resources whose type contains `Image`. - * - * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported resource type, an INVALID_ARGUMENT error will be returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.kms.inventory.v1.ProtectedResource|ProtectedResource}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_tracking_service.search_protected_resources.js - * region_tag:kmsinventory_v1_generated_KeyTrackingService_SearchProtectedResources_async - */ - searchProtectedResourcesAsync( - request?: protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, - 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({ - 'scope': request.scope ?? '', - }); - const defaultCallSettings = this._defaults['searchProtectedResources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.searchProtectedResources.asyncIterate( - this.innerApiCalls['searchProtectedResources'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified cryptoKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @returns {string} Resource name string. - */ - cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { - return this.pathTemplates.cryptoKeyPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - }); - } - - /** - * Parse the project from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; - } - - /** - * Parse the location from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; - } - - /** - * Parse the key_ring from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; - } - - /** - * Parse the crypto_key from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; - } - - /** - * Return a fully-qualified cryptoKeyVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @param {string} crypto_key_version - * @returns {string} Resource name string. - */ - cryptoKeyVersionPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - crypto_key_version: cryptoKeyVersion, - }); - } - - /** - * Parse the project from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).project; - } - - /** - * Parse the location from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).location; - } - - /** - * Parse the key_ring from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).key_ring; - } - - /** - * Parse the crypto_key from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).crypto_key; - } - - /** - * Parse the crypto_key_version from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the crypto_key_version. - */ - matchCryptoKeyVersionFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).crypto_key_version; - } - - /** - * Return a fully-qualified importJob resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} import_job - * @returns {string} Resource name string. - */ - importJobPath(project:string,location:string,keyRing:string,importJob:string) { - return this.pathTemplates.importJobPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - import_job: importJob, - }); - } - - /** - * Parse the project from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the project. - */ - matchProjectFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).project; - } - - /** - * Parse the location from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the location. - */ - matchLocationFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).location; - } - - /** - * Parse the key_ring from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).key_ring; - } - - /** - * Parse the import_job from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the import_job. - */ - matchImportJobFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).import_job; - } - - /** - * Return a fully-qualified keyRing resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @returns {string} Resource name string. - */ - keyRingPath(project:string,location:string,keyRing:string) { - return this.pathTemplates.keyRingPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - }); - } - - /** - * Parse the project from KeyRing resource. - * - * @param {string} keyRingName - * A fully-qualified path representing KeyRing resource. - * @returns {string} A string representing the project. - */ - matchProjectFromKeyRingName(keyRingName: string) { - return this.pathTemplates.keyRingPathTemplate.match(keyRingName).project; - } - - /** - * Parse the location from KeyRing resource. - * - * @param {string} keyRingName - * A fully-qualified path representing KeyRing resource. - * @returns {string} A string representing the location. - */ - matchLocationFromKeyRingName(keyRingName: string) { - return this.pathTemplates.keyRingPathTemplate.match(keyRingName).location; - } - - /** - * Parse the key_ring from KeyRing resource. - * - * @param {string} keyRingName - * A fully-qualified path representing KeyRing resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromKeyRingName(keyRingName: string) { - return this.pathTemplates.keyRingPathTemplate.match(keyRingName).key_ring; - } - - /** - * Return a fully-qualified organization resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationPath(organization:string) { - return this.pathTemplates.organizationPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from Organization resource. - * - * @param {string} organizationName - * A fully-qualified path representing Organization resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationName(organizationName: string) { - return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; - } - - /** - * Return a fully-qualified projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @param {string} crypto_key_version - * @returns {string} Resource name string. - */ - projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - crypto_key_version: cryptoKeyVersion, - }); - } - - /** - * Parse the project from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).project; - } - - /** - * Parse the location from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).location; - } - - /** - * Parse the key_ring from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).key_ring; - } - - /** - * Parse the crypto_key from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).crypto_key; - } - - /** - * Parse the crypto_key_version from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource. - * @returns {string} A string representing the crypto_key_version. - */ - matchCryptoKeyVersionFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName).crypto_key_version; - } - - /** - * Return a fully-qualified projectLocationKeyRingCryptoKeyProtectedResourcesSummary resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @returns {string} Resource name string. - */ - projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPath(project:string,location:string,keyRing:string,cryptoKey:string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - }); - } - - /** - * Parse the project from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName).project; - } - - /** - * Parse the location from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName).location; - } - - /** - * Parse the key_ring from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName).key_ring; - } - - /** - * Parse the crypto_key from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource. - * - * @param {string} projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName - * A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string) { - return this.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName).crypto_key; - } - - /** - * Return a fully-qualified publicKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @param {string} crypto_key_version - * @returns {string} Resource name string. - */ - publicKeyPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { - return this.pathTemplates.publicKeyPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - crypto_key_version: cryptoKeyVersion, - }); - } - - /** - * Parse the project from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the project. - */ - matchProjectFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).project; - } - - /** - * Parse the location from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the location. - */ - matchLocationFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).location; - } - - /** - * Parse the key_ring from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).key_ring; - } - - /** - * Parse the crypto_key from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).crypto_key; - } - - /** - * Parse the crypto_key_version from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the crypto_key_version. - */ - matchCryptoKeyVersionFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).crypto_key_version; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.keyTrackingServiceStub && !this._terminated) { - return this.keyTrackingServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_client_config.json b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_client_config.json deleted file mode 100644 index c3128be608e..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_client_config.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "interfaces": { - "google.cloud.kms.inventory.v1.KeyTrackingService": { - "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": { - "GetProtectedResourcesSummary": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SearchProtectedResources": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_proto_list.json b/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_proto_list.json deleted file mode 100644 index c3534b31a62..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/src/v1/key_tracking_service_proto_list.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "../../protos/google/cloud/kms/inventory/v1/key_dashboard_service.proto", - "../../protos/google/cloud/kms/inventory/v1/key_tracking_service.proto", - "../../protos/google/cloud/kms/v1/resources.proto" -] diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-kms-inventory/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 886bbe354fa..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/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 inventory = require('@google-cloud/kms-inventory'); - -function main() { - const keyDashboardServiceClient = new inventory.KeyDashboardServiceClient(); - const keyTrackingServiceClient = new inventory.KeyTrackingServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-kms-inventory/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 102f3318ffb..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/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 {KeyDashboardServiceClient, KeyTrackingServiceClient} from '@google-cloud/kms-inventory'; - -// check that the client class type name can be used -function doStuffWithKeyDashboardServiceClient(client: KeyDashboardServiceClient) { - client.close(); -} -function doStuffWithKeyTrackingServiceClient(client: KeyTrackingServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const keyDashboardServiceClient = new KeyDashboardServiceClient(); - doStuffWithKeyDashboardServiceClient(keyDashboardServiceClient); - // check that the client instance can be created - const keyTrackingServiceClient = new KeyTrackingServiceClient(); - doStuffWithKeyTrackingServiceClient(keyTrackingServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/system-test/install.ts b/owl-bot-staging/google-cloud-kms-inventory/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/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-kms-inventory/v1/test/gapic_key_dashboard_service_v1.ts b/owl-bot-staging/google-cloud-kms-inventory/v1/test/gapic_key_dashboard_service_v1.ts deleted file mode 100644 index 1f358dc742a..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/test/gapic_key_dashboard_service_v1.ts +++ /dev/null @@ -1,869 +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 keydashboardserviceModule 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.KeyDashboardServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = keydashboardserviceModule.v1.KeyDashboardServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = keydashboardserviceModule.v1.KeyDashboardServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = keydashboardserviceModule.v1.KeyDashboardServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.keyDashboardServiceStub, undefined); - await client.initialize(); - assert(client.keyDashboardServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.keyDashboardServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.keyDashboardServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - 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 keydashboardserviceModule.v1.KeyDashboardServiceClient({ - 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('listCryptoKeys', () => { - it('invokes listCryptoKeys without error', async () => { - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - ]; - client.innerApiCalls.listCryptoKeys = stubSimpleCall(expectedResponse); - const [response] = await client.listCryptoKeys(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeys without error using callback', async () => { - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - ]; - client.innerApiCalls.listCryptoKeys = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCryptoKeys( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeys with error', async () => { - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCryptoKeys = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCryptoKeys(request), expectedError); - const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeysStream without error', async () => { - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - ]; - client.descriptors.page.listCryptoKeys.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCryptoKeysStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.CryptoKey[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKey) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCryptoKeys.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCryptoKeys, request)); - assert( - (client.descriptors.page.listCryptoKeys.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listCryptoKeysStream with error', async () => { - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listCryptoKeys.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCryptoKeysStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.CryptoKey[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKey) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCryptoKeys.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCryptoKeys, request)); - assert( - (client.descriptors.page.listCryptoKeys.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCryptoKeys without error', async () => { - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - ]; - client.descriptors.page.listCryptoKeys.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.kms.v1.ICryptoKey[] = []; - const iterable = client.listCryptoKeysAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCryptoKeys with error', async () => { - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listCryptoKeys.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCryptoKeysAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.kms.v1.ICryptoKey[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('cryptoKey', () => { - const fakePath = "/rendered/path/cryptoKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - }; - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.cryptoKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cryptoKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cryptoKeyPath', () => { - const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCryptoKeyName', () => { - const result = client.matchProjectFromCryptoKeyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCryptoKeyName', () => { - const result = client.matchLocationFromCryptoKeyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromCryptoKeyName', () => { - const result = client.matchKeyRingFromCryptoKeyName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromCryptoKeyName', () => { - const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('cryptoKeyVersion', () => { - const fakePath = "/rendered/path/cryptoKeyVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - crypto_key_version: "cryptoKeyVersionValue", - }; - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.cryptoKeyVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cryptoKeyVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cryptoKeyVersionPath', () => { - const result = client.cryptoKeyVersionPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCryptoKeyVersionName', () => { - const result = client.matchProjectFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCryptoKeyVersionName', () => { - const result = client.matchLocationFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromCryptoKeyVersionName', () => { - const result = client.matchKeyRingFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromCryptoKeyVersionName', () => { - const result = client.matchCryptoKeyFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyVersionFromCryptoKeyVersionName', () => { - const result = client.matchCryptoKeyVersionFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "cryptoKeyVersionValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('importJob', () => { - const fakePath = "/rendered/path/importJob"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - import_job: "importJobValue", - }; - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.importJobPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.importJobPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('importJobPath', () => { - const result = client.importJobPath("projectValue", "locationValue", "keyRingValue", "importJobValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.importJobPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromImportJobName', () => { - const result = client.matchProjectFromImportJobName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromImportJobName', () => { - const result = client.matchLocationFromImportJobName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromImportJobName', () => { - const result = client.matchKeyRingFromImportJobName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchImportJobFromImportJobName', () => { - const result = client.matchImportJobFromImportJobName(fakePath); - assert.strictEqual(result, "importJobValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('keyRing', () => { - const fakePath = "/rendered/path/keyRing"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - }; - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.keyRingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.keyRingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('keyRingPath', () => { - const result = client.keyRingPath("projectValue", "locationValue", "keyRingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.keyRingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromKeyRingName', () => { - const result = client.matchProjectFromKeyRingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromKeyRingName', () => { - const result = client.matchLocationFromKeyRingName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromKeyRingName', () => { - const result = client.matchKeyRingFromKeyRingName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - 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('projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary', () => { - const fakePath = "/rendered/path/projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - crypto_key_version: "cryptoKeyVersionValue", - }; - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPath', () => { - const result = client.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { - const result = client.matchProjectFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { - const result = client.matchLocationFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { - const result = client.matchKeyRingFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { - const result = client.matchCryptoKeyFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyVersionFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { - const result = client.matchCryptoKeyVersionFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "cryptoKeyVersionValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKeyRingCryptoKeyProtectedResourcesSummary', () => { - const fakePath = "/rendered/path/projectLocationKeyRingCryptoKeyProtectedResourcesSummary"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - }; - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPath', () => { - const result = client.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName', () => { - const result = client.matchProjectFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName', () => { - const result = client.matchLocationFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName', () => { - const result = client.matchKeyRingFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName', () => { - const result = client.matchCryptoKeyFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('publicKey', () => { - const fakePath = "/rendered/path/publicKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - crypto_key_version: "cryptoKeyVersionValue", - }; - const client = new keydashboardserviceModule.v1.KeyDashboardServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.publicKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.publicKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('publicKeyPath', () => { - const result = client.publicKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.publicKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPublicKeyName', () => { - const result = client.matchProjectFromPublicKeyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPublicKeyName', () => { - const result = client.matchLocationFromPublicKeyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromPublicKeyName', () => { - const result = client.matchKeyRingFromPublicKeyName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromPublicKeyName', () => { - const result = client.matchCryptoKeyFromPublicKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyVersionFromPublicKeyName', () => { - const result = client.matchCryptoKeyVersionFromPublicKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyVersionValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/test/gapic_key_tracking_service_v1.ts b/owl-bot-staging/google-cloud-kms-inventory/v1/test/gapic_key_tracking_service_v1.ts deleted file mode 100644 index 3a0b697d7a7..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/v1/test/gapic_key_tracking_service_v1.ts +++ /dev/null @@ -1,977 +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 keytrackingserviceModule 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.KeyTrackingServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = keytrackingserviceModule.v1.KeyTrackingServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = keytrackingserviceModule.v1.KeyTrackingServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = keytrackingserviceModule.v1.KeyTrackingServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.keyTrackingServiceStub, undefined); - await client.initialize(); - assert(client.keyTrackingServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.keyTrackingServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.keyTrackingServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - 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 keytrackingserviceModule.v1.KeyTrackingServiceClient({ - 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('getProtectedResourcesSummary', () => { - it('invokes getProtectedResourcesSummary without error', async () => { - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.ProtectedResourcesSummary() - ); - client.innerApiCalls.getProtectedResourcesSummary = stubSimpleCall(expectedResponse); - const [response] = await client.getProtectedResourcesSummary(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProtectedResourcesSummary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProtectedResourcesSummary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProtectedResourcesSummary without error using callback', async () => { - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.ProtectedResourcesSummary() - ); - client.innerApiCalls.getProtectedResourcesSummary = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProtectedResourcesSummary( - request, - (err?: Error|null, result?: protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProtectedResourcesSummary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProtectedResourcesSummary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProtectedResourcesSummary with error', async () => { - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getProtectedResourcesSummary = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getProtectedResourcesSummary(request), expectedError); - const actualRequest = (client.innerApiCalls.getProtectedResourcesSummary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProtectedResourcesSummary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProtectedResourcesSummary with closed client', async () => { - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.GetProtectedResourcesSummaryRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getProtectedResourcesSummary(request), expectedError); - }); - }); - - describe('searchProtectedResources', () => { - it('invokes searchProtectedResources without error', async () => { - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), - generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), - generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), - ]; - client.innerApiCalls.searchProtectedResources = stubSimpleCall(expectedResponse); - const [response] = await client.searchProtectedResources(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchProtectedResources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchProtectedResources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchProtectedResources without error using callback', async () => { - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), - generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), - generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), - ]; - client.innerApiCalls.searchProtectedResources = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchProtectedResources( - request, - (err?: Error|null, result?: protos.google.cloud.kms.inventory.v1.IProtectedResource[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchProtectedResources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchProtectedResources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchProtectedResources with error', async () => { - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchProtectedResources = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchProtectedResources(request), expectedError); - const actualRequest = (client.innerApiCalls.searchProtectedResources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchProtectedResources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchProtectedResourcesStream without error', async () => { - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), - generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), - generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), - ]; - client.descriptors.page.searchProtectedResources.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.searchProtectedResourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.inventory.v1.ProtectedResource[] = []; - stream.on('data', (response: protos.google.cloud.kms.inventory.v1.ProtectedResource) => { - 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.searchProtectedResources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchProtectedResources, request)); - assert( - (client.descriptors.page.searchProtectedResources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes searchProtectedResourcesStream with error', async () => { - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.searchProtectedResources.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.searchProtectedResourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.inventory.v1.ProtectedResource[] = []; - stream.on('data', (response: protos.google.cloud.kms.inventory.v1.ProtectedResource) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.searchProtectedResources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchProtectedResources, request)); - assert( - (client.descriptors.page.searchProtectedResources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with searchProtectedResources without error', async () => { - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), - generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), - generateSampleMessage(new protos.google.cloud.kms.inventory.v1.ProtectedResource()), - ]; - client.descriptors.page.searchProtectedResources.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.kms.inventory.v1.IProtectedResource[] = []; - const iterable = client.searchProtectedResourcesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.searchProtectedResources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchProtectedResources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with searchProtectedResources with error', async () => { - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.inventory.v1.SearchProtectedResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.searchProtectedResources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.searchProtectedResourcesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.kms.inventory.v1.IProtectedResource[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.searchProtectedResources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchProtectedResources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('cryptoKey', () => { - const fakePath = "/rendered/path/cryptoKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - }; - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.cryptoKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cryptoKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cryptoKeyPath', () => { - const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCryptoKeyName', () => { - const result = client.matchProjectFromCryptoKeyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCryptoKeyName', () => { - const result = client.matchLocationFromCryptoKeyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromCryptoKeyName', () => { - const result = client.matchKeyRingFromCryptoKeyName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromCryptoKeyName', () => { - const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('cryptoKeyVersion', () => { - const fakePath = "/rendered/path/cryptoKeyVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - crypto_key_version: "cryptoKeyVersionValue", - }; - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.cryptoKeyVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cryptoKeyVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cryptoKeyVersionPath', () => { - const result = client.cryptoKeyVersionPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCryptoKeyVersionName', () => { - const result = client.matchProjectFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCryptoKeyVersionName', () => { - const result = client.matchLocationFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromCryptoKeyVersionName', () => { - const result = client.matchKeyRingFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromCryptoKeyVersionName', () => { - const result = client.matchCryptoKeyFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyVersionFromCryptoKeyVersionName', () => { - const result = client.matchCryptoKeyVersionFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "cryptoKeyVersionValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('importJob', () => { - const fakePath = "/rendered/path/importJob"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - import_job: "importJobValue", - }; - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.importJobPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.importJobPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('importJobPath', () => { - const result = client.importJobPath("projectValue", "locationValue", "keyRingValue", "importJobValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.importJobPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromImportJobName', () => { - const result = client.matchProjectFromImportJobName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromImportJobName', () => { - const result = client.matchLocationFromImportJobName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromImportJobName', () => { - const result = client.matchKeyRingFromImportJobName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchImportJobFromImportJobName', () => { - const result = client.matchImportJobFromImportJobName(fakePath); - assert.strictEqual(result, "importJobValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('keyRing', () => { - const fakePath = "/rendered/path/keyRing"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - }; - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.keyRingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.keyRingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('keyRingPath', () => { - const result = client.keyRingPath("projectValue", "locationValue", "keyRingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.keyRingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromKeyRingName', () => { - const result = client.matchProjectFromKeyRingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromKeyRingName', () => { - const result = client.matchLocationFromKeyRingName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromKeyRingName', () => { - const result = client.matchKeyRingFromKeyRingName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organization', () => { - const fakePath = "/rendered/path/organization"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationPath', () => { - const result = client.organizationPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationName', () => { - const result = client.matchOrganizationFromOrganizationName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary', () => { - const fakePath = "/rendered/path/projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - crypto_key_version: "cryptoKeyVersionValue", - }; - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPath', () => { - const result = client.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { - const result = client.matchProjectFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { - const result = client.matchLocationFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { - const result = client.matchKeyRingFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { - const result = client.matchCryptoKeyFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyVersionFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName', () => { - const result = client.matchCryptoKeyVersionFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "cryptoKeyVersionValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKeyRingCryptoKeyProtectedResourcesSummary', () => { - const fakePath = "/rendered/path/projectLocationKeyRingCryptoKeyProtectedResourcesSummary"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - }; - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPath', () => { - const result = client.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName', () => { - const result = client.matchProjectFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName', () => { - const result = client.matchLocationFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName', () => { - const result = client.matchKeyRingFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName', () => { - const result = client.matchCryptoKeyFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('publicKey', () => { - const fakePath = "/rendered/path/publicKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - crypto_key_version: "cryptoKeyVersionValue", - }; - const client = new keytrackingserviceModule.v1.KeyTrackingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.publicKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.publicKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('publicKeyPath', () => { - const result = client.publicKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.publicKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPublicKeyName', () => { - const result = client.matchProjectFromPublicKeyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPublicKeyName', () => { - const result = client.matchLocationFromPublicKeyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromPublicKeyName', () => { - const result = client.matchKeyRingFromPublicKeyName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromPublicKeyName', () => { - const result = client.matchCryptoKeyFromPublicKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyVersionFromPublicKeyName', () => { - const result = client.matchCryptoKeyVersionFromPublicKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyVersionValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-kms-inventory/v1/tsconfig.json b/owl-bot-staging/google-cloud-kms-inventory/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/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-kms-inventory/v1/webpack.config.js b/owl-bot-staging/google-cloud-kms-inventory/v1/webpack.config.js deleted file mode 100644 index 7e4c2732db0..00000000000 --- a/owl-bot-staging/google-cloud-kms-inventory/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: 'KeyDashboardService', - filename: './key-dashboard-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-kms/v1/.eslintignore b/owl-bot-staging/google-cloud-kms/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-kms/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-kms/v1/.eslintrc.json b/owl-bot-staging/google-cloud-kms/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-kms/v1/.gitignore b/owl-bot-staging/google-cloud-kms/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-kms/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-kms/v1/.jsdoc.js b/owl-bot-staging/google-cloud-kms/v1/.jsdoc.js deleted file mode 100644 index ff4782d58cb..00000000000 --- a/owl-bot-staging/google-cloud-kms/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/kms', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-kms/v1/.mocharc.js b/owl-bot-staging/google-cloud-kms/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-kms/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-kms/v1/.prettierrc.js b/owl-bot-staging/google-cloud-kms/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-kms/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-kms/v1/README.md b/owl-bot-staging/google-cloud-kms/v1/README.md deleted file mode 100644 index ea8e413e5ae..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Kms: Nodejs Client diff --git a/owl-bot-staging/google-cloud-kms/v1/package.json b/owl-bot-staging/google-cloud-kms/v1/package.json deleted file mode 100644 index 38af1cff202..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "@google-cloud/kms", - "version": "0.1.0", - "description": "Kms client for Node.js", - "repository": "googleapis/nodejs-kms", - "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 kms", - "kms", - "ekm service", - "key management service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/ekm_service.proto b/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/ekm_service.proto deleted file mode 100644 index da3056543db..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/ekm_service.proto +++ /dev/null @@ -1,451 +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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.kms.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Kms.V1"; -option go_package = "cloud.google.com/go/kms/apiv1/kmspb;kmspb"; -option java_multiple_files = true; -option java_outer_classname = "EkmServiceProto"; -option java_package = "com.google.cloud.kms.v1"; -option php_namespace = "Google\\Cloud\\Kms\\V1"; -option (google.api.resource_definition) = { - type: "servicedirectory.googleapis.com/Service" - pattern: "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}" -}; - -// Google Cloud Key Management EKM Service -// -// Manages external cryptographic keys and operations using those keys. -// Implements a REST model with the following objects: -// * [EkmConnection][google.cloud.kms.v1.EkmConnection] -service EkmService { - option (google.api.default_host) = "cloudkms.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloudkms"; - - // Lists [EkmConnections][google.cloud.kms.v1.EkmConnection]. - rpc ListEkmConnections(ListEkmConnectionsRequest) - returns (ListEkmConnectionsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/ekmConnections" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns metadata for a given - // [EkmConnection][google.cloud.kms.v1.EkmConnection]. - rpc GetEkmConnection(GetEkmConnectionRequest) returns (EkmConnection) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/ekmConnections/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new [EkmConnection][google.cloud.kms.v1.EkmConnection] in a given - // Project and Location. - rpc CreateEkmConnection(CreateEkmConnectionRequest) returns (EkmConnection) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/ekmConnections" - body: "ekm_connection" - }; - option (google.api.method_signature) = - "parent,ekm_connection_id,ekm_connection"; - } - - // Updates an [EkmConnection][google.cloud.kms.v1.EkmConnection]'s metadata. - rpc UpdateEkmConnection(UpdateEkmConnectionRequest) returns (EkmConnection) { - option (google.api.http) = { - patch: "/v1/{ekm_connection.name=projects/*/locations/*/ekmConnections/*}" - body: "ekm_connection" - }; - option (google.api.method_signature) = "ekm_connection,update_mask"; - } - - // Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource - // for a given project and location. - rpc GetEkmConfig(GetEkmConfigRequest) returns (EkmConfig) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/ekmConfig}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource - // for a given project and location. - rpc UpdateEkmConfig(UpdateEkmConfigRequest) returns (EkmConfig) { - option (google.api.http) = { - patch: "/v1/{ekm_config.name=projects/*/locations/*/ekmConfig}" - body: "ekm_config" - }; - option (google.api.method_signature) = "ekm_config,update_mask"; - } - - // Verifies that Cloud KMS can successfully connect to the external key - // manager specified by an [EkmConnection][google.cloud.kms.v1.EkmConnection]. - // If there is an error connecting to the EKM, this method returns a - // FAILED_PRECONDITION status containing structured information as described - // at https://cloud.google.com/kms/docs/reference/ekm_errors. - rpc VerifyConnectivity(VerifyConnectivityRequest) - returns (VerifyConnectivityResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/ekmConnections/*}:verifyConnectivity" - }; - option (google.api.method_signature) = "name"; - } -} - -// Request message for -// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections]. -message ListEkmConnectionsRequest { - // Required. The resource name of the location associated with the - // [EkmConnections][google.cloud.kms.v1.EkmConnection] to list, in the format - // `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. Optional limit on the number of - // [EkmConnections][google.cloud.kms.v1.EkmConnection] to include in the - // response. Further [EkmConnections][google.cloud.kms.v1.EkmConnection] can - // subsequently be obtained by including the - // [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token] - // in a subsequent request. If unspecified, the server will pick an - // appropriate default. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Optional pagination token, returned earlier via - // [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only include resources that match the filter in the response. For - // more information, see - // [Sorting and filtering list - // results](https://cloud.google.com/kms/docs/sorting-and-filtering). - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify how the results should be sorted. If not specified, the - // results will be sorted in the default order. For more information, see - // [Sorting and filtering list - // results](https://cloud.google.com/kms/docs/sorting-and-filtering). - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections]. -message ListEkmConnectionsResponse { - // The list of [EkmConnections][google.cloud.kms.v1.EkmConnection]. - repeated EkmConnection ekm_connections = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListEkmConnectionsRequest.page_token][google.cloud.kms.v1.ListEkmConnectionsRequest.page_token] - // to retrieve the next page of results. - string next_page_token = 2; - - // The total number of [EkmConnections][google.cloud.kms.v1.EkmConnection] - // that matched the query. - int32 total_size = 3; -} - -// Request message for -// [EkmService.GetEkmConnection][google.cloud.kms.v1.EkmService.GetEkmConnection]. -message GetEkmConnectionRequest { - // Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the - // [EkmConnection][google.cloud.kms.v1.EkmConnection] to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/EkmConnection" - } - ]; -} - -// Request message for -// [EkmService.CreateEkmConnection][google.cloud.kms.v1.EkmService.CreateEkmConnection]. -message CreateEkmConnectionRequest { - // Required. The resource name of the location associated with the - // [EkmConnection][google.cloud.kms.v1.EkmConnection], in the format - // `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. It must be unique within a location and match the regular - // expression `[a-zA-Z0-9_-]{1,63}`. - string ekm_connection_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. An [EkmConnection][google.cloud.kms.v1.EkmConnection] with - // initial field values. - EkmConnection ekm_connection = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [EkmService.UpdateEkmConnection][google.cloud.kms.v1.EkmService.UpdateEkmConnection]. -message UpdateEkmConnectionRequest { - // Required. [EkmConnection][google.cloud.kms.v1.EkmConnection] with updated - // values. - EkmConnection ekm_connection = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. List of fields to be updated in this request. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [EkmService.GetEkmConfig][google.cloud.kms.v1.EkmService.GetEkmConfig]. -message GetEkmConfigRequest { - // Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the - // [EkmConfig][google.cloud.kms.v1.EkmConfig] to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/EkmConfig" - } - ]; -} - -// Request message for -// [EkmService.UpdateEkmConfig][google.cloud.kms.v1.EkmService.UpdateEkmConfig]. -message UpdateEkmConfigRequest { - // Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values. - EkmConfig ekm_config = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. List of fields to be updated in this request. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// A [Certificate][google.cloud.kms.v1.Certificate] represents an X.509 -// certificate used to authenticate HTTPS connections to EKM replicas. -message Certificate { - // Required. The raw certificate bytes in DER format. - bytes raw_der = 1 [(google.api.field_behavior) = REQUIRED]; - - // Output only. True if the certificate was parsed successfully. - bool parsed = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The issuer distinguished name in RFC 2253 format. Only present - // if [parsed][google.cloud.kms.v1.Certificate.parsed] is true. - string issuer = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The subject distinguished name in RFC 2253 format. Only - // present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true. - string subject = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The subject Alternative DNS names. Only present if - // [parsed][google.cloud.kms.v1.Certificate.parsed] is true. - repeated string subject_alternative_dns_names = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The certificate is not valid before this time. Only present if - // [parsed][google.cloud.kms.v1.Certificate.parsed] is true. - google.protobuf.Timestamp not_before_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The certificate is not valid after this time. Only present if - // [parsed][google.cloud.kms.v1.Certificate.parsed] is true. - google.protobuf.Timestamp not_after_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The certificate serial number as a hex string. Only present if - // [parsed][google.cloud.kms.v1.Certificate.parsed] is true. - string serial_number = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The SHA-256 certificate fingerprint as a hex string. Only - // present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true. - string sha256_fingerprint = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// An [EkmConnection][google.cloud.kms.v1.EkmConnection] represents an -// individual EKM connection. It can be used for creating -// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and -// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a -// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of -// [EXTERNAL_VPC][CryptoKeyVersion.ProtectionLevel.EXTERNAL_VPC], as well as -// performing cryptographic operations using keys created within the -// [EkmConnection][google.cloud.kms.v1.EkmConnection]. -message EkmConnection { - option (google.api.resource) = { - type: "cloudkms.googleapis.com/EkmConnection" - pattern: "projects/{project}/locations/{location}/ekmConnections/{ekm_connection}" - }; - - // A [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] - // represents an EKM replica that can be reached within an - // [EkmConnection][google.cloud.kms.v1.EkmConnection]. - message ServiceResolver { - // Required. The resource name of the Service Directory service pointing to - // an EKM replica, in the format - // `projects/*/locations/*/namespaces/*/services/*`. - string service_directory_service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "servicedirectory.googleapis.com/Service" - } - ]; - - // Optional. The filter applied to the endpoints of the resolved service. If - // no filter is specified, all endpoints will be considered. An endpoint - // will be chosen arbitrarily from the filtered list for each request. - // - // For endpoint filter syntax and examples, see - // https://cloud.google.com/service-directory/docs/reference/rpc/google.cloud.servicedirectory.v1#resolveservicerequest. - string endpoint_filter = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The hostname of the EKM replica used at TLS and HTTP layers. - string hostname = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. A list of leaf server certificates used to authenticate HTTPS - // connections to the EKM replica. Currently, a maximum of 10 - // [Certificate][google.cloud.kms.v1.Certificate] is supported. - repeated Certificate server_certificates = 4 - [(google.api.field_behavior) = REQUIRED]; - } - - // [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] - // describes who can perform control plane cryptographic operations using this - // [EkmConnection][google.cloud.kms.v1.EkmConnection]. - enum KeyManagementMode { - // Not specified. - KEY_MANAGEMENT_MODE_UNSPECIFIED = 0; - - // EKM-side key management operations on - // [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this - // [EkmConnection][google.cloud.kms.v1.EkmConnection] must be initiated from - // the EKM directly and cannot be performed from Cloud KMS. This means that: - // * When creating a - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] associated with - // this - // [EkmConnection][google.cloud.kms.v1.EkmConnection], the caller must - // supply the key path of pre-existing external key material that will be - // linked to the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. - // * Destruction of external key material cannot be requested via the - // Cloud KMS API and must be performed directly in the EKM. - // * Automatic rotation of key material is not supported. - MANUAL = 1; - - // All [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this - // [EkmConnection][google.cloud.kms.v1.EkmConnection] use EKM-side key - // management operations initiated from Cloud KMS. This means that: - // * When a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] - // associated with this [EkmConnection][google.cloud.kms.v1.EkmConnection] - // is - // created, the EKM automatically generates new key material and a new - // key path. The caller cannot supply the key path of pre-existing - // external key material. - // * Destruction of external key material associated with this - // [EkmConnection][google.cloud.kms.v1.EkmConnection] can be requested by - // calling [DestroyCryptoKeyVersion][EkmService.DestroyCryptoKeyVersion]. - // * Automatic rotation of key material is supported. - CLOUD_KMS = 2; - } - - // Output only. The resource name for the - // [EkmConnection][google.cloud.kms.v1.EkmConnection] in the format - // `projects/*/locations/*/ekmConnections/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which the - // [EkmConnection][google.cloud.kms.v1.EkmConnection] was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A list of - // [ServiceResolvers][google.cloud.kms.v1.EkmConnection.ServiceResolver] where - // the EKM can be reached. There should be one ServiceResolver per EKM - // replica. Currently, only a single - // [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] is - // supported. - repeated ServiceResolver service_resolvers = 3; - - // Optional. Etag of the currently stored - // [EkmConnection][google.cloud.kms.v1.EkmConnection]. - string etag = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Describes who can perform control plane operations on the EKM. If - // unset, this defaults to - // [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL]. - KeyManagementMode key_management_mode = 6 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Identifies the EKM Crypto Space that this - // [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This - // field is required if - // [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is - // [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS]. - string crypto_space_path = 7 [(google.api.field_behavior) = OPTIONAL]; -} - -// An [EkmConfig][google.cloud.kms.v1.EkmConfig] is a singleton resource that -// represents configuration parameters that apply to all -// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and -// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a -// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of -// [EXTERNAL_VPC][CryptoKeyVersion.ProtectionLevel.EXTERNAL_VPC] in a given -// project and location. -message EkmConfig { - option (google.api.resource) = { - type: "cloudkms.googleapis.com/EkmConfig" - pattern: "projects/{project}/locations/{location}/ekmConfig" - }; - - // Output only. The resource name for the - // [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format - // `projects/*/locations/*/ekmConfig`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Resource name of the default - // [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to - // the empty string removes the default. - string default_ekm_connection = 2 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/EkmConnection" - } - ]; -} - -// Request message for -// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity]. -message VerifyConnectivityRequest { - // Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the - // [EkmConnection][google.cloud.kms.v1.EkmConnection] to verify. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/EkmConnection" - } - ]; -} - -// Response message for -// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity]. -message VerifyConnectivityResponse {} diff --git a/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/resources.proto b/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/resources.proto deleted file mode 100644 index fb4e6534a69..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/resources.proto +++ /dev/null @@ -1,920 +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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.kms.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Kms.V1"; -option go_package = "cloud.google.com/go/kms/apiv1/kmspb;kmspb"; -option java_multiple_files = true; -option java_outer_classname = "KmsResourcesProto"; -option java_package = "com.google.cloud.kms.v1"; -option php_namespace = "Google\\Cloud\\Kms\\V1"; - -// A [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of -// [CryptoKeys][google.cloud.kms.v1.CryptoKey]. -message KeyRing { - option (google.api.resource) = { - type: "cloudkms.googleapis.com/KeyRing" - pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}" - }; - - // Output only. The resource name for the - // [KeyRing][google.cloud.kms.v1.KeyRing] in the format - // `projects/*/locations/*/keyRings/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] - // was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that -// can be used for cryptographic operations. -// -// A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of zero or more -// [versions][google.cloud.kms.v1.CryptoKeyVersion], which represent the actual -// key material used in cryptographic operations. -message CryptoKey { - option (google.api.resource) = { - type: "cloudkms.googleapis.com/CryptoKey" - pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" - }; - - // [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] - // describes the cryptographic capabilities of a - // [CryptoKey][google.cloud.kms.v1.CryptoKey]. A given key can only be used - // for the operations allowed by its purpose. For more information, see [Key - // purposes](https://cloud.google.com/kms/docs/algorithms#key_purposes). - enum CryptoKeyPurpose { - // Not specified. - CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0; - - // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used - // with [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and - // [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. - ENCRYPT_DECRYPT = 1; - - // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used - // with - // [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign] - // and - // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. - ASYMMETRIC_SIGN = 5; - - // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used - // with - // [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt] - // and - // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. - ASYMMETRIC_DECRYPT = 6; - - // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used - // with [RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt] - // and [RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt]. - // This purpose is meant to be used for interoperable symmetric - // encryption and does not support automatic CryptoKey rotation. - RAW_ENCRYPT_DECRYPT = 7; - - // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used - // with [MacSign][google.cloud.kms.v1.KeyManagementService.MacSign]. - MAC = 9; - } - - // Output only. The resource name for this - // [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format - // `projects/*/locations/*/keyRings/*/cryptoKeys/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A copy of the "primary" - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used - // by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this - // [CryptoKey][google.cloud.kms.v1.CryptoKey] is given in - // [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name]. - // - // The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be - // updated via - // [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]. - // - // Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT] - // may have a primary. For other keys, this field will be omitted. - CryptoKeyVersion primary = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Immutable. The immutable purpose of this - // [CryptoKey][google.cloud.kms.v1.CryptoKey]. - CryptoKeyPurpose purpose = 3 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time at which this - // [CryptoKey][google.cloud.kms.v1.CryptoKey] was created. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], - // the Key Management Service will automatically: - // - // 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. - // 2. Mark the new version as primary. - // - // Key rotations performed manually via - // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] - // and - // [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion] - // do not affect - // [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]. - // - // Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT] - // support automatic rotation. For other keys, this field must be omitted. - google.protobuf.Timestamp next_rotation_time = 7; - - // Controls the rate of automatic rotation. - oneof rotation_schedule { - // [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] - // will be advanced by this period when the service automatically rotates a - // key. Must be at least 24 hours and at most 876,000 hours. - // - // If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is - // set, - // [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] - // must also be set. - // - // Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT] - // support automatic rotation. For other keys, this field must be omitted. - google.protobuf.Duration rotation_period = 8; - } - - // A template describing settings for new - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] instances. The - // properties of new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] - // instances created by either - // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] - // or auto-rotation are controlled by this template. - CryptoKeyVersionTemplate version_template = 11; - - // Labels with user-defined metadata. For more information, see - // [Labeling Keys](https://cloud.google.com/kms/docs/labeling-keys). - map labels = 10; - - // Immutable. Whether this key may contain imported versions only. - bool import_only = 13 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. The period of time that versions of this key spend in the - // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] - // state before transitioning to - // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]. - // If not specified at creation time, the default duration is 24 hours. - google.protobuf.Duration destroy_scheduled_duration = 14 - [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. The resource name of the backend environment where the key - // material for all [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] - // associated with this [CryptoKey][google.cloud.kms.v1.CryptoKey] reside and - // where all related cryptographic operations are performed. Only applicable - // if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] have a - // [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of - // [EXTERNAL_VPC][CryptoKeyVersion.ProtectionLevel.EXTERNAL_VPC], with the - // resource name in the format `projects/*/locations/*/ekmConnections/*`. - // Note, this list is non-exhaustive and may apply to additional - // [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel] in the future. - string crypto_key_backend = 15 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { type: "*" } - ]; -} - -// A [CryptoKeyVersionTemplate][google.cloud.kms.v1.CryptoKeyVersionTemplate] -// specifies the properties to use when creating a new -// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], either manually -// with -// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] -// or automatically as a result of auto-rotation. -message CryptoKeyVersionTemplate { - // [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when creating - // a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this - // template. Immutable. Defaults to - // [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE]. - ProtectionLevel protection_level = 1; - - // Required. - // [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] - // to use when creating a - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this - // template. - // - // For backwards compatibility, GOOGLE_SYMMETRIC_ENCRYPTION is implied if both - // this field is omitted and - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. - CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 3 - [(google.api.field_behavior) = REQUIRED]; -} - -// Contains an HSM-generated attestation about a key operation. For more -// information, see [Verifying attestations] -// (https://cloud.google.com/kms/docs/attest-key). -message KeyOperationAttestation { - // Attestation formats provided by the HSM. - enum AttestationFormat { - // Not specified. - ATTESTATION_FORMAT_UNSPECIFIED = 0; - - // Cavium HSM attestation compressed with gzip. Note that this format is - // defined by Cavium and subject to change at any time. - // - // See - // https://www.marvell.com/products/security-solutions/nitrox-hs-adapters/software-key-attestation.html. - CAVIUM_V1_COMPRESSED = 3; - - // Cavium HSM attestation V2 compressed with gzip. This is a new format - // introduced in Cavium's version 3.2-08. - CAVIUM_V2_COMPRESSED = 4; - } - - // Certificate chains needed to verify the attestation. - // Certificates in chains are PEM-encoded and are ordered based on - // https://tools.ietf.org/html/rfc5246#section-7.4.2. - message CertificateChains { - // Cavium certificate chain corresponding to the attestation. - repeated string cavium_certs = 1; - - // Google card certificate chain corresponding to the attestation. - repeated string google_card_certs = 2; - - // Google partition certificate chain corresponding to the attestation. - repeated string google_partition_certs = 3; - } - - // Output only. The format of the attestation data. - AttestationFormat format = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The attestation data provided by the HSM when the key - // operation was performed. - bytes content = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The certificate chains needed to validate the attestation - CertificateChains cert_chains = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an -// individual cryptographic key, and the associated key material. -// -// An -// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] -// version can be used for cryptographic operations. -// -// For security reasons, the raw cryptographic key material represented by a -// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed -// or exported. It can only be used to encrypt, decrypt, or sign data when an -// authorized user or application invokes Cloud KMS. -message CryptoKeyVersion { - option (google.api.resource) = { - type: "cloudkms.googleapis.com/CryptoKeyVersion" - pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}" - }; - - // The algorithm of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating what - // parameters must be used for each cryptographic operation. - // - // The - // [GOOGLE_SYMMETRIC_ENCRYPTION][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION] - // algorithm is usable with - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. - // - // Algorithms beginning with `RSA_SIGN_` are usable with - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]. - // - // The fields in the name after `RSA_SIGN_` correspond to the following - // parameters: padding algorithm, modulus bit length, and digest algorithm. - // - // For PSS, the salt length used is equal to the length of digest - // algorithm. For example, - // [RSA_SIGN_PSS_2048_SHA256][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256] - // will use PSS with a salt length of 256 bits or 32 bytes. - // - // Algorithms beginning with `RSA_DECRYPT_` are usable with - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]. - // - // The fields in the name after `RSA_DECRYPT_` correspond to the following - // parameters: padding algorithm, modulus bit length, and digest algorithm. - // - // Algorithms beginning with `EC_SIGN_` are usable with - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]. - // - // The fields in the name after `EC_SIGN_` correspond to the following - // parameters: elliptic curve, digest algorithm. - // - // Algorithms beginning with `HMAC_` are usable with - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [MAC][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC]. - // - // The suffix following `HMAC_` corresponds to the hash algorithm being used - // (eg. SHA256). - // - // For more information, see [Key purposes and algorithms] - // (https://cloud.google.com/kms/docs/algorithms). - enum CryptoKeyVersionAlgorithm { - // Not specified. - CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED = 0; - - // Creates symmetric encryption keys. - GOOGLE_SYMMETRIC_ENCRYPTION = 1; - - // AES-GCM (Galois Counter Mode) using 128-bit keys. - AES_128_GCM = 41; - - // AES-GCM (Galois Counter Mode) using 256-bit keys. - AES_256_GCM = 19; - - // AES-CBC (Cipher Block Chaining Mode) using 128-bit keys. - AES_128_CBC = 42; - - // AES-CBC (Cipher Block Chaining Mode) using 256-bit keys. - AES_256_CBC = 43; - - // AES-CTR (Counter Mode) using 128-bit keys. - AES_128_CTR = 44; - - // AES-CTR (Counter Mode) using 256-bit keys. - AES_256_CTR = 45; - - // RSASSA-PSS 2048 bit key with a SHA256 digest. - RSA_SIGN_PSS_2048_SHA256 = 2; - - // RSASSA-PSS 3072 bit key with a SHA256 digest. - RSA_SIGN_PSS_3072_SHA256 = 3; - - // RSASSA-PSS 4096 bit key with a SHA256 digest. - RSA_SIGN_PSS_4096_SHA256 = 4; - - // RSASSA-PSS 4096 bit key with a SHA512 digest. - RSA_SIGN_PSS_4096_SHA512 = 15; - - // RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest. - RSA_SIGN_PKCS1_2048_SHA256 = 5; - - // RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest. - RSA_SIGN_PKCS1_3072_SHA256 = 6; - - // RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest. - RSA_SIGN_PKCS1_4096_SHA256 = 7; - - // RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest. - RSA_SIGN_PKCS1_4096_SHA512 = 16; - - // RSASSA-PKCS1-v1_5 signing without encoding, with a 2048 bit key. - RSA_SIGN_RAW_PKCS1_2048 = 28; - - // RSASSA-PKCS1-v1_5 signing without encoding, with a 3072 bit key. - RSA_SIGN_RAW_PKCS1_3072 = 29; - - // RSASSA-PKCS1-v1_5 signing without encoding, with a 4096 bit key. - RSA_SIGN_RAW_PKCS1_4096 = 30; - - // RSAES-OAEP 2048 bit key with a SHA256 digest. - RSA_DECRYPT_OAEP_2048_SHA256 = 8; - - // RSAES-OAEP 3072 bit key with a SHA256 digest. - RSA_DECRYPT_OAEP_3072_SHA256 = 9; - - // RSAES-OAEP 4096 bit key with a SHA256 digest. - RSA_DECRYPT_OAEP_4096_SHA256 = 10; - - // RSAES-OAEP 4096 bit key with a SHA512 digest. - RSA_DECRYPT_OAEP_4096_SHA512 = 17; - - // RSAES-OAEP 2048 bit key with a SHA1 digest. - RSA_DECRYPT_OAEP_2048_SHA1 = 37; - - // RSAES-OAEP 3072 bit key with a SHA1 digest. - RSA_DECRYPT_OAEP_3072_SHA1 = 38; - - // RSAES-OAEP 4096 bit key with a SHA1 digest. - RSA_DECRYPT_OAEP_4096_SHA1 = 39; - - // ECDSA on the NIST P-256 curve with a SHA256 digest. - // Other hash functions can also be used: - // https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms - EC_SIGN_P256_SHA256 = 12; - - // ECDSA on the NIST P-384 curve with a SHA384 digest. - // Other hash functions can also be used: - // https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms - EC_SIGN_P384_SHA384 = 13; - - // ECDSA on the non-NIST secp256k1 curve. This curve is only supported for - // HSM protection level. - // Other hash functions can also be used: - // https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms - EC_SIGN_SECP256K1_SHA256 = 31; - - // HMAC-SHA256 signing with a 256 bit key. - HMAC_SHA256 = 32; - - // HMAC-SHA1 signing with a 160 bit key. - HMAC_SHA1 = 33; - - // HMAC-SHA384 signing with a 384 bit key. - HMAC_SHA384 = 34; - - // HMAC-SHA512 signing with a 512 bit key. - HMAC_SHA512 = 35; - - // HMAC-SHA224 signing with a 224 bit key. - HMAC_SHA224 = 36; - - // Algorithm representing symmetric encryption by an external key manager. - EXTERNAL_SYMMETRIC_ENCRYPTION = 18; - } - - // The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], - // indicating if it can be used. - enum CryptoKeyVersionState { - // Not specified. - CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0; - - // This version is still being generated. It may not be used, enabled, - // disabled, or destroyed yet. Cloud KMS will automatically mark this - // version - // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] - // as soon as the version is ready. - PENDING_GENERATION = 5; - - // This version may be used for cryptographic operations. - ENABLED = 1; - - // This version may not be used, but the key material is still available, - // and the version can be placed back into the - // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] - // state. - DISABLED = 2; - - // This version is destroyed, and the key material is no longer stored. - // This version may only become - // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] - // again if this version is - // [reimport_eligible][google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible] - // and the original key material is reimported with a call to - // [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]. - DESTROYED = 3; - - // This version is scheduled for destruction, and will be destroyed soon. - // Call - // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] - // to put it back into the - // [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] - // state. - DESTROY_SCHEDULED = 4; - - // This version is still being imported. It may not be used, enabled, - // disabled, or destroyed yet. Cloud KMS will automatically mark this - // version - // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] - // as soon as the version is ready. - PENDING_IMPORT = 6; - - // This version was not imported successfully. It may not be used, enabled, - // disabled, or destroyed. The submitted key material has been discarded. - // Additional details can be found in - // [CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason]. - IMPORT_FAILED = 7; - - // This version was not generated successfully. It may not be used, enabled, - // disabled, or destroyed. Additional details can be found in - // [CryptoKeyVersion.generation_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason]. - GENERATION_FAILED = 8; - - // This version was destroyed, and it may not be used or enabled again. - // Cloud KMS is waiting for the corresponding key material residing in an - // external key manager to be destroyed. - PENDING_EXTERNAL_DESTRUCTION = 9; - - // This version was destroyed, and it may not be used or enabled again. - // However, Cloud KMS could not confirm that the corresponding key material - // residing in an external key manager was destroyed. Additional details can - // be found in - // [CryptoKeyVersion.external_destruction_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason]. - EXTERNAL_DESTRUCTION_FAILED = 10; - } - - // A view for [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]s. - // Controls the level of detail returned for - // [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] in - // [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions] - // and - // [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. - enum CryptoKeyVersionView { - // Default view for each - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not - // include the - // [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field. - CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED = 0; - - // Provides all fields in each - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the - // [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation]. - FULL = 1; - } - - // Output only. The resource name for this - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format - // `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The current state of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. - CryptoKeyVersionState state = 3; - - // Output only. The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] - // describing how crypto operations are performed with this - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. - ProtectionLevel protection_level = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The - // [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] - // that this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] - // supports. - CryptoKeyVersionAlgorithm algorithm = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statement that was generated and signed by the HSM at key - // creation time. Use this statement to verify attributes of the key as stored - // on the HSM, independently of Google. Only provided for key versions with - // [protection_level][google.cloud.kms.v1.CryptoKeyVersion.protection_level] - // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM]. - KeyOperationAttestation attestation = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created. - google.protobuf.Timestamp create_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time this - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was - // generated. - google.protobuf.Timestamp generate_time = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time this - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is - // scheduled for destruction. Only present if - // [state][google.cloud.kms.v1.CryptoKeyVersion.state] is - // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]. - google.protobuf.Timestamp destroy_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time this CryptoKeyVersion's key material was - // destroyed. Only present if - // [state][google.cloud.kms.v1.CryptoKeyVersion.state] is - // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]. - google.protobuf.Timestamp destroy_event_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The name of the [ImportJob][google.cloud.kms.v1.ImportJob] - // used in the most recent import of this - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Only present if - // the underlying key material was imported. - string import_job = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was - // most recently imported. - google.protobuf.Timestamp import_time = 15 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The root cause of the most recent import failure. Only present - // if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is - // [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]. - string import_failure_reason = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The root cause of the most recent generation failure. Only - // present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is - // [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED]. - string generation_failure_reason = 19 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The root cause of the most recent external destruction - // failure. Only present if - // [state][google.cloud.kms.v1.CryptoKeyVersion.state] is - // [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED]. - string external_destruction_failure_reason = 20 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // ExternalProtectionLevelOptions stores a group of additional fields for - // configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that - // are specific to the - // [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] protection level - // and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] - // protection levels. - ExternalProtectionLevelOptions external_protection_level_options = 17; - - // Output only. Whether or not this key version is eligible for reimport, by - // being specified as a target in - // [ImportCryptoKeyVersionRequest.crypto_key_version][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version]. - bool reimport_eligible = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The public key for a given -// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via -// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. -message PublicKey { - option (google.api.resource) = { - type: "cloudkms.googleapis.com/PublicKey" - pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/publicKey" - }; - - // The public key, encoded in PEM format. For more information, see the - // [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for - // [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and - // [Textual Encoding of Subject Public Key Info] - // (https://tools.ietf.org/html/rfc7468#section-13). - string pem = 1; - - // The - // [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] - // associated with this key. - CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2; - - // Integrity verification field. A CRC32C checksum of the returned - // [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of - // [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by - // computing the CRC32C checksum of - // [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your - // results to this field. Discard the response in case of non-matching - // checksum values, and perform a limited number of retries. A persistent - // mismatch may indicate an issue in your computation of the CRC32C checksum. - // Note: This field is defined as int64 for reasons of compatibility across - // different languages. However, it is a non-negative integer, which will - // never exceed 2^32-1, and can be safely downconverted to uint32 in languages - // that support this type. - // - // NOTE: This field is in Beta. - google.protobuf.Int64Value pem_crc32c = 3; - - // The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key. - // Provided here for verification. - // - // NOTE: This field is in Beta. - string name = 4; - - // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key. - ProtectionLevel protection_level = 5; -} - -// An [ImportJob][google.cloud.kms.v1.ImportJob] can be used to create -// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and -// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] using pre-existing -// key material, generated outside of Cloud KMS. -// -// When an [ImportJob][google.cloud.kms.v1.ImportJob] is created, Cloud KMS will -// generate a "wrapping key", which is a public/private key pair. You use the -// wrapping key to encrypt (also known as wrap) the pre-existing key material to -// protect it during the import process. The nature of the wrapping key depends -// on the choice of -// [import_method][google.cloud.kms.v1.ImportJob.import_method]. When the -// wrapping key generation is complete, the -// [state][google.cloud.kms.v1.ImportJob.state] will be set to -// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] and the -// [public_key][google.cloud.kms.v1.ImportJob.public_key] can be fetched. The -// fetched public key can then be used to wrap your pre-existing key material. -// -// Once the key material is wrapped, it can be imported into a new -// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in an existing -// [CryptoKey][google.cloud.kms.v1.CryptoKey] by calling -// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]. -// Multiple [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can be -// imported with a single [ImportJob][google.cloud.kms.v1.ImportJob]. Cloud KMS -// uses the private key portion of the wrapping key to unwrap the key material. -// Only Cloud KMS has access to the private key. -// -// An [ImportJob][google.cloud.kms.v1.ImportJob] expires 3 days after it is -// created. Once expired, Cloud KMS will no longer be able to import or unwrap -// any key material that was wrapped with the -// [ImportJob][google.cloud.kms.v1.ImportJob]'s public key. -// -// For more information, see -// [Importing a key](https://cloud.google.com/kms/docs/importing-a-key). -message ImportJob { - option (google.api.resource) = { - type: "cloudkms.googleapis.com/ImportJob" - pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}" - }; - - // [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] describes the - // key wrapping method chosen for this - // [ImportJob][google.cloud.kms.v1.ImportJob]. - enum ImportMethod { - // Not specified. - IMPORT_METHOD_UNSPECIFIED = 0; - - // This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping - // scheme defined in the PKCS #11 standard. In summary, this involves - // wrapping the raw key with an ephemeral AES key, and wrapping the - // ephemeral AES key with a 3072 bit RSA key. For more details, see - // [RSA AES key wrap - // mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908). - RSA_OAEP_3072_SHA1_AES_256 = 1; - - // This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping - // scheme defined in the PKCS #11 standard. In summary, this involves - // wrapping the raw key with an ephemeral AES key, and wrapping the - // ephemeral AES key with a 4096 bit RSA key. For more details, see - // [RSA AES key wrap - // mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908). - RSA_OAEP_4096_SHA1_AES_256 = 2; - - // This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping - // scheme defined in the PKCS #11 standard. In summary, this involves - // wrapping the raw key with an ephemeral AES key, and wrapping the - // ephemeral AES key with a 3072 bit RSA key. For more details, see - // [RSA AES key wrap - // mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908). - RSA_OAEP_3072_SHA256_AES_256 = 3; - - // This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping - // scheme defined in the PKCS #11 standard. In summary, this involves - // wrapping the raw key with an ephemeral AES key, and wrapping the - // ephemeral AES key with a 4096 bit RSA key. For more details, see - // [RSA AES key wrap - // mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908). - RSA_OAEP_4096_SHA256_AES_256 = 4; - - // This ImportMethod represents RSAES-OAEP with a 3072 bit RSA key. The - // key material to be imported is wrapped directly with the RSA key. Due - // to technical limitations of RSA wrapping, this method cannot be used to - // wrap RSA keys for import. - RSA_OAEP_3072_SHA256 = 5; - - // This ImportMethod represents RSAES-OAEP with a 4096 bit RSA key. The - // key material to be imported is wrapped directly with the RSA key. Due - // to technical limitations of RSA wrapping, this method cannot be used to - // wrap RSA keys for import. - RSA_OAEP_4096_SHA256 = 6; - } - - // The state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if - // it can be used. - enum ImportJobState { - // Not specified. - IMPORT_JOB_STATE_UNSPECIFIED = 0; - - // The wrapping key for this job is still being generated. It may not be - // used. Cloud KMS will automatically mark this job as - // [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] as soon as - // the wrapping key is generated. - PENDING_GENERATION = 1; - - // This job may be used in - // [CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey] - // and - // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] - // requests. - ACTIVE = 2; - - // This job can no longer be used and may not leave this state once entered. - EXPIRED = 3; - } - - // The public key component of the wrapping key. For details of the type of - // key this public key corresponds to, see the - // [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod]. - message WrappingPublicKey { - // The public key, encoded in PEM format. For more information, see the [RFC - // 7468](https://tools.ietf.org/html/rfc7468) sections for [General - // Considerations](https://tools.ietf.org/html/rfc7468#section-2) and - // [Textual Encoding of Subject Public Key Info] - // (https://tools.ietf.org/html/rfc7468#section-13). - string pem = 1; - } - - // Output only. The resource name for this - // [ImportJob][google.cloud.kms.v1.ImportJob] in the format - // `projects/*/locations/*/keyRings/*/importJobs/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Immutable. The wrapping method to be used for incoming key - // material. - ImportMethod import_method = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Required. Immutable. The protection level of the - // [ImportJob][google.cloud.kms.v1.ImportJob]. This must match the - // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level] - // of the [version_template][google.cloud.kms.v1.CryptoKey.version_template] - // on the [CryptoKey][google.cloud.kms.v1.CryptoKey] you attempt to import - // into. - ProtectionLevel protection_level = 9 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Output only. The time at which this - // [ImportJob][google.cloud.kms.v1.ImportJob] was created. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]'s key - // material was generated. - google.protobuf.Timestamp generate_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this - // [ImportJob][google.cloud.kms.v1.ImportJob] is scheduled for expiration and - // can no longer be used to import key material. - google.protobuf.Timestamp expire_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob] - // expired. Only present if [state][google.cloud.kms.v1.ImportJob.state] is - // [EXPIRED][google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED]. - google.protobuf.Timestamp expire_event_time = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the - // [ImportJob][google.cloud.kms.v1.ImportJob], indicating if it can be used. - ImportJobState state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The public key with which to wrap key material prior to - // import. Only returned if [state][google.cloud.kms.v1.ImportJob.state] is - // [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]. - WrappingPublicKey public_key = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statement that was generated and signed by the key creator - // (for example, an HSM) at key creation time. Use this statement to verify - // attributes of the key as stored on the HSM, independently of Google. - // Only present if the chosen - // [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] is one with a - // protection level of [HSM][google.cloud.kms.v1.ProtectionLevel.HSM]. - KeyOperationAttestation attestation = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// ExternalProtectionLevelOptions stores a group of additional fields for -// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that -// are specific to the [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] -// protection level and -// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] protection -// levels. -message ExternalProtectionLevelOptions { - // The URI for an external resource that this - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents. - string external_key_uri = 1; - - // The path to the external key material on the EKM when using - // [EkmConnection][google.cloud.kms.v1.EkmConnection] e.g., "v0/my/key". Set - // this field instead of external_key_uri when using an - // [EkmConnection][google.cloud.kms.v1.EkmConnection]. - string ekm_connection_key_path = 2; -} - -// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] specifies how -// cryptographic operations are performed. For more information, see [Protection -// levels] (https://cloud.google.com/kms/docs/algorithms#protection_levels). -enum ProtectionLevel { - // Not specified. - PROTECTION_LEVEL_UNSPECIFIED = 0; - - // Crypto operations are performed in software. - SOFTWARE = 1; - - // Crypto operations are performed in a Hardware Security Module. - HSM = 2; - - // Crypto operations are performed by an external key manager. - EXTERNAL = 3; - - // Crypto operations are performed in an EKM-over-VPC backend. - EXTERNAL_VPC = 4; -} diff --git a/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/service.proto b/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/service.proto deleted file mode 100644 index c9a0557141c..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/protos/google/cloud/kms/v1/service.proto +++ /dev/null @@ -1,2073 +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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.kms.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/kms/v1/resources.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/wrappers.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Kms.V1"; -option go_package = "cloud.google.com/go/kms/apiv1/kmspb;kmspb"; -option java_multiple_files = true; -option java_outer_classname = "KmsProto"; -option java_package = "com.google.cloud.kms.v1"; -option php_namespace = "Google\\Cloud\\Kms\\V1"; - -// Google Cloud Key Management Service -// -// Manages cryptographic keys and operations using those keys. Implements a REST -// model with the following objects: -// -// * [KeyRing][google.cloud.kms.v1.KeyRing] -// * [CryptoKey][google.cloud.kms.v1.CryptoKey] -// * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] -// * [ImportJob][google.cloud.kms.v1.ImportJob] -// -// If you are using manual gRPC libraries, see -// [Using gRPC with Cloud KMS](https://cloud.google.com/kms/docs/grpc). -service KeyManagementService { - option (google.api.default_host) = "cloudkms.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloudkms"; - - // Lists [KeyRings][google.cloud.kms.v1.KeyRing]. - rpc ListKeyRings(ListKeyRingsRequest) returns (ListKeyRingsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/keyRings" - }; - option (google.api.method_signature) = "parent"; - } - - // Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey]. - rpc ListCryptoKeys(ListCryptoKeysRequest) returns (ListCryptoKeysResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/keyRings/*}/cryptoKeys" - }; - option (google.api.method_signature) = "parent"; - } - - // Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. - rpc ListCryptoKeyVersions(ListCryptoKeyVersionsRequest) - returns (ListCryptoKeyVersionsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions" - }; - option (google.api.method_signature) = "parent"; - } - - // Lists [ImportJobs][google.cloud.kms.v1.ImportJob]. - rpc ListImportJobs(ListImportJobsRequest) returns (ListImportJobsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/keyRings/*}/importJobs" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing]. - rpc GetKeyRing(GetKeyRingRequest) returns (KeyRing) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/keyRings/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as - // well as its [primary][google.cloud.kms.v1.CryptoKey.primary] - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. - rpc GetCryptoKey(GetCryptoKeyRequest) returns (CryptoKey) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns metadata for a given - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. - rpc GetCryptoKeyVersion(GetCryptoKeyVersionRequest) - returns (CryptoKeyVersion) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns the public key for the given - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be - // [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] - // or - // [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]. - rpc GetPublicKey(GetPublicKeyRequest) returns (PublicKey) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}/publicKey" - }; - option (google.api.method_signature) = "name"; - } - - // Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob]. - rpc GetImportJob(GetImportJobRequest) returns (ImportJob) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/keyRings/*/importJobs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and - // Location. - rpc CreateKeyRing(CreateKeyRingRequest) returns (KeyRing) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/keyRings" - body: "key_ring" - }; - option (google.api.method_signature) = "parent,key_ring_id,key_ring"; - } - - // Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a - // [KeyRing][google.cloud.kms.v1.KeyRing]. - // - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and - // [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] - // are required. - rpc CreateCryptoKey(CreateCryptoKeyRequest) returns (CryptoKey) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/keyRings/*}/cryptoKeys" - body: "crypto_key" - }; - option (google.api.method_signature) = "parent,crypto_key_id,crypto_key"; - } - - // Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a - // [CryptoKey][google.cloud.kms.v1.CryptoKey]. - // - // The server will assign the next sequential id. If unset, - // [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to - // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]. - rpc CreateCryptoKeyVersion(CreateCryptoKeyVersionRequest) - returns (CryptoKeyVersion) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions" - body: "crypto_key_version" - }; - option (google.api.method_signature) = "parent,crypto_key_version"; - } - - // Import wrapped key material into a - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. - // - // All requests must specify a [CryptoKey][google.cloud.kms.v1.CryptoKey]. If - // a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] is additionally - // specified in the request, key material will be reimported into that - // version. Otherwise, a new version will be created, and will be assigned the - // next sequential id within the [CryptoKey][google.cloud.kms.v1.CryptoKey]. - rpc ImportCryptoKeyVersion(ImportCryptoKeyVersionRequest) - returns (CryptoKeyVersion) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions:import" - body: "*" - }; - } - - // Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a - // [KeyRing][google.cloud.kms.v1.KeyRing]. - // - // [ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is - // required. - rpc CreateImportJob(CreateImportJobRequest) returns (ImportJob) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/keyRings/*}/importJobs" - body: "import_job" - }; - option (google.api.method_signature) = "parent,import_job_id,import_job"; - } - - // Update a [CryptoKey][google.cloud.kms.v1.CryptoKey]. - rpc UpdateCryptoKey(UpdateCryptoKeyRequest) returns (CryptoKey) { - option (google.api.http) = { - patch: "/v1/{crypto_key.name=projects/*/locations/*/keyRings/*/cryptoKeys/*}" - body: "crypto_key" - }; - option (google.api.method_signature) = "crypto_key,update_mask"; - } - - // Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s - // metadata. - // - // [state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between - // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] - // and - // [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] - // using this method. See - // [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] - // and - // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] - // to move between other states. - rpc UpdateCryptoKeyVersion(UpdateCryptoKeyVersionRequest) - returns (CryptoKeyVersion) { - option (google.api.http) = { - patch: "/v1/{crypto_key_version.name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}" - body: "crypto_key_version" - }; - option (google.api.method_signature) = "crypto_key_version,update_mask"; - } - - // Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that - // will be used in - // [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. - // - // Returns an error if called on a key whose purpose is not - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. - rpc UpdateCryptoKeyPrimaryVersion(UpdateCryptoKeyPrimaryVersionRequest) - returns (CryptoKey) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}:updatePrimaryVersion" - body: "*" - }; - option (google.api.method_signature) = "name,crypto_key_version_id"; - } - - // Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for - // destruction. - // - // Upon calling this method, - // [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will - // be set to - // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], - // and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will - // be set to the time - // [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] - // in the future. At that time, the - // [state][google.cloud.kms.v1.CryptoKeyVersion.state] will automatically - // change to - // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], - // and the key material will be irrevocably destroyed. - // - // Before the - // [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is - // reached, - // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] - // may be called to reverse the process. - rpc DestroyCryptoKeyVersion(DestroyCryptoKeyVersionRequest) - returns (CryptoKeyVersion) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:destroy" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the - // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] - // state. - // - // Upon restoration of the CryptoKeyVersion, - // [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to - // [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], - // and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will - // be cleared. - rpc RestoreCryptoKeyVersion(RestoreCryptoKeyVersionRequest) - returns (CryptoKeyVersion) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:restore" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Encrypts data, so that it can only be recovered by a call to - // [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. - rpc Encrypt(EncryptRequest) returns (EncryptResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/**}:encrypt" - body: "*" - }; - option (google.api.method_signature) = "name,plaintext"; - } - - // Decrypts data that was protected by - // [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. - rpc Decrypt(DecryptRequest) returns (DecryptResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}:decrypt" - body: "*" - }; - option (google.api.method_signature) = "name,ciphertext"; - } - - // Encrypts data using portable cryptographic primitives. Most users should - // choose [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and - // [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt] rather than - // their raw counterparts. The - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be - // [RAW_ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT]. - rpc RawEncrypt(RawEncryptRequest) returns (RawEncryptResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:rawEncrypt" - body: "*" - }; - } - - // Decrypts data that was originally encrypted using a raw cryptographic - // mechanism. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // must be - // [RAW_ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT]. - rpc RawDecrypt(RawDecryptRequest) returns (RawDecryptResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:rawDecrypt" - body: "*" - }; - } - - // Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] - // with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // ASYMMETRIC_SIGN, producing a signature that can be verified with the public - // key retrieved from - // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. - rpc AsymmetricSign(AsymmetricSignRequest) returns (AsymmetricSignResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:asymmetricSign" - body: "*" - }; - option (google.api.method_signature) = "name,digest"; - } - - // Decrypts data that was encrypted with a public key retrieved from - // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] - // corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] - // with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // ASYMMETRIC_DECRYPT. - rpc AsymmetricDecrypt(AsymmetricDecryptRequest) - returns (AsymmetricDecryptResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:asymmetricDecrypt" - body: "*" - }; - option (google.api.method_signature) = "name,ciphertext"; - } - - // Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] - // with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, - // producing a tag that can be verified by another source with the same key. - rpc MacSign(MacSignRequest) returns (MacSignResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:macSign" - body: "*" - }; - option (google.api.method_signature) = "name,data"; - } - - // Verifies MAC tag using a - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, and returns - // a response that indicates whether or not the verification was successful. - rpc MacVerify(MacVerifyRequest) returns (MacVerifyResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:macVerify" - body: "*" - }; - option (google.api.method_signature) = "name,data,mac"; - } - - // Generate random bytes using the Cloud KMS randomness source in the provided - // location. - rpc GenerateRandomBytes(GenerateRandomBytesRequest) - returns (GenerateRandomBytesResponse) { - option (google.api.http) = { - post: "/v1/{location=projects/*/locations/*}:generateRandomBytes" - body: "*" - }; - option (google.api.method_signature) = - "location,length_bytes,protection_level"; - } -} - -// Request message for -// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings]. -message ListKeyRingsRequest { - // Required. The resource name of the location associated with the - // [KeyRings][google.cloud.kms.v1.KeyRing], in the format - // `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. Optional limit on the number of - // [KeyRings][google.cloud.kms.v1.KeyRing] to include in the response. Further - // [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by - // including the - // [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token] - // in a subsequent request. If unspecified, the server will pick an - // appropriate default. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Optional pagination token, returned earlier via - // [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only include resources that match the filter in the response. For - // more information, see - // [Sorting and filtering list - // results](https://cloud.google.com/kms/docs/sorting-and-filtering). - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify how the results should be sorted. If not specified, the - // results will be sorted in the default order. For more information, see - // [Sorting and filtering list - // results](https://cloud.google.com/kms/docs/sorting-and-filtering). - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. -message ListCryptoKeysRequest { - // Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] - // to list, in the format `projects/*/locations/*/keyRings/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/KeyRing" - } - ]; - - // Optional. Optional limit on the number of - // [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the response. - // Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be - // obtained by including the - // [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token] - // in a subsequent request. If unspecified, the server will pick an - // appropriate default. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Optional pagination token, returned earlier via - // [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // The fields of the primary version to include in the response. - CryptoKeyVersion.CryptoKeyVersionView version_view = 4; - - // Optional. Only include resources that match the filter in the response. For - // more information, see - // [Sorting and filtering list - // results](https://cloud.google.com/kms/docs/sorting-and-filtering). - string filter = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify how the results should be sorted. If not specified, the - // results will be sorted in the default order. For more information, see - // [Sorting and filtering list - // results](https://cloud.google.com/kms/docs/sorting-and-filtering). - string order_by = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]. -message ListCryptoKeyVersionsRequest { - // Required. The resource name of the - // [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format - // `projects/*/locations/*/keyRings/*/cryptoKeys/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - } - ]; - - // Optional. Optional limit on the number of - // [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to include in the - // response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] - // can subsequently be obtained by including the - // [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token] - // in a subsequent request. If unspecified, the server will pick an - // appropriate default. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Optional pagination token, returned earlier via - // [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // The fields to include in the response. - CryptoKeyVersion.CryptoKeyVersionView view = 4; - - // Optional. Only include resources that match the filter in the response. For - // more information, see - // [Sorting and filtering list - // results](https://cloud.google.com/kms/docs/sorting-and-filtering). - string filter = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify how the results should be sorted. If not specified, the - // results will be sorted in the default order. For more information, see - // [Sorting and filtering list - // results](https://cloud.google.com/kms/docs/sorting-and-filtering). - string order_by = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs]. -message ListImportJobsRequest { - // Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] - // to list, in the format `projects/*/locations/*/keyRings/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/KeyRing" - } - ]; - - // Optional. Optional limit on the number of - // [ImportJobs][google.cloud.kms.v1.ImportJob] to include in the response. - // Further [ImportJobs][google.cloud.kms.v1.ImportJob] can subsequently be - // obtained by including the - // [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token] - // in a subsequent request. If unspecified, the server will pick an - // appropriate default. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Optional pagination token, returned earlier via - // [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token]. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only include resources that match the filter in the response. For - // more information, see - // [Sorting and filtering list - // results](https://cloud.google.com/kms/docs/sorting-and-filtering). - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify how the results should be sorted. If not specified, the - // results will be sorted in the default order. For more information, see - // [Sorting and filtering list - // results](https://cloud.google.com/kms/docs/sorting-and-filtering). - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings]. -message ListKeyRingsResponse { - // The list of [KeyRings][google.cloud.kms.v1.KeyRing]. - repeated KeyRing key_rings = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] - // to retrieve the next page of results. - string next_page_token = 2; - - // The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched - // the query. - int32 total_size = 3; -} - -// Response message for -// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. -message ListCryptoKeysResponse { - // The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. - repeated CryptoKey crypto_keys = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token] - // to retrieve the next page of results. - string next_page_token = 2; - - // The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that - // matched the query. - int32 total_size = 3; -} - -// Response message for -// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]. -message ListCryptoKeyVersionsResponse { - // The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. - repeated CryptoKeyVersion crypto_key_versions = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token] - // to retrieve the next page of results. - string next_page_token = 2; - - // The total number of - // [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the - // query. - int32 total_size = 3; -} - -// Response message for -// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs]. -message ListImportJobsResponse { - // The list of [ImportJobs][google.cloud.kms.v1.ImportJob]. - repeated ImportJob import_jobs = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListImportJobsRequest.page_token][google.cloud.kms.v1.ListImportJobsRequest.page_token] - // to retrieve the next page of results. - string next_page_token = 2; - - // The total number of [ImportJobs][google.cloud.kms.v1.ImportJob] that - // matched the query. - int32 total_size = 3; -} - -// Request message for -// [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing]. -message GetKeyRingRequest { - // Required. The [name][google.cloud.kms.v1.KeyRing.name] of the - // [KeyRing][google.cloud.kms.v1.KeyRing] to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/KeyRing" - } - ]; -} - -// Request message for -// [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey]. -message GetCryptoKeyRequest { - // Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the - // [CryptoKey][google.cloud.kms.v1.CryptoKey] to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - } - ]; -} - -// Request message for -// [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion]. -message GetCryptoKeyVersionRequest { - // Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKeyVersion" - } - ]; -} - -// Request message for -// [KeyManagementService.GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. -message GetPublicKeyRequest { - // Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKeyVersion" - } - ]; -} - -// Request message for -// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob]. -message GetImportJobRequest { - // Required. The [name][google.cloud.kms.v1.ImportJob.name] of the - // [ImportJob][google.cloud.kms.v1.ImportJob] to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/ImportJob" - } - ]; -} - -// Request message for -// [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing]. -message CreateKeyRingRequest { - // Required. The resource name of the location associated with the - // [KeyRings][google.cloud.kms.v1.KeyRing], in the format - // `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. It must be unique within a location and match the regular - // expression `[a-zA-Z0-9_-]{1,63}` - string key_ring_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field - // values. - KeyRing key_ring = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]. -message CreateCryptoKeyRequest { - // Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing - // associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey]. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/KeyRing" - } - ]; - - // Required. It must be unique within a KeyRing and match the regular - // expression `[a-zA-Z0-9_-]{1,63}` - string crypto_key_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field - // values. - CryptoKey crypto_key = 3 [(google.api.field_behavior) = REQUIRED]; - - // If set to true, the request will create a - // [CryptoKey][google.cloud.kms.v1.CryptoKey] without any - // [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. You must - // manually call - // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] - // or - // [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion] - // before you can use this [CryptoKey][google.cloud.kms.v1.CryptoKey]. - bool skip_initial_version_creation = 5; -} - -// Request message for -// [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]. -message CreateCryptoKeyVersionRequest { - // Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the - // [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the - // [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - } - ]; - - // Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with - // initial field values. - CryptoKeyVersion crypto_key_version = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]. -message ImportCryptoKeyVersionRequest { - // Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the - // [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into. - // - // The create permission is only required on this key when creating a new - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - } - ]; - - // Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of - // an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to - // target for an import operation. If this field is not present, a new - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the - // supplied key material is created. - // - // If this field is present, the supplied key material is imported into - // the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To - // import into an existing - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of - // [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent], - // have been previously created via [ImportCryptoKeyVersion][], and be in - // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED] - // or - // [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED] - // state. The key material and algorithm must match the previous - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained - // key material. - string crypto_key_version = 6 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKeyVersion" - } - ]; - - // Required. The - // [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] - // of the key being imported. This does not need to match the - // [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the - // [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into. - CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The [name][google.cloud.kms.v1.ImportJob.name] of the - // [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key - // material. - string import_job = 4 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The wrapped key material to import. - // - // Before wrapping, key material must be formatted. If importing symmetric key - // material, the expected key material format is plain bytes. If importing - // asymmetric key material, the expected key material format is PKCS#8-encoded - // DER (the PrivateKeyInfo structure from RFC 5208). - // - // When wrapping with import methods - // ([RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256] - // or - // [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256] - // or - // [RSA_OAEP_3072_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256] - // or - // [RSA_OAEP_4096_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]), - // - // this field must contain the concatenation of: - //
    - //
  1. An ephemeral AES-256 wrapping key wrapped with the - // [public_key][google.cloud.kms.v1.ImportJob.public_key] using - // RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an empty - // label. - //
  2. - //
  3. The formatted key to be imported, wrapped with the ephemeral AES-256 - // key using AES-KWP (RFC 5649). - //
  4. - //
- // - // This format is the same as the format produced by PKCS#11 mechanism - // CKM_RSA_AES_KEY_WRAP. - // - // When wrapping with import methods - // ([RSA_OAEP_3072_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256] - // or - // [RSA_OAEP_4096_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]), - // - // this field must contain the formatted key to be imported, wrapped with the - // [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP - // with SHA-256, MGF1 with SHA-256, and an empty label. - bytes wrapped_key = 8 [(google.api.field_behavior) = OPTIONAL]; - - // This field is legacy. Use the field - // [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key] - // instead. - oneof wrapped_key_material { - // Optional. This field has the same meaning as - // [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]. - // Prefer to use that field in new work. Either that field or this field - // (but not both) must be specified. - bytes rsa_aes_wrapped_key = 5 [(google.api.field_behavior) = OPTIONAL]; - } -} - -// Request message for -// [KeyManagementService.CreateImportJob][google.cloud.kms.v1.KeyManagementService.CreateImportJob]. -message CreateImportJobRequest { - // Required. The [name][google.cloud.kms.v1.KeyRing.name] of the - // [KeyRing][google.cloud.kms.v1.KeyRing] associated with the - // [ImportJobs][google.cloud.kms.v1.ImportJob]. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/KeyRing" - } - ]; - - // Required. It must be unique within a KeyRing and match the regular - // expression `[a-zA-Z0-9_-]{1,63}` - string import_job_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field - // values. - ImportJob import_job = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey]. -message UpdateCryptoKeyRequest { - // Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values. - CryptoKey crypto_key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. List of fields to be updated in this request. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion]. -message UpdateCryptoKeyVersionRequest { - // Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with - // updated values. - CryptoKeyVersion crypto_key_version = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. List of fields to be updated in this request. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]. -message UpdateCryptoKeyPrimaryVersionRequest { - // Required. The resource name of the - // [CryptoKey][google.cloud.kms.v1.CryptoKey] to update. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - } - ]; - - // Required. The id of the child - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary. - string crypto_key_version_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]. -message DestroyCryptoKeyVersionRequest { - // Required. The resource name of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKeyVersion" - } - ]; -} - -// Request message for -// [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]. -message RestoreCryptoKeyVersionRequest { - // Required. The resource name of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKeyVersion" - } - ]; -} - -// Request message for -// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. -message EncryptRequest { - // Required. The resource name of the - // [CryptoKey][google.cloud.kms.v1.CryptoKey] or - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for - // encryption. - // - // If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server - // will use its [primary version][google.cloud.kms.v1.CryptoKey.primary]. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "*" } - ]; - - // Required. The data to encrypt. Must be no larger than 64KiB. - // - // The maximum size depends on the key version's - // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. - // For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE], - // [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and - // [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the - // plaintext must be no larger than 64KiB. For - // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of - // the plaintext and additional_authenticated_data fields must be no larger - // than 8KiB. - bytes plaintext = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Optional data that, if specified, must also be provided during - // decryption through - // [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]. - // - // The maximum size depends on the key version's - // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. - // For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE], - // [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and - // [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys the - // AAD must be no larger than 64KiB. For - // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of - // the plaintext and additional_authenticated_data fields must be no larger - // than 8KiB. - bytes additional_authenticated_data = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An optional CRC32C checksum of the - // [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. - // If specified, - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // verify the integrity of the received - // [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext] - // using this checksum. - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // report an error if the checksum verification fails. If you receive a - // checksum error, your client should verify that - // CRC32C([EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]) - // is equal to - // [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c], - // and if so, perform a limited number of retries. A persistent mismatch may - // indicate an issue in your computation of the CRC32C checksum. Note: This - // field is defined as int64 for reasons of compatibility across different - // languages. However, it is a non-negative integer, which will never exceed - // 2^32-1, and can be safely downconverted to uint32 in languages that support - // this type. - google.protobuf.Int64Value plaintext_crc32c = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An optional CRC32C checksum of the - // [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. - // If specified, - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // verify the integrity of the received - // [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data] - // using this checksum. - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // report an error if the checksum verification fails. If you receive a - // checksum error, your client should verify that - // CRC32C([EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]) - // is equal to - // [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c], - // and if so, perform a limited number of retries. A persistent mismatch may - // indicate an issue in your computation of the CRC32C checksum. Note: This - // field is defined as int64 for reasons of compatibility across different - // languages. However, it is a non-negative integer, which will never exceed - // 2^32-1, and can be safely downconverted to uint32 in languages that support - // this type. - google.protobuf.Int64Value additional_authenticated_data_crc32c = 8 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. -message DecryptRequest { - // Required. The resource name of the - // [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The - // server will choose the appropriate version. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - } - ]; - - // Required. The encrypted data originally returned in - // [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]. - bytes ciphertext = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Optional data that must match the data originally supplied in - // [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. - bytes additional_authenticated_data = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An optional CRC32C checksum of the - // [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]. - // If specified, - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // verify the integrity of the received - // [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext] - // using this checksum. - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // report an error if the checksum verification fails. If you receive a - // checksum error, your client should verify that - // CRC32C([DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]) - // is equal to - // [DecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c], - // and if so, perform a limited number of retries. A persistent mismatch may - // indicate an issue in your computation of the CRC32C checksum. Note: This - // field is defined as int64 for reasons of compatibility across different - // languages. However, it is a non-negative integer, which will never exceed - // 2^32-1, and can be safely downconverted to uint32 in languages that support - // this type. - google.protobuf.Int64Value ciphertext_crc32c = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An optional CRC32C checksum of the - // [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]. - // If specified, - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // verify the integrity of the received - // [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data] - // using this checksum. - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // report an error if the checksum verification fails. If you receive a - // checksum error, your client should verify that - // CRC32C([DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]) - // is equal to - // [DecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c], - // and if so, perform a limited number of retries. A persistent mismatch may - // indicate an issue in your computation of the CRC32C checksum. Note: This - // field is defined as int64 for reasons of compatibility across different - // languages. However, it is a non-negative integer, which will never exceed - // 2^32-1, and can be safely downconverted to uint32 in languages that support - // this type. - google.protobuf.Int64Value additional_authenticated_data_crc32c = 6 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt]. -message RawEncryptRequest { - // Required. The resource name of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for - // encryption. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The data to encrypt. Must be no larger than 64KiB. - // - // The maximum size depends on the key version's - // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. - // For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the - // plaintext must be no larger than 64KiB. For - // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of - // the plaintext and additional_authenticated_data fields must be no larger - // than 8KiB. - bytes plaintext = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Optional data that, if specified, must also be provided during - // decryption through - // [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]. - // - // This field may only be used in conjunction with an - // [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm] that accepts - // additional authenticated data (for example, AES-GCM). - // - // The maximum size depends on the key version's - // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. - // For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the - // plaintext must be no larger than 64KiB. For - // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of - // the plaintext and additional_authenticated_data fields must be no larger - // than 8KiB. - bytes additional_authenticated_data = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An optional CRC32C checksum of the - // [RawEncryptRequest.plaintext][google.cloud.kms.v1.RawEncryptRequest.plaintext]. - // If specified, - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // verify the integrity of the received plaintext using this checksum. - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // report an error if the checksum verification fails. If you receive a - // checksum error, your client should verify that CRC32C(plaintext) is equal - // to plaintext_crc32c, and if so, perform a limited number of retries. A - // persistent mismatch may indicate an issue in your computation of the CRC32C - // checksum. Note: This field is defined as int64 for reasons of compatibility - // across different languages. However, it is a non-negative integer, which - // will never exceed 2^32-1, and can be safely downconverted to uint32 in - // languages that support this type. - google.protobuf.Int64Value plaintext_crc32c = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An optional CRC32C checksum of the - // [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]. - // If specified, - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // verify the integrity of the received additional_authenticated_data using - // this checksum. - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // report an error if the checksum verification fails. If you receive a - // checksum error, your client should verify that - // CRC32C(additional_authenticated_data) is equal to - // additional_authenticated_data_crc32c, and if so, perform - // a limited number of retries. A persistent mismatch may indicate an issue in - // your computation of the CRC32C checksum. - // Note: This field is defined as int64 for reasons of compatibility across - // different languages. However, it is a non-negative integer, which will - // never exceed 2^32-1, and can be safely downconverted to uint32 in languages - // that support this type. - google.protobuf.Int64Value additional_authenticated_data_crc32c = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A customer-supplied initialization vector that will be used for - // encryption. If it is not provided for AES-CBC and AES-CTR, one will be - // generated. It will be returned in - // [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector]. - bytes initialization_vector = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An optional CRC32C checksum of the - // [RawEncryptRequest.initialization_vector][google.cloud.kms.v1.RawEncryptRequest.initialization_vector]. - // If specified, - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // verify the integrity of the received initialization_vector using this - // checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService] - // will report an error if the checksum verification fails. If you receive a - // checksum error, your client should verify that - // CRC32C(initialization_vector) is equal to - // initialization_vector_crc32c, and if so, perform - // a limited number of retries. A persistent mismatch may indicate an issue in - // your computation of the CRC32C checksum. - // Note: This field is defined as int64 for reasons of compatibility across - // different languages. However, it is a non-negative integer, which will - // never exceed 2^32-1, and can be safely downconverted to uint32 in languages - // that support this type. - google.protobuf.Int64Value initialization_vector_crc32c = 7 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt]. -message RawDecryptRequest { - // Required. The resource name of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for - // decryption. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The encrypted data originally returned in - // [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext]. - bytes ciphertext = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Optional data that must match the data originally supplied in - // [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]. - bytes additional_authenticated_data = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Required. The initialization vector (IV) used during encryption, which must - // match the data originally provided in - // [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector]. - bytes initialization_vector = 4 [(google.api.field_behavior) = REQUIRED]; - - // The length of the authentication tag that is appended to the end of - // the ciphertext. If unspecified (0), the default value for the key's - // algorithm will be used (for AES-GCM, the default value is 16). - int32 tag_length = 5; - - // Optional. An optional CRC32C checksum of the - // [RawDecryptRequest.ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext]. - // If specified, - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // verify the integrity of the received ciphertext using this checksum. - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // report an error if the checksum verification fails. If you receive a - // checksum error, your client should verify that CRC32C(ciphertext) is equal - // to ciphertext_crc32c, and if so, perform a limited number of retries. A - // persistent mismatch may indicate an issue in your computation of the CRC32C - // checksum. Note: This field is defined as int64 for reasons of compatibility - // across different languages. However, it is a non-negative integer, which - // will never exceed 2^32-1, and can be safely downconverted to uint32 in - // languages that support this type. - google.protobuf.Int64Value ciphertext_crc32c = 6 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An optional CRC32C checksum of the - // [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]. - // If specified, - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // verify the integrity of the received additional_authenticated_data using - // this checksum. - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // report an error if the checksum verification fails. If you receive a - // checksum error, your client should verify that - // CRC32C(additional_authenticated_data) is equal to - // additional_authenticated_data_crc32c, and if so, perform - // a limited number of retries. A persistent mismatch may indicate an issue in - // your computation of the CRC32C checksum. - // Note: This field is defined as int64 for reasons of compatibility across - // different languages. However, it is a non-negative integer, which will - // never exceed 2^32-1, and can be safely downconverted to uint32 in languages - // that support this type. - google.protobuf.Int64Value additional_authenticated_data_crc32c = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An optional CRC32C checksum of the - // [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector]. - // If specified, - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // verify the integrity of the received initialization_vector using this - // checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService] - // will report an error if the checksum verification fails. If you receive a - // checksum error, your client should verify that - // CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and - // if so, perform a limited number of retries. A persistent mismatch may - // indicate an issue in your computation of the CRC32C checksum. - // Note: This field is defined as int64 for reasons of compatibility across - // different languages. However, it is a non-negative integer, which will - // never exceed 2^32-1, and can be safely downconverted to uint32 in languages - // that support this type. - google.protobuf.Int64Value initialization_vector_crc32c = 8 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]. -message AsymmetricSignRequest { - // Required. The resource name of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for - // signing. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKeyVersion" - } - ]; - - // Optional. The digest of the data to sign. The digest must be produced with - // the same digest algorithm as specified by the key version's - // [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm]. - // - // This field may not be supplied if - // [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data] - // is supplied. - Digest digest = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An optional CRC32C checksum of the - // [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]. - // If specified, - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // verify the integrity of the received - // [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest] - // using this checksum. - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // report an error if the checksum verification fails. If you receive a - // checksum error, your client should verify that - // CRC32C([AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]) - // is equal to - // [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c], - // and if so, perform a limited number of retries. A persistent mismatch may - // indicate an issue in your computation of the CRC32C checksum. Note: This - // field is defined as int64 for reasons of compatibility across different - // languages. However, it is a non-negative integer, which will never exceed - // 2^32-1, and can be safely downconverted to uint32 in languages that support - // this type. - google.protobuf.Int64Value digest_crc32c = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The data to sign. - // It can't be supplied if - // [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest] - // is supplied. - bytes data = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An optional CRC32C checksum of the - // [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]. - // If specified, - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // verify the integrity of the received - // [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data] - // using this checksum. - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // report an error if the checksum verification fails. If you receive a - // checksum error, your client should verify that - // CRC32C([AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]) - // is equal to - // [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c], - // and if so, perform a limited number of retries. A persistent mismatch may - // indicate an issue in your computation of the CRC32C checksum. Note: This - // field is defined as int64 for reasons of compatibility across different - // languages. However, it is a non-negative integer, which will never exceed - // 2^32-1, and can be safely downconverted to uint32 in languages that support - // this type. - google.protobuf.Int64Value data_crc32c = 7 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]. -message AsymmetricDecryptRequest { - // Required. The resource name of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for - // decryption. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKeyVersion" - } - ]; - - // Required. The data encrypted with the named - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using - // OAEP. - bytes ciphertext = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional CRC32C checksum of the - // [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]. - // If specified, - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // verify the integrity of the received - // [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext] - // using this checksum. - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // report an error if the checksum verification fails. If you receive a - // checksum error, your client should verify that - // CRC32C([AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]) - // is equal to - // [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c], - // and if so, perform a limited number of retries. A persistent mismatch may - // indicate an issue in your computation of the CRC32C checksum. Note: This - // field is defined as int64 for reasons of compatibility across different - // languages. However, it is a non-negative integer, which will never exceed - // 2^32-1, and can be safely downconverted to uint32 in languages that support - // this type. - google.protobuf.Int64Value ciphertext_crc32c = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign]. -message MacSignRequest { - // Required. The resource name of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for - // signing. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKeyVersion" - } - ]; - - // Required. The data to sign. The MAC tag is computed over this data field - // based on the specific algorithm. - bytes data = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional CRC32C checksum of the - // [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]. If - // specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService] - // will verify the integrity of the received - // [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] using this - // checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService] - // will report an error if the checksum verification fails. If you receive a - // checksum error, your client should verify that - // CRC32C([MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]) is - // equal to - // [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c], - // and if so, perform a limited number of retries. A persistent mismatch may - // indicate an issue in your computation of the CRC32C checksum. Note: This - // field is defined as int64 for reasons of compatibility across different - // languages. However, it is a non-negative integer, which will never exceed - // 2^32-1, and can be safely downconverted to uint32 in languages that support - // this type. - google.protobuf.Int64Value data_crc32c = 3 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify]. -message MacVerifyRequest { - // Required. The resource name of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for - // verification. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKeyVersion" - } - ]; - - // Required. The data used previously as a - // [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate - // the MAC tag. - bytes data = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional CRC32C checksum of the - // [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data]. If - // specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService] - // will verify the integrity of the received - // [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] using - // this checksum. - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will - // report an error if the checksum verification fails. If you receive a - // checksum error, your client should verify that - // CRC32C([MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data]) - // is equal to - // [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c], - // and if so, perform a limited number of retries. A persistent mismatch may - // indicate an issue in your computation of the CRC32C checksum. Note: This - // field is defined as int64 for reasons of compatibility across different - // languages. However, it is a non-negative integer, which will never exceed - // 2^32-1, and can be safely downconverted to uint32 in languages that support - // this type. - google.protobuf.Int64Value data_crc32c = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Required. The signature to verify. - bytes mac = 4 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional CRC32C checksum of the - // [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]. If - // specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService] - // will verify the integrity of the received - // [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] using this - // checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService] - // will report an error if the checksum verification fails. If you receive a - // checksum error, your client should verify that - // CRC32C([MacVerifyRequest.tag][]) is equal to - // [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c], - // and if so, perform a limited number of retries. A persistent mismatch may - // indicate an issue in your computation of the CRC32C checksum. Note: This - // field is defined as int64 for reasons of compatibility across different - // languages. However, it is a non-negative integer, which will never exceed - // 2^32-1, and can be safely downconverted to uint32 in languages that support - // this type. - google.protobuf.Int64Value mac_crc32c = 5 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]. -message GenerateRandomBytesRequest { - // The project-specific location in which to generate random bytes. - // For example, "projects/my-project/locations/us-central1". - string location = 1; - - // The length in bytes of the amount of randomness to retrieve. Minimum 8 - // bytes, maximum 1024 bytes. - int32 length_bytes = 2; - - // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when - // generating the random data. Currently, only - // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is - // supported. - ProtectionLevel protection_level = 3; -} - -// Response message for -// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. -message EncryptResponse { - // The resource name of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in - // encryption. Check this field to verify that the intended resource was used - // for encryption. - string name = 1; - - // The encrypted data. - bytes ciphertext = 2; - - // Integrity verification field. A CRC32C checksum of the returned - // [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]. - // An integrity check of - // [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext] - // can be performed by computing the CRC32C checksum of - // [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext] - // and comparing your results to this field. Discard the response in case of - // non-matching checksum values, and perform a limited number of retries. A - // persistent mismatch may indicate an issue in your computation of the CRC32C - // checksum. Note: This field is defined as int64 for reasons of compatibility - // across different languages. However, it is a non-negative integer, which - // will never exceed 2^32-1, and can be safely downconverted to uint32 in - // languages that support this type. - google.protobuf.Int64Value ciphertext_crc32c = 4; - - // Integrity verification field. A flag indicating whether - // [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c] - // was received by - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used - // for the integrity verification of the - // [plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. A false value of - // this field indicates either that - // [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c] - // was left unset or that it was not delivered to - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've - // set - // [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c] - // but this field is still false, discard the response and perform a limited - // number of retries. - bool verified_plaintext_crc32c = 5; - - // Integrity verification field. A flag indicating whether - // [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c] - // was received by - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used - // for the integrity verification of the - // [AAD][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. A - // false value of this field indicates either that - // [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c] - // was left unset or that it was not delivered to - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've - // set - // [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c] - // but this field is still false, discard the response and perform a limited - // number of retries. - bool verified_additional_authenticated_data_crc32c = 6; - - // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in - // encryption. - ProtectionLevel protection_level = 7; -} - -// Response message for -// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. -message DecryptResponse { - // The decrypted data originally supplied in - // [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. - bytes plaintext = 1; - - // Integrity verification field. A CRC32C checksum of the returned - // [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]. - // An integrity check of - // [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext] - // can be performed by computing the CRC32C checksum of - // [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext] - // and comparing your results to this field. Discard the response in case of - // non-matching checksum values, and perform a limited number of retries. A - // persistent mismatch may indicate an issue in your computation of the CRC32C - // checksum. Note: receiving this response message indicates that - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to - // successfully decrypt the - // [ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]. Note: This - // field is defined as int64 for reasons of compatibility across different - // languages. However, it is a non-negative integer, which will never exceed - // 2^32-1, and can be safely downconverted to uint32 in languages that support - // this type. - google.protobuf.Int64Value plaintext_crc32c = 2; - - // Whether the Decryption was performed using the primary key version. - bool used_primary = 3; - - // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in - // decryption. - ProtectionLevel protection_level = 4; -} - -// Response message for -// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt]. -message RawEncryptResponse { - // The encrypted data. In the case of AES-GCM, the authentication tag - // is the [tag_length][google.cloud.kms.v1.RawEncryptResponse.tag_length] - // bytes at the end of this field. - bytes ciphertext = 1; - - // The initialization vector (IV) generated by the service during - // encryption. This value must be stored and provided in - // [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector] - // at decryption time. - bytes initialization_vector = 2; - - // The length of the authentication tag that is appended to - // the end of the ciphertext. - int32 tag_length = 3; - - // Integrity verification field. A CRC32C checksum of the returned - // [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext]. - // An integrity check of ciphertext can be performed by computing the CRC32C - // checksum of ciphertext and comparing your results to this field. Discard - // the response in case of non-matching checksum values, and perform a limited - // number of retries. A persistent mismatch may indicate an issue in your - // computation of the CRC32C checksum. Note: This field is defined as int64 - // for reasons of compatibility across different languages. However, it is a - // non-negative integer, which will never exceed 2^32-1, and can be safely - // downconverted to uint32 in languages that support this type. - google.protobuf.Int64Value ciphertext_crc32c = 4; - - // Integrity verification field. A CRC32C checksum of the returned - // [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector]. - // An integrity check of initialization_vector can be performed by computing - // the CRC32C checksum of initialization_vector and comparing your results to - // this field. Discard the response in case of non-matching checksum values, - // and perform a limited number of retries. A persistent mismatch may indicate - // an issue in your computation of the CRC32C checksum. Note: This field is - // defined as int64 for reasons of compatibility across different languages. - // However, it is a non-negative integer, which will never exceed 2^32-1, and - // can be safely downconverted to uint32 in languages that support this type. - google.protobuf.Int64Value initialization_vector_crc32c = 5; - - // Integrity verification field. A flag indicating whether - // [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c] - // was received by - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used - // for the integrity verification of the plaintext. A false value of this - // field indicates either that - // [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c] - // was left unset or that it was not delivered to - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've - // set - // [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c] - // but this field is still false, discard the response and perform a limited - // number of retries. - bool verified_plaintext_crc32c = 6; - - // Integrity verification field. A flag indicating whether - // [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c] - // was received by - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used - // for the integrity verification of additional_authenticated_data. A false - // value of this field indicates either that // - // [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c] - // was left unset or that it was not delivered to - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've - // set - // [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c] - // but this field is still false, discard the response and perform a limited - // number of retries. - bool verified_additional_authenticated_data_crc32c = 7; - - // Integrity verification field. A flag indicating whether - // [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c] - // was received by - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used - // for the integrity verification of initialization_vector. A false value of - // this field indicates either that - // [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c] - // was left unset or that it was not delivered to - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've - // set - // [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c] - // but this field is still false, discard the response and perform a limited - // number of retries. - bool verified_initialization_vector_crc32c = 10; - - // The resource name of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in - // encryption. Check this field to verify that the intended resource was used - // for encryption. - string name = 8; - - // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in - // encryption. - ProtectionLevel protection_level = 9; -} - -// Response message for -// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt]. -message RawDecryptResponse { - // The decrypted data. - bytes plaintext = 1; - - // Integrity verification field. A CRC32C checksum of the returned - // [RawDecryptResponse.plaintext][google.cloud.kms.v1.RawDecryptResponse.plaintext]. - // An integrity check of plaintext can be performed by computing the CRC32C - // checksum of plaintext and comparing your results to this field. Discard the - // response in case of non-matching checksum values, and perform a limited - // number of retries. A persistent mismatch may indicate an issue in your - // computation of the CRC32C checksum. Note: receiving this response message - // indicates that - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to - // successfully decrypt the - // [ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext]. - // Note: This field is defined as int64 for reasons of compatibility across - // different languages. However, it is a non-negative integer, which will - // never exceed 2^32-1, and can be safely downconverted to uint32 in languages - // that support this type. - google.protobuf.Int64Value plaintext_crc32c = 2; - - // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in - // decryption. - ProtectionLevel protection_level = 3; - - // Integrity verification field. A flag indicating whether - // [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c] - // was received by - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used - // for the integrity verification of the ciphertext. A false value of this - // field indicates either that - // [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c] - // was left unset or that it was not delivered to - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've - // set - // [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c] - // but this field is still false, discard the response and perform a limited - // number of retries. - bool verified_ciphertext_crc32c = 4; - - // Integrity verification field. A flag indicating whether - // [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c] - // was received by - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used - // for the integrity verification of additional_authenticated_data. A false - // value of this field indicates either that // - // [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c] - // was left unset or that it was not delivered to - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've - // set - // [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c] - // but this field is still false, discard the response and perform a limited - // number of retries. - bool verified_additional_authenticated_data_crc32c = 5; - - // Integrity verification field. A flag indicating whether - // [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c] - // was received by - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used - // for the integrity verification of initialization_vector. A false value of - // this field indicates either that - // [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c] - // was left unset or that it was not delivered to - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've - // set - // [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c] - // but this field is still false, discard the response and perform a limited - // number of retries. - bool verified_initialization_vector_crc32c = 6; -} - -// Response message for -// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]. -message AsymmetricSignResponse { - // The created signature. - bytes signature = 1; - - // Integrity verification field. A CRC32C checksum of the returned - // [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]. - // An integrity check of - // [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature] - // can be performed by computing the CRC32C checksum of - // [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature] - // and comparing your results to this field. Discard the response in case of - // non-matching checksum values, and perform a limited number of retries. A - // persistent mismatch may indicate an issue in your computation of the CRC32C - // checksum. Note: This field is defined as int64 for reasons of compatibility - // across different languages. However, it is a non-negative integer, which - // will never exceed 2^32-1, and can be safely downconverted to uint32 in - // languages that support this type. - google.protobuf.Int64Value signature_crc32c = 2; - - // Integrity verification field. A flag indicating whether - // [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c] - // was received by - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used - // for the integrity verification of the - // [digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]. A false value - // of this field indicates either that - // [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c] - // was left unset or that it was not delivered to - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've - // set - // [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c] - // but this field is still false, discard the response and perform a limited - // number of retries. - bool verified_digest_crc32c = 3; - - // The resource name of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing. - // Check this field to verify that the intended resource was used for signing. - string name = 4; - - // Integrity verification field. A flag indicating whether - // [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c] - // was received by - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used - // for the integrity verification of the - // [data][google.cloud.kms.v1.AsymmetricSignRequest.data]. A false value of - // this field indicates either that - // [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c] - // was left unset or that it was not delivered to - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've - // set - // [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c] - // but this field is still false, discard the response and perform a limited - // number of retries. - bool verified_data_crc32c = 5; - - // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing. - ProtectionLevel protection_level = 6; -} - -// Response message for -// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]. -message AsymmetricDecryptResponse { - // The decrypted data originally encrypted with the matching public key. - bytes plaintext = 1; - - // Integrity verification field. A CRC32C checksum of the returned - // [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]. - // An integrity check of - // [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext] - // can be performed by computing the CRC32C checksum of - // [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext] - // and comparing your results to this field. Discard the response in case of - // non-matching checksum values, and perform a limited number of retries. A - // persistent mismatch may indicate an issue in your computation of the CRC32C - // checksum. Note: This field is defined as int64 for reasons of compatibility - // across different languages. However, it is a non-negative integer, which - // will never exceed 2^32-1, and can be safely downconverted to uint32 in - // languages that support this type. - google.protobuf.Int64Value plaintext_crc32c = 2; - - // Integrity verification field. A flag indicating whether - // [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c] - // was received by - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used - // for the integrity verification of the - // [ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]. A - // false value of this field indicates either that - // [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c] - // was left unset or that it was not delivered to - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've - // set - // [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c] - // but this field is still false, discard the response and perform a limited - // number of retries. - bool verified_ciphertext_crc32c = 3; - - // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in - // decryption. - ProtectionLevel protection_level = 4; -} - -// Response message for -// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign]. -message MacSignResponse { - // The resource name of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing. - // Check this field to verify that the intended resource was used for signing. - string name = 1; - - // The created signature. - bytes mac = 2; - - // Integrity verification field. A CRC32C checksum of the returned - // [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac]. An - // integrity check of - // [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] can be - // performed by computing the CRC32C checksum of - // [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] and - // comparing your results to this field. Discard the response in case of - // non-matching checksum values, and perform a limited number of retries. A - // persistent mismatch may indicate an issue in your computation of the CRC32C - // checksum. Note: This field is defined as int64 for reasons of compatibility - // across different languages. However, it is a non-negative integer, which - // will never exceed 2^32-1, and can be safely downconverted to uint32 in - // languages that support this type. - google.protobuf.Int64Value mac_crc32c = 3; - - // Integrity verification field. A flag indicating whether - // [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c] - // was received by - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used - // for the integrity verification of the - // [data][google.cloud.kms.v1.MacSignRequest.data]. A false value of this - // field indicates either that - // [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c] - // was left unset or that it was not delivered to - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've - // set - // [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c] - // but this field is still false, discard the response and perform a limited - // number of retries. - bool verified_data_crc32c = 4; - - // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing. - ProtectionLevel protection_level = 5; -} - -// Response message for -// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify]. -message MacVerifyResponse { - // The resource name of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for - // verification. Check this field to verify that the intended resource was - // used for verification. - string name = 1; - - // This field indicates whether or not the verification operation for - // [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] over - // [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] was - // successful. - bool success = 2; - - // Integrity verification field. A flag indicating whether - // [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c] - // was received by - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used - // for the integrity verification of the - // [data][google.cloud.kms.v1.MacVerifyRequest.data]. A false value of this - // field indicates either that - // [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c] - // was left unset or that it was not delivered to - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've - // set - // [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c] - // but this field is still false, discard the response and perform a limited - // number of retries. - bool verified_data_crc32c = 3; - - // Integrity verification field. A flag indicating whether - // [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c] - // was received by - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used - // for the integrity verification of the - // [data][google.cloud.kms.v1.MacVerifyRequest.mac]. A false value of this - // field indicates either that - // [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c] - // was left unset or that it was not delivered to - // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've - // set - // [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c] - // but this field is still false, discard the response and perform a limited - // number of retries. - bool verified_mac_crc32c = 4; - - // Integrity verification field. This value is used for the integrity - // verification of [MacVerifyResponse.success]. If the value of this field - // contradicts the value of [MacVerifyResponse.success], discard the response - // and perform a limited number of retries. - bool verified_success_integrity = 5; - - // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for - // verification. - ProtectionLevel protection_level = 6; -} - -// Response message for -// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]. -message GenerateRandomBytesResponse { - // The generated data. - bytes data = 1; - - // Integrity verification field. A CRC32C checksum of the returned - // [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]. - // An integrity check of - // [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data] - // can be performed by computing the CRC32C checksum of - // [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data] - // and comparing your results to this field. Discard the response in case of - // non-matching checksum values, and perform a limited number of retries. A - // persistent mismatch may indicate an issue in your computation of the CRC32C - // checksum. Note: This field is defined as int64 for reasons of compatibility - // across different languages. However, it is a non-negative integer, which - // will never exceed 2^32-1, and can be safely downconverted to uint32 in - // languages that support this type. - google.protobuf.Int64Value data_crc32c = 3; -} - -// A [Digest][google.cloud.kms.v1.Digest] holds a cryptographic message digest. -message Digest { - // Required. The message digest. - oneof digest { - // A message digest produced with the SHA-256 algorithm. - bytes sha256 = 1; - - // A message digest produced with the SHA-384 algorithm. - bytes sha384 = 2; - - // A message digest produced with the SHA-512 algorithm. - bytes sha512 = 3; - } -} - -// Cloud KMS metadata for the given -// [google.cloud.location.Location][google.cloud.location.Location]. -message LocationMetadata { - // Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with - // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level] - // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] can be created in this - // location. - bool hsm_available = 1; - - // Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with - // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level] - // [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] can be created in - // this location. - bool ekm_available = 2; -} diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.create_ekm_connection.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.create_ekm_connection.js deleted file mode 100644 index 58c67070167..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.create_ekm_connection.js +++ /dev/null @@ -1,75 +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, ekmConnectionId, ekmConnection) { - // [START cloudkms_v1_generated_EkmService_CreateEkmConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * EkmConnection google.cloud.kms.v1.EkmConnection, in the format - * `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Required. It must be unique within a location and match the regular - * expression `[a-zA-Z0-9_-]{1,63}`. - */ - // const ekmConnectionId = 'abc123' - /** - * Required. An EkmConnection google.cloud.kms.v1.EkmConnection with - * initial field values. - */ - // const ekmConnection = {} - - // Imports the Kms library - const {EkmServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new EkmServiceClient(); - - async function callCreateEkmConnection() { - // Construct request - const request = { - parent, - ekmConnectionId, - ekmConnection, - }; - - // Run request - const response = await kmsClient.createEkmConnection(request); - console.log(response); - } - - callCreateEkmConnection(); - // [END cloudkms_v1_generated_EkmService_CreateEkmConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.get_ekm_config.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.get_ekm_config.js deleted file mode 100644 index 1bd4b4ca6fc..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.get_ekm_config.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 cloudkms_v1_generated_EkmService_GetEkmConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.EkmConfig.name of the - * EkmConfig google.cloud.kms.v1.EkmConfig to get. - */ - // const name = 'abc123' - - // Imports the Kms library - const {EkmServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new EkmServiceClient(); - - async function callGetEkmConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await kmsClient.getEkmConfig(request); - console.log(response); - } - - callGetEkmConfig(); - // [END cloudkms_v1_generated_EkmService_GetEkmConfig_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-kms/v1/samples/generated/v1/ekm_service.get_ekm_connection.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.get_ekm_connection.js deleted file mode 100644 index c9d347d3fcc..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.get_ekm_connection.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 cloudkms_v1_generated_EkmService_GetEkmConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.EkmConnection.name of the - * EkmConnection google.cloud.kms.v1.EkmConnection to get. - */ - // const name = 'abc123' - - // Imports the Kms library - const {EkmServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new EkmServiceClient(); - - async function callGetEkmConnection() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await kmsClient.getEkmConnection(request); - console.log(response); - } - - callGetEkmConnection(); - // [END cloudkms_v1_generated_EkmService_GetEkmConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.list_ekm_connections.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.list_ekm_connections.js deleted file mode 100644 index f8353555c43..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.list_ekm_connections.js +++ /dev/null @@ -1,94 +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 cloudkms_v1_generated_EkmService_ListEkmConnections_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * EkmConnections google.cloud.kms.v1.EkmConnection to list, in the format - * `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Optional. Optional limit on the number of - * EkmConnections google.cloud.kms.v1.EkmConnection to include in the - * response. Further EkmConnections google.cloud.kms.v1.EkmConnection can - * subsequently be obtained by including the - * ListEkmConnectionsResponse.next_page_token google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - */ - // const pageSize = 1234 - /** - * Optional. Optional pagination token, returned earlier via - * ListEkmConnectionsResponse.next_page_token google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * Optional. Only include resources that match the filter in the response. For - * more information, see - * Sorting and filtering list - * results (https://cloud.google.com/kms/docs/sorting-and-filtering). - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * Sorting and filtering list - * results (https://cloud.google.com/kms/docs/sorting-and-filtering). - */ - // const orderBy = 'abc123' - - // Imports the Kms library - const {EkmServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new EkmServiceClient(); - - async function callListEkmConnections() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await kmsClient.listEkmConnectionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListEkmConnections(); - // [END cloudkms_v1_generated_EkmService_ListEkmConnections_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.update_ekm_config.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.update_ekm_config.js deleted file mode 100644 index 58d479ffd12..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.update_ekm_config.js +++ /dev/null @@ -1,66 +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(ekmConfig, updateMask) { - // [START cloudkms_v1_generated_EkmService_UpdateEkmConfig_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. EkmConfig google.cloud.kms.v1.EkmConfig with updated values. - */ - // const ekmConfig = {} - /** - * Required. List of fields to be updated in this request. - */ - // const updateMask = {} - - // Imports the Kms library - const {EkmServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new EkmServiceClient(); - - async function callUpdateEkmConfig() { - // Construct request - const request = { - ekmConfig, - updateMask, - }; - - // Run request - const response = await kmsClient.updateEkmConfig(request); - console.log(response); - } - - callUpdateEkmConfig(); - // [END cloudkms_v1_generated_EkmService_UpdateEkmConfig_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-kms/v1/samples/generated/v1/ekm_service.update_ekm_connection.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.update_ekm_connection.js deleted file mode 100644 index be9cde05978..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.update_ekm_connection.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(ekmConnection, updateMask) { - // [START cloudkms_v1_generated_EkmService_UpdateEkmConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. EkmConnection google.cloud.kms.v1.EkmConnection with updated - * values. - */ - // const ekmConnection = {} - /** - * Required. List of fields to be updated in this request. - */ - // const updateMask = {} - - // Imports the Kms library - const {EkmServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new EkmServiceClient(); - - async function callUpdateEkmConnection() { - // Construct request - const request = { - ekmConnection, - updateMask, - }; - - // Run request - const response = await kmsClient.updateEkmConnection(request); - console.log(response); - } - - callUpdateEkmConnection(); - // [END cloudkms_v1_generated_EkmService_UpdateEkmConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.verify_connectivity.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.verify_connectivity.js deleted file mode 100644 index 84e5eeaa873..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/ekm_service.verify_connectivity.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 cloudkms_v1_generated_EkmService_VerifyConnectivity_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.EkmConnection.name of the - * EkmConnection google.cloud.kms.v1.EkmConnection to verify. - */ - // const name = 'abc123' - - // Imports the Kms library - const {EkmServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new EkmServiceClient(); - - async function callVerifyConnectivity() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await kmsClient.verifyConnectivity(request); - console.log(response); - } - - callVerifyConnectivity(); - // [END cloudkms_v1_generated_EkmService_VerifyConnectivity_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-kms/v1/samples/generated/v1/key_management_service.asymmetric_decrypt.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.asymmetric_decrypt.js deleted file mode 100644 index 3b8eb7c12a9..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.asymmetric_decrypt.js +++ /dev/null @@ -1,92 +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, ciphertext) { - // [START cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for - * decryption. - */ - // const name = 'abc123' - /** - * Required. The data encrypted with the named - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion's public key using - * OAEP. - */ - // const ciphertext = Buffer.from('string') - /** - * Optional. An optional CRC32C checksum of the - * AsymmetricDecryptRequest.ciphertext google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext. - * If specified, - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * verify the integrity of the received - * AsymmetricDecryptRequest.ciphertext google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext - * using this checksum. - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(AsymmetricDecryptRequest.ciphertext google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext) - * is equal to - * AsymmetricDecryptRequest.ciphertext_crc32c google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - */ - // const ciphertextCrc32c = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callAsymmetricDecrypt() { - // Construct request - const request = { - name, - ciphertext, - }; - - // Run request - const response = await kmsClient.asymmetricDecrypt(request); - console.log(response); - } - - callAsymmetricDecrypt(); - // [END cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.asymmetric_sign.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.asymmetric_sign.js deleted file mode 100644 index 32277ce68fb..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.asymmetric_sign.js +++ /dev/null @@ -1,123 +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 cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for - * signing. - */ - // const name = 'abc123' - /** - * Optional. The digest of the data to sign. The digest must be produced with - * the same digest algorithm as specified by the key version's - * algorithm google.cloud.kms.v1.CryptoKeyVersion.algorithm. - * This field may not be supplied if - * AsymmetricSignRequest.data google.cloud.kms.v1.AsymmetricSignRequest.data - * is supplied. - */ - // const digest = {} - /** - * Optional. An optional CRC32C checksum of the - * AsymmetricSignRequest.digest google.cloud.kms.v1.AsymmetricSignRequest.digest. - * If specified, - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * verify the integrity of the received - * AsymmetricSignRequest.digest google.cloud.kms.v1.AsymmetricSignRequest.digest - * using this checksum. - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(AsymmetricSignRequest.digest google.cloud.kms.v1.AsymmetricSignRequest.digest) - * is equal to - * AsymmetricSignRequest.digest_crc32c google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - */ - // const digestCrc32c = {} - /** - * Optional. The data to sign. - * It can't be supplied if - * AsymmetricSignRequest.digest google.cloud.kms.v1.AsymmetricSignRequest.digest - * is supplied. - */ - // const data = Buffer.from('string') - /** - * Optional. An optional CRC32C checksum of the - * AsymmetricSignRequest.data google.cloud.kms.v1.AsymmetricSignRequest.data. - * If specified, - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * verify the integrity of the received - * AsymmetricSignRequest.data google.cloud.kms.v1.AsymmetricSignRequest.data - * using this checksum. - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(AsymmetricSignRequest.data google.cloud.kms.v1.AsymmetricSignRequest.data) - * is equal to - * AsymmetricSignRequest.data_crc32c google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - */ - // const dataCrc32c = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callAsymmetricSign() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await kmsClient.asymmetricSign(request); - console.log(response); - } - - callAsymmetricSign(); - // [END cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_crypto_key.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_crypto_key.js deleted file mode 100644 index b54a03167aa..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_crypto_key.js +++ /dev/null @@ -1,85 +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, cryptoKeyId, cryptoKey) { - // [START cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.KeyRing.name of the KeyRing - * associated with the CryptoKeys google.cloud.kms.v1.CryptoKey. - */ - // const parent = 'abc123' - /** - * Required. It must be unique within a KeyRing and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - */ - // const cryptoKeyId = 'abc123' - /** - * Required. A CryptoKey google.cloud.kms.v1.CryptoKey with initial field - * values. - */ - // const cryptoKey = {} - /** - * If set to true, the request will create a - * CryptoKey google.cloud.kms.v1.CryptoKey without any - * CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion. You must - * manually call - * CreateCryptoKeyVersion google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion - * or - * ImportCryptoKeyVersion google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion - * before you can use this CryptoKey google.cloud.kms.v1.CryptoKey. - */ - // const skipInitialVersionCreation = true - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callCreateCryptoKey() { - // Construct request - const request = { - parent, - cryptoKeyId, - cryptoKey, - }; - - // Run request - const response = await kmsClient.createCryptoKey(request); - console.log(response); - } - - callCreateCryptoKey(); - // [END cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_crypto_key_version.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_crypto_key_version.js deleted file mode 100644 index 88d3f0579a6..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_crypto_key_version.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, cryptoKeyVersion) { - // [START cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.CryptoKey.name of the - * CryptoKey google.cloud.kms.v1.CryptoKey associated with the - * CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion. - */ - // const parent = 'abc123' - /** - * Required. A CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion with - * initial field values. - */ - // const cryptoKeyVersion = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callCreateCryptoKeyVersion() { - // Construct request - const request = { - parent, - cryptoKeyVersion, - }; - - // Run request - const response = await kmsClient.createCryptoKeyVersion(request); - console.log(response); - } - - callCreateCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_import_job.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_import_job.js deleted file mode 100644 index 73a8beb1271..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_import_job.js +++ /dev/null @@ -1,75 +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, importJobId, importJob) { - // [START cloudkms_v1_generated_KeyManagementService_CreateImportJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.KeyRing.name of the - * KeyRing google.cloud.kms.v1.KeyRing associated with the - * ImportJobs google.cloud.kms.v1.ImportJob. - */ - // const parent = 'abc123' - /** - * Required. It must be unique within a KeyRing and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - */ - // const importJobId = 'abc123' - /** - * Required. An ImportJob google.cloud.kms.v1.ImportJob with initial field - * values. - */ - // const importJob = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callCreateImportJob() { - // Construct request - const request = { - parent, - importJobId, - importJob, - }; - - // Run request - const response = await kmsClient.createImportJob(request); - console.log(response); - } - - callCreateImportJob(); - // [END cloudkms_v1_generated_KeyManagementService_CreateImportJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_key_ring.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_key_ring.js deleted file mode 100644 index dfca3c2077d..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.create_key_ring.js +++ /dev/null @@ -1,75 +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, keyRingId, keyRing) { - // [START cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * KeyRings google.cloud.kms.v1.KeyRing, in the format - * `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Required. It must be unique within a location and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - */ - // const keyRingId = 'abc123' - /** - * Required. A KeyRing google.cloud.kms.v1.KeyRing with initial field - * values. - */ - // const keyRing = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callCreateKeyRing() { - // Construct request - const request = { - parent, - keyRingId, - keyRing, - }; - - // Run request - const response = await kmsClient.createKeyRing(request); - console.log(response); - } - - callCreateKeyRing(); - // [END cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.decrypt.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.decrypt.js deleted file mode 100644 index ea9cecee93e..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.decrypt.js +++ /dev/null @@ -1,118 +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, ciphertext) { - // [START cloudkms_v1_generated_KeyManagementService_Decrypt_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the - * CryptoKey google.cloud.kms.v1.CryptoKey to use for decryption. The - * server will choose the appropriate version. - */ - // const name = 'abc123' - /** - * Required. The encrypted data originally returned in - * EncryptResponse.ciphertext google.cloud.kms.v1.EncryptResponse.ciphertext. - */ - // const ciphertext = Buffer.from('string') - /** - * Optional. Optional data that must match the data originally supplied in - * EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data. - */ - // const additionalAuthenticatedData = Buffer.from('string') - /** - * Optional. An optional CRC32C checksum of the - * DecryptRequest.ciphertext google.cloud.kms.v1.DecryptRequest.ciphertext. - * If specified, - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * verify the integrity of the received - * DecryptRequest.ciphertext google.cloud.kms.v1.DecryptRequest.ciphertext - * using this checksum. - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(DecryptRequest.ciphertext google.cloud.kms.v1.DecryptRequest.ciphertext) - * is equal to - * DecryptRequest.ciphertext_crc32c google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - */ - // const ciphertextCrc32c = {} - /** - * Optional. An optional CRC32C checksum of the - * DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data. - * If specified, - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * verify the integrity of the received - * DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data - * using this checksum. - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data) - * is equal to - * DecryptRequest.additional_authenticated_data_crc32c google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - */ - // const additionalAuthenticatedDataCrc32c = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callDecrypt() { - // Construct request - const request = { - name, - ciphertext, - }; - - // Run request - const response = await kmsClient.decrypt(request); - console.log(response); - } - - callDecrypt(); - // [END cloudkms_v1_generated_KeyManagementService_Decrypt_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.destroy_crypto_key_version.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.destroy_crypto_key_version.js deleted file mode 100644 index 50b0a9b66a0..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.destroy_crypto_key_version.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 cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to destroy. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callDestroyCryptoKeyVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await kmsClient.destroyCryptoKeyVersion(request); - console.log(response); - } - - callDestroyCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.encrypt.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.encrypt.js deleted file mode 100644 index dabbe16a547..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.encrypt.js +++ /dev/null @@ -1,139 +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, plaintext) { - // [START cloudkms_v1_generated_KeyManagementService_Encrypt_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the - * CryptoKey google.cloud.kms.v1.CryptoKey or - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for - * encryption. - * If a CryptoKey google.cloud.kms.v1.CryptoKey is specified, the server - * will use its primary version google.cloud.kms.v1.CryptoKey.primary. - */ - // const name = 'abc123' - /** - * Required. The data to encrypt. Must be no larger than 64KiB. - * The maximum size depends on the key version's - * protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level. - * For SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE, - * EXTERNAL google.cloud.kms.v1.ProtectionLevel.EXTERNAL, and - * EXTERNAL_VPC google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC keys, the - * plaintext must be no larger than 64KiB. For - * HSM google.cloud.kms.v1.ProtectionLevel.HSM keys, the combined length of - * the plaintext and additional_authenticated_data fields must be no larger - * than 8KiB. - */ - // const plaintext = Buffer.from('string') - /** - * Optional. Optional data that, if specified, must also be provided during - * decryption through - * DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data. - * The maximum size depends on the key version's - * protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level. - * For SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE, - * EXTERNAL google.cloud.kms.v1.ProtectionLevel.EXTERNAL, and - * EXTERNAL_VPC google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC keys the - * AAD must be no larger than 64KiB. For - * HSM google.cloud.kms.v1.ProtectionLevel.HSM keys, the combined length of - * the plaintext and additional_authenticated_data fields must be no larger - * than 8KiB. - */ - // const additionalAuthenticatedData = Buffer.from('string') - /** - * Optional. An optional CRC32C checksum of the - * EncryptRequest.plaintext google.cloud.kms.v1.EncryptRequest.plaintext. - * If specified, - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * verify the integrity of the received - * EncryptRequest.plaintext google.cloud.kms.v1.EncryptRequest.plaintext - * using this checksum. - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(EncryptRequest.plaintext google.cloud.kms.v1.EncryptRequest.plaintext) - * is equal to - * EncryptRequest.plaintext_crc32c google.cloud.kms.v1.EncryptRequest.plaintext_crc32c, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - */ - // const plaintextCrc32c = {} - /** - * Optional. An optional CRC32C checksum of the - * EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data. - * If specified, - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * verify the integrity of the received - * EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data - * using this checksum. - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data) - * is equal to - * EncryptRequest.additional_authenticated_data_crc32c google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - */ - // const additionalAuthenticatedDataCrc32c = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callEncrypt() { - // Construct request - const request = { - name, - plaintext, - }; - - // Run request - const response = await kmsClient.encrypt(request); - console.log(response); - } - - callEncrypt(); - // [END cloudkms_v1_generated_KeyManagementService_Encrypt_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.generate_random_bytes.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.generate_random_bytes.js deleted file mode 100644 index c0df8619dcb..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.generate_random_bytes.js +++ /dev/null @@ -1,73 +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() { - // [START cloudkms_v1_generated_KeyManagementService_GenerateRandomBytes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The project-specific location in which to generate random bytes. - * For example, "projects/my-project/locations/us-central1". - */ - // const location = 'abc123' - /** - * The length in bytes of the amount of randomness to retrieve. Minimum 8 - * bytes, maximum 1024 bytes. - */ - // const lengthBytes = 1234 - /** - * The ProtectionLevel google.cloud.kms.v1.ProtectionLevel to use when - * generating the random data. Currently, only - * HSM google.cloud.kms.v1.ProtectionLevel.HSM protection level is - * supported. - */ - // const protectionLevel = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callGenerateRandomBytes() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.generateRandomBytes(request); - console.log(response); - } - - callGenerateRandomBytes(); - // [END cloudkms_v1_generated_KeyManagementService_GenerateRandomBytes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_crypto_key.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_crypto_key.js deleted file mode 100644 index 56eb2dacf97..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_crypto_key.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 cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.CryptoKey.name of the - * CryptoKey google.cloud.kms.v1.CryptoKey to get. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callGetCryptoKey() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await kmsClient.getCryptoKey(request); - console.log(response); - } - - callGetCryptoKey(); - // [END cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_crypto_key_version.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_crypto_key_version.js deleted file mode 100644 index e0e3df10922..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_crypto_key_version.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 cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.CryptoKeyVersion.name of the - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to get. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callGetCryptoKeyVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await kmsClient.getCryptoKeyVersion(request); - console.log(response); - } - - callGetCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_import_job.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_import_job.js deleted file mode 100644 index 699bcd6bca8..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_import_job.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 cloudkms_v1_generated_KeyManagementService_GetImportJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.ImportJob.name of the - * ImportJob google.cloud.kms.v1.ImportJob to get. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callGetImportJob() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await kmsClient.getImportJob(request); - console.log(response); - } - - callGetImportJob(); - // [END cloudkms_v1_generated_KeyManagementService_GetImportJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_key_ring.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_key_ring.js deleted file mode 100644 index 69afc7b2809..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_key_ring.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 cloudkms_v1_generated_KeyManagementService_GetKeyRing_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.KeyRing.name of the - * KeyRing google.cloud.kms.v1.KeyRing to get. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callGetKeyRing() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await kmsClient.getKeyRing(request); - console.log(response); - } - - callGetKeyRing(); - // [END cloudkms_v1_generated_KeyManagementService_GetKeyRing_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_public_key.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_public_key.js deleted file mode 100644 index 019771352b5..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.get_public_key.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 cloudkms_v1_generated_KeyManagementService_GetPublicKey_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.CryptoKeyVersion.name of the - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion public key to get. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callGetPublicKey() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await kmsClient.getPublicKey(request); - console.log(response); - } - - callGetPublicKey(); - // [END cloudkms_v1_generated_KeyManagementService_GetPublicKey_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.import_crypto_key_version.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.import_crypto_key_version.js deleted file mode 100644 index 0d18113111e..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.import_crypto_key_version.js +++ /dev/null @@ -1,145 +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, algorithm, importJob) { - // [START cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.CryptoKey.name of the - * CryptoKey google.cloud.kms.v1.CryptoKey to be imported into. - * The create permission is only required on this key when creating a new - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion. - */ - // const parent = 'abc123' - /** - * Optional. The optional name google.cloud.kms.v1.CryptoKeyVersion.name of - * an existing CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to - * target for an import operation. If this field is not present, a new - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion containing the - * supplied key material is created. - * If this field is present, the supplied key material is imported into - * the existing CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion. To - * import into an existing - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion, the - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion must be a child of - * ImportCryptoKeyVersionRequest.parent google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent, - * have been previously created via ImportCryptoKeyVersion , and be in - * DESTROYED google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED - * or - * IMPORT_FAILED google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED - * state. The key material and algorithm must match the previous - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion exactly if the - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion has ever contained - * key material. - */ - // const cryptoKeyVersion = 'abc123' - /** - * Required. The - * algorithm google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm - * of the key being imported. This does not need to match the - * version_template google.cloud.kms.v1.CryptoKey.version_template of the - * CryptoKey google.cloud.kms.v1.CryptoKey this version imports into. - */ - // const algorithm = {} - /** - * Required. The name google.cloud.kms.v1.ImportJob.name of the - * ImportJob google.cloud.kms.v1.ImportJob that was used to wrap this key - * material. - */ - // const importJob = 'abc123' - /** - * Optional. The wrapped key material to import. - * Before wrapping, key material must be formatted. If importing symmetric key - * material, the expected key material format is plain bytes. If importing - * asymmetric key material, the expected key material format is PKCS#8-encoded - * DER (the PrivateKeyInfo structure from RFC 5208). - * When wrapping with import methods - * (RSA_OAEP_3072_SHA1_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256 - * or - * RSA_OAEP_4096_SHA1_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256 - * or - * RSA_OAEP_3072_SHA256_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256 - * or - * RSA_OAEP_4096_SHA256_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256), - * this field must contain the concatenation of: - *
    - *
  1. An ephemeral AES-256 wrapping key wrapped with the - * public_key google.cloud.kms.v1.ImportJob.public_key using - * RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an empty - * label. - *
  2. - *
  3. The formatted key to be imported, wrapped with the ephemeral AES-256 - * key using AES-KWP (RFC 5649). - *
  4. - *
- * This format is the same as the format produced by PKCS#11 mechanism - * CKM_RSA_AES_KEY_WRAP. - * When wrapping with import methods - * (RSA_OAEP_3072_SHA256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256 - * or - * RSA_OAEP_4096_SHA256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256), - * this field must contain the formatted key to be imported, wrapped with the - * public_key google.cloud.kms.v1.ImportJob.public_key using RSAES-OAEP - * with SHA-256, MGF1 with SHA-256, and an empty label. - */ - // const wrappedKey = Buffer.from('string') - /** - * Optional. This field has the same meaning as - * wrapped_key google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key. - * Prefer to use that field in new work. Either that field or this field - * (but not both) must be specified. - */ - // const rsaAesWrappedKey = Buffer.from('string') - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callImportCryptoKeyVersion() { - // Construct request - const request = { - parent, - algorithm, - importJob, - }; - - // Run request - const response = await kmsClient.importCryptoKeyVersion(request); - console.log(response); - } - - callImportCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_crypto_key_versions.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_crypto_key_versions.js deleted file mode 100644 index 2d5695aa5b4..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_crypto_key_versions.js +++ /dev/null @@ -1,98 +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 cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the - * CryptoKey google.cloud.kms.v1.CryptoKey to list, in the format - * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. - */ - // const parent = 'abc123' - /** - * Optional. Optional limit on the number of - * CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion to include in the - * response. Further CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion - * can subsequently be obtained by including the - * ListCryptoKeyVersionsResponse.next_page_token google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - */ - // const pageSize = 1234 - /** - * Optional. Optional pagination token, returned earlier via - * ListCryptoKeyVersionsResponse.next_page_token google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * The fields to include in the response. - */ - // const view = {} - /** - * Optional. Only include resources that match the filter in the response. For - * more information, see - * Sorting and filtering list - * results (https://cloud.google.com/kms/docs/sorting-and-filtering). - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * Sorting and filtering list - * results (https://cloud.google.com/kms/docs/sorting-and-filtering). - */ - // const orderBy = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callListCryptoKeyVersions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await kmsClient.listCryptoKeyVersionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCryptoKeyVersions(); - // [END cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_crypto_keys.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_crypto_keys.js deleted file mode 100644 index 615dc84a567..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_crypto_keys.js +++ /dev/null @@ -1,97 +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 cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the KeyRing google.cloud.kms.v1.KeyRing - * to list, in the format `projects/* /locations/* /keyRings/*`. - */ - // const parent = 'abc123' - /** - * Optional. Optional limit on the number of - * CryptoKeys google.cloud.kms.v1.CryptoKey to include in the response. - * Further CryptoKeys google.cloud.kms.v1.CryptoKey can subsequently be - * obtained by including the - * ListCryptoKeysResponse.next_page_token google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - */ - // const pageSize = 1234 - /** - * Optional. Optional pagination token, returned earlier via - * ListCryptoKeysResponse.next_page_token google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * The fields of the primary version to include in the response. - */ - // const versionView = {} - /** - * Optional. Only include resources that match the filter in the response. For - * more information, see - * Sorting and filtering list - * results (https://cloud.google.com/kms/docs/sorting-and-filtering). - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * Sorting and filtering list - * results (https://cloud.google.com/kms/docs/sorting-and-filtering). - */ - // const orderBy = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callListCryptoKeys() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await kmsClient.listCryptoKeysAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCryptoKeys(); - // [END cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_import_jobs.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_import_jobs.js deleted file mode 100644 index c6161bbe4fc..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_import_jobs.js +++ /dev/null @@ -1,93 +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 cloudkms_v1_generated_KeyManagementService_ListImportJobs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the KeyRing google.cloud.kms.v1.KeyRing - * to list, in the format `projects/* /locations/* /keyRings/*`. - */ - // const parent = 'abc123' - /** - * Optional. Optional limit on the number of - * ImportJobs google.cloud.kms.v1.ImportJob to include in the response. - * Further ImportJobs google.cloud.kms.v1.ImportJob can subsequently be - * obtained by including the - * ListImportJobsResponse.next_page_token google.cloud.kms.v1.ListImportJobsResponse.next_page_token - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - */ - // const pageSize = 1234 - /** - * Optional. Optional pagination token, returned earlier via - * ListImportJobsResponse.next_page_token google.cloud.kms.v1.ListImportJobsResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * Optional. Only include resources that match the filter in the response. For - * more information, see - * Sorting and filtering list - * results (https://cloud.google.com/kms/docs/sorting-and-filtering). - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * Sorting and filtering list - * results (https://cloud.google.com/kms/docs/sorting-and-filtering). - */ - // const orderBy = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callListImportJobs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await kmsClient.listImportJobsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListImportJobs(); - // [END cloudkms_v1_generated_KeyManagementService_ListImportJobs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_key_rings.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_key_rings.js deleted file mode 100644 index ccf1426a56e..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.list_key_rings.js +++ /dev/null @@ -1,94 +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 cloudkms_v1_generated_KeyManagementService_ListKeyRings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * KeyRings google.cloud.kms.v1.KeyRing, in the format - * `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Optional. Optional limit on the number of - * KeyRings google.cloud.kms.v1.KeyRing to include in the response. Further - * KeyRings google.cloud.kms.v1.KeyRing can subsequently be obtained by - * including the - * ListKeyRingsResponse.next_page_token google.cloud.kms.v1.ListKeyRingsResponse.next_page_token - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - */ - // const pageSize = 1234 - /** - * Optional. Optional pagination token, returned earlier via - * ListKeyRingsResponse.next_page_token google.cloud.kms.v1.ListKeyRingsResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * Optional. Only include resources that match the filter in the response. For - * more information, see - * Sorting and filtering list - * results (https://cloud.google.com/kms/docs/sorting-and-filtering). - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * Sorting and filtering list - * results (https://cloud.google.com/kms/docs/sorting-and-filtering). - */ - // const orderBy = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callListKeyRings() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await kmsClient.listKeyRingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListKeyRings(); - // [END cloudkms_v1_generated_KeyManagementService_ListKeyRings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.mac_sign.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.mac_sign.js deleted file mode 100644 index 418a3cbcd3f..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.mac_sign.js +++ /dev/null @@ -1,89 +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, data) { - // [START cloudkms_v1_generated_KeyManagementService_MacSign_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for - * signing. - */ - // const name = 'abc123' - /** - * Required. The data to sign. The MAC tag is computed over this data field - * based on the specific algorithm. - */ - // const data = Buffer.from('string') - /** - * Optional. An optional CRC32C checksum of the - * MacSignRequest.data google.cloud.kms.v1.MacSignRequest.data. If - * specified, KeyManagementService google.cloud.kms.v1.KeyManagementService - * will verify the integrity of the received - * MacSignRequest.data google.cloud.kms.v1.MacSignRequest.data using this - * checksum. KeyManagementService google.cloud.kms.v1.KeyManagementService - * will report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(MacSignRequest.data google.cloud.kms.v1.MacSignRequest.data) is - * equal to - * MacSignRequest.data_crc32c google.cloud.kms.v1.MacSignRequest.data_crc32c, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - */ - // const dataCrc32c = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callMacSign() { - // Construct request - const request = { - name, - data, - }; - - // Run request - const response = await kmsClient.macSign(request); - console.log(response); - } - - callMacSign(); - // [END cloudkms_v1_generated_KeyManagementService_MacSign_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.mac_verify.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.mac_verify.js deleted file mode 100644 index eae353774e9..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.mac_verify.js +++ /dev/null @@ -1,115 +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, data, mac) { - // [START cloudkms_v1_generated_KeyManagementService_MacVerify_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for - * verification. - */ - // const name = 'abc123' - /** - * Required. The data used previously as a - * MacSignRequest.data google.cloud.kms.v1.MacSignRequest.data to generate - * the MAC tag. - */ - // const data = Buffer.from('string') - /** - * Optional. An optional CRC32C checksum of the - * MacVerifyRequest.data google.cloud.kms.v1.MacVerifyRequest.data. If - * specified, KeyManagementService google.cloud.kms.v1.KeyManagementService - * will verify the integrity of the received - * MacVerifyRequest.data google.cloud.kms.v1.MacVerifyRequest.data using - * this checksum. - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(MacVerifyRequest.data google.cloud.kms.v1.MacVerifyRequest.data) - * is equal to - * MacVerifyRequest.data_crc32c google.cloud.kms.v1.MacVerifyRequest.data_crc32c, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - */ - // const dataCrc32c = {} - /** - * Required. The signature to verify. - */ - // const mac = Buffer.from('string') - /** - * Optional. An optional CRC32C checksum of the - * MacVerifyRequest.mac google.cloud.kms.v1.MacVerifyRequest.mac. If - * specified, KeyManagementService google.cloud.kms.v1.KeyManagementService - * will verify the integrity of the received - * MacVerifyRequest.mac google.cloud.kms.v1.MacVerifyRequest.mac using this - * checksum. KeyManagementService google.cloud.kms.v1.KeyManagementService - * will report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(MacVerifyRequest.tag ) is equal to - * MacVerifyRequest.mac_crc32c google.cloud.kms.v1.MacVerifyRequest.mac_crc32c, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - */ - // const macCrc32c = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callMacVerify() { - // Construct request - const request = { - name, - data, - mac, - }; - - // Run request - const response = await kmsClient.macVerify(request); - console.log(response); - } - - callMacVerify(); - // [END cloudkms_v1_generated_KeyManagementService_MacVerify_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.raw_decrypt.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.raw_decrypt.js deleted file mode 100644 index d03236a2a89..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.raw_decrypt.js +++ /dev/null @@ -1,142 +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, ciphertext, initializationVector) { - // [START cloudkms_v1_generated_KeyManagementService_RawDecrypt_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for - * decryption. - */ - // const name = 'abc123' - /** - * Required. The encrypted data originally returned in - * RawEncryptResponse.ciphertext google.cloud.kms.v1.RawEncryptResponse.ciphertext. - */ - // const ciphertext = Buffer.from('string') - /** - * Optional. Optional data that must match the data originally supplied in - * RawEncryptRequest.additional_authenticated_data google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data. - */ - // const additionalAuthenticatedData = Buffer.from('string') - /** - * Required. The initialization vector (IV) used during encryption, which must - * match the data originally provided in - * RawEncryptResponse.initialization_vector google.cloud.kms.v1.RawEncryptResponse.initialization_vector. - */ - // const initializationVector = Buffer.from('string') - /** - * The length of the authentication tag that is appended to the end of - * the ciphertext. If unspecified (0), the default value for the key's - * algorithm will be used (for AES-GCM, the default value is 16). - */ - // const tagLength = 1234 - /** - * Optional. An optional CRC32C checksum of the - * RawDecryptRequest.ciphertext google.cloud.kms.v1.RawDecryptRequest.ciphertext. - * If specified, - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * verify the integrity of the received ciphertext using this checksum. - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that CRC32C(ciphertext) is equal - * to ciphertext_crc32c, and if so, perform a limited number of retries. A - * persistent mismatch may indicate an issue in your computation of the CRC32C - * checksum. Note: This field is defined as int64 for reasons of compatibility - * across different languages. However, it is a non-negative integer, which - * will never exceed 2^32-1, and can be safely downconverted to uint32 in - * languages that support this type. - */ - // const ciphertextCrc32c = {} - /** - * Optional. An optional CRC32C checksum of the - * RawDecryptRequest.additional_authenticated_data google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data. - * If specified, - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * verify the integrity of the received additional_authenticated_data using - * this checksum. - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(additional_authenticated_data) is equal to - * additional_authenticated_data_crc32c, and if so, perform - * a limited number of retries. A persistent mismatch may indicate an issue in - * your computation of the CRC32C checksum. - * Note: This field is defined as int64 for reasons of compatibility across - * different languages. However, it is a non-negative integer, which will - * never exceed 2^32-1, and can be safely downconverted to uint32 in languages - * that support this type. - */ - // const additionalAuthenticatedDataCrc32c = {} - /** - * Optional. An optional CRC32C checksum of the - * RawDecryptRequest.initialization_vector google.cloud.kms.v1.RawDecryptRequest.initialization_vector. - * If specified, - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * verify the integrity of the received initialization_vector using this - * checksum. KeyManagementService google.cloud.kms.v1.KeyManagementService - * will report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and - * if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. - * Note: This field is defined as int64 for reasons of compatibility across - * different languages. However, it is a non-negative integer, which will - * never exceed 2^32-1, and can be safely downconverted to uint32 in languages - * that support this type. - */ - // const initializationVectorCrc32c = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callRawDecrypt() { - // Construct request - const request = { - name, - ciphertext, - initializationVector, - }; - - // Run request - const response = await kmsClient.rawDecrypt(request); - console.log(response); - } - - callRawDecrypt(); - // [END cloudkms_v1_generated_KeyManagementService_RawDecrypt_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-kms/v1/samples/generated/v1/key_management_service.raw_encrypt.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.raw_encrypt.js deleted file mode 100644 index 4b27306d4b2..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.raw_encrypt.js +++ /dev/null @@ -1,154 +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, plaintext) { - // [START cloudkms_v1_generated_KeyManagementService_RawEncrypt_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for - * encryption. - */ - // const name = 'abc123' - /** - * Required. The data to encrypt. Must be no larger than 64KiB. - * The maximum size depends on the key version's - * protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level. - * For SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE keys, the - * plaintext must be no larger than 64KiB. For - * HSM google.cloud.kms.v1.ProtectionLevel.HSM keys, the combined length of - * the plaintext and additional_authenticated_data fields must be no larger - * than 8KiB. - */ - // const plaintext = Buffer.from('string') - /** - * Optional. Optional data that, if specified, must also be provided during - * decryption through - * RawDecryptRequest.additional_authenticated_data google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data. - * This field may only be used in conjunction with an - * algorithm google.cloud.kms.v1.CryptoKeyVersion.algorithm that accepts - * additional authenticated data (for example, AES-GCM). - * The maximum size depends on the key version's - * protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level. - * For SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE keys, the - * plaintext must be no larger than 64KiB. For - * HSM google.cloud.kms.v1.ProtectionLevel.HSM keys, the combined length of - * the plaintext and additional_authenticated_data fields must be no larger - * than 8KiB. - */ - // const additionalAuthenticatedData = Buffer.from('string') - /** - * Optional. An optional CRC32C checksum of the - * RawEncryptRequest.plaintext google.cloud.kms.v1.RawEncryptRequest.plaintext. - * If specified, - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * verify the integrity of the received plaintext using this checksum. - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that CRC32C(plaintext) is equal - * to plaintext_crc32c, and if so, perform a limited number of retries. A - * persistent mismatch may indicate an issue in your computation of the CRC32C - * checksum. Note: This field is defined as int64 for reasons of compatibility - * across different languages. However, it is a non-negative integer, which - * will never exceed 2^32-1, and can be safely downconverted to uint32 in - * languages that support this type. - */ - // const plaintextCrc32c = {} - /** - * Optional. An optional CRC32C checksum of the - * RawEncryptRequest.additional_authenticated_data google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data. - * If specified, - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * verify the integrity of the received additional_authenticated_data using - * this checksum. - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(additional_authenticated_data) is equal to - * additional_authenticated_data_crc32c, and if so, perform - * a limited number of retries. A persistent mismatch may indicate an issue in - * your computation of the CRC32C checksum. - * Note: This field is defined as int64 for reasons of compatibility across - * different languages. However, it is a non-negative integer, which will - * never exceed 2^32-1, and can be safely downconverted to uint32 in languages - * that support this type. - */ - // const additionalAuthenticatedDataCrc32c = {} - /** - * Optional. A customer-supplied initialization vector that will be used for - * encryption. If it is not provided for AES-CBC and AES-CTR, one will be - * generated. It will be returned in - * RawEncryptResponse.initialization_vector google.cloud.kms.v1.RawEncryptResponse.initialization_vector. - */ - // const initializationVector = Buffer.from('string') - /** - * Optional. An optional CRC32C checksum of the - * RawEncryptRequest.initialization_vector google.cloud.kms.v1.RawEncryptRequest.initialization_vector. - * If specified, - * KeyManagementService google.cloud.kms.v1.KeyManagementService will - * verify the integrity of the received initialization_vector using this - * checksum. KeyManagementService google.cloud.kms.v1.KeyManagementService - * will report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(initialization_vector) is equal to - * initialization_vector_crc32c, and if so, perform - * a limited number of retries. A persistent mismatch may indicate an issue in - * your computation of the CRC32C checksum. - * Note: This field is defined as int64 for reasons of compatibility across - * different languages. However, it is a non-negative integer, which will - * never exceed 2^32-1, and can be safely downconverted to uint32 in languages - * that support this type. - */ - // const initializationVectorCrc32c = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callRawEncrypt() { - // Construct request - const request = { - name, - plaintext, - }; - - // Run request - const response = await kmsClient.rawEncrypt(request); - console.log(response); - } - - callRawEncrypt(); - // [END cloudkms_v1_generated_KeyManagementService_RawEncrypt_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-kms/v1/samples/generated/v1/key_management_service.restore_crypto_key_version.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.restore_crypto_key_version.js deleted file mode 100644 index a3133d23f8e..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.restore_crypto_key_version.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 cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to restore. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callRestoreCryptoKeyVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await kmsClient.restoreCryptoKeyVersion(request); - console.log(response); - } - - callRestoreCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key.js deleted file mode 100644 index cafb6efa4ad..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key.js +++ /dev/null @@ -1,66 +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(cryptoKey, updateMask) { - // [START cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. CryptoKey google.cloud.kms.v1.CryptoKey with updated values. - */ - // const cryptoKey = {} - /** - * Required. List of fields to be updated in this request. - */ - // const updateMask = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callUpdateCryptoKey() { - // Construct request - const request = { - cryptoKey, - updateMask, - }; - - // Run request - const response = await kmsClient.updateCryptoKey(request); - console.log(response); - } - - callUpdateCryptoKey(); - // [END cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js deleted file mode 100644 index de28c966352..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js +++ /dev/null @@ -1,68 +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, cryptoKeyVersionId) { - // [START cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the - * CryptoKey google.cloud.kms.v1.CryptoKey to update. - */ - // const name = 'abc123' - /** - * Required. The id of the child - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use as primary. - */ - // const cryptoKeyVersionId = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callUpdateCryptoKeyPrimaryVersion() { - // Construct request - const request = { - name, - cryptoKeyVersionId, - }; - - // Run request - const response = await kmsClient.updateCryptoKeyPrimaryVersion(request); - console.log(response); - } - - callUpdateCryptoKeyPrimaryVersion(); - // [END cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key_version.js b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key_version.js deleted file mode 100644 index 309d3911278..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/key_management_service.update_crypto_key_version.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(cryptoKeyVersion, updateMask) { - // [START cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion with - * updated values. - */ - // const cryptoKeyVersion = {} - /** - * Required. List of fields to be updated in this request. - */ - // const updateMask = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callUpdateCryptoKeyVersion() { - // Construct request - const request = { - cryptoKeyVersion, - updateMask, - }; - - // Run request - const response = await kmsClient.updateCryptoKeyVersion(request); - console.log(response); - } - - callUpdateCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/snippet_metadata_google.cloud.kms.v1.json b/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/snippet_metadata_google.cloud.kms.v1.json deleted file mode 100644 index da9b7bd30e7..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/samples/generated/v1/snippet_metadata_google.cloud.kms.v1.json +++ /dev/null @@ -1,1723 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-kms", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.kms.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudkms_v1_generated_EkmService_ListEkmConnections_async", - "title": "EkmService listEkmConnections Sample", - "origin": "API_DEFINITION", - "description": " Lists [EkmConnections][google.cloud.kms.v1.EkmConnection].", - "canonical": true, - "file": "ekm_service.list_ekm_connections.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 86, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListEkmConnections", - "fullName": "google.cloud.kms.v1.EkmService.ListEkmConnections", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.ListEkmConnectionsResponse", - "client": { - "shortName": "EkmServiceClient", - "fullName": "google.cloud.kms.v1.EkmServiceClient" - }, - "method": { - "shortName": "ListEkmConnections", - "fullName": "google.cloud.kms.v1.EkmService.ListEkmConnections", - "service": { - "shortName": "EkmService", - "fullName": "google.cloud.kms.v1.EkmService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_EkmService_GetEkmConnection_async", - "title": "EkmService getEkmConnection Sample", - "origin": "API_DEFINITION", - "description": " Returns metadata for a given [EkmConnection][google.cloud.kms.v1.EkmConnection].", - "canonical": true, - "file": "ekm_service.get_ekm_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetEkmConnection", - "fullName": "google.cloud.kms.v1.EkmService.GetEkmConnection", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.EkmConnection", - "client": { - "shortName": "EkmServiceClient", - "fullName": "google.cloud.kms.v1.EkmServiceClient" - }, - "method": { - "shortName": "GetEkmConnection", - "fullName": "google.cloud.kms.v1.EkmService.GetEkmConnection", - "service": { - "shortName": "EkmService", - "fullName": "google.cloud.kms.v1.EkmService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_EkmService_CreateEkmConnection_async", - "title": "EkmService createEkmConnection Sample", - "origin": "API_DEFINITION", - "description": " Creates a new [EkmConnection][google.cloud.kms.v1.EkmConnection] in a given Project and Location.", - "canonical": true, - "file": "ekm_service.create_ekm_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateEkmConnection", - "fullName": "google.cloud.kms.v1.EkmService.CreateEkmConnection", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "ekm_connection_id", - "type": "TYPE_STRING" - }, - { - "name": "ekm_connection", - "type": ".google.cloud.kms.v1.EkmConnection" - } - ], - "resultType": ".google.cloud.kms.v1.EkmConnection", - "client": { - "shortName": "EkmServiceClient", - "fullName": "google.cloud.kms.v1.EkmServiceClient" - }, - "method": { - "shortName": "CreateEkmConnection", - "fullName": "google.cloud.kms.v1.EkmService.CreateEkmConnection", - "service": { - "shortName": "EkmService", - "fullName": "google.cloud.kms.v1.EkmService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_EkmService_UpdateEkmConnection_async", - "title": "EkmService updateEkmConnection Sample", - "origin": "API_DEFINITION", - "description": " Updates an [EkmConnection][google.cloud.kms.v1.EkmConnection]'s metadata.", - "canonical": true, - "file": "ekm_service.update_ekm_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateEkmConnection", - "fullName": "google.cloud.kms.v1.EkmService.UpdateEkmConnection", - "async": true, - "parameters": [ - { - "name": "ekm_connection", - "type": ".google.cloud.kms.v1.EkmConnection" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.kms.v1.EkmConnection", - "client": { - "shortName": "EkmServiceClient", - "fullName": "google.cloud.kms.v1.EkmServiceClient" - }, - "method": { - "shortName": "UpdateEkmConnection", - "fullName": "google.cloud.kms.v1.EkmService.UpdateEkmConnection", - "service": { - "shortName": "EkmService", - "fullName": "google.cloud.kms.v1.EkmService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_EkmService_GetEkmConfig_async", - "title": "EkmService getEkmConfig Sample", - "origin": "API_DEFINITION", - "description": " Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project and location.", - "canonical": true, - "file": "ekm_service.get_ekm_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetEkmConfig", - "fullName": "google.cloud.kms.v1.EkmService.GetEkmConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.EkmConfig", - "client": { - "shortName": "EkmServiceClient", - "fullName": "google.cloud.kms.v1.EkmServiceClient" - }, - "method": { - "shortName": "GetEkmConfig", - "fullName": "google.cloud.kms.v1.EkmService.GetEkmConfig", - "service": { - "shortName": "EkmService", - "fullName": "google.cloud.kms.v1.EkmService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_EkmService_UpdateEkmConfig_async", - "title": "EkmService updateEkmConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project and location.", - "canonical": true, - "file": "ekm_service.update_ekm_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateEkmConfig", - "fullName": "google.cloud.kms.v1.EkmService.UpdateEkmConfig", - "async": true, - "parameters": [ - { - "name": "ekm_config", - "type": ".google.cloud.kms.v1.EkmConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.kms.v1.EkmConfig", - "client": { - "shortName": "EkmServiceClient", - "fullName": "google.cloud.kms.v1.EkmServiceClient" - }, - "method": { - "shortName": "UpdateEkmConfig", - "fullName": "google.cloud.kms.v1.EkmService.UpdateEkmConfig", - "service": { - "shortName": "EkmService", - "fullName": "google.cloud.kms.v1.EkmService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_EkmService_VerifyConnectivity_async", - "title": "EkmService verifyConnectivity Sample", - "origin": "API_DEFINITION", - "description": " Verifies that Cloud KMS can successfully connect to the external key manager specified by an [EkmConnection][google.cloud.kms.v1.EkmConnection]. If there is an error connecting to the EKM, this method returns a FAILED_PRECONDITION status containing structured information as described at https://cloud.google.com/kms/docs/reference/ekm_errors.", - "canonical": true, - "file": "ekm_service.verify_connectivity.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "VerifyConnectivity", - "fullName": "google.cloud.kms.v1.EkmService.VerifyConnectivity", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.VerifyConnectivityResponse", - "client": { - "shortName": "EkmServiceClient", - "fullName": "google.cloud.kms.v1.EkmServiceClient" - }, - "method": { - "shortName": "VerifyConnectivity", - "fullName": "google.cloud.kms.v1.EkmService.VerifyConnectivity", - "service": { - "shortName": "EkmService", - "fullName": "google.cloud.kms.v1.EkmService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_ListKeyRings_async", - "title": "EkmService listKeyRings Sample", - "origin": "API_DEFINITION", - "description": " Lists [KeyRings][google.cloud.kms.v1.KeyRing].", - "canonical": true, - "file": "key_management_service.list_key_rings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 86, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListKeyRings", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListKeyRings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.ListKeyRingsResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "ListKeyRings", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListKeyRings", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async", - "title": "EkmService listCryptoKeys Sample", - "origin": "API_DEFINITION", - "description": " Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].", - "canonical": true, - "file": "key_management_service.list_crypto_keys.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 89, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCryptoKeys", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeys", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "version_view", - "type": ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.ListCryptoKeysResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "ListCryptoKeys", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeys", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async", - "title": "EkmService listCryptoKeyVersions Sample", - "origin": "API_DEFINITION", - "description": " Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].", - "canonical": true, - "file": "key_management_service.list_crypto_key_versions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 90, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCryptoKeyVersions", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.ListCryptoKeyVersionsResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "ListCryptoKeyVersions", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_ListImportJobs_async", - "title": "EkmService listImportJobs Sample", - "origin": "API_DEFINITION", - "description": " Lists [ImportJobs][google.cloud.kms.v1.ImportJob].", - "canonical": true, - "file": "key_management_service.list_import_jobs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListImportJobs", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListImportJobs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.ListImportJobsResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "ListImportJobs", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListImportJobs", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_GetKeyRing_async", - "title": "EkmService getKeyRing Sample", - "origin": "API_DEFINITION", - "description": " Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].", - "canonical": true, - "file": "key_management_service.get_key_ring.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetKeyRing", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetKeyRing", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.KeyRing", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "GetKeyRing", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetKeyRing", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async", - "title": "EkmService getCryptoKey Sample", - "origin": "API_DEFINITION", - "description": " Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].", - "canonical": true, - "file": "key_management_service.get_crypto_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKey", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKey", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "GetCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKey", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async", - "title": "EkmService getCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].", - "canonical": true, - "file": "key_management_service.get_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "GetCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_GetPublicKey_async", - "title": "EkmService getPublicKey Sample", - "origin": "API_DEFINITION", - "description": " Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].", - "canonical": true, - "file": "key_management_service.get_public_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetPublicKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetPublicKey", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.PublicKey", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "GetPublicKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetPublicKey", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_GetImportJob_async", - "title": "EkmService getImportJob Sample", - "origin": "API_DEFINITION", - "description": " Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].", - "canonical": true, - "file": "key_management_service.get_import_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetImportJob", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetImportJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.ImportJob", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "GetImportJob", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetImportJob", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async", - "title": "EkmService createKeyRing Sample", - "origin": "API_DEFINITION", - "description": " Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.", - "canonical": true, - "file": "key_management_service.create_key_ring.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateKeyRing", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateKeyRing", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "key_ring_id", - "type": "TYPE_STRING" - }, - { - "name": "key_ring", - "type": ".google.cloud.kms.v1.KeyRing" - } - ], - "resultType": ".google.cloud.kms.v1.KeyRing", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "CreateKeyRing", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateKeyRing", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async", - "title": "EkmService createCryptoKey Sample", - "origin": "API_DEFINITION", - "description": " Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing]. [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.", - "canonical": true, - "file": "key_management_service.create_crypto_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKey", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "crypto_key_id", - "type": "TYPE_STRING" - }, - { - "name": "crypto_key", - "type": ".google.cloud.kms.v1.CryptoKey" - }, - { - "name": "skip_initial_version_creation", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKey", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "CreateCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKey", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async", - "title": "EkmService createCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey]. The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].", - "canonical": true, - "file": "key_management_service.create_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "crypto_key_version", - "type": ".google.cloud.kms.v1.CryptoKeyVersion" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "CreateCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async", - "title": "EkmService importCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Import wrapped key material into a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. All requests must specify a [CryptoKey][google.cloud.kms.v1.CryptoKey]. If a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] is additionally specified in the request, key material will be reimported into that version. Otherwise, a new version will be created, and will be assigned the next sequential id within the [CryptoKey][google.cloud.kms.v1.CryptoKey].", - "canonical": true, - "file": "key_management_service.import_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 137, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "crypto_key_version", - "type": "TYPE_STRING" - }, - { - "name": "algorithm", - "type": ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm" - }, - { - "name": "import_job", - "type": "TYPE_STRING" - }, - { - "name": "wrapped_key", - "type": "TYPE_BYTES" - }, - { - "name": "rsa_aes_wrapped_key", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "ImportCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateImportJob_async", - "title": "EkmService createImportJob Sample", - "origin": "API_DEFINITION", - "description": " Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing]. [ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.", - "canonical": true, - "file": "key_management_service.create_import_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateImportJob", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateImportJob", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "import_job_id", - "type": "TYPE_STRING" - }, - { - "name": "import_job", - "type": ".google.cloud.kms.v1.ImportJob" - } - ], - "resultType": ".google.cloud.kms.v1.ImportJob", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "CreateImportJob", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateImportJob", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async", - "title": "EkmService updateCryptoKey Sample", - "origin": "API_DEFINITION", - "description": " Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].", - "canonical": true, - "file": "key_management_service.update_crypto_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey", - "async": true, - "parameters": [ - { - "name": "crypto_key", - "type": ".google.cloud.kms.v1.CryptoKey" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKey", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "UpdateCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async", - "title": "EkmService updateCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata. [state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to move between other states.", - "canonical": true, - "file": "key_management_service.update_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "crypto_key_version", - "type": ".google.cloud.kms.v1.CryptoKeyVersion" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "UpdateCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async", - "title": "EkmService updateCryptoKeyPrimaryVersion Sample", - "origin": "API_DEFINITION", - "description": " Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].", - "canonical": true, - "file": "key_management_service.update_crypto_key_primary_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCryptoKeyPrimaryVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "crypto_key_version_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKey", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "UpdateCryptoKeyPrimaryVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async", - "title": "EkmService destroyCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction. Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to the time [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] in the future. At that time, the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will automatically change to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed. Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.", - "canonical": true, - "file": "key_management_service.destroy_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DestroyCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "DestroyCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async", - "title": "EkmService restoreCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state. Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.", - "canonical": true, - "file": "key_management_service.restore_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RestoreCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "RestoreCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_Encrypt_async", - "title": "EkmService encrypt Sample", - "origin": "API_DEFINITION", - "description": " Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].", - "canonical": true, - "file": "key_management_service.encrypt.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 131, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Encrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.Encrypt", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "plaintext", - "type": "TYPE_BYTES" - }, - { - "name": "additional_authenticated_data", - "type": "TYPE_BYTES" - }, - { - "name": "plaintext_crc32c", - "type": ".google.protobuf.Int64Value" - }, - { - "name": "additional_authenticated_data_crc32c", - "type": ".google.protobuf.Int64Value" - } - ], - "resultType": ".google.cloud.kms.v1.EncryptResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "Encrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.Encrypt", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_Decrypt_async", - "title": "EkmService decrypt Sample", - "origin": "API_DEFINITION", - "description": " Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].", - "canonical": true, - "file": "key_management_service.decrypt.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 110, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Decrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.Decrypt", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "ciphertext", - "type": "TYPE_BYTES" - }, - { - "name": "additional_authenticated_data", - "type": "TYPE_BYTES" - }, - { - "name": "ciphertext_crc32c", - "type": ".google.protobuf.Int64Value" - }, - { - "name": "additional_authenticated_data_crc32c", - "type": ".google.protobuf.Int64Value" - } - ], - "resultType": ".google.cloud.kms.v1.DecryptResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "Decrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.Decrypt", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_RawEncrypt_async", - "title": "EkmService rawEncrypt Sample", - "origin": "API_DEFINITION", - "description": " Encrypts data using portable cryptographic primitives. Most users should choose [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt] rather than their raw counterparts. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [RAW_ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT].", - "canonical": true, - "file": "key_management_service.raw_encrypt.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 146, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RawEncrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.RawEncrypt", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "plaintext", - "type": "TYPE_BYTES" - }, - { - "name": "additional_authenticated_data", - "type": "TYPE_BYTES" - }, - { - "name": "plaintext_crc32c", - "type": ".google.protobuf.Int64Value" - }, - { - "name": "additional_authenticated_data_crc32c", - "type": ".google.protobuf.Int64Value" - }, - { - "name": "initialization_vector", - "type": "TYPE_BYTES" - }, - { - "name": "initialization_vector_crc32c", - "type": ".google.protobuf.Int64Value" - } - ], - "resultType": ".google.cloud.kms.v1.RawEncryptResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "RawEncrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.RawEncrypt", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_RawDecrypt_async", - "title": "EkmService rawDecrypt Sample", - "origin": "API_DEFINITION", - "description": " Decrypts data that was originally encrypted using a raw cryptographic mechanism. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [RAW_ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT].", - "canonical": true, - "file": "key_management_service.raw_decrypt.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 134, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RawDecrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.RawDecrypt", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "ciphertext", - "type": "TYPE_BYTES" - }, - { - "name": "additional_authenticated_data", - "type": "TYPE_BYTES" - }, - { - "name": "initialization_vector", - "type": "TYPE_BYTES" - }, - { - "name": "tag_length", - "type": "TYPE_INT32" - }, - { - "name": "ciphertext_crc32c", - "type": ".google.protobuf.Int64Value" - }, - { - "name": "additional_authenticated_data_crc32c", - "type": ".google.protobuf.Int64Value" - }, - { - "name": "initialization_vector_crc32c", - "type": ".google.protobuf.Int64Value" - } - ], - "resultType": ".google.cloud.kms.v1.RawDecryptResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "RawDecrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.RawDecrypt", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async", - "title": "EkmService asymmetricSign Sample", - "origin": "API_DEFINITION", - "description": " Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].", - "canonical": true, - "file": "key_management_service.asymmetric_sign.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 115, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AsymmetricSign", - "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricSign", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "digest", - "type": ".google.cloud.kms.v1.Digest" - }, - { - "name": "digest_crc32c", - "type": ".google.protobuf.Int64Value" - }, - { - "name": "data", - "type": "TYPE_BYTES" - }, - { - "name": "data_crc32c", - "type": ".google.protobuf.Int64Value" - } - ], - "resultType": ".google.cloud.kms.v1.AsymmetricSignResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "AsymmetricSign", - "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricSign", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async", - "title": "EkmService asymmetricDecrypt Sample", - "origin": "API_DEFINITION", - "description": " Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.", - "canonical": true, - "file": "key_management_service.asymmetric_decrypt.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AsymmetricDecrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "ciphertext", - "type": "TYPE_BYTES" - }, - { - "name": "ciphertext_crc32c", - "type": ".google.protobuf.Int64Value" - } - ], - "resultType": ".google.cloud.kms.v1.AsymmetricDecryptResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "AsymmetricDecrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_MacSign_async", - "title": "EkmService macSign Sample", - "origin": "API_DEFINITION", - "description": " Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, producing a tag that can be verified by another source with the same key.", - "canonical": true, - "file": "key_management_service.mac_sign.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 81, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "MacSign", - "fullName": "google.cloud.kms.v1.KeyManagementService.MacSign", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "data", - "type": "TYPE_BYTES" - }, - { - "name": "data_crc32c", - "type": ".google.protobuf.Int64Value" - } - ], - "resultType": ".google.cloud.kms.v1.MacSignResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "MacSign", - "fullName": "google.cloud.kms.v1.KeyManagementService.MacSign", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_MacVerify_async", - "title": "EkmService macVerify Sample", - "origin": "API_DEFINITION", - "description": " Verifies MAC tag using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, and returns a response that indicates whether or not the verification was successful.", - "canonical": true, - "file": "key_management_service.mac_verify.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 107, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "MacVerify", - "fullName": "google.cloud.kms.v1.KeyManagementService.MacVerify", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "data", - "type": "TYPE_BYTES" - }, - { - "name": "data_crc32c", - "type": ".google.protobuf.Int64Value" - }, - { - "name": "mac", - "type": "TYPE_BYTES" - }, - { - "name": "mac_crc32c", - "type": ".google.protobuf.Int64Value" - } - ], - "resultType": ".google.cloud.kms.v1.MacVerifyResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "MacVerify", - "fullName": "google.cloud.kms.v1.KeyManagementService.MacVerify", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_GenerateRandomBytes_async", - "title": "EkmService generateRandomBytes Sample", - "origin": "API_DEFINITION", - "description": " Generate random bytes using the Cloud KMS randomness source in the provided location.", - "canonical": true, - "file": "key_management_service.generate_random_bytes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateRandomBytes", - "fullName": "google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes", - "async": true, - "parameters": [ - { - "name": "location", - "type": "TYPE_STRING" - }, - { - "name": "length_bytes", - "type": "TYPE_INT32" - }, - { - "name": "protection_level", - "type": ".google.cloud.kms.v1.ProtectionLevel" - } - ], - "resultType": ".google.cloud.kms.v1.GenerateRandomBytesResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "GenerateRandomBytes", - "fullName": "google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-kms/v1/src/index.ts b/owl-bot-staging/google-cloud-kms/v1/src/index.ts deleted file mode 100644 index 917816886be..00000000000 --- a/owl-bot-staging/google-cloud-kms/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 EkmServiceClient = v1.EkmServiceClient; -type EkmServiceClient = v1.EkmServiceClient; -const KeyManagementServiceClient = v1.KeyManagementServiceClient; -type KeyManagementServiceClient = v1.KeyManagementServiceClient; -export {v1, EkmServiceClient, KeyManagementServiceClient}; -export default {v1, EkmServiceClient, KeyManagementServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_client.ts b/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_client.ts deleted file mode 100644 index b6d9a581ab6..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_client.ts +++ /dev/null @@ -1,1696 +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, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/ekm_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './ekm_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Google Cloud Key Management EKM Service - * - * Manages external cryptographic keys and operations using those keys. - * Implements a REST model with the following objects: - * * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection} - * @class - * @memberof v1 - */ -export class EkmServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - ekmServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of EkmServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new EkmServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof EkmServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // 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; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' - ), - cryptoKeyVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}' - ), - ekmConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/ekmConfig' - ), - ekmConnectionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/ekmConnections/{ekm_connection}' - ), - importJobPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}' - ), - keyRingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - publicKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/publicKey' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listEkmConnections: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'ekmConnections') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.kms.v1.EkmService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.ekmServiceStub) { - return this.ekmServiceStub; - } - - // Put together the "service stub" for - // google.cloud.kms.v1.EkmService. - this.ekmServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.kms.v1.EkmService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.kms.v1.EkmService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const ekmServiceStubMethods = - ['listEkmConnections', 'getEkmConnection', 'createEkmConnection', 'updateEkmConnection', 'getEkmConfig', 'updateEkmConfig', 'verifyConnectivity']; - for (const methodName of ekmServiceStubMethods) { - const callPromise = this.ekmServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.ekmServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'cloudkms.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'cloudkms.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloudkms' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Returns metadata for a given - * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The {@link protos.google.cloud.kms.v1.EkmConnection.name|name} of the - * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection} to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/ekm_service.get_ekm_connection.js - * region_tag:cloudkms_v1_generated_EkmService_GetEkmConnection_async - */ - getEkmConnection( - request?: protos.google.cloud.kms.v1.IGetEkmConnectionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.IGetEkmConnectionRequest|undefined, {}|undefined - ]>; - getEkmConnection( - request: protos.google.cloud.kms.v1.IGetEkmConnectionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.IGetEkmConnectionRequest|null|undefined, - {}|null|undefined>): void; - getEkmConnection( - request: protos.google.cloud.kms.v1.IGetEkmConnectionRequest, - callback: Callback< - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.IGetEkmConnectionRequest|null|undefined, - {}|null|undefined>): void; - getEkmConnection( - request?: protos.google.cloud.kms.v1.IGetEkmConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.IGetEkmConnectionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.IGetEkmConnectionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.IGetEkmConnectionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getEkmConnection(request, options, callback); - } -/** - * Creates a new {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection} in a given - * Project and Location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location associated with the - * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}, in the format - * `projects/* /locations/*`. - * @param {string} request.ekmConnectionId - * Required. It must be unique within a location and match the regular - * expression `[a-zA-Z0-9_-]{1,63}`. - * @param {google.cloud.kms.v1.EkmConnection} request.ekmConnection - * Required. An {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection} with - * initial field values. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/ekm_service.create_ekm_connection.js - * region_tag:cloudkms_v1_generated_EkmService_CreateEkmConnection_async - */ - createEkmConnection( - request?: protos.google.cloud.kms.v1.ICreateEkmConnectionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.ICreateEkmConnectionRequest|undefined, {}|undefined - ]>; - createEkmConnection( - request: protos.google.cloud.kms.v1.ICreateEkmConnectionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.ICreateEkmConnectionRequest|null|undefined, - {}|null|undefined>): void; - createEkmConnection( - request: protos.google.cloud.kms.v1.ICreateEkmConnectionRequest, - callback: Callback< - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.ICreateEkmConnectionRequest|null|undefined, - {}|null|undefined>): void; - createEkmConnection( - request?: protos.google.cloud.kms.v1.ICreateEkmConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.ICreateEkmConnectionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.ICreateEkmConnectionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.ICreateEkmConnectionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createEkmConnection(request, options, callback); - } -/** - * Updates an {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}'s metadata. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.kms.v1.EkmConnection} request.ekmConnection - * Required. {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection} with updated - * values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. List of fields to be updated in this request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/ekm_service.update_ekm_connection.js - * region_tag:cloudkms_v1_generated_EkmService_UpdateEkmConnection_async - */ - updateEkmConnection( - request?: protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest|undefined, {}|undefined - ]>; - updateEkmConnection( - request: protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest|null|undefined, - {}|null|undefined>): void; - updateEkmConnection( - request: protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest, - callback: Callback< - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest|null|undefined, - {}|null|undefined>): void; - updateEkmConnection( - request?: protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IEkmConnection, - protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'ekm_connection.name': request.ekmConnection!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateEkmConnection(request, options, callback); - } -/** - * Returns the {@link protos.google.cloud.kms.v1.EkmConfig|EkmConfig} singleton resource - * for a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The {@link protos.google.cloud.kms.v1.EkmConfig.name|name} of the - * {@link protos.google.cloud.kms.v1.EkmConfig|EkmConfig} to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.EkmConfig|EkmConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/ekm_service.get_ekm_config.js - * region_tag:cloudkms_v1_generated_EkmService_GetEkmConfig_async - */ - getEkmConfig( - request?: protos.google.cloud.kms.v1.IGetEkmConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IEkmConfig, - protos.google.cloud.kms.v1.IGetEkmConfigRequest|undefined, {}|undefined - ]>; - getEkmConfig( - request: protos.google.cloud.kms.v1.IGetEkmConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IEkmConfig, - protos.google.cloud.kms.v1.IGetEkmConfigRequest|null|undefined, - {}|null|undefined>): void; - getEkmConfig( - request: protos.google.cloud.kms.v1.IGetEkmConfigRequest, - callback: Callback< - protos.google.cloud.kms.v1.IEkmConfig, - protos.google.cloud.kms.v1.IGetEkmConfigRequest|null|undefined, - {}|null|undefined>): void; - getEkmConfig( - request?: protos.google.cloud.kms.v1.IGetEkmConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IEkmConfig, - protos.google.cloud.kms.v1.IGetEkmConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IEkmConfig, - protos.google.cloud.kms.v1.IGetEkmConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IEkmConfig, - protos.google.cloud.kms.v1.IGetEkmConfigRequest|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.getEkmConfig(request, options, callback); - } -/** - * Updates the {@link protos.google.cloud.kms.v1.EkmConfig|EkmConfig} singleton resource - * for a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.kms.v1.EkmConfig} request.ekmConfig - * Required. {@link protos.google.cloud.kms.v1.EkmConfig|EkmConfig} with updated values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. List of fields to be updated in this request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.EkmConfig|EkmConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/ekm_service.update_ekm_config.js - * region_tag:cloudkms_v1_generated_EkmService_UpdateEkmConfig_async - */ - updateEkmConfig( - request?: protos.google.cloud.kms.v1.IUpdateEkmConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IEkmConfig, - protos.google.cloud.kms.v1.IUpdateEkmConfigRequest|undefined, {}|undefined - ]>; - updateEkmConfig( - request: protos.google.cloud.kms.v1.IUpdateEkmConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IEkmConfig, - protos.google.cloud.kms.v1.IUpdateEkmConfigRequest|null|undefined, - {}|null|undefined>): void; - updateEkmConfig( - request: protos.google.cloud.kms.v1.IUpdateEkmConfigRequest, - callback: Callback< - protos.google.cloud.kms.v1.IEkmConfig, - protos.google.cloud.kms.v1.IUpdateEkmConfigRequest|null|undefined, - {}|null|undefined>): void; - updateEkmConfig( - request?: protos.google.cloud.kms.v1.IUpdateEkmConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IEkmConfig, - protos.google.cloud.kms.v1.IUpdateEkmConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IEkmConfig, - protos.google.cloud.kms.v1.IUpdateEkmConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IEkmConfig, - protos.google.cloud.kms.v1.IUpdateEkmConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'ekm_config.name': request.ekmConfig!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateEkmConfig(request, options, callback); - } -/** - * Verifies that Cloud KMS can successfully connect to the external key - * manager specified by an {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}. - * If there is an error connecting to the EKM, this method returns a - * FAILED_PRECONDITION status containing structured information as described - * at https://cloud.google.com/kms/docs/reference/ekm_errors. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The {@link protos.google.cloud.kms.v1.EkmConnection.name|name} of the - * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection} to verify. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.kms.v1.VerifyConnectivityResponse|VerifyConnectivityResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/ekm_service.verify_connectivity.js - * region_tag:cloudkms_v1_generated_EkmService_VerifyConnectivity_async - */ - verifyConnectivity( - request?: protos.google.cloud.kms.v1.IVerifyConnectivityRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IVerifyConnectivityResponse, - protos.google.cloud.kms.v1.IVerifyConnectivityRequest|undefined, {}|undefined - ]>; - verifyConnectivity( - request: protos.google.cloud.kms.v1.IVerifyConnectivityRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IVerifyConnectivityResponse, - protos.google.cloud.kms.v1.IVerifyConnectivityRequest|null|undefined, - {}|null|undefined>): void; - verifyConnectivity( - request: protos.google.cloud.kms.v1.IVerifyConnectivityRequest, - callback: Callback< - protos.google.cloud.kms.v1.IVerifyConnectivityResponse, - protos.google.cloud.kms.v1.IVerifyConnectivityRequest|null|undefined, - {}|null|undefined>): void; - verifyConnectivity( - request?: protos.google.cloud.kms.v1.IVerifyConnectivityRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IVerifyConnectivityResponse, - protos.google.cloud.kms.v1.IVerifyConnectivityRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IVerifyConnectivityResponse, - protos.google.cloud.kms.v1.IVerifyConnectivityRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IVerifyConnectivityResponse, - protos.google.cloud.kms.v1.IVerifyConnectivityRequest|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.verifyConnectivity(request, options, callback); - } - - /** - * Lists {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location associated with the - * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} to list, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Optional limit on the number of - * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} to include in the - * response. Further {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} can - * subsequently be obtained by including the - * {@link protos.google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token} - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - * @param {string} [request.pageToken] - * Optional. Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For - * more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listEkmConnectionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listEkmConnections( - request?: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IEkmConnection[], - protos.google.cloud.kms.v1.IListEkmConnectionsRequest|null, - protos.google.cloud.kms.v1.IListEkmConnectionsResponse - ]>; - listEkmConnections( - request: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListEkmConnectionsRequest, - protos.google.cloud.kms.v1.IListEkmConnectionsResponse|null|undefined, - protos.google.cloud.kms.v1.IEkmConnection>): void; - listEkmConnections( - request: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListEkmConnectionsRequest, - protos.google.cloud.kms.v1.IListEkmConnectionsResponse|null|undefined, - protos.google.cloud.kms.v1.IEkmConnection>): void; - listEkmConnections( - request?: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.kms.v1.IListEkmConnectionsRequest, - protos.google.cloud.kms.v1.IListEkmConnectionsResponse|null|undefined, - protos.google.cloud.kms.v1.IEkmConnection>, - callback?: PaginationCallback< - protos.google.cloud.kms.v1.IListEkmConnectionsRequest, - protos.google.cloud.kms.v1.IListEkmConnectionsResponse|null|undefined, - protos.google.cloud.kms.v1.IEkmConnection>): - Promise<[ - protos.google.cloud.kms.v1.IEkmConnection[], - protos.google.cloud.kms.v1.IListEkmConnectionsRequest|null, - protos.google.cloud.kms.v1.IListEkmConnectionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listEkmConnections(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location associated with the - * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} to list, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Optional limit on the number of - * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} to include in the - * response. Further {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} can - * subsequently be obtained by including the - * {@link protos.google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token} - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - * @param {string} [request.pageToken] - * Optional. Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For - * more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listEkmConnectionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listEkmConnectionsStream( - request?: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listEkmConnections']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listEkmConnections.createStream( - this.innerApiCalls.listEkmConnections as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listEkmConnections`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location associated with the - * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} to list, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Optional limit on the number of - * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} to include in the - * response. Further {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnections} can - * subsequently be obtained by including the - * {@link protos.google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token} - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - * @param {string} [request.pageToken] - * Optional. Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For - * more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.kms.v1.EkmConnection|EkmConnection}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/ekm_service.list_ekm_connections.js - * region_tag:cloudkms_v1_generated_EkmService_ListEkmConnections_async - */ - listEkmConnectionsAsync( - request?: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listEkmConnections']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listEkmConnections.asyncIterate( - this.innerApiCalls['listEkmConnections'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified cryptoKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @returns {string} Resource name string. - */ - cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { - return this.pathTemplates.cryptoKeyPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - }); - } - - /** - * Parse the project from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; - } - - /** - * Parse the location from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; - } - - /** - * Parse the key_ring from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; - } - - /** - * Parse the crypto_key from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; - } - - /** - * Return a fully-qualified cryptoKeyVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @param {string} crypto_key_version - * @returns {string} Resource name string. - */ - cryptoKeyVersionPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - crypto_key_version: cryptoKeyVersion, - }); - } - - /** - * Parse the project from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).project; - } - - /** - * Parse the location from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).location; - } - - /** - * Parse the key_ring from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).key_ring; - } - - /** - * Parse the crypto_key from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).crypto_key; - } - - /** - * Parse the crypto_key_version from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the crypto_key_version. - */ - matchCryptoKeyVersionFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).crypto_key_version; - } - - /** - * Return a fully-qualified ekmConfig resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - ekmConfigPath(project:string,location:string) { - return this.pathTemplates.ekmConfigPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from EkmConfig resource. - * - * @param {string} ekmConfigName - * A fully-qualified path representing EkmConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromEkmConfigName(ekmConfigName: string) { - return this.pathTemplates.ekmConfigPathTemplate.match(ekmConfigName).project; - } - - /** - * Parse the location from EkmConfig resource. - * - * @param {string} ekmConfigName - * A fully-qualified path representing EkmConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromEkmConfigName(ekmConfigName: string) { - return this.pathTemplates.ekmConfigPathTemplate.match(ekmConfigName).location; - } - - /** - * Return a fully-qualified ekmConnection resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} ekm_connection - * @returns {string} Resource name string. - */ - ekmConnectionPath(project:string,location:string,ekmConnection:string) { - return this.pathTemplates.ekmConnectionPathTemplate.render({ - project: project, - location: location, - ekm_connection: ekmConnection, - }); - } - - /** - * Parse the project from EkmConnection resource. - * - * @param {string} ekmConnectionName - * A fully-qualified path representing EkmConnection resource. - * @returns {string} A string representing the project. - */ - matchProjectFromEkmConnectionName(ekmConnectionName: string) { - return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName).project; - } - - /** - * Parse the location from EkmConnection resource. - * - * @param {string} ekmConnectionName - * A fully-qualified path representing EkmConnection resource. - * @returns {string} A string representing the location. - */ - matchLocationFromEkmConnectionName(ekmConnectionName: string) { - return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName).location; - } - - /** - * Parse the ekm_connection from EkmConnection resource. - * - * @param {string} ekmConnectionName - * A fully-qualified path representing EkmConnection resource. - * @returns {string} A string representing the ekm_connection. - */ - matchEkmConnectionFromEkmConnectionName(ekmConnectionName: string) { - return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName).ekm_connection; - } - - /** - * Return a fully-qualified importJob resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} import_job - * @returns {string} Resource name string. - */ - importJobPath(project:string,location:string,keyRing:string,importJob:string) { - return this.pathTemplates.importJobPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - import_job: importJob, - }); - } - - /** - * Parse the project from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the project. - */ - matchProjectFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).project; - } - - /** - * Parse the location from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the location. - */ - matchLocationFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).location; - } - - /** - * Parse the key_ring from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).key_ring; - } - - /** - * Parse the import_job from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the import_job. - */ - matchImportJobFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).import_job; - } - - /** - * Return a fully-qualified keyRing resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @returns {string} Resource name string. - */ - keyRingPath(project:string,location:string,keyRing:string) { - return this.pathTemplates.keyRingPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - }); - } - - /** - * Parse the project from KeyRing resource. - * - * @param {string} keyRingName - * A fully-qualified path representing KeyRing resource. - * @returns {string} A string representing the project. - */ - matchProjectFromKeyRingName(keyRingName: string) { - return this.pathTemplates.keyRingPathTemplate.match(keyRingName).project; - } - - /** - * Parse the location from KeyRing resource. - * - * @param {string} keyRingName - * A fully-qualified path representing KeyRing resource. - * @returns {string} A string representing the location. - */ - matchLocationFromKeyRingName(keyRingName: string) { - return this.pathTemplates.keyRingPathTemplate.match(keyRingName).location; - } - - /** - * Parse the key_ring from KeyRing resource. - * - * @param {string} keyRingName - * A fully-qualified path representing KeyRing resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromKeyRingName(keyRingName: string) { - return this.pathTemplates.keyRingPathTemplate.match(keyRingName).key_ring; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified publicKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @param {string} crypto_key_version - * @returns {string} Resource name string. - */ - publicKeyPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { - return this.pathTemplates.publicKeyPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - crypto_key_version: cryptoKeyVersion, - }); - } - - /** - * Parse the project from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the project. - */ - matchProjectFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).project; - } - - /** - * Parse the location from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the location. - */ - matchLocationFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).location; - } - - /** - * Parse the key_ring from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).key_ring; - } - - /** - * Parse the crypto_key from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).crypto_key; - } - - /** - * Parse the crypto_key_version from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the crypto_key_version. - */ - matchCryptoKeyVersionFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).crypto_key_version; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.ekmServiceStub && !this._terminated) { - return this.ekmServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_client_config.json b/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_client_config.json deleted file mode 100644 index b4ef489d214..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_client_config.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "interfaces": { - "google.cloud.kms.v1.EkmService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListEkmConnections": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetEkmConnection": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateEkmConnection": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateEkmConnection": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetEkmConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateEkmConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "VerifyConnectivity": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_proto_list.json b/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_proto_list.json deleted file mode 100644 index ad57fc558ee..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/src/v1/ekm_service_proto_list.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "../../protos/google/cloud/kms/v1/ekm_service.proto", - "../../protos/google/cloud/kms/v1/resources.proto", - "../../protos/google/cloud/kms/v1/service.proto" -] diff --git a/owl-bot-staging/google-cloud-kms/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-kms/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 8070b887cfe..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,407 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.kms.v1", - "libraryPackage": "@google-cloud/kms", - "services": { - "EkmService": { - "clients": { - "grpc": { - "libraryClient": "EkmServiceClient", - "rpcs": { - "GetEkmConnection": { - "methods": [ - "getEkmConnection" - ] - }, - "CreateEkmConnection": { - "methods": [ - "createEkmConnection" - ] - }, - "UpdateEkmConnection": { - "methods": [ - "updateEkmConnection" - ] - }, - "GetEkmConfig": { - "methods": [ - "getEkmConfig" - ] - }, - "UpdateEkmConfig": { - "methods": [ - "updateEkmConfig" - ] - }, - "VerifyConnectivity": { - "methods": [ - "verifyConnectivity" - ] - }, - "ListEkmConnections": { - "methods": [ - "listEkmConnections", - "listEkmConnectionsStream", - "listEkmConnectionsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "EkmServiceClient", - "rpcs": { - "GetEkmConnection": { - "methods": [ - "getEkmConnection" - ] - }, - "CreateEkmConnection": { - "methods": [ - "createEkmConnection" - ] - }, - "UpdateEkmConnection": { - "methods": [ - "updateEkmConnection" - ] - }, - "GetEkmConfig": { - "methods": [ - "getEkmConfig" - ] - }, - "UpdateEkmConfig": { - "methods": [ - "updateEkmConfig" - ] - }, - "VerifyConnectivity": { - "methods": [ - "verifyConnectivity" - ] - }, - "ListEkmConnections": { - "methods": [ - "listEkmConnections", - "listEkmConnectionsStream", - "listEkmConnectionsAsync" - ] - } - } - } - } - }, - "KeyManagementService": { - "clients": { - "grpc": { - "libraryClient": "KeyManagementServiceClient", - "rpcs": { - "GetKeyRing": { - "methods": [ - "getKeyRing" - ] - }, - "GetCryptoKey": { - "methods": [ - "getCryptoKey" - ] - }, - "GetCryptoKeyVersion": { - "methods": [ - "getCryptoKeyVersion" - ] - }, - "GetPublicKey": { - "methods": [ - "getPublicKey" - ] - }, - "GetImportJob": { - "methods": [ - "getImportJob" - ] - }, - "CreateKeyRing": { - "methods": [ - "createKeyRing" - ] - }, - "CreateCryptoKey": { - "methods": [ - "createCryptoKey" - ] - }, - "CreateCryptoKeyVersion": { - "methods": [ - "createCryptoKeyVersion" - ] - }, - "ImportCryptoKeyVersion": { - "methods": [ - "importCryptoKeyVersion" - ] - }, - "CreateImportJob": { - "methods": [ - "createImportJob" - ] - }, - "UpdateCryptoKey": { - "methods": [ - "updateCryptoKey" - ] - }, - "UpdateCryptoKeyVersion": { - "methods": [ - "updateCryptoKeyVersion" - ] - }, - "UpdateCryptoKeyPrimaryVersion": { - "methods": [ - "updateCryptoKeyPrimaryVersion" - ] - }, - "DestroyCryptoKeyVersion": { - "methods": [ - "destroyCryptoKeyVersion" - ] - }, - "RestoreCryptoKeyVersion": { - "methods": [ - "restoreCryptoKeyVersion" - ] - }, - "Encrypt": { - "methods": [ - "encrypt" - ] - }, - "Decrypt": { - "methods": [ - "decrypt" - ] - }, - "RawEncrypt": { - "methods": [ - "rawEncrypt" - ] - }, - "RawDecrypt": { - "methods": [ - "rawDecrypt" - ] - }, - "AsymmetricSign": { - "methods": [ - "asymmetricSign" - ] - }, - "AsymmetricDecrypt": { - "methods": [ - "asymmetricDecrypt" - ] - }, - "MacSign": { - "methods": [ - "macSign" - ] - }, - "MacVerify": { - "methods": [ - "macVerify" - ] - }, - "GenerateRandomBytes": { - "methods": [ - "generateRandomBytes" - ] - }, - "ListKeyRings": { - "methods": [ - "listKeyRings", - "listKeyRingsStream", - "listKeyRingsAsync" - ] - }, - "ListCryptoKeys": { - "methods": [ - "listCryptoKeys", - "listCryptoKeysStream", - "listCryptoKeysAsync" - ] - }, - "ListCryptoKeyVersions": { - "methods": [ - "listCryptoKeyVersions", - "listCryptoKeyVersionsStream", - "listCryptoKeyVersionsAsync" - ] - }, - "ListImportJobs": { - "methods": [ - "listImportJobs", - "listImportJobsStream", - "listImportJobsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "KeyManagementServiceClient", - "rpcs": { - "GetKeyRing": { - "methods": [ - "getKeyRing" - ] - }, - "GetCryptoKey": { - "methods": [ - "getCryptoKey" - ] - }, - "GetCryptoKeyVersion": { - "methods": [ - "getCryptoKeyVersion" - ] - }, - "GetPublicKey": { - "methods": [ - "getPublicKey" - ] - }, - "GetImportJob": { - "methods": [ - "getImportJob" - ] - }, - "CreateKeyRing": { - "methods": [ - "createKeyRing" - ] - }, - "CreateCryptoKey": { - "methods": [ - "createCryptoKey" - ] - }, - "CreateCryptoKeyVersion": { - "methods": [ - "createCryptoKeyVersion" - ] - }, - "ImportCryptoKeyVersion": { - "methods": [ - "importCryptoKeyVersion" - ] - }, - "CreateImportJob": { - "methods": [ - "createImportJob" - ] - }, - "UpdateCryptoKey": { - "methods": [ - "updateCryptoKey" - ] - }, - "UpdateCryptoKeyVersion": { - "methods": [ - "updateCryptoKeyVersion" - ] - }, - "UpdateCryptoKeyPrimaryVersion": { - "methods": [ - "updateCryptoKeyPrimaryVersion" - ] - }, - "DestroyCryptoKeyVersion": { - "methods": [ - "destroyCryptoKeyVersion" - ] - }, - "RestoreCryptoKeyVersion": { - "methods": [ - "restoreCryptoKeyVersion" - ] - }, - "Encrypt": { - "methods": [ - "encrypt" - ] - }, - "Decrypt": { - "methods": [ - "decrypt" - ] - }, - "RawEncrypt": { - "methods": [ - "rawEncrypt" - ] - }, - "RawDecrypt": { - "methods": [ - "rawDecrypt" - ] - }, - "AsymmetricSign": { - "methods": [ - "asymmetricSign" - ] - }, - "AsymmetricDecrypt": { - "methods": [ - "asymmetricDecrypt" - ] - }, - "MacSign": { - "methods": [ - "macSign" - ] - }, - "MacVerify": { - "methods": [ - "macVerify" - ] - }, - "GenerateRandomBytes": { - "methods": [ - "generateRandomBytes" - ] - }, - "ListKeyRings": { - "methods": [ - "listKeyRings", - "listKeyRingsStream", - "listKeyRingsAsync" - ] - }, - "ListCryptoKeys": { - "methods": [ - "listCryptoKeys", - "listCryptoKeysStream", - "listCryptoKeysAsync" - ] - }, - "ListCryptoKeyVersions": { - "methods": [ - "listCryptoKeyVersions", - "listCryptoKeyVersionsStream", - "listCryptoKeyVersionsAsync" - ] - }, - "ListImportJobs": { - "methods": [ - "listImportJobs", - "listImportJobsStream", - "listImportJobsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-kms/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-kms/v1/src/v1/index.ts deleted file mode 100644 index 5ecb6c75ce9..00000000000 --- a/owl-bot-staging/google-cloud-kms/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 {EkmServiceClient} from './ekm_service_client'; -export {KeyManagementServiceClient} from './key_management_service_client'; diff --git a/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_client.ts b/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_client.ts deleted file mode 100644 index ebc65ca6b5f..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_client.ts +++ /dev/null @@ -1,4292 +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, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/key_management_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './key_management_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Google Cloud Key Management Service - * - * Manages cryptographic keys and operations using those keys. Implements a REST - * model with the following objects: - * - * * {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} - * * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} - * * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} - * * {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} - * - * If you are using manual gRPC libraries, see - * [Using gRPC with Cloud KMS](https://cloud.google.com/kms/docs/grpc). - * @class - * @memberof v1 - */ -export class KeyManagementServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - keyManagementServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of KeyManagementServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new KeyManagementServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof KeyManagementServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // 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; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' - ), - cryptoKeyVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}' - ), - ekmConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/ekmConfig' - ), - ekmConnectionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/ekmConnections/{ekm_connection}' - ), - importJobPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}' - ), - keyRingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - publicKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/publicKey' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listKeyRings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'keyRings'), - listCryptoKeys: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'cryptoKeys'), - listCryptoKeyVersions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'cryptoKeyVersions'), - listImportJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'importJobs') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.kms.v1.KeyManagementService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.keyManagementServiceStub) { - return this.keyManagementServiceStub; - } - - // Put together the "service stub" for - // google.cloud.kms.v1.KeyManagementService. - this.keyManagementServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.kms.v1.KeyManagementService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.kms.v1.KeyManagementService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const keyManagementServiceStubMethods = - ['listKeyRings', 'listCryptoKeys', 'listCryptoKeyVersions', 'listImportJobs', 'getKeyRing', 'getCryptoKey', 'getCryptoKeyVersion', 'getPublicKey', 'getImportJob', 'createKeyRing', 'createCryptoKey', 'createCryptoKeyVersion', 'importCryptoKeyVersion', 'createImportJob', 'updateCryptoKey', 'updateCryptoKeyVersion', 'updateCryptoKeyPrimaryVersion', 'destroyCryptoKeyVersion', 'restoreCryptoKeyVersion', 'encrypt', 'decrypt', 'rawEncrypt', 'rawDecrypt', 'asymmetricSign', 'asymmetricDecrypt', 'macSign', 'macVerify', 'generateRandomBytes']; - for (const methodName of keyManagementServiceStubMethods) { - const callPromise = this.keyManagementServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.keyManagementServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'cloudkms.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'cloudkms.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloudkms' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Returns metadata for a given {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The {@link protos.google.cloud.kms.v1.KeyRing.name|name} of the - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.get_key_ring.js - * region_tag:cloudkms_v1_generated_KeyManagementService_GetKeyRing_async - */ - getKeyRing( - request?: protos.google.cloud.kms.v1.IGetKeyRingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|undefined, {}|undefined - ]>; - getKeyRing( - request: protos.google.cloud.kms.v1.IGetKeyRingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, - {}|null|undefined>): void; - getKeyRing( - request: protos.google.cloud.kms.v1.IGetKeyRingRequest, - callback: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, - {}|null|undefined>): void; - getKeyRing( - request?: protos.google.cloud.kms.v1.IGetKeyRingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getKeyRing(request, options, callback); - } -/** - * Returns metadata for a given {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}, as - * well as its {@link protos.google.cloud.kms.v1.CryptoKey.primary|primary} - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The {@link protos.google.cloud.kms.v1.CryptoKey.name|name} of the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.get_crypto_key.js - * region_tag:cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async - */ - getCryptoKey( - request?: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|undefined, {}|undefined - ]>; - getCryptoKey( - request: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - getCryptoKey( - request: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - getCryptoKey( - request?: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getCryptoKey(request, options, callback); - } -/** - * Returns metadata for a given - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The {@link protos.google.cloud.kms.v1.CryptoKeyVersion.name|name} of the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.get_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async - */ - getCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - getCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - getCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - getCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getCryptoKeyVersion(request, options, callback); - } -/** - * Returns the public key for the given - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. The - * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} must be - * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN|ASYMMETRIC_SIGN} - * or - * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT|ASYMMETRIC_DECRYPT}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The {@link protos.google.cloud.kms.v1.CryptoKeyVersion.name|name} of the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} public key to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.PublicKey|PublicKey}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.get_public_key.js - * region_tag:cloudkms_v1_generated_KeyManagementService_GetPublicKey_async - */ - getPublicKey( - request?: protos.google.cloud.kms.v1.IGetPublicKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|undefined, {}|undefined - ]>; - getPublicKey( - request: protos.google.cloud.kms.v1.IGetPublicKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - getPublicKey( - request: protos.google.cloud.kms.v1.IGetPublicKeyRequest, - callback: Callback< - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - getPublicKey( - request?: protos.google.cloud.kms.v1.IGetPublicKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getPublicKey(request, options, callback); - } -/** - * Returns metadata for a given {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The {@link protos.google.cloud.kms.v1.ImportJob.name|name} of the - * {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.get_import_job.js - * region_tag:cloudkms_v1_generated_KeyManagementService_GetImportJob_async - */ - getImportJob( - request?: protos.google.cloud.kms.v1.IGetImportJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|undefined, {}|undefined - ]>; - getImportJob( - request: protos.google.cloud.kms.v1.IGetImportJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>): void; - getImportJob( - request: protos.google.cloud.kms.v1.IGetImportJobRequest, - callback: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>): void; - getImportJob( - request?: protos.google.cloud.kms.v1.IGetImportJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getImportJob(request, options, callback); - } -/** - * Create a new {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} in a given Project and - * Location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location associated with the - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}, in the format - * `projects/* /locations/*`. - * @param {string} request.keyRingId - * Required. It must be unique within a location and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - * @param {google.cloud.kms.v1.KeyRing} request.keyRing - * Required. A {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} with initial field - * values. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.create_key_ring.js - * region_tag:cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async - */ - createKeyRing( - request?: protos.google.cloud.kms.v1.ICreateKeyRingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|undefined, {}|undefined - ]>; - createKeyRing( - request: protos.google.cloud.kms.v1.ICreateKeyRingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, - {}|null|undefined>): void; - createKeyRing( - request: protos.google.cloud.kms.v1.ICreateKeyRingRequest, - callback: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, - {}|null|undefined>): void; - createKeyRing( - request?: protos.google.cloud.kms.v1.ICreateKeyRingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createKeyRing(request, options, callback); - } -/** - * Create a new {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} within a - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * - * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} and - * {@link protos.google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm|CryptoKey.version_template.algorithm} - * are required. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The {@link protos.google.cloud.kms.v1.KeyRing.name|name} of the KeyRing - * associated with the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys}. - * @param {string} request.cryptoKeyId - * Required. It must be unique within a KeyRing and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - * @param {google.cloud.kms.v1.CryptoKey} request.cryptoKey - * Required. A {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} with initial field - * values. - * @param {boolean} request.skipInitialVersionCreation - * If set to true, the request will create a - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} without any - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions}. You must - * manually call - * {@link protos.google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion|CreateCryptoKeyVersion} - * or - * {@link protos.google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion|ImportCryptoKeyVersion} - * before you can use this {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.create_crypto_key.js - * region_tag:cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async - */ - createCryptoKey( - request?: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|undefined, {}|undefined - ]>; - createCryptoKey( - request: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - createCryptoKey( - request: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - createCryptoKey( - request?: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createCryptoKey(request, options, callback); - } -/** - * Create a new {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} in a - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * - * The server will assign the next sequential id. If unset, - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|state} will be set to - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED|ENABLED}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The {@link protos.google.cloud.kms.v1.CryptoKey.name|name} of the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} associated with the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions}. - * @param {google.cloud.kms.v1.CryptoKeyVersion} request.cryptoKeyVersion - * Required. A {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} with - * initial field values. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.create_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async - */ - createCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - createCryptoKeyVersion( - request: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - createCryptoKeyVersion( - request: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - createCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createCryptoKeyVersion(request, options, callback); - } -/** - * Import wrapped key material into a - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * - * All requests must specify a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. If - * a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} is additionally - * specified in the request, key material will be reimported into that - * version. Otherwise, a new version will be created, and will be assigned the - * next sequential id within the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The {@link protos.google.cloud.kms.v1.CryptoKey.name|name} of the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to be imported into. - * - * The create permission is only required on this key when creating a new - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * @param {string} [request.cryptoKeyVersion] - * Optional. The optional {@link protos.google.cloud.kms.v1.CryptoKeyVersion.name|name} of - * an existing {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to - * target for an import operation. If this field is not present, a new - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} containing the - * supplied key material is created. - * - * If this field is present, the supplied key material is imported into - * the existing {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. To - * import into an existing - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}, the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} must be a child of - * {@link protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent|ImportCryptoKeyVersionRequest.parent}, - * have been previously created via {@link protos.|ImportCryptoKeyVersion}, and be in - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED|DESTROYED} - * or - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED|IMPORT_FAILED} - * state. The key material and algorithm must match the previous - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} exactly if the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} has ever contained - * key material. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm} request.algorithm - * Required. The - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|algorithm} - * of the key being imported. This does not need to match the - * {@link protos.google.cloud.kms.v1.CryptoKey.version_template|version_template} of the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} this version imports into. - * @param {string} request.importJob - * Required. The {@link protos.google.cloud.kms.v1.ImportJob.name|name} of the - * {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} that was used to wrap this key - * material. - * @param {Buffer} [request.wrappedKey] - * Optional. The wrapped key material to import. - * - * Before wrapping, key material must be formatted. If importing symmetric key - * material, the expected key material format is plain bytes. If importing - * asymmetric key material, the expected key material format is PKCS#8-encoded - * DER (the PrivateKeyInfo structure from RFC 5208). - * - * When wrapping with import methods - * ({@link protos.google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256|RSA_OAEP_3072_SHA1_AES_256} - * or - * {@link protos.google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256|RSA_OAEP_4096_SHA1_AES_256} - * or - * {@link protos.google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256|RSA_OAEP_3072_SHA256_AES_256} - * or - * {@link protos.google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256|RSA_OAEP_4096_SHA256_AES_256}), - * - * this field must contain the concatenation of: - *
    - *
  1. An ephemeral AES-256 wrapping key wrapped with the - * {@link protos.google.cloud.kms.v1.ImportJob.public_key|public_key} using - * RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an empty - * label. - *
  2. - *
  3. The formatted key to be imported, wrapped with the ephemeral AES-256 - * key using AES-KWP (RFC 5649). - *
  4. - *
- * - * This format is the same as the format produced by PKCS#11 mechanism - * CKM_RSA_AES_KEY_WRAP. - * - * When wrapping with import methods - * ({@link protos.google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256|RSA_OAEP_3072_SHA256} - * or - * {@link protos.google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256|RSA_OAEP_4096_SHA256}), - * - * this field must contain the formatted key to be imported, wrapped with the - * {@link protos.google.cloud.kms.v1.ImportJob.public_key|public_key} using RSAES-OAEP - * with SHA-256, MGF1 with SHA-256, and an empty label. - * @param {Buffer} [request.rsaAesWrappedKey] - * Optional. This field has the same meaning as - * {@link protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key|wrapped_key}. - * Prefer to use that field in new work. Either that field or this field - * (but not both) must be specified. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.import_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async - */ - importCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - importCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - importCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - importCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.importCryptoKeyVersion(request, options, callback); - } -/** - * Create a new {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} within a - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * - * {@link protos.google.cloud.kms.v1.ImportJob.import_method|ImportJob.import_method} is - * required. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The {@link protos.google.cloud.kms.v1.KeyRing.name|name} of the - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} associated with the - * {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs}. - * @param {string} request.importJobId - * Required. It must be unique within a KeyRing and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - * @param {google.cloud.kms.v1.ImportJob} request.importJob - * Required. An {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} with initial field - * values. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.create_import_job.js - * region_tag:cloudkms_v1_generated_KeyManagementService_CreateImportJob_async - */ - createImportJob( - request?: protos.google.cloud.kms.v1.ICreateImportJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|undefined, {}|undefined - ]>; - createImportJob( - request: protos.google.cloud.kms.v1.ICreateImportJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, - {}|null|undefined>): void; - createImportJob( - request: protos.google.cloud.kms.v1.ICreateImportJobRequest, - callback: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, - {}|null|undefined>): void; - createImportJob( - request?: protos.google.cloud.kms.v1.ICreateImportJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createImportJob(request, options, callback); - } -/** - * Update a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.kms.v1.CryptoKey} request.cryptoKey - * Required. {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} with updated values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. List of fields to be updated in this request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.update_crypto_key.js - * region_tag:cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async - */ - updateCryptoKey( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|undefined, {}|undefined - ]>; - updateCryptoKey( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKey( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKey( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'crypto_key.name': request.cryptoKey!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateCryptoKey(request, options, callback); - } -/** - * Update a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}'s - * metadata. - * - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|state} may be changed between - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED|ENABLED} - * and - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED|DISABLED} - * using this method. See - * {@link protos.google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion|DestroyCryptoKeyVersion} - * and - * {@link protos.google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion|RestoreCryptoKeyVersion} - * to move between other states. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.kms.v1.CryptoKeyVersion} request.cryptoKeyVersion - * Required. {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} with - * updated values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. List of fields to be updated in this request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.update_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async - */ - updateCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - updateCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'crypto_key_version.name': request.cryptoKeyVersion!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateCryptoKeyVersion(request, options, callback); - } -/** - * Update the version of a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} that - * will be used in - * {@link protos.google.cloud.kms.v1.KeyManagementService.Encrypt|Encrypt}. - * - * Returns an error if called on a key whose purpose is not - * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT|ENCRYPT_DECRYPT}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to update. - * @param {string} request.cryptoKeyVersionId - * Required. The id of the child - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use as primary. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.update_crypto_key_primary_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async - */ - updateCryptoKeyPrimaryVersion( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|undefined, {}|undefined - ]>; - updateCryptoKeyPrimaryVersion( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKeyPrimaryVersion( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKeyPrimaryVersion( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateCryptoKeyPrimaryVersion(request, options, callback); - } -/** - * Schedule a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} for - * destruction. - * - * Upon calling this method, - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|CryptoKeyVersion.state} will - * be set to - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED|DESTROY_SCHEDULED}, - * and {@link protos.google.cloud.kms.v1.CryptoKeyVersion.destroy_time|destroy_time} will - * be set to the time - * {@link protos.google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration|destroy_scheduled_duration} - * in the future. At that time, the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|state} will automatically - * change to - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED|DESTROYED}, - * and the key material will be irrevocably destroyed. - * - * Before the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.destroy_time|destroy_time} is - * reached, - * {@link protos.google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion|RestoreCryptoKeyVersion} - * may be called to reverse the process. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to destroy. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.destroy_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async - */ - destroyCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - destroyCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - destroyCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - destroyCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.destroyCryptoKeyVersion(request, options, callback); - } -/** - * Restore a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} in the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED|DESTROY_SCHEDULED} - * state. - * - * Upon restoration of the CryptoKeyVersion, - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|state} will be set to - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED|DISABLED}, - * and {@link protos.google.cloud.kms.v1.CryptoKeyVersion.destroy_time|destroy_time} will - * be cleared. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to restore. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.restore_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async - */ - restoreCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - restoreCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - restoreCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - restoreCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.restoreCryptoKeyVersion(request, options, callback); - } -/** - * Encrypts data, so that it can only be recovered by a call to - * {@link protos.google.cloud.kms.v1.KeyManagementService.Decrypt|Decrypt}. The - * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} must be - * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT|ENCRYPT_DECRYPT}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} or - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for - * encryption. - * - * If a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} is specified, the server - * will use its {@link protos.google.cloud.kms.v1.CryptoKey.primary|primary version}. - * @param {Buffer} request.plaintext - * Required. The data to encrypt. Must be no larger than 64KiB. - * - * The maximum size depends on the key version's - * {@link protos.google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level|protection_level}. - * For {@link protos.google.cloud.kms.v1.ProtectionLevel.SOFTWARE|SOFTWARE}, - * {@link protos.google.cloud.kms.v1.ProtectionLevel.EXTERNAL|EXTERNAL}, and - * {@link protos.google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC|EXTERNAL_VPC} keys, the - * plaintext must be no larger than 64KiB. For - * {@link protos.google.cloud.kms.v1.ProtectionLevel.HSM|HSM} keys, the combined length of - * the plaintext and additional_authenticated_data fields must be no larger - * than 8KiB. - * @param {Buffer} [request.additionalAuthenticatedData] - * Optional. Optional data that, if specified, must also be provided during - * decryption through - * {@link protos.google.cloud.kms.v1.DecryptRequest.additional_authenticated_data|DecryptRequest.additional_authenticated_data}. - * - * The maximum size depends on the key version's - * {@link protos.google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level|protection_level}. - * For {@link protos.google.cloud.kms.v1.ProtectionLevel.SOFTWARE|SOFTWARE}, - * {@link protos.google.cloud.kms.v1.ProtectionLevel.EXTERNAL|EXTERNAL}, and - * {@link protos.google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC|EXTERNAL_VPC} keys the - * AAD must be no larger than 64KiB. For - * {@link protos.google.cloud.kms.v1.ProtectionLevel.HSM|HSM} keys, the combined length of - * the plaintext and additional_authenticated_data fields must be no larger - * than 8KiB. - * @param {google.protobuf.Int64Value} [request.plaintextCrc32c] - * Optional. An optional CRC32C checksum of the - * {@link protos.google.cloud.kms.v1.EncryptRequest.plaintext|EncryptRequest.plaintext}. - * If specified, - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * verify the integrity of the received - * {@link protos.google.cloud.kms.v1.EncryptRequest.plaintext|EncryptRequest.plaintext} - * using this checksum. - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C({@link protos.google.cloud.kms.v1.EncryptRequest.plaintext|EncryptRequest.plaintext}) - * is equal to - * {@link protos.google.cloud.kms.v1.EncryptRequest.plaintext_crc32c|EncryptRequest.plaintext_crc32c}, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - * @param {google.protobuf.Int64Value} [request.additionalAuthenticatedDataCrc32c] - * Optional. An optional CRC32C checksum of the - * {@link protos.google.cloud.kms.v1.EncryptRequest.additional_authenticated_data|EncryptRequest.additional_authenticated_data}. - * If specified, - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * verify the integrity of the received - * {@link protos.google.cloud.kms.v1.EncryptRequest.additional_authenticated_data|EncryptRequest.additional_authenticated_data} - * using this checksum. - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C({@link protos.google.cloud.kms.v1.EncryptRequest.additional_authenticated_data|EncryptRequest.additional_authenticated_data}) - * is equal to - * {@link protos.google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c|EncryptRequest.additional_authenticated_data_crc32c}, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.EncryptResponse|EncryptResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.encrypt.js - * region_tag:cloudkms_v1_generated_KeyManagementService_Encrypt_async - */ - encrypt( - request?: protos.google.cloud.kms.v1.IEncryptRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|undefined, {}|undefined - ]>; - encrypt( - request: protos.google.cloud.kms.v1.IEncryptRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, - {}|null|undefined>): void; - encrypt( - request: protos.google.cloud.kms.v1.IEncryptRequest, - callback: Callback< - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, - {}|null|undefined>): void; - encrypt( - request?: protos.google.cloud.kms.v1.IEncryptRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.encrypt(request, options, callback); - } -/** - * Decrypts data that was protected by - * {@link protos.google.cloud.kms.v1.KeyManagementService.Encrypt|Encrypt}. The - * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} must be - * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT|ENCRYPT_DECRYPT}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to use for decryption. The - * server will choose the appropriate version. - * @param {Buffer} request.ciphertext - * Required. The encrypted data originally returned in - * {@link protos.google.cloud.kms.v1.EncryptResponse.ciphertext|EncryptResponse.ciphertext}. - * @param {Buffer} [request.additionalAuthenticatedData] - * Optional. Optional data that must match the data originally supplied in - * {@link protos.google.cloud.kms.v1.EncryptRequest.additional_authenticated_data|EncryptRequest.additional_authenticated_data}. - * @param {google.protobuf.Int64Value} [request.ciphertextCrc32c] - * Optional. An optional CRC32C checksum of the - * {@link protos.google.cloud.kms.v1.DecryptRequest.ciphertext|DecryptRequest.ciphertext}. - * If specified, - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * verify the integrity of the received - * {@link protos.google.cloud.kms.v1.DecryptRequest.ciphertext|DecryptRequest.ciphertext} - * using this checksum. - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C({@link protos.google.cloud.kms.v1.DecryptRequest.ciphertext|DecryptRequest.ciphertext}) - * is equal to - * {@link protos.google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c|DecryptRequest.ciphertext_crc32c}, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - * @param {google.protobuf.Int64Value} [request.additionalAuthenticatedDataCrc32c] - * Optional. An optional CRC32C checksum of the - * {@link protos.google.cloud.kms.v1.DecryptRequest.additional_authenticated_data|DecryptRequest.additional_authenticated_data}. - * If specified, - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * verify the integrity of the received - * {@link protos.google.cloud.kms.v1.DecryptRequest.additional_authenticated_data|DecryptRequest.additional_authenticated_data} - * using this checksum. - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C({@link protos.google.cloud.kms.v1.DecryptRequest.additional_authenticated_data|DecryptRequest.additional_authenticated_data}) - * is equal to - * {@link protos.google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c|DecryptRequest.additional_authenticated_data_crc32c}, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.DecryptResponse|DecryptResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.decrypt.js - * region_tag:cloudkms_v1_generated_KeyManagementService_Decrypt_async - */ - decrypt( - request?: protos.google.cloud.kms.v1.IDecryptRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|undefined, {}|undefined - ]>; - decrypt( - request: protos.google.cloud.kms.v1.IDecryptRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, - {}|null|undefined>): void; - decrypt( - request: protos.google.cloud.kms.v1.IDecryptRequest, - callback: Callback< - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, - {}|null|undefined>): void; - decrypt( - request?: protos.google.cloud.kms.v1.IDecryptRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.decrypt(request, options, callback); - } -/** - * Encrypts data using portable cryptographic primitives. Most users should - * choose {@link protos.google.cloud.kms.v1.KeyManagementService.Encrypt|Encrypt} and - * {@link protos.google.cloud.kms.v1.KeyManagementService.Decrypt|Decrypt} rather than - * their raw counterparts. The - * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} must be - * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT|RAW_ENCRYPT_DECRYPT}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for - * encryption. - * @param {Buffer} request.plaintext - * Required. The data to encrypt. Must be no larger than 64KiB. - * - * The maximum size depends on the key version's - * {@link protos.google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level|protection_level}. - * For {@link protos.google.cloud.kms.v1.ProtectionLevel.SOFTWARE|SOFTWARE} keys, the - * plaintext must be no larger than 64KiB. For - * {@link protos.google.cloud.kms.v1.ProtectionLevel.HSM|HSM} keys, the combined length of - * the plaintext and additional_authenticated_data fields must be no larger - * than 8KiB. - * @param {Buffer} [request.additionalAuthenticatedData] - * Optional. Optional data that, if specified, must also be provided during - * decryption through - * {@link protos.google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data|RawDecryptRequest.additional_authenticated_data}. - * - * This field may only be used in conjunction with an - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.algorithm|algorithm} that accepts - * additional authenticated data (for example, AES-GCM). - * - * The maximum size depends on the key version's - * {@link protos.google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level|protection_level}. - * For {@link protos.google.cloud.kms.v1.ProtectionLevel.SOFTWARE|SOFTWARE} keys, the - * plaintext must be no larger than 64KiB. For - * {@link protos.google.cloud.kms.v1.ProtectionLevel.HSM|HSM} keys, the combined length of - * the plaintext and additional_authenticated_data fields must be no larger - * than 8KiB. - * @param {google.protobuf.Int64Value} [request.plaintextCrc32c] - * Optional. An optional CRC32C checksum of the - * {@link protos.google.cloud.kms.v1.RawEncryptRequest.plaintext|RawEncryptRequest.plaintext}. - * If specified, - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * verify the integrity of the received plaintext using this checksum. - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that CRC32C(plaintext) is equal - * to plaintext_crc32c, and if so, perform a limited number of retries. A - * persistent mismatch may indicate an issue in your computation of the CRC32C - * checksum. Note: This field is defined as int64 for reasons of compatibility - * across different languages. However, it is a non-negative integer, which - * will never exceed 2^32-1, and can be safely downconverted to uint32 in - * languages that support this type. - * @param {google.protobuf.Int64Value} [request.additionalAuthenticatedDataCrc32c] - * Optional. An optional CRC32C checksum of the - * {@link protos.google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data|RawEncryptRequest.additional_authenticated_data}. - * If specified, - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * verify the integrity of the received additional_authenticated_data using - * this checksum. - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(additional_authenticated_data) is equal to - * additional_authenticated_data_crc32c, and if so, perform - * a limited number of retries. A persistent mismatch may indicate an issue in - * your computation of the CRC32C checksum. - * Note: This field is defined as int64 for reasons of compatibility across - * different languages. However, it is a non-negative integer, which will - * never exceed 2^32-1, and can be safely downconverted to uint32 in languages - * that support this type. - * @param {Buffer} [request.initializationVector] - * Optional. A customer-supplied initialization vector that will be used for - * encryption. If it is not provided for AES-CBC and AES-CTR, one will be - * generated. It will be returned in - * {@link protos.google.cloud.kms.v1.RawEncryptResponse.initialization_vector|RawEncryptResponse.initialization_vector}. - * @param {google.protobuf.Int64Value} [request.initializationVectorCrc32c] - * Optional. An optional CRC32C checksum of the - * {@link protos.google.cloud.kms.v1.RawEncryptRequest.initialization_vector|RawEncryptRequest.initialization_vector}. - * If specified, - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * verify the integrity of the received initialization_vector using this - * checksum. {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} - * will report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(initialization_vector) is equal to - * initialization_vector_crc32c, and if so, perform - * a limited number of retries. A persistent mismatch may indicate an issue in - * your computation of the CRC32C checksum. - * Note: This field is defined as int64 for reasons of compatibility across - * different languages. However, it is a non-negative integer, which will - * never exceed 2^32-1, and can be safely downconverted to uint32 in languages - * that support this type. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.RawEncryptResponse|RawEncryptResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.raw_encrypt.js - * region_tag:cloudkms_v1_generated_KeyManagementService_RawEncrypt_async - */ - rawEncrypt( - request?: protos.google.cloud.kms.v1.IRawEncryptRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IRawEncryptResponse, - protos.google.cloud.kms.v1.IRawEncryptRequest|undefined, {}|undefined - ]>; - rawEncrypt( - request: protos.google.cloud.kms.v1.IRawEncryptRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IRawEncryptResponse, - protos.google.cloud.kms.v1.IRawEncryptRequest|null|undefined, - {}|null|undefined>): void; - rawEncrypt( - request: protos.google.cloud.kms.v1.IRawEncryptRequest, - callback: Callback< - protos.google.cloud.kms.v1.IRawEncryptResponse, - protos.google.cloud.kms.v1.IRawEncryptRequest|null|undefined, - {}|null|undefined>): void; - rawEncrypt( - request?: protos.google.cloud.kms.v1.IRawEncryptRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IRawEncryptResponse, - protos.google.cloud.kms.v1.IRawEncryptRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IRawEncryptResponse, - protos.google.cloud.kms.v1.IRawEncryptRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IRawEncryptResponse, - protos.google.cloud.kms.v1.IRawEncryptRequest|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.rawEncrypt(request, options, callback); - } -/** - * Decrypts data that was originally encrypted using a raw cryptographic - * mechanism. The {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} - * must be - * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT|RAW_ENCRYPT_DECRYPT}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for - * decryption. - * @param {Buffer} request.ciphertext - * Required. The encrypted data originally returned in - * {@link protos.google.cloud.kms.v1.RawEncryptResponse.ciphertext|RawEncryptResponse.ciphertext}. - * @param {Buffer} [request.additionalAuthenticatedData] - * Optional. Optional data that must match the data originally supplied in - * {@link protos.google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data|RawEncryptRequest.additional_authenticated_data}. - * @param {Buffer} request.initializationVector - * Required. The initialization vector (IV) used during encryption, which must - * match the data originally provided in - * {@link protos.google.cloud.kms.v1.RawEncryptResponse.initialization_vector|RawEncryptResponse.initialization_vector}. - * @param {number} request.tagLength - * The length of the authentication tag that is appended to the end of - * the ciphertext. If unspecified (0), the default value for the key's - * algorithm will be used (for AES-GCM, the default value is 16). - * @param {google.protobuf.Int64Value} [request.ciphertextCrc32c] - * Optional. An optional CRC32C checksum of the - * {@link protos.google.cloud.kms.v1.RawDecryptRequest.ciphertext|RawDecryptRequest.ciphertext}. - * If specified, - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * verify the integrity of the received ciphertext using this checksum. - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that CRC32C(ciphertext) is equal - * to ciphertext_crc32c, and if so, perform a limited number of retries. A - * persistent mismatch may indicate an issue in your computation of the CRC32C - * checksum. Note: This field is defined as int64 for reasons of compatibility - * across different languages. However, it is a non-negative integer, which - * will never exceed 2^32-1, and can be safely downconverted to uint32 in - * languages that support this type. - * @param {google.protobuf.Int64Value} [request.additionalAuthenticatedDataCrc32c] - * Optional. An optional CRC32C checksum of the - * {@link protos.google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data|RawDecryptRequest.additional_authenticated_data}. - * If specified, - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * verify the integrity of the received additional_authenticated_data using - * this checksum. - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(additional_authenticated_data) is equal to - * additional_authenticated_data_crc32c, and if so, perform - * a limited number of retries. A persistent mismatch may indicate an issue in - * your computation of the CRC32C checksum. - * Note: This field is defined as int64 for reasons of compatibility across - * different languages. However, it is a non-negative integer, which will - * never exceed 2^32-1, and can be safely downconverted to uint32 in languages - * that support this type. - * @param {google.protobuf.Int64Value} [request.initializationVectorCrc32c] - * Optional. An optional CRC32C checksum of the - * {@link protos.google.cloud.kms.v1.RawDecryptRequest.initialization_vector|RawDecryptRequest.initialization_vector}. - * If specified, - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * verify the integrity of the received initialization_vector using this - * checksum. {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} - * will report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and - * if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. - * Note: This field is defined as int64 for reasons of compatibility across - * different languages. However, it is a non-negative integer, which will - * never exceed 2^32-1, and can be safely downconverted to uint32 in languages - * that support this type. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.RawDecryptResponse|RawDecryptResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.raw_decrypt.js - * region_tag:cloudkms_v1_generated_KeyManagementService_RawDecrypt_async - */ - rawDecrypt( - request?: protos.google.cloud.kms.v1.IRawDecryptRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IRawDecryptResponse, - protos.google.cloud.kms.v1.IRawDecryptRequest|undefined, {}|undefined - ]>; - rawDecrypt( - request: protos.google.cloud.kms.v1.IRawDecryptRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IRawDecryptResponse, - protos.google.cloud.kms.v1.IRawDecryptRequest|null|undefined, - {}|null|undefined>): void; - rawDecrypt( - request: protos.google.cloud.kms.v1.IRawDecryptRequest, - callback: Callback< - protos.google.cloud.kms.v1.IRawDecryptResponse, - protos.google.cloud.kms.v1.IRawDecryptRequest|null|undefined, - {}|null|undefined>): void; - rawDecrypt( - request?: protos.google.cloud.kms.v1.IRawDecryptRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IRawDecryptResponse, - protos.google.cloud.kms.v1.IRawDecryptRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IRawDecryptResponse, - protos.google.cloud.kms.v1.IRawDecryptRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IRawDecryptResponse, - protos.google.cloud.kms.v1.IRawDecryptRequest|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.rawDecrypt(request, options, callback); - } -/** - * Signs data using a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} - * with {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} - * ASYMMETRIC_SIGN, producing a signature that can be verified with the public - * key retrieved from - * {@link protos.google.cloud.kms.v1.KeyManagementService.GetPublicKey|GetPublicKey}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for - * signing. - * @param {google.cloud.kms.v1.Digest} [request.digest] - * Optional. The digest of the data to sign. The digest must be produced with - * the same digest algorithm as specified by the key version's - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.algorithm|algorithm}. - * - * This field may not be supplied if - * {@link protos.google.cloud.kms.v1.AsymmetricSignRequest.data|AsymmetricSignRequest.data} - * is supplied. - * @param {google.protobuf.Int64Value} [request.digestCrc32c] - * Optional. An optional CRC32C checksum of the - * {@link protos.google.cloud.kms.v1.AsymmetricSignRequest.digest|AsymmetricSignRequest.digest}. - * If specified, - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * verify the integrity of the received - * {@link protos.google.cloud.kms.v1.AsymmetricSignRequest.digest|AsymmetricSignRequest.digest} - * using this checksum. - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C({@link protos.google.cloud.kms.v1.AsymmetricSignRequest.digest|AsymmetricSignRequest.digest}) - * is equal to - * {@link protos.google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c|AsymmetricSignRequest.digest_crc32c}, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - * @param {Buffer} [request.data] - * Optional. The data to sign. - * It can't be supplied if - * {@link protos.google.cloud.kms.v1.AsymmetricSignRequest.digest|AsymmetricSignRequest.digest} - * is supplied. - * @param {google.protobuf.Int64Value} [request.dataCrc32c] - * Optional. An optional CRC32C checksum of the - * {@link protos.google.cloud.kms.v1.AsymmetricSignRequest.data|AsymmetricSignRequest.data}. - * If specified, - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * verify the integrity of the received - * {@link protos.google.cloud.kms.v1.AsymmetricSignRequest.data|AsymmetricSignRequest.data} - * using this checksum. - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C({@link protos.google.cloud.kms.v1.AsymmetricSignRequest.data|AsymmetricSignRequest.data}) - * is equal to - * {@link protos.google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c|AsymmetricSignRequest.data_crc32c}, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.AsymmetricSignResponse|AsymmetricSignResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.asymmetric_sign.js - * region_tag:cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async - */ - asymmetricSign( - request?: protos.google.cloud.kms.v1.IAsymmetricSignRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|undefined, {}|undefined - ]>; - asymmetricSign( - request: protos.google.cloud.kms.v1.IAsymmetricSignRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, - {}|null|undefined>): void; - asymmetricSign( - request: protos.google.cloud.kms.v1.IAsymmetricSignRequest, - callback: Callback< - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, - {}|null|undefined>): void; - asymmetricSign( - request?: protos.google.cloud.kms.v1.IAsymmetricSignRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.asymmetricSign(request, options, callback); - } -/** - * Decrypts data that was encrypted with a public key retrieved from - * {@link protos.google.cloud.kms.v1.KeyManagementService.GetPublicKey|GetPublicKey} - * corresponding to a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} - * with {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} - * ASYMMETRIC_DECRYPT. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for - * decryption. - * @param {Buffer} request.ciphertext - * Required. The data encrypted with the named - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}'s public key using - * OAEP. - * @param {google.protobuf.Int64Value} [request.ciphertextCrc32c] - * Optional. An optional CRC32C checksum of the - * {@link protos.google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext|AsymmetricDecryptRequest.ciphertext}. - * If specified, - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * verify the integrity of the received - * {@link protos.google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext|AsymmetricDecryptRequest.ciphertext} - * using this checksum. - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C({@link protos.google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext|AsymmetricDecryptRequest.ciphertext}) - * is equal to - * {@link protos.google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c|AsymmetricDecryptRequest.ciphertext_crc32c}, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.AsymmetricDecryptResponse|AsymmetricDecryptResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.asymmetric_decrypt.js - * region_tag:cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async - */ - asymmetricDecrypt( - request?: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|undefined, {}|undefined - ]>; - asymmetricDecrypt( - request: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, - {}|null|undefined>): void; - asymmetricDecrypt( - request: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, - callback: Callback< - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, - {}|null|undefined>): void; - asymmetricDecrypt( - request?: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.asymmetricDecrypt(request, options, callback); - } -/** - * Signs data using a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} - * with {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} MAC, - * producing a tag that can be verified by another source with the same key. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for - * signing. - * @param {Buffer} request.data - * Required. The data to sign. The MAC tag is computed over this data field - * based on the specific algorithm. - * @param {google.protobuf.Int64Value} [request.dataCrc32c] - * Optional. An optional CRC32C checksum of the - * {@link protos.google.cloud.kms.v1.MacSignRequest.data|MacSignRequest.data}. If - * specified, {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} - * will verify the integrity of the received - * {@link protos.google.cloud.kms.v1.MacSignRequest.data|MacSignRequest.data} using this - * checksum. {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} - * will report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C({@link protos.google.cloud.kms.v1.MacSignRequest.data|MacSignRequest.data}) is - * equal to - * {@link protos.google.cloud.kms.v1.MacSignRequest.data_crc32c|MacSignRequest.data_crc32c}, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.MacSignResponse|MacSignResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.mac_sign.js - * region_tag:cloudkms_v1_generated_KeyManagementService_MacSign_async - */ - macSign( - request?: protos.google.cloud.kms.v1.IMacSignRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IMacSignResponse, - protos.google.cloud.kms.v1.IMacSignRequest|undefined, {}|undefined - ]>; - macSign( - request: protos.google.cloud.kms.v1.IMacSignRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IMacSignResponse, - protos.google.cloud.kms.v1.IMacSignRequest|null|undefined, - {}|null|undefined>): void; - macSign( - request: protos.google.cloud.kms.v1.IMacSignRequest, - callback: Callback< - protos.google.cloud.kms.v1.IMacSignResponse, - protos.google.cloud.kms.v1.IMacSignRequest|null|undefined, - {}|null|undefined>): void; - macSign( - request?: protos.google.cloud.kms.v1.IMacSignRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IMacSignResponse, - protos.google.cloud.kms.v1.IMacSignRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IMacSignResponse, - protos.google.cloud.kms.v1.IMacSignRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IMacSignResponse, - protos.google.cloud.kms.v1.IMacSignRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.macSign(request, options, callback); - } -/** - * Verifies MAC tag using a - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} with - * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} MAC, and returns - * a response that indicates whether or not the verification was successful. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for - * verification. - * @param {Buffer} request.data - * Required. The data used previously as a - * {@link protos.google.cloud.kms.v1.MacSignRequest.data|MacSignRequest.data} to generate - * the MAC tag. - * @param {google.protobuf.Int64Value} [request.dataCrc32c] - * Optional. An optional CRC32C checksum of the - * {@link protos.google.cloud.kms.v1.MacVerifyRequest.data|MacVerifyRequest.data}. If - * specified, {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} - * will verify the integrity of the received - * {@link protos.google.cloud.kms.v1.MacVerifyRequest.data|MacVerifyRequest.data} using - * this checksum. - * {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} will - * report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C({@link protos.google.cloud.kms.v1.MacVerifyRequest.data|MacVerifyRequest.data}) - * is equal to - * {@link protos.google.cloud.kms.v1.MacVerifyRequest.data_crc32c|MacVerifyRequest.data_crc32c}, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - * @param {Buffer} request.mac - * Required. The signature to verify. - * @param {google.protobuf.Int64Value} [request.macCrc32c] - * Optional. An optional CRC32C checksum of the - * {@link protos.google.cloud.kms.v1.MacVerifyRequest.mac|MacVerifyRequest.mac}. If - * specified, {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} - * will verify the integrity of the received - * {@link protos.google.cloud.kms.v1.MacVerifyRequest.mac|MacVerifyRequest.mac} using this - * checksum. {@link protos.google.cloud.kms.v1.KeyManagementService|KeyManagementService} - * will report an error if the checksum verification fails. If you receive a - * checksum error, your client should verify that - * CRC32C({@link protos.|MacVerifyRequest.tag}) is equal to - * {@link protos.google.cloud.kms.v1.MacVerifyRequest.mac_crc32c|MacVerifyRequest.mac_crc32c}, - * and if so, perform a limited number of retries. A persistent mismatch may - * indicate an issue in your computation of the CRC32C checksum. Note: This - * field is defined as int64 for reasons of compatibility across different - * languages. However, it is a non-negative integer, which will never exceed - * 2^32-1, and can be safely downconverted to uint32 in languages that support - * this type. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.MacVerifyResponse|MacVerifyResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.mac_verify.js - * region_tag:cloudkms_v1_generated_KeyManagementService_MacVerify_async - */ - macVerify( - request?: protos.google.cloud.kms.v1.IMacVerifyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IMacVerifyResponse, - protos.google.cloud.kms.v1.IMacVerifyRequest|undefined, {}|undefined - ]>; - macVerify( - request: protos.google.cloud.kms.v1.IMacVerifyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IMacVerifyResponse, - protos.google.cloud.kms.v1.IMacVerifyRequest|null|undefined, - {}|null|undefined>): void; - macVerify( - request: protos.google.cloud.kms.v1.IMacVerifyRequest, - callback: Callback< - protos.google.cloud.kms.v1.IMacVerifyResponse, - protos.google.cloud.kms.v1.IMacVerifyRequest|null|undefined, - {}|null|undefined>): void; - macVerify( - request?: protos.google.cloud.kms.v1.IMacVerifyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IMacVerifyResponse, - protos.google.cloud.kms.v1.IMacVerifyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IMacVerifyResponse, - protos.google.cloud.kms.v1.IMacVerifyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IMacVerifyResponse, - protos.google.cloud.kms.v1.IMacVerifyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.macVerify(request, options, callback); - } -/** - * Generate random bytes using the Cloud KMS randomness source in the provided - * location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.location - * The project-specific location in which to generate random bytes. - * For example, "projects/my-project/locations/us-central1". - * @param {number} request.lengthBytes - * The length in bytes of the amount of randomness to retrieve. Minimum 8 - * bytes, maximum 1024 bytes. - * @param {google.cloud.kms.v1.ProtectionLevel} request.protectionLevel - * The {@link protos.google.cloud.kms.v1.ProtectionLevel|ProtectionLevel} to use when - * generating the random data. Currently, only - * {@link protos.google.cloud.kms.v1.ProtectionLevel.HSM|HSM} protection level is - * supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.kms.v1.GenerateRandomBytesResponse|GenerateRandomBytesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.generate_random_bytes.js - * region_tag:cloudkms_v1_generated_KeyManagementService_GenerateRandomBytes_async - */ - generateRandomBytes( - request?: protos.google.cloud.kms.v1.IGenerateRandomBytesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, - protos.google.cloud.kms.v1.IGenerateRandomBytesRequest|undefined, {}|undefined - ]>; - generateRandomBytes( - request: protos.google.cloud.kms.v1.IGenerateRandomBytesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, - protos.google.cloud.kms.v1.IGenerateRandomBytesRequest|null|undefined, - {}|null|undefined>): void; - generateRandomBytes( - request: protos.google.cloud.kms.v1.IGenerateRandomBytesRequest, - callback: Callback< - protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, - protos.google.cloud.kms.v1.IGenerateRandomBytesRequest|null|undefined, - {}|null|undefined>): void; - generateRandomBytes( - request?: protos.google.cloud.kms.v1.IGenerateRandomBytesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, - protos.google.cloud.kms.v1.IGenerateRandomBytesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, - protos.google.cloud.kms.v1.IGenerateRandomBytesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, - protos.google.cloud.kms.v1.IGenerateRandomBytesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'location': request.location ?? '', - }); - this.initialize(); - return this.innerApiCalls.generateRandomBytes(request, options, callback); - } - - /** - * Lists {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location associated with the - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Optional limit on the number of - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} to include in the response. Further - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} can subsequently be obtained by - * including the - * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token} - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - * @param {string} [request.pageToken] - * Optional. Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For - * more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listKeyRingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listKeyRings( - request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing[], - protos.google.cloud.kms.v1.IListKeyRingsRequest|null, - protos.google.cloud.kms.v1.IListKeyRingsResponse - ]>; - listKeyRings( - request: protos.google.cloud.kms.v1.IListKeyRingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListKeyRingsRequest, - protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, - protos.google.cloud.kms.v1.IKeyRing>): void; - listKeyRings( - request: protos.google.cloud.kms.v1.IListKeyRingsRequest, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListKeyRingsRequest, - protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, - protos.google.cloud.kms.v1.IKeyRing>): void; - listKeyRings( - request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.kms.v1.IListKeyRingsRequest, - protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, - protos.google.cloud.kms.v1.IKeyRing>, - callback?: PaginationCallback< - protos.google.cloud.kms.v1.IListKeyRingsRequest, - protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, - protos.google.cloud.kms.v1.IKeyRing>): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing[], - protos.google.cloud.kms.v1.IListKeyRingsRequest|null, - protos.google.cloud.kms.v1.IListKeyRingsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listKeyRings(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location associated with the - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Optional limit on the number of - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} to include in the response. Further - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} can subsequently be obtained by - * including the - * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token} - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - * @param {string} [request.pageToken] - * Optional. Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For - * more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listKeyRingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listKeyRingsStream( - request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listKeyRings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listKeyRings.createStream( - this.innerApiCalls.listKeyRings as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listKeyRings`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location associated with the - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Optional limit on the number of - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} to include in the response. Further - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} can subsequently be obtained by - * including the - * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token} - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - * @param {string} [request.pageToken] - * Optional. Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For - * more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.list_key_rings.js - * region_tag:cloudkms_v1_generated_KeyManagementService_ListKeyRings_async - */ - listKeyRingsAsync( - request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listKeyRings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listKeyRings.asyncIterate( - this.innerApiCalls['listKeyRings'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} - * to list, in the format `projects/* /locations/* /keyRings/*`. - * @param {number} [request.pageSize] - * Optional. Optional limit on the number of - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} to include in the response. - * Further {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} can subsequently be - * obtained by including the - * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token} - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - * @param {string} [request.pageToken] - * Optional. Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.versionView - * The fields of the primary version to include in the response. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For - * more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listCryptoKeysAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listCryptoKeys( - request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey[], - protos.google.cloud.kms.v1.IListCryptoKeysRequest|null, - protos.google.cloud.kms.v1.IListCryptoKeysResponse - ]>; - listCryptoKeys( - request: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>): void; - listCryptoKeys( - request: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>): void; - listCryptoKeys( - request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>, - callback?: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey[], - protos.google.cloud.kms.v1.IListCryptoKeysRequest|null, - protos.google.cloud.kms.v1.IListCryptoKeysResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listCryptoKeys(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} - * to list, in the format `projects/* /locations/* /keyRings/*`. - * @param {number} [request.pageSize] - * Optional. Optional limit on the number of - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} to include in the response. - * Further {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} can subsequently be - * obtained by including the - * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token} - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - * @param {string} [request.pageToken] - * Optional. Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.versionView - * The fields of the primary version to include in the response. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For - * more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listCryptoKeysAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listCryptoKeysStream( - request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCryptoKeys']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCryptoKeys.createStream( - this.innerApiCalls.listCryptoKeys as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCryptoKeys`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} - * to list, in the format `projects/* /locations/* /keyRings/*`. - * @param {number} [request.pageSize] - * Optional. Optional limit on the number of - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} to include in the response. - * Further {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} can subsequently be - * obtained by including the - * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token} - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - * @param {string} [request.pageToken] - * Optional. Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.versionView - * The fields of the primary version to include in the response. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For - * more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.list_crypto_keys.js - * region_tag:cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async - */ - listCryptoKeysAsync( - request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCryptoKeys']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCryptoKeys.asyncIterate( - this.innerApiCalls['listCryptoKeys'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to list, in the format - * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. - * @param {number} [request.pageSize] - * Optional. Optional limit on the number of - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} to include in the - * response. Further {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} - * can subsequently be obtained by including the - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token} - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - * @param {string} [request.pageToken] - * Optional. Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.view - * The fields to include in the response. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For - * more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listCryptoKeyVersionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listCryptoKeyVersions( - request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion[], - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest|null, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse - ]>; - listCryptoKeyVersions( - request: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKeyVersion>): void; - listCryptoKeyVersions( - request: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKeyVersion>): void; - listCryptoKeyVersions( - request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKeyVersion>, - callback?: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKeyVersion>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion[], - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest|null, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listCryptoKeyVersions(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to list, in the format - * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. - * @param {number} [request.pageSize] - * Optional. Optional limit on the number of - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} to include in the - * response. Further {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} - * can subsequently be obtained by including the - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token} - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - * @param {string} [request.pageToken] - * Optional. Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.view - * The fields to include in the response. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For - * more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listCryptoKeyVersionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listCryptoKeyVersionsStream( - request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCryptoKeyVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCryptoKeyVersions.createStream( - this.innerApiCalls.listCryptoKeyVersions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCryptoKeyVersions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to list, in the format - * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. - * @param {number} [request.pageSize] - * Optional. Optional limit on the number of - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} to include in the - * response. Further {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} - * can subsequently be obtained by including the - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token} - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - * @param {string} [request.pageToken] - * Optional. Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.view - * The fields to include in the response. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For - * more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.list_crypto_key_versions.js - * region_tag:cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async - */ - listCryptoKeyVersionsAsync( - request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCryptoKeyVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCryptoKeyVersions.asyncIterate( - this.innerApiCalls['listCryptoKeyVersions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} - * to list, in the format `projects/* /locations/* /keyRings/*`. - * @param {number} [request.pageSize] - * Optional. Optional limit on the number of - * {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} to include in the response. - * Further {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} can subsequently be - * obtained by including the - * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token} - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - * @param {string} [request.pageToken] - * Optional. Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For - * more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listImportJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listImportJobs( - request?: protos.google.cloud.kms.v1.IListImportJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IImportJob[], - protos.google.cloud.kms.v1.IListImportJobsRequest|null, - protos.google.cloud.kms.v1.IListImportJobsResponse - ]>; - listImportJobs( - request: protos.google.cloud.kms.v1.IListImportJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListImportJobsRequest, - protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.kms.v1.IImportJob>): void; - listImportJobs( - request: protos.google.cloud.kms.v1.IListImportJobsRequest, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListImportJobsRequest, - protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.kms.v1.IImportJob>): void; - listImportJobs( - request?: protos.google.cloud.kms.v1.IListImportJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.kms.v1.IListImportJobsRequest, - protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.kms.v1.IImportJob>, - callback?: PaginationCallback< - protos.google.cloud.kms.v1.IListImportJobsRequest, - protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.kms.v1.IImportJob>): - Promise<[ - protos.google.cloud.kms.v1.IImportJob[], - protos.google.cloud.kms.v1.IListImportJobsRequest|null, - protos.google.cloud.kms.v1.IListImportJobsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listImportJobs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} - * to list, in the format `projects/* /locations/* /keyRings/*`. - * @param {number} [request.pageSize] - * Optional. Optional limit on the number of - * {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} to include in the response. - * Further {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} can subsequently be - * obtained by including the - * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token} - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - * @param {string} [request.pageToken] - * Optional. Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For - * more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listImportJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listImportJobsStream( - request?: protos.google.cloud.kms.v1.IListImportJobsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listImportJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listImportJobs.createStream( - this.innerApiCalls.listImportJobs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listImportJobs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} - * to list, in the format `projects/* /locations/* /keyRings/*`. - * @param {number} [request.pageSize] - * Optional. Optional limit on the number of - * {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} to include in the response. - * Further {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} can subsequently be - * obtained by including the - * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token} - * in a subsequent request. If unspecified, the server will pick an - * appropriate default. - * @param {string} [request.pageToken] - * Optional. Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For - * more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. For more information, see - * [Sorting and filtering list - * results](https://cloud.google.com/kms/docs/sorting-and-filtering). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.list_import_jobs.js - * region_tag:cloudkms_v1_generated_KeyManagementService_ListImportJobs_async - */ - listImportJobsAsync( - request?: protos.google.cloud.kms.v1.IListImportJobsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listImportJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listImportJobs.asyncIterate( - this.innerApiCalls['listImportJobs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified cryptoKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @returns {string} Resource name string. - */ - cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { - return this.pathTemplates.cryptoKeyPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - }); - } - - /** - * Parse the project from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; - } - - /** - * Parse the location from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; - } - - /** - * Parse the key_ring from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; - } - - /** - * Parse the crypto_key from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; - } - - /** - * Return a fully-qualified cryptoKeyVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @param {string} crypto_key_version - * @returns {string} Resource name string. - */ - cryptoKeyVersionPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - crypto_key_version: cryptoKeyVersion, - }); - } - - /** - * Parse the project from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).project; - } - - /** - * Parse the location from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).location; - } - - /** - * Parse the key_ring from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).key_ring; - } - - /** - * Parse the crypto_key from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).crypto_key; - } - - /** - * Parse the crypto_key_version from CryptoKeyVersion resource. - * - * @param {string} cryptoKeyVersionName - * A fully-qualified path representing CryptoKeyVersion resource. - * @returns {string} A string representing the crypto_key_version. - */ - matchCryptoKeyVersionFromCryptoKeyVersionName(cryptoKeyVersionName: string) { - return this.pathTemplates.cryptoKeyVersionPathTemplate.match(cryptoKeyVersionName).crypto_key_version; - } - - /** - * Return a fully-qualified ekmConfig resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - ekmConfigPath(project:string,location:string) { - return this.pathTemplates.ekmConfigPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from EkmConfig resource. - * - * @param {string} ekmConfigName - * A fully-qualified path representing EkmConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromEkmConfigName(ekmConfigName: string) { - return this.pathTemplates.ekmConfigPathTemplate.match(ekmConfigName).project; - } - - /** - * Parse the location from EkmConfig resource. - * - * @param {string} ekmConfigName - * A fully-qualified path representing EkmConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromEkmConfigName(ekmConfigName: string) { - return this.pathTemplates.ekmConfigPathTemplate.match(ekmConfigName).location; - } - - /** - * Return a fully-qualified ekmConnection resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} ekm_connection - * @returns {string} Resource name string. - */ - ekmConnectionPath(project:string,location:string,ekmConnection:string) { - return this.pathTemplates.ekmConnectionPathTemplate.render({ - project: project, - location: location, - ekm_connection: ekmConnection, - }); - } - - /** - * Parse the project from EkmConnection resource. - * - * @param {string} ekmConnectionName - * A fully-qualified path representing EkmConnection resource. - * @returns {string} A string representing the project. - */ - matchProjectFromEkmConnectionName(ekmConnectionName: string) { - return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName).project; - } - - /** - * Parse the location from EkmConnection resource. - * - * @param {string} ekmConnectionName - * A fully-qualified path representing EkmConnection resource. - * @returns {string} A string representing the location. - */ - matchLocationFromEkmConnectionName(ekmConnectionName: string) { - return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName).location; - } - - /** - * Parse the ekm_connection from EkmConnection resource. - * - * @param {string} ekmConnectionName - * A fully-qualified path representing EkmConnection resource. - * @returns {string} A string representing the ekm_connection. - */ - matchEkmConnectionFromEkmConnectionName(ekmConnectionName: string) { - return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName).ekm_connection; - } - - /** - * Return a fully-qualified importJob resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} import_job - * @returns {string} Resource name string. - */ - importJobPath(project:string,location:string,keyRing:string,importJob:string) { - return this.pathTemplates.importJobPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - import_job: importJob, - }); - } - - /** - * Parse the project from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the project. - */ - matchProjectFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).project; - } - - /** - * Parse the location from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the location. - */ - matchLocationFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).location; - } - - /** - * Parse the key_ring from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).key_ring; - } - - /** - * Parse the import_job from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the import_job. - */ - matchImportJobFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).import_job; - } - - /** - * Return a fully-qualified keyRing resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @returns {string} Resource name string. - */ - keyRingPath(project:string,location:string,keyRing:string) { - return this.pathTemplates.keyRingPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - }); - } - - /** - * Parse the project from KeyRing resource. - * - * @param {string} keyRingName - * A fully-qualified path representing KeyRing resource. - * @returns {string} A string representing the project. - */ - matchProjectFromKeyRingName(keyRingName: string) { - return this.pathTemplates.keyRingPathTemplate.match(keyRingName).project; - } - - /** - * Parse the location from KeyRing resource. - * - * @param {string} keyRingName - * A fully-qualified path representing KeyRing resource. - * @returns {string} A string representing the location. - */ - matchLocationFromKeyRingName(keyRingName: string) { - return this.pathTemplates.keyRingPathTemplate.match(keyRingName).location; - } - - /** - * Parse the key_ring from KeyRing resource. - * - * @param {string} keyRingName - * A fully-qualified path representing KeyRing resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromKeyRingName(keyRingName: string) { - return this.pathTemplates.keyRingPathTemplate.match(keyRingName).key_ring; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified publicKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @param {string} crypto_key_version - * @returns {string} Resource name string. - */ - publicKeyPath(project:string,location:string,keyRing:string,cryptoKey:string,cryptoKeyVersion:string) { - return this.pathTemplates.publicKeyPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - crypto_key_version: cryptoKeyVersion, - }); - } - - /** - * Parse the project from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the project. - */ - matchProjectFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).project; - } - - /** - * Parse the location from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the location. - */ - matchLocationFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).location; - } - - /** - * Parse the key_ring from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).key_ring; - } - - /** - * Parse the crypto_key from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).crypto_key; - } - - /** - * Parse the crypto_key_version from PublicKey resource. - * - * @param {string} publicKeyName - * A fully-qualified path representing PublicKey resource. - * @returns {string} A string representing the crypto_key_version. - */ - matchCryptoKeyVersionFromPublicKeyName(publicKeyName: string) { - return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName).crypto_key_version; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.keyManagementServiceStub && !this._terminated) { - return this.keyManagementServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_client_config.json b/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_client_config.json deleted file mode 100644 index d30f20d20ed..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_client_config.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "interfaces": { - "google.cloud.kms.v1.KeyManagementService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListKeyRings": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListCryptoKeys": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListCryptoKeyVersions": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListImportJobs": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetKeyRing": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetCryptoKey": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetCryptoKeyVersion": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetPublicKey": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetImportJob": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateKeyRing": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateCryptoKey": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateCryptoKeyVersion": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ImportCryptoKeyVersion": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateImportJob": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateCryptoKey": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateCryptoKeyVersion": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateCryptoKeyPrimaryVersion": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DestroyCryptoKeyVersion": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "RestoreCryptoKeyVersion": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "Encrypt": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "Decrypt": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "RawEncrypt": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RawDecrypt": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AsymmetricSign": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "AsymmetricDecrypt": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "MacSign": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "MacVerify": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GenerateRandomBytes": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_proto_list.json b/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_proto_list.json deleted file mode 100644 index ad57fc558ee..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/src/v1/key_management_service_proto_list.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "../../protos/google/cloud/kms/v1/ekm_service.proto", - "../../protos/google/cloud/kms/v1/resources.proto", - "../../protos/google/cloud/kms/v1/service.proto" -] diff --git a/owl-bot-staging/google-cloud-kms/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-kms/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 269c314a82c..00000000000 --- a/owl-bot-staging/google-cloud-kms/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 kms = require('@google-cloud/kms'); - -function main() { - const ekmServiceClient = new kms.EkmServiceClient(); - const keyManagementServiceClient = new kms.KeyManagementServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-kms/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-kms/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index d2b8592b58d..00000000000 --- a/owl-bot-staging/google-cloud-kms/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 {EkmServiceClient, KeyManagementServiceClient} from '@google-cloud/kms'; - -// check that the client class type name can be used -function doStuffWithEkmServiceClient(client: EkmServiceClient) { - client.close(); -} -function doStuffWithKeyManagementServiceClient(client: KeyManagementServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const ekmServiceClient = new EkmServiceClient(); - doStuffWithEkmServiceClient(ekmServiceClient); - // check that the client instance can be created - const keyManagementServiceClient = new KeyManagementServiceClient(); - doStuffWithKeyManagementServiceClient(keyManagementServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-kms/v1/system-test/install.ts b/owl-bot-staging/google-cloud-kms/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-kms/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-kms/v1/test/gapic_ekm_service_v1.ts b/owl-bot-staging/google-cloud-kms/v1/test/gapic_ekm_service_v1.ts deleted file mode 100644 index 6acdc45f4ce..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/test/gapic_ekm_service_v1.ts +++ /dev/null @@ -1,1943 +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 ekmserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.EkmServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = ekmserviceModule.v1.EkmServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = ekmserviceModule.v1.EkmServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = ekmserviceModule.v1.EkmServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new ekmserviceModule.v1.EkmServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.ekmServiceStub, undefined); - await client.initialize(); - assert(client.ekmServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.ekmServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.ekmServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getEkmConnection', () => { - it('invokes getEkmConnection without error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetEkmConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetEkmConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.EkmConnection() - ); - client.innerApiCalls.getEkmConnection = stubSimpleCall(expectedResponse); - const [response] = await client.getEkmConnection(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getEkmConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEkmConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getEkmConnection without error using callback', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetEkmConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetEkmConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.EkmConnection() - ); - client.innerApiCalls.getEkmConnection = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getEkmConnection( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IEkmConnection|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getEkmConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEkmConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getEkmConnection with error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetEkmConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetEkmConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getEkmConnection = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEkmConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.getEkmConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEkmConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getEkmConnection with closed client', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetEkmConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetEkmConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getEkmConnection(request), expectedError); - }); - }); - - describe('createEkmConnection', () => { - it('invokes createEkmConnection without error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateEkmConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateEkmConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.EkmConnection() - ); - client.innerApiCalls.createEkmConnection = stubSimpleCall(expectedResponse); - const [response] = await client.createEkmConnection(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createEkmConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEkmConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEkmConnection without error using callback', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateEkmConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateEkmConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.EkmConnection() - ); - client.innerApiCalls.createEkmConnection = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createEkmConnection( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IEkmConnection|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createEkmConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEkmConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEkmConnection with error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateEkmConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateEkmConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createEkmConnection = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createEkmConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.createEkmConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEkmConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEkmConnection with closed client', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateEkmConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateEkmConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createEkmConnection(request), expectedError); - }); - }); - - describe('updateEkmConnection', () => { - it('invokes updateEkmConnection without error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateEkmConnectionRequest() - ); - request.ekmConnection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateEkmConnectionRequest', ['ekmConnection', 'name']); - request.ekmConnection.name = defaultValue1; - const expectedHeaderRequestParams = `ekm_connection.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.EkmConnection() - ); - client.innerApiCalls.updateEkmConnection = stubSimpleCall(expectedResponse); - const [response] = await client.updateEkmConnection(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateEkmConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEkmConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateEkmConnection without error using callback', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateEkmConnectionRequest() - ); - request.ekmConnection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateEkmConnectionRequest', ['ekmConnection', 'name']); - request.ekmConnection.name = defaultValue1; - const expectedHeaderRequestParams = `ekm_connection.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.EkmConnection() - ); - client.innerApiCalls.updateEkmConnection = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateEkmConnection( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IEkmConnection|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateEkmConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEkmConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateEkmConnection with error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateEkmConnectionRequest() - ); - request.ekmConnection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateEkmConnectionRequest', ['ekmConnection', 'name']); - request.ekmConnection.name = defaultValue1; - const expectedHeaderRequestParams = `ekm_connection.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateEkmConnection = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateEkmConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.updateEkmConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEkmConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateEkmConnection with closed client', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateEkmConnectionRequest() - ); - request.ekmConnection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateEkmConnectionRequest', ['ekmConnection', 'name']); - request.ekmConnection.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateEkmConnection(request), expectedError); - }); - }); - - describe('getEkmConfig', () => { - it('invokes getEkmConfig without error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetEkmConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetEkmConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.EkmConfig() - ); - client.innerApiCalls.getEkmConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getEkmConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getEkmConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEkmConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getEkmConfig without error using callback', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetEkmConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetEkmConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.EkmConfig() - ); - client.innerApiCalls.getEkmConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getEkmConfig( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IEkmConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getEkmConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEkmConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getEkmConfig with error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetEkmConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetEkmConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getEkmConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEkmConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getEkmConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEkmConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getEkmConfig with closed client', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetEkmConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetEkmConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getEkmConfig(request), expectedError); - }); - }); - - describe('updateEkmConfig', () => { - it('invokes updateEkmConfig without error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateEkmConfigRequest() - ); - request.ekmConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateEkmConfigRequest', ['ekmConfig', 'name']); - request.ekmConfig.name = defaultValue1; - const expectedHeaderRequestParams = `ekm_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.EkmConfig() - ); - client.innerApiCalls.updateEkmConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateEkmConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateEkmConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEkmConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateEkmConfig without error using callback', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateEkmConfigRequest() - ); - request.ekmConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateEkmConfigRequest', ['ekmConfig', 'name']); - request.ekmConfig.name = defaultValue1; - const expectedHeaderRequestParams = `ekm_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.EkmConfig() - ); - client.innerApiCalls.updateEkmConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateEkmConfig( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IEkmConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateEkmConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEkmConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateEkmConfig with error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateEkmConfigRequest() - ); - request.ekmConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateEkmConfigRequest', ['ekmConfig', 'name']); - request.ekmConfig.name = defaultValue1; - const expectedHeaderRequestParams = `ekm_config.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateEkmConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateEkmConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateEkmConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEkmConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateEkmConfig with closed client', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateEkmConfigRequest() - ); - request.ekmConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateEkmConfigRequest', ['ekmConfig', 'name']); - request.ekmConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateEkmConfig(request), expectedError); - }); - }); - - describe('verifyConnectivity', () => { - it('invokes verifyConnectivity without error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.VerifyConnectivityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.VerifyConnectivityRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.VerifyConnectivityResponse() - ); - client.innerApiCalls.verifyConnectivity = stubSimpleCall(expectedResponse); - const [response] = await client.verifyConnectivity(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyConnectivity as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyConnectivity as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyConnectivity without error using callback', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.VerifyConnectivityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.VerifyConnectivityRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.VerifyConnectivityResponse() - ); - client.innerApiCalls.verifyConnectivity = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.verifyConnectivity( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IVerifyConnectivityResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyConnectivity as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyConnectivity as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyConnectivity with error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.VerifyConnectivityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.VerifyConnectivityRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.verifyConnectivity = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.verifyConnectivity(request), expectedError); - const actualRequest = (client.innerApiCalls.verifyConnectivity as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyConnectivity as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyConnectivity with closed client', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.VerifyConnectivityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.VerifyConnectivityRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.verifyConnectivity(request), expectedError); - }); - }); - - describe('listEkmConnections', () => { - it('invokes listEkmConnections without error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListEkmConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), - generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), - generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), - ]; - client.innerApiCalls.listEkmConnections = stubSimpleCall(expectedResponse); - const [response] = await client.listEkmConnections(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEkmConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEkmConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEkmConnections without error using callback', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListEkmConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), - generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), - generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), - ]; - client.innerApiCalls.listEkmConnections = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listEkmConnections( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IEkmConnection[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEkmConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEkmConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEkmConnections with error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListEkmConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listEkmConnections = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listEkmConnections(request), expectedError); - const actualRequest = (client.innerApiCalls.listEkmConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEkmConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEkmConnectionsStream without error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListEkmConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), - generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), - generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), - ]; - client.descriptors.page.listEkmConnections.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listEkmConnectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.EkmConnection[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.EkmConnection) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listEkmConnections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEkmConnections, request)); - assert( - (client.descriptors.page.listEkmConnections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listEkmConnectionsStream with error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListEkmConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listEkmConnections.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listEkmConnectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.EkmConnection[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.EkmConnection) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listEkmConnections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEkmConnections, request)); - assert( - (client.descriptors.page.listEkmConnections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listEkmConnections without error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListEkmConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), - generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), - generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), - ]; - client.descriptors.page.listEkmConnections.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.kms.v1.IEkmConnection[] = []; - const iterable = client.listEkmConnectionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listEkmConnections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listEkmConnections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listEkmConnections with error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListEkmConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listEkmConnections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listEkmConnectionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.kms.v1.IEkmConnection[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listEkmConnections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listEkmConnections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('cryptoKey', () => { - const fakePath = "/rendered/path/cryptoKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - }; - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.cryptoKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cryptoKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cryptoKeyPath', () => { - const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCryptoKeyName', () => { - const result = client.matchProjectFromCryptoKeyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCryptoKeyName', () => { - const result = client.matchLocationFromCryptoKeyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromCryptoKeyName', () => { - const result = client.matchKeyRingFromCryptoKeyName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromCryptoKeyName', () => { - const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('cryptoKeyVersion', () => { - const fakePath = "/rendered/path/cryptoKeyVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - crypto_key_version: "cryptoKeyVersionValue", - }; - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.cryptoKeyVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cryptoKeyVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cryptoKeyVersionPath', () => { - const result = client.cryptoKeyVersionPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCryptoKeyVersionName', () => { - const result = client.matchProjectFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCryptoKeyVersionName', () => { - const result = client.matchLocationFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromCryptoKeyVersionName', () => { - const result = client.matchKeyRingFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromCryptoKeyVersionName', () => { - const result = client.matchCryptoKeyFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyVersionFromCryptoKeyVersionName', () => { - const result = client.matchCryptoKeyVersionFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "cryptoKeyVersionValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('ekmConfig', () => { - const fakePath = "/rendered/path/ekmConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.ekmConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.ekmConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('ekmConfigPath', () => { - const result = client.ekmConfigPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.ekmConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromEkmConfigName', () => { - const result = client.matchProjectFromEkmConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.ekmConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromEkmConfigName', () => { - const result = client.matchLocationFromEkmConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.ekmConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('ekmConnection', () => { - const fakePath = "/rendered/path/ekmConnection"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - ekm_connection: "ekmConnectionValue", - }; - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.ekmConnectionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.ekmConnectionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('ekmConnectionPath', () => { - const result = client.ekmConnectionPath("projectValue", "locationValue", "ekmConnectionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.ekmConnectionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromEkmConnectionName', () => { - const result = client.matchProjectFromEkmConnectionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromEkmConnectionName', () => { - const result = client.matchLocationFromEkmConnectionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEkmConnectionFromEkmConnectionName', () => { - const result = client.matchEkmConnectionFromEkmConnectionName(fakePath); - assert.strictEqual(result, "ekmConnectionValue"); - assert((client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('importJob', () => { - const fakePath = "/rendered/path/importJob"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - import_job: "importJobValue", - }; - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.importJobPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.importJobPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('importJobPath', () => { - const result = client.importJobPath("projectValue", "locationValue", "keyRingValue", "importJobValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.importJobPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromImportJobName', () => { - const result = client.matchProjectFromImportJobName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromImportJobName', () => { - const result = client.matchLocationFromImportJobName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromImportJobName', () => { - const result = client.matchKeyRingFromImportJobName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchImportJobFromImportJobName', () => { - const result = client.matchImportJobFromImportJobName(fakePath); - assert.strictEqual(result, "importJobValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('keyRing', () => { - const fakePath = "/rendered/path/keyRing"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - }; - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.keyRingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.keyRingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('keyRingPath', () => { - const result = client.keyRingPath("projectValue", "locationValue", "keyRingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.keyRingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromKeyRingName', () => { - const result = client.matchProjectFromKeyRingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromKeyRingName', () => { - const result = client.matchLocationFromKeyRingName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromKeyRingName', () => { - const result = client.matchKeyRingFromKeyRingName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('publicKey', () => { - const fakePath = "/rendered/path/publicKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - crypto_key_version: "cryptoKeyVersionValue", - }; - const client = new ekmserviceModule.v1.EkmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.publicKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.publicKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('publicKeyPath', () => { - const result = client.publicKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.publicKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPublicKeyName', () => { - const result = client.matchProjectFromPublicKeyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPublicKeyName', () => { - const result = client.matchLocationFromPublicKeyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromPublicKeyName', () => { - const result = client.matchKeyRingFromPublicKeyName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromPublicKeyName', () => { - const result = client.matchCryptoKeyFromPublicKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyVersionFromPublicKeyName', () => { - const result = client.matchCryptoKeyVersionFromPublicKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyVersionValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-kms/v1/test/gapic_key_management_service_v1.ts b/owl-bot-staging/google-cloud-kms/v1/test/gapic_key_management_service_v1.ts deleted file mode 100644 index 512dc0fd5fe..00000000000 --- a/owl-bot-staging/google-cloud-kms/v1/test/gapic_key_management_service_v1.ts +++ /dev/null @@ -1,4622 +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 keymanagementserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.KeyManagementServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = keymanagementserviceModule.v1.KeyManagementServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = keymanagementserviceModule.v1.KeyManagementServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = keymanagementserviceModule.v1.KeyManagementServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.keyManagementServiceStub, undefined); - await client.initialize(); - assert(client.keyManagementServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.keyManagementServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.keyManagementServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getKeyRing', () => { - it('invokes getKeyRing without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetKeyRingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.KeyRing() - ); - client.innerApiCalls.getKeyRing = stubSimpleCall(expectedResponse); - const [response] = await client.getKeyRing(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getKeyRing without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetKeyRingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.KeyRing() - ); - client.innerApiCalls.getKeyRing = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getKeyRing( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IKeyRing|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getKeyRing with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetKeyRingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getKeyRing = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getKeyRing(request), expectedError); - const actualRequest = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getKeyRing with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetKeyRingRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getKeyRing(request), expectedError); - }); - }); - - describe('getCryptoKey', () => { - it('invokes getCryptoKey without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.getCryptoKey = stubSimpleCall(expectedResponse); - const [response] = await client.getCryptoKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKey without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.getCryptoKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCryptoKey( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKey with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCryptoKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCryptoKey(request), expectedError); - const actualRequest = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKey with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCryptoKey(request), expectedError); - }); - }); - - describe('getCryptoKeyVersion', () => { - it('invokes getCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.getCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.getCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.getCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCryptoKeyVersion(request), expectedError); - }); - }); - - describe('getPublicKey', () => { - it('invokes getPublicKey without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.PublicKey() - ); - client.innerApiCalls.getPublicKey = stubSimpleCall(expectedResponse); - const [response] = await client.getPublicKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPublicKey without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.PublicKey() - ); - client.innerApiCalls.getPublicKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPublicKey( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IPublicKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPublicKey with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getPublicKey(request), expectedError); - const actualRequest = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPublicKey with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getPublicKey(request), expectedError); - }); - }); - - describe('getImportJob', () => { - it('invokes getImportJob without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportJob() - ); - client.innerApiCalls.getImportJob = stubSimpleCall(expectedResponse); - const [response] = await client.getImportJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getImportJob without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportJob() - ); - client.innerApiCalls.getImportJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getImportJob( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IImportJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getImportJob with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getImportJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getImportJob(request), expectedError); - const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getImportJob with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getImportJob(request), expectedError); - }); - }); - - describe('createKeyRing', () => { - it('invokes createKeyRing without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateKeyRingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.KeyRing() - ); - client.innerApiCalls.createKeyRing = stubSimpleCall(expectedResponse); - const [response] = await client.createKeyRing(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createKeyRing without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateKeyRingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.KeyRing() - ); - client.innerApiCalls.createKeyRing = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createKeyRing( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IKeyRing|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createKeyRing with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateKeyRingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createKeyRing = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createKeyRing(request), expectedError); - const actualRequest = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createKeyRing with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateKeyRingRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createKeyRing(request), expectedError); - }); - }); - - describe('createCryptoKey', () => { - it('invokes createCryptoKey without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.createCryptoKey = stubSimpleCall(expectedResponse); - const [response] = await client.createCryptoKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKey without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.createCryptoKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCryptoKey( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKey with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCryptoKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createCryptoKey(request), expectedError); - const actualRequest = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKey with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createCryptoKey(request), expectedError); - }); - }); - - describe('createCryptoKeyVersion', () => { - it('invokes createCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.createCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.createCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.createCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createCryptoKeyVersion(request), expectedError); - }); - }); - - describe('importCryptoKeyVersion', () => { - it('invokes importCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.importCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.importCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.importCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.importCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.importCryptoKeyVersion(request), expectedError); - }); - }); - - describe('createImportJob', () => { - it('invokes createImportJob without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateImportJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportJob() - ); - client.innerApiCalls.createImportJob = stubSimpleCall(expectedResponse); - const [response] = await client.createImportJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImportJob without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateImportJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportJob() - ); - client.innerApiCalls.createImportJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createImportJob( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IImportJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImportJob with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateImportJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createImportJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createImportJob(request), expectedError); - const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImportJob with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateImportJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createImportJob(request), expectedError); - }); - }); - - describe('updateCryptoKey', () => { - it('invokes updateCryptoKey without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() - ); - request.cryptoKey ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyRequest', ['cryptoKey', 'name']); - request.cryptoKey.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.updateCryptoKey = stubSimpleCall(expectedResponse); - const [response] = await client.updateCryptoKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKey without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() - ); - request.cryptoKey ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyRequest', ['cryptoKey', 'name']); - request.cryptoKey.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.updateCryptoKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCryptoKey( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKey with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() - ); - request.cryptoKey ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyRequest', ['cryptoKey', 'name']); - request.cryptoKey.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCryptoKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCryptoKey(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKey with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() - ); - request.cryptoKey ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyRequest', ['cryptoKey', 'name']); - request.cryptoKey.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateCryptoKey(request), expectedError); - }); - }); - - describe('updateCryptoKeyVersion', () => { - it('invokes updateCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() - ); - request.cryptoKeyVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', ['cryptoKeyVersion', 'name']); - request.cryptoKeyVersion.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key_version.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.updateCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.updateCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() - ); - request.cryptoKeyVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', ['cryptoKeyVersion', 'name']); - request.cryptoKeyVersion.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key_version.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.updateCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() - ); - request.cryptoKeyVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', ['cryptoKeyVersion', 'name']); - request.cryptoKeyVersion.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key_version.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() - ); - request.cryptoKeyVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', ['cryptoKeyVersion', 'name']); - request.cryptoKeyVersion.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateCryptoKeyVersion(request), expectedError); - }); - }); - - describe('updateCryptoKeyPrimaryVersion', () => { - it('invokes updateCryptoKeyPrimaryVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.updateCryptoKeyPrimaryVersion = stubSimpleCall(expectedResponse); - const [response] = await client.updateCryptoKeyPrimaryVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyPrimaryVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.updateCryptoKeyPrimaryVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCryptoKeyPrimaryVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyPrimaryVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCryptoKeyPrimaryVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCryptoKeyPrimaryVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyPrimaryVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateCryptoKeyPrimaryVersion(request), expectedError); - }); - }); - - describe('destroyCryptoKeyVersion', () => { - it('invokes destroyCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.destroyCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.destroyCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes destroyCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.destroyCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.destroyCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes destroyCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.destroyCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.destroyCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes destroyCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.destroyCryptoKeyVersion(request), expectedError); - }); - }); - - describe('restoreCryptoKeyVersion', () => { - it('invokes restoreCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.restoreCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.restoreCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.restoreCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.restoreCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.restoreCryptoKeyVersion(request), expectedError); - }); - }); - - describe('encrypt', () => { - it('invokes encrypt without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.EncryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptResponse() - ); - client.innerApiCalls.encrypt = stubSimpleCall(expectedResponse); - const [response] = await client.encrypt(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes encrypt without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.EncryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptResponse() - ); - client.innerApiCalls.encrypt = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.encrypt( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IEncryptResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes encrypt with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.EncryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.encrypt = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.encrypt(request), expectedError); - const actualRequest = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes encrypt with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.EncryptRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.encrypt(request), expectedError); - }); - }); - - describe('decrypt', () => { - it('invokes decrypt without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptResponse() - ); - client.innerApiCalls.decrypt = stubSimpleCall(expectedResponse); - const [response] = await client.decrypt(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes decrypt without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptResponse() - ); - client.innerApiCalls.decrypt = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.decrypt( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IDecryptResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes decrypt with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.decrypt = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.decrypt(request), expectedError); - const actualRequest = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes decrypt with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DecryptRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.decrypt(request), expectedError); - }); - }); - - describe('rawEncrypt', () => { - it('invokes rawEncrypt without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RawEncryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RawEncryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.RawEncryptResponse() - ); - client.innerApiCalls.rawEncrypt = stubSimpleCall(expectedResponse); - const [response] = await client.rawEncrypt(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rawEncrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rawEncrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rawEncrypt without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RawEncryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RawEncryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.RawEncryptResponse() - ); - client.innerApiCalls.rawEncrypt = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rawEncrypt( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IRawEncryptResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rawEncrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rawEncrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rawEncrypt with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RawEncryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RawEncryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rawEncrypt = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.rawEncrypt(request), expectedError); - const actualRequest = (client.innerApiCalls.rawEncrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rawEncrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rawEncrypt with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RawEncryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RawEncryptRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.rawEncrypt(request), expectedError); - }); - }); - - describe('rawDecrypt', () => { - it('invokes rawDecrypt without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RawDecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RawDecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.RawDecryptResponse() - ); - client.innerApiCalls.rawDecrypt = stubSimpleCall(expectedResponse); - const [response] = await client.rawDecrypt(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rawDecrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rawDecrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rawDecrypt without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RawDecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RawDecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.RawDecryptResponse() - ); - client.innerApiCalls.rawDecrypt = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rawDecrypt( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IRawDecryptResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rawDecrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rawDecrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rawDecrypt with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RawDecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RawDecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rawDecrypt = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.rawDecrypt(request), expectedError); - const actualRequest = (client.innerApiCalls.rawDecrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rawDecrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rawDecrypt with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RawDecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RawDecryptRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.rawDecrypt(request), expectedError); - }); - }); - - describe('asymmetricSign', () => { - it('invokes asymmetricSign without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricSignRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignResponse() - ); - client.innerApiCalls.asymmetricSign = stubSimpleCall(expectedResponse); - const [response] = await client.asymmetricSign(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricSign without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricSignRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignResponse() - ); - client.innerApiCalls.asymmetricSign = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.asymmetricSign( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IAsymmetricSignResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricSign with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricSignRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.asymmetricSign = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.asymmetricSign(request), expectedError); - const actualRequest = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricSign with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricSignRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.asymmetricSign(request), expectedError); - }); - }); - - describe('asymmetricDecrypt', () => { - it('invokes asymmetricDecrypt without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricDecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptResponse() - ); - client.innerApiCalls.asymmetricDecrypt = stubSimpleCall(expectedResponse); - const [response] = await client.asymmetricDecrypt(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricDecrypt without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricDecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptResponse() - ); - client.innerApiCalls.asymmetricDecrypt = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.asymmetricDecrypt( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IAsymmetricDecryptResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricDecrypt with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricDecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.asymmetricDecrypt = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.asymmetricDecrypt(request), expectedError); - const actualRequest = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricDecrypt with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricDecryptRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.asymmetricDecrypt(request), expectedError); - }); - }); - - describe('macSign', () => { - it('invokes macSign without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.MacSignRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.MacSignRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.MacSignResponse() - ); - client.innerApiCalls.macSign = stubSimpleCall(expectedResponse); - const [response] = await client.macSign(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.macSign as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.macSign as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes macSign without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.MacSignRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.MacSignRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.MacSignResponse() - ); - client.innerApiCalls.macSign = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.macSign( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IMacSignResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.macSign as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.macSign as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes macSign with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.MacSignRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.MacSignRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.macSign = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.macSign(request), expectedError); - const actualRequest = (client.innerApiCalls.macSign as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.macSign as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes macSign with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.MacSignRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.MacSignRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.macSign(request), expectedError); - }); - }); - - describe('macVerify', () => { - it('invokes macVerify without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.MacVerifyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.MacVerifyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.MacVerifyResponse() - ); - client.innerApiCalls.macVerify = stubSimpleCall(expectedResponse); - const [response] = await client.macVerify(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.macVerify as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.macVerify as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes macVerify without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.MacVerifyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.MacVerifyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.MacVerifyResponse() - ); - client.innerApiCalls.macVerify = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.macVerify( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IMacVerifyResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.macVerify as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.macVerify as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes macVerify with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.MacVerifyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.MacVerifyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.macVerify = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.macVerify(request), expectedError); - const actualRequest = (client.innerApiCalls.macVerify as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.macVerify as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes macVerify with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.MacVerifyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.MacVerifyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.macVerify(request), expectedError); - }); - }); - - describe('generateRandomBytes', () => { - it('invokes generateRandomBytes without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GenerateRandomBytesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GenerateRandomBytesRequest', ['location']); - request.location = defaultValue1; - const expectedHeaderRequestParams = `location=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.GenerateRandomBytesResponse() - ); - client.innerApiCalls.generateRandomBytes = stubSimpleCall(expectedResponse); - const [response] = await client.generateRandomBytes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateRandomBytes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateRandomBytes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateRandomBytes without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GenerateRandomBytesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GenerateRandomBytesRequest', ['location']); - request.location = defaultValue1; - const expectedHeaderRequestParams = `location=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.GenerateRandomBytesResponse() - ); - client.innerApiCalls.generateRandomBytes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateRandomBytes( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IGenerateRandomBytesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateRandomBytes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateRandomBytes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateRandomBytes with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GenerateRandomBytesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GenerateRandomBytesRequest', ['location']); - request.location = defaultValue1; - const expectedHeaderRequestParams = `location=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateRandomBytes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateRandomBytes(request), expectedError); - const actualRequest = (client.innerApiCalls.generateRandomBytes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateRandomBytes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateRandomBytes with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GenerateRandomBytesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GenerateRandomBytesRequest', ['location']); - request.location = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateRandomBytes(request), expectedError); - }); - }); - - describe('listKeyRings', () => { - it('invokes listKeyRings without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - ]; - client.innerApiCalls.listKeyRings = stubSimpleCall(expectedResponse); - const [response] = await client.listKeyRings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listKeyRings without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - ]; - client.innerApiCalls.listKeyRings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listKeyRings( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IKeyRing[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listKeyRings with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listKeyRings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listKeyRings(request), expectedError); - const actualRequest = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listKeyRingsStream without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - ]; - client.descriptors.page.listKeyRings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listKeyRingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.KeyRing[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.KeyRing) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listKeyRings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listKeyRings, request)); - assert( - (client.descriptors.page.listKeyRings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listKeyRingsStream with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listKeyRings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listKeyRingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.KeyRing[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.KeyRing) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listKeyRings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listKeyRings, request)); - assert( - (client.descriptors.page.listKeyRings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listKeyRings without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - ]; - client.descriptors.page.listKeyRings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.kms.v1.IKeyRing[] = []; - const iterable = client.listKeyRingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listKeyRings with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listKeyRings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listKeyRingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.kms.v1.IKeyRing[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listCryptoKeys', () => { - it('invokes listCryptoKeys without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - ]; - client.innerApiCalls.listCryptoKeys = stubSimpleCall(expectedResponse); - const [response] = await client.listCryptoKeys(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeys without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - ]; - client.innerApiCalls.listCryptoKeys = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCryptoKeys( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeys with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCryptoKeys = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCryptoKeys(request), expectedError); - const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeysStream without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - ]; - client.descriptors.page.listCryptoKeys.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCryptoKeysStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.CryptoKey[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKey) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCryptoKeys.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCryptoKeys, request)); - assert( - (client.descriptors.page.listCryptoKeys.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listCryptoKeysStream with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listCryptoKeys.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCryptoKeysStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.CryptoKey[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKey) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCryptoKeys.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCryptoKeys, request)); - assert( - (client.descriptors.page.listCryptoKeys.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCryptoKeys without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - ]; - client.descriptors.page.listCryptoKeys.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.kms.v1.ICryptoKey[] = []; - const iterable = client.listCryptoKeysAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCryptoKeys with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listCryptoKeys.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCryptoKeysAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.kms.v1.ICryptoKey[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listCryptoKeyVersions', () => { - it('invokes listCryptoKeyVersions without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - ]; - client.innerApiCalls.listCryptoKeyVersions = stubSimpleCall(expectedResponse); - const [response] = await client.listCryptoKeyVersions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeyVersions without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - ]; - client.innerApiCalls.listCryptoKeyVersions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCryptoKeyVersions( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeyVersions with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCryptoKeyVersions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCryptoKeyVersions(request), expectedError); - const actualRequest = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeyVersionsStream without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - ]; - client.descriptors.page.listCryptoKeyVersions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCryptoKeyVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.CryptoKeyVersion[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKeyVersion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCryptoKeyVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCryptoKeyVersions, request)); - assert( - (client.descriptors.page.listCryptoKeyVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listCryptoKeyVersionsStream with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listCryptoKeyVersions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCryptoKeyVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.CryptoKeyVersion[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKeyVersion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCryptoKeyVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCryptoKeyVersions, request)); - assert( - (client.descriptors.page.listCryptoKeyVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCryptoKeyVersions without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - ]; - client.descriptors.page.listCryptoKeyVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.kms.v1.ICryptoKeyVersion[] = []; - const iterable = client.listCryptoKeyVersionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCryptoKeyVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCryptoKeyVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCryptoKeyVersions with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listCryptoKeyVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCryptoKeyVersionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.kms.v1.ICryptoKeyVersion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCryptoKeyVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCryptoKeyVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listImportJobs', () => { - it('invokes listImportJobs without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - ]; - client.innerApiCalls.listImportJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listImportJobs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listImportJobs without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - ]; - client.innerApiCalls.listImportJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listImportJobs( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IImportJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listImportJobs with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listImportJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listImportJobs(request), expectedError); - const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listImportJobsStream without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - ]; - client.descriptors.page.listImportJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listImportJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.ImportJob[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.ImportJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listImportJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listImportJobs, request)); - assert( - (client.descriptors.page.listImportJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listImportJobsStream with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listImportJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listImportJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.ImportJob[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.ImportJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listImportJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listImportJobs, request)); - assert( - (client.descriptors.page.listImportJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listImportJobs without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - ]; - client.descriptors.page.listImportJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.kms.v1.IImportJob[] = []; - const iterable = client.listImportJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listImportJobs with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listImportJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listImportJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.kms.v1.IImportJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('cryptoKey', () => { - const fakePath = "/rendered/path/cryptoKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - }; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.cryptoKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cryptoKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cryptoKeyPath', () => { - const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCryptoKeyName', () => { - const result = client.matchProjectFromCryptoKeyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCryptoKeyName', () => { - const result = client.matchLocationFromCryptoKeyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromCryptoKeyName', () => { - const result = client.matchKeyRingFromCryptoKeyName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromCryptoKeyName', () => { - const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('cryptoKeyVersion', () => { - const fakePath = "/rendered/path/cryptoKeyVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - crypto_key_version: "cryptoKeyVersionValue", - }; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.cryptoKeyVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cryptoKeyVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cryptoKeyVersionPath', () => { - const result = client.cryptoKeyVersionPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCryptoKeyVersionName', () => { - const result = client.matchProjectFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCryptoKeyVersionName', () => { - const result = client.matchLocationFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromCryptoKeyVersionName', () => { - const result = client.matchKeyRingFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromCryptoKeyVersionName', () => { - const result = client.matchCryptoKeyFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyVersionFromCryptoKeyVersionName', () => { - const result = client.matchCryptoKeyVersionFromCryptoKeyVersionName(fakePath); - assert.strictEqual(result, "cryptoKeyVersionValue"); - assert((client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('ekmConfig', () => { - const fakePath = "/rendered/path/ekmConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.ekmConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.ekmConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('ekmConfigPath', () => { - const result = client.ekmConfigPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.ekmConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromEkmConfigName', () => { - const result = client.matchProjectFromEkmConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.ekmConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromEkmConfigName', () => { - const result = client.matchLocationFromEkmConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.ekmConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('ekmConnection', () => { - const fakePath = "/rendered/path/ekmConnection"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - ekm_connection: "ekmConnectionValue", - }; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.ekmConnectionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.ekmConnectionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('ekmConnectionPath', () => { - const result = client.ekmConnectionPath("projectValue", "locationValue", "ekmConnectionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.ekmConnectionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromEkmConnectionName', () => { - const result = client.matchProjectFromEkmConnectionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromEkmConnectionName', () => { - const result = client.matchLocationFromEkmConnectionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEkmConnectionFromEkmConnectionName', () => { - const result = client.matchEkmConnectionFromEkmConnectionName(fakePath); - assert.strictEqual(result, "ekmConnectionValue"); - assert((client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('importJob', () => { - const fakePath = "/rendered/path/importJob"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - import_job: "importJobValue", - }; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.importJobPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.importJobPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('importJobPath', () => { - const result = client.importJobPath("projectValue", "locationValue", "keyRingValue", "importJobValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.importJobPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromImportJobName', () => { - const result = client.matchProjectFromImportJobName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromImportJobName', () => { - const result = client.matchLocationFromImportJobName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromImportJobName', () => { - const result = client.matchKeyRingFromImportJobName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchImportJobFromImportJobName', () => { - const result = client.matchImportJobFromImportJobName(fakePath); - assert.strictEqual(result, "importJobValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('keyRing', () => { - const fakePath = "/rendered/path/keyRing"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - }; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.keyRingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.keyRingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('keyRingPath', () => { - const result = client.keyRingPath("projectValue", "locationValue", "keyRingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.keyRingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromKeyRingName', () => { - const result = client.matchProjectFromKeyRingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromKeyRingName', () => { - const result = client.matchLocationFromKeyRingName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromKeyRingName', () => { - const result = client.matchKeyRingFromKeyRingName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.keyRingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('publicKey', () => { - const fakePath = "/rendered/path/publicKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - crypto_key_version: "cryptoKeyVersionValue", - }; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.publicKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.publicKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('publicKeyPath', () => { - const result = client.publicKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue", "cryptoKeyVersionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.publicKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPublicKeyName', () => { - const result = client.matchProjectFromPublicKeyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPublicKeyName', () => { - const result = client.matchLocationFromPublicKeyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromPublicKeyName', () => { - const result = client.matchKeyRingFromPublicKeyName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromPublicKeyName', () => { - const result = client.matchCryptoKeyFromPublicKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyVersionFromPublicKeyName', () => { - const result = client.matchCryptoKeyVersionFromPublicKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyVersionValue"); - assert((client.pathTemplates.publicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-kms/v1/tsconfig.json b/owl-bot-staging/google-cloud-kms/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-kms/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-kms/v1/webpack.config.js b/owl-bot-staging/google-cloud-kms/v1/webpack.config.js deleted file mode 100644 index ea2d522ae9e..00000000000 --- a/owl-bot-staging/google-cloud-kms/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: 'EkmService', - filename: './ekm-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/owl-bot-staging/google-cloud-language/v1/.eslintignore b/owl-bot-staging/google-cloud-language/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-language/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-language/v1/.eslintrc.json b/owl-bot-staging/google-cloud-language/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-language/v1/.gitignore b/owl-bot-staging/google-cloud-language/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-language/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-language/v1/.jsdoc.js b/owl-bot-staging/google-cloud-language/v1/.jsdoc.js deleted file mode 100644 index 31167957cc8..00000000000 --- a/owl-bot-staging/google-cloud-language/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/language', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-language/v1/.mocharc.js b/owl-bot-staging/google-cloud-language/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-language/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-language/v1/.prettierrc.js b/owl-bot-staging/google-cloud-language/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-language/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-language/v1/README.md b/owl-bot-staging/google-cloud-language/v1/README.md deleted file mode 100644 index 7287da54696..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Language: Nodejs Client diff --git a/owl-bot-staging/google-cloud-language/v1/package.json b/owl-bot-staging/google-cloud-language/v1/package.json deleted file mode 100644 index c158c05feac..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/language", - "version": "0.1.0", - "description": "Language client for Node.js", - "repository": "googleapis/nodejs-language", - "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 language", - "language", - "language service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-language/v1/protos/google/cloud/language/v1/language_service.proto b/owl-bot-staging/google-cloud-language/v1/protos/google/cloud/language/v1/language_service.proto deleted file mode 100644 index d34240827c3..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/protos/google/cloud/language/v1/language_service.proto +++ /dev/null @@ -1,1211 +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 -// -// 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.language.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/language/apiv1/languagepb;languagepb"; -option java_multiple_files = true; -option java_outer_classname = "LanguageServiceProto"; -option java_package = "com.google.cloud.language.v1"; - -// Provides text analysis operations such as sentiment analysis and entity -// recognition. -service LanguageService { - option (google.api.default_host) = "language.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-language," - "https://www.googleapis.com/auth/cloud-platform"; - - // Analyzes the sentiment of the provided text. - rpc AnalyzeSentiment(AnalyzeSentimentRequest) - returns (AnalyzeSentimentResponse) { - option (google.api.http) = { - post: "/v1/documents:analyzeSentiment" - body: "*" - }; - option (google.api.method_signature) = "document,encoding_type"; - option (google.api.method_signature) = "document"; - } - - // Finds named entities (currently proper names and common nouns) in the text - // along with entity types, salience, mentions for each entity, and - // other properties. - rpc AnalyzeEntities(AnalyzeEntitiesRequest) - returns (AnalyzeEntitiesResponse) { - option (google.api.http) = { - post: "/v1/documents:analyzeEntities" - body: "*" - }; - option (google.api.method_signature) = "document,encoding_type"; - option (google.api.method_signature) = "document"; - } - - // Finds entities, similar to - // [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] - // in the text and analyzes sentiment associated with each entity and its - // mentions. - rpc AnalyzeEntitySentiment(AnalyzeEntitySentimentRequest) - returns (AnalyzeEntitySentimentResponse) { - option (google.api.http) = { - post: "/v1/documents:analyzeEntitySentiment" - body: "*" - }; - option (google.api.method_signature) = "document,encoding_type"; - option (google.api.method_signature) = "document"; - } - - // Analyzes the syntax of the text and provides sentence boundaries and - // tokenization along with part of speech tags, dependency trees, and other - // properties. - rpc AnalyzeSyntax(AnalyzeSyntaxRequest) returns (AnalyzeSyntaxResponse) { - option (google.api.http) = { - post: "/v1/documents:analyzeSyntax" - body: "*" - }; - option (google.api.method_signature) = "document,encoding_type"; - option (google.api.method_signature) = "document"; - } - - // Classifies a document into categories. - rpc ClassifyText(ClassifyTextRequest) returns (ClassifyTextResponse) { - option (google.api.http) = { - post: "/v1/documents:classifyText" - body: "*" - }; - option (google.api.method_signature) = "document"; - } - - // Moderates a document for harmful and sensitive categories. - rpc ModerateText(ModerateTextRequest) returns (ModerateTextResponse) { - option (google.api.http) = { - post: "/v1/documents:moderateText" - body: "*" - }; - option (google.api.method_signature) = "document"; - } - - // A convenience method that provides all the features that analyzeSentiment, - // analyzeEntities, and analyzeSyntax provide in one call. - rpc AnnotateText(AnnotateTextRequest) returns (AnnotateTextResponse) { - option (google.api.http) = { - post: "/v1/documents:annotateText" - body: "*" - }; - option (google.api.method_signature) = "document,features,encoding_type"; - option (google.api.method_signature) = "document,features"; - } -} - -// Represents the input to API methods. -message Document { - // The document types enum. - enum Type { - // The content type is not specified. - TYPE_UNSPECIFIED = 0; - - // Plain text - PLAIN_TEXT = 1; - - // HTML - HTML = 2; - } - - // Required. If the type is not set or is `TYPE_UNSPECIFIED`, - // returns an `INVALID_ARGUMENT` error. - Type type = 1; - - // The source of the document: a string containing the content or a - // Google Cloud Storage URI. - oneof source { - // The content of the input in string format. - // Cloud audit logging exempt since it is based on user data. - string content = 2; - - // The Google Cloud Storage URI where the file content is located. - // This URI must be of the form: gs://bucket_name/object_name. For more - // details, see https://cloud.google.com/storage/docs/reference-uris. - // NOTE: Cloud Storage object versioning is not supported. - string gcs_content_uri = 3; - } - - // The language of the document (if not specified, the language is - // automatically detected). Both ISO and BCP-47 language codes are - // accepted.
- // [Language - // Support](https://cloud.google.com/natural-language/docs/languages) lists - // currently supported languages for each API method. If the language (either - // specified by the caller or automatically detected) is not supported by the - // called API method, an `INVALID_ARGUMENT` error is returned. - string language = 4; -} - -// Represents a sentence in the input document. -message Sentence { - // The sentence text. - TextSpan text = 1; - - // For calls to [AnalyzeSentiment][] or if - // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment] - // is set to true, this field will contain the sentiment for the sentence. - Sentiment sentiment = 2; -} - -// Represents the text encoding that the caller uses to process the output. -// Providing an `EncodingType` is recommended because the API provides the -// beginning offsets for various outputs, such as tokens and mentions, and -// languages that natively use different text encodings may access offsets -// differently. -enum EncodingType { - // If `EncodingType` is not specified, encoding-dependent information (such as - // `begin_offset`) will be set at `-1`. - NONE = 0; - - // Encoding-dependent information (such as `begin_offset`) is calculated based - // on the UTF-8 encoding of the input. C++ and Go are examples of languages - // that use this encoding natively. - UTF8 = 1; - - // Encoding-dependent information (such as `begin_offset`) is calculated based - // on the UTF-16 encoding of the input. Java and JavaScript are examples of - // languages that use this encoding natively. - UTF16 = 2; - - // Encoding-dependent information (such as `begin_offset`) is calculated based - // on the UTF-32 encoding of the input. Python is an example of a language - // that uses this encoding natively. - UTF32 = 3; -} - -// Represents a phrase in the text that is a known entity, such as -// a person, an organization, or location. The API associates information, such -// as salience and mentions, with entities. -message Entity { - // The type of the entity. For most entity types, the associated metadata is a - // Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table - // below lists the associated fields for entities that have different - // metadata. - enum Type { - // Unknown - UNKNOWN = 0; - - // Person - PERSON = 1; - - // Location - LOCATION = 2; - - // Organization - ORGANIZATION = 3; - - // Event - EVENT = 4; - - // Artwork - WORK_OF_ART = 5; - - // Consumer product - CONSUMER_GOOD = 6; - - // Other types of entities - OTHER = 7; - - // Phone number - // - // The metadata lists the phone number, formatted according to local - // convention, plus whichever additional elements appear in the text: - // - // * `number` - the actual number, broken down into sections as per local - // convention - // * `national_prefix` - country code, if detected - // * `area_code` - region or area code, if detected - // * `extension` - phone extension (to be dialed after connection), if - // detected - PHONE_NUMBER = 9; - - // Address - // - // The metadata identifies the street number and locality plus whichever - // additional elements appear in the text: - // - // * `street_number` - street number - // * `locality` - city or town - // * `street_name` - street/route name, if detected - // * `postal_code` - postal code, if detected - // * `country` - country, if detected< - // * `broad_region` - administrative area, such as the state, if detected - // * `narrow_region` - smaller administrative area, such as county, if - // detected - // * `sublocality` - used in Asian addresses to demark a district within a - // city, if detected - ADDRESS = 10; - - // Date - // - // The metadata identifies the components of the date: - // - // * `year` - four digit year, if detected - // * `month` - two digit month number, if detected - // * `day` - two digit day number, if detected - DATE = 11; - - // Number - // - // The metadata is the number itself. - NUMBER = 12; - - // Price - // - // The metadata identifies the `value` and `currency`. - PRICE = 13; - } - - // The representative name for the entity. - string name = 1; - - // The entity type. - Type type = 2; - - // Metadata associated with the entity. - // - // For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) - // and Knowledge Graph MID (`mid`), if they are available. For the metadata - // associated with other entity types, see the Type table below. - map metadata = 3; - - // The salience score associated with the entity in the [0, 1.0] range. - // - // The salience score for an entity provides information about the - // importance or centrality of that entity to the entire document text. - // Scores closer to 0 are less salient, while scores closer to 1.0 are highly - // salient. - float salience = 4; - - // The mentions of this entity in the input document. The API currently - // supports proper noun mentions. - repeated EntityMention mentions = 5; - - // For calls to [AnalyzeEntitySentiment][] or if - // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] - // is set to true, this field will contain the aggregate sentiment expressed - // for this entity in the provided document. - Sentiment sentiment = 6; -} - -// Represents the smallest syntactic building block of the text. -message Token { - // The token text. - TextSpan text = 1; - - // Parts of speech tag for this token. - PartOfSpeech part_of_speech = 2; - - // Dependency tree parse for this token. - DependencyEdge dependency_edge = 3; - - // [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. - string lemma = 4; -} - -// Represents the feeling associated with the entire text or entities in -// the text. -message Sentiment { - // A non-negative number in the [0, +inf) range, which represents - // the absolute magnitude of sentiment regardless of score (positive or - // negative). - float magnitude = 2; - - // Sentiment score between -1.0 (negative sentiment) and 1.0 - // (positive sentiment). - float score = 3; -} - -// Represents part of speech information for a token. Parts of speech -// are as defined in -// http://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf -message PartOfSpeech { - // The part of speech tags enum. - enum Tag { - // Unknown - UNKNOWN = 0; - - // Adjective - ADJ = 1; - - // Adposition (preposition and postposition) - ADP = 2; - - // Adverb - ADV = 3; - - // Conjunction - CONJ = 4; - - // Determiner - DET = 5; - - // Noun (common and proper) - NOUN = 6; - - // Cardinal number - NUM = 7; - - // Pronoun - PRON = 8; - - // Particle or other function word - PRT = 9; - - // Punctuation - PUNCT = 10; - - // Verb (all tenses and modes) - VERB = 11; - - // Other: foreign words, typos, abbreviations - X = 12; - - // Affix - AFFIX = 13; - } - - // The characteristic of a verb that expresses time flow during an event. - enum Aspect { - // Aspect is not applicable in the analyzed language or is not predicted. - ASPECT_UNKNOWN = 0; - - // Perfective - PERFECTIVE = 1; - - // Imperfective - IMPERFECTIVE = 2; - - // Progressive - PROGRESSIVE = 3; - } - - // The grammatical function performed by a noun or pronoun in a phrase, - // clause, or sentence. In some languages, other parts of speech, such as - // adjective and determiner, take case inflection in agreement with the noun. - enum Case { - // Case is not applicable in the analyzed language or is not predicted. - CASE_UNKNOWN = 0; - - // Accusative - ACCUSATIVE = 1; - - // Adverbial - ADVERBIAL = 2; - - // Complementive - COMPLEMENTIVE = 3; - - // Dative - DATIVE = 4; - - // Genitive - GENITIVE = 5; - - // Instrumental - INSTRUMENTAL = 6; - - // Locative - LOCATIVE = 7; - - // Nominative - NOMINATIVE = 8; - - // Oblique - OBLIQUE = 9; - - // Partitive - PARTITIVE = 10; - - // Prepositional - PREPOSITIONAL = 11; - - // Reflexive - REFLEXIVE_CASE = 12; - - // Relative - RELATIVE_CASE = 13; - - // Vocative - VOCATIVE = 14; - } - - // Depending on the language, Form can be categorizing different forms of - // verbs, adjectives, adverbs, etc. For example, categorizing inflected - // endings of verbs and adjectives or distinguishing between short and long - // forms of adjectives and participles - enum Form { - // Form is not applicable in the analyzed language or is not predicted. - FORM_UNKNOWN = 0; - - // Adnomial - ADNOMIAL = 1; - - // Auxiliary - AUXILIARY = 2; - - // Complementizer - COMPLEMENTIZER = 3; - - // Final ending - FINAL_ENDING = 4; - - // Gerund - GERUND = 5; - - // Realis - REALIS = 6; - - // Irrealis - IRREALIS = 7; - - // Short form - SHORT = 8; - - // Long form - LONG = 9; - - // Order form - ORDER = 10; - - // Specific form - SPECIFIC = 11; - } - - // Gender classes of nouns reflected in the behaviour of associated words. - enum Gender { - // Gender is not applicable in the analyzed language or is not predicted. - GENDER_UNKNOWN = 0; - - // Feminine - FEMININE = 1; - - // Masculine - MASCULINE = 2; - - // Neuter - NEUTER = 3; - } - - // The grammatical feature of verbs, used for showing modality and attitude. - enum Mood { - // Mood is not applicable in the analyzed language or is not predicted. - MOOD_UNKNOWN = 0; - - // Conditional - CONDITIONAL_MOOD = 1; - - // Imperative - IMPERATIVE = 2; - - // Indicative - INDICATIVE = 3; - - // Interrogative - INTERROGATIVE = 4; - - // Jussive - JUSSIVE = 5; - - // Subjunctive - SUBJUNCTIVE = 6; - } - - // Count distinctions. - enum Number { - // Number is not applicable in the analyzed language or is not predicted. - NUMBER_UNKNOWN = 0; - - // Singular - SINGULAR = 1; - - // Plural - PLURAL = 2; - - // Dual - DUAL = 3; - } - - // The distinction between the speaker, second person, third person, etc. - enum Person { - // Person is not applicable in the analyzed language or is not predicted. - PERSON_UNKNOWN = 0; - - // First - FIRST = 1; - - // Second - SECOND = 2; - - // Third - THIRD = 3; - - // Reflexive - REFLEXIVE_PERSON = 4; - } - - // This category shows if the token is part of a proper name. - enum Proper { - // Proper is not applicable in the analyzed language or is not predicted. - PROPER_UNKNOWN = 0; - - // Proper - PROPER = 1; - - // Not proper - NOT_PROPER = 2; - } - - // Reciprocal features of a pronoun. - enum Reciprocity { - // Reciprocity is not applicable in the analyzed language or is not - // predicted. - RECIPROCITY_UNKNOWN = 0; - - // Reciprocal - RECIPROCAL = 1; - - // Non-reciprocal - NON_RECIPROCAL = 2; - } - - // Time reference. - enum Tense { - // Tense is not applicable in the analyzed language or is not predicted. - TENSE_UNKNOWN = 0; - - // Conditional - CONDITIONAL_TENSE = 1; - - // Future - FUTURE = 2; - - // Past - PAST = 3; - - // Present - PRESENT = 4; - - // Imperfect - IMPERFECT = 5; - - // Pluperfect - PLUPERFECT = 6; - } - - // The relationship between the action that a verb expresses and the - // participants identified by its arguments. - enum Voice { - // Voice is not applicable in the analyzed language or is not predicted. - VOICE_UNKNOWN = 0; - - // Active - ACTIVE = 1; - - // Causative - CAUSATIVE = 2; - - // Passive - PASSIVE = 3; - } - - // The part of speech tag. - Tag tag = 1; - - // The grammatical aspect. - Aspect aspect = 2; - - // The grammatical case. - Case case = 3; - - // The grammatical form. - Form form = 4; - - // The grammatical gender. - Gender gender = 5; - - // The grammatical mood. - Mood mood = 6; - - // The grammatical number. - Number number = 7; - - // The grammatical person. - Person person = 8; - - // The grammatical properness. - Proper proper = 9; - - // The grammatical reciprocity. - Reciprocity reciprocity = 10; - - // The grammatical tense. - Tense tense = 11; - - // The grammatical voice. - Voice voice = 12; -} - -// Represents dependency parse tree information for a token. (For more -// information on dependency labels, see -// http://www.aclweb.org/anthology/P13-2017 -message DependencyEdge { - // The parse label enum for the token. - enum Label { - // Unknown - UNKNOWN = 0; - - // Abbreviation modifier - ABBREV = 1; - - // Adjectival complement - ACOMP = 2; - - // Adverbial clause modifier - ADVCL = 3; - - // Adverbial modifier - ADVMOD = 4; - - // Adjectival modifier of an NP - AMOD = 5; - - // Appositional modifier of an NP - APPOS = 6; - - // Attribute dependent of a copular verb - ATTR = 7; - - // Auxiliary (non-main) verb - AUX = 8; - - // Passive auxiliary - AUXPASS = 9; - - // Coordinating conjunction - CC = 10; - - // Clausal complement of a verb or adjective - CCOMP = 11; - - // Conjunct - CONJ = 12; - - // Clausal subject - CSUBJ = 13; - - // Clausal passive subject - CSUBJPASS = 14; - - // Dependency (unable to determine) - DEP = 15; - - // Determiner - DET = 16; - - // Discourse - DISCOURSE = 17; - - // Direct object - DOBJ = 18; - - // Expletive - EXPL = 19; - - // Goes with (part of a word in a text not well edited) - GOESWITH = 20; - - // Indirect object - IOBJ = 21; - - // Marker (word introducing a subordinate clause) - MARK = 22; - - // Multi-word expression - MWE = 23; - - // Multi-word verbal expression - MWV = 24; - - // Negation modifier - NEG = 25; - - // Noun compound modifier - NN = 26; - - // Noun phrase used as an adverbial modifier - NPADVMOD = 27; - - // Nominal subject - NSUBJ = 28; - - // Passive nominal subject - NSUBJPASS = 29; - - // Numeric modifier of a noun - NUM = 30; - - // Element of compound number - NUMBER = 31; - - // Punctuation mark - P = 32; - - // Parataxis relation - PARATAXIS = 33; - - // Participial modifier - PARTMOD = 34; - - // The complement of a preposition is a clause - PCOMP = 35; - - // Object of a preposition - POBJ = 36; - - // Possession modifier - POSS = 37; - - // Postverbal negative particle - POSTNEG = 38; - - // Predicate complement - PRECOMP = 39; - - // Preconjunt - PRECONJ = 40; - - // Predeterminer - PREDET = 41; - - // Prefix - PREF = 42; - - // Prepositional modifier - PREP = 43; - - // The relationship between a verb and verbal morpheme - PRONL = 44; - - // Particle - PRT = 45; - - // Associative or possessive marker - PS = 46; - - // Quantifier phrase modifier - QUANTMOD = 47; - - // Relative clause modifier - RCMOD = 48; - - // Complementizer in relative clause - RCMODREL = 49; - - // Ellipsis without a preceding predicate - RDROP = 50; - - // Referent - REF = 51; - - // Remnant - REMNANT = 52; - - // Reparandum - REPARANDUM = 53; - - // Root - ROOT = 54; - - // Suffix specifying a unit of number - SNUM = 55; - - // Suffix - SUFF = 56; - - // Temporal modifier - TMOD = 57; - - // Topic marker - TOPIC = 58; - - // Clause headed by an infinite form of the verb that modifies a noun - VMOD = 59; - - // Vocative - VOCATIVE = 60; - - // Open clausal complement - XCOMP = 61; - - // Name suffix - SUFFIX = 62; - - // Name title - TITLE = 63; - - // Adverbial phrase modifier - ADVPHMOD = 64; - - // Causative auxiliary - AUXCAUS = 65; - - // Helper auxiliary - AUXVV = 66; - - // Rentaishi (Prenominal modifier) - DTMOD = 67; - - // Foreign words - FOREIGN = 68; - - // Keyword - KW = 69; - - // List for chains of comparable items - LIST = 70; - - // Nominalized clause - NOMC = 71; - - // Nominalized clausal subject - NOMCSUBJ = 72; - - // Nominalized clausal passive - NOMCSUBJPASS = 73; - - // Compound of numeric modifier - NUMC = 74; - - // Copula - COP = 75; - - // Dislocated relation (for fronted/topicalized elements) - DISLOCATED = 76; - - // Aspect marker - ASP = 77; - - // Genitive modifier - GMOD = 78; - - // Genitive object - GOBJ = 79; - - // Infinitival modifier - INFMOD = 80; - - // Measure - MES = 81; - - // Nominal complement of a noun - NCOMP = 82; - } - - // Represents the head of this token in the dependency tree. - // This is the index of the token which has an arc going to this token. - // The index is the position of the token in the array of tokens returned - // by the API method. If this token is a root token, then the - // `head_token_index` is its own index. - int32 head_token_index = 1; - - // The parse label for the token. - Label label = 2; -} - -// Represents a mention for an entity in the text. Currently, proper noun -// mentions are supported. -message EntityMention { - // The supported types of mentions. - enum Type { - // Unknown - TYPE_UNKNOWN = 0; - - // Proper name - PROPER = 1; - - // Common noun (or noun compound) - COMMON = 2; - } - - // The mention text. - TextSpan text = 1; - - // The type of the entity mention. - Type type = 2; - - // For calls to [AnalyzeEntitySentiment][] or if - // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] - // is set to true, this field will contain the sentiment expressed for this - // mention of the entity in the provided document. - Sentiment sentiment = 3; -} - -// Represents an output piece of text. -message TextSpan { - // The content of the output text. - string content = 1; - - // The API calculates the beginning offset of the content in the original - // document according to the - // [EncodingType][google.cloud.language.v1.EncodingType] specified in the API - // request. - int32 begin_offset = 2; -} - -// Represents a category returned from the text classifier. -message ClassificationCategory { - // The name of the category representing the document. - string name = 1; - - // The classifier's confidence of the category. Number represents how certain - // the classifier is that this category represents the given text. - float confidence = 2; -} - -// Model options available for classification requests. -message ClassificationModelOptions { - // Options for the V1 model. - message V1Model {} - - // Options for the V2 model. - message V2Model { - // The content categories used for classification. - enum ContentCategoriesVersion { - // If `ContentCategoriesVersion` is not specified, this option will - // default to `V1`. - CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0; - - // Legacy content categories of our initial launch in 2017. - V1 = 1; - - // Updated content categories in 2022. - V2 = 2; - } - - // The content categories used for classification. - ContentCategoriesVersion content_categories_version = 1; - } - - // If this field is not set, then the `v1_model` will be used by default. - oneof model_type { - // Setting this field will use the V1 model and V1 content categories - // version. The V1 model is a legacy model; support for this will be - // discontinued in the future. - V1Model v1_model = 1; - - // Setting this field will use the V2 model with the appropriate content - // categories version. The V2 model is a better performing model. - V2Model v2_model = 2; - } -} - -// The sentiment analysis request message. -message AnalyzeSentimentRequest { - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; - - // The encoding type used by the API to calculate sentence offsets. - EncodingType encoding_type = 2; -} - -// The sentiment analysis response message. -message AnalyzeSentimentResponse { - // The overall sentiment of the input document. - Sentiment document_sentiment = 1; - - // The language of the text, which will be the same as the language specified - // in the request or, if not specified, the automatically-detected language. - // See [Document.language][google.cloud.language.v1.Document.language] field - // for more details. - string language = 2; - - // The sentiment for all the sentences in the document. - repeated Sentence sentences = 3; -} - -// The entity-level sentiment analysis request message. -message AnalyzeEntitySentimentRequest { - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; - - // The encoding type used by the API to calculate offsets. - EncodingType encoding_type = 2; -} - -// The entity-level sentiment analysis response message. -message AnalyzeEntitySentimentResponse { - // The recognized entities in the input document with associated sentiments. - repeated Entity entities = 1; - - // The language of the text, which will be the same as the language specified - // in the request or, if not specified, the automatically-detected language. - // See [Document.language][google.cloud.language.v1.Document.language] field - // for more details. - string language = 2; -} - -// The entity analysis request message. -message AnalyzeEntitiesRequest { - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; - - // The encoding type used by the API to calculate offsets. - EncodingType encoding_type = 2; -} - -// The entity analysis response message. -message AnalyzeEntitiesResponse { - // The recognized entities in the input document. - repeated Entity entities = 1; - - // The language of the text, which will be the same as the language specified - // in the request or, if not specified, the automatically-detected language. - // See [Document.language][google.cloud.language.v1.Document.language] field - // for more details. - string language = 2; -} - -// The syntax analysis request message. -message AnalyzeSyntaxRequest { - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; - - // The encoding type used by the API to calculate offsets. - EncodingType encoding_type = 2; -} - -// The syntax analysis response message. -message AnalyzeSyntaxResponse { - // Sentences in the input document. - repeated Sentence sentences = 1; - - // Tokens, along with their syntactic information, in the input document. - repeated Token tokens = 2; - - // The language of the text, which will be the same as the language specified - // in the request or, if not specified, the automatically-detected language. - // See [Document.language][google.cloud.language.v1.Document.language] field - // for more details. - string language = 3; -} - -// The document classification request message. -message ClassifyTextRequest { - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; - - // Model options to use for classification. Defaults to v1 options if not - // specified. - ClassificationModelOptions classification_model_options = 3; -} - -// The document classification response message. -message ClassifyTextResponse { - // Categories representing the input document. - repeated ClassificationCategory categories = 1; -} - -// The document moderation request message. -message ModerateTextRequest { - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The document moderation response message. -message ModerateTextResponse { - // Harmful and sensitive categories representing the input document. - repeated ClassificationCategory moderation_categories = 1; -} - -// The request message for the text annotation API, which can perform multiple -// analysis types (sentiment, entities, and syntax) in one call. -message AnnotateTextRequest { - // All available features for sentiment, syntax, and semantic analysis. - // Setting each one to true will enable that specific analysis for the input. - message Features { - // Extract syntax information. - bool extract_syntax = 1; - - // Extract entities. - bool extract_entities = 2; - - // Extract document-level sentiment. - bool extract_document_sentiment = 3; - - // Extract entities and their associated sentiment. - bool extract_entity_sentiment = 4; - - // Classify the full document into categories. - bool classify_text = 6; - - // Moderate the document for harmful and sensitive categories. - bool moderate_text = 11; - - // The model options to use for classification. Defaults to v1 options - // if not specified. Only used if `classify_text` is set to true. - ClassificationModelOptions classification_model_options = 10; - } - - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The enabled features. - Features features = 2 [(google.api.field_behavior) = REQUIRED]; - - // The encoding type used by the API to calculate offsets. - EncodingType encoding_type = 3; -} - -// The text annotations response message. -message AnnotateTextResponse { - // Sentences in the input document. Populated if the user enables - // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. - repeated Sentence sentences = 1; - - // Tokens, along with their syntactic information, in the input document. - // Populated if the user enables - // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. - repeated Token tokens = 2; - - // Entities, along with their semantic information, in the input document. - // Populated if the user enables - // [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. - repeated Entity entities = 3; - - // The overall sentiment for the document. Populated if the user enables - // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. - Sentiment document_sentiment = 4; - - // The language of the text, which will be the same as the language specified - // in the request or, if not specified, the automatically-detected language. - // See [Document.language][google.cloud.language.v1.Document.language] field - // for more details. - string language = 5; - - // Categories identified in the input document. - repeated ClassificationCategory categories = 6; - - // Harmful and sensitive categories identified in the input document. - repeated ClassificationCategory moderation_categories = 7; -} diff --git a/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_entities.js b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_entities.js deleted file mode 100644 index e8a4cb64a31..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_entities.js +++ /dev/null @@ -1,65 +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(document) { - // [START language_v1_generated_LanguageService_AnalyzeEntities_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. Input document. - */ - // const document = {} - /** - * The encoding type used by the API to calculate offsets. - */ - // const encodingType = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v1; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callAnalyzeEntities() { - // Construct request - const request = { - document, - }; - - // Run request - const response = await languageClient.analyzeEntities(request); - console.log(response); - } - - callAnalyzeEntities(); - // [END language_v1_generated_LanguageService_AnalyzeEntities_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-language/v1/samples/generated/v1/language_service.analyze_entity_sentiment.js b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_entity_sentiment.js deleted file mode 100644 index 64f3211aaa4..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_entity_sentiment.js +++ /dev/null @@ -1,65 +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(document) { - // [START language_v1_generated_LanguageService_AnalyzeEntitySentiment_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. Input document. - */ - // const document = {} - /** - * The encoding type used by the API to calculate offsets. - */ - // const encodingType = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v1; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callAnalyzeEntitySentiment() { - // Construct request - const request = { - document, - }; - - // Run request - const response = await languageClient.analyzeEntitySentiment(request); - console.log(response); - } - - callAnalyzeEntitySentiment(); - // [END language_v1_generated_LanguageService_AnalyzeEntitySentiment_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-language/v1/samples/generated/v1/language_service.analyze_sentiment.js b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_sentiment.js deleted file mode 100644 index 7870a9486c5..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_sentiment.js +++ /dev/null @@ -1,65 +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(document) { - // [START language_v1_generated_LanguageService_AnalyzeSentiment_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. Input document. - */ - // const document = {} - /** - * The encoding type used by the API to calculate sentence offsets. - */ - // const encodingType = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v1; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callAnalyzeSentiment() { - // Construct request - const request = { - document, - }; - - // Run request - const response = await languageClient.analyzeSentiment(request); - console.log(response); - } - - callAnalyzeSentiment(); - // [END language_v1_generated_LanguageService_AnalyzeSentiment_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-language/v1/samples/generated/v1/language_service.analyze_syntax.js b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_syntax.js deleted file mode 100644 index 1a213628c7a..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.analyze_syntax.js +++ /dev/null @@ -1,65 +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(document) { - // [START language_v1_generated_LanguageService_AnalyzeSyntax_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. Input document. - */ - // const document = {} - /** - * The encoding type used by the API to calculate offsets. - */ - // const encodingType = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v1; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callAnalyzeSyntax() { - // Construct request - const request = { - document, - }; - - // Run request - const response = await languageClient.analyzeSyntax(request); - console.log(response); - } - - callAnalyzeSyntax(); - // [END language_v1_generated_LanguageService_AnalyzeSyntax_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-language/v1/samples/generated/v1/language_service.annotate_text.js b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.annotate_text.js deleted file mode 100644 index 3c41f6a879a..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.annotate_text.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(document, features) { - // [START language_v1_generated_LanguageService_AnnotateText_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. Input document. - */ - // const document = {} - /** - * Required. The enabled features. - */ - // const features = {} - /** - * The encoding type used by the API to calculate offsets. - */ - // const encodingType = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v1; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callAnnotateText() { - // Construct request - const request = { - document, - features, - }; - - // Run request - const response = await languageClient.annotateText(request); - console.log(response); - } - - callAnnotateText(); - // [END language_v1_generated_LanguageService_AnnotateText_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-language/v1/samples/generated/v1/language_service.classify_text.js b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.classify_text.js deleted file mode 100644 index b8191d121f0..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.classify_text.js +++ /dev/null @@ -1,66 +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(document) { - // [START language_v1_generated_LanguageService_ClassifyText_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. Input document. - */ - // const document = {} - /** - * Model options to use for classification. Defaults to v1 options if not - * specified. - */ - // const classificationModelOptions = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v1; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callClassifyText() { - // Construct request - const request = { - document, - }; - - // Run request - const response = await languageClient.classifyText(request); - console.log(response); - } - - callClassifyText(); - // [END language_v1_generated_LanguageService_ClassifyText_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-language/v1/samples/generated/v1/language_service.moderate_text.js b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.moderate_text.js deleted file mode 100644 index 271b9fe1e1f..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/language_service.moderate_text.js +++ /dev/null @@ -1,61 +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(document) { - // [START language_v1_generated_LanguageService_ModerateText_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. Input document. - */ - // const document = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v1; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callModerateText() { - // Construct request - const request = { - document, - }; - - // Run request - const response = await languageClient.moderateText(request); - console.log(response); - } - - callModerateText(); - // [END language_v1_generated_LanguageService_ModerateText_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-language/v1/samples/generated/v1/snippet_metadata_google.cloud.language.v1.json b/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/snippet_metadata_google.cloud.language.v1.json deleted file mode 100644 index 0ac8ed666ea..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/samples/generated/v1/snippet_metadata_google.cloud.language.v1.json +++ /dev/null @@ -1,323 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-language", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.language.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "language_v1_generated_LanguageService_AnalyzeSentiment_async", - "title": "LanguageService analyzeSentiment Sample", - "origin": "API_DEFINITION", - "description": " Analyzes the sentiment of the provided text.", - "canonical": true, - "file": "language_service.analyze_sentiment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AnalyzeSentiment", - "fullName": "google.cloud.language.v1.LanguageService.AnalyzeSentiment", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v1.Document" - }, - { - "name": "encoding_type", - "type": ".google.cloud.language.v1.EncodingType" - } - ], - "resultType": ".google.cloud.language.v1.AnalyzeSentimentResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v1.LanguageServiceClient" - }, - "method": { - "shortName": "AnalyzeSentiment", - "fullName": "google.cloud.language.v1.LanguageService.AnalyzeSentiment", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v1.LanguageService" - } - } - } - }, - { - "regionTag": "language_v1_generated_LanguageService_AnalyzeEntities_async", - "title": "LanguageService analyzeEntities Sample", - "origin": "API_DEFINITION", - "description": " Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties.", - "canonical": true, - "file": "language_service.analyze_entities.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AnalyzeEntities", - "fullName": "google.cloud.language.v1.LanguageService.AnalyzeEntities", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v1.Document" - }, - { - "name": "encoding_type", - "type": ".google.cloud.language.v1.EncodingType" - } - ], - "resultType": ".google.cloud.language.v1.AnalyzeEntitiesResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v1.LanguageServiceClient" - }, - "method": { - "shortName": "AnalyzeEntities", - "fullName": "google.cloud.language.v1.LanguageService.AnalyzeEntities", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v1.LanguageService" - } - } - } - }, - { - "regionTag": "language_v1_generated_LanguageService_AnalyzeEntitySentiment_async", - "title": "LanguageService analyzeEntitySentiment Sample", - "origin": "API_DEFINITION", - "description": " Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes sentiment associated with each entity and its mentions.", - "canonical": true, - "file": "language_service.analyze_entity_sentiment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AnalyzeEntitySentiment", - "fullName": "google.cloud.language.v1.LanguageService.AnalyzeEntitySentiment", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v1.Document" - }, - { - "name": "encoding_type", - "type": ".google.cloud.language.v1.EncodingType" - } - ], - "resultType": ".google.cloud.language.v1.AnalyzeEntitySentimentResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v1.LanguageServiceClient" - }, - "method": { - "shortName": "AnalyzeEntitySentiment", - "fullName": "google.cloud.language.v1.LanguageService.AnalyzeEntitySentiment", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v1.LanguageService" - } - } - } - }, - { - "regionTag": "language_v1_generated_LanguageService_AnalyzeSyntax_async", - "title": "LanguageService analyzeSyntax Sample", - "origin": "API_DEFINITION", - "description": " Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.", - "canonical": true, - "file": "language_service.analyze_syntax.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AnalyzeSyntax", - "fullName": "google.cloud.language.v1.LanguageService.AnalyzeSyntax", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v1.Document" - }, - { - "name": "encoding_type", - "type": ".google.cloud.language.v1.EncodingType" - } - ], - "resultType": ".google.cloud.language.v1.AnalyzeSyntaxResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v1.LanguageServiceClient" - }, - "method": { - "shortName": "AnalyzeSyntax", - "fullName": "google.cloud.language.v1.LanguageService.AnalyzeSyntax", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v1.LanguageService" - } - } - } - }, - { - "regionTag": "language_v1_generated_LanguageService_ClassifyText_async", - "title": "LanguageService classifyText Sample", - "origin": "API_DEFINITION", - "description": " Classifies a document into categories.", - "canonical": true, - "file": "language_service.classify_text.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ClassifyText", - "fullName": "google.cloud.language.v1.LanguageService.ClassifyText", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v1.Document" - }, - { - "name": "classification_model_options", - "type": ".google.cloud.language.v1.ClassificationModelOptions" - } - ], - "resultType": ".google.cloud.language.v1.ClassifyTextResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v1.LanguageServiceClient" - }, - "method": { - "shortName": "ClassifyText", - "fullName": "google.cloud.language.v1.LanguageService.ClassifyText", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v1.LanguageService" - } - } - } - }, - { - "regionTag": "language_v1_generated_LanguageService_ModerateText_async", - "title": "LanguageService moderateText Sample", - "origin": "API_DEFINITION", - "description": " Moderates a document for harmful and sensitive categories.", - "canonical": true, - "file": "language_service.moderate_text.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ModerateText", - "fullName": "google.cloud.language.v1.LanguageService.ModerateText", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v1.Document" - } - ], - "resultType": ".google.cloud.language.v1.ModerateTextResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v1.LanguageServiceClient" - }, - "method": { - "shortName": "ModerateText", - "fullName": "google.cloud.language.v1.LanguageService.ModerateText", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v1.LanguageService" - } - } - } - }, - { - "regionTag": "language_v1_generated_LanguageService_AnnotateText_async", - "title": "LanguageService annotateText Sample", - "origin": "API_DEFINITION", - "description": " A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and analyzeSyntax provide in one call.", - "canonical": true, - "file": "language_service.annotate_text.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AnnotateText", - "fullName": "google.cloud.language.v1.LanguageService.AnnotateText", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v1.Document" - }, - { - "name": "features", - "type": ".google.cloud.language.v1.AnnotateTextRequest.Features" - }, - { - "name": "encoding_type", - "type": ".google.cloud.language.v1.EncodingType" - } - ], - "resultType": ".google.cloud.language.v1.AnnotateTextResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v1.LanguageServiceClient" - }, - "method": { - "shortName": "AnnotateText", - "fullName": "google.cloud.language.v1.LanguageService.AnnotateText", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v1.LanguageService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-language/v1/src/index.ts b/owl-bot-staging/google-cloud-language/v1/src/index.ts deleted file mode 100644 index d518ad8805f..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/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 v1 from './v1'; -const LanguageServiceClient = v1.LanguageServiceClient; -type LanguageServiceClient = v1.LanguageServiceClient; -export {v1, LanguageServiceClient}; -export default {v1, LanguageServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-language/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-language/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 14d2569e068..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.language.v1", - "libraryPackage": "@google-cloud/language", - "services": { - "LanguageService": { - "clients": { - "grpc": { - "libraryClient": "LanguageServiceClient", - "rpcs": { - "AnalyzeSentiment": { - "methods": [ - "analyzeSentiment" - ] - }, - "AnalyzeEntities": { - "methods": [ - "analyzeEntities" - ] - }, - "AnalyzeEntitySentiment": { - "methods": [ - "analyzeEntitySentiment" - ] - }, - "AnalyzeSyntax": { - "methods": [ - "analyzeSyntax" - ] - }, - "ClassifyText": { - "methods": [ - "classifyText" - ] - }, - "ModerateText": { - "methods": [ - "moderateText" - ] - }, - "AnnotateText": { - "methods": [ - "annotateText" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "LanguageServiceClient", - "rpcs": { - "AnalyzeSentiment": { - "methods": [ - "analyzeSentiment" - ] - }, - "AnalyzeEntities": { - "methods": [ - "analyzeEntities" - ] - }, - "AnalyzeEntitySentiment": { - "methods": [ - "analyzeEntitySentiment" - ] - }, - "AnalyzeSyntax": { - "methods": [ - "analyzeSyntax" - ] - }, - "ClassifyText": { - "methods": [ - "classifyText" - ] - }, - "ModerateText": { - "methods": [ - "moderateText" - ] - }, - "AnnotateText": { - "methods": [ - "annotateText" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-language/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-language/v1/src/v1/index.ts deleted file mode 100644 index 3275c17250d..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/src/v1/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 {LanguageServiceClient} from './language_service_client'; diff --git a/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_client.ts b/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_client.ts deleted file mode 100644 index 25bcaf6be1f..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_client.ts +++ /dev/null @@ -1,786 +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/v1/language_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './language_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Provides text analysis operations such as sentiment analysis and entity - * recognition. - * @class - * @memberof v1 - */ -export class LanguageServiceClient { - 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}; - languageServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of LanguageServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 LanguageServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof LanguageServiceClient; - 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 { - 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.language.v1.LanguageService', 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.languageServiceStub) { - return this.languageServiceStub; - } - - // Put together the "service stub" for - // google.cloud.language.v1.LanguageService. - this.languageServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.language.v1.LanguageService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.language.v1.LanguageService, - 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 languageServiceStubMethods = - ['analyzeSentiment', 'analyzeEntities', 'analyzeEntitySentiment', 'analyzeSyntax', 'classifyText', 'moderateText', 'annotateText']; - for (const methodName of languageServiceStubMethods) { - const callPromise = this.languageServiceStub.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.languageServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'language.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 'language.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-language', - '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 -- - // ------------------- -/** - * Analyzes the sentiment of the provided text. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v1.Document} request.document - * Required. Input document. - * @param {google.cloud.language.v1.EncodingType} request.encodingType - * The encoding type used by the API to calculate sentence offsets. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1.AnalyzeSentimentResponse|AnalyzeSentimentResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/language_service.analyze_sentiment.js - * region_tag:language_v1_generated_LanguageService_AnalyzeSentiment_async - */ - analyzeSentiment( - request?: protos.google.cloud.language.v1.IAnalyzeSentimentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v1.IAnalyzeSentimentResponse, - protos.google.cloud.language.v1.IAnalyzeSentimentRequest|undefined, {}|undefined - ]>; - analyzeSentiment( - request: protos.google.cloud.language.v1.IAnalyzeSentimentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v1.IAnalyzeSentimentResponse, - protos.google.cloud.language.v1.IAnalyzeSentimentRequest|null|undefined, - {}|null|undefined>): void; - analyzeSentiment( - request: protos.google.cloud.language.v1.IAnalyzeSentimentRequest, - callback: Callback< - protos.google.cloud.language.v1.IAnalyzeSentimentResponse, - protos.google.cloud.language.v1.IAnalyzeSentimentRequest|null|undefined, - {}|null|undefined>): void; - analyzeSentiment( - request?: protos.google.cloud.language.v1.IAnalyzeSentimentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v1.IAnalyzeSentimentResponse, - protos.google.cloud.language.v1.IAnalyzeSentimentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v1.IAnalyzeSentimentResponse, - protos.google.cloud.language.v1.IAnalyzeSentimentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v1.IAnalyzeSentimentResponse, - protos.google.cloud.language.v1.IAnalyzeSentimentRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.analyzeSentiment(request, options, callback); - } -/** - * Finds named entities (currently proper names and common nouns) in the text - * along with entity types, salience, mentions for each entity, and - * other properties. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v1.Document} request.document - * Required. Input document. - * @param {google.cloud.language.v1.EncodingType} request.encodingType - * The encoding type used by the API to calculate offsets. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1.AnalyzeEntitiesResponse|AnalyzeEntitiesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/language_service.analyze_entities.js - * region_tag:language_v1_generated_LanguageService_AnalyzeEntities_async - */ - analyzeEntities( - request?: protos.google.cloud.language.v1.IAnalyzeEntitiesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v1.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v1.IAnalyzeEntitiesRequest|undefined, {}|undefined - ]>; - analyzeEntities( - request: protos.google.cloud.language.v1.IAnalyzeEntitiesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v1.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v1.IAnalyzeEntitiesRequest|null|undefined, - {}|null|undefined>): void; - analyzeEntities( - request: protos.google.cloud.language.v1.IAnalyzeEntitiesRequest, - callback: Callback< - protos.google.cloud.language.v1.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v1.IAnalyzeEntitiesRequest|null|undefined, - {}|null|undefined>): void; - analyzeEntities( - request?: protos.google.cloud.language.v1.IAnalyzeEntitiesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v1.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v1.IAnalyzeEntitiesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v1.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v1.IAnalyzeEntitiesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v1.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v1.IAnalyzeEntitiesRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.analyzeEntities(request, options, callback); - } -/** - * Finds entities, similar to - * {@link protos.google.cloud.language.v1.LanguageService.AnalyzeEntities|AnalyzeEntities} - * in the text and analyzes sentiment associated with each entity and its - * mentions. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v1.Document} request.document - * Required. Input document. - * @param {google.cloud.language.v1.EncodingType} request.encodingType - * The encoding type used by the API to calculate offsets. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1.AnalyzeEntitySentimentResponse|AnalyzeEntitySentimentResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/language_service.analyze_entity_sentiment.js - * region_tag:language_v1_generated_LanguageService_AnalyzeEntitySentiment_async - */ - analyzeEntitySentiment( - request?: protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v1.IAnalyzeEntitySentimentResponse, - protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest|undefined, {}|undefined - ]>; - analyzeEntitySentiment( - request: protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v1.IAnalyzeEntitySentimentResponse, - protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest|null|undefined, - {}|null|undefined>): void; - analyzeEntitySentiment( - request: protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest, - callback: Callback< - protos.google.cloud.language.v1.IAnalyzeEntitySentimentResponse, - protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest|null|undefined, - {}|null|undefined>): void; - analyzeEntitySentiment( - request?: protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v1.IAnalyzeEntitySentimentResponse, - protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v1.IAnalyzeEntitySentimentResponse, - protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v1.IAnalyzeEntitySentimentResponse, - protos.google.cloud.language.v1.IAnalyzeEntitySentimentRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.analyzeEntitySentiment(request, options, callback); - } -/** - * Analyzes the syntax of the text and provides sentence boundaries and - * tokenization along with part of speech tags, dependency trees, and other - * properties. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v1.Document} request.document - * Required. Input document. - * @param {google.cloud.language.v1.EncodingType} request.encodingType - * The encoding type used by the API to calculate offsets. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1.AnalyzeSyntaxResponse|AnalyzeSyntaxResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/language_service.analyze_syntax.js - * region_tag:language_v1_generated_LanguageService_AnalyzeSyntax_async - */ - analyzeSyntax( - request?: protos.google.cloud.language.v1.IAnalyzeSyntaxRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v1.IAnalyzeSyntaxResponse, - protos.google.cloud.language.v1.IAnalyzeSyntaxRequest|undefined, {}|undefined - ]>; - analyzeSyntax( - request: protos.google.cloud.language.v1.IAnalyzeSyntaxRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v1.IAnalyzeSyntaxResponse, - protos.google.cloud.language.v1.IAnalyzeSyntaxRequest|null|undefined, - {}|null|undefined>): void; - analyzeSyntax( - request: protos.google.cloud.language.v1.IAnalyzeSyntaxRequest, - callback: Callback< - protos.google.cloud.language.v1.IAnalyzeSyntaxResponse, - protos.google.cloud.language.v1.IAnalyzeSyntaxRequest|null|undefined, - {}|null|undefined>): void; - analyzeSyntax( - request?: protos.google.cloud.language.v1.IAnalyzeSyntaxRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v1.IAnalyzeSyntaxResponse, - protos.google.cloud.language.v1.IAnalyzeSyntaxRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v1.IAnalyzeSyntaxResponse, - protos.google.cloud.language.v1.IAnalyzeSyntaxRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v1.IAnalyzeSyntaxResponse, - protos.google.cloud.language.v1.IAnalyzeSyntaxRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.analyzeSyntax(request, options, callback); - } -/** - * Classifies a document into categories. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v1.Document} request.document - * Required. Input document. - * @param {google.cloud.language.v1.ClassificationModelOptions} request.classificationModelOptions - * Model options to use for classification. Defaults to v1 options if not - * specified. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1.ClassifyTextResponse|ClassifyTextResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/language_service.classify_text.js - * region_tag:language_v1_generated_LanguageService_ClassifyText_async - */ - classifyText( - request?: protos.google.cloud.language.v1.IClassifyTextRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v1.IClassifyTextResponse, - protos.google.cloud.language.v1.IClassifyTextRequest|undefined, {}|undefined - ]>; - classifyText( - request: protos.google.cloud.language.v1.IClassifyTextRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v1.IClassifyTextResponse, - protos.google.cloud.language.v1.IClassifyTextRequest|null|undefined, - {}|null|undefined>): void; - classifyText( - request: protos.google.cloud.language.v1.IClassifyTextRequest, - callback: Callback< - protos.google.cloud.language.v1.IClassifyTextResponse, - protos.google.cloud.language.v1.IClassifyTextRequest|null|undefined, - {}|null|undefined>): void; - classifyText( - request?: protos.google.cloud.language.v1.IClassifyTextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v1.IClassifyTextResponse, - protos.google.cloud.language.v1.IClassifyTextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v1.IClassifyTextResponse, - protos.google.cloud.language.v1.IClassifyTextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v1.IClassifyTextResponse, - protos.google.cloud.language.v1.IClassifyTextRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.classifyText(request, options, callback); - } -/** - * Moderates a document for harmful and sensitive categories. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v1.Document} request.document - * Required. Input document. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1.ModerateTextResponse|ModerateTextResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/language_service.moderate_text.js - * region_tag:language_v1_generated_LanguageService_ModerateText_async - */ - moderateText( - request?: protos.google.cloud.language.v1.IModerateTextRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v1.IModerateTextResponse, - protos.google.cloud.language.v1.IModerateTextRequest|undefined, {}|undefined - ]>; - moderateText( - request: protos.google.cloud.language.v1.IModerateTextRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v1.IModerateTextResponse, - protos.google.cloud.language.v1.IModerateTextRequest|null|undefined, - {}|null|undefined>): void; - moderateText( - request: protos.google.cloud.language.v1.IModerateTextRequest, - callback: Callback< - protos.google.cloud.language.v1.IModerateTextResponse, - protos.google.cloud.language.v1.IModerateTextRequest|null|undefined, - {}|null|undefined>): void; - moderateText( - request?: protos.google.cloud.language.v1.IModerateTextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v1.IModerateTextResponse, - protos.google.cloud.language.v1.IModerateTextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v1.IModerateTextResponse, - protos.google.cloud.language.v1.IModerateTextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v1.IModerateTextResponse, - protos.google.cloud.language.v1.IModerateTextRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.moderateText(request, options, callback); - } -/** - * A convenience method that provides all the features that analyzeSentiment, - * analyzeEntities, and analyzeSyntax provide in one call. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v1.Document} request.document - * Required. Input document. - * @param {google.cloud.language.v1.AnnotateTextRequest.Features} request.features - * Required. The enabled features. - * @param {google.cloud.language.v1.EncodingType} request.encodingType - * The encoding type used by the API to calculate offsets. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1.AnnotateTextResponse|AnnotateTextResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/language_service.annotate_text.js - * region_tag:language_v1_generated_LanguageService_AnnotateText_async - */ - annotateText( - request?: protos.google.cloud.language.v1.IAnnotateTextRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v1.IAnnotateTextResponse, - protos.google.cloud.language.v1.IAnnotateTextRequest|undefined, {}|undefined - ]>; - annotateText( - request: protos.google.cloud.language.v1.IAnnotateTextRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v1.IAnnotateTextResponse, - protos.google.cloud.language.v1.IAnnotateTextRequest|null|undefined, - {}|null|undefined>): void; - annotateText( - request: protos.google.cloud.language.v1.IAnnotateTextRequest, - callback: Callback< - protos.google.cloud.language.v1.IAnnotateTextResponse, - protos.google.cloud.language.v1.IAnnotateTextRequest|null|undefined, - {}|null|undefined>): void; - annotateText( - request?: protos.google.cloud.language.v1.IAnnotateTextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v1.IAnnotateTextResponse, - protos.google.cloud.language.v1.IAnnotateTextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v1.IAnnotateTextResponse, - protos.google.cloud.language.v1.IAnnotateTextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v1.IAnnotateTextResponse, - protos.google.cloud.language.v1.IAnnotateTextRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.annotateText(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.languageServiceStub && !this._terminated) { - return this.languageServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_client_config.json b/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_client_config.json deleted file mode 100644 index ba23b0097e0..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_client_config.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "interfaces": { - "google.cloud.language.v1.LanguageService": { - "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": { - "AnalyzeSentiment": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "AnalyzeEntities": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "AnalyzeEntitySentiment": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "AnalyzeSyntax": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ClassifyText": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ModerateText": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AnnotateText": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_proto_list.json b/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_proto_list.json deleted file mode 100644 index 0456052873e..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/src/v1/language_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/language/v1/language_service.proto" -] diff --git a/owl-bot-staging/google-cloud-language/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-language/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 46600ec0cdc..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/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 language = require('@google-cloud/language'); - -function main() { - const languageServiceClient = new language.LanguageServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-language/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-language/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index e2767ca4173..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/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 {LanguageServiceClient} from '@google-cloud/language'; - -// check that the client class type name can be used -function doStuffWithLanguageServiceClient(client: LanguageServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const languageServiceClient = new LanguageServiceClient(); - doStuffWithLanguageServiceClient(languageServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-language/v1/system-test/install.ts b/owl-bot-staging/google-cloud-language/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-language/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-language/v1/test/gapic_language_service_v1.ts b/owl-bot-staging/google-cloud-language/v1/test/gapic_language_service_v1.ts deleted file mode 100644 index b1fb333436f..00000000000 --- a/owl-bot-staging/google-cloud-language/v1/test/gapic_language_service_v1.ts +++ /dev/null @@ -1,675 +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 languageserviceModule 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('v1.LanguageServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = languageserviceModule.v1.LanguageServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = languageserviceModule.v1.LanguageServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = languageserviceModule.v1.LanguageServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new languageserviceModule.v1.LanguageServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.languageServiceStub, undefined); - await client.initialize(); - assert(client.languageServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.languageServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.languageServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new languageserviceModule.v1.LanguageServiceClient({ - 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 languageserviceModule.v1.LanguageServiceClient({ - 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('analyzeSentiment', () => { - it('invokes analyzeSentiment without error', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeSentimentRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeSentimentResponse() - ); - client.innerApiCalls.analyzeSentiment = stubSimpleCall(expectedResponse); - const [response] = await client.analyzeSentiment(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeSentiment without error using callback', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeSentimentRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeSentimentResponse() - ); - client.innerApiCalls.analyzeSentiment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.analyzeSentiment( - request, - (err?: Error|null, result?: protos.google.cloud.language.v1.IAnalyzeSentimentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeSentiment with error', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeSentimentRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeSentiment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.analyzeSentiment(request), expectedError); - }); - - it('invokes analyzeSentiment with closed client', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeSentimentRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.analyzeSentiment(request), expectedError); - }); - }); - - describe('analyzeEntities', () => { - it('invokes analyzeEntities without error', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeEntitiesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeEntitiesResponse() - ); - client.innerApiCalls.analyzeEntities = stubSimpleCall(expectedResponse); - const [response] = await client.analyzeEntities(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeEntities without error using callback', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeEntitiesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeEntitiesResponse() - ); - client.innerApiCalls.analyzeEntities = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.analyzeEntities( - request, - (err?: Error|null, result?: protos.google.cloud.language.v1.IAnalyzeEntitiesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeEntities with error', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeEntitiesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeEntities = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.analyzeEntities(request), expectedError); - }); - - it('invokes analyzeEntities with closed client', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeEntitiesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.analyzeEntities(request), expectedError); - }); - }); - - describe('analyzeEntitySentiment', () => { - it('invokes analyzeEntitySentiment without error', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeEntitySentimentRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeEntitySentimentResponse() - ); - client.innerApiCalls.analyzeEntitySentiment = stubSimpleCall(expectedResponse); - const [response] = await client.analyzeEntitySentiment(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeEntitySentiment without error using callback', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeEntitySentimentRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeEntitySentimentResponse() - ); - client.innerApiCalls.analyzeEntitySentiment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.analyzeEntitySentiment( - request, - (err?: Error|null, result?: protos.google.cloud.language.v1.IAnalyzeEntitySentimentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeEntitySentiment with error', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeEntitySentimentRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeEntitySentiment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.analyzeEntitySentiment(request), expectedError); - }); - - it('invokes analyzeEntitySentiment with closed client', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeEntitySentimentRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.analyzeEntitySentiment(request), expectedError); - }); - }); - - describe('analyzeSyntax', () => { - it('invokes analyzeSyntax without error', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeSyntaxRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeSyntaxResponse() - ); - client.innerApiCalls.analyzeSyntax = stubSimpleCall(expectedResponse); - const [response] = await client.analyzeSyntax(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeSyntax without error using callback', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeSyntaxRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeSyntaxResponse() - ); - client.innerApiCalls.analyzeSyntax = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.analyzeSyntax( - request, - (err?: Error|null, result?: protos.google.cloud.language.v1.IAnalyzeSyntaxResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeSyntax with error', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeSyntaxRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeSyntax = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.analyzeSyntax(request), expectedError); - }); - - it('invokes analyzeSyntax with closed client', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnalyzeSyntaxRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.analyzeSyntax(request), expectedError); - }); - }); - - describe('classifyText', () => { - it('invokes classifyText without error', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.ClassifyTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1.ClassifyTextResponse() - ); - client.innerApiCalls.classifyText = stubSimpleCall(expectedResponse); - const [response] = await client.classifyText(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes classifyText without error using callback', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.ClassifyTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1.ClassifyTextResponse() - ); - client.innerApiCalls.classifyText = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.classifyText( - request, - (err?: Error|null, result?: protos.google.cloud.language.v1.IClassifyTextResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes classifyText with error', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.ClassifyTextRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.classifyText = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.classifyText(request), expectedError); - }); - - it('invokes classifyText with closed client', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.ClassifyTextRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.classifyText(request), expectedError); - }); - }); - - describe('moderateText', () => { - it('invokes moderateText without error', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.ModerateTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1.ModerateTextResponse() - ); - client.innerApiCalls.moderateText = stubSimpleCall(expectedResponse); - const [response] = await client.moderateText(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes moderateText without error using callback', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.ModerateTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1.ModerateTextResponse() - ); - client.innerApiCalls.moderateText = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.moderateText( - request, - (err?: Error|null, result?: protos.google.cloud.language.v1.IModerateTextResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes moderateText with error', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.ModerateTextRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.moderateText = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.moderateText(request), expectedError); - }); - - it('invokes moderateText with closed client', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.ModerateTextRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.moderateText(request), expectedError); - }); - }); - - describe('annotateText', () => { - it('invokes annotateText without error', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnnotateTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1.AnnotateTextResponse() - ); - client.innerApiCalls.annotateText = stubSimpleCall(expectedResponse); - const [response] = await client.annotateText(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes annotateText without error using callback', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnnotateTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1.AnnotateTextResponse() - ); - client.innerApiCalls.annotateText = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.annotateText( - request, - (err?: Error|null, result?: protos.google.cloud.language.v1.IAnnotateTextResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes annotateText with error', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnnotateTextRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.annotateText = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.annotateText(request), expectedError); - }); - - it('invokes annotateText with closed client', async () => { - const client = new languageserviceModule.v1.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1.AnnotateTextRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.annotateText(request), expectedError); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-language/v1/tsconfig.json b/owl-bot-staging/google-cloud-language/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-language/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-language/v1/webpack.config.js b/owl-bot-staging/google-cloud-language/v1/webpack.config.js deleted file mode 100644 index c90df1063ed..00000000000 --- a/owl-bot-staging/google-cloud-language/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: 'LanguageService', - filename: './language-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-language/v1beta2/.eslintignore b/owl-bot-staging/google-cloud-language/v1beta2/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/.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-language/v1beta2/.eslintrc.json b/owl-bot-staging/google-cloud-language/v1beta2/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-language/v1beta2/.gitignore b/owl-bot-staging/google-cloud-language/v1beta2/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/.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-language/v1beta2/.jsdoc.js b/owl-bot-staging/google-cloud-language/v1beta2/.jsdoc.js deleted file mode 100644 index 31167957cc8..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/.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/language', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-language/v1beta2/.mocharc.js b/owl-bot-staging/google-cloud-language/v1beta2/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/.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-language/v1beta2/.prettierrc.js b/owl-bot-staging/google-cloud-language/v1beta2/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/.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-language/v1beta2/README.md b/owl-bot-staging/google-cloud-language/v1beta2/README.md deleted file mode 100644 index 7287da54696..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/README.md +++ /dev/null @@ -1 +0,0 @@ -Language: Nodejs Client diff --git a/owl-bot-staging/google-cloud-language/v1beta2/package.json b/owl-bot-staging/google-cloud-language/v1beta2/package.json deleted file mode 100644 index c158c05feac..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/language", - "version": "0.1.0", - "description": "Language client for Node.js", - "repository": "googleapis/nodejs-language", - "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 language", - "language", - "language service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-language/v1beta2/protos/google/cloud/language/v1beta2/language_service.proto b/owl-bot-staging/google-cloud-language/v1beta2/protos/google/cloud/language/v1beta2/language_service.proto deleted file mode 100644 index 95c169be080..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/protos/google/cloud/language/v1beta2/language_service.proto +++ /dev/null @@ -1,1235 +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 -// -// 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.language.v1beta2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/language/apiv1beta2/languagepb;languagepb"; -option java_multiple_files = true; -option java_outer_classname = "LanguageServiceProto"; -option java_package = "com.google.cloud.language.v1beta2"; - -// Provides text analysis operations such as sentiment analysis and entity -// recognition. -service LanguageService { - option (google.api.default_host) = "language.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-language," - "https://www.googleapis.com/auth/cloud-platform"; - - // Analyzes the sentiment of the provided text. - rpc AnalyzeSentiment(AnalyzeSentimentRequest) - returns (AnalyzeSentimentResponse) { - option (google.api.http) = { - post: "/v1beta2/documents:analyzeSentiment" - body: "*" - }; - option (google.api.method_signature) = "document,encoding_type"; - option (google.api.method_signature) = "document"; - } - - // Finds named entities (currently proper names and common nouns) in the text - // along with entity types, salience, mentions for each entity, and - // other properties. - rpc AnalyzeEntities(AnalyzeEntitiesRequest) - returns (AnalyzeEntitiesResponse) { - option (google.api.http) = { - post: "/v1beta2/documents:analyzeEntities" - body: "*" - }; - option (google.api.method_signature) = "document,encoding_type"; - option (google.api.method_signature) = "document"; - } - - // Finds entities, similar to - // [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] - // in the text and analyzes sentiment associated with each entity and its - // mentions. - rpc AnalyzeEntitySentiment(AnalyzeEntitySentimentRequest) - returns (AnalyzeEntitySentimentResponse) { - option (google.api.http) = { - post: "/v1beta2/documents:analyzeEntitySentiment" - body: "*" - }; - option (google.api.method_signature) = "document,encoding_type"; - option (google.api.method_signature) = "document"; - } - - // Analyzes the syntax of the text and provides sentence boundaries and - // tokenization along with part of speech tags, dependency trees, and other - // properties. - rpc AnalyzeSyntax(AnalyzeSyntaxRequest) returns (AnalyzeSyntaxResponse) { - option (google.api.http) = { - post: "/v1beta2/documents:analyzeSyntax" - body: "*" - }; - option (google.api.method_signature) = "document,encoding_type"; - option (google.api.method_signature) = "document"; - } - - // Classifies a document into categories. - rpc ClassifyText(ClassifyTextRequest) returns (ClassifyTextResponse) { - option (google.api.http) = { - post: "/v1beta2/documents:classifyText" - body: "*" - }; - option (google.api.method_signature) = "document"; - } - - // Moderates a document for harmful and sensitive categories. - rpc ModerateText(ModerateTextRequest) returns (ModerateTextResponse) { - option (google.api.http) = { - post: "/v1beta2/documents:moderateText" - body: "*" - }; - option (google.api.method_signature) = "document"; - } - - // A convenience method that provides all syntax, sentiment, entity, and - // classification features in one call. - rpc AnnotateText(AnnotateTextRequest) returns (AnnotateTextResponse) { - option (google.api.http) = { - post: "/v1beta2/documents:annotateText" - body: "*" - }; - option (google.api.method_signature) = "document,features,encoding_type"; - option (google.api.method_signature) = "document,features"; - } -} - -// Represents the input to API methods. -message Document { - // The document types enum. - enum Type { - // The content type is not specified. - TYPE_UNSPECIFIED = 0; - - // Plain text - PLAIN_TEXT = 1; - - // HTML - HTML = 2; - } - - // Ways of handling boilerplate detected in the document - enum BoilerplateHandling { - // The boilerplate handling is not specified. - BOILERPLATE_HANDLING_UNSPECIFIED = 0; - - // Do not analyze detected boilerplate. Reference web URI is required for - // detecting boilerplate. - SKIP_BOILERPLATE = 1; - - // Treat boilerplate the same as content. - KEEP_BOILERPLATE = 2; - } - - // Required. If the type is not set or is `TYPE_UNSPECIFIED`, - // returns an `INVALID_ARGUMENT` error. - Type type = 1; - - // The source of the document: a string containing the content or a - // Google Cloud Storage URI. - oneof source { - // The content of the input in string format. - // Cloud audit logging exempt since it is based on user data. - string content = 2; - - // The Google Cloud Storage URI where the file content is located. - // This URI must be of the form: gs://bucket_name/object_name. For more - // details, see https://cloud.google.com/storage/docs/reference-uris. - // NOTE: Cloud Storage object versioning is not supported. - string gcs_content_uri = 3; - } - - // The language of the document (if not specified, the language is - // automatically detected). Both ISO and BCP-47 language codes are - // accepted.
- // [Language - // Support](https://cloud.google.com/natural-language/docs/languages) lists - // currently supported languages for each API method. If the language (either - // specified by the caller or automatically detected) is not supported by the - // called API method, an `INVALID_ARGUMENT` error is returned. - string language = 4; - - // The web URI where the document comes from. This URI is not used for - // fetching the content, but as a hint for analyzing the document. - string reference_web_uri = 5; - - // Indicates how detected boilerplate(e.g. advertisements, copyright - // declarations, banners) should be handled for this document. If not - // specified, boilerplate will be treated the same as content. - BoilerplateHandling boilerplate_handling = 6; -} - -// Represents a sentence in the input document. -message Sentence { - // The sentence text. - TextSpan text = 1; - - // For calls to [AnalyzeSentiment][] or if - // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment] - // is set to true, this field will contain the sentiment for the sentence. - Sentiment sentiment = 2; -} - -// Represents the text encoding that the caller uses to process the output. -// Providing an `EncodingType` is recommended because the API provides the -// beginning offsets for various outputs, such as tokens and mentions, and -// languages that natively use different text encodings may access offsets -// differently. -enum EncodingType { - // If `EncodingType` is not specified, encoding-dependent information (such as - // `begin_offset`) will be set at `-1`. - NONE = 0; - - // Encoding-dependent information (such as `begin_offset`) is calculated based - // on the UTF-8 encoding of the input. C++ and Go are examples of languages - // that use this encoding natively. - UTF8 = 1; - - // Encoding-dependent information (such as `begin_offset`) is calculated based - // on the UTF-16 encoding of the input. Java and JavaScript are examples of - // languages that use this encoding natively. - UTF16 = 2; - - // Encoding-dependent information (such as `begin_offset`) is calculated based - // on the UTF-32 encoding of the input. Python is an example of a language - // that uses this encoding natively. - UTF32 = 3; -} - -// Represents a phrase in the text that is a known entity, such as -// a person, an organization, or location. The API associates information, such -// as salience and mentions, with entities. -message Entity { - // The type of the entity. For most entity types, the associated metadata is a - // Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table - // below lists the associated fields for entities that have different - // metadata. - enum Type { - // Unknown - UNKNOWN = 0; - - // Person - PERSON = 1; - - // Location - LOCATION = 2; - - // Organization - ORGANIZATION = 3; - - // Event - EVENT = 4; - - // Artwork - WORK_OF_ART = 5; - - // Consumer product - CONSUMER_GOOD = 6; - - // Other types of entities - OTHER = 7; - - // Phone number - // - // The metadata lists the phone number, formatted according to local - // convention, plus whichever additional elements appear in the text: - // - // * `number` - the actual number, broken down into sections as per local - // convention - // * `national_prefix` - country code, if detected - // * `area_code` - region or area code, if detected - // * `extension` - phone extension (to be dialed after connection), if - // detected - PHONE_NUMBER = 9; - - // Address - // - // The metadata identifies the street number and locality plus whichever - // additional elements appear in the text: - // - // * `street_number` - street number - // * `locality` - city or town - // * `street_name` - street/route name, if detected - // * `postal_code` - postal code, if detected - // * `country` - country, if detected< - // * `broad_region` - administrative area, such as the state, if detected - // * `narrow_region` - smaller administrative area, such as county, if - // detected - // * `sublocality` - used in Asian addresses to demark a district within a - // city, if detected - ADDRESS = 10; - - // Date - // - // The metadata identifies the components of the date: - // - // * `year` - four digit year, if detected - // * `month` - two digit month number, if detected - // * `day` - two digit day number, if detected - DATE = 11; - - // Number - // - // The metadata is the number itself. - NUMBER = 12; - - // Price - // - // The metadata identifies the `value` and `currency`. - PRICE = 13; - } - - // The representative name for the entity. - string name = 1; - - // The entity type. - Type type = 2; - - // Metadata associated with the entity. - // - // For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) - // and Knowledge Graph MID (`mid`), if they are available. For the metadata - // associated with other entity types, see the Type table below. - map metadata = 3; - - // The salience score associated with the entity in the [0, 1.0] range. - // - // The salience score for an entity provides information about the - // importance or centrality of that entity to the entire document text. - // Scores closer to 0 are less salient, while scores closer to 1.0 are highly - // salient. - float salience = 4; - - // The mentions of this entity in the input document. The API currently - // supports proper noun mentions. - repeated EntityMention mentions = 5; - - // For calls to [AnalyzeEntitySentiment][] or if - // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] - // is set to true, this field will contain the aggregate sentiment expressed - // for this entity in the provided document. - Sentiment sentiment = 6; -} - -// Represents the smallest syntactic building block of the text. -message Token { - // The token text. - TextSpan text = 1; - - // Parts of speech tag for this token. - PartOfSpeech part_of_speech = 2; - - // Dependency tree parse for this token. - DependencyEdge dependency_edge = 3; - - // [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. - string lemma = 4; -} - -// Represents the feeling associated with the entire text or entities in -// the text. -// Next ID: 6 -message Sentiment { - // A non-negative number in the [0, +inf) range, which represents - // the absolute magnitude of sentiment regardless of score (positive or - // negative). - float magnitude = 2; - - // Sentiment score between -1.0 (negative sentiment) and 1.0 - // (positive sentiment). - float score = 3; -} - -// Represents part of speech information for a token. -message PartOfSpeech { - // The part of speech tags enum. - enum Tag { - // Unknown - UNKNOWN = 0; - - // Adjective - ADJ = 1; - - // Adposition (preposition and postposition) - ADP = 2; - - // Adverb - ADV = 3; - - // Conjunction - CONJ = 4; - - // Determiner - DET = 5; - - // Noun (common and proper) - NOUN = 6; - - // Cardinal number - NUM = 7; - - // Pronoun - PRON = 8; - - // Particle or other function word - PRT = 9; - - // Punctuation - PUNCT = 10; - - // Verb (all tenses and modes) - VERB = 11; - - // Other: foreign words, typos, abbreviations - X = 12; - - // Affix - AFFIX = 13; - } - - // The characteristic of a verb that expresses time flow during an event. - enum Aspect { - // Aspect is not applicable in the analyzed language or is not predicted. - ASPECT_UNKNOWN = 0; - - // Perfective - PERFECTIVE = 1; - - // Imperfective - IMPERFECTIVE = 2; - - // Progressive - PROGRESSIVE = 3; - } - - // The grammatical function performed by a noun or pronoun in a phrase, - // clause, or sentence. In some languages, other parts of speech, such as - // adjective and determiner, take case inflection in agreement with the noun. - enum Case { - // Case is not applicable in the analyzed language or is not predicted. - CASE_UNKNOWN = 0; - - // Accusative - ACCUSATIVE = 1; - - // Adverbial - ADVERBIAL = 2; - - // Complementive - COMPLEMENTIVE = 3; - - // Dative - DATIVE = 4; - - // Genitive - GENITIVE = 5; - - // Instrumental - INSTRUMENTAL = 6; - - // Locative - LOCATIVE = 7; - - // Nominative - NOMINATIVE = 8; - - // Oblique - OBLIQUE = 9; - - // Partitive - PARTITIVE = 10; - - // Prepositional - PREPOSITIONAL = 11; - - // Reflexive - REFLEXIVE_CASE = 12; - - // Relative - RELATIVE_CASE = 13; - - // Vocative - VOCATIVE = 14; - } - - // Depending on the language, Form can be categorizing different forms of - // verbs, adjectives, adverbs, etc. For example, categorizing inflected - // endings of verbs and adjectives or distinguishing between short and long - // forms of adjectives and participles - enum Form { - // Form is not applicable in the analyzed language or is not predicted. - FORM_UNKNOWN = 0; - - // Adnomial - ADNOMIAL = 1; - - // Auxiliary - AUXILIARY = 2; - - // Complementizer - COMPLEMENTIZER = 3; - - // Final ending - FINAL_ENDING = 4; - - // Gerund - GERUND = 5; - - // Realis - REALIS = 6; - - // Irrealis - IRREALIS = 7; - - // Short form - SHORT = 8; - - // Long form - LONG = 9; - - // Order form - ORDER = 10; - - // Specific form - SPECIFIC = 11; - } - - // Gender classes of nouns reflected in the behaviour of associated words. - enum Gender { - // Gender is not applicable in the analyzed language or is not predicted. - GENDER_UNKNOWN = 0; - - // Feminine - FEMININE = 1; - - // Masculine - MASCULINE = 2; - - // Neuter - NEUTER = 3; - } - - // The grammatical feature of verbs, used for showing modality and attitude. - enum Mood { - // Mood is not applicable in the analyzed language or is not predicted. - MOOD_UNKNOWN = 0; - - // Conditional - CONDITIONAL_MOOD = 1; - - // Imperative - IMPERATIVE = 2; - - // Indicative - INDICATIVE = 3; - - // Interrogative - INTERROGATIVE = 4; - - // Jussive - JUSSIVE = 5; - - // Subjunctive - SUBJUNCTIVE = 6; - } - - // Count distinctions. - enum Number { - // Number is not applicable in the analyzed language or is not predicted. - NUMBER_UNKNOWN = 0; - - // Singular - SINGULAR = 1; - - // Plural - PLURAL = 2; - - // Dual - DUAL = 3; - } - - // The distinction between the speaker, second person, third person, etc. - enum Person { - // Person is not applicable in the analyzed language or is not predicted. - PERSON_UNKNOWN = 0; - - // First - FIRST = 1; - - // Second - SECOND = 2; - - // Third - THIRD = 3; - - // Reflexive - REFLEXIVE_PERSON = 4; - } - - // This category shows if the token is part of a proper name. - enum Proper { - // Proper is not applicable in the analyzed language or is not predicted. - PROPER_UNKNOWN = 0; - - // Proper - PROPER = 1; - - // Not proper - NOT_PROPER = 2; - } - - // Reciprocal features of a pronoun. - enum Reciprocity { - // Reciprocity is not applicable in the analyzed language or is not - // predicted. - RECIPROCITY_UNKNOWN = 0; - - // Reciprocal - RECIPROCAL = 1; - - // Non-reciprocal - NON_RECIPROCAL = 2; - } - - // Time reference. - enum Tense { - // Tense is not applicable in the analyzed language or is not predicted. - TENSE_UNKNOWN = 0; - - // Conditional - CONDITIONAL_TENSE = 1; - - // Future - FUTURE = 2; - - // Past - PAST = 3; - - // Present - PRESENT = 4; - - // Imperfect - IMPERFECT = 5; - - // Pluperfect - PLUPERFECT = 6; - } - - // The relationship between the action that a verb expresses and the - // participants identified by its arguments. - enum Voice { - // Voice is not applicable in the analyzed language or is not predicted. - VOICE_UNKNOWN = 0; - - // Active - ACTIVE = 1; - - // Causative - CAUSATIVE = 2; - - // Passive - PASSIVE = 3; - } - - // The part of speech tag. - Tag tag = 1; - - // The grammatical aspect. - Aspect aspect = 2; - - // The grammatical case. - Case case = 3; - - // The grammatical form. - Form form = 4; - - // The grammatical gender. - Gender gender = 5; - - // The grammatical mood. - Mood mood = 6; - - // The grammatical number. - Number number = 7; - - // The grammatical person. - Person person = 8; - - // The grammatical properness. - Proper proper = 9; - - // The grammatical reciprocity. - Reciprocity reciprocity = 10; - - // The grammatical tense. - Tense tense = 11; - - // The grammatical voice. - Voice voice = 12; -} - -// Represents dependency parse tree information for a token. -message DependencyEdge { - // The parse label enum for the token. - enum Label { - // Unknown - UNKNOWN = 0; - - // Abbreviation modifier - ABBREV = 1; - - // Adjectival complement - ACOMP = 2; - - // Adverbial clause modifier - ADVCL = 3; - - // Adverbial modifier - ADVMOD = 4; - - // Adjectival modifier of an NP - AMOD = 5; - - // Appositional modifier of an NP - APPOS = 6; - - // Attribute dependent of a copular verb - ATTR = 7; - - // Auxiliary (non-main) verb - AUX = 8; - - // Passive auxiliary - AUXPASS = 9; - - // Coordinating conjunction - CC = 10; - - // Clausal complement of a verb or adjective - CCOMP = 11; - - // Conjunct - CONJ = 12; - - // Clausal subject - CSUBJ = 13; - - // Clausal passive subject - CSUBJPASS = 14; - - // Dependency (unable to determine) - DEP = 15; - - // Determiner - DET = 16; - - // Discourse - DISCOURSE = 17; - - // Direct object - DOBJ = 18; - - // Expletive - EXPL = 19; - - // Goes with (part of a word in a text not well edited) - GOESWITH = 20; - - // Indirect object - IOBJ = 21; - - // Marker (word introducing a subordinate clause) - MARK = 22; - - // Multi-word expression - MWE = 23; - - // Multi-word verbal expression - MWV = 24; - - // Negation modifier - NEG = 25; - - // Noun compound modifier - NN = 26; - - // Noun phrase used as an adverbial modifier - NPADVMOD = 27; - - // Nominal subject - NSUBJ = 28; - - // Passive nominal subject - NSUBJPASS = 29; - - // Numeric modifier of a noun - NUM = 30; - - // Element of compound number - NUMBER = 31; - - // Punctuation mark - P = 32; - - // Parataxis relation - PARATAXIS = 33; - - // Participial modifier - PARTMOD = 34; - - // The complement of a preposition is a clause - PCOMP = 35; - - // Object of a preposition - POBJ = 36; - - // Possession modifier - POSS = 37; - - // Postverbal negative particle - POSTNEG = 38; - - // Predicate complement - PRECOMP = 39; - - // Preconjunt - PRECONJ = 40; - - // Predeterminer - PREDET = 41; - - // Prefix - PREF = 42; - - // Prepositional modifier - PREP = 43; - - // The relationship between a verb and verbal morpheme - PRONL = 44; - - // Particle - PRT = 45; - - // Associative or possessive marker - PS = 46; - - // Quantifier phrase modifier - QUANTMOD = 47; - - // Relative clause modifier - RCMOD = 48; - - // Complementizer in relative clause - RCMODREL = 49; - - // Ellipsis without a preceding predicate - RDROP = 50; - - // Referent - REF = 51; - - // Remnant - REMNANT = 52; - - // Reparandum - REPARANDUM = 53; - - // Root - ROOT = 54; - - // Suffix specifying a unit of number - SNUM = 55; - - // Suffix - SUFF = 56; - - // Temporal modifier - TMOD = 57; - - // Topic marker - TOPIC = 58; - - // Clause headed by an infinite form of the verb that modifies a noun - VMOD = 59; - - // Vocative - VOCATIVE = 60; - - // Open clausal complement - XCOMP = 61; - - // Name suffix - SUFFIX = 62; - - // Name title - TITLE = 63; - - // Adverbial phrase modifier - ADVPHMOD = 64; - - // Causative auxiliary - AUXCAUS = 65; - - // Helper auxiliary - AUXVV = 66; - - // Rentaishi (Prenominal modifier) - DTMOD = 67; - - // Foreign words - FOREIGN = 68; - - // Keyword - KW = 69; - - // List for chains of comparable items - LIST = 70; - - // Nominalized clause - NOMC = 71; - - // Nominalized clausal subject - NOMCSUBJ = 72; - - // Nominalized clausal passive - NOMCSUBJPASS = 73; - - // Compound of numeric modifier - NUMC = 74; - - // Copula - COP = 75; - - // Dislocated relation (for fronted/topicalized elements) - DISLOCATED = 76; - - // Aspect marker - ASP = 77; - - // Genitive modifier - GMOD = 78; - - // Genitive object - GOBJ = 79; - - // Infinitival modifier - INFMOD = 80; - - // Measure - MES = 81; - - // Nominal complement of a noun - NCOMP = 82; - } - - // Represents the head of this token in the dependency tree. - // This is the index of the token which has an arc going to this token. - // The index is the position of the token in the array of tokens returned - // by the API method. If this token is a root token, then the - // `head_token_index` is its own index. - int32 head_token_index = 1; - - // The parse label for the token. - Label label = 2; -} - -// Represents a mention for an entity in the text. Currently, proper noun -// mentions are supported. -message EntityMention { - // The supported types of mentions. - enum Type { - // Unknown - TYPE_UNKNOWN = 0; - - // Proper name - PROPER = 1; - - // Common noun (or noun compound) - COMMON = 2; - } - - // The mention text. - TextSpan text = 1; - - // The type of the entity mention. - Type type = 2; - - // For calls to [AnalyzeEntitySentiment][] or if - // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] - // is set to true, this field will contain the sentiment expressed for this - // mention of the entity in the provided document. - Sentiment sentiment = 3; -} - -// Represents an output piece of text. -message TextSpan { - // The content of the output text. - string content = 1; - - // The API calculates the beginning offset of the content in the original - // document according to the - // [EncodingType][google.cloud.language.v1beta2.EncodingType] specified in the - // API request. - int32 begin_offset = 2; -} - -// Represents a category returned from the text classifier. -message ClassificationCategory { - // The name of the category representing the document. - string name = 1; - - // The classifier's confidence of the category. Number represents how certain - // the classifier is that this category represents the given text. - float confidence = 2; -} - -// Model options available for classification requests. -message ClassificationModelOptions { - // Options for the V1 model. - message V1Model {} - - // Options for the V2 model. - message V2Model { - // The content categories used for classification. - enum ContentCategoriesVersion { - // If `ContentCategoriesVersion` is not specified, this option will - // default to `V1`. - CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0; - - // Legacy content categories of our initial launch in 2017. - V1 = 1; - - // Updated content categories in 2022. - V2 = 2; - } - - // The content categories used for classification. - ContentCategoriesVersion content_categories_version = 1; - } - - // If this field is not set, then the `v1_model` will be used by default. - oneof model_type { - // Setting this field will use the V1 model and V1 content categories - // version. The V1 model is a legacy model; support for this will be - // discontinued in the future. - V1Model v1_model = 1; - - // Setting this field will use the V2 model with the appropriate content - // categories version. The V2 model is a better performing model. - V2Model v2_model = 2; - } -} - -// The sentiment analysis request message. -message AnalyzeSentimentRequest { - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; - - // The encoding type used by the API to calculate sentence offsets for the - // sentence sentiment. - EncodingType encoding_type = 2; -} - -// The sentiment analysis response message. -message AnalyzeSentimentResponse { - // The overall sentiment of the input document. - Sentiment document_sentiment = 1; - - // The language of the text, which will be the same as the language specified - // in the request or, if not specified, the automatically-detected language. - // See [Document.language][google.cloud.language.v1beta2.Document.language] - // field for more details. - string language = 2; - - // The sentiment for all the sentences in the document. - repeated Sentence sentences = 3; -} - -// The entity-level sentiment analysis request message. -message AnalyzeEntitySentimentRequest { - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; - - // The encoding type used by the API to calculate offsets. - EncodingType encoding_type = 2; -} - -// The entity-level sentiment analysis response message. -message AnalyzeEntitySentimentResponse { - // The recognized entities in the input document with associated sentiments. - repeated Entity entities = 1; - - // The language of the text, which will be the same as the language specified - // in the request or, if not specified, the automatically-detected language. - // See [Document.language][google.cloud.language.v1beta2.Document.language] - // field for more details. - string language = 2; -} - -// The entity analysis request message. -message AnalyzeEntitiesRequest { - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; - - // The encoding type used by the API to calculate offsets. - EncodingType encoding_type = 2; -} - -// The entity analysis response message. -message AnalyzeEntitiesResponse { - // The recognized entities in the input document. - repeated Entity entities = 1; - - // The language of the text, which will be the same as the language specified - // in the request or, if not specified, the automatically-detected language. - // See [Document.language][google.cloud.language.v1beta2.Document.language] - // field for more details. - string language = 2; -} - -// The syntax analysis request message. -message AnalyzeSyntaxRequest { - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; - - // The encoding type used by the API to calculate offsets. - EncodingType encoding_type = 2; -} - -// The syntax analysis response message. -message AnalyzeSyntaxResponse { - // Sentences in the input document. - repeated Sentence sentences = 1; - - // Tokens, along with their syntactic information, in the input document. - repeated Token tokens = 2; - - // The language of the text, which will be the same as the language specified - // in the request or, if not specified, the automatically-detected language. - // See [Document.language][google.cloud.language.v1beta2.Document.language] - // field for more details. - string language = 3; -} - -// The document classification request message. -message ClassifyTextRequest { - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; - - // Model options to use for classification. Defaults to v1 options if not - // specified. - ClassificationModelOptions classification_model_options = 3; -} - -// The document classification response message. -message ClassifyTextResponse { - // Categories representing the input document. - repeated ClassificationCategory categories = 1; -} - -// The document moderation request message. -message ModerateTextRequest { - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The document moderation response message. -message ModerateTextResponse { - // Harmful and sensitive categories representing the input document. - repeated ClassificationCategory moderation_categories = 1; -} - -// The request message for the text annotation API, which can perform multiple -// analysis types (sentiment, entities, and syntax) in one call. -message AnnotateTextRequest { - // All available features for sentiment, syntax, and semantic analysis. - // Setting each one to true will enable that specific analysis for the input. - // Next ID: 12 - message Features { - // Extract syntax information. - bool extract_syntax = 1; - - // Extract entities. - bool extract_entities = 2; - - // Extract document-level sentiment. - bool extract_document_sentiment = 3; - - // Extract entities and their associated sentiment. - bool extract_entity_sentiment = 4; - - // Classify the full document into categories. If this is true, - // the API will use the default model which classifies into a - // [predefined - // taxonomy](https://cloud.google.com/natural-language/docs/categories). - bool classify_text = 6; - - // Moderate the document for harmful and sensitive categories. - bool moderate_text = 11; - - // The model options to use for classification. Defaults to v1 options - // if not specified. Only used if `classify_text` is set to true. - ClassificationModelOptions classification_model_options = 10; - } - - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The enabled features. - Features features = 2 [(google.api.field_behavior) = REQUIRED]; - - // The encoding type used by the API to calculate offsets. - EncodingType encoding_type = 3; -} - -// The text annotations response message. -message AnnotateTextResponse { - // Sentences in the input document. Populated if the user enables - // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax]. - repeated Sentence sentences = 1; - - // Tokens, along with their syntactic information, in the input document. - // Populated if the user enables - // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax]. - repeated Token tokens = 2; - - // Entities, along with their semantic information, in the input document. - // Populated if the user enables - // [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entities]. - repeated Entity entities = 3; - - // The overall sentiment for the document. Populated if the user enables - // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment]. - Sentiment document_sentiment = 4; - - // The language of the text, which will be the same as the language specified - // in the request or, if not specified, the automatically-detected language. - // See [Document.language][google.cloud.language.v1beta2.Document.language] - // field for more details. - string language = 5; - - // Categories identified in the input document. - repeated ClassificationCategory categories = 6; - - // Harmful and sensitive categories identified in the input document. - repeated ClassificationCategory moderation_categories = 8; -} diff --git a/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_entities.js b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_entities.js deleted file mode 100644 index c8f261cb905..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_entities.js +++ /dev/null @@ -1,65 +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(document) { - // [START language_v1beta2_generated_LanguageService_AnalyzeEntities_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. Input document. - */ - // const document = {} - /** - * The encoding type used by the API to calculate offsets. - */ - // const encodingType = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v1beta2; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callAnalyzeEntities() { - // Construct request - const request = { - document, - }; - - // Run request - const response = await languageClient.analyzeEntities(request); - console.log(response); - } - - callAnalyzeEntities(); - // [END language_v1beta2_generated_LanguageService_AnalyzeEntities_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-language/v1beta2/samples/generated/v1beta2/language_service.analyze_entity_sentiment.js b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_entity_sentiment.js deleted file mode 100644 index 51a1ead03b3..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_entity_sentiment.js +++ /dev/null @@ -1,65 +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(document) { - // [START language_v1beta2_generated_LanguageService_AnalyzeEntitySentiment_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. Input document. - */ - // const document = {} - /** - * The encoding type used by the API to calculate offsets. - */ - // const encodingType = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v1beta2; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callAnalyzeEntitySentiment() { - // Construct request - const request = { - document, - }; - - // Run request - const response = await languageClient.analyzeEntitySentiment(request); - console.log(response); - } - - callAnalyzeEntitySentiment(); - // [END language_v1beta2_generated_LanguageService_AnalyzeEntitySentiment_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-language/v1beta2/samples/generated/v1beta2/language_service.analyze_sentiment.js b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_sentiment.js deleted file mode 100644 index 31213ead7a1..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_sentiment.js +++ /dev/null @@ -1,66 +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(document) { - // [START language_v1beta2_generated_LanguageService_AnalyzeSentiment_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. Input document. - */ - // const document = {} - /** - * The encoding type used by the API to calculate sentence offsets for the - * sentence sentiment. - */ - // const encodingType = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v1beta2; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callAnalyzeSentiment() { - // Construct request - const request = { - document, - }; - - // Run request - const response = await languageClient.analyzeSentiment(request); - console.log(response); - } - - callAnalyzeSentiment(); - // [END language_v1beta2_generated_LanguageService_AnalyzeSentiment_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-language/v1beta2/samples/generated/v1beta2/language_service.analyze_syntax.js b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_syntax.js deleted file mode 100644 index b125c505102..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.analyze_syntax.js +++ /dev/null @@ -1,65 +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(document) { - // [START language_v1beta2_generated_LanguageService_AnalyzeSyntax_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. Input document. - */ - // const document = {} - /** - * The encoding type used by the API to calculate offsets. - */ - // const encodingType = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v1beta2; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callAnalyzeSyntax() { - // Construct request - const request = { - document, - }; - - // Run request - const response = await languageClient.analyzeSyntax(request); - console.log(response); - } - - callAnalyzeSyntax(); - // [END language_v1beta2_generated_LanguageService_AnalyzeSyntax_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-language/v1beta2/samples/generated/v1beta2/language_service.annotate_text.js b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.annotate_text.js deleted file mode 100644 index 520f7ab3106..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.annotate_text.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(document, features) { - // [START language_v1beta2_generated_LanguageService_AnnotateText_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. Input document. - */ - // const document = {} - /** - * Required. The enabled features. - */ - // const features = {} - /** - * The encoding type used by the API to calculate offsets. - */ - // const encodingType = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v1beta2; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callAnnotateText() { - // Construct request - const request = { - document, - features, - }; - - // Run request - const response = await languageClient.annotateText(request); - console.log(response); - } - - callAnnotateText(); - // [END language_v1beta2_generated_LanguageService_AnnotateText_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-language/v1beta2/samples/generated/v1beta2/language_service.classify_text.js b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.classify_text.js deleted file mode 100644 index f431d864f6c..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.classify_text.js +++ /dev/null @@ -1,66 +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(document) { - // [START language_v1beta2_generated_LanguageService_ClassifyText_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. Input document. - */ - // const document = {} - /** - * Model options to use for classification. Defaults to v1 options if not - * specified. - */ - // const classificationModelOptions = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v1beta2; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callClassifyText() { - // Construct request - const request = { - document, - }; - - // Run request - const response = await languageClient.classifyText(request); - console.log(response); - } - - callClassifyText(); - // [END language_v1beta2_generated_LanguageService_ClassifyText_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-language/v1beta2/samples/generated/v1beta2/language_service.moderate_text.js b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.moderate_text.js deleted file mode 100644 index 2992deaa659..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/language_service.moderate_text.js +++ /dev/null @@ -1,61 +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(document) { - // [START language_v1beta2_generated_LanguageService_ModerateText_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. Input document. - */ - // const document = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v1beta2; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callModerateText() { - // Construct request - const request = { - document, - }; - - // Run request - const response = await languageClient.moderateText(request); - console.log(response); - } - - callModerateText(); - // [END language_v1beta2_generated_LanguageService_ModerateText_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-language/v1beta2/samples/generated/v1beta2/snippet_metadata_google.cloud.language.v1beta2.json b/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/snippet_metadata_google.cloud.language.v1beta2.json deleted file mode 100644 index 7f46630d8de..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/samples/generated/v1beta2/snippet_metadata_google.cloud.language.v1beta2.json +++ /dev/null @@ -1,323 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-language", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.language.v1beta2", - "version": "v1beta2" - } - ] - }, - "snippets": [ - { - "regionTag": "language_v1beta2_generated_LanguageService_AnalyzeSentiment_async", - "title": "LanguageService analyzeSentiment Sample", - "origin": "API_DEFINITION", - "description": " Analyzes the sentiment of the provided text.", - "canonical": true, - "file": "language_service.analyze_sentiment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AnalyzeSentiment", - "fullName": "google.cloud.language.v1beta2.LanguageService.AnalyzeSentiment", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v1beta2.Document" - }, - { - "name": "encoding_type", - "type": ".google.cloud.language.v1beta2.EncodingType" - } - ], - "resultType": ".google.cloud.language.v1beta2.AnalyzeSentimentResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v1beta2.LanguageServiceClient" - }, - "method": { - "shortName": "AnalyzeSentiment", - "fullName": "google.cloud.language.v1beta2.LanguageService.AnalyzeSentiment", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v1beta2.LanguageService" - } - } - } - }, - { - "regionTag": "language_v1beta2_generated_LanguageService_AnalyzeEntities_async", - "title": "LanguageService analyzeEntities Sample", - "origin": "API_DEFINITION", - "description": " Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties.", - "canonical": true, - "file": "language_service.analyze_entities.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AnalyzeEntities", - "fullName": "google.cloud.language.v1beta2.LanguageService.AnalyzeEntities", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v1beta2.Document" - }, - { - "name": "encoding_type", - "type": ".google.cloud.language.v1beta2.EncodingType" - } - ], - "resultType": ".google.cloud.language.v1beta2.AnalyzeEntitiesResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v1beta2.LanguageServiceClient" - }, - "method": { - "shortName": "AnalyzeEntities", - "fullName": "google.cloud.language.v1beta2.LanguageService.AnalyzeEntities", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v1beta2.LanguageService" - } - } - } - }, - { - "regionTag": "language_v1beta2_generated_LanguageService_AnalyzeEntitySentiment_async", - "title": "LanguageService analyzeEntitySentiment Sample", - "origin": "API_DEFINITION", - "description": " Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text and analyzes sentiment associated with each entity and its mentions.", - "canonical": true, - "file": "language_service.analyze_entity_sentiment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AnalyzeEntitySentiment", - "fullName": "google.cloud.language.v1beta2.LanguageService.AnalyzeEntitySentiment", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v1beta2.Document" - }, - { - "name": "encoding_type", - "type": ".google.cloud.language.v1beta2.EncodingType" - } - ], - "resultType": ".google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v1beta2.LanguageServiceClient" - }, - "method": { - "shortName": "AnalyzeEntitySentiment", - "fullName": "google.cloud.language.v1beta2.LanguageService.AnalyzeEntitySentiment", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v1beta2.LanguageService" - } - } - } - }, - { - "regionTag": "language_v1beta2_generated_LanguageService_AnalyzeSyntax_async", - "title": "LanguageService analyzeSyntax Sample", - "origin": "API_DEFINITION", - "description": " Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.", - "canonical": true, - "file": "language_service.analyze_syntax.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AnalyzeSyntax", - "fullName": "google.cloud.language.v1beta2.LanguageService.AnalyzeSyntax", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v1beta2.Document" - }, - { - "name": "encoding_type", - "type": ".google.cloud.language.v1beta2.EncodingType" - } - ], - "resultType": ".google.cloud.language.v1beta2.AnalyzeSyntaxResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v1beta2.LanguageServiceClient" - }, - "method": { - "shortName": "AnalyzeSyntax", - "fullName": "google.cloud.language.v1beta2.LanguageService.AnalyzeSyntax", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v1beta2.LanguageService" - } - } - } - }, - { - "regionTag": "language_v1beta2_generated_LanguageService_ClassifyText_async", - "title": "LanguageService classifyText Sample", - "origin": "API_DEFINITION", - "description": " Classifies a document into categories.", - "canonical": true, - "file": "language_service.classify_text.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ClassifyText", - "fullName": "google.cloud.language.v1beta2.LanguageService.ClassifyText", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v1beta2.Document" - }, - { - "name": "classification_model_options", - "type": ".google.cloud.language.v1beta2.ClassificationModelOptions" - } - ], - "resultType": ".google.cloud.language.v1beta2.ClassifyTextResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v1beta2.LanguageServiceClient" - }, - "method": { - "shortName": "ClassifyText", - "fullName": "google.cloud.language.v1beta2.LanguageService.ClassifyText", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v1beta2.LanguageService" - } - } - } - }, - { - "regionTag": "language_v1beta2_generated_LanguageService_ModerateText_async", - "title": "LanguageService moderateText Sample", - "origin": "API_DEFINITION", - "description": " Moderates a document for harmful and sensitive categories.", - "canonical": true, - "file": "language_service.moderate_text.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ModerateText", - "fullName": "google.cloud.language.v1beta2.LanguageService.ModerateText", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v1beta2.Document" - } - ], - "resultType": ".google.cloud.language.v1beta2.ModerateTextResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v1beta2.LanguageServiceClient" - }, - "method": { - "shortName": "ModerateText", - "fullName": "google.cloud.language.v1beta2.LanguageService.ModerateText", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v1beta2.LanguageService" - } - } - } - }, - { - "regionTag": "language_v1beta2_generated_LanguageService_AnnotateText_async", - "title": "LanguageService annotateText Sample", - "origin": "API_DEFINITION", - "description": " A convenience method that provides all syntax, sentiment, entity, and classification features in one call.", - "canonical": true, - "file": "language_service.annotate_text.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AnnotateText", - "fullName": "google.cloud.language.v1beta2.LanguageService.AnnotateText", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v1beta2.Document" - }, - { - "name": "features", - "type": ".google.cloud.language.v1beta2.AnnotateTextRequest.Features" - }, - { - "name": "encoding_type", - "type": ".google.cloud.language.v1beta2.EncodingType" - } - ], - "resultType": ".google.cloud.language.v1beta2.AnnotateTextResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v1beta2.LanguageServiceClient" - }, - "method": { - "shortName": "AnnotateText", - "fullName": "google.cloud.language.v1beta2.LanguageService.AnnotateText", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v1beta2.LanguageService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-language/v1beta2/src/index.ts b/owl-bot-staging/google-cloud-language/v1beta2/src/index.ts deleted file mode 100644 index 0af96dc62b7..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/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 v1beta2 from './v1beta2'; -const LanguageServiceClient = v1beta2.LanguageServiceClient; -type LanguageServiceClient = v1beta2.LanguageServiceClient; -export {v1beta2, LanguageServiceClient}; -export default {v1beta2, LanguageServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/gapic_metadata.json b/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/gapic_metadata.json deleted file mode 100644 index 0a44c556085..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/gapic_metadata.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.language.v1beta2", - "libraryPackage": "@google-cloud/language", - "services": { - "LanguageService": { - "clients": { - "grpc": { - "libraryClient": "LanguageServiceClient", - "rpcs": { - "AnalyzeSentiment": { - "methods": [ - "analyzeSentiment" - ] - }, - "AnalyzeEntities": { - "methods": [ - "analyzeEntities" - ] - }, - "AnalyzeEntitySentiment": { - "methods": [ - "analyzeEntitySentiment" - ] - }, - "AnalyzeSyntax": { - "methods": [ - "analyzeSyntax" - ] - }, - "ClassifyText": { - "methods": [ - "classifyText" - ] - }, - "ModerateText": { - "methods": [ - "moderateText" - ] - }, - "AnnotateText": { - "methods": [ - "annotateText" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "LanguageServiceClient", - "rpcs": { - "AnalyzeSentiment": { - "methods": [ - "analyzeSentiment" - ] - }, - "AnalyzeEntities": { - "methods": [ - "analyzeEntities" - ] - }, - "AnalyzeEntitySentiment": { - "methods": [ - "analyzeEntitySentiment" - ] - }, - "AnalyzeSyntax": { - "methods": [ - "analyzeSyntax" - ] - }, - "ClassifyText": { - "methods": [ - "classifyText" - ] - }, - "ModerateText": { - "methods": [ - "moderateText" - ] - }, - "AnnotateText": { - "methods": [ - "annotateText" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/index.ts b/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/index.ts deleted file mode 100644 index 3275c17250d..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/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 {LanguageServiceClient} from './language_service_client'; diff --git a/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_client.ts b/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_client.ts deleted file mode 100644 index 951cc2dce11..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_client.ts +++ /dev/null @@ -1,787 +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/v1beta2/language_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './language_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Provides text analysis operations such as sentiment analysis and entity - * recognition. - * @class - * @memberof v1beta2 - */ -export class LanguageServiceClient { - 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}; - languageServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of LanguageServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 LanguageServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof LanguageServiceClient; - 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 { - 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.language.v1beta2.LanguageService', 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.languageServiceStub) { - return this.languageServiceStub; - } - - // Put together the "service stub" for - // google.cloud.language.v1beta2.LanguageService. - this.languageServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.language.v1beta2.LanguageService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.language.v1beta2.LanguageService, - 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 languageServiceStubMethods = - ['analyzeSentiment', 'analyzeEntities', 'analyzeEntitySentiment', 'analyzeSyntax', 'classifyText', 'moderateText', 'annotateText']; - for (const methodName of languageServiceStubMethods) { - const callPromise = this.languageServiceStub.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.languageServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'language.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 'language.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-language', - '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 -- - // ------------------- -/** - * Analyzes the sentiment of the provided text. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v1beta2.Document} request.document - * Required. Input document. - * @param {google.cloud.language.v1beta2.EncodingType} request.encodingType - * The encoding type used by the API to calculate sentence offsets for the - * sentence sentiment. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1beta2.AnalyzeSentimentResponse|AnalyzeSentimentResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/language_service.analyze_sentiment.js - * region_tag:language_v1beta2_generated_LanguageService_AnalyzeSentiment_async - */ - analyzeSentiment( - request?: protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v1beta2.IAnalyzeSentimentResponse, - protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest|undefined, {}|undefined - ]>; - analyzeSentiment( - request: protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v1beta2.IAnalyzeSentimentResponse, - protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest|null|undefined, - {}|null|undefined>): void; - analyzeSentiment( - request: protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest, - callback: Callback< - protos.google.cloud.language.v1beta2.IAnalyzeSentimentResponse, - protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest|null|undefined, - {}|null|undefined>): void; - analyzeSentiment( - request?: protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v1beta2.IAnalyzeSentimentResponse, - protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v1beta2.IAnalyzeSentimentResponse, - protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v1beta2.IAnalyzeSentimentResponse, - protos.google.cloud.language.v1beta2.IAnalyzeSentimentRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.analyzeSentiment(request, options, callback); - } -/** - * Finds named entities (currently proper names and common nouns) in the text - * along with entity types, salience, mentions for each entity, and - * other properties. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v1beta2.Document} request.document - * Required. Input document. - * @param {google.cloud.language.v1beta2.EncodingType} request.encodingType - * The encoding type used by the API to calculate offsets. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1beta2.AnalyzeEntitiesResponse|AnalyzeEntitiesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/language_service.analyze_entities.js - * region_tag:language_v1beta2_generated_LanguageService_AnalyzeEntities_async - */ - analyzeEntities( - request?: protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v1beta2.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest|undefined, {}|undefined - ]>; - analyzeEntities( - request: protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v1beta2.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest|null|undefined, - {}|null|undefined>): void; - analyzeEntities( - request: protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest, - callback: Callback< - protos.google.cloud.language.v1beta2.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest|null|undefined, - {}|null|undefined>): void; - analyzeEntities( - request?: protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v1beta2.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v1beta2.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v1beta2.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v1beta2.IAnalyzeEntitiesRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.analyzeEntities(request, options, callback); - } -/** - * Finds entities, similar to - * {@link protos.google.cloud.language.v1beta2.LanguageService.AnalyzeEntities|AnalyzeEntities} - * in the text and analyzes sentiment associated with each entity and its - * mentions. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v1beta2.Document} request.document - * Required. Input document. - * @param {google.cloud.language.v1beta2.EncodingType} request.encodingType - * The encoding type used by the API to calculate offsets. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse|AnalyzeEntitySentimentResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/language_service.analyze_entity_sentiment.js - * region_tag:language_v1beta2_generated_LanguageService_AnalyzeEntitySentiment_async - */ - analyzeEntitySentiment( - request?: protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentResponse, - protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest|undefined, {}|undefined - ]>; - analyzeEntitySentiment( - request: protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentResponse, - protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest|null|undefined, - {}|null|undefined>): void; - analyzeEntitySentiment( - request: protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest, - callback: Callback< - protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentResponse, - protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest|null|undefined, - {}|null|undefined>): void; - analyzeEntitySentiment( - request?: protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentResponse, - protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentResponse, - protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentResponse, - protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.analyzeEntitySentiment(request, options, callback); - } -/** - * Analyzes the syntax of the text and provides sentence boundaries and - * tokenization along with part of speech tags, dependency trees, and other - * properties. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v1beta2.Document} request.document - * Required. Input document. - * @param {google.cloud.language.v1beta2.EncodingType} request.encodingType - * The encoding type used by the API to calculate offsets. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1beta2.AnalyzeSyntaxResponse|AnalyzeSyntaxResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/language_service.analyze_syntax.js - * region_tag:language_v1beta2_generated_LanguageService_AnalyzeSyntax_async - */ - analyzeSyntax( - request?: protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v1beta2.IAnalyzeSyntaxResponse, - protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest|undefined, {}|undefined - ]>; - analyzeSyntax( - request: protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v1beta2.IAnalyzeSyntaxResponse, - protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest|null|undefined, - {}|null|undefined>): void; - analyzeSyntax( - request: protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest, - callback: Callback< - protos.google.cloud.language.v1beta2.IAnalyzeSyntaxResponse, - protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest|null|undefined, - {}|null|undefined>): void; - analyzeSyntax( - request?: protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v1beta2.IAnalyzeSyntaxResponse, - protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v1beta2.IAnalyzeSyntaxResponse, - protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v1beta2.IAnalyzeSyntaxResponse, - protos.google.cloud.language.v1beta2.IAnalyzeSyntaxRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.analyzeSyntax(request, options, callback); - } -/** - * Classifies a document into categories. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v1beta2.Document} request.document - * Required. Input document. - * @param {google.cloud.language.v1beta2.ClassificationModelOptions} request.classificationModelOptions - * Model options to use for classification. Defaults to v1 options if not - * specified. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1beta2.ClassifyTextResponse|ClassifyTextResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/language_service.classify_text.js - * region_tag:language_v1beta2_generated_LanguageService_ClassifyText_async - */ - classifyText( - request?: protos.google.cloud.language.v1beta2.IClassifyTextRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v1beta2.IClassifyTextResponse, - protos.google.cloud.language.v1beta2.IClassifyTextRequest|undefined, {}|undefined - ]>; - classifyText( - request: protos.google.cloud.language.v1beta2.IClassifyTextRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v1beta2.IClassifyTextResponse, - protos.google.cloud.language.v1beta2.IClassifyTextRequest|null|undefined, - {}|null|undefined>): void; - classifyText( - request: protos.google.cloud.language.v1beta2.IClassifyTextRequest, - callback: Callback< - protos.google.cloud.language.v1beta2.IClassifyTextResponse, - protos.google.cloud.language.v1beta2.IClassifyTextRequest|null|undefined, - {}|null|undefined>): void; - classifyText( - request?: protos.google.cloud.language.v1beta2.IClassifyTextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v1beta2.IClassifyTextResponse, - protos.google.cloud.language.v1beta2.IClassifyTextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v1beta2.IClassifyTextResponse, - protos.google.cloud.language.v1beta2.IClassifyTextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v1beta2.IClassifyTextResponse, - protos.google.cloud.language.v1beta2.IClassifyTextRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.classifyText(request, options, callback); - } -/** - * Moderates a document for harmful and sensitive categories. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v1beta2.Document} request.document - * Required. Input document. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1beta2.ModerateTextResponse|ModerateTextResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/language_service.moderate_text.js - * region_tag:language_v1beta2_generated_LanguageService_ModerateText_async - */ - moderateText( - request?: protos.google.cloud.language.v1beta2.IModerateTextRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v1beta2.IModerateTextResponse, - protos.google.cloud.language.v1beta2.IModerateTextRequest|undefined, {}|undefined - ]>; - moderateText( - request: protos.google.cloud.language.v1beta2.IModerateTextRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v1beta2.IModerateTextResponse, - protos.google.cloud.language.v1beta2.IModerateTextRequest|null|undefined, - {}|null|undefined>): void; - moderateText( - request: protos.google.cloud.language.v1beta2.IModerateTextRequest, - callback: Callback< - protos.google.cloud.language.v1beta2.IModerateTextResponse, - protos.google.cloud.language.v1beta2.IModerateTextRequest|null|undefined, - {}|null|undefined>): void; - moderateText( - request?: protos.google.cloud.language.v1beta2.IModerateTextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v1beta2.IModerateTextResponse, - protos.google.cloud.language.v1beta2.IModerateTextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v1beta2.IModerateTextResponse, - protos.google.cloud.language.v1beta2.IModerateTextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v1beta2.IModerateTextResponse, - protos.google.cloud.language.v1beta2.IModerateTextRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.moderateText(request, options, callback); - } -/** - * A convenience method that provides all syntax, sentiment, entity, and - * classification features in one call. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v1beta2.Document} request.document - * Required. Input document. - * @param {google.cloud.language.v1beta2.AnnotateTextRequest.Features} request.features - * Required. The enabled features. - * @param {google.cloud.language.v1beta2.EncodingType} request.encodingType - * The encoding type used by the API to calculate offsets. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v1beta2.AnnotateTextResponse|AnnotateTextResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/language_service.annotate_text.js - * region_tag:language_v1beta2_generated_LanguageService_AnnotateText_async - */ - annotateText( - request?: protos.google.cloud.language.v1beta2.IAnnotateTextRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v1beta2.IAnnotateTextResponse, - protos.google.cloud.language.v1beta2.IAnnotateTextRequest|undefined, {}|undefined - ]>; - annotateText( - request: protos.google.cloud.language.v1beta2.IAnnotateTextRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v1beta2.IAnnotateTextResponse, - protos.google.cloud.language.v1beta2.IAnnotateTextRequest|null|undefined, - {}|null|undefined>): void; - annotateText( - request: protos.google.cloud.language.v1beta2.IAnnotateTextRequest, - callback: Callback< - protos.google.cloud.language.v1beta2.IAnnotateTextResponse, - protos.google.cloud.language.v1beta2.IAnnotateTextRequest|null|undefined, - {}|null|undefined>): void; - annotateText( - request?: protos.google.cloud.language.v1beta2.IAnnotateTextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v1beta2.IAnnotateTextResponse, - protos.google.cloud.language.v1beta2.IAnnotateTextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v1beta2.IAnnotateTextResponse, - protos.google.cloud.language.v1beta2.IAnnotateTextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v1beta2.IAnnotateTextResponse, - protos.google.cloud.language.v1beta2.IAnnotateTextRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.annotateText(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.languageServiceStub && !this._terminated) { - return this.languageServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_client_config.json b/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_client_config.json deleted file mode 100644 index 59cb784dc03..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_client_config.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "interfaces": { - "google.cloud.language.v1beta2.LanguageService": { - "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": { - "AnalyzeSentiment": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "AnalyzeEntities": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "AnalyzeEntitySentiment": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "AnalyzeSyntax": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ClassifyText": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ModerateText": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AnnotateText": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_proto_list.json b/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_proto_list.json deleted file mode 100644 index d5314f41309..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/src/v1beta2/language_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/language/v1beta2/language_service.proto" -] diff --git a/owl-bot-staging/google-cloud-language/v1beta2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-language/v1beta2/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 46600ec0cdc..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/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 language = require('@google-cloud/language'); - -function main() { - const languageServiceClient = new language.LanguageServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-language/v1beta2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-language/v1beta2/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index e2767ca4173..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/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 {LanguageServiceClient} from '@google-cloud/language'; - -// check that the client class type name can be used -function doStuffWithLanguageServiceClient(client: LanguageServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const languageServiceClient = new LanguageServiceClient(); - doStuffWithLanguageServiceClient(languageServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-language/v1beta2/system-test/install.ts b/owl-bot-staging/google-cloud-language/v1beta2/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/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-language/v1beta2/test/gapic_language_service_v1beta2.ts b/owl-bot-staging/google-cloud-language/v1beta2/test/gapic_language_service_v1beta2.ts deleted file mode 100644 index c0f805a8793..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/test/gapic_language_service_v1beta2.ts +++ /dev/null @@ -1,675 +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 languageserviceModule 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('v1beta2.LanguageServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = languageserviceModule.v1beta2.LanguageServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = languageserviceModule.v1beta2.LanguageServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = languageserviceModule.v1beta2.LanguageServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.languageServiceStub, undefined); - await client.initialize(); - assert(client.languageServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.languageServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.languageServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - 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 languageserviceModule.v1beta2.LanguageServiceClient({ - 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('analyzeSentiment', () => { - it('invokes analyzeSentiment without error', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeSentimentRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeSentimentResponse() - ); - client.innerApiCalls.analyzeSentiment = stubSimpleCall(expectedResponse); - const [response] = await client.analyzeSentiment(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeSentiment without error using callback', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeSentimentRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeSentimentResponse() - ); - client.innerApiCalls.analyzeSentiment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.analyzeSentiment( - request, - (err?: Error|null, result?: protos.google.cloud.language.v1beta2.IAnalyzeSentimentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeSentiment with error', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeSentimentRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeSentiment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.analyzeSentiment(request), expectedError); - }); - - it('invokes analyzeSentiment with closed client', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeSentimentRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.analyzeSentiment(request), expectedError); - }); - }); - - describe('analyzeEntities', () => { - it('invokes analyzeEntities without error', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeEntitiesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeEntitiesResponse() - ); - client.innerApiCalls.analyzeEntities = stubSimpleCall(expectedResponse); - const [response] = await client.analyzeEntities(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeEntities without error using callback', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeEntitiesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeEntitiesResponse() - ); - client.innerApiCalls.analyzeEntities = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.analyzeEntities( - request, - (err?: Error|null, result?: protos.google.cloud.language.v1beta2.IAnalyzeEntitiesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeEntities with error', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeEntitiesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeEntities = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.analyzeEntities(request), expectedError); - }); - - it('invokes analyzeEntities with closed client', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeEntitiesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.analyzeEntities(request), expectedError); - }); - }); - - describe('analyzeEntitySentiment', () => { - it('invokes analyzeEntitySentiment without error', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse() - ); - client.innerApiCalls.analyzeEntitySentiment = stubSimpleCall(expectedResponse); - const [response] = await client.analyzeEntitySentiment(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeEntitySentiment without error using callback', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse() - ); - client.innerApiCalls.analyzeEntitySentiment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.analyzeEntitySentiment( - request, - (err?: Error|null, result?: protos.google.cloud.language.v1beta2.IAnalyzeEntitySentimentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeEntitySentiment with error', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeEntitySentiment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.analyzeEntitySentiment(request), expectedError); - }); - - it('invokes analyzeEntitySentiment with closed client', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.analyzeEntitySentiment(request), expectedError); - }); - }); - - describe('analyzeSyntax', () => { - it('invokes analyzeSyntax without error', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeSyntaxRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeSyntaxResponse() - ); - client.innerApiCalls.analyzeSyntax = stubSimpleCall(expectedResponse); - const [response] = await client.analyzeSyntax(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeSyntax without error using callback', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeSyntaxRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeSyntaxResponse() - ); - client.innerApiCalls.analyzeSyntax = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.analyzeSyntax( - request, - (err?: Error|null, result?: protos.google.cloud.language.v1beta2.IAnalyzeSyntaxResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeSyntax with error', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeSyntaxRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeSyntax = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.analyzeSyntax(request), expectedError); - }); - - it('invokes analyzeSyntax with closed client', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnalyzeSyntaxRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.analyzeSyntax(request), expectedError); - }); - }); - - describe('classifyText', () => { - it('invokes classifyText without error', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.ClassifyTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1beta2.ClassifyTextResponse() - ); - client.innerApiCalls.classifyText = stubSimpleCall(expectedResponse); - const [response] = await client.classifyText(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes classifyText without error using callback', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.ClassifyTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1beta2.ClassifyTextResponse() - ); - client.innerApiCalls.classifyText = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.classifyText( - request, - (err?: Error|null, result?: protos.google.cloud.language.v1beta2.IClassifyTextResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes classifyText with error', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.ClassifyTextRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.classifyText = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.classifyText(request), expectedError); - }); - - it('invokes classifyText with closed client', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.ClassifyTextRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.classifyText(request), expectedError); - }); - }); - - describe('moderateText', () => { - it('invokes moderateText without error', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.ModerateTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1beta2.ModerateTextResponse() - ); - client.innerApiCalls.moderateText = stubSimpleCall(expectedResponse); - const [response] = await client.moderateText(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes moderateText without error using callback', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.ModerateTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1beta2.ModerateTextResponse() - ); - client.innerApiCalls.moderateText = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.moderateText( - request, - (err?: Error|null, result?: protos.google.cloud.language.v1beta2.IModerateTextResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes moderateText with error', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.ModerateTextRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.moderateText = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.moderateText(request), expectedError); - }); - - it('invokes moderateText with closed client', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.ModerateTextRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.moderateText(request), expectedError); - }); - }); - - describe('annotateText', () => { - it('invokes annotateText without error', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnnotateTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnnotateTextResponse() - ); - client.innerApiCalls.annotateText = stubSimpleCall(expectedResponse); - const [response] = await client.annotateText(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes annotateText without error using callback', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnnotateTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnnotateTextResponse() - ); - client.innerApiCalls.annotateText = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.annotateText( - request, - (err?: Error|null, result?: protos.google.cloud.language.v1beta2.IAnnotateTextResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes annotateText with error', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnnotateTextRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.annotateText = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.annotateText(request), expectedError); - }); - - it('invokes annotateText with closed client', async () => { - const client = new languageserviceModule.v1beta2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v1beta2.AnnotateTextRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.annotateText(request), expectedError); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-language/v1beta2/tsconfig.json b/owl-bot-staging/google-cloud-language/v1beta2/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/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-language/v1beta2/webpack.config.js b/owl-bot-staging/google-cloud-language/v1beta2/webpack.config.js deleted file mode 100644 index c90df1063ed..00000000000 --- a/owl-bot-staging/google-cloud-language/v1beta2/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: 'LanguageService', - filename: './language-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-language/v2/.eslintignore b/owl-bot-staging/google-cloud-language/v2/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/.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-language/v2/.eslintrc.json b/owl-bot-staging/google-cloud-language/v2/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-language/v2/.gitignore b/owl-bot-staging/google-cloud-language/v2/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/.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-language/v2/.jsdoc.js b/owl-bot-staging/google-cloud-language/v2/.jsdoc.js deleted file mode 100644 index 31167957cc8..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/.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/language', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-language/v2/.mocharc.js b/owl-bot-staging/google-cloud-language/v2/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/.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-language/v2/.prettierrc.js b/owl-bot-staging/google-cloud-language/v2/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/.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-language/v2/README.md b/owl-bot-staging/google-cloud-language/v2/README.md deleted file mode 100644 index 7287da54696..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/README.md +++ /dev/null @@ -1 +0,0 @@ -Language: Nodejs Client diff --git a/owl-bot-staging/google-cloud-language/v2/package.json b/owl-bot-staging/google-cloud-language/v2/package.json deleted file mode 100644 index c158c05feac..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/language", - "version": "0.1.0", - "description": "Language client for Node.js", - "repository": "googleapis/nodejs-language", - "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 language", - "language", - "language service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-language/v2/protos/google/cloud/language/v2/language_service.proto b/owl-bot-staging/google-cloud-language/v2/protos/google/cloud/language/v2/language_service.proto deleted file mode 100644 index acbdbd4f6ad..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/protos/google/cloud/language/v2/language_service.proto +++ /dev/null @@ -1,504 +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 -// -// 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.language.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/language/apiv2/languagepb;languagepb"; -option java_multiple_files = true; -option java_outer_classname = "LanguageServiceProto"; -option java_package = "com.google.cloud.language.v2"; - -// Provides text analysis operations such as sentiment analysis and entity -// recognition. -service LanguageService { - option (google.api.default_host) = "language.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-language," - "https://www.googleapis.com/auth/cloud-platform"; - - // Analyzes the sentiment of the provided text. - rpc AnalyzeSentiment(AnalyzeSentimentRequest) - returns (AnalyzeSentimentResponse) { - option (google.api.http) = { - post: "/v2/documents:analyzeSentiment" - body: "*" - }; - option (google.api.method_signature) = "document,encoding_type"; - option (google.api.method_signature) = "document"; - } - - // Finds named entities (currently proper names and common nouns) in the text - // along with entity types, probability, mentions for each entity, and - // other properties. - rpc AnalyzeEntities(AnalyzeEntitiesRequest) - returns (AnalyzeEntitiesResponse) { - option (google.api.http) = { - post: "/v2/documents:analyzeEntities" - body: "*" - }; - option (google.api.method_signature) = "document,encoding_type"; - option (google.api.method_signature) = "document"; - } - - // Classifies a document into categories. - rpc ClassifyText(ClassifyTextRequest) returns (ClassifyTextResponse) { - option (google.api.http) = { - post: "/v2/documents:classifyText" - body: "*" - }; - option (google.api.method_signature) = "document"; - } - - // Moderates a document for harmful and sensitive categories. - rpc ModerateText(ModerateTextRequest) returns (ModerateTextResponse) { - option (google.api.http) = { - post: "/v2/documents:moderateText" - body: "*" - }; - option (google.api.method_signature) = "document"; - } - - // A convenience method that provides all features in one call. - rpc AnnotateText(AnnotateTextRequest) returns (AnnotateTextResponse) { - option (google.api.http) = { - post: "/v2/documents:annotateText" - body: "*" - }; - option (google.api.method_signature) = "document,features,encoding_type"; - option (google.api.method_signature) = "document,features"; - } -} - -// Represents the input to API methods. -message Document { - // The document types enum. - enum Type { - // The content type is not specified. - TYPE_UNSPECIFIED = 0; - - // Plain text - PLAIN_TEXT = 1; - - // HTML - HTML = 2; - } - - // Required. If the type is not set or is `TYPE_UNSPECIFIED`, - // returns an `INVALID_ARGUMENT` error. - Type type = 1; - - // The source of the document: a string containing the content or a - // Google Cloud Storage URI. - oneof source { - // The content of the input in string format. - // Cloud audit logging exempt since it is based on user data. - string content = 2; - - // The Google Cloud Storage URI where the file content is located. - // This URI must be of the form: gs://bucket_name/object_name. For more - // details, see https://cloud.google.com/storage/docs/reference-uris. - // NOTE: Cloud Storage object versioning is not supported. - string gcs_content_uri = 3; - } - - // Optional. The language of the document (if not specified, the language is - // automatically detected). Both ISO and BCP-47 language codes are - // accepted.
- // [Language - // Support](https://cloud.google.com/natural-language/docs/languages) lists - // currently supported languages for each API method. If the language (either - // specified by the caller or automatically detected) is not supported by the - // called API method, an `INVALID_ARGUMENT` error is returned. - string language_code = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents a sentence in the input document. -message Sentence { - // The sentence text. - TextSpan text = 1; - - // For calls to [AnalyzeSentiment][] or if - // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_document_sentiment] - // is set to true, this field will contain the sentiment for the sentence. - Sentiment sentiment = 2; -} - -// Represents the text encoding that the caller uses to process the output. -// Providing an `EncodingType` is recommended because the API provides the -// beginning offsets for various outputs, such as tokens and mentions, and -// languages that natively use different text encodings may access offsets -// differently. -enum EncodingType { - // If `EncodingType` is not specified, encoding-dependent information (such as - // `begin_offset`) will be set at `-1`. - NONE = 0; - - // Encoding-dependent information (such as `begin_offset`) is calculated based - // on the UTF-8 encoding of the input. C++ and Go are examples of languages - // that use this encoding natively. - UTF8 = 1; - - // Encoding-dependent information (such as `begin_offset`) is calculated based - // on the UTF-16 encoding of the input. Java and JavaScript are examples of - // languages that use this encoding natively. - UTF16 = 2; - - // Encoding-dependent information (such as `begin_offset`) is calculated based - // on the UTF-32 encoding of the input. Python is an example of a language - // that uses this encoding natively. - UTF32 = 3; -} - -// Represents a phrase in the text that is a known entity, such as -// a person, an organization, or location. The API associates information, such -// as probability and mentions, with entities. -message Entity { - // The type of the entity. For most entity types, the associated metadata is a - // Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table - // below lists the associated fields for entities that have different - // metadata. - enum Type { - // Unknown - UNKNOWN = 0; - - // Person - PERSON = 1; - - // Location - LOCATION = 2; - - // Organization - ORGANIZATION = 3; - - // Event - EVENT = 4; - - // Artwork - WORK_OF_ART = 5; - - // Consumer product - CONSUMER_GOOD = 6; - - // Other types of entities - OTHER = 7; - - // Phone number - // - // The metadata lists the phone number, formatted according to local - // convention, plus whichever additional elements appear in the text: - // - // * `number` - the actual number, broken down into sections as per local - // convention - // * `national_prefix` - country code, if detected - // * `area_code` - region or area code, if detected - // * `extension` - phone extension (to be dialed after connection), if - // detected - PHONE_NUMBER = 9; - - // Address - // - // The metadata identifies the street number and locality plus whichever - // additional elements appear in the text: - // - // * `street_number` - street number - // * `locality` - city or town - // * `street_name` - street/route name, if detected - // * `postal_code` - postal code, if detected - // * `country` - country, if detected< - // * `broad_region` - administrative area, such as the state, if detected - // * `narrow_region` - smaller administrative area, such as county, if - // detected - // * `sublocality` - used in Asian addresses to demark a district within a - // city, if detected - ADDRESS = 10; - - // Date - // - // The metadata identifies the components of the date: - // - // * `year` - four digit year, if detected - // * `month` - two digit month number, if detected - // * `day` - two digit day number, if detected - DATE = 11; - - // Number - // - // The metadata is the number itself. - NUMBER = 12; - - // Price - // - // The metadata identifies the `value` and `currency`. - PRICE = 13; - } - - // The representative name for the entity. - string name = 1; - - // The entity type. - Type type = 2; - - // Metadata associated with the entity. - // - // For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) - // and Knowledge Graph MID (`mid`), if they are available. For the metadata - // associated with other entity types, see the Type table below. - map metadata = 3; - - // The mentions of this entity in the input document. The API currently - // supports proper noun mentions. - repeated EntityMention mentions = 5; - - // For calls to [AnalyzeEntitySentiment][] or if - // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_entity_sentiment] - // is set to true, this field will contain the aggregate sentiment expressed - // for this entity in the provided document. - Sentiment sentiment = 6; -} - -// Represents the feeling associated with the entire text or entities in -// the text. -message Sentiment { - // A non-negative number in the [0, +inf) range, which represents - // the absolute magnitude of sentiment regardless of score (positive or - // negative). - float magnitude = 1; - - // Sentiment score between -1.0 (negative sentiment) and 1.0 - // (positive sentiment). - float score = 2; -} - -// Represents a mention for an entity in the text. Currently, proper noun -// mentions are supported. -message EntityMention { - // The supported types of mentions. - enum Type { - // Unknown - TYPE_UNKNOWN = 0; - - // Proper name - PROPER = 1; - - // Common noun (or noun compound) - COMMON = 2; - } - - // The mention text. - TextSpan text = 1; - - // The type of the entity mention. - Type type = 2; - - // For calls to [AnalyzeEntitySentiment][] or if - // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_entity_sentiment] - // is set to true, this field will contain the sentiment expressed for this - // mention of the entity in the provided document. - Sentiment sentiment = 3; - - // Probability score associated with the entity. - // - // The score shows the probability of the entity mention being the entity - // type. The score is in (0, 1] range. - float probability = 4; -} - -// Represents a text span in the input document. -message TextSpan { - // The content of the text span, which is a substring of the document. - string content = 1; - - // The API calculates the beginning offset of the content in the original - // document according to the - // [EncodingType][google.cloud.language.v2.EncodingType] specified in the API - // request. - int32 begin_offset = 2; -} - -// Represents a category returned from the text classifier. -message ClassificationCategory { - // The name of the category representing the document. - string name = 1; - - // The classifier's confidence of the category. Number represents how certain - // the classifier is that this category represents the given text. - float confidence = 2; -} - -// The sentiment analysis request message. -message AnalyzeSentimentRequest { - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; - - // The encoding type used by the API to calculate sentence offsets. - EncodingType encoding_type = 2; -} - -// The sentiment analysis response message. -message AnalyzeSentimentResponse { - // The overall sentiment of the input document. - Sentiment document_sentiment = 1; - - // The language of the text, which will be the same as the language specified - // in the request or, if not specified, the automatically-detected language. - // See [Document.language][] field for more details. - string language_code = 2; - - // The sentiment for all the sentences in the document. - repeated Sentence sentences = 3; - - // Whether the language is officially supported. The API may still return a - // response when the language is not supported, but it is on a best effort - // basis. - bool language_supported = 4; -} - -// The entity analysis request message. -message AnalyzeEntitiesRequest { - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; - - // The encoding type used by the API to calculate offsets. - EncodingType encoding_type = 2; -} - -// The entity analysis response message. -message AnalyzeEntitiesResponse { - // The recognized entities in the input document. - repeated Entity entities = 1; - - // The language of the text, which will be the same as the language specified - // in the request or, if not specified, the automatically-detected language. - // See [Document.language][] field for more details. - string language_code = 2; - - // Whether the language is officially supported. The API may still return a - // response when the language is not supported, but it is on a best effort - // basis. - bool language_supported = 3; -} - -// The document classification request message. -message ClassifyTextRequest { - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The document classification response message. -message ClassifyTextResponse { - // Categories representing the input document. - repeated ClassificationCategory categories = 1; - - // The language of the text, which will be the same as the language specified - // in the request or, if not specified, the automatically-detected language. - // See [Document.language][] field for more details. - string language_code = 2; - - // Whether the language is officially supported. The API may still return a - // response when the language is not supported, but it is on a best effort - // basis. - bool language_supported = 3; -} - -// The document moderation request message. -message ModerateTextRequest { - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The document moderation response message. -message ModerateTextResponse { - // Harmful and sensitive categories representing the input document. - repeated ClassificationCategory moderation_categories = 1; - - // The language of the text, which will be the same as the language specified - // in the request or, if not specified, the automatically-detected language. - // See [Document.language][] field for more details. - string language_code = 2; - - // Whether the language is officially supported. The API may still return a - // response when the language is not supported, but it is on a best effort - // basis. - bool language_supported = 3; -} - -// The request message for the text annotation API, which can perform multiple -// analysis types in one call. -message AnnotateTextRequest { - // All available features. - // Setting each one to true will enable that specific analysis for the input. - message Features { - // Optional. Extract entities. - bool extract_entities = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Extract document-level sentiment. - bool extract_document_sentiment = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Classify the full document into categories. - bool classify_text = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Moderate the document for harmful and sensitive categories. - bool moderate_text = 5 [(google.api.field_behavior) = OPTIONAL]; - } - - // Required. Input document. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The enabled features. - Features features = 2 [(google.api.field_behavior) = REQUIRED]; - - // The encoding type used by the API to calculate offsets. - EncodingType encoding_type = 3; -} - -// The text annotations response message. -message AnnotateTextResponse { - // Sentences in the input document. Populated if the user enables - // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_document_sentiment]. - repeated Sentence sentences = 1; - - // Entities, along with their semantic information, in the input document. - // Populated if the user enables - // [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v2.AnnotateTextRequest.Features.extract_entities] - // or - // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_entity_sentiment]. - repeated Entity entities = 2; - - // The overall sentiment for the document. Populated if the user enables - // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_document_sentiment]. - Sentiment document_sentiment = 3; - - // The language of the text, which will be the same as the language specified - // in the request or, if not specified, the automatically-detected language. - // See [Document.language][] field for more details. - string language_code = 4; - - // Categories identified in the input document. - repeated ClassificationCategory categories = 5; - - // Harmful and sensitive categories identified in the input document. - repeated ClassificationCategory moderation_categories = 6; - - // Whether the language is officially supported by all requested features. - // The API may still return a response when the language is not supported, but - // it is on a best effort basis. - bool language_supported = 7; -} diff --git a/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.analyze_entities.js b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.analyze_entities.js deleted file mode 100644 index 7cdeb63e0ee..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.analyze_entities.js +++ /dev/null @@ -1,65 +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(document) { - // [START language_v2_generated_LanguageService_AnalyzeEntities_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. Input document. - */ - // const document = {} - /** - * The encoding type used by the API to calculate offsets. - */ - // const encodingType = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v2; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callAnalyzeEntities() { - // Construct request - const request = { - document, - }; - - // Run request - const response = await languageClient.analyzeEntities(request); - console.log(response); - } - - callAnalyzeEntities(); - // [END language_v2_generated_LanguageService_AnalyzeEntities_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-language/v2/samples/generated/v2/language_service.analyze_sentiment.js b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.analyze_sentiment.js deleted file mode 100644 index 97bc408febe..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.analyze_sentiment.js +++ /dev/null @@ -1,65 +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(document) { - // [START language_v2_generated_LanguageService_AnalyzeSentiment_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. Input document. - */ - // const document = {} - /** - * The encoding type used by the API to calculate sentence offsets. - */ - // const encodingType = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v2; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callAnalyzeSentiment() { - // Construct request - const request = { - document, - }; - - // Run request - const response = await languageClient.analyzeSentiment(request); - console.log(response); - } - - callAnalyzeSentiment(); - // [END language_v2_generated_LanguageService_AnalyzeSentiment_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-language/v2/samples/generated/v2/language_service.annotate_text.js b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.annotate_text.js deleted file mode 100644 index 5f920ce2afb..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.annotate_text.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(document, features) { - // [START language_v2_generated_LanguageService_AnnotateText_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. Input document. - */ - // const document = {} - /** - * Required. The enabled features. - */ - // const features = {} - /** - * The encoding type used by the API to calculate offsets. - */ - // const encodingType = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v2; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callAnnotateText() { - // Construct request - const request = { - document, - features, - }; - - // Run request - const response = await languageClient.annotateText(request); - console.log(response); - } - - callAnnotateText(); - // [END language_v2_generated_LanguageService_AnnotateText_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-language/v2/samples/generated/v2/language_service.classify_text.js b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.classify_text.js deleted file mode 100644 index 844d9edd8c2..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.classify_text.js +++ /dev/null @@ -1,61 +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(document) { - // [START language_v2_generated_LanguageService_ClassifyText_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. Input document. - */ - // const document = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v2; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callClassifyText() { - // Construct request - const request = { - document, - }; - - // Run request - const response = await languageClient.classifyText(request); - console.log(response); - } - - callClassifyText(); - // [END language_v2_generated_LanguageService_ClassifyText_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-language/v2/samples/generated/v2/language_service.moderate_text.js b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.moderate_text.js deleted file mode 100644 index 159e0228c25..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/language_service.moderate_text.js +++ /dev/null @@ -1,61 +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(document) { - // [START language_v2_generated_LanguageService_ModerateText_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. Input document. - */ - // const document = {} - - // Imports the Language library - const {LanguageServiceClient} = require('@google-cloud/language').v2; - - // Instantiates a client - const languageClient = new LanguageServiceClient(); - - async function callModerateText() { - // Construct request - const request = { - document, - }; - - // Run request - const response = await languageClient.moderateText(request); - console.log(response); - } - - callModerateText(); - // [END language_v2_generated_LanguageService_ModerateText_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-language/v2/samples/generated/v2/snippet_metadata_google.cloud.language.v2.json b/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/snippet_metadata_google.cloud.language.v2.json deleted file mode 100644 index 2472641268a..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/samples/generated/v2/snippet_metadata_google.cloud.language.v2.json +++ /dev/null @@ -1,231 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-language", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.language.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "language_v2_generated_LanguageService_AnalyzeSentiment_async", - "title": "LanguageService analyzeSentiment Sample", - "origin": "API_DEFINITION", - "description": " Analyzes the sentiment of the provided text.", - "canonical": true, - "file": "language_service.analyze_sentiment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AnalyzeSentiment", - "fullName": "google.cloud.language.v2.LanguageService.AnalyzeSentiment", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v2.Document" - }, - { - "name": "encoding_type", - "type": ".google.cloud.language.v2.EncodingType" - } - ], - "resultType": ".google.cloud.language.v2.AnalyzeSentimentResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v2.LanguageServiceClient" - }, - "method": { - "shortName": "AnalyzeSentiment", - "fullName": "google.cloud.language.v2.LanguageService.AnalyzeSentiment", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v2.LanguageService" - } - } - } - }, - { - "regionTag": "language_v2_generated_LanguageService_AnalyzeEntities_async", - "title": "LanguageService analyzeEntities Sample", - "origin": "API_DEFINITION", - "description": " Finds named entities (currently proper names and common nouns) in the text along with entity types, probability, mentions for each entity, and other properties.", - "canonical": true, - "file": "language_service.analyze_entities.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AnalyzeEntities", - "fullName": "google.cloud.language.v2.LanguageService.AnalyzeEntities", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v2.Document" - }, - { - "name": "encoding_type", - "type": ".google.cloud.language.v2.EncodingType" - } - ], - "resultType": ".google.cloud.language.v2.AnalyzeEntitiesResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v2.LanguageServiceClient" - }, - "method": { - "shortName": "AnalyzeEntities", - "fullName": "google.cloud.language.v2.LanguageService.AnalyzeEntities", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v2.LanguageService" - } - } - } - }, - { - "regionTag": "language_v2_generated_LanguageService_ClassifyText_async", - "title": "LanguageService classifyText Sample", - "origin": "API_DEFINITION", - "description": " Classifies a document into categories.", - "canonical": true, - "file": "language_service.classify_text.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ClassifyText", - "fullName": "google.cloud.language.v2.LanguageService.ClassifyText", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v2.Document" - } - ], - "resultType": ".google.cloud.language.v2.ClassifyTextResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v2.LanguageServiceClient" - }, - "method": { - "shortName": "ClassifyText", - "fullName": "google.cloud.language.v2.LanguageService.ClassifyText", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v2.LanguageService" - } - } - } - }, - { - "regionTag": "language_v2_generated_LanguageService_ModerateText_async", - "title": "LanguageService moderateText Sample", - "origin": "API_DEFINITION", - "description": " Moderates a document for harmful and sensitive categories.", - "canonical": true, - "file": "language_service.moderate_text.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ModerateText", - "fullName": "google.cloud.language.v2.LanguageService.ModerateText", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v2.Document" - } - ], - "resultType": ".google.cloud.language.v2.ModerateTextResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v2.LanguageServiceClient" - }, - "method": { - "shortName": "ModerateText", - "fullName": "google.cloud.language.v2.LanguageService.ModerateText", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v2.LanguageService" - } - } - } - }, - { - "regionTag": "language_v2_generated_LanguageService_AnnotateText_async", - "title": "LanguageService annotateText Sample", - "origin": "API_DEFINITION", - "description": " A convenience method that provides all features in one call.", - "canonical": true, - "file": "language_service.annotate_text.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AnnotateText", - "fullName": "google.cloud.language.v2.LanguageService.AnnotateText", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.language.v2.Document" - }, - { - "name": "features", - "type": ".google.cloud.language.v2.AnnotateTextRequest.Features" - }, - { - "name": "encoding_type", - "type": ".google.cloud.language.v2.EncodingType" - } - ], - "resultType": ".google.cloud.language.v2.AnnotateTextResponse", - "client": { - "shortName": "LanguageServiceClient", - "fullName": "google.cloud.language.v2.LanguageServiceClient" - }, - "method": { - "shortName": "AnnotateText", - "fullName": "google.cloud.language.v2.LanguageService.AnnotateText", - "service": { - "shortName": "LanguageService", - "fullName": "google.cloud.language.v2.LanguageService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-language/v2/src/index.ts b/owl-bot-staging/google-cloud-language/v2/src/index.ts deleted file mode 100644 index 29aa24ffe34..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/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 v2 from './v2'; -const LanguageServiceClient = v2.LanguageServiceClient; -type LanguageServiceClient = v2.LanguageServiceClient; -export {v2, LanguageServiceClient}; -export default {v2, LanguageServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-language/v2/src/v2/gapic_metadata.json b/owl-bot-staging/google-cloud-language/v2/src/v2/gapic_metadata.json deleted file mode 100644 index 44c7d62017a..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/src/v2/gapic_metadata.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.language.v2", - "libraryPackage": "@google-cloud/language", - "services": { - "LanguageService": { - "clients": { - "grpc": { - "libraryClient": "LanguageServiceClient", - "rpcs": { - "AnalyzeSentiment": { - "methods": [ - "analyzeSentiment" - ] - }, - "AnalyzeEntities": { - "methods": [ - "analyzeEntities" - ] - }, - "ClassifyText": { - "methods": [ - "classifyText" - ] - }, - "ModerateText": { - "methods": [ - "moderateText" - ] - }, - "AnnotateText": { - "methods": [ - "annotateText" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "LanguageServiceClient", - "rpcs": { - "AnalyzeSentiment": { - "methods": [ - "analyzeSentiment" - ] - }, - "AnalyzeEntities": { - "methods": [ - "analyzeEntities" - ] - }, - "ClassifyText": { - "methods": [ - "classifyText" - ] - }, - "ModerateText": { - "methods": [ - "moderateText" - ] - }, - "AnnotateText": { - "methods": [ - "annotateText" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-language/v2/src/v2/index.ts b/owl-bot-staging/google-cloud-language/v2/src/v2/index.ts deleted file mode 100644 index 3275c17250d..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/src/v2/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 {LanguageServiceClient} from './language_service_client'; diff --git a/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_client.ts b/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_client.ts deleted file mode 100644 index ed5758c63b8..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_client.ts +++ /dev/null @@ -1,643 +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/v2/language_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './language_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Provides text analysis operations such as sentiment analysis and entity - * recognition. - * @class - * @memberof v2 - */ -export class LanguageServiceClient { - 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}; - languageServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of LanguageServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 LanguageServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof LanguageServiceClient; - 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 { - 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.language.v2.LanguageService', 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.languageServiceStub) { - return this.languageServiceStub; - } - - // Put together the "service stub" for - // google.cloud.language.v2.LanguageService. - this.languageServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.language.v2.LanguageService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.language.v2.LanguageService, - 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 languageServiceStubMethods = - ['analyzeSentiment', 'analyzeEntities', 'classifyText', 'moderateText', 'annotateText']; - for (const methodName of languageServiceStubMethods) { - const callPromise = this.languageServiceStub.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.languageServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'language.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 'language.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-language', - '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 -- - // ------------------- -/** - * Analyzes the sentiment of the provided text. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v2.Document} request.document - * Required. Input document. - * @param {google.cloud.language.v2.EncodingType} request.encodingType - * The encoding type used by the API to calculate sentence offsets. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v2.AnalyzeSentimentResponse|AnalyzeSentimentResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/language_service.analyze_sentiment.js - * region_tag:language_v2_generated_LanguageService_AnalyzeSentiment_async - */ - analyzeSentiment( - request?: protos.google.cloud.language.v2.IAnalyzeSentimentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v2.IAnalyzeSentimentResponse, - protos.google.cloud.language.v2.IAnalyzeSentimentRequest|undefined, {}|undefined - ]>; - analyzeSentiment( - request: protos.google.cloud.language.v2.IAnalyzeSentimentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v2.IAnalyzeSentimentResponse, - protos.google.cloud.language.v2.IAnalyzeSentimentRequest|null|undefined, - {}|null|undefined>): void; - analyzeSentiment( - request: protos.google.cloud.language.v2.IAnalyzeSentimentRequest, - callback: Callback< - protos.google.cloud.language.v2.IAnalyzeSentimentResponse, - protos.google.cloud.language.v2.IAnalyzeSentimentRequest|null|undefined, - {}|null|undefined>): void; - analyzeSentiment( - request?: protos.google.cloud.language.v2.IAnalyzeSentimentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v2.IAnalyzeSentimentResponse, - protos.google.cloud.language.v2.IAnalyzeSentimentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v2.IAnalyzeSentimentResponse, - protos.google.cloud.language.v2.IAnalyzeSentimentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v2.IAnalyzeSentimentResponse, - protos.google.cloud.language.v2.IAnalyzeSentimentRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.analyzeSentiment(request, options, callback); - } -/** - * Finds named entities (currently proper names and common nouns) in the text - * along with entity types, probability, mentions for each entity, and - * other properties. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v2.Document} request.document - * Required. Input document. - * @param {google.cloud.language.v2.EncodingType} request.encodingType - * The encoding type used by the API to calculate offsets. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v2.AnalyzeEntitiesResponse|AnalyzeEntitiesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/language_service.analyze_entities.js - * region_tag:language_v2_generated_LanguageService_AnalyzeEntities_async - */ - analyzeEntities( - request?: protos.google.cloud.language.v2.IAnalyzeEntitiesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v2.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v2.IAnalyzeEntitiesRequest|undefined, {}|undefined - ]>; - analyzeEntities( - request: protos.google.cloud.language.v2.IAnalyzeEntitiesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v2.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v2.IAnalyzeEntitiesRequest|null|undefined, - {}|null|undefined>): void; - analyzeEntities( - request: protos.google.cloud.language.v2.IAnalyzeEntitiesRequest, - callback: Callback< - protos.google.cloud.language.v2.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v2.IAnalyzeEntitiesRequest|null|undefined, - {}|null|undefined>): void; - analyzeEntities( - request?: protos.google.cloud.language.v2.IAnalyzeEntitiesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v2.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v2.IAnalyzeEntitiesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v2.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v2.IAnalyzeEntitiesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v2.IAnalyzeEntitiesResponse, - protos.google.cloud.language.v2.IAnalyzeEntitiesRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.analyzeEntities(request, options, callback); - } -/** - * Classifies a document into categories. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v2.Document} request.document - * Required. Input document. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v2.ClassifyTextResponse|ClassifyTextResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/language_service.classify_text.js - * region_tag:language_v2_generated_LanguageService_ClassifyText_async - */ - classifyText( - request?: protos.google.cloud.language.v2.IClassifyTextRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v2.IClassifyTextResponse, - protos.google.cloud.language.v2.IClassifyTextRequest|undefined, {}|undefined - ]>; - classifyText( - request: protos.google.cloud.language.v2.IClassifyTextRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v2.IClassifyTextResponse, - protos.google.cloud.language.v2.IClassifyTextRequest|null|undefined, - {}|null|undefined>): void; - classifyText( - request: protos.google.cloud.language.v2.IClassifyTextRequest, - callback: Callback< - protos.google.cloud.language.v2.IClassifyTextResponse, - protos.google.cloud.language.v2.IClassifyTextRequest|null|undefined, - {}|null|undefined>): void; - classifyText( - request?: protos.google.cloud.language.v2.IClassifyTextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v2.IClassifyTextResponse, - protos.google.cloud.language.v2.IClassifyTextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v2.IClassifyTextResponse, - protos.google.cloud.language.v2.IClassifyTextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v2.IClassifyTextResponse, - protos.google.cloud.language.v2.IClassifyTextRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.classifyText(request, options, callback); - } -/** - * Moderates a document for harmful and sensitive categories. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v2.Document} request.document - * Required. Input document. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v2.ModerateTextResponse|ModerateTextResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/language_service.moderate_text.js - * region_tag:language_v2_generated_LanguageService_ModerateText_async - */ - moderateText( - request?: protos.google.cloud.language.v2.IModerateTextRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v2.IModerateTextResponse, - protos.google.cloud.language.v2.IModerateTextRequest|undefined, {}|undefined - ]>; - moderateText( - request: protos.google.cloud.language.v2.IModerateTextRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v2.IModerateTextResponse, - protos.google.cloud.language.v2.IModerateTextRequest|null|undefined, - {}|null|undefined>): void; - moderateText( - request: protos.google.cloud.language.v2.IModerateTextRequest, - callback: Callback< - protos.google.cloud.language.v2.IModerateTextResponse, - protos.google.cloud.language.v2.IModerateTextRequest|null|undefined, - {}|null|undefined>): void; - moderateText( - request?: protos.google.cloud.language.v2.IModerateTextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v2.IModerateTextResponse, - protos.google.cloud.language.v2.IModerateTextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v2.IModerateTextResponse, - protos.google.cloud.language.v2.IModerateTextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v2.IModerateTextResponse, - protos.google.cloud.language.v2.IModerateTextRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.moderateText(request, options, callback); - } -/** - * A convenience method that provides all features in one call. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.language.v2.Document} request.document - * Required. Input document. - * @param {google.cloud.language.v2.AnnotateTextRequest.Features} request.features - * Required. The enabled features. - * @param {google.cloud.language.v2.EncodingType} request.encodingType - * The encoding type used by the API to calculate offsets. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.language.v2.AnnotateTextResponse|AnnotateTextResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/language_service.annotate_text.js - * region_tag:language_v2_generated_LanguageService_AnnotateText_async - */ - annotateText( - request?: protos.google.cloud.language.v2.IAnnotateTextRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.language.v2.IAnnotateTextResponse, - protos.google.cloud.language.v2.IAnnotateTextRequest|undefined, {}|undefined - ]>; - annotateText( - request: protos.google.cloud.language.v2.IAnnotateTextRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.language.v2.IAnnotateTextResponse, - protos.google.cloud.language.v2.IAnnotateTextRequest|null|undefined, - {}|null|undefined>): void; - annotateText( - request: protos.google.cloud.language.v2.IAnnotateTextRequest, - callback: Callback< - protos.google.cloud.language.v2.IAnnotateTextResponse, - protos.google.cloud.language.v2.IAnnotateTextRequest|null|undefined, - {}|null|undefined>): void; - annotateText( - request?: protos.google.cloud.language.v2.IAnnotateTextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.language.v2.IAnnotateTextResponse, - protos.google.cloud.language.v2.IAnnotateTextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.language.v2.IAnnotateTextResponse, - protos.google.cloud.language.v2.IAnnotateTextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.language.v2.IAnnotateTextResponse, - protos.google.cloud.language.v2.IAnnotateTextRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.annotateText(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.languageServiceStub && !this._terminated) { - return this.languageServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_client_config.json b/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_client_config.json deleted file mode 100644 index fbe98e549af..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_client_config.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "interfaces": { - "google.cloud.language.v2.LanguageService": { - "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": { - "AnalyzeSentiment": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "AnalyzeEntities": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ClassifyText": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ModerateText": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "AnnotateText": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_proto_list.json b/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_proto_list.json deleted file mode 100644 index a463a4e6f9c..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/src/v2/language_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/language/v2/language_service.proto" -] diff --git a/owl-bot-staging/google-cloud-language/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-language/v2/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 46600ec0cdc..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/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 language = require('@google-cloud/language'); - -function main() { - const languageServiceClient = new language.LanguageServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-language/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-language/v2/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index e2767ca4173..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/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 {LanguageServiceClient} from '@google-cloud/language'; - -// check that the client class type name can be used -function doStuffWithLanguageServiceClient(client: LanguageServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const languageServiceClient = new LanguageServiceClient(); - doStuffWithLanguageServiceClient(languageServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-language/v2/system-test/install.ts b/owl-bot-staging/google-cloud-language/v2/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/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-language/v2/test/gapic_language_service_v2.ts b/owl-bot-staging/google-cloud-language/v2/test/gapic_language_service_v2.ts deleted file mode 100644 index 9c0281ce08e..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/test/gapic_language_service_v2.ts +++ /dev/null @@ -1,525 +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 languageserviceModule 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('v2.LanguageServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = languageserviceModule.v2.LanguageServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = languageserviceModule.v2.LanguageServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = languageserviceModule.v2.LanguageServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new languageserviceModule.v2.LanguageServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.languageServiceStub, undefined); - await client.initialize(); - assert(client.languageServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.languageServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.languageServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new languageserviceModule.v2.LanguageServiceClient({ - 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 languageserviceModule.v2.LanguageServiceClient({ - 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('analyzeSentiment', () => { - it('invokes analyzeSentiment without error', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.AnalyzeSentimentRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v2.AnalyzeSentimentResponse() - ); - client.innerApiCalls.analyzeSentiment = stubSimpleCall(expectedResponse); - const [response] = await client.analyzeSentiment(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeSentiment without error using callback', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.AnalyzeSentimentRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v2.AnalyzeSentimentResponse() - ); - client.innerApiCalls.analyzeSentiment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.analyzeSentiment( - request, - (err?: Error|null, result?: protos.google.cloud.language.v2.IAnalyzeSentimentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeSentiment with error', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.AnalyzeSentimentRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeSentiment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.analyzeSentiment(request), expectedError); - }); - - it('invokes analyzeSentiment with closed client', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.AnalyzeSentimentRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.analyzeSentiment(request), expectedError); - }); - }); - - describe('analyzeEntities', () => { - it('invokes analyzeEntities without error', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.AnalyzeEntitiesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v2.AnalyzeEntitiesResponse() - ); - client.innerApiCalls.analyzeEntities = stubSimpleCall(expectedResponse); - const [response] = await client.analyzeEntities(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeEntities without error using callback', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.AnalyzeEntitiesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v2.AnalyzeEntitiesResponse() - ); - client.innerApiCalls.analyzeEntities = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.analyzeEntities( - request, - (err?: Error|null, result?: protos.google.cloud.language.v2.IAnalyzeEntitiesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes analyzeEntities with error', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.AnalyzeEntitiesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeEntities = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.analyzeEntities(request), expectedError); - }); - - it('invokes analyzeEntities with closed client', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.AnalyzeEntitiesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.analyzeEntities(request), expectedError); - }); - }); - - describe('classifyText', () => { - it('invokes classifyText without error', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.ClassifyTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v2.ClassifyTextResponse() - ); - client.innerApiCalls.classifyText = stubSimpleCall(expectedResponse); - const [response] = await client.classifyText(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes classifyText without error using callback', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.ClassifyTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v2.ClassifyTextResponse() - ); - client.innerApiCalls.classifyText = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.classifyText( - request, - (err?: Error|null, result?: protos.google.cloud.language.v2.IClassifyTextResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes classifyText with error', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.ClassifyTextRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.classifyText = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.classifyText(request), expectedError); - }); - - it('invokes classifyText with closed client', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.ClassifyTextRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.classifyText(request), expectedError); - }); - }); - - describe('moderateText', () => { - it('invokes moderateText without error', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.ModerateTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v2.ModerateTextResponse() - ); - client.innerApiCalls.moderateText = stubSimpleCall(expectedResponse); - const [response] = await client.moderateText(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes moderateText without error using callback', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.ModerateTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v2.ModerateTextResponse() - ); - client.innerApiCalls.moderateText = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.moderateText( - request, - (err?: Error|null, result?: protos.google.cloud.language.v2.IModerateTextResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes moderateText with error', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.ModerateTextRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.moderateText = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.moderateText(request), expectedError); - }); - - it('invokes moderateText with closed client', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.ModerateTextRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.moderateText(request), expectedError); - }); - }); - - describe('annotateText', () => { - it('invokes annotateText without error', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.AnnotateTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v2.AnnotateTextResponse() - ); - client.innerApiCalls.annotateText = stubSimpleCall(expectedResponse); - const [response] = await client.annotateText(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes annotateText without error using callback', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.AnnotateTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.language.v2.AnnotateTextResponse() - ); - client.innerApiCalls.annotateText = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.annotateText( - request, - (err?: Error|null, result?: protos.google.cloud.language.v2.IAnnotateTextResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes annotateText with error', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.AnnotateTextRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.annotateText = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.annotateText(request), expectedError); - }); - - it('invokes annotateText with closed client', async () => { - const client = new languageserviceModule.v2.LanguageServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.language.v2.AnnotateTextRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.annotateText(request), expectedError); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-language/v2/tsconfig.json b/owl-bot-staging/google-cloud-language/v2/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/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-language/v2/webpack.config.js b/owl-bot-staging/google-cloud-language/v2/webpack.config.js deleted file mode 100644 index c90df1063ed..00000000000 --- a/owl-bot-staging/google-cloud-language/v2/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: 'LanguageService', - filename: './language-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-lifesciences/v2beta/.eslintignore b/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/.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-lifesciences/v2beta/.eslintrc.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/.gitignore b/owl-bot-staging/google-cloud-lifesciences/v2beta/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/.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-lifesciences/v2beta/.jsdoc.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/.jsdoc.js deleted file mode 100644 index 4d130c236fc..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/.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/life-sciences', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/.mocharc.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/.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-lifesciences/v2beta/.prettierrc.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/.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-lifesciences/v2beta/README.md b/owl-bot-staging/google-cloud-lifesciences/v2beta/README.md deleted file mode 100644 index d2c6675dd1e..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/README.md +++ /dev/null @@ -1 +0,0 @@ -Lifesciences: Nodejs Client diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/package.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/package.json deleted file mode 100644 index 8c1173acd7d..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/life-sciences", - "version": "0.1.0", - "description": "Lifesciences client for Node.js", - "repository": "googleapis/nodejs-lifesciences", - "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 lifesciences", - "lifesciences", - "workflows service v2 beta" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/protos/google/cloud/lifesciences/v2beta/workflows.proto b/owl-bot-staging/google-cloud-lifesciences/v2beta/protos/google/cloud/lifesciences/v2beta/workflows.proto deleted file mode 100644 index 162ca8fbeaf..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/protos/google/cloud/lifesciences/v2beta/workflows.proto +++ /dev/null @@ -1,783 +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 -// -// 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.lifesciences.v2beta; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/code.proto"; - -option csharp_namespace = "Google.Cloud.LifeSciences.V2Beta"; -option go_package = "cloud.google.com/go/lifesciences/apiv2beta/lifesciencespb;lifesciencespb"; -option java_multiple_files = true; -option java_outer_classname = "WorkflowsProto"; -option java_package = "com.google.cloud.lifesciences.v2beta"; -option objc_class_prefix = "CLSW"; -option php_namespace = "Google\\Cloud\\LifeSciences\\V2beta"; -option ruby_package = "Google::Cloud::LifeSciences::V2beta"; - -// A service for running workflows, such as pipelines consisting of Docker -// containers. -service WorkflowsServiceV2Beta { - option (google.api.default_host) = "lifesciences.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Runs a pipeline. The returned Operation's [metadata] - // [google.longrunning.Operation.metadata] field will contain a - // [google.cloud.lifesciences.v2beta.Metadata][google.cloud.lifesciences.v2beta.Metadata] - // object describing the status of the pipeline execution. The - // [response][google.longrunning.Operation.response] field will contain a - // [google.cloud.lifesciences.v2beta.RunPipelineResponse][google.cloud.lifesciences.v2beta.RunPipelineResponse] - // object if the pipeline completes successfully. - // - // **Note:** Before you can use this method, the *Life Sciences Service Agent* - // must have access to your project. This is done automatically when the - // Cloud Life Sciences API is first enabled, but if you delete this permission - // you must disable and re-enable the API to grant the Life Sciences - // Service Agent the required permissions. - // Authorization requires the following [Google - // IAM](https://cloud.google.com/iam/) permission: - // - // * `lifesciences.workflows.run` - rpc RunPipeline(RunPipelineRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2beta/{parent=projects/*/locations/*}/pipelines:run" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "RunPipelineResponse" - metadata_type: "Metadata" - }; - } -} - -// The arguments to the `RunPipeline` method. The requesting user must have -// the `iam.serviceAccounts.actAs` permission for the Cloud Life Sciences -// service account or the request will fail. -message RunPipelineRequest { - // The project and location that this request should be executed against. - string parent = 4; - - // Required. The description of the pipeline to run. - Pipeline pipeline = 1 [(google.api.field_behavior) = REQUIRED]; - - // User-defined labels to associate with the returned operation. These - // labels are not propagated to any Google Cloud Platform resources used by - // the operation, and can be modified at any time. - // - // To associate labels with resources created while executing the operation, - // see the appropriate resource message (for example, `VirtualMachine`). - map labels = 2; - - // The name of an existing Pub/Sub topic. The server will publish - // messages to this topic whenever the status of the operation changes. - // The Life Sciences Service Agent account must have publisher permissions to - // the specified topic or notifications will not be sent. - string pub_sub_topic = 3; -} - -// The response to the RunPipeline method, returned in the operation's result -// field on success. -message RunPipelineResponse {} - -// Specifies a series of actions to execute, expressed as Docker containers. -message Pipeline { - // The list of actions to execute, in the order they are specified. - repeated Action actions = 1; - - // The resources required for execution. - Resources resources = 2; - - // The environment to pass into every action. Each action can also specify - // additional environment variables but cannot delete an entry from this map - // (though they can overwrite it with a different value). - map environment = 3; - - // The encrypted environment to pass into every action. Each action can also - // specify its own encrypted environment. - // - // The secret must decrypt to a JSON-encoded dictionary where key-value pairs - // serve as environment variable names and their values. The decoded - // environment variables can overwrite the values specified by the - // `environment` field. - Secret encrypted_environment = 5; - - // The maximum amount of time to give the pipeline to complete. This includes - // the time spent waiting for a worker to be allocated. If the pipeline fails - // to complete before the timeout, it will be cancelled and the error code - // will be set to DEADLINE_EXCEEDED. - // - // If unspecified, it will default to 7 days. - google.protobuf.Duration timeout = 4; -} - -// Specifies a single action that runs a Docker container. -message Action { - // An optional name for the container. The container hostname will be set to - // this name, making it useful for inter-container communication. The name - // must contain only upper and lowercase alphanumeric characters and hyphens - // and cannot start with a hyphen. - string container_name = 1; - - // Required. The URI to pull the container image from. Note that all images - // referenced by actions in the pipeline are pulled before the first action - // runs. If multiple actions reference the same image, it is only pulled once, - // ensuring that the same image is used for all actions in a single pipeline. - // - // The image URI can be either a complete host and image specification (e.g., - // quay.io/biocontainers/samtools), a library and image name (e.g., - // google/cloud-sdk) or a bare image name ('bash') to pull from the default - // library. No schema is required in any of these cases. - // - // If the specified image is not public, the service account specified for - // the Virtual Machine must have access to pull the images from GCR, or - // appropriate credentials must be specified in the - // [google.cloud.lifesciences.v2beta.Action.credentials][google.cloud.lifesciences.v2beta.Action.credentials] - // field. - string image_uri = 2 [(google.api.field_behavior) = REQUIRED]; - - // If specified, overrides the `CMD` specified in the container. If the - // container also has an `ENTRYPOINT` the values are used as entrypoint - // arguments. Otherwise, they are used as a command and arguments to run - // inside the container. - repeated string commands = 3; - - // If specified, overrides the `ENTRYPOINT` specified in the container. - string entrypoint = 4; - - // The environment to pass into the container. This environment is merged - // with values specified in the - // [google.cloud.lifesciences.v2beta.Pipeline][google.cloud.lifesciences.v2beta.Pipeline] - // message, overwriting any duplicate values. - // - // In addition to the values passed here, a few other values are - // automatically injected into the environment. These cannot be hidden or - // overwritten. - // - // `GOOGLE_PIPELINE_FAILED` will be set to "1" if the pipeline failed - // because an action has exited with a non-zero status (and did not have the - // `IGNORE_EXIT_STATUS` flag set). This can be used to determine if additional - // debug or logging actions should execute. - // - // `GOOGLE_LAST_EXIT_STATUS` will be set to the exit status of the last - // non-background action that executed. This can be used by workflow engine - // authors to determine whether an individual action has succeeded or failed. - map environment = 5; - - // The encrypted environment to pass into the container. This environment is - // merged with values specified in the - // [google.cloud.lifesciences.v2beta.Pipeline][google.cloud.lifesciences.v2beta.Pipeline] - // message, overwriting any duplicate values. - // - // The secret must decrypt to a JSON-encoded dictionary where key-value pairs - // serve as environment variable names and their values. The decoded - // environment variables can overwrite the values specified by the - // `environment` field. - Secret encrypted_environment = 21; - - // An optional identifier for a PID namespace to run the action inside. - // Multiple actions should use the same string to share a namespace. If - // unspecified, a separate isolated namespace is used. - string pid_namespace = 6; - - // A map of containers to host port mappings for this container. If the - // container already specifies exposed ports, use the - // `PUBLISH_EXPOSED_PORTS` flag instead. - // - // The host port number must be less than 65536. If it is zero, an unused - // random port is assigned. To determine the resulting port number, consult - // the `ContainerStartedEvent` in the operation metadata. - map port_mappings = 8; - - // A list of mounts to make available to the action. - // - // In addition to the values specified here, every action has a special - // virtual disk mounted under `/google` that contains log files and other - // operational components. - // - //
    - //
  • /google/logs All logs written during the pipeline - // execution.
  • - //
  • /google/logs/output The combined standard output and - // standard error of all actions run as part of the pipeline - // execution.
  • - //
  • /google/logs/action/*/stdout The complete contents of - // each individual action's standard output.
  • - //
  • /google/logs/action/*/stderr The complete contents of - // each individual action's standard error output.
  • - //
- repeated Mount mounts = 9; - - // Labels to associate with the action. This field is provided to assist - // workflow engine authors in identifying actions (for example, to indicate - // what sort of action they perform, such as localization or debugging). - // They are returned in the operation metadata, but are otherwise ignored. - map labels = 10; - - // If the specified image is hosted on a private registry other than Google - // Container Registry, the credentials required to pull the image must be - // specified here as an encrypted secret. - // - // The secret must decrypt to a JSON-encoded dictionary containing both - // `username` and `password` keys. - Secret credentials = 11; - - // The maximum amount of time to give the action to complete. If the action - // fails to complete before the timeout, it will be terminated and the exit - // status will be non-zero. The pipeline will continue or terminate based - // on the rules defined by the `ALWAYS_RUN` and `IGNORE_EXIT_STATUS` flags. - google.protobuf.Duration timeout = 12; - - // Normally, a non-zero exit status causes the pipeline to fail. This flag - // allows execution of other actions to continue instead. - bool ignore_exit_status = 13; - - // This flag allows an action to continue running in the background while - // executing subsequent actions. This is useful to provide services to - // other actions (or to provide debugging support tools like SSH servers). - bool run_in_background = 14; - - // By default, after an action fails, no further actions are run. This flag - // indicates that this action must be run even if the pipeline has already - // failed. This is useful for actions that copy output files off of the VM - // or for debugging. Note that no actions will be run if image prefetching - // fails. - bool always_run = 15; - - // Enable access to the FUSE device for this action. Filesystems can then - // be mounted into disks shared with other actions. The other actions do - // not need the `enable_fuse` flag to access the mounted filesystem. - // - // This has the effect of causing the container to be executed with - // `CAP_SYS_ADMIN` and exposes `/dev/fuse` to the container, so use it only - // for containers you trust. - bool enable_fuse = 16; - - // Exposes all ports specified by `EXPOSE` statements in the container. To - // discover the host side port numbers, consult the `ACTION_STARTED` event - // in the operation metadata. - bool publish_exposed_ports = 17; - - // All container images are typically downloaded before any actions are - // executed. This helps prevent typos in URIs or issues like lack of disk - // space from wasting large amounts of compute resources. - // - // If set, this flag prevents the worker from downloading the image until - // just before the action is executed. - bool disable_image_prefetch = 18; - - // A small portion of the container's standard error stream is typically - // captured and returned inside the `ContainerStoppedEvent`. Setting this - // flag disables this functionality. - bool disable_standard_error_capture = 19; - - // Prevents the container from accessing the external network. - bool block_external_network = 20; -} - -// Holds encrypted information that is only decrypted and stored in RAM -// by the worker VM when running the pipeline. -message Secret { - // The name of the Cloud KMS key that will be used to decrypt the secret - // value. The VM service account must have the required permissions and - // authentication scopes to invoke the `decrypt` method on the specified key. - string key_name = 1; - - // The value of the cipherText response from the `encrypt` method. This field - // is intentionally unaudited. - string cipher_text = 2; -} - -// Carries information about a particular disk mount inside a container. -message Mount { - // The name of the disk to mount, as specified in the resources section. - string disk = 1; - - // The path to mount the disk inside the container. - string path = 2; - - // If true, the disk is mounted read-only inside the container. - bool read_only = 3; -} - -// The system resources for the pipeline run. -// -// At least one zone or region must be specified or the pipeline run will fail. -message Resources { - // The list of regions allowed for VM allocation. If set, the `zones` field - // must not be set. - repeated string regions = 2; - - // The list of zones allowed for VM allocation. If set, the `regions` field - // must not be set. - repeated string zones = 3; - - // The virtual machine specification. - VirtualMachine virtual_machine = 4; -} - -// Carries information about a Compute Engine VM resource. -message VirtualMachine { - // Required. The machine type of the virtual machine to create. Must be the - // short name of a standard machine type (such as "n1-standard-1") or a custom - // machine type (such as "custom-1-4096", where "1" indicates the number of - // vCPUs and "4096" indicates the memory in MB). See [Creating an instance - // with a custom machine - // type](https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type#create) - // for more specifications on creating a custom machine type. - string machine_type = 1 [(google.api.field_behavior) = REQUIRED]; - - // If true, allocate a preemptible VM. - bool preemptible = 2; - - // Optional set of labels to apply to the VM and any attached disk resources. - // These labels must adhere to the [name and value - // restrictions](https://cloud.google.com/compute/docs/labeling-resources) on - // VM labels imposed by Compute Engine. - // - // Labels keys with the prefix 'google-' are reserved for use by Google. - // - // Labels applied at creation time to the VM. Applied on a best-effort basis - // to attached disk resources shortly after VM creation. - map labels = 3; - - // The list of disks to create and attach to the VM. - // - // Specify either the `volumes[]` field or the `disks[]` field, but not both. - repeated Disk disks = 4; - - // The VM network configuration. - Network network = 5; - - // The list of accelerators to attach to the VM. - repeated Accelerator accelerators = 6; - - // The service account to install on the VM. This account does not need - // any permissions other than those required by the pipeline. - ServiceAccount service_account = 7; - - // The size of the boot disk, in GB. The boot disk must be large - // enough to accommodate all of the Docker images from each action in the - // pipeline at the same time. If not specified, a small but reasonable - // default value is used. - int32 boot_disk_size_gb = 8; - - // The CPU platform to request. An instance based on a newer platform can be - // allocated, but never one with fewer capabilities. The value of this - // parameter must be a valid Compute Engine CPU platform name (such as "Intel - // Skylake"). This parameter is only useful for carefully optimized work - // loads where the CPU platform has a significant impact. - // - // For more information about the effect of this parameter, see - // https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform. - string cpu_platform = 9; - - // The host operating system image to use. - // - // Currently, only Container-Optimized OS images can be used. - // - // The default value is `projects/cos-cloud/global/images/family/cos-stable`, - // which selects the latest stable release of Container-Optimized OS. - // - // This option is provided to allow testing against the beta release of the - // operating system to ensure that the new version does not interact - // negatively with production pipelines. - // - // To test a pipeline against the beta release of Container-Optimized OS, - // use the value `projects/cos-cloud/global/images/family/cos-beta`. - string boot_image = 10; - - // The NVIDIA driver version to use when attaching an NVIDIA GPU accelerator. - // The version specified here must be compatible with the GPU libraries - // contained in the container being executed, and must be one of the drivers - // hosted in the `nvidia-drivers-us-public` bucket on Google Cloud Storage. - string nvidia_driver_version = 11 [deprecated = true]; - - // Whether Stackdriver monitoring should be enabled on the VM. - bool enable_stackdriver_monitoring = 12; - - // The Compute Engine Disk Images to use as a Docker cache. The disks will be - // mounted into the Docker folder in a way that the images present in the - // cache will not need to be pulled. The digests of the cached images must - // match those of the tags used or the latest version will still be pulled. - // The root directory of the ext4 image must contain `image` and `overlay2` - // directories copied from the Docker directory of a VM where the desired - // Docker images have already been pulled. Any images pulled that are not - // cached will be stored on the first cache disk instead of the boot disk. - // Only a single image is supported. - repeated string docker_cache_images = 13; - - // The list of disks and other storage to create or attach to the VM. - // - // Specify either the `volumes[]` field or the `disks[]` field, but not both. - repeated Volume volumes = 14; - - // If specified, the VM will only be allocated inside the matching - // reservation. It will fail if the VM parameters don't match the reservation. - string reservation = 15; -} - -// Carries information about a Google Cloud service account. -message ServiceAccount { - // Email address of the service account. If not specified, the default - // Compute Engine service account for the project will be used. - string email = 1; - - // List of scopes to be enabled for this service account on the VM, in - // addition to the cloud-platform API scope that will be added by default. - repeated string scopes = 2; -} - -// Carries information about an accelerator that can be attached to a VM. -message Accelerator { - // The accelerator type string (for example, "nvidia-tesla-k80"). - // - // Only NVIDIA GPU accelerators are currently supported. If an NVIDIA GPU is - // attached, the required runtime libraries will be made available to all - // containers under `/usr/local/nvidia`. The driver version to install must - // be specified using the NVIDIA driver version parameter on the virtual - // machine specification. Note that attaching a GPU increases the worker VM - // startup time by a few minutes. - string type = 1; - - // How many accelerators of this type to attach. - int64 count = 2; -} - -// VM networking options. -message Network { - // The network name to attach the VM's network interface to. The value will - // be prefixed with `global/networks/` unless it contains a `/`, in which - // case it is assumed to be a fully specified network resource URL. - // - // If unspecified, the global default network is used. - string network = 1; - - // If set to true, do not attach a public IP address to the VM. Note that - // without a public IP address, additional configuration is required to - // allow the VM to access Google services. - // - // See https://cloud.google.com/vpc/docs/configure-private-google-access - // for more information. - bool use_private_address = 2; - - // If the specified network is configured for custom subnet creation, the - // name of the subnetwork to attach the instance to must be specified here. - // - // The value is prefixed with `regions/*/subnetworks/` unless it contains a - // `/`, in which case it is assumed to be a fully specified subnetwork - // resource URL. - // - // If the `*` character appears in the value, it is replaced with the region - // that the virtual machine has been allocated in. - string subnetwork = 3; -} - -// Carries information about a disk that can be attached to a VM. -// -// See https://cloud.google.com/compute/docs/disks/performance for more -// information about disk type, size, and performance considerations. -// -// Specify either [`Volume`][google.cloud.lifesciences.v2beta.Volume] or -// [`Disk`][google.cloud.lifesciences.v2beta.Disk], but not both. -message Disk { - // A user-supplied name for the disk. Used when mounting the disk into - // actions. The name must contain only upper and lowercase alphanumeric - // characters and hyphens and cannot start with a hyphen. - string name = 1; - - // The size, in GB, of the disk to attach. If the size is not - // specified, a default is chosen to ensure reasonable I/O performance. - // - // If the disk type is specified as `local-ssd`, multiple local drives are - // automatically combined to provide the requested size. Note, however, that - // each physical SSD is 375GB in size, and no more than 8 drives can be - // attached to a single instance. - int32 size_gb = 2; - - // The Compute Engine disk type. If unspecified, `pd-standard` is used. - string type = 3; - - // An optional image to put on the disk before attaching it to the VM. - string source_image = 4; -} - -// Carries information about storage that can be attached to a VM. -// -// Specify either [`Volume`][google.cloud.lifesciences.v2beta.Volume] or -// [`Disk`][google.cloud.lifesciences.v2beta.Disk], but not both. -message Volume { - // A user-supplied name for the volume. Used when mounting the volume into - // [`Actions`][google.cloud.lifesciences.v2beta.Action]. The name must contain - // only upper and lowercase alphanumeric characters and hyphens and cannot - // start with a hyphen. - string volume = 1; - - oneof storage { - // Configuration for a persistent disk. - PersistentDisk persistent_disk = 2; - - // Configuration for a existing disk. - ExistingDisk existing_disk = 3; - - // Configuration for an NFS mount. - NFSMount nfs_mount = 4; - } -} - -// Configuration for a persistent disk to be attached to the VM. -// -// See https://cloud.google.com/compute/docs/disks/performance for more -// information about disk type, size, and performance considerations. -message PersistentDisk { - // The size, in GB, of the disk to attach. If the size is not - // specified, a default is chosen to ensure reasonable I/O performance. - // - // If the disk type is specified as `local-ssd`, multiple local drives are - // automatically combined to provide the requested size. Note, however, that - // each physical SSD is 375GB in size, and no more than 8 drives can be - // attached to a single instance. - int32 size_gb = 1; - - // The Compute Engine disk type. If unspecified, `pd-standard` is used. - string type = 2; - - // An image to put on the disk before attaching it to the VM. - string source_image = 3; -} - -// Configuration for an existing disk to be attached to the VM. -message ExistingDisk { - // If `disk` contains slashes, the Cloud Life Sciences API assumes that it is - // a complete URL for the disk. If `disk` does not contain slashes, the Cloud - // Life Sciences API assumes that the disk is a zonal disk and a URL will be - // generated of the form `zones//disks/`, where `` is the - // zone in which the instance is allocated. The disk must be ext4 formatted. - // - // If all `Mount` references to this disk have the `read_only` flag set to - // true, the disk will be attached in `read-only` mode and can be shared with - // other instances. Otherwise, the disk will be available for writing but - // cannot be shared. - string disk = 1; -} - -// Configuration for an `NFSMount` to be attached to the VM. -message NFSMount { - // A target NFS mount. The target must be specified as `address:/mount". - string target = 1; -} - -// Carries information about the pipeline execution that is returned -// in the long running operation's metadata field. -message Metadata { - // The pipeline this operation represents. - Pipeline pipeline = 1; - - // The user-defined labels associated with this operation. - map labels = 2; - - // The list of events that have happened so far during the execution of this - // operation. - repeated Event events = 3; - - // The time at which the operation was created by the API. - google.protobuf.Timestamp create_time = 4; - - // The first time at which resources were allocated to execute the pipeline. - google.protobuf.Timestamp start_time = 5; - - // The time at which execution was completed and resources were cleaned up. - google.protobuf.Timestamp end_time = 6; - - // The name of the Cloud Pub/Sub topic where notifications of operation status - // changes are sent. - string pub_sub_topic = 7; -} - -// Carries information about events that occur during pipeline execution. -message Event { - // The time at which the event occurred. - google.protobuf.Timestamp timestamp = 1; - - // A human-readable description of the event. Note that these strings can - // change at any time without notice. Any application logic must use the - // information in the `details` field. - string description = 2; - - // Machine-readable details about the event. - oneof details { - // See - // [google.cloud.lifesciences.v2beta.DelayedEvent][google.cloud.lifesciences.v2beta.DelayedEvent]. - DelayedEvent delayed = 17; - - // See - // [google.cloud.lifesciences.v2beta.WorkerAssignedEvent][google.cloud.lifesciences.v2beta.WorkerAssignedEvent]. - WorkerAssignedEvent worker_assigned = 18; - - // See - // [google.cloud.lifesciences.v2beta.WorkerReleasedEvent][google.cloud.lifesciences.v2beta.WorkerReleasedEvent]. - WorkerReleasedEvent worker_released = 19; - - // See - // [google.cloud.lifesciences.v2beta.PullStartedEvent][google.cloud.lifesciences.v2beta.PullStartedEvent]. - PullStartedEvent pull_started = 20; - - // See - // [google.cloud.lifesciences.v2beta.PullStoppedEvent][google.cloud.lifesciences.v2beta.PullStoppedEvent]. - PullStoppedEvent pull_stopped = 21; - - // See - // [google.cloud.lifesciences.v2beta.ContainerStartedEvent][google.cloud.lifesciences.v2beta.ContainerStartedEvent]. - ContainerStartedEvent container_started = 22; - - // See - // [google.cloud.lifesciences.v2beta.ContainerStoppedEvent][google.cloud.lifesciences.v2beta.ContainerStoppedEvent]. - ContainerStoppedEvent container_stopped = 23; - - // See - // [google.cloud.lifesciences.v2beta.ContainerKilledEvent][google.cloud.lifesciences.v2beta.ContainerKilledEvent]. - ContainerKilledEvent container_killed = 24; - - // See - // [google.cloud.lifesciences.v2beta.UnexpectedExitStatusEvent][google.cloud.lifesciences.v2beta.UnexpectedExitStatusEvent]. - UnexpectedExitStatusEvent unexpected_exit_status = 25; - - // See - // [google.cloud.lifesciences.v2beta.FailedEvent][google.cloud.lifesciences.v2beta.FailedEvent]. - FailedEvent failed = 26; - } -} - -// An event generated whenever a resource limitation or transient error -// delays execution of a pipeline that was otherwise ready to run. -message DelayedEvent { - // A textual description of the cause of the delay. The string can change - // without notice because it is often generated by another service (such as - // Compute Engine). - string cause = 1; - - // If the delay was caused by a resource shortage, this field lists the - // Compute Engine metrics that are preventing this operation from running - // (for example, `CPUS` or `INSTANCES`). If the particular metric is not - // known, a single `UNKNOWN` metric will be present. - repeated string metrics = 2; -} - -// An event generated after a worker VM has been assigned to run the -// pipeline. -message WorkerAssignedEvent { - // The zone the worker is running in. - string zone = 1; - - // The worker's instance name. - string instance = 2; - - // The machine type that was assigned for the worker. - string machine_type = 3; -} - -// An event generated when the worker VM that was assigned to the pipeline -// has been released (deleted). -message WorkerReleasedEvent { - // The zone the worker was running in. - string zone = 1; - - // The worker's instance name. - string instance = 2; -} - -// An event generated when the worker starts pulling an image. -message PullStartedEvent { - // The URI of the image that was pulled. - string image_uri = 1; -} - -// An event generated when the worker stops pulling an image. -message PullStoppedEvent { - // The URI of the image that was pulled. - string image_uri = 1; -} - -// An event generated when a container starts. -message ContainerStartedEvent { - // The numeric ID of the action that started this container. - int32 action_id = 1; - - // The container-to-host port mappings installed for this container. This - // set will contain any ports exposed using the `PUBLISH_EXPOSED_PORTS` flag - // as well as any specified in the `Action` definition. - map port_mappings = 2; - - // The public IP address that can be used to connect to the container. This - // field is only populated when at least one port mapping is present. If the - // instance was created with a private address, this field will be empty even - // if port mappings exist. - string ip_address = 3; -} - -// An event generated when a container exits. -message ContainerStoppedEvent { - // The numeric ID of the action that started this container. - int32 action_id = 1; - - // The exit status of the container. - int32 exit_status = 2; - - // The tail end of any content written to standard error by the container. - // If the content emits large amounts of debugging noise or contains - // sensitive information, you can prevent the content from being printed by - // setting the `DISABLE_STANDARD_ERROR_CAPTURE` flag. - // - // Note that only a small amount of the end of the stream is captured here. - // The entire stream is stored in the `/google/logs` directory mounted into - // each action, and can be copied off the machine as described elsewhere. - string stderr = 3; -} - -// An event generated when the execution of a container results in a -// non-zero exit status that was not otherwise ignored. Execution will -// continue, but only actions that are flagged as `ALWAYS_RUN` will be -// executed. Other actions will be skipped. -message UnexpectedExitStatusEvent { - // The numeric ID of the action that started the container. - int32 action_id = 1; - - // The exit status of the container. - int32 exit_status = 2; -} - -// An event generated when a container is forcibly terminated by the -// worker. Currently, this only occurs when the container outlives the -// timeout specified by the user. -message ContainerKilledEvent { - // The numeric ID of the action that started the container. - int32 action_id = 1; -} - -// An event generated when the execution of a pipeline has failed. Note -// that other events can continue to occur after this event. -message FailedEvent { - // The Google standard error code that best describes this failure. - google.rpc.Code code = 1; - - // The human-readable description of the cause of the failure. - string cause = 2; -} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/snippet_metadata_google.cloud.lifesciences.v2beta.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/snippet_metadata_google.cloud.lifesciences.v2beta.json deleted file mode 100644 index 3785dc98d68..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/snippet_metadata_google.cloud.lifesciences.v2beta.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-lifesciences", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.lifesciences.v2beta", - "version": "v2beta" - } - ] - }, - "snippets": [ - { - "regionTag": "lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async", - "title": "WorkflowsServiceV2Beta runPipeline Sample", - "origin": "API_DEFINITION", - "description": " Runs a pipeline. The returned Operation's [metadata] [google.longrunning.Operation.metadata] field will contain a [google.cloud.lifesciences.v2beta.Metadata][google.cloud.lifesciences.v2beta.Metadata] object describing the status of the pipeline execution. The [response][google.longrunning.Operation.response] field will contain a [google.cloud.lifesciences.v2beta.RunPipelineResponse][google.cloud.lifesciences.v2beta.RunPipelineResponse] object if the pipeline completes successfully. **Note:** Before you can use this method, the *Life Sciences Service Agent* must have access to your project. This is done automatically when the Cloud Life Sciences API is first enabled, but if you delete this permission you must disable and re-enable the API to grant the Life Sciences Service Agent the required permissions. Authorization requires the following [Google IAM](https://cloud.google.com/iam/) permission: * `lifesciences.workflows.run`", - "canonical": true, - "file": "workflows_service_v2_beta.run_pipeline.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RunPipeline", - "fullName": "google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta.RunPipeline", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "pipeline", - "type": ".google.cloud.lifesciences.v2beta.Pipeline" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "pub_sub_topic", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkflowsServiceV2BetaClient", - "fullName": "google.cloud.lifesciences.v2beta.WorkflowsServiceV2BetaClient" - }, - "method": { - "shortName": "RunPipeline", - "fullName": "google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta.RunPipeline", - "service": { - "shortName": "WorkflowsServiceV2Beta", - "fullName": "google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js deleted file mode 100644 index e6d6edf42b1..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.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(pipeline) { - // [START lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The project and location that this request should be executed against. - */ - // const parent = 'abc123' - /** - * Required. The description of the pipeline to run. - */ - // const pipeline = {} - /** - * User-defined labels to associate with the returned operation. These - * labels are not propagated to any Google Cloud Platform resources used by - * the operation, and can be modified at any time. - * To associate labels with resources created while executing the operation, - * see the appropriate resource message (for example, `VirtualMachine`). - */ - // const labels = [1,2,3,4] - /** - * The name of an existing Pub/Sub topic. The server will publish - * messages to this topic whenever the status of the operation changes. - * The Life Sciences Service Agent account must have publisher permissions to - * the specified topic or notifications will not be sent. - */ - // const pubSubTopic = 'abc123' - - // Imports the Lifesciences library - const {WorkflowsServiceV2BetaClient} = require('@google-cloud/life-sciences').v2beta; - - // Instantiates a client - const lifesciencesClient = new WorkflowsServiceV2BetaClient(); - - async function callRunPipeline() { - // Construct request - const request = { - pipeline, - }; - - // Run request - const [operation] = await lifesciencesClient.runPipeline(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRunPipeline(); - // [END lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_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-lifesciences/v2beta/src/index.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/index.ts deleted file mode 100644 index 1957bdc6074..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/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 v2beta from './v2beta'; -const WorkflowsServiceV2BetaClient = v2beta.WorkflowsServiceV2BetaClient; -type WorkflowsServiceV2BetaClient = v2beta.WorkflowsServiceV2BetaClient; -export {v2beta, WorkflowsServiceV2BetaClient}; -export default {v2beta, WorkflowsServiceV2BetaClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/gapic_metadata.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/gapic_metadata.json deleted file mode 100644 index 443e9dc9c80..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/gapic_metadata.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.lifesciences.v2beta", - "libraryPackage": "@google-cloud/life-sciences", - "services": { - "WorkflowsServiceV2Beta": { - "clients": { - "grpc": { - "libraryClient": "WorkflowsServiceV2BetaClient", - "rpcs": { - "RunPipeline": { - "methods": [ - "runPipeline" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "WorkflowsServiceV2BetaClient", - "rpcs": { - "RunPipeline": { - "methods": [ - "runPipeline" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/index.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/index.ts deleted file mode 100644 index ee7dd34b610..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/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 {WorkflowsServiceV2BetaClient} from './workflows_service_v2_beta_client'; diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts deleted file mode 100644 index 96ac33824f3..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts +++ /dev/null @@ -1,714 +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, GrpcClientOptions, LROperation, LocationsClient, LocationProtos} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta/workflows_service_v2_beta_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './workflows_service_v2_beta_client_config.json'; -const version = require('../../../package.json').version; - -/** - * A service for running workflows, such as pipelines consisting of Docker - * containers. - * @class - * @memberof v2beta - */ -export class WorkflowsServiceV2BetaClient { - 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}; - locationsClient: LocationsClient; - operationsClient: gax.OperationsClient; - workflowsServiceV2BetaStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of WorkflowsServiceV2BetaClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 WorkflowsServiceV2BetaClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof WorkflowsServiceV2BetaClient; - 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; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - 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); - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2beta/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2beta/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2beta/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v2beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v2beta/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const runPipelineResponse = protoFilesRoot.lookup( - '.google.cloud.lifesciences.v2beta.RunPipelineResponse') as gax.protobuf.Type; - const runPipelineMetadata = protoFilesRoot.lookup( - '.google.cloud.lifesciences.v2beta.Metadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - runPipeline: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - runPipelineResponse.decode.bind(runPipelineResponse), - runPipelineMetadata.decode.bind(runPipelineMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta', 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.workflowsServiceV2BetaStub) { - return this.workflowsServiceV2BetaStub; - } - - // Put together the "service stub" for - // google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta. - this.workflowsServiceV2BetaStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta, - 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 workflowsServiceV2BetaStubMethods = - ['runPipeline']; - for (const methodName of workflowsServiceV2BetaStubMethods) { - const callPromise = this.workflowsServiceV2BetaStub.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.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.workflowsServiceV2BetaStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'lifesciences.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 'lifesciences.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 -- - // ------------------- - -/** - * Runs a pipeline. The returned Operation's [metadata] - * [google.longrunning.Operation.metadata] field will contain a - * {@link protos.google.cloud.lifesciences.v2beta.Metadata|google.cloud.lifesciences.v2beta.Metadata} - * object describing the status of the pipeline execution. The - * {@link protos.google.longrunning.Operation.response|response} field will contain a - * {@link protos.google.cloud.lifesciences.v2beta.RunPipelineResponse|google.cloud.lifesciences.v2beta.RunPipelineResponse} - * object if the pipeline completes successfully. - * - * **Note:** Before you can use this method, the *Life Sciences Service Agent* - * must have access to your project. This is done automatically when the - * Cloud Life Sciences API is first enabled, but if you delete this permission - * you must disable and re-enable the API to grant the Life Sciences - * Service Agent the required permissions. - * Authorization requires the following [Google - * IAM](https://cloud.google.com/iam/) permission: - * - * * `lifesciences.workflows.run` - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The project and location that this request should be executed against. - * @param {google.cloud.lifesciences.v2beta.Pipeline} request.pipeline - * Required. The description of the pipeline to run. - * @param {number[]} request.labels - * User-defined labels to associate with the returned operation. These - * labels are not propagated to any Google Cloud Platform resources used by - * the operation, and can be modified at any time. - * - * To associate labels with resources created while executing the operation, - * see the appropriate resource message (for example, `VirtualMachine`). - * @param {string} request.pubSubTopic - * The name of an existing Pub/Sub topic. The server will publish - * messages to this topic whenever the status of the operation changes. - * The Life Sciences Service Agent account must have publisher permissions to - * the specified topic or notifications will not be sent. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js - * region_tag:lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async - */ - runPipeline( - request?: protos.google.cloud.lifesciences.v2beta.IRunPipelineRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - runPipeline( - request: protos.google.cloud.lifesciences.v2beta.IRunPipelineRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runPipeline( - request: protos.google.cloud.lifesciences.v2beta.IRunPipelineRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runPipeline( - request?: protos.google.cloud.lifesciences.v2beta.IRunPipelineRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.runPipeline(request, options, callback); - } -/** - * Check the status of the long running operation returned by `runPipeline()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js - * region_tag:lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async - */ - async checkRunPipelineProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runPipeline, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(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.workflowsServiceV2BetaStub && !this._terminated) { - return this.workflowsServiceV2BetaStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client_config.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client_config.json deleted file mode 100644 index 9c8434c1b8d..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client_config.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "interfaces": { - "google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta": { - "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": { - "RunPipeline": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_proto_list.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_proto_list.json deleted file mode 100644 index b8302b0ea69..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/lifesciences/v2beta/workflows.proto" -] diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 0076cf26656..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/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 lifesciences = require('@google-cloud/life-sciences'); - -function main() { - const workflowsServiceV2BetaClient = new lifesciences.WorkflowsServiceV2BetaClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 6c8d3f3a893..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/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 {WorkflowsServiceV2BetaClient} from '@google-cloud/life-sciences'; - -// check that the client class type name can be used -function doStuffWithWorkflowsServiceV2BetaClient(client: WorkflowsServiceV2BetaClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const workflowsServiceV2BetaClient = new WorkflowsServiceV2BetaClient(); - doStuffWithWorkflowsServiceV2BetaClient(workflowsServiceV2BetaClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/install.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/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-lifesciences/v2beta/test/gapic_workflows_service_v2_beta_v2beta.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/test/gapic_workflows_service_v2_beta_v2beta.ts deleted file mode 100644 index ac1c16f373d..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/test/gapic_workflows_service_v2_beta_v2beta.ts +++ /dev/null @@ -1,757 +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 workflowsservicev2betaModule from '../src'; - -import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function 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('v2beta.WorkflowsServiceV2BetaClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowsServiceV2BetaStub, undefined); - await client.initialize(); - assert(client.workflowsServiceV2BetaStub); - }); - - it('has close method for the initialized client', done => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.workflowsServiceV2BetaStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowsServiceV2BetaStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - 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 workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - 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('runPipeline', () => { - it('invokes runPipeline without error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.lifesciences.v2beta.RunPipelineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.lifesciences.v2beta.RunPipelineRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runPipeline = stubLongRunningCall(expectedResponse); - const [operation] = await client.runPipeline(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runPipeline as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runPipeline as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runPipeline without error using callback', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.lifesciences.v2beta.RunPipelineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.lifesciences.v2beta.RunPipelineRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runPipeline = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runPipeline( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runPipeline as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runPipeline as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runPipeline with call error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.lifesciences.v2beta.RunPipelineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.lifesciences.v2beta.RunPipelineRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.runPipeline = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.runPipeline(request), expectedError); - const actualRequest = (client.innerApiCalls.runPipeline as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runPipeline as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runPipeline with LRO error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.lifesciences.v2beta.RunPipelineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.lifesciences.v2beta.RunPipelineRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.runPipeline = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.runPipeline(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.runPipeline as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runPipeline as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRunPipelineProgress without error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRunPipelineProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRunPipelineProgress with error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRunPipelineProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/tsconfig.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/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-lifesciences/v2beta/webpack.config.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/webpack.config.js deleted file mode 100644 index e7f6079e4d2..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/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: 'WorkflowsServiceV2Beta', - filename: './workflows-service-v2-beta.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-managedidentities/v1/.eslintignore b/owl-bot-staging/google-cloud-managedidentities/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1/.eslintrc.json b/owl-bot-staging/google-cloud-managedidentities/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/.gitignore b/owl-bot-staging/google-cloud-managedidentities/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1/.jsdoc.js b/owl-bot-staging/google-cloud-managedidentities/v1/.jsdoc.js deleted file mode 100644 index fe671cd4e4e..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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/managed-identities', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/.mocharc.js b/owl-bot-staging/google-cloud-managedidentities/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1/.prettierrc.js b/owl-bot-staging/google-cloud-managedidentities/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1/README.md b/owl-bot-staging/google-cloud-managedidentities/v1/README.md deleted file mode 100644 index 94f33d69900..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Managedidentities: Nodejs Client diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/package.json b/owl-bot-staging/google-cloud-managedidentities/v1/package.json deleted file mode 100644 index fa591ecc6c5..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/managed-identities", - "version": "0.1.0", - "description": "Managedidentities client for Node.js", - "repository": "googleapis/nodejs-managedidentities", - "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 managedidentities", - "managedidentities", - "managed identities service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/protos/google/cloud/managedidentities/v1/managed_identities_service.proto b/owl-bot-staging/google-cloud-managedidentities/v1/protos/google/cloud/managedidentities/v1/managed_identities_service.proto deleted file mode 100644 index 3a8d14ef1df..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/protos/google/cloud/managedidentities/v1/managed_identities_service.proto +++ /dev/null @@ -1,422 +0,0 @@ -// Copyright 2019 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.managedidentities.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/managedidentities/v1/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ManagedIdentities.V1"; -option go_package = "cloud.google.com/go/managedidentities/apiv1/managedidentitiespb;managedidentitiespb"; -option java_multiple_files = true; -option java_outer_classname = "ManagedIdentitiesServiceProto"; -option java_package = "com.google.cloud.managedidentities.v1"; -option objc_class_prefix = "GCMI"; -option php_namespace = "Google\\Cloud\\ManagedIdentities\\V1"; -option ruby_package = "Google::Cloud::ManagedIdentities::V1"; - -// API Overview -// -// The `managedidentites.googleapis.com` service implements the Google Cloud -// Managed Identites API for identity services -// (e.g. Microsoft Active Directory). -// -// The Managed Identities service provides methods to manage -// (create/read/update/delete) domains, reset managed identities admin password, -// add/remove domain controllers in GCP regions and add/remove VPC peering. -// -// Data Model -// -// The Managed Identities service exposes the following resources: -// -// * Locations as global, named as follows: -// `projects/{project_id}/locations/global`. -// -// * Domains, named as follows: -// `/projects/{project_id}/locations/global/domain/{domain_name}`. -// -// The `{domain_name}` refers to fully qualified domain name in the customer -// project e.g. mydomain.myorganization.com, with the following restrictions: -// -// * Must contain only lowercase letters, numbers, periods and hyphens. -// * Must start with a letter. -// * Must contain between 2-64 characters. -// * Must end with a number or a letter. -// * Must not start with period. -// * First segement length (mydomain form example above) shouldn't exceed -// 15 chars. -// * The last segment cannot be fully numeric. -// * Must be unique within the customer project. -service ManagedIdentitiesService { - option (google.api.default_host) = "managedidentities.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a Microsoft AD domain. - rpc CreateMicrosoftAdDomain(CreateMicrosoftAdDomainRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/global}/domains" - body: "domain" - }; - option (google.api.method_signature) = "parent,domain_name,domain"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Resets a domain's administrator password. - rpc ResetAdminPassword(ResetAdminPasswordRequest) returns (ResetAdminPasswordResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/global/domains/*}:resetAdminPassword" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Lists domains in a project. - rpc ListDomains(ListDomainsRequest) returns (ListDomainsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/global}/domains" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets information about a domain. - rpc GetDomain(GetDomainRequest) returns (Domain) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/global/domains/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the metadata and configuration of a domain. - rpc UpdateDomain(UpdateDomainRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{domain.name=projects/*/locations/global/domains/*}" - body: "domain" - }; - option (google.api.method_signature) = "domain,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Deletes a domain. - rpc DeleteDomain(DeleteDomainRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/global/domains/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OpMetadata" - }; - } - - // Adds an AD trust to a domain. - rpc AttachTrust(AttachTrustRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/global/domains/*}:attachTrust" - body: "*" - }; - option (google.api.method_signature) = "name,trust"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Updates the DNS conditional forwarder. - rpc ReconfigureTrust(ReconfigureTrustRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/global/domains/*}:reconfigureTrust" - body: "*" - }; - option (google.api.method_signature) = "name,target_domain_name,target_dns_ip_addresses"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Removes an AD trust. - rpc DetachTrust(DetachTrustRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/global/domains/*}:detachTrust" - body: "*" - }; - option (google.api.method_signature) = "name,trust"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Validates a trust state, that the target domain is reachable, and that the - // target domain is able to accept incoming trust requests. - rpc ValidateTrust(ValidateTrustRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/global/domains/*}:validateTrust" - body: "*" - }; - option (google.api.method_signature) = "name,trust"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } -} - -// Represents the metadata of the long-running operation. -message OpMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool requested_cancellation = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request message for -// [CreateMicrosoftAdDomain][google.cloud.managedidentities.v1.CreateMicrosoftAdDomain] -message CreateMicrosoftAdDomainRequest { - // Required. The resource project name and location using the form: - // `projects/{project_id}/locations/global` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The fully qualified domain name. - // e.g. mydomain.myorganization.com, with the following restrictions: - // - // * Must contain only lowercase letters, numbers, periods and hyphens. - // * Must start with a letter. - // * Must contain between 2-64 characters. - // * Must end with a number or a letter. - // * Must not start with period. - // * First segement length (mydomain form example above) shouldn't exceed - // 15 chars. - // * The last segment cannot be fully numeric. - // * Must be unique within the customer project. - string domain_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A Managed Identity domain resource. - Domain domain = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [ResetAdminPassword][google.cloud.managedidentities.v1.ResetAdminPassword] -message ResetAdminPasswordRequest { - // Required. The domain resource name using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; -} - -// Response message for -// [ResetAdminPassword][google.cloud.managedidentities.v1.ResetAdminPassword] -message ResetAdminPasswordResponse { - // A random password. See [admin][google.cloud.managedidentities.v1.Domain.admin] for more information. - string password = 1; -} - -// Request message for -// [ListDomains][google.cloud.managedidentities.v1.ListDomains] -message ListDomainsRequest { - // Required. The resource name of the domain location using the form: - // `projects/{project_id}/locations/global` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Optional. The maximum number of items to return. - // If not specified, a default value of 1000 will be used. - // Regardless of the page_size value, the response may include a partial list. - // Callers should rely on a response's - // [next_page_token][google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token] - // to determine if there are additional results to list. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The `next_page_token` value returned from a previous ListDomainsRequest - // request, if any. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A filter specifying constraints of a list operation. - // For example, `Domain.fqdn="mydomain.myorginization"`. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the ordering of results. See - // [Sorting - // order](https://cloud.google.com/apis/design/design_patterns#sorting_order) - // for more information. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [ListDomains][google.cloud.managedidentities.v1.ListDomains] -message ListDomainsResponse { - // A list of Managed Identities Service domains in the project. - repeated Domain domains = 1; - - // A token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; - - // A list of locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for [GetDomain][google.cloud.managedidentities.v1.GetDomain] -message GetDomainRequest { - // Required. The domain resource name using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; -} - -// Request message for -// [UpdateDomain][google.cloud.managedidentities.v1.UpdateDomain] -message UpdateDomainRequest { - // Required. Mask of fields to update. At least one path must be supplied in this - // field. The elements of the repeated paths field may only include - // fields from [Domain][google.cloud.managedidentities.v1.Domain]: - // * `labels` - // * `locations` - // * `authorized_networks` - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Domain message with updated fields. Only supported fields specified in - // update_mask are updated. - Domain domain = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [DeleteDomain][google.cloud.managedidentities.v1.DeleteDomain] -message DeleteDomainRequest { - // Required. The domain resource name using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; -} - -// Request message for -// [AttachTrust][google.cloud.managedidentities.v1.AttachTrust] -message AttachTrustRequest { - // Required. The resource domain name, project name and location using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The domain trust resource. - Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [ReconfigureTrust][google.cloud.managedidentities.v1.ReconfigureTrust] -message ReconfigureTrustRequest { - // Required. The resource domain name, project name and location using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The fully-qualified target domain name which will be in trust with current - // domain. - string target_domain_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The target DNS server IP addresses to resolve the remote domain involved - // in the trust. - repeated string target_dns_ip_addresses = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [DetachTrust][google.cloud.managedidentities.v1.DetachTrust] -message DetachTrustRequest { - // Required. The resource domain name, project name, and location using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The domain trust resource to removed. - Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [ValidateTrust][google.cloud.managedidentities.v1.ValidateTrust] -message ValidateTrustRequest { - // Required. The resource domain name, project name, and location using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The domain trust to validate trust state for. - Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/protos/google/cloud/managedidentities/v1/resource.proto b/owl-bot-staging/google-cloud-managedidentities/v1/protos/google/cloud/managedidentities/v1/resource.proto deleted file mode 100644 index f03917ca0d1..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/protos/google/cloud/managedidentities/v1/resource.proto +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright 2019 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.managedidentities.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ManagedIdentities.V1"; -option go_package = "cloud.google.com/go/managedidentities/apiv1/managedidentitiespb;managedidentitiespb"; -option java_multiple_files = true; -option java_outer_classname = "ResourceProto"; -option java_package = "com.google.cloud.managedidentities.v1"; -option php_namespace = "Google\\Cloud\\ManagedIdentities\\V1"; -option ruby_package = "Google::Cloud::ManagedIdentities::V1"; - -// Represents a managed Microsoft Active Directory domain. -message Domain { - option (google.api.resource) = { - type: "managedidentities.googleapis.com/Domain" - pattern: "projects/{project}/locations/{location}/domains/{domain}" - }; - - // Represents the different states of a managed domain. - enum State { - // Not set. - STATE_UNSPECIFIED = 0; - - // The domain is being created. - CREATING = 1; - - // The domain has been created and is fully usable. - READY = 2; - - // The domain's configuration is being updated. - UPDATING = 3; - - // The domain is being deleted. - DELETING = 4; - - // The domain is being repaired and may be unusable. Details - // can be found in the `status_message` field. - REPAIRING = 5; - - // The domain is undergoing maintenance. - PERFORMING_MAINTENANCE = 6; - - // The domain is not serving requests. - UNAVAILABLE = 7; - } - - // Required. The unique name of the domain using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}`. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Resource labels that can contain user-provided metadata. - map labels = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The full names of the Google Compute Engine - // [networks](/compute/docs/networks-and-firewalls#networks) the domain - // instance is connected to. Networks can be added using UpdateDomain. - // The domain is only available on networks listed in `authorized_networks`. - // If CIDR subnets overlap between networks, domain creation will fail. - repeated string authorized_networks = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The CIDR range of internal addresses that are reserved for this - // domain. Reserved networks must be /24 or larger. Ranges must be - // unique and non-overlapping with existing subnets in - // [Domain].[authorized_networks]. - string reserved_ip_range = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. Locations where domain needs to be provisioned. - // [regions][compute/docs/regions-zones/] - // e.g. us-west1 or us-east4 - // Service supports up to 4 locations at once. Each location will use a /26 - // block. - repeated string locations = 5 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The name of delegated administrator account used to perform - // Active Directory operations. If not specified, `setupadmin` will be used. - string admin = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The fully-qualified domain name of the exposed domain used by - // clients to connect to the service. Similar to what would be chosen for an - // Active Directory set up on an internal network. - string fqdn = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the instance was created. - google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update time. - google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of this domain. - State state = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current status of this - // domain, if available. - string status_message = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current trusts associated with the domain. - repeated Trust trusts = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents a relationship between two domains. This allows a controller in -// one domain to authenticate a user in another domain. -message Trust { - // Represents the different states of a domain trust. - enum State { - // Not set. - STATE_UNSPECIFIED = 0; - - // The domain trust is being created. - CREATING = 1; - - // The domain trust is being updated. - UPDATING = 2; - - // The domain trust is being deleted. - DELETING = 3; - - // The domain trust is connected. - CONNECTED = 4; - - // The domain trust is disconnected. - DISCONNECTED = 5; - } - - // Represents the different inter-forest trust types. - enum TrustType { - // Not set. - TRUST_TYPE_UNSPECIFIED = 0; - - // The forest trust. - FOREST = 1; - - // The external domain trust. - EXTERNAL = 2; - } - - // Represents the direction of trust. - // See - // [System.DirectoryServices.ActiveDirectory.TrustDirection](https://docs.microsoft.com/en-us/dotnet/api/system.directoryservices.activedirectory.trustdirection?view=netframework-4.7.2) - // for more information. - enum TrustDirection { - // Not set. - TRUST_DIRECTION_UNSPECIFIED = 0; - - // The inbound direction represents the trusting side. - INBOUND = 1; - - // The outboud direction represents the trusted side. - OUTBOUND = 2; - - // The bidirectional direction represents the trusted / trusting side. - BIDIRECTIONAL = 3; - } - - // Required. The fully qualified target domain name which will be in trust with the - // current domain. - string target_domain_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The type of trust represented by the trust resource. - TrustType trust_type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The trust direction, which decides if the current domain is trusted, - // trusting, or both. - TrustDirection trust_direction = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The trust authentication type, which decides whether the trusted side has - // forest/domain wide access or selective access to an approved set of - // resources. - bool selective_authentication = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The target DNS server IP addresses which can resolve the remote domain - // involved in the trust. - repeated string target_dns_ip_addresses = 5 [(google.api.field_behavior) = REQUIRED]; - - // Required. The trust secret used for the handshake with the target domain. This will - // not be stored. - string trust_handshake_secret = 6 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The time the instance was created. - google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update time. - google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the trust. - State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current state of the trust, if available. - string state_description = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last heartbeat time when the trust was known to be connected. - google.protobuf.Timestamp last_trust_heartbeat_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.attach_trust.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.attach_trust.js deleted file mode 100644 index 1e14de62219..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.attach_trust.js +++ /dev/null @@ -1,68 +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, trust) { - // [START managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_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 domain name, project name and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - /** - * Required. The domain trust resource. - */ - // const trust = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callAttachTrust() { - // Construct request - const request = { - name, - trust, - }; - - // Run request - const [operation] = await managedidentitiesClient.attachTrust(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAttachTrust(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_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-managedidentities/v1/samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js deleted file mode 100644 index 223036e6fee..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js +++ /dev/null @@ -1,83 +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, domainName, domain) { - // [START managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_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 project name and location using the form: - * `projects/{project_id}/locations/global` - */ - // const parent = 'abc123' - /** - * Required. The fully qualified domain name. - * e.g. mydomain.myorganization.com, with the following restrictions: - * * Must contain only lowercase letters, numbers, periods and hyphens. - * * Must start with a letter. - * * Must contain between 2-64 characters. - * * Must end with a number or a letter. - * * Must not start with period. - * * First segement length (mydomain form example above) shouldn't exceed - * 15 chars. - * * The last segment cannot be fully numeric. - * * Must be unique within the customer project. - */ - // const domainName = 'abc123' - /** - * Required. A Managed Identity domain resource. - */ - // const domain = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callCreateMicrosoftAdDomain() { - // Construct request - const request = { - parent, - domainName, - domain, - }; - - // Run request - const [operation] = await managedidentitiesClient.createMicrosoftAdDomain(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateMicrosoftAdDomain(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_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-managedidentities/v1/samples/generated/v1/managed_identities_service.delete_domain.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.delete_domain.js deleted file mode 100644 index 556030402d0..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.delete_domain.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 managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_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 domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callDeleteDomain() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await managedidentitiesClient.deleteDomain(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteDomain(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_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-managedidentities/v1/samples/generated/v1/managed_identities_service.detach_trust.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.detach_trust.js deleted file mode 100644 index dcf2546599f..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.detach_trust.js +++ /dev/null @@ -1,68 +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, trust) { - // [START managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_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 domain name, project name, and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - /** - * Required. The domain trust resource to removed. - */ - // const trust = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callDetachTrust() { - // Construct request - const request = { - name, - trust, - }; - - // Run request - const [operation] = await managedidentitiesClient.detachTrust(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDetachTrust(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_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-managedidentities/v1/samples/generated/v1/managed_identities_service.get_domain.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.get_domain.js deleted file mode 100644 index 6b19f68c1c9..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.get_domain.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 managedidentities_v1_generated_ManagedIdentitiesService_GetDomain_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 domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callGetDomain() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await managedidentitiesClient.getDomain(request); - console.log(response); - } - - callGetDomain(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_GetDomain_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-managedidentities/v1/samples/generated/v1/managed_identities_service.list_domains.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.list_domains.js deleted file mode 100644 index eecf2cc4103..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.list_domains.js +++ /dev/null @@ -1,90 +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 managedidentities_v1_generated_ManagedIdentitiesService_ListDomains_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the domain location using the form: - * `projects/{project_id}/locations/global` - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return. - * If not specified, a default value of 1000 will be used. - * Regardless of the page_size value, the response may include a partial list. - * Callers should rely on a response's - * next_page_token google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token - * to determine if there are additional results to list. - */ - // const pageSize = 1234 - /** - * Optional. The `next_page_token` value returned from a previous ListDomainsRequest - * request, if any. - */ - // const pageToken = 'abc123' - /** - * Optional. A filter specifying constraints of a list operation. - * For example, `Domain.fqdn="mydomain.myorginization"`. - */ - // const filter = 'abc123' - /** - * Optional. Specifies the ordering of results. See - * Sorting - * order (https://cloud.google.com/apis/design/design_patterns#sorting_order) - * for more information. - */ - // const orderBy = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callListDomains() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await managedidentitiesClient.listDomainsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDomains(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_ListDomains_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-managedidentities/v1/samples/generated/v1/managed_identities_service.reconfigure_trust.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.reconfigure_trust.js deleted file mode 100644 index 2a1cea1709d..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.reconfigure_trust.js +++ /dev/null @@ -1,75 +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, targetDomainName, targetDnsIpAddresses) { - // [START managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_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 domain name, project name and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - /** - * Required. The fully-qualified target domain name which will be in trust with current - * domain. - */ - // const targetDomainName = 'abc123' - /** - * Required. The target DNS server IP addresses to resolve the remote domain involved - * in the trust. - */ - // const targetDnsIpAddresses = ['abc','def'] - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callReconfigureTrust() { - // Construct request - const request = { - name, - targetDomainName, - targetDnsIpAddresses, - }; - - // Run request - const [operation] = await managedidentitiesClient.reconfigureTrust(request); - const [response] = await operation.promise(); - console.log(response); - } - - callReconfigureTrust(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_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-managedidentities/v1/samples/generated/v1/managed_identities_service.reset_admin_password.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.reset_admin_password.js deleted file mode 100644 index 2ac2b42ab8e..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.reset_admin_password.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 managedidentities_v1_generated_ManagedIdentitiesService_ResetAdminPassword_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 domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callResetAdminPassword() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await managedidentitiesClient.resetAdminPassword(request); - console.log(response); - } - - callResetAdminPassword(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_ResetAdminPassword_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-managedidentities/v1/samples/generated/v1/managed_identities_service.update_domain.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.update_domain.js deleted file mode 100644 index 264f1dcab68..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.update_domain.js +++ /dev/null @@ -1,73 +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(updateMask, domain) { - // [START managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_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. Mask of fields to update. At least one path must be supplied in this - * field. The elements of the repeated paths field may only include - * fields from Domain google.cloud.managedidentities.v1.Domain: - * * `labels` - * * `locations` - * * `authorized_networks` - */ - // const updateMask = {} - /** - * Required. Domain message with updated fields. Only supported fields specified in - * update_mask are updated. - */ - // const domain = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callUpdateDomain() { - // Construct request - const request = { - updateMask, - domain, - }; - - // Run request - const [operation] = await managedidentitiesClient.updateDomain(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateDomain(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_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-managedidentities/v1/samples/generated/v1/managed_identities_service.validate_trust.js b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.validate_trust.js deleted file mode 100644 index 3788dacefd4..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/managed_identities_service.validate_trust.js +++ /dev/null @@ -1,68 +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, trust) { - // [START managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_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 domain name, project name, and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - /** - * Required. The domain trust to validate trust state for. - */ - // const trust = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callValidateTrust() { - // Construct request - const request = { - name, - trust, - }; - - // Run request - const [operation] = await managedidentitiesClient.validateTrust(request); - const [response] = await operation.promise(); - console.log(response); - } - - callValidateTrust(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_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-managedidentities/v1/samples/generated/v1/snippet_metadata_google.cloud.managedidentities.v1.json b/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/snippet_metadata_google.cloud.managedidentities.v1.json deleted file mode 100644 index 334c969c455..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/samples/generated/v1/snippet_metadata_google.cloud.managedidentities.v1.json +++ /dev/null @@ -1,463 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-managedidentities", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.managedidentities.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async", - "title": "ManagedIdentitiesService createMicrosoftAdDomain Sample", - "origin": "API_DEFINITION", - "description": " Creates a Microsoft AD domain.", - "canonical": true, - "file": "managed_identities_service.create_microsoft_ad_domain.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMicrosoftAdDomain", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.CreateMicrosoftAdDomain", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "domain_name", - "type": "TYPE_STRING" - }, - { - "name": "domain", - "type": ".google.cloud.managedidentities.v1.Domain" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "CreateMicrosoftAdDomain", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.CreateMicrosoftAdDomain", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_ResetAdminPassword_async", - "title": "ManagedIdentitiesService resetAdminPassword Sample", - "origin": "API_DEFINITION", - "description": " Resets a domain's administrator password.", - "canonical": true, - "file": "managed_identities_service.reset_admin_password.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResetAdminPassword", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ResetAdminPassword", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.managedidentities.v1.ResetAdminPasswordResponse", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "ResetAdminPassword", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ResetAdminPassword", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_ListDomains_async", - "title": "ManagedIdentitiesService listDomains Sample", - "origin": "API_DEFINITION", - "description": " Lists domains in a project.", - "canonical": true, - "file": "managed_identities_service.list_domains.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDomains", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ListDomains", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.managedidentities.v1.ListDomainsResponse", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "ListDomains", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ListDomains", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_GetDomain_async", - "title": "ManagedIdentitiesService getDomain Sample", - "origin": "API_DEFINITION", - "description": " Gets information about a domain.", - "canonical": true, - "file": "managed_identities_service.get_domain.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDomain", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.GetDomain", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.managedidentities.v1.Domain", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "GetDomain", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.GetDomain", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_async", - "title": "ManagedIdentitiesService updateDomain Sample", - "origin": "API_DEFINITION", - "description": " Updates the metadata and configuration of a domain.", - "canonical": true, - "file": "managed_identities_service.update_domain.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateDomain", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.UpdateDomain", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "domain", - "type": ".google.cloud.managedidentities.v1.Domain" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "UpdateDomain", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.UpdateDomain", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_async", - "title": "ManagedIdentitiesService deleteDomain Sample", - "origin": "API_DEFINITION", - "description": " Deletes a domain.", - "canonical": true, - "file": "managed_identities_service.delete_domain.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDomain", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.DeleteDomain", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "DeleteDomain", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.DeleteDomain", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_async", - "title": "ManagedIdentitiesService attachTrust Sample", - "origin": "API_DEFINITION", - "description": " Adds an AD trust to a domain.", - "canonical": true, - "file": "managed_identities_service.attach_trust.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AttachTrust", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.AttachTrust", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "trust", - "type": ".google.cloud.managedidentities.v1.Trust" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "AttachTrust", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.AttachTrust", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_async", - "title": "ManagedIdentitiesService reconfigureTrust Sample", - "origin": "API_DEFINITION", - "description": " Updates the DNS conditional forwarder.", - "canonical": true, - "file": "managed_identities_service.reconfigure_trust.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReconfigureTrust", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ReconfigureTrust", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "target_domain_name", - "type": "TYPE_STRING" - }, - { - "name": "target_dns_ip_addresses", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "ReconfigureTrust", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ReconfigureTrust", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_async", - "title": "ManagedIdentitiesService detachTrust Sample", - "origin": "API_DEFINITION", - "description": " Removes an AD trust.", - "canonical": true, - "file": "managed_identities_service.detach_trust.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DetachTrust", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.DetachTrust", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "trust", - "type": ".google.cloud.managedidentities.v1.Trust" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "DetachTrust", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.DetachTrust", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_async", - "title": "ManagedIdentitiesService validateTrust Sample", - "origin": "API_DEFINITION", - "description": " Validates a trust state, that the target domain is reachable, and that the target domain is able to accept incoming trust requests.", - "canonical": true, - "file": "managed_identities_service.validate_trust.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ValidateTrust", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ValidateTrust", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "trust", - "type": ".google.cloud.managedidentities.v1.Trust" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "ValidateTrust", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ValidateTrust", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/src/index.ts b/owl-bot-staging/google-cloud-managedidentities/v1/src/index.ts deleted file mode 100644 index 5a561f375b1..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/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 v1 from './v1'; -const ManagedIdentitiesServiceClient = v1.ManagedIdentitiesServiceClient; -type ManagedIdentitiesServiceClient = v1.ManagedIdentitiesServiceClient; -export {v1, ManagedIdentitiesServiceClient}; -export default {v1, ManagedIdentitiesServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/gapic_metadata.json deleted file mode 100644 index f9a5a085c68..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.managedidentities.v1", - "libraryPackage": "@google-cloud/managed-identities", - "services": { - "ManagedIdentitiesService": { - "clients": { - "grpc": { - "libraryClient": "ManagedIdentitiesServiceClient", - "rpcs": { - "ResetAdminPassword": { - "methods": [ - "resetAdminPassword" - ] - }, - "GetDomain": { - "methods": [ - "getDomain" - ] - }, - "CreateMicrosoftAdDomain": { - "methods": [ - "createMicrosoftAdDomain" - ] - }, - "UpdateDomain": { - "methods": [ - "updateDomain" - ] - }, - "DeleteDomain": { - "methods": [ - "deleteDomain" - ] - }, - "AttachTrust": { - "methods": [ - "attachTrust" - ] - }, - "ReconfigureTrust": { - "methods": [ - "reconfigureTrust" - ] - }, - "DetachTrust": { - "methods": [ - "detachTrust" - ] - }, - "ValidateTrust": { - "methods": [ - "validateTrust" - ] - }, - "ListDomains": { - "methods": [ - "listDomains", - "listDomainsStream", - "listDomainsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ManagedIdentitiesServiceClient", - "rpcs": { - "ResetAdminPassword": { - "methods": [ - "resetAdminPassword" - ] - }, - "GetDomain": { - "methods": [ - "getDomain" - ] - }, - "CreateMicrosoftAdDomain": { - "methods": [ - "createMicrosoftAdDomain" - ] - }, - "UpdateDomain": { - "methods": [ - "updateDomain" - ] - }, - "DeleteDomain": { - "methods": [ - "deleteDomain" - ] - }, - "AttachTrust": { - "methods": [ - "attachTrust" - ] - }, - "ReconfigureTrust": { - "methods": [ - "reconfigureTrust" - ] - }, - "DetachTrust": { - "methods": [ - "detachTrust" - ] - }, - "ValidateTrust": { - "methods": [ - "validateTrust" - ] - }, - "ListDomains": { - "methods": [ - "listDomains", - "listDomainsStream", - "listDomainsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/index.ts deleted file mode 100644 index b8fd8f0320d..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/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 {ManagedIdentitiesServiceClient} from './managed_identities_service_client'; diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_client.ts b/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_client.ts deleted file mode 100644 index bc5c56f4fb5..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_client.ts +++ /dev/null @@ -1,1574 +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, GrpcClientOptions, LROperation, 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/managed_identities_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './managed_identities_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * API Overview - * - * The `managedidentites.googleapis.com` service implements the Google Cloud - * Managed Identites API for identity services - * (e.g. Microsoft Active Directory). - * - * The Managed Identities service provides methods to manage - * (create/read/update/delete) domains, reset managed identities admin password, - * add/remove domain controllers in GCP regions and add/remove VPC peering. - * - * Data Model - * - * The Managed Identities service exposes the following resources: - * - * * Locations as global, named as follows: - * `projects/{project_id}/locations/global`. - * - * * Domains, named as follows: - * `/projects/{project_id}/locations/global/domain/{domain_name}`. - * - * The `{domain_name}` refers to fully qualified domain name in the customer - * project e.g. mydomain.myorganization.com, with the following restrictions: - * - * * Must contain only lowercase letters, numbers, periods and hyphens. - * * Must start with a letter. - * * Must contain between 2-64 characters. - * * Must end with a number or a letter. - * * Must not start with period. - * * First segement length (mydomain form example above) shouldn't exceed - * 15 chars. - * * The last segment cannot be fully numeric. - * * Must be unique within the customer project. - * @class - * @memberof v1 - */ -export class ManagedIdentitiesServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - managedIdentitiesServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ManagedIdentitiesServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 ManagedIdentitiesServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ManagedIdentitiesServiceClient; - 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 { - 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 = { - domainPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/domains/{domain}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - }; - - // 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 = { - listDomains: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'domains') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/global/domains/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/global/peerings/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/global/domains/*/backups/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/global/domains/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/global/peerings/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/global/domains/*/backups/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/global/domains/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/global/peerings/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/global/domains/*/backups/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/global/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/global/operations}',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createMicrosoftAdDomainResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; - const createMicrosoftAdDomainMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; - const updateDomainResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; - const updateDomainMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; - const deleteDomainResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteDomainMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; - const attachTrustResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; - const attachTrustMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; - const reconfigureTrustResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; - const reconfigureTrustMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; - const detachTrustResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; - const detachTrustMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; - const validateTrustResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; - const validateTrustMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createMicrosoftAdDomain: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createMicrosoftAdDomainResponse.decode.bind(createMicrosoftAdDomainResponse), - createMicrosoftAdDomainMetadata.decode.bind(createMicrosoftAdDomainMetadata)), - updateDomain: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateDomainResponse.decode.bind(updateDomainResponse), - updateDomainMetadata.decode.bind(updateDomainMetadata)), - deleteDomain: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteDomainResponse.decode.bind(deleteDomainResponse), - deleteDomainMetadata.decode.bind(deleteDomainMetadata)), - attachTrust: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - attachTrustResponse.decode.bind(attachTrustResponse), - attachTrustMetadata.decode.bind(attachTrustMetadata)), - reconfigureTrust: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - reconfigureTrustResponse.decode.bind(reconfigureTrustResponse), - reconfigureTrustMetadata.decode.bind(reconfigureTrustMetadata)), - detachTrust: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - detachTrustResponse.decode.bind(detachTrustResponse), - detachTrustMetadata.decode.bind(detachTrustMetadata)), - validateTrust: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - validateTrustResponse.decode.bind(validateTrustResponse), - validateTrustMetadata.decode.bind(validateTrustMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.managedidentities.v1.ManagedIdentitiesService', 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.managedIdentitiesServiceStub) { - return this.managedIdentitiesServiceStub; - } - - // Put together the "service stub" for - // google.cloud.managedidentities.v1.ManagedIdentitiesService. - this.managedIdentitiesServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.managedidentities.v1.ManagedIdentitiesService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.managedidentities.v1.ManagedIdentitiesService, - 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 managedIdentitiesServiceStubMethods = - ['createMicrosoftAdDomain', 'resetAdminPassword', 'listDomains', 'getDomain', 'updateDomain', 'deleteDomain', 'attachTrust', 'reconfigureTrust', 'detachTrust', 'validateTrust']; - for (const methodName of managedIdentitiesServiceStubMethods) { - const callPromise = this.managedIdentitiesServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.managedIdentitiesServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'managedidentities.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 'managedidentities.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 -- - // ------------------- -/** - * Resets a domain's administrator password. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.managedidentities.v1.ResetAdminPasswordResponse|ResetAdminPasswordResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/managed_identities_service.reset_admin_password.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ResetAdminPassword_async - */ - resetAdminPassword( - request?: protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|undefined, {}|undefined - ]>; - resetAdminPassword( - request: protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|null|undefined, - {}|null|undefined>): void; - resetAdminPassword( - request: protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest, - callback: Callback< - protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|null|undefined, - {}|null|undefined>): void; - resetAdminPassword( - request?: protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|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.resetAdminPassword(request, options, callback); - } -/** - * Gets information about a domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.managedidentities.v1.Domain|Domain}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/managed_identities_service.get_domain.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_GetDomain_async - */ - getDomain( - request?: protos.google.cloud.managedidentities.v1.IGetDomainRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.managedidentities.v1.IDomain, - protos.google.cloud.managedidentities.v1.IGetDomainRequest|undefined, {}|undefined - ]>; - getDomain( - request: protos.google.cloud.managedidentities.v1.IGetDomainRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.managedidentities.v1.IDomain, - protos.google.cloud.managedidentities.v1.IGetDomainRequest|null|undefined, - {}|null|undefined>): void; - getDomain( - request: protos.google.cloud.managedidentities.v1.IGetDomainRequest, - callback: Callback< - protos.google.cloud.managedidentities.v1.IDomain, - protos.google.cloud.managedidentities.v1.IGetDomainRequest|null|undefined, - {}|null|undefined>): void; - getDomain( - request?: protos.google.cloud.managedidentities.v1.IGetDomainRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.managedidentities.v1.IDomain, - protos.google.cloud.managedidentities.v1.IGetDomainRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.managedidentities.v1.IDomain, - protos.google.cloud.managedidentities.v1.IGetDomainRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.managedidentities.v1.IDomain, - protos.google.cloud.managedidentities.v1.IGetDomainRequest|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.getDomain(request, options, callback); - } - -/** - * Creates a Microsoft AD domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource project name and location using the form: - * `projects/{project_id}/locations/global` - * @param {string} request.domainName - * Required. The fully qualified domain name. - * e.g. mydomain.myorganization.com, with the following restrictions: - * - * * Must contain only lowercase letters, numbers, periods and hyphens. - * * Must start with a letter. - * * Must contain between 2-64 characters. - * * Must end with a number or a letter. - * * Must not start with period. - * * First segement length (mydomain form example above) shouldn't exceed - * 15 chars. - * * The last segment cannot be fully numeric. - * * Must be unique within the customer project. - * @param {google.cloud.managedidentities.v1.Domain} request.domain - * Required. A Managed Identity domain 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async - */ - createMicrosoftAdDomain( - request?: protos.google.cloud.managedidentities.v1.ICreateMicrosoftAdDomainRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createMicrosoftAdDomain( - request: protos.google.cloud.managedidentities.v1.ICreateMicrosoftAdDomainRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMicrosoftAdDomain( - request: protos.google.cloud.managedidentities.v1.ICreateMicrosoftAdDomainRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMicrosoftAdDomain( - request?: protos.google.cloud.managedidentities.v1.ICreateMicrosoftAdDomainRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createMicrosoftAdDomain(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createMicrosoftAdDomain()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async - */ - async checkCreateMicrosoftAdDomainProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMicrosoftAdDomain, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the metadata and configuration of a domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. At least one path must be supplied in this - * field. The elements of the repeated paths field may only include - * fields from {@link protos.google.cloud.managedidentities.v1.Domain|Domain}: - * * `labels` - * * `locations` - * * `authorized_networks` - * @param {google.cloud.managedidentities.v1.Domain} request.domain - * Required. Domain message with updated fields. Only supported fields specified in - * update_mask are updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/managed_identities_service.update_domain.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_async - */ - updateDomain( - request?: protos.google.cloud.managedidentities.v1.IUpdateDomainRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateDomain( - request: protos.google.cloud.managedidentities.v1.IUpdateDomainRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateDomain( - request: protos.google.cloud.managedidentities.v1.IUpdateDomainRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateDomain( - request?: protos.google.cloud.managedidentities.v1.IUpdateDomainRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'domain.name': request.domain!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateDomain(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateDomain()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/managed_identities_service.update_domain.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_async - */ - async checkUpdateDomainProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDomain, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/managed_identities_service.delete_domain.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_async - */ - deleteDomain( - request?: protos.google.cloud.managedidentities.v1.IDeleteDomainRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteDomain( - request: protos.google.cloud.managedidentities.v1.IDeleteDomainRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteDomain( - request: protos.google.cloud.managedidentities.v1.IDeleteDomainRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteDomain( - request?: protos.google.cloud.managedidentities.v1.IDeleteDomainRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteDomain(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteDomain()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/managed_identities_service.delete_domain.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_async - */ - async checkDeleteDomainProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteDomain, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Adds an AD trust to a domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource domain name, project name and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {google.cloud.managedidentities.v1.Trust} request.trust - * Required. The domain trust 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/managed_identities_service.attach_trust.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_async - */ - attachTrust( - request?: protos.google.cloud.managedidentities.v1.IAttachTrustRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - attachTrust( - request: protos.google.cloud.managedidentities.v1.IAttachTrustRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - attachTrust( - request: protos.google.cloud.managedidentities.v1.IAttachTrustRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - attachTrust( - request?: protos.google.cloud.managedidentities.v1.IAttachTrustRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.attachTrust(request, options, callback); - } -/** - * Check the status of the long running operation returned by `attachTrust()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/managed_identities_service.attach_trust.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_async - */ - async checkAttachTrustProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.attachTrust, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the DNS conditional forwarder. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource domain name, project name and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {string} request.targetDomainName - * Required. The fully-qualified target domain name which will be in trust with current - * domain. - * @param {string[]} request.targetDnsIpAddresses - * Required. The target DNS server IP addresses to resolve the remote domain involved - * in the trust. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/managed_identities_service.reconfigure_trust.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_async - */ - reconfigureTrust( - request?: protos.google.cloud.managedidentities.v1.IReconfigureTrustRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - reconfigureTrust( - request: protos.google.cloud.managedidentities.v1.IReconfigureTrustRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - reconfigureTrust( - request: protos.google.cloud.managedidentities.v1.IReconfigureTrustRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - reconfigureTrust( - request?: protos.google.cloud.managedidentities.v1.IReconfigureTrustRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.reconfigureTrust(request, options, callback); - } -/** - * Check the status of the long running operation returned by `reconfigureTrust()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/managed_identities_service.reconfigure_trust.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_async - */ - async checkReconfigureTrustProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.reconfigureTrust, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Removes an AD trust. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource domain name, project name, and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {google.cloud.managedidentities.v1.Trust} request.trust - * Required. The domain trust resource to removed. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/managed_identities_service.detach_trust.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_async - */ - detachTrust( - request?: protos.google.cloud.managedidentities.v1.IDetachTrustRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - detachTrust( - request: protos.google.cloud.managedidentities.v1.IDetachTrustRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - detachTrust( - request: protos.google.cloud.managedidentities.v1.IDetachTrustRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - detachTrust( - request?: protos.google.cloud.managedidentities.v1.IDetachTrustRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.detachTrust(request, options, callback); - } -/** - * Check the status of the long running operation returned by `detachTrust()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/managed_identities_service.detach_trust.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_async - */ - async checkDetachTrustProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.detachTrust, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Validates a trust state, that the target domain is reachable, and that the - * target domain is able to accept incoming trust requests. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource domain name, project name, and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {google.cloud.managedidentities.v1.Trust} request.trust - * Required. The domain trust to validate trust state for. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/managed_identities_service.validate_trust.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_async - */ - validateTrust( - request?: protos.google.cloud.managedidentities.v1.IValidateTrustRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - validateTrust( - request: protos.google.cloud.managedidentities.v1.IValidateTrustRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - validateTrust( - request: protos.google.cloud.managedidentities.v1.IValidateTrustRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - validateTrust( - request?: protos.google.cloud.managedidentities.v1.IValidateTrustRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.validateTrust(request, options, callback); - } -/** - * Check the status of the long running operation returned by `validateTrust()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/managed_identities_service.validate_trust.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_async - */ - async checkValidateTrustProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.validateTrust, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists domains in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the domain location using the form: - * `projects/{project_id}/locations/global` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return. - * If not specified, a default value of 1000 will be used. - * Regardless of the page_size value, the response may include a partial list. - * Callers should rely on a response's - * {@link protos.google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token|next_page_token} - * to determine if there are additional results to list. - * @param {string} [request.pageToken] - * Optional. The `next_page_token` value returned from a previous ListDomainsRequest - * request, if any. - * @param {string} [request.filter] - * Optional. A filter specifying constraints of a list operation. - * For example, `Domain.fqdn="mydomain.myorginization"`. - * @param {string} [request.orderBy] - * Optional. Specifies the ordering of results. See - * [Sorting - * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) - * for more information. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.managedidentities.v1.Domain|Domain}. - * 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 `listDomainsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDomains( - request?: protos.google.cloud.managedidentities.v1.IListDomainsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.managedidentities.v1.IDomain[], - protos.google.cloud.managedidentities.v1.IListDomainsRequest|null, - protos.google.cloud.managedidentities.v1.IListDomainsResponse - ]>; - listDomains( - request: protos.google.cloud.managedidentities.v1.IListDomainsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.managedidentities.v1.IListDomainsRequest, - protos.google.cloud.managedidentities.v1.IListDomainsResponse|null|undefined, - protos.google.cloud.managedidentities.v1.IDomain>): void; - listDomains( - request: protos.google.cloud.managedidentities.v1.IListDomainsRequest, - callback: PaginationCallback< - protos.google.cloud.managedidentities.v1.IListDomainsRequest, - protos.google.cloud.managedidentities.v1.IListDomainsResponse|null|undefined, - protos.google.cloud.managedidentities.v1.IDomain>): void; - listDomains( - request?: protos.google.cloud.managedidentities.v1.IListDomainsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.managedidentities.v1.IListDomainsRequest, - protos.google.cloud.managedidentities.v1.IListDomainsResponse|null|undefined, - protos.google.cloud.managedidentities.v1.IDomain>, - callback?: PaginationCallback< - protos.google.cloud.managedidentities.v1.IListDomainsRequest, - protos.google.cloud.managedidentities.v1.IListDomainsResponse|null|undefined, - protos.google.cloud.managedidentities.v1.IDomain>): - Promise<[ - protos.google.cloud.managedidentities.v1.IDomain[], - protos.google.cloud.managedidentities.v1.IListDomainsRequest|null, - protos.google.cloud.managedidentities.v1.IListDomainsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listDomains(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the domain location using the form: - * `projects/{project_id}/locations/global` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return. - * If not specified, a default value of 1000 will be used. - * Regardless of the page_size value, the response may include a partial list. - * Callers should rely on a response's - * {@link protos.google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token|next_page_token} - * to determine if there are additional results to list. - * @param {string} [request.pageToken] - * Optional. The `next_page_token` value returned from a previous ListDomainsRequest - * request, if any. - * @param {string} [request.filter] - * Optional. A filter specifying constraints of a list operation. - * For example, `Domain.fqdn="mydomain.myorginization"`. - * @param {string} [request.orderBy] - * Optional. Specifies the ordering of results. See - * [Sorting - * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) - * for more information. - * @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 protos.google.cloud.managedidentities.v1.Domain|Domain} 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 `listDomainsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDomainsStream( - request?: protos.google.cloud.managedidentities.v1.IListDomainsRequest, - 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['listDomains']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDomains.createStream( - this.innerApiCalls.listDomains as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDomains`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the domain location using the form: - * `projects/{project_id}/locations/global` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return. - * If not specified, a default value of 1000 will be used. - * Regardless of the page_size value, the response may include a partial list. - * Callers should rely on a response's - * {@link protos.google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token|next_page_token} - * to determine if there are additional results to list. - * @param {string} [request.pageToken] - * Optional. The `next_page_token` value returned from a previous ListDomainsRequest - * request, if any. - * @param {string} [request.filter] - * Optional. A filter specifying constraints of a list operation. - * For example, `Domain.fqdn="mydomain.myorginization"`. - * @param {string} [request.orderBy] - * Optional. Specifies the ordering of results. See - * [Sorting - * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) - * for more information. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.managedidentities.v1.Domain|Domain}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/managed_identities_service.list_domains.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ListDomains_async - */ - listDomainsAsync( - request?: protos.google.cloud.managedidentities.v1.IListDomainsRequest, - 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['listDomains']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDomains.asyncIterate( - this.innerApiCalls['listDomains'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified domain resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} domain - * @returns {string} Resource name string. - */ - domainPath(project:string,location:string,domain:string) { - return this.pathTemplates.domainPathTemplate.render({ - project: project, - location: location, - domain: domain, - }); - } - - /** - * Parse the project from Domain resource. - * - * @param {string} domainName - * A fully-qualified path representing Domain resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDomainName(domainName: string) { - return this.pathTemplates.domainPathTemplate.match(domainName).project; - } - - /** - * Parse the location from Domain resource. - * - * @param {string} domainName - * A fully-qualified path representing Domain resource. - * @returns {string} A string representing the location. - */ - matchLocationFromDomainName(domainName: string) { - return this.pathTemplates.domainPathTemplate.match(domainName).location; - } - - /** - * Parse the domain from Domain resource. - * - * @param {string} domainName - * A fully-qualified path representing Domain resource. - * @returns {string} A string representing the domain. - */ - matchDomainFromDomainName(domainName: string) { - return this.pathTemplates.domainPathTemplate.match(domainName).domain; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified 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; - } - - /** - * 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.managedIdentitiesServiceStub && !this._terminated) { - return this.managedIdentitiesServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_client_config.json b/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_client_config.json deleted file mode 100644 index 96889cb3b0d..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_client_config.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "interfaces": { - "google.cloud.managedidentities.v1.ManagedIdentitiesService": { - "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": { - "CreateMicrosoftAdDomain": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ResetAdminPassword": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListDomains": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetDomain": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateDomain": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteDomain": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AttachTrust": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReconfigureTrust": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DetachTrust": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ValidateTrust": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_proto_list.json b/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_proto_list.json deleted file mode 100644 index 6200ede0f78..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/src/v1/managed_identities_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/managedidentities/v1/managed_identities_service.proto", - "../../protos/google/cloud/managedidentities/v1/resource.proto" -] diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-managedidentities/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 19557c14fd8..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/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 managedidentities = require('@google-cloud/managed-identities'); - -function main() { - const managedIdentitiesServiceClient = new managedidentities.ManagedIdentitiesServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-managedidentities/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 58efb744a28..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/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 {ManagedIdentitiesServiceClient} from '@google-cloud/managed-identities'; - -// check that the client class type name can be used -function doStuffWithManagedIdentitiesServiceClient(client: ManagedIdentitiesServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const managedIdentitiesServiceClient = new ManagedIdentitiesServiceClient(); - doStuffWithManagedIdentitiesServiceClient(managedIdentitiesServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/system-test/install.ts b/owl-bot-staging/google-cloud-managedidentities/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1/test/gapic_managed_identities_service_v1.ts b/owl-bot-staging/google-cloud-managedidentities/v1/test/gapic_managed_identities_service_v1.ts deleted file mode 100644 index ca4c29002ed..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1/test/gapic_managed_identities_service_v1.ts +++ /dev/null @@ -1,1873 +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 managedidentitiesserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.ManagedIdentitiesServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.managedIdentitiesServiceStub, undefined); - await client.initialize(); - assert(client.managedIdentitiesServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.managedIdentitiesServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.managedIdentitiesServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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 managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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('resetAdminPassword', () => { - it('invokes resetAdminPassword without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ResetAdminPasswordRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ResetAdminPasswordRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ResetAdminPasswordResponse() - ); - client.innerApiCalls.resetAdminPassword = stubSimpleCall(expectedResponse); - const [response] = await client.resetAdminPassword(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetAdminPassword without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ResetAdminPasswordRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ResetAdminPasswordRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ResetAdminPasswordResponse() - ); - client.innerApiCalls.resetAdminPassword = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resetAdminPassword( - request, - (err?: Error|null, result?: protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetAdminPassword with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ResetAdminPasswordRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ResetAdminPasswordRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetAdminPassword = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resetAdminPassword(request), expectedError); - const actualRequest = (client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetAdminPassword with closed client', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ResetAdminPasswordRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ResetAdminPasswordRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.resetAdminPassword(request), expectedError); - }); - }); - - describe('getDomain', () => { - it('invokes getDomain without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.GetDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.GetDomainRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.Domain() - ); - client.innerApiCalls.getDomain = stubSimpleCall(expectedResponse); - const [response] = await client.getDomain(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDomain without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.GetDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.GetDomainRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.Domain() - ); - client.innerApiCalls.getDomain = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDomain( - request, - (err?: Error|null, result?: protos.google.cloud.managedidentities.v1.IDomain|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDomain with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.GetDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.GetDomainRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDomain = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDomain(request), expectedError); - const actualRequest = (client.innerApiCalls.getDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDomain with closed client', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.GetDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.GetDomainRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getDomain(request), expectedError); - }); - }); - - describe('createMicrosoftAdDomain', () => { - it('invokes createMicrosoftAdDomain without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMicrosoftAdDomain(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMicrosoftAdDomain without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMicrosoftAdDomain( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMicrosoftAdDomain with call error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMicrosoftAdDomain(request), expectedError); - const actualRequest = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMicrosoftAdDomain with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMicrosoftAdDomain(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateMicrosoftAdDomainProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateMicrosoftAdDomainProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateMicrosoftAdDomainProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMicrosoftAdDomainProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateDomain', () => { - it('invokes updateDomain without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.UpdateDomainRequest() - ); - request.domain ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.UpdateDomainRequest', ['domain', 'name']); - request.domain.name = defaultValue1; - const expectedHeaderRequestParams = `domain.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateDomain = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateDomain(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDomain without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.UpdateDomainRequest() - ); - request.domain ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.UpdateDomainRequest', ['domain', 'name']); - request.domain.name = defaultValue1; - const expectedHeaderRequestParams = `domain.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateDomain = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDomain( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDomain with call error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.UpdateDomainRequest() - ); - request.domain ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.UpdateDomainRequest', ['domain', 'name']); - request.domain.name = defaultValue1; - const expectedHeaderRequestParams = `domain.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDomain = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateDomain(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDomain with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.UpdateDomainRequest() - ); - request.domain ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.UpdateDomainRequest', ['domain', 'name']); - request.domain.name = defaultValue1; - const expectedHeaderRequestParams = `domain.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDomain = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateDomain(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateDomainProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateDomainProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateDomainProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateDomainProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteDomain', () => { - it('invokes deleteDomain without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.DeleteDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.DeleteDomainRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteDomain = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteDomain(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDomain without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.DeleteDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.DeleteDomainRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteDomain = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDomain( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDomain with call error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.DeleteDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.DeleteDomainRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDomain = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteDomain(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDomain with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.DeleteDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.DeleteDomainRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDomain = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteDomain(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteDomainProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteDomainProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteDomainProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteDomainProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('attachTrust', () => { - it('invokes attachTrust without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.AttachTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.AttachTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.attachTrust = stubLongRunningCall(expectedResponse); - const [operation] = await client.attachTrust(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attachTrust without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.AttachTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.AttachTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.attachTrust = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.attachTrust( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attachTrust with call error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.AttachTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.AttachTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.attachTrust = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.attachTrust(request), expectedError); - const actualRequest = (client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attachTrust with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.AttachTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.AttachTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.attachTrust = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.attachTrust(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAttachTrustProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAttachTrustProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAttachTrustProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAttachTrustProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('reconfigureTrust', () => { - it('invokes reconfigureTrust without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ReconfigureTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ReconfigureTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.reconfigureTrust = stubLongRunningCall(expectedResponse); - const [operation] = await client.reconfigureTrust(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reconfigureTrust without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ReconfigureTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ReconfigureTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.reconfigureTrust = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reconfigureTrust( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reconfigureTrust with call error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ReconfigureTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ReconfigureTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.reconfigureTrust = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.reconfigureTrust(request), expectedError); - const actualRequest = (client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reconfigureTrust with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ReconfigureTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ReconfigureTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.reconfigureTrust = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.reconfigureTrust(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkReconfigureTrustProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkReconfigureTrustProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkReconfigureTrustProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkReconfigureTrustProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('detachTrust', () => { - it('invokes detachTrust without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.DetachTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.DetachTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.detachTrust = stubLongRunningCall(expectedResponse); - const [operation] = await client.detachTrust(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes detachTrust without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.DetachTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.DetachTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.detachTrust = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.detachTrust( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes detachTrust with call error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.DetachTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.DetachTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.detachTrust = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.detachTrust(request), expectedError); - const actualRequest = (client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes detachTrust with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.DetachTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.DetachTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.detachTrust = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.detachTrust(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDetachTrustProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDetachTrustProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDetachTrustProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDetachTrustProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('validateTrust', () => { - it('invokes validateTrust without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ValidateTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ValidateTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.validateTrust = stubLongRunningCall(expectedResponse); - const [operation] = await client.validateTrust(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes validateTrust without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ValidateTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ValidateTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.validateTrust = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.validateTrust( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes validateTrust with call error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ValidateTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ValidateTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.validateTrust = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.validateTrust(request), expectedError); - const actualRequest = (client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes validateTrust with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ValidateTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ValidateTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.validateTrust = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.validateTrust(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkValidateTrustProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkValidateTrustProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkValidateTrustProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkValidateTrustProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listDomains', () => { - it('invokes listDomains without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ListDomainsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ListDomainsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - ]; - client.innerApiCalls.listDomains = stubSimpleCall(expectedResponse); - const [response] = await client.listDomains(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDomains as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDomains as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDomains without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ListDomainsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ListDomainsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - ]; - client.innerApiCalls.listDomains = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDomains( - request, - (err?: Error|null, result?: protos.google.cloud.managedidentities.v1.IDomain[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDomains as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDomains as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDomains with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ListDomainsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ListDomainsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDomains = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDomains(request), expectedError); - const actualRequest = (client.innerApiCalls.listDomains as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDomains as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDomainsStream without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ListDomainsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ListDomainsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - ]; - client.descriptors.page.listDomains.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDomainsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.managedidentities.v1.Domain[] = []; - stream.on('data', (response: protos.google.cloud.managedidentities.v1.Domain) => { - 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.listDomains.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDomains, request)); - assert( - (client.descriptors.page.listDomains.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDomainsStream with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ListDomainsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ListDomainsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDomains.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDomainsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.managedidentities.v1.Domain[] = []; - stream.on('data', (response: protos.google.cloud.managedidentities.v1.Domain) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDomains.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDomains, request)); - assert( - (client.descriptors.page.listDomains.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDomains without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ListDomainsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ListDomainsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - ]; - client.descriptors.page.listDomains.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.managedidentities.v1.IDomain[] = []; - const iterable = client.listDomainsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDomains.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDomains.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDomains with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1.ListDomainsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1.ListDomainsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDomains.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDomainsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.managedidentities.v1.IDomain[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDomains.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDomains.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('domain', () => { - const fakePath = "/rendered/path/domain"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - domain: "domainValue", - }; - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.domainPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.domainPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('domainPath', () => { - const result = client.domainPath("projectValue", "locationValue", "domainValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.domainPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDomainName', () => { - const result = client.matchProjectFromDomainName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.domainPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDomainName', () => { - const result = client.matchLocationFromDomainName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.domainPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDomainFromDomainName', () => { - const result = client.matchDomainFromDomainName(fakePath); - assert.strictEqual(result, "domainValue"); - assert((client.pathTemplates.domainPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-managedidentities/v1/tsconfig.json b/owl-bot-staging/google-cloud-managedidentities/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1/webpack.config.js b/owl-bot-staging/google-cloud-managedidentities/v1/webpack.config.js deleted file mode 100644 index 934d7017657..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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: 'ManagedIdentitiesService', - filename: './managed-identities-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-managedidentities/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-managedidentities/v1beta1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-managedidentities/v1beta1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/.gitignore b/owl-bot-staging/google-cloud-managedidentities/v1beta1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/.jsdoc.js deleted file mode 100644 index fe671cd4e4e..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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/managed-identities', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1beta1/README.md b/owl-bot-staging/google-cloud-managedidentities/v1beta1/README.md deleted file mode 100644 index 94f33d69900..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Managedidentities: Nodejs Client diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/package.json b/owl-bot-staging/google-cloud-managedidentities/v1beta1/package.json deleted file mode 100644 index fa591ecc6c5..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/managed-identities", - "version": "0.1.0", - "description": "Managedidentities client for Node.js", - "repository": "googleapis/nodejs-managedidentities", - "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 managedidentities", - "managedidentities", - "managed identities service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto b/owl-bot-staging/google-cloud-managedidentities/v1beta1/protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto deleted file mode 100644 index 8abe4a8c6df..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto +++ /dev/null @@ -1,389 +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.managedidentities.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/managedidentities/v1beta1/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ManagedIdentities.V1Beta1"; -option go_package = "cloud.google.com/go/managedidentities/apiv1beta1/managedidentitiespb;managedidentitiespb"; -option java_multiple_files = true; -option java_outer_classname = "ManagedIdentitiesServiceProto"; -option java_package = "com.google.cloud.managedidentities.v1beta1"; -option objc_class_prefix = "GCMI"; -option php_namespace = "Google\\Cloud\\ManagedIdentities\\V1beta1"; -option ruby_package = "Google::Cloud::ManagedIdentities::V1beta1"; - -service ManagedIdentitiesService { - option (google.api.default_host) = "managedidentities.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a Microsoft AD domain. - rpc CreateMicrosoftAdDomain(CreateMicrosoftAdDomainRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{parent=projects/*/locations/global}/domains" - body: "domain" - }; - option (google.api.method_signature) = "parent,domain_name,domain"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Resets a domain's administrator password. - rpc ResetAdminPassword(ResetAdminPasswordRequest) returns (ResetAdminPasswordResponse) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/global/domains/*}:resetAdminPassword" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Lists domains in a project. - rpc ListDomains(ListDomainsRequest) returns (ListDomainsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/global}/domains" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets information about a domain. - rpc GetDomain(GetDomainRequest) returns (Domain) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/global/domains/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the metadata and configuration of a domain. - rpc UpdateDomain(UpdateDomainRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta1/{domain.name=projects/*/locations/global/domains/*}" - body: "domain" - }; - option (google.api.method_signature) = "domain,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Deletes a domain. - rpc DeleteDomain(DeleteDomainRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta1/{name=projects/*/locations/global/domains/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OpMetadata" - }; - } - - // Adds an AD trust to a domain. - rpc AttachTrust(AttachTrustRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/global/domains/*}:attachTrust" - body: "*" - }; - option (google.api.method_signature) = "name,trust"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Updates the DNS conditional forwarder. - rpc ReconfigureTrust(ReconfigureTrustRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/global/domains/*}:reconfigureTrust" - body: "*" - }; - option (google.api.method_signature) = "name,target_domain_name,target_dns_ip_addresses"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Removes an AD trust. - rpc DetachTrust(DetachTrustRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/global/domains/*}:detachTrust" - body: "*" - }; - option (google.api.method_signature) = "name,trust"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Validates a trust state, that the target domain is reachable, and that the - // target domain is able to accept incoming trust requests. - rpc ValidateTrust(ValidateTrustRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/global/domains/*}:validateTrust" - body: "*" - }; - option (google.api.method_signature) = "name,trust"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } -} - -// Represents the metadata of the long-running operation. -message OpMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool requested_cancellation = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request message for -// [CreateMicrosoftAdDomain][google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomain] -message CreateMicrosoftAdDomainRequest { - // Required. The resource project name and location using the form: - // `projects/{project_id}/locations/global` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. A domain name, e.g. mydomain.myorg.com, with the following restrictions: - // * Must contain only lowercase letters, numbers, periods and hyphens. - // * Must start with a letter. - // * Must contain between 2-64 characters. - // * Must end with a number or a letter. - // * Must not start with period. - // * First segment length (mydomain form example above) shouldn't exceed - // 15 chars. - // * The last segment cannot be fully numeric. - // * Must be unique within the customer project. - string domain_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A Managed Identity domain resource. - Domain domain = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [ResetAdminPassword][google.cloud.managedidentities.v1beta1.ResetAdminPassword] -message ResetAdminPasswordRequest { - // Required. The domain resource name using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; -} - -// Response message for -// [ResetAdminPassword][google.cloud.managedidentities.v1beta1.ResetAdminPassword] -message ResetAdminPasswordResponse { - // A random password. See [admin][google.cloud.managedidentities.v1beta1.Domain.admin] for more information. - string password = 1; -} - -// Request message for -// [ListDomains][google.cloud.managedidentities.v1beta1.ListDomains] -message ListDomainsRequest { - // Required. The resource name of the domain location using the form: - // `projects/{project_id}/locations/global` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Optional. The maximum number of items to return. - // If not specified, a default value of 1000 will be used. - // Regardless of the page_size value, the response may include a partial list. - // Callers should rely on a response's - // [next_page_token][google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token] - // to determine if there are additional results to list. - int32 page_size = 2; - - // The `next_page_token` value returned from a previous ListDomainsRequest - // request, if any. - string page_token = 3; - - // Optional. A filter specifying constraints of a list operation. - // For example, `Domain.fqdn="mydomain.myorginization"`. - string filter = 4; - - // Optional. Specifies the ordering of results. See - // [Sorting - // order](https://cloud.google.com/apis/design/design_patterns#sorting_order) - // for more information. - string order_by = 5; -} - -// Response message for -// [ListDomains][google.cloud.managedidentities.v1beta1.ListDomains] -message ListDomainsResponse { - // A list of Managed Identities Service domains in the project. - repeated Domain domains = 1; - - // A token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; - - // A list of locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [GetDomain][google.cloud.managedidentities.v1beta1.GetDomain] -message GetDomainRequest { - // Required. The domain resource name using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; -} - -// Request message for -// [UpdateDomain][google.cloud.managedidentities.v1beta1.UpdateDomain] -message UpdateDomainRequest { - // Required. Mask of fields to update. At least one path must be supplied in this - // field. The elements of the repeated paths field may only include - // fields from [Domain][google.cloud.managedidentities.v1beta1.Domain]: - // * `labels` - // * `locations` - // * `authorized_networks` - // * `audit_logs_enabled` - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Domain message with updated fields. Only supported fields specified in - // update_mask are updated. - Domain domain = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [DeleteDomain][google.cloud.managedidentities.v1beta1.DeleteDomain] -message DeleteDomainRequest { - // Required. The domain resource name using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; -} - -// Request message for -// [AttachTrust][google.cloud.managedidentities.v1beta1.AttachTrust] -message AttachTrustRequest { - // Required. The resource domain name, project name and location using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The domain trust resource. - Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [ReconfigureTrust][google.cloud.managedidentities.v1beta1.ReconfigureTrust] -message ReconfigureTrustRequest { - // Required. The resource domain name, project name and location using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The fully-qualified target domain name which will be in trust with current - // domain. - string target_domain_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The target DNS server IP addresses to resolve the remote domain involved - // in the trust. - repeated string target_dns_ip_addresses = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [DetachTrust][google.cloud.managedidentities.v1beta1.DetachTrust] -message DetachTrustRequest { - // Required. The resource domain name, project name, and location using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The domain trust resource to removed. - Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [ValidateTrust][google.cloud.managedidentities.v1beta1.ValidateTrust] -message ValidateTrustRequest { - // Required. The resource domain name, project name, and location using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The domain trust to validate trust state for. - Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/protos/google/cloud/managedidentities/v1beta1/resource.proto b/owl-bot-staging/google-cloud-managedidentities/v1beta1/protos/google/cloud/managedidentities/v1beta1/resource.proto deleted file mode 100644 index 7fa7cc0c08b..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/protos/google/cloud/managedidentities/v1beta1/resource.proto +++ /dev/null @@ -1,216 +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.managedidentities.v1beta1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ManagedIdentities.V1Beta1"; -option go_package = "cloud.google.com/go/managedidentities/apiv1beta1/managedidentitiespb;managedidentitiespb"; -option java_multiple_files = true; -option java_outer_classname = "ResourceProto"; -option java_package = "com.google.cloud.managedidentities.v1beta1"; -option php_namespace = "Google\\Cloud\\ManagedIdentities\\V1beta1"; -option ruby_package = "Google::Cloud::ManagedIdentities::V1beta1"; - -// Represents a managed Microsoft Active Directory domain. -// If the domain is being changed, it will be placed into the UPDATING state, -// which indicates that the resource is being reconciled. At this point, Get -// will reflect an intermediate state. -message Domain { - option (google.api.resource) = { - type: "managedidentities.googleapis.com/Domain" - pattern: "projects/{project}/locations/{location}/domains/{domain}" - }; - - // Represents the different states of a managed domain. - enum State { - // Not set. - STATE_UNSPECIFIED = 0; - - // The domain is being created. - CREATING = 1; - - // The domain has been created and is fully usable. - READY = 2; - - // The domain's configuration is being updated. - UPDATING = 3; - - // The domain is being deleted. - DELETING = 4; - - // The domain is being repaired and may be unusable. Details - // can be found in the `status_message` field. - REPAIRING = 5; - - // The domain is undergoing maintenance. - PERFORMING_MAINTENANCE = 6; - - // The domain is not serving requests. - UNAVAILABLE = 7; - } - - // Output only. The unique name of the domain using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Resource labels that can contain user-provided metadata. - map labels = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The full names of the Google Compute Engine - // [networks](/compute/docs/networks-and-firewalls#networks) the domain - // instance is connected to. Networks can be added using UpdateDomain. - // The domain is only available on networks listed in `authorized_networks`. - // If CIDR subnets overlap between networks, domain creation will fail. - repeated string authorized_networks = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The CIDR range of internal addresses that are reserved for this - // domain. Reserved networks must be /24 or larger. Ranges must be - // unique and non-overlapping with existing subnets in - // [Domain].[authorized_networks]. - string reserved_ip_range = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. Locations where domain needs to be provisioned. - // [regions][compute/docs/regions-zones/] - // e.g. us-west1 or us-east4 - // Service supports up to 4 locations at once. Each location will use a /26 - // block. - repeated string locations = 5 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The name of delegated administrator account used to perform - // Active Directory operations. If not specified, `setupadmin` will be used. - string admin = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The fully-qualified domain name of the exposed domain used by - // clients to connect to the service. Similar to what would be chosen for an - // Active Directory set up on an internal network. - string fqdn = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the instance was created. - google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update time. - google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of this domain. - State state = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current status of this - // domain, if available. - string status_message = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current trusts associated with the domain. - repeated Trust trusts = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents a relationship between two domains. This allows a controller in -// one domain to authenticate a user in another domain. -message Trust { - // Represents the different states of a domain trust. - enum State { - // Not set. - STATE_UNSPECIFIED = 0; - - // The domain trust is being created. - CREATING = 1; - - // The domain trust is being updated. - UPDATING = 2; - - // The domain trust is being deleted. - DELETING = 3; - - // The domain trust is connected. - CONNECTED = 4; - - // The domain trust is disconnected. - DISCONNECTED = 5; - } - - // Represents the different inter-forest trust types. - enum TrustType { - // Not set. - TRUST_TYPE_UNSPECIFIED = 0; - - // The forest trust. - FOREST = 1; - - // The external domain trust. - EXTERNAL = 2; - } - - // Represents the direction of trust. - // See - // [System.DirectoryServices.ActiveDirectory.TrustDirection](https://docs.microsoft.com/en-us/dotnet/api/system.directoryservices.activedirectory.trustdirection?view=netframework-4.7.2) - // for more information. - enum TrustDirection { - // Not set. - TRUST_DIRECTION_UNSPECIFIED = 0; - - // The inbound direction represents the trusting side. - INBOUND = 1; - - // The outboud direction represents the trusted side. - OUTBOUND = 2; - - // The bidirectional direction represents the trusted / trusting side. - BIDIRECTIONAL = 3; - } - - // The fully qualified target domain name which will be in trust with the - // current domain. - string target_domain_name = 1; - - // The type of trust represented by the trust resource. - TrustType trust_type = 2; - - // The trust direction, which decides if the current domain is trusted, - // trusting, or both. - TrustDirection trust_direction = 3; - - // The trust authentication type, which decides whether the trusted side has - // forest/domain wide access or selective access to an approved set of - // resources. - bool selective_authentication = 4; - - // The target DNS server IP addresses which can resolve the remote domain - // involved in the trust. - repeated string target_dns_ip_addresses = 5; - - // Input only. The trust secret used for the handshake - // with the target domain. It will not be stored. - string trust_handshake_secret = 6 [(google.api.field_behavior) = INPUT_ONLY]; - - // Output only. The time the instance was created. - google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update time. - google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the trust. - State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current state of the - // trust, if available. - string state_description = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last heartbeat time when the trust was known to be - // connected. - google.protobuf.Timestamp last_trust_heartbeat_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.attach_trust.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.attach_trust.js deleted file mode 100644 index 50bf3636b7e..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.attach_trust.js +++ /dev/null @@ -1,68 +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, trust) { - // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_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 domain name, project name and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - /** - * Required. The domain trust resource. - */ - // const trust = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callAttachTrust() { - // Construct request - const request = { - name, - trust, - }; - - // Run request - const [operation] = await managedidentitiesClient.attachTrust(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAttachTrust(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js deleted file mode 100644 index 4c894996741..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js +++ /dev/null @@ -1,82 +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, domainName, domain) { - // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_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 project name and location using the form: - * `projects/{project_id}/locations/global` - */ - // const parent = 'abc123' - /** - * Required. A domain name, e.g. mydomain.myorg.com, with the following restrictions: - * * Must contain only lowercase letters, numbers, periods and hyphens. - * * Must start with a letter. - * * Must contain between 2-64 characters. - * * Must end with a number or a letter. - * * Must not start with period. - * * First segment length (mydomain form example above) shouldn't exceed - * 15 chars. - * * The last segment cannot be fully numeric. - * * Must be unique within the customer project. - */ - // const domainName = 'abc123' - /** - * Required. A Managed Identity domain resource. - */ - // const domain = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callCreateMicrosoftAdDomain() { - // Construct request - const request = { - parent, - domainName, - domain, - }; - - // Run request - const [operation] = await managedidentitiesClient.createMicrosoftAdDomain(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateMicrosoftAdDomain(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.delete_domain.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.delete_domain.js deleted file mode 100644 index 5763f1fb766..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.delete_domain.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 managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_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 domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callDeleteDomain() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await managedidentitiesClient.deleteDomain(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteDomain(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.detach_trust.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.detach_trust.js deleted file mode 100644 index e108972aef5..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.detach_trust.js +++ /dev/null @@ -1,68 +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, trust) { - // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_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 domain name, project name, and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - /** - * Required. The domain trust resource to removed. - */ - // const trust = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callDetachTrust() { - // Construct request - const request = { - name, - trust, - }; - - // Run request - const [operation] = await managedidentitiesClient.detachTrust(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDetachTrust(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.get_domain.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.get_domain.js deleted file mode 100644 index c0e7156cf1c..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.get_domain.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 managedidentities_v1beta1_generated_ManagedIdentitiesService_GetDomain_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 domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callGetDomain() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await managedidentitiesClient.getDomain(request); - console.log(response); - } - - callGetDomain(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_GetDomain_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.list_domains.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.list_domains.js deleted file mode 100644 index b41790dbac6..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.list_domains.js +++ /dev/null @@ -1,90 +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 managedidentities_v1beta1_generated_ManagedIdentitiesService_ListDomains_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the domain location using the form: - * `projects/{project_id}/locations/global` - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return. - * If not specified, a default value of 1000 will be used. - * Regardless of the page_size value, the response may include a partial list. - * Callers should rely on a response's - * next_page_token google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token - * to determine if there are additional results to list. - */ - // const pageSize = 1234 - /** - * The `next_page_token` value returned from a previous ListDomainsRequest - * request, if any. - */ - // const pageToken = 'abc123' - /** - * Optional. A filter specifying constraints of a list operation. - * For example, `Domain.fqdn="mydomain.myorginization"`. - */ - // const filter = 'abc123' - /** - * Optional. Specifies the ordering of results. See - * Sorting - * order (https://cloud.google.com/apis/design/design_patterns#sorting_order) - * for more information. - */ - // const orderBy = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callListDomains() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await managedidentitiesClient.listDomainsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDomains(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_ListDomains_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js deleted file mode 100644 index baba2066365..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js +++ /dev/null @@ -1,75 +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, targetDomainName, targetDnsIpAddresses) { - // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_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 domain name, project name and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - /** - * Required. The fully-qualified target domain name which will be in trust with current - * domain. - */ - // const targetDomainName = 'abc123' - /** - * Required. The target DNS server IP addresses to resolve the remote domain involved - * in the trust. - */ - // const targetDnsIpAddresses = ['abc','def'] - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callReconfigureTrust() { - // Construct request - const request = { - name, - targetDomainName, - targetDnsIpAddresses, - }; - - // Run request - const [operation] = await managedidentitiesClient.reconfigureTrust(request); - const [response] = await operation.promise(); - console.log(response); - } - - callReconfigureTrust(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.reset_admin_password.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.reset_admin_password.js deleted file mode 100644 index b75686772d1..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.reset_admin_password.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 managedidentities_v1beta1_generated_ManagedIdentitiesService_ResetAdminPassword_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 domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callResetAdminPassword() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await managedidentitiesClient.resetAdminPassword(request); - console.log(response); - } - - callResetAdminPassword(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_ResetAdminPassword_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.update_domain.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.update_domain.js deleted file mode 100644 index 02d32c37c05..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.update_domain.js +++ /dev/null @@ -1,74 +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(updateMask, domain) { - // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_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. Mask of fields to update. At least one path must be supplied in this - * field. The elements of the repeated paths field may only include - * fields from Domain google.cloud.managedidentities.v1beta1.Domain: - * * `labels` - * * `locations` - * * `authorized_networks` - * * `audit_logs_enabled` - */ - // const updateMask = {} - /** - * Required. Domain message with updated fields. Only supported fields specified in - * update_mask are updated. - */ - // const domain = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callUpdateDomain() { - // Construct request - const request = { - updateMask, - domain, - }; - - // Run request - const [operation] = await managedidentitiesClient.updateDomain(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateDomain(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_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-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.validate_trust.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.validate_trust.js deleted file mode 100644 index 88731f3c320..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/managed_identities_service.validate_trust.js +++ /dev/null @@ -1,68 +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, trust) { - // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_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 domain name, project name, and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - /** - * Required. The domain trust to validate trust state for. - */ - // const trust = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callValidateTrust() { - // Construct request - const request = { - name, - trust, - }; - - // Run request - const [operation] = await managedidentitiesClient.validateTrust(request); - const [response] = await operation.promise(); - console.log(response); - } - - callValidateTrust(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_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-managedidentities/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.managedidentities.v1beta1.json b/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.managedidentities.v1beta1.json deleted file mode 100644 index 006c222675d..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.managedidentities.v1beta1.json +++ /dev/null @@ -1,463 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-managedidentities", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.managedidentities.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async", - "title": "ManagedIdentitiesService createMicrosoftAdDomain Sample", - "origin": "API_DEFINITION", - "description": " Creates a Microsoft AD domain.", - "canonical": true, - "file": "managed_identities_service.create_microsoft_ad_domain.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMicrosoftAdDomain", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.CreateMicrosoftAdDomain", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "domain_name", - "type": "TYPE_STRING" - }, - { - "name": "domain", - "type": ".google.cloud.managedidentities.v1beta1.Domain" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "CreateMicrosoftAdDomain", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.CreateMicrosoftAdDomain", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_ResetAdminPassword_async", - "title": "ManagedIdentitiesService resetAdminPassword Sample", - "origin": "API_DEFINITION", - "description": " Resets a domain's administrator password.", - "canonical": true, - "file": "managed_identities_service.reset_admin_password.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResetAdminPassword", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ResetAdminPassword", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.managedidentities.v1beta1.ResetAdminPasswordResponse", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "ResetAdminPassword", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ResetAdminPassword", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_ListDomains_async", - "title": "ManagedIdentitiesService listDomains Sample", - "origin": "API_DEFINITION", - "description": " Lists domains in a project.", - "canonical": true, - "file": "managed_identities_service.list_domains.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDomains", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ListDomains", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.managedidentities.v1beta1.ListDomainsResponse", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "ListDomains", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ListDomains", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_GetDomain_async", - "title": "ManagedIdentitiesService getDomain Sample", - "origin": "API_DEFINITION", - "description": " Gets information about a domain.", - "canonical": true, - "file": "managed_identities_service.get_domain.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDomain", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.GetDomain", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.managedidentities.v1beta1.Domain", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "GetDomain", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.GetDomain", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_async", - "title": "ManagedIdentitiesService updateDomain Sample", - "origin": "API_DEFINITION", - "description": " Updates the metadata and configuration of a domain.", - "canonical": true, - "file": "managed_identities_service.update_domain.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateDomain", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.UpdateDomain", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "domain", - "type": ".google.cloud.managedidentities.v1beta1.Domain" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "UpdateDomain", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.UpdateDomain", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_async", - "title": "ManagedIdentitiesService deleteDomain Sample", - "origin": "API_DEFINITION", - "description": " Deletes a domain.", - "canonical": true, - "file": "managed_identities_service.delete_domain.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDomain", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.DeleteDomain", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "DeleteDomain", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.DeleteDomain", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_async", - "title": "ManagedIdentitiesService attachTrust Sample", - "origin": "API_DEFINITION", - "description": " Adds an AD trust to a domain.", - "canonical": true, - "file": "managed_identities_service.attach_trust.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AttachTrust", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.AttachTrust", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "trust", - "type": ".google.cloud.managedidentities.v1beta1.Trust" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "AttachTrust", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.AttachTrust", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_async", - "title": "ManagedIdentitiesService reconfigureTrust Sample", - "origin": "API_DEFINITION", - "description": " Updates the DNS conditional forwarder.", - "canonical": true, - "file": "managed_identities_service.reconfigure_trust.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReconfigureTrust", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ReconfigureTrust", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "target_domain_name", - "type": "TYPE_STRING" - }, - { - "name": "target_dns_ip_addresses", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "ReconfigureTrust", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ReconfigureTrust", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_async", - "title": "ManagedIdentitiesService detachTrust Sample", - "origin": "API_DEFINITION", - "description": " Removes an AD trust.", - "canonical": true, - "file": "managed_identities_service.detach_trust.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DetachTrust", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.DetachTrust", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "trust", - "type": ".google.cloud.managedidentities.v1beta1.Trust" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "DetachTrust", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.DetachTrust", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_async", - "title": "ManagedIdentitiesService validateTrust Sample", - "origin": "API_DEFINITION", - "description": " Validates a trust state, that the target domain is reachable, and that the target domain is able to accept incoming trust requests.", - "canonical": true, - "file": "managed_identities_service.validate_trust.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ValidateTrust", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ValidateTrust", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "trust", - "type": ".google.cloud.managedidentities.v1beta1.Trust" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "ValidateTrust", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ValidateTrust", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/index.ts deleted file mode 100644 index d6ef87eaf1c..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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 ManagedIdentitiesServiceClient = v1beta1.ManagedIdentitiesServiceClient; -type ManagedIdentitiesServiceClient = v1beta1.ManagedIdentitiesServiceClient; -export {v1beta1, ManagedIdentitiesServiceClient}; -export default {v1beta1, ManagedIdentitiesServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/gapic_metadata.json deleted file mode 100644 index 7566a4e2905..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/gapic_metadata.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.managedidentities.v1beta1", - "libraryPackage": "@google-cloud/managed-identities", - "services": { - "ManagedIdentitiesService": { - "clients": { - "grpc": { - "libraryClient": "ManagedIdentitiesServiceClient", - "rpcs": { - "ResetAdminPassword": { - "methods": [ - "resetAdminPassword" - ] - }, - "GetDomain": { - "methods": [ - "getDomain" - ] - }, - "CreateMicrosoftAdDomain": { - "methods": [ - "createMicrosoftAdDomain" - ] - }, - "UpdateDomain": { - "methods": [ - "updateDomain" - ] - }, - "DeleteDomain": { - "methods": [ - "deleteDomain" - ] - }, - "AttachTrust": { - "methods": [ - "attachTrust" - ] - }, - "ReconfigureTrust": { - "methods": [ - "reconfigureTrust" - ] - }, - "DetachTrust": { - "methods": [ - "detachTrust" - ] - }, - "ValidateTrust": { - "methods": [ - "validateTrust" - ] - }, - "ListDomains": { - "methods": [ - "listDomains", - "listDomainsStream", - "listDomainsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ManagedIdentitiesServiceClient", - "rpcs": { - "ResetAdminPassword": { - "methods": [ - "resetAdminPassword" - ] - }, - "GetDomain": { - "methods": [ - "getDomain" - ] - }, - "CreateMicrosoftAdDomain": { - "methods": [ - "createMicrosoftAdDomain" - ] - }, - "UpdateDomain": { - "methods": [ - "updateDomain" - ] - }, - "DeleteDomain": { - "methods": [ - "deleteDomain" - ] - }, - "AttachTrust": { - "methods": [ - "attachTrust" - ] - }, - "ReconfigureTrust": { - "methods": [ - "reconfigureTrust" - ] - }, - "DetachTrust": { - "methods": [ - "detachTrust" - ] - }, - "ValidateTrust": { - "methods": [ - "validateTrust" - ] - }, - "ListDomains": { - "methods": [ - "listDomains", - "listDomainsStream", - "listDomainsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/index.ts deleted file mode 100644 index b8fd8f0320d..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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 {ManagedIdentitiesServiceClient} from './managed_identities_service_client'; diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_client.ts b/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_client.ts deleted file mode 100644 index 0042fb75503..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_client.ts +++ /dev/null @@ -1,1541 +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, GrpcClientOptions, LROperation, 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/v1beta1/managed_identities_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './managed_identities_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * @class - * @memberof v1beta1 - */ -export class ManagedIdentitiesServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - managedIdentitiesServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ManagedIdentitiesServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 ManagedIdentitiesServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ManagedIdentitiesServiceClient; - 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 { - 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 = { - domainPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/domains/{domain}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - }; - - // 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 = { - listDomains: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'domains') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta1/{resource=projects/*/locations/global/domains/*}:getIamPolicy',additional_bindings: [{get: '/v1beta1/{resource=projects/*/locations/global/peerings/*}:getIamPolicy',},{get: '/v1beta1/{resource=projects/*/locations/global/domains/*/backups/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta1/{resource=projects/*/locations/global/domains/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta1/{resource=projects/*/locations/global/peerings/*}:setIamPolicy',body: '*',},{post: '/v1beta1/{resource=projects/*/locations/global/domains/*/backups/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta1/{resource=projects/*/locations/global/domains/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta1/{resource=projects/*/locations/global/peerings/*}:testIamPermissions',body: '*',},{post: '/v1beta1/{resource=projects/*/locations/global/domains/*/backups/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=projects/*/locations/global/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/{name=projects/*/locations/global/operations}',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createMicrosoftAdDomainResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; - const createMicrosoftAdDomainMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; - const updateDomainResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; - const updateDomainMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; - const deleteDomainResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteDomainMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; - const attachTrustResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; - const attachTrustMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; - const reconfigureTrustResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; - const reconfigureTrustMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; - const detachTrustResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; - const detachTrustMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; - const validateTrustResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; - const validateTrustMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createMicrosoftAdDomain: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createMicrosoftAdDomainResponse.decode.bind(createMicrosoftAdDomainResponse), - createMicrosoftAdDomainMetadata.decode.bind(createMicrosoftAdDomainMetadata)), - updateDomain: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateDomainResponse.decode.bind(updateDomainResponse), - updateDomainMetadata.decode.bind(updateDomainMetadata)), - deleteDomain: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteDomainResponse.decode.bind(deleteDomainResponse), - deleteDomainMetadata.decode.bind(deleteDomainMetadata)), - attachTrust: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - attachTrustResponse.decode.bind(attachTrustResponse), - attachTrustMetadata.decode.bind(attachTrustMetadata)), - reconfigureTrust: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - reconfigureTrustResponse.decode.bind(reconfigureTrustResponse), - reconfigureTrustMetadata.decode.bind(reconfigureTrustMetadata)), - detachTrust: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - detachTrustResponse.decode.bind(detachTrustResponse), - detachTrustMetadata.decode.bind(detachTrustMetadata)), - validateTrust: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - validateTrustResponse.decode.bind(validateTrustResponse), - validateTrustMetadata.decode.bind(validateTrustMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.managedidentities.v1beta1.ManagedIdentitiesService', 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.managedIdentitiesServiceStub) { - return this.managedIdentitiesServiceStub; - } - - // Put together the "service stub" for - // google.cloud.managedidentities.v1beta1.ManagedIdentitiesService. - this.managedIdentitiesServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.managedidentities.v1beta1.ManagedIdentitiesService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.managedidentities.v1beta1.ManagedIdentitiesService, - 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 managedIdentitiesServiceStubMethods = - ['createMicrosoftAdDomain', 'resetAdminPassword', 'listDomains', 'getDomain', 'updateDomain', 'deleteDomain', 'attachTrust', 'reconfigureTrust', 'detachTrust', 'validateTrust']; - for (const methodName of managedIdentitiesServiceStubMethods) { - const callPromise = this.managedIdentitiesServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.managedIdentitiesServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'managedidentities.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 'managedidentities.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 -- - // ------------------- -/** - * Resets a domain's administrator password. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordResponse|ResetAdminPasswordResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/managed_identities_service.reset_admin_password.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ResetAdminPassword_async - */ - resetAdminPassword( - request?: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|undefined, {}|undefined - ]>; - resetAdminPassword( - request: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|null|undefined, - {}|null|undefined>): void; - resetAdminPassword( - request: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest, - callback: Callback< - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|null|undefined, - {}|null|undefined>): void; - resetAdminPassword( - request?: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|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.resetAdminPassword(request, options, callback); - } -/** - * Gets information about a domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.managedidentities.v1beta1.Domain|Domain}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/managed_identities_service.get_domain.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_GetDomain_async - */ - getDomain( - request?: protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.managedidentities.v1beta1.IDomain, - protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|undefined, {}|undefined - ]>; - getDomain( - request: protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.managedidentities.v1beta1.IDomain, - protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|null|undefined, - {}|null|undefined>): void; - getDomain( - request: protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest, - callback: Callback< - protos.google.cloud.managedidentities.v1beta1.IDomain, - protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|null|undefined, - {}|null|undefined>): void; - getDomain( - request?: protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.managedidentities.v1beta1.IDomain, - protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.managedidentities.v1beta1.IDomain, - protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.managedidentities.v1beta1.IDomain, - protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|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.getDomain(request, options, callback); - } - -/** - * Creates a Microsoft AD domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource project name and location using the form: - * `projects/{project_id}/locations/global` - * @param {string} request.domainName - * Required. A domain name, e.g. mydomain.myorg.com, with the following restrictions: - * * Must contain only lowercase letters, numbers, periods and hyphens. - * * Must start with a letter. - * * Must contain between 2-64 characters. - * * Must end with a number or a letter. - * * Must not start with period. - * * First segment length (mydomain form example above) shouldn't exceed - * 15 chars. - * * The last segment cannot be fully numeric. - * * Must be unique within the customer project. - * @param {google.cloud.managedidentities.v1beta1.Domain} request.domain - * Required. A Managed Identity domain 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async - */ - createMicrosoftAdDomain( - request?: protos.google.cloud.managedidentities.v1beta1.ICreateMicrosoftAdDomainRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createMicrosoftAdDomain( - request: protos.google.cloud.managedidentities.v1beta1.ICreateMicrosoftAdDomainRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMicrosoftAdDomain( - request: protos.google.cloud.managedidentities.v1beta1.ICreateMicrosoftAdDomainRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMicrosoftAdDomain( - request?: protos.google.cloud.managedidentities.v1beta1.ICreateMicrosoftAdDomainRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createMicrosoftAdDomain(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createMicrosoftAdDomain()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async - */ - async checkCreateMicrosoftAdDomainProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMicrosoftAdDomain, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the metadata and configuration of a domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. At least one path must be supplied in this - * field. The elements of the repeated paths field may only include - * fields from {@link protos.google.cloud.managedidentities.v1beta1.Domain|Domain}: - * * `labels` - * * `locations` - * * `authorized_networks` - * * `audit_logs_enabled` - * @param {google.cloud.managedidentities.v1beta1.Domain} request.domain - * Required. Domain message with updated fields. Only supported fields specified in - * update_mask are updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/managed_identities_service.update_domain.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_async - */ - updateDomain( - request?: protos.google.cloud.managedidentities.v1beta1.IUpdateDomainRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateDomain( - request: protos.google.cloud.managedidentities.v1beta1.IUpdateDomainRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateDomain( - request: protos.google.cloud.managedidentities.v1beta1.IUpdateDomainRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateDomain( - request?: protos.google.cloud.managedidentities.v1beta1.IUpdateDomainRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'domain.name': request.domain!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateDomain(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateDomain()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/managed_identities_service.update_domain.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_async - */ - async checkUpdateDomainProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDomain, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/managed_identities_service.delete_domain.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_async - */ - deleteDomain( - request?: protos.google.cloud.managedidentities.v1beta1.IDeleteDomainRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteDomain( - request: protos.google.cloud.managedidentities.v1beta1.IDeleteDomainRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteDomain( - request: protos.google.cloud.managedidentities.v1beta1.IDeleteDomainRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteDomain( - request?: protos.google.cloud.managedidentities.v1beta1.IDeleteDomainRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteDomain(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteDomain()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/managed_identities_service.delete_domain.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_async - */ - async checkDeleteDomainProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteDomain, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Adds an AD trust to a domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource domain name, project name and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {google.cloud.managedidentities.v1beta1.Trust} request.trust - * Required. The domain trust 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/managed_identities_service.attach_trust.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_async - */ - attachTrust( - request?: protos.google.cloud.managedidentities.v1beta1.IAttachTrustRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - attachTrust( - request: protos.google.cloud.managedidentities.v1beta1.IAttachTrustRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - attachTrust( - request: protos.google.cloud.managedidentities.v1beta1.IAttachTrustRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - attachTrust( - request?: protos.google.cloud.managedidentities.v1beta1.IAttachTrustRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.attachTrust(request, options, callback); - } -/** - * Check the status of the long running operation returned by `attachTrust()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/managed_identities_service.attach_trust.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_async - */ - async checkAttachTrustProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.attachTrust, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the DNS conditional forwarder. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource domain name, project name and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {string} request.targetDomainName - * Required. The fully-qualified target domain name which will be in trust with current - * domain. - * @param {string[]} request.targetDnsIpAddresses - * Required. The target DNS server IP addresses to resolve the remote domain involved - * in the trust. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_async - */ - reconfigureTrust( - request?: protos.google.cloud.managedidentities.v1beta1.IReconfigureTrustRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - reconfigureTrust( - request: protos.google.cloud.managedidentities.v1beta1.IReconfigureTrustRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - reconfigureTrust( - request: protos.google.cloud.managedidentities.v1beta1.IReconfigureTrustRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - reconfigureTrust( - request?: protos.google.cloud.managedidentities.v1beta1.IReconfigureTrustRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.reconfigureTrust(request, options, callback); - } -/** - * Check the status of the long running operation returned by `reconfigureTrust()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_async - */ - async checkReconfigureTrustProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.reconfigureTrust, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Removes an AD trust. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource domain name, project name, and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {google.cloud.managedidentities.v1beta1.Trust} request.trust - * Required. The domain trust resource to removed. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/managed_identities_service.detach_trust.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_async - */ - detachTrust( - request?: protos.google.cloud.managedidentities.v1beta1.IDetachTrustRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - detachTrust( - request: protos.google.cloud.managedidentities.v1beta1.IDetachTrustRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - detachTrust( - request: protos.google.cloud.managedidentities.v1beta1.IDetachTrustRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - detachTrust( - request?: protos.google.cloud.managedidentities.v1beta1.IDetachTrustRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.detachTrust(request, options, callback); - } -/** - * Check the status of the long running operation returned by `detachTrust()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/managed_identities_service.detach_trust.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_async - */ - async checkDetachTrustProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.detachTrust, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Validates a trust state, that the target domain is reachable, and that the - * target domain is able to accept incoming trust requests. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource domain name, project name, and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {google.cloud.managedidentities.v1beta1.Trust} request.trust - * Required. The domain trust to validate trust state for. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/managed_identities_service.validate_trust.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_async - */ - validateTrust( - request?: protos.google.cloud.managedidentities.v1beta1.IValidateTrustRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - validateTrust( - request: protos.google.cloud.managedidentities.v1beta1.IValidateTrustRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - validateTrust( - request: protos.google.cloud.managedidentities.v1beta1.IValidateTrustRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - validateTrust( - request?: protos.google.cloud.managedidentities.v1beta1.IValidateTrustRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.validateTrust(request, options, callback); - } -/** - * Check the status of the long running operation returned by `validateTrust()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/managed_identities_service.validate_trust.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_async - */ - async checkValidateTrustProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.validateTrust, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists domains in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the domain location using the form: - * `projects/{project_id}/locations/global` - * @param {number} request.pageSize - * Optional. The maximum number of items to return. - * If not specified, a default value of 1000 will be used. - * Regardless of the page_size value, the response may include a partial list. - * Callers should rely on a response's - * {@link protos.google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token|next_page_token} - * to determine if there are additional results to list. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous ListDomainsRequest - * request, if any. - * @param {string} request.filter - * Optional. A filter specifying constraints of a list operation. - * For example, `Domain.fqdn="mydomain.myorginization"`. - * @param {string} request.orderBy - * Optional. Specifies the ordering of results. See - * [Sorting - * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) - * for more information. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.managedidentities.v1beta1.Domain|Domain}. - * 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 `listDomainsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDomains( - request?: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.managedidentities.v1beta1.IDomain[], - protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest|null, - protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse - ]>; - listDomains( - request: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse|null|undefined, - protos.google.cloud.managedidentities.v1beta1.IDomain>): void; - listDomains( - request: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - callback: PaginationCallback< - protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse|null|undefined, - protos.google.cloud.managedidentities.v1beta1.IDomain>): void; - listDomains( - request?: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse|null|undefined, - protos.google.cloud.managedidentities.v1beta1.IDomain>, - callback?: PaginationCallback< - protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse|null|undefined, - protos.google.cloud.managedidentities.v1beta1.IDomain>): - Promise<[ - protos.google.cloud.managedidentities.v1beta1.IDomain[], - protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest|null, - protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listDomains(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the domain location using the form: - * `projects/{project_id}/locations/global` - * @param {number} request.pageSize - * Optional. The maximum number of items to return. - * If not specified, a default value of 1000 will be used. - * Regardless of the page_size value, the response may include a partial list. - * Callers should rely on a response's - * {@link protos.google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token|next_page_token} - * to determine if there are additional results to list. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous ListDomainsRequest - * request, if any. - * @param {string} request.filter - * Optional. A filter specifying constraints of a list operation. - * For example, `Domain.fqdn="mydomain.myorginization"`. - * @param {string} request.orderBy - * Optional. Specifies the ordering of results. See - * [Sorting - * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) - * for more information. - * @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 protos.google.cloud.managedidentities.v1beta1.Domain|Domain} 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 `listDomainsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDomainsStream( - request?: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - 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['listDomains']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDomains.createStream( - this.innerApiCalls.listDomains as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDomains`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the domain location using the form: - * `projects/{project_id}/locations/global` - * @param {number} request.pageSize - * Optional. The maximum number of items to return. - * If not specified, a default value of 1000 will be used. - * Regardless of the page_size value, the response may include a partial list. - * Callers should rely on a response's - * {@link protos.google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token|next_page_token} - * to determine if there are additional results to list. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous ListDomainsRequest - * request, if any. - * @param {string} request.filter - * Optional. A filter specifying constraints of a list operation. - * For example, `Domain.fqdn="mydomain.myorginization"`. - * @param {string} request.orderBy - * Optional. Specifies the ordering of results. See - * [Sorting - * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) - * for more information. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.managedidentities.v1beta1.Domain|Domain}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/managed_identities_service.list_domains.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ListDomains_async - */ - listDomainsAsync( - request?: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - 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['listDomains']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDomains.asyncIterate( - this.innerApiCalls['listDomains'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified domain resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} domain - * @returns {string} Resource name string. - */ - domainPath(project:string,location:string,domain:string) { - return this.pathTemplates.domainPathTemplate.render({ - project: project, - location: location, - domain: domain, - }); - } - - /** - * Parse the project from Domain resource. - * - * @param {string} domainName - * A fully-qualified path representing Domain resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDomainName(domainName: string) { - return this.pathTemplates.domainPathTemplate.match(domainName).project; - } - - /** - * Parse the location from Domain resource. - * - * @param {string} domainName - * A fully-qualified path representing Domain resource. - * @returns {string} A string representing the location. - */ - matchLocationFromDomainName(domainName: string) { - return this.pathTemplates.domainPathTemplate.match(domainName).location; - } - - /** - * Parse the domain from Domain resource. - * - * @param {string} domainName - * A fully-qualified path representing Domain resource. - * @returns {string} A string representing the domain. - */ - matchDomainFromDomainName(domainName: string) { - return this.pathTemplates.domainPathTemplate.match(domainName).domain; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified 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; - } - - /** - * 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.managedIdentitiesServiceStub && !this._terminated) { - return this.managedIdentitiesServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_client_config.json b/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_client_config.json deleted file mode 100644 index c863d5ec9a6..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_client_config.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService": { - "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": { - "CreateMicrosoftAdDomain": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ResetAdminPassword": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListDomains": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetDomain": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateDomain": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteDomain": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AttachTrust": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReconfigureTrust": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DetachTrust": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ValidateTrust": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_proto_list.json b/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_proto_list.json deleted file mode 100644 index dbe47297a1a..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/src/v1beta1/managed_identities_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto", - "../../protos/google/cloud/managedidentities/v1beta1/resource.proto" -] diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 19557c14fd8..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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 managedidentities = require('@google-cloud/managed-identities'); - -function main() { - const managedIdentitiesServiceClient = new managedidentities.ManagedIdentitiesServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 58efb744a28..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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 {ManagedIdentitiesServiceClient} from '@google-cloud/managed-identities'; - -// check that the client class type name can be used -function doStuffWithManagedIdentitiesServiceClient(client: ManagedIdentitiesServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const managedIdentitiesServiceClient = new ManagedIdentitiesServiceClient(); - doStuffWithManagedIdentitiesServiceClient(managedIdentitiesServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-managedidentities/v1beta1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1beta1/test/gapic_managed_identities_service_v1beta1.ts b/owl-bot-staging/google-cloud-managedidentities/v1beta1/test/gapic_managed_identities_service_v1beta1.ts deleted file mode 100644 index 62863e662c4..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/v1beta1/test/gapic_managed_identities_service_v1beta1.ts +++ /dev/null @@ -1,1873 +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 managedidentitiesserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.ManagedIdentitiesServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.managedIdentitiesServiceStub, undefined); - await client.initialize(); - assert(client.managedIdentitiesServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.managedIdentitiesServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.managedIdentitiesServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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 managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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('resetAdminPassword', () => { - it('invokes resetAdminPassword without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordResponse() - ); - client.innerApiCalls.resetAdminPassword = stubSimpleCall(expectedResponse); - const [response] = await client.resetAdminPassword(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetAdminPassword without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordResponse() - ); - client.innerApiCalls.resetAdminPassword = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resetAdminPassword( - request, - (err?: Error|null, result?: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetAdminPassword with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetAdminPassword = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resetAdminPassword(request), expectedError); - const actualRequest = (client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetAdminPassword with closed client', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.resetAdminPassword(request), expectedError); - }); - }); - - describe('getDomain', () => { - it('invokes getDomain without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.GetDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.GetDomainRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.Domain() - ); - client.innerApiCalls.getDomain = stubSimpleCall(expectedResponse); - const [response] = await client.getDomain(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDomain without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.GetDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.GetDomainRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.Domain() - ); - client.innerApiCalls.getDomain = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDomain( - request, - (err?: Error|null, result?: protos.google.cloud.managedidentities.v1beta1.IDomain|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDomain with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.GetDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.GetDomainRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDomain = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDomain(request), expectedError); - const actualRequest = (client.innerApiCalls.getDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDomain with closed client', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.GetDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.GetDomainRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getDomain(request), expectedError); - }); - }); - - describe('createMicrosoftAdDomain', () => { - it('invokes createMicrosoftAdDomain without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMicrosoftAdDomain(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMicrosoftAdDomain without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMicrosoftAdDomain( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMicrosoftAdDomain with call error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMicrosoftAdDomain(request), expectedError); - const actualRequest = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMicrosoftAdDomain with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMicrosoftAdDomain(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateMicrosoftAdDomainProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateMicrosoftAdDomainProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateMicrosoftAdDomainProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMicrosoftAdDomainProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateDomain', () => { - it('invokes updateDomain without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.UpdateDomainRequest() - ); - request.domain ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.UpdateDomainRequest', ['domain', 'name']); - request.domain.name = defaultValue1; - const expectedHeaderRequestParams = `domain.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateDomain = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateDomain(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDomain without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.UpdateDomainRequest() - ); - request.domain ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.UpdateDomainRequest', ['domain', 'name']); - request.domain.name = defaultValue1; - const expectedHeaderRequestParams = `domain.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateDomain = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDomain( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDomain with call error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.UpdateDomainRequest() - ); - request.domain ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.UpdateDomainRequest', ['domain', 'name']); - request.domain.name = defaultValue1; - const expectedHeaderRequestParams = `domain.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDomain = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateDomain(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDomain with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.UpdateDomainRequest() - ); - request.domain ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.UpdateDomainRequest', ['domain', 'name']); - request.domain.name = defaultValue1; - const expectedHeaderRequestParams = `domain.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDomain = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateDomain(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateDomainProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateDomainProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateDomainProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateDomainProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteDomain', () => { - it('invokes deleteDomain without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.DeleteDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.DeleteDomainRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteDomain = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteDomain(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDomain without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.DeleteDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.DeleteDomainRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteDomain = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDomain( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDomain with call error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.DeleteDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.DeleteDomainRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDomain = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteDomain(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDomain with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.DeleteDomainRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.DeleteDomainRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDomain = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteDomain(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteDomainProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteDomainProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteDomainProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteDomainProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('attachTrust', () => { - it('invokes attachTrust without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.AttachTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.AttachTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.attachTrust = stubLongRunningCall(expectedResponse); - const [operation] = await client.attachTrust(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attachTrust without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.AttachTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.AttachTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.attachTrust = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.attachTrust( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attachTrust with call error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.AttachTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.AttachTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.attachTrust = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.attachTrust(request), expectedError); - const actualRequest = (client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attachTrust with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.AttachTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.AttachTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.attachTrust = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.attachTrust(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAttachTrustProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAttachTrustProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAttachTrustProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAttachTrustProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('reconfigureTrust', () => { - it('invokes reconfigureTrust without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.reconfigureTrust = stubLongRunningCall(expectedResponse); - const [operation] = await client.reconfigureTrust(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reconfigureTrust without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.reconfigureTrust = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reconfigureTrust( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reconfigureTrust with call error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.reconfigureTrust = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.reconfigureTrust(request), expectedError); - const actualRequest = (client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reconfigureTrust with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.reconfigureTrust = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.reconfigureTrust(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkReconfigureTrustProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkReconfigureTrustProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkReconfigureTrustProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkReconfigureTrustProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('detachTrust', () => { - it('invokes detachTrust without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.DetachTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.DetachTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.detachTrust = stubLongRunningCall(expectedResponse); - const [operation] = await client.detachTrust(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes detachTrust without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.DetachTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.DetachTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.detachTrust = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.detachTrust( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes detachTrust with call error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.DetachTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.DetachTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.detachTrust = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.detachTrust(request), expectedError); - const actualRequest = (client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes detachTrust with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.DetachTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.DetachTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.detachTrust = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.detachTrust(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDetachTrustProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDetachTrustProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDetachTrustProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDetachTrustProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('validateTrust', () => { - it('invokes validateTrust without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ValidateTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ValidateTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.validateTrust = stubLongRunningCall(expectedResponse); - const [operation] = await client.validateTrust(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes validateTrust without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ValidateTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ValidateTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.validateTrust = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.validateTrust( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes validateTrust with call error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ValidateTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ValidateTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.validateTrust = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.validateTrust(request), expectedError); - const actualRequest = (client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes validateTrust with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ValidateTrustRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ValidateTrustRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.validateTrust = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.validateTrust(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkValidateTrustProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkValidateTrustProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkValidateTrustProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkValidateTrustProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listDomains', () => { - it('invokes listDomains without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ListDomainsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - ]; - client.innerApiCalls.listDomains = stubSimpleCall(expectedResponse); - const [response] = await client.listDomains(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDomains as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDomains as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDomains without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ListDomainsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - ]; - client.innerApiCalls.listDomains = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDomains( - request, - (err?: Error|null, result?: protos.google.cloud.managedidentities.v1beta1.IDomain[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDomains as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDomains as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDomains with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ListDomainsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDomains = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDomains(request), expectedError); - const actualRequest = (client.innerApiCalls.listDomains as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDomains as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDomainsStream without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ListDomainsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - ]; - client.descriptors.page.listDomains.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDomainsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.managedidentities.v1beta1.Domain[] = []; - stream.on('data', (response: protos.google.cloud.managedidentities.v1beta1.Domain) => { - 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.listDomains.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDomains, request)); - assert( - (client.descriptors.page.listDomains.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDomainsStream with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ListDomainsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDomains.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDomainsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.managedidentities.v1beta1.Domain[] = []; - stream.on('data', (response: protos.google.cloud.managedidentities.v1beta1.Domain) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDomains.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDomains, request)); - assert( - (client.descriptors.page.listDomains.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDomains without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ListDomainsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - ]; - client.descriptors.page.listDomains.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.managedidentities.v1beta1.IDomain[] = []; - const iterable = client.listDomainsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDomains.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDomains.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDomains with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.managedidentities.v1beta1.ListDomainsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDomains.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDomainsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.managedidentities.v1beta1.IDomain[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDomains.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDomains.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('domain', () => { - const fakePath = "/rendered/path/domain"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - domain: "domainValue", - }; - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.domainPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.domainPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('domainPath', () => { - const result = client.domainPath("projectValue", "locationValue", "domainValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.domainPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDomainName', () => { - const result = client.matchProjectFromDomainName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.domainPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDomainName', () => { - const result = client.matchLocationFromDomainName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.domainPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDomainFromDomainName', () => { - const result = client.matchDomainFromDomainName(fakePath); - assert.strictEqual(result, "domainValue"); - assert((client.pathTemplates.domainPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-managedidentities/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-managedidentities/v1beta1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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-managedidentities/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-managedidentities/v1beta1/webpack.config.js deleted file mode 100644 index 934d7017657..00000000000 --- a/owl-bot-staging/google-cloud-managedidentities/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: 'ManagedIdentitiesService', - filename: './managed-identities-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-mediatranslation/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/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-mediatranslation/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.gitignore b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/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-mediatranslation/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.jsdoc.js deleted file mode 100644 index 16d4d3203ff..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/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/media-translation', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/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-mediatranslation/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/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-mediatranslation/v1beta1/README.md b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/README.md deleted file mode 100644 index 16fe5858f75..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Mediatranslation: Nodejs Client diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/package.json b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/package.json deleted file mode 100644 index f1f1d60fee8..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/media-translation", - "version": "0.1.0", - "description": "Mediatranslation client for Node.js", - "repository": "googleapis/nodejs-mediatranslation", - "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 mediatranslation", - "mediatranslation", - "speech translation service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/protos/google/cloud/mediatranslation/v1beta1/media_translation.proto b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/protos/google/cloud/mediatranslation/v1beta1/media_translation.proto deleted file mode 100644 index 63aff80c927..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/protos/google/cloud/mediatranslation/v1beta1/media_translation.proto +++ /dev/null @@ -1,204 +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.mediatranslation.v1beta1; - -import "google/api/field_behavior.proto"; -import "google/rpc/status.proto"; -import "google/api/client.proto"; - -option cc_enable_arenas = true; -option go_package = "cloud.google.com/go/mediatranslation/apiv1beta1/mediatranslationpb;mediatranslationpb"; -option java_multiple_files = true; -option java_outer_classname = "MediaTranslationProto"; -option java_package = "com.google.cloud.mediatranslation.v1beta1"; -option csharp_namespace = "Google.Cloud.MediaTranslation.V1Beta1"; -option ruby_package = "Google::Cloud::MediaTranslation::V1beta1"; -option php_namespace = "Google\\Cloud\\MediaTranslation\\V1beta1"; - -// Provides translation from/to media types. -service SpeechTranslationService { - option (google.api.default_host) = "mediatranslation.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Performs bidirectional streaming speech translation: receive results while - // sending audio. This method is only available via the gRPC API (not REST). - rpc StreamingTranslateSpeech(stream StreamingTranslateSpeechRequest) returns (stream StreamingTranslateSpeechResponse) { - } -} - -// Provides information to the speech translation that specifies how to process -// the request. -message TranslateSpeechConfig { - // Required. Encoding of audio data. - // Supported formats: - // - // - `linear16` - // - // Uncompressed 16-bit signed little-endian samples (Linear PCM). - // - // - `flac` - // - // `flac` (Free Lossless Audio Codec) is the recommended encoding - // because it is lossless--therefore recognition is not compromised--and - // requires only about half the bandwidth of `linear16`. - // - // - `mulaw` - // - // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. - // - // - `amr` - // - // Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. - // - // - `amr-wb` - // - // Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. - // - // - `ogg-opus` - // - // Opus encoded audio frames in [Ogg](https://wikipedia.org/wiki/Ogg) - // container. `sample_rate_hertz` must be one of 8000, 12000, 16000, 24000, - // or 48000. - // - // - `mp3` - // - // MP3 audio. Support all standard MP3 bitrates (which range from 32-320 - // kbps). When using this encoding, `sample_rate_hertz` has to match the - // sample rate of the file being used. - string audio_encoding = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Source language code (BCP-47) of the input audio. - string source_language_code = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Target language code (BCP-47) of the output. - string target_language_code = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Sample rate in Hertz of the audio data. Valid values are: - // 8000-48000. 16000 is optimal. For best results, set the sampling rate of - // the audio source to 16000 Hz. If that's not possible, use the native sample - // rate of the audio source (instead of re-sampling). - int32 sample_rate_hertz = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. `google-provided-model/video` and - // `google-provided-model/enhanced-phone-call` are premium models. - // `google-provided-model/phone-call` is not premium model. - string model = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Config used for streaming translation. -message StreamingTranslateSpeechConfig { - // Required. The common config for all the following audio contents. - TranslateSpeechConfig audio_config = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. If `false` or omitted, the system performs - // continuous translation (continuing to wait for and process audio even if - // the user pauses speaking) until the client closes the input stream (gRPC - // API) or until the maximum time limit has been reached. May return multiple - // `StreamingTranslateSpeechResult`s with the `is_final` flag set to `true`. - // - // If `true`, the speech translator will detect a single spoken utterance. - // When it detects that the user has paused or stopped speaking, it will - // return an `END_OF_SINGLE_UTTERANCE` event and cease translation. - // When the client receives 'END_OF_SINGLE_UTTERANCE' event, the client should - // stop sending the requests. However, clients should keep receiving remaining - // responses until the stream is terminated. To construct the complete - // sentence in a streaming way, one should override (if 'is_final' of previous - // response is false), or append (if 'is_final' of previous response is true). - bool single_utterance = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The top-level message sent by the client for the `StreamingTranslateSpeech` -// method. Multiple `StreamingTranslateSpeechRequest` messages are sent. The -// first message must contain a `streaming_config` message and must not contain -// `audio_content` data. All subsequent messages must contain `audio_content` -// data and must not contain a `streaming_config` message. -message StreamingTranslateSpeechRequest { - // The streaming request, which is either a streaming config or content. - oneof streaming_request { - // Provides information to the recognizer that specifies how to process the - // request. The first `StreamingTranslateSpeechRequest` message must contain - // a `streaming_config` message. - StreamingTranslateSpeechConfig streaming_config = 1; - - // The audio data to be translated. Sequential chunks of audio data are sent - // in sequential `StreamingTranslateSpeechRequest` messages. The first - // `StreamingTranslateSpeechRequest` message must not contain - // `audio_content` data and all subsequent `StreamingTranslateSpeechRequest` - // messages must contain `audio_content` data. The audio bytes must be - // encoded as specified in `StreamingTranslateSpeechConfig`. Note: as with - // all bytes fields, protobuffers use a pure binary representation (not - // base64). - bytes audio_content = 2; - } -} - -// A streaming speech translation result corresponding to a portion of the audio -// that is currently being processed. -message StreamingTranslateSpeechResult { - // Text translation result. - message TextTranslationResult { - // Output only. The translated sentence. - string translation = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If `false`, this `StreamingTranslateSpeechResult` represents - // an interim result that may change. If `true`, this is the final time the - // translation service will return this particular - // `StreamingTranslateSpeechResult`, the streaming translator will not - // return any further hypotheses for this portion of the transcript and - // corresponding audio. - bool is_final = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Translation result. - oneof result { - // Text translation result. - TextTranslationResult text_translation_result = 1; - } -} - -// A streaming speech translation response corresponding to a portion of -// the audio currently processed. -message StreamingTranslateSpeechResponse { - // Indicates the type of speech event. - enum SpeechEventType { - // No speech event specified. - SPEECH_EVENT_TYPE_UNSPECIFIED = 0; - - // This event indicates that the server has detected the end of the user's - // speech utterance and expects no additional speech. Therefore, the server - // will not process additional audio (although it may subsequently return - // additional results). When the client receives 'END_OF_SINGLE_UTTERANCE' - // event, the client should stop sending the requests. However, clients - // should keep receiving remaining responses until the stream is terminated. - // To construct the complete sentence in a streaming way, one should - // override (if 'is_final' of previous response is false), or append (if - // 'is_final' of previous response is true). This event is only sent if - // `single_utterance` was set to `true`, and is not used otherwise. - END_OF_SINGLE_UTTERANCE = 1; - } - - // Output only. If set, returns a [google.rpc.Status][google.rpc.Status] message that - // specifies the error for the operation. - google.rpc.Status error = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The translation result that is currently being processed (is_final could be - // true or false). - StreamingTranslateSpeechResult result = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Indicates the type of speech event. - SpeechEventType speech_event_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.mediatranslation.v1beta1.json b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.mediatranslation.v1beta1.json deleted file mode 100644 index 4d12e4092a2..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.mediatranslation.v1beta1.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-mediatranslation", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.mediatranslation.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "mediatranslation_v1beta1_generated_SpeechTranslationService_StreamingTranslateSpeech_async", - "title": "SpeechTranslationService streamingTranslateSpeech Sample", - "origin": "API_DEFINITION", - "description": " Performs bidirectional streaming speech translation: receive results while sending audio. This method is only available via the gRPC API (not REST).", - "canonical": true, - "file": "speech_translation_service.streaming_translate_speech.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StreamingTranslateSpeech", - "fullName": "google.cloud.mediatranslation.v1beta1.SpeechTranslationService.StreamingTranslateSpeech", - "async": true, - "parameters": [ - { - "name": "streaming_config", - "type": ".google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechConfig" - }, - { - "name": "audio_content", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse", - "client": { - "shortName": "SpeechTranslationServiceClient", - "fullName": "google.cloud.mediatranslation.v1beta1.SpeechTranslationServiceClient" - }, - "method": { - "shortName": "StreamingTranslateSpeech", - "fullName": "google.cloud.mediatranslation.v1beta1.SpeechTranslationService.StreamingTranslateSpeech", - "service": { - "shortName": "SpeechTranslationService", - "fullName": "google.cloud.mediatranslation.v1beta1.SpeechTranslationService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/samples/generated/v1beta1/speech_translation_service.streaming_translate_speech.js b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/samples/generated/v1beta1/speech_translation_service.streaming_translate_speech.js deleted file mode 100644 index 3523410caf7..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/samples/generated/v1beta1/speech_translation_service.streaming_translate_speech.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() { - // [START mediatranslation_v1beta1_generated_SpeechTranslationService_StreamingTranslateSpeech_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. - */ - /** - * Provides information to the recognizer that specifies how to process the - * request. The first `StreamingTranslateSpeechRequest` message must contain - * a `streaming_config` message. - */ - // const streamingConfig = {} - /** - * The audio data to be translated. Sequential chunks of audio data are sent - * in sequential `StreamingTranslateSpeechRequest` messages. The first - * `StreamingTranslateSpeechRequest` message must not contain - * `audio_content` data and all subsequent `StreamingTranslateSpeechRequest` - * messages must contain `audio_content` data. The audio bytes must be - * encoded as specified in `StreamingTranslateSpeechConfig`. Note: as with - * all bytes fields, protobuffers use a pure binary representation (not - * base64). - */ - // const audioContent = Buffer.from('string') - - // Imports the Mediatranslation library - const {SpeechTranslationServiceClient} = require('@google-cloud/media-translation').v1beta1; - - // Instantiates a client - const mediatranslationClient = new SpeechTranslationServiceClient(); - - async function callStreamingTranslateSpeech() { - // Construct request - const request = { - }; - - // Run request - const stream = await mediatranslationClient.streamingTranslateSpeech(); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - stream.write(request); - stream.end(); - } - - callStreamingTranslateSpeech(); - // [END mediatranslation_v1beta1_generated_SpeechTranslationService_StreamingTranslateSpeech_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-mediatranslation/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/index.ts deleted file mode 100644 index da4ad7ca4db..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/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 SpeechTranslationServiceClient = v1beta1.SpeechTranslationServiceClient; -type SpeechTranslationServiceClient = v1beta1.SpeechTranslationServiceClient; -export {v1beta1, SpeechTranslationServiceClient}; -export default {v1beta1, SpeechTranslationServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/gapic_metadata.json deleted file mode 100644 index 0a32f7ae25f..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/gapic_metadata.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.mediatranslation.v1beta1", - "libraryPackage": "@google-cloud/media-translation", - "services": { - "SpeechTranslationService": { - "clients": { - "grpc": { - "libraryClient": "SpeechTranslationServiceClient", - "rpcs": { - "StreamingTranslateSpeech": { - "methods": [ - "streamingTranslateSpeech" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SpeechTranslationServiceClient", - "rpcs": {} - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/index.ts deleted file mode 100644 index e0ce5ec8f2c..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/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 {SpeechTranslationServiceClient} from './speech_translation_service_client'; diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_client.ts b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_client.ts deleted file mode 100644 index f7858946705..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_client.ts +++ /dev/null @@ -1,342 +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 {PassThrough} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/speech_translation_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './speech_translation_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Provides translation from/to media types. - * @class - * @memberof v1beta1 - */ -export class SpeechTranslationServiceClient { - 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}; - speechTranslationServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SpeechTranslationServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 SpeechTranslationServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SpeechTranslationServiceClient; - 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 { - 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); - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - streamingTranslateSpeech: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.mediatranslation.v1beta1.SpeechTranslationService', 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.speechTranslationServiceStub) { - return this.speechTranslationServiceStub; - } - - // Put together the "service stub" for - // google.cloud.mediatranslation.v1beta1.SpeechTranslationService. - this.speechTranslationServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.mediatranslation.v1beta1.SpeechTranslationService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.mediatranslation.v1beta1.SpeechTranslationService, - 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 speechTranslationServiceStubMethods = - ['streamingTranslateSpeech']; - for (const methodName of speechTranslationServiceStubMethods) { - const callPromise = this.speechTranslationServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough(); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - 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.stream[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.speechTranslationServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'mediatranslation.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 'mediatranslation.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 -- - // ------------------- - -/** - * Performs bidirectional streaming speech translation: receive results while - * sending audio. This method is only available via the gRPC API (not REST). - * - * @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 is both readable and writable. It accepts objects - * representing {@link protos.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechRequest|StreamingTranslateSpeechRequest} for write() method, and - * will emit objects representing {@link protos.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse|StreamingTranslateSpeechResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/speech_translation_service.streaming_translate_speech.js - * region_tag:mediatranslation_v1beta1_generated_SpeechTranslationService_StreamingTranslateSpeech_async - */ - streamingTranslateSpeech( - options?: CallOptions): - gax.CancellableStream { - this.initialize(); - return this.innerApiCalls.streamingTranslateSpeech(null, options); - } - - - /** - * 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.speechTranslationServiceStub && !this._terminated) { - return this.speechTranslationServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_client_config.json b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_client_config.json deleted file mode 100644 index 75bcb1e3260..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_client_config.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "interfaces": { - "google.cloud.mediatranslation.v1beta1.SpeechTranslationService": { - "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": { - "StreamingTranslateSpeech": { - "timeout_millis": 400000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_proto_list.json b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_proto_list.json deleted file mode 100644 index ede436a2170..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/src/v1beta1/speech_translation_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/mediatranslation/v1beta1/media_translation.proto" -] diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index aa7872d9645..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/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 mediatranslation = require('@google-cloud/media-translation'); - -function main() { - const speechTranslationServiceClient = new mediatranslation.SpeechTranslationServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 9cee11a1b5b..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/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 {SpeechTranslationServiceClient} from '@google-cloud/media-translation'; - -// check that the client class type name can be used -function doStuffWithSpeechTranslationServiceClient(client: SpeechTranslationServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const speechTranslationServiceClient = new SpeechTranslationServiceClient(); - doStuffWithSpeechTranslationServiceClient(speechTranslationServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/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-mediatranslation/v1beta1/test/gapic_speech_translation_service_v1beta1.ts b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/test/gapic_speech_translation_service_v1beta1.ts deleted file mode 100644 index 47a6b583328..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/test/gapic_speech_translation_service_v1beta1.ts +++ /dev/null @@ -1,217 +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 speechtranslationserviceModule 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 stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); -} - -describe('v1beta1.SpeechTranslationServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.speechTranslationServiceStub, undefined); - await client.initialize(); - assert(client.speechTranslationServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.speechTranslationServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.speechTranslationServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient({ - 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 speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient({ - 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('streamingTranslateSpeech', () => { - it('invokes streamingTranslateSpeech without error', async () => { - const client = new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse() - ); - client.innerApiCalls.streamingTranslateSpeech = stubBidiStreamingCall(expectedResponse); - const stream = client.streamingTranslateSpeech(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.streamingTranslateSpeech as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes streamingTranslateSpeech with error', async () => { - const client = new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.streamingTranslateSpeech = stubBidiStreamingCall(undefined, expectedError); - const stream = client.streamingTranslateSpeech(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.streamingTranslateSpeech as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-mediatranslation/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/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-mediatranslation/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-mediatranslation/v1beta1/webpack.config.js deleted file mode 100644 index 52c6d008165..00000000000 --- a/owl-bot-staging/google-cloud-mediatranslation/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: 'SpeechTranslationService', - filename: './speech-translation-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-memcache/v1/.eslintignore b/owl-bot-staging/google-cloud-memcache/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-memcache/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-memcache/v1/.eslintrc.json b/owl-bot-staging/google-cloud-memcache/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-memcache/v1/.gitignore b/owl-bot-staging/google-cloud-memcache/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-memcache/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-memcache/v1/.jsdoc.js b/owl-bot-staging/google-cloud-memcache/v1/.jsdoc.js deleted file mode 100644 index 3933f5c8b73..00000000000 --- a/owl-bot-staging/google-cloud-memcache/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/memcache', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-memcache/v1/.mocharc.js b/owl-bot-staging/google-cloud-memcache/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-memcache/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-memcache/v1/.prettierrc.js b/owl-bot-staging/google-cloud-memcache/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-memcache/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-memcache/v1/README.md b/owl-bot-staging/google-cloud-memcache/v1/README.md deleted file mode 100644 index fc7ba0933a7..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Memcache: Nodejs Client diff --git a/owl-bot-staging/google-cloud-memcache/v1/package.json b/owl-bot-staging/google-cloud-memcache/v1/package.json deleted file mode 100644 index ac0a246880d..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/memcache", - "version": "0.1.0", - "description": "Memcache client for Node.js", - "repository": "googleapis/nodejs-memcache", - "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 memcache", - "memcache", - "cloud memcache" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-memcache/v1/protos/google/cloud/memcache/v1/cloud_memcache.proto b/owl-bot-staging/google-cloud-memcache/v1/protos/google/cloud/memcache/v1/cloud_memcache.proto deleted file mode 100644 index 47606fab4ba..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/protos/google/cloud/memcache/v1/cloud_memcache.proto +++ /dev/null @@ -1,618 +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 -// -// 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.memcache.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/type/dayofweek.proto"; -import "google/type/timeofday.proto"; - -option go_package = "cloud.google.com/go/memcache/apiv1/memcachepb;memcachepb"; -option java_multiple_files = true; -option java_outer_classname = "CloudMemcacheProto"; -option java_package = "com.google.cloud.memcache.v1"; - -// Configures and manages Cloud Memorystore for Memcached instances. -// -// -// The `memcache.googleapis.com` service implements the Google Cloud Memorystore -// for Memcached API and defines the following resource model for managing -// Memorystore Memcached (also called Memcached below) instances: -// * The service works with a collection of cloud projects, named: `/projects/*` -// * Each project has a collection of available locations, named: `/locations/*` -// * Each location has a collection of Memcached instances, named: -// `/instances/*` -// * As such, Memcached instances are resources of the form: -// `/projects/{project_id}/locations/{location_id}/instances/{instance_id}` -// -// Note that location_id must be a GCP `region`; for example: -// * `projects/my-memcached-project/locations/us-central1/instances/my-memcached` -service CloudMemcache { - option (google.api.default_host) = "memcache.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists Instances in a given location. - rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/instances" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single Instance. - rpc GetInstance(GetInstanceRequest) returns (Instance) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new Instance in a given location. - rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/instances" - body: "instance" - }; - option (google.api.method_signature) = "parent,instance,instance_id"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.memcache.v1.Instance" - metadata_type: "google.cloud.memcache.v1.OperationMetadata" - }; - } - - // Updates an existing Instance in a given project and location. - rpc UpdateInstance(UpdateInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{instance.name=projects/*/locations/*/instances/*}" - body: "instance" - }; - option (google.api.method_signature) = "instance,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.memcache.v1.Instance" - metadata_type: "google.cloud.memcache.v1.OperationMetadata" - }; - } - - // Updates the defined Memcached parameters for an existing instance. - // This method only stages the parameters, it must be followed by - // `ApplyParameters` to apply the parameters to nodes of the Memcached - // instance. - rpc UpdateParameters(UpdateParametersRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{name=projects/*/locations/*/instances/*}:updateParameters" - body: "*" - }; - option (google.api.method_signature) = "name,update_mask,parameters"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.memcache.v1.Instance" - metadata_type: "google.cloud.memcache.v1.OperationMetadata" - }; - } - - // Deletes a single Instance. - rpc DeleteInstance(DeleteInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.memcache.v1.OperationMetadata" - }; - } - - // `ApplyParameters` restarts the set of specified nodes in order to update - // them to the current set of parameters for the Memcached Instance. - rpc ApplyParameters(ApplyParametersRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/instances/*}:applyParameters" - body: "*" - }; - option (google.api.method_signature) = "name,node_ids,apply_all"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.memcache.v1.Instance" - metadata_type: "google.cloud.memcache.v1.OperationMetadata" - }; - } - - // Reschedules upcoming maintenance event. - rpc RescheduleMaintenance(RescheduleMaintenanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{instance=projects/*/locations/*/instances/*}:rescheduleMaintenance" - body: "*" - }; - option (google.api.method_signature) = "instance, reschedule_type, schedule_time"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.memcache.v1.Instance" - metadata_type: "google.cloud.memcache.v1.OperationMetadata" - }; - } -} - -// A Memorystore for Memcached instance -message Instance { - option (google.api.resource) = { - type: "memcache.googleapis.com/Instance" - pattern: "projects/{project}/locations/{location}/instances/{instance}" - }; - - // Different states of a Memcached instance. - enum State { - // State not set. - STATE_UNSPECIFIED = 0; - - // Memcached instance is being created. - CREATING = 1; - - // Memcached instance has been created and ready to be used. - READY = 2; - - // Memcached instance is updating configuration such as maintenance policy - // and schedule. - UPDATING = 3; - - // Memcached instance is being deleted. - DELETING = 4; - - // Memcached instance is going through maintenance, e.g. data plane rollout. - PERFORMING_MAINTENANCE = 5; - } - - // Configuration for a Memcached Node. - message NodeConfig { - // Required. Number of cpus per Memcached node. - int32 cpu_count = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Memory size in MiB for each Memcached node. - int32 memory_size_mb = 2 [(google.api.field_behavior) = REQUIRED]; - } - - message Node { - // Different states of a Memcached node. - enum State { - // Node state is not set. - STATE_UNSPECIFIED = 0; - - // Node is being created. - CREATING = 1; - - // Node has been created and ready to be used. - READY = 2; - - // Node is being deleted. - DELETING = 3; - - // Node is being updated. - UPDATING = 4; - } - - // Output only. Identifier of the Memcached node. The node id does not - // include project or location like the Memcached instance name. - string node_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Location (GCP Zone) for the Memcached node. - string zone = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Current state of the Memcached node. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Hostname or IP address of the Memcached node used by the - // clients to connect to the Memcached server on this node. - string host = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The port number of the Memcached server on this node. - int32 port = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User defined parameters currently applied to the node. - MemcacheParameters parameters = 6; - } - - message InstanceMessage { - enum Code { - // Message Code not set. - CODE_UNSPECIFIED = 0; - - // Memcached nodes are distributed unevenly. - ZONE_DISTRIBUTION_UNBALANCED = 1; - } - - // A code that correspond to one type of user-facing message. - Code code = 1; - - // Message on memcached instance which will be exposed to users. - string message = 2; - } - - // Required. Unique name of the resource in this scope including project and - // location using the form: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // - // Note: Memcached instances are managed and addressed at the regional level - // so `location_id` here refers to a Google Cloud region; however, users may - // choose which zones Memcached nodes should be provisioned in within an - // instance. Refer to [zones][google.cloud.memcache.v1.Instance.zones] field for more details. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // User provided name for the instance, which is only used for display - // purposes. Cannot be more than 80 characters. - string display_name = 2; - - // Resource labels to represent user-provided metadata. - // Refer to cloud documentation on labels for more details. - // https://cloud.google.com/compute/docs/labeling-resources - map labels = 3; - - // The full name of the Google Compute Engine - // [network](/compute/docs/networks-and-firewalls#networks) to which the - // instance is connected. If left unspecified, the `default` network - // will be used. - string authorized_network = 4; - - // Zones in which Memcached nodes should be provisioned. - // Memcached nodes will be equally distributed across these zones. If not - // provided, the service will by default create nodes in all zones in the - // region for the instance. - repeated string zones = 5; - - // Required. Number of nodes in the Memcached instance. - int32 node_count = 6 [(google.api.field_behavior) = REQUIRED]; - - // Required. Configuration for Memcached nodes. - NodeConfig node_config = 7 [(google.api.field_behavior) = REQUIRED]; - - // The major version of Memcached software. - // If not provided, latest supported version will be used. Currently the - // latest supported major version is `MEMCACHE_1_5`. - // The minor version will be automatically determined by our system based on - // the latest supported minor version. - MemcacheVersion memcache_version = 9; - - // User defined parameters to apply to the memcached process - // on each node. - MemcacheParameters parameters = 11; - - // Output only. List of Memcached nodes. - // Refer to [Node][google.cloud.memcache.v1.Instance.Node] message for more details. - repeated Node memcache_nodes = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the instance was created. - google.protobuf.Timestamp create_time = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the instance was updated. - google.protobuf.Timestamp update_time = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The state of this Memcached instance. - State state = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The full version of memcached server running on this instance. - // System automatically determines the full memcached version for an instance - // based on the input MemcacheVersion. - // The full version format will be "memcached-1.5.16". - string memcache_full_version = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // List of messages that describe the current state of the Memcached instance. - repeated InstanceMessage instance_messages = 19; - - // Output only. Endpoint for the Discovery API. - string discovery_endpoint = 20 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The maintenance policy for the instance. If not provided, - // the maintenance event will be performed based on Memorystore - // internal rollout schedule. - MaintenancePolicy maintenance_policy = 21; - - // Output only. Published maintenance schedule. - MaintenanceSchedule maintenance_schedule = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Maintenance policy per instance. -message MaintenancePolicy { - // Output only. The time when the policy was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the policy was updated. - google.protobuf.Timestamp update_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Description of what this policy is for. Create/Update methods - // return INVALID_ARGUMENT if the length is greater than 512. - string description = 3; - - // Required. Maintenance window that is applied to resources covered by this - // policy. Minimum 1. For the current version, the maximum number of - // weekly_maintenance_windows is expected to be one. - repeated WeeklyMaintenanceWindow weekly_maintenance_window = 4 [(google.api.field_behavior) = REQUIRED]; -} - -// Time window specified for weekly operations. -message WeeklyMaintenanceWindow { - // Required. Allows to define schedule that runs specified day of the week. - google.type.DayOfWeek day = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Start time of the window in UTC. - google.type.TimeOfDay start_time = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Duration of the time window. - google.protobuf.Duration duration = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Upcoming maintenance schedule. -message MaintenanceSchedule { - // Output only. The start time of any upcoming scheduled maintenance for this instance. - google.protobuf.Timestamp start_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The end time of any upcoming scheduled maintenance for this instance. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The deadline that the maintenance schedule start time can not go beyond, - // including reschedule. - google.protobuf.Timestamp schedule_deadline_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request for [RescheduleMaintenance][google.cloud.memcache.v1.CloudMemcache.RescheduleMaintenance]. -message RescheduleMaintenanceRequest { - // Reschedule options. - enum RescheduleType { - // Not set. - RESCHEDULE_TYPE_UNSPECIFIED = 0; - - // If the user wants to schedule the maintenance to happen now. - IMMEDIATE = 1; - - // If the user wants to use the existing maintenance policy to find the - // next available window. - NEXT_AVAILABLE_WINDOW = 2; - - // If the user wants to reschedule the maintenance to a specific time. - SPECIFIC_TIME = 3; - } - - // Required. Memcache instance resource name using the form: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // where `location_id` refers to a GCP region. - string instance = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "memcache.googleapis.com/Instance" - } - ]; - - // Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well. - RescheduleType reschedule_type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Timestamp when the maintenance shall be rescheduled to if - // reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for - // example `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp schedule_time = 3; -} - -// Request for [ListInstances][google.cloud.memcache.v1.CloudMemcache.ListInstances]. -message ListInstancesRequest { - // Required. The resource name of the instance location using the form: - // `projects/{project_id}/locations/{location_id}` - // where `location_id` refers to a GCP region - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of items to return. - // - // If not specified, a default value of 1000 will be used by the service. - // Regardless of the `page_size` value, the response may include a partial - // list and a caller should only rely on response's - // [`next_page_token`][google.cloud.memcache.v1.ListInstancesResponse.next_page_token] - // to determine if there are more instances left to be queried. - int32 page_size = 2; - - // The `next_page_token` value returned from a previous List request, if any. - string page_token = 3; - - // List filter. For example, exclude all Memcached instances with name as - // my-instance by specifying `"name != my-instance"`. - string filter = 4; - - // Sort results. Supported values are "name", "name desc" or "" (unsorted). - string order_by = 5; -} - -// Response for [ListInstances][google.cloud.memcache.v1.CloudMemcache.ListInstances]. -message ListInstancesResponse { - // A list of Memcached instances in the project in the specified location, - // or across all locations. - // - // If the `location_id` in the parent field of the request is "-", all regions - // available to the project are queried, and the results aggregated. - repeated Instance instances = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request for [GetInstance][google.cloud.memcache.v1.CloudMemcache.GetInstance]. -message GetInstanceRequest { - // Required. Memcached instance resource name in the format: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // where `location_id` refers to a GCP region - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "memcache.googleapis.com/Instance" - } - ]; -} - -// Request for [CreateInstance][google.cloud.memcache.v1.CloudMemcache.CreateInstance]. -message CreateInstanceRequest { - // Required. The resource name of the instance location using the form: - // `projects/{project_id}/locations/{location_id}` - // where `location_id` refers to a GCP region - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The logical name of the Memcached instance in the user - // project with the following restrictions: - // - // * Must contain only lowercase letters, numbers, and hyphens. - // * Must start with a letter. - // * Must be between 1-40 characters. - // * Must end with a number or a letter. - // * Must be unique within the user project / location. - // - // If any of the above are not met, the API raises an invalid argument error. - string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A Memcached Instance - Instance instance = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for [UpdateInstance][google.cloud.memcache.v1.CloudMemcache.UpdateInstance]. -message UpdateInstanceRequest { - // Required. Mask of fields to update. - // - // * `displayName` - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A Memcached Instance. - // Only fields specified in update_mask are updated. - Instance instance = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for [DeleteInstance][google.cloud.memcache.v1.CloudMemcache.DeleteInstance]. -message DeleteInstanceRequest { - // Required. Memcached instance resource name in the format: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // where `location_id` refers to a GCP region - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "memcache.googleapis.com/Instance" - } - ]; -} - -// Request for [ApplyParameters][google.cloud.memcache.v1.CloudMemcache.ApplyParameters]. -message ApplyParametersRequest { - // Required. Resource name of the Memcached instance for which parameter group updates - // should be applied. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "memcache.googleapis.com/Instance" - } - ]; - - // Nodes to which the instance-level parameter group is applied. - repeated string node_ids = 2; - - // Whether to apply instance-level parameter group to all nodes. If set to - // true, users are restricted from specifying individual nodes, and - // `ApplyParameters` updates all nodes within the instance. - bool apply_all = 3; -} - -// Request for [UpdateParameters][google.cloud.memcache.v1.CloudMemcache.UpdateParameters]. -message UpdateParametersRequest { - // Required. Resource name of the Memcached instance for which the parameters should be - // updated. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "memcache.googleapis.com/Instance" - } - ]; - - // Required. Mask of fields to update. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; - - // The parameters to apply to the instance. - MemcacheParameters parameters = 3; -} - -// Memcached versions supported by our service. -enum MemcacheVersion { - MEMCACHE_VERSION_UNSPECIFIED = 0; - - // Memcached 1.5 version. - MEMCACHE_1_5 = 1; -} - -message MemcacheParameters { - // Output only. The unique ID associated with this set of parameters. Users - // can use this id to determine if the parameters associated with the instance - // differ from the parameters associated with the nodes. A discrepancy between - // parameter ids can inform users that they may need to take action to apply - // parameters on nodes. - string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User defined set of parameters to use in the memcached process. - map params = 3; -} - -// Represents the metadata of a long-running operation. -message OperationMetadata { - // Output only. Time when the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_detail = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Metadata for the given [google.cloud.location.Location][google.cloud.location.Location]. -message LocationMetadata { - // Output only. The set of available zones in the location. The map is keyed - // by the lowercase ID of each zone, as defined by GCE. These keys can be - // specified in the `zones` field when creating a Memcached instance. - map available_zones = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -message ZoneMetadata { - -} diff --git a/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.apply_parameters.js b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.apply_parameters.js deleted file mode 100644 index 58617c0077e..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.apply_parameters.js +++ /dev/null @@ -1,73 +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 memcache_v1_generated_CloudMemcache_ApplyParameters_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. Resource name of the Memcached instance for which parameter group updates - * should be applied. - */ - // const name = 'abc123' - /** - * Nodes to which the instance-level parameter group is applied. - */ - // const nodeIds = ['abc','def'] - /** - * Whether to apply instance-level parameter group to all nodes. If set to - * true, users are restricted from specifying individual nodes, and - * `ApplyParameters` updates all nodes within the instance. - */ - // const applyAll = true - - // Imports the Memcache library - const {CloudMemcacheClient} = require('@google-cloud/memcache').v1; - - // Instantiates a client - const memcacheClient = new CloudMemcacheClient(); - - async function callApplyParameters() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await memcacheClient.applyParameters(request); - const [response] = await operation.promise(); - console.log(response); - } - - callApplyParameters(); - // [END memcache_v1_generated_CloudMemcache_ApplyParameters_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-memcache/v1/samples/generated/v1/cloud_memcache.create_instance.js b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.create_instance.js deleted file mode 100644 index c3bcb26f195..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.create_instance.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, instanceId, instance) { - // [START memcache_v1_generated_CloudMemcache_CreateInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region - */ - // const parent = 'abc123' - /** - * Required. The logical name of the Memcached instance in the user - * project with the following restrictions: - * * Must contain only lowercase letters, numbers, and hyphens. - * * Must start with a letter. - * * Must be between 1-40 characters. - * * Must end with a number or a letter. - * * Must be unique within the user project / location. - * If any of the above are not met, the API raises an invalid argument error. - */ - // const instanceId = 'abc123' - /** - * Required. A Memcached Instance - */ - // const instance = {} - - // Imports the Memcache library - const {CloudMemcacheClient} = require('@google-cloud/memcache').v1; - - // Instantiates a client - const memcacheClient = new CloudMemcacheClient(); - - async function callCreateInstance() { - // Construct request - const request = { - parent, - instanceId, - instance, - }; - - // Run request - const [operation] = await memcacheClient.createInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateInstance(); - // [END memcache_v1_generated_CloudMemcache_CreateInstance_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-memcache/v1/samples/generated/v1/cloud_memcache.delete_instance.js b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.delete_instance.js deleted file mode 100644 index 45c11b5b8e2..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.delete_instance.js +++ /dev/null @@ -1,64 +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 memcache_v1_generated_CloudMemcache_DeleteInstance_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. Memcached instance resource name in the format: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region - */ - // const name = 'abc123' - - // Imports the Memcache library - const {CloudMemcacheClient} = require('@google-cloud/memcache').v1; - - // Instantiates a client - const memcacheClient = new CloudMemcacheClient(); - - async function callDeleteInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await memcacheClient.deleteInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteInstance(); - // [END memcache_v1_generated_CloudMemcache_DeleteInstance_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-memcache/v1/samples/generated/v1/cloud_memcache.get_instance.js b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.get_instance.js deleted file mode 100644 index 37800fd0025..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.get_instance.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 memcache_v1_generated_CloudMemcache_GetInstance_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. Memcached instance resource name in the format: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region - */ - // const name = 'abc123' - - // Imports the Memcache library - const {CloudMemcacheClient} = require('@google-cloud/memcache').v1; - - // Instantiates a client - const memcacheClient = new CloudMemcacheClient(); - - async function callGetInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await memcacheClient.getInstance(request); - console.log(response); - } - - callGetInstance(); - // [END memcache_v1_generated_CloudMemcache_GetInstance_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-memcache/v1/samples/generated/v1/cloud_memcache.list_instances.js b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.list_instances.js deleted file mode 100644 index a3638999476..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.list_instances.js +++ /dev/null @@ -1,87 +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 memcache_v1_generated_CloudMemcache_ListInstances_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - * If not specified, a default value of 1000 will be used by the service. - * Regardless of the `page_size` value, the response may include a partial - * list and a caller should only rely on response's - * `next_page_token` google.cloud.memcache.v1.ListInstancesResponse.next_page_token - * to determine if there are more instances left to be queried. - */ - // const pageSize = 1234 - /** - * The `next_page_token` value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - /** - * List filter. For example, exclude all Memcached instances with name as - * my-instance by specifying `"name != my-instance"`. - */ - // const filter = 'abc123' - /** - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - */ - // const orderBy = 'abc123' - - // Imports the Memcache library - const {CloudMemcacheClient} = require('@google-cloud/memcache').v1; - - // Instantiates a client - const memcacheClient = new CloudMemcacheClient(); - - async function callListInstances() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await memcacheClient.listInstancesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListInstances(); - // [END memcache_v1_generated_CloudMemcache_ListInstances_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-memcache/v1/samples/generated/v1/cloud_memcache.reschedule_maintenance.js b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.reschedule_maintenance.js deleted file mode 100644 index 37e39556d41..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.reschedule_maintenance.js +++ /dev/null @@ -1,75 +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(instance, rescheduleType) { - // [START memcache_v1_generated_CloudMemcache_RescheduleMaintenance_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. Memcache instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - */ - // const instance = 'abc123' - /** - * Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well. - */ - // const rescheduleType = {} - /** - * Timestamp when the maintenance shall be rescheduled to if - * reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for - * example `2012-11-15T16:19:00.094Z`. - */ - // const scheduleTime = {} - - // Imports the Memcache library - const {CloudMemcacheClient} = require('@google-cloud/memcache').v1; - - // Instantiates a client - const memcacheClient = new CloudMemcacheClient(); - - async function callRescheduleMaintenance() { - // Construct request - const request = { - instance, - rescheduleType, - }; - - // Run request - const [operation] = await memcacheClient.rescheduleMaintenance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRescheduleMaintenance(); - // [END memcache_v1_generated_CloudMemcache_RescheduleMaintenance_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-memcache/v1/samples/generated/v1/cloud_memcache.update_instance.js b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.update_instance.js deleted file mode 100644 index 019bd2e2a0b..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.update_instance.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(updateMask, instance) { - // [START memcache_v1_generated_CloudMemcache_UpdateInstance_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. Mask of fields to update. - * * `displayName` - */ - // const updateMask = {} - /** - * Required. A Memcached Instance. - * Only fields specified in update_mask are updated. - */ - // const instance = {} - - // Imports the Memcache library - const {CloudMemcacheClient} = require('@google-cloud/memcache').v1; - - // Instantiates a client - const memcacheClient = new CloudMemcacheClient(); - - async function callUpdateInstance() { - // Construct request - const request = { - updateMask, - instance, - }; - - // Run request - const [operation] = await memcacheClient.updateInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateInstance(); - // [END memcache_v1_generated_CloudMemcache_UpdateInstance_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-memcache/v1/samples/generated/v1/cloud_memcache.update_parameters.js b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.update_parameters.js deleted file mode 100644 index 0c10086620d..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/cloud_memcache.update_parameters.js +++ /dev/null @@ -1,72 +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, updateMask) { - // [START memcache_v1_generated_CloudMemcache_UpdateParameters_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. Resource name of the Memcached instance for which the parameters should be - * updated. - */ - // const name = 'abc123' - /** - * Required. Mask of fields to update. - */ - // const updateMask = {} - /** - * The parameters to apply to the instance. - */ - // const parameters = {} - - // Imports the Memcache library - const {CloudMemcacheClient} = require('@google-cloud/memcache').v1; - - // Instantiates a client - const memcacheClient = new CloudMemcacheClient(); - - async function callUpdateParameters() { - // Construct request - const request = { - name, - updateMask, - }; - - // Run request - const [operation] = await memcacheClient.updateParameters(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateParameters(); - // [END memcache_v1_generated_CloudMemcache_UpdateParameters_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-memcache/v1/samples/generated/v1/snippet_metadata_google.cloud.memcache.v1.json b/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/snippet_metadata_google.cloud.memcache.v1.json deleted file mode 100644 index 8d1ed37fe55..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/samples/generated/v1/snippet_metadata_google.cloud.memcache.v1.json +++ /dev/null @@ -1,387 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-memcache", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.memcache.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "memcache_v1_generated_CloudMemcache_ListInstances_async", - "title": "CloudMemcache listInstances Sample", - "origin": "API_DEFINITION", - "description": " Lists Instances in a given location.", - "canonical": true, - "file": "cloud_memcache.list_instances.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListInstances", - "fullName": "google.cloud.memcache.v1.CloudMemcache.ListInstances", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.memcache.v1.ListInstancesResponse", - "client": { - "shortName": "CloudMemcacheClient", - "fullName": "google.cloud.memcache.v1.CloudMemcacheClient" - }, - "method": { - "shortName": "ListInstances", - "fullName": "google.cloud.memcache.v1.CloudMemcache.ListInstances", - "service": { - "shortName": "CloudMemcache", - "fullName": "google.cloud.memcache.v1.CloudMemcache" - } - } - } - }, - { - "regionTag": "memcache_v1_generated_CloudMemcache_GetInstance_async", - "title": "CloudMemcache getInstance Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single Instance.", - "canonical": true, - "file": "cloud_memcache.get_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetInstance", - "fullName": "google.cloud.memcache.v1.CloudMemcache.GetInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.memcache.v1.Instance", - "client": { - "shortName": "CloudMemcacheClient", - "fullName": "google.cloud.memcache.v1.CloudMemcacheClient" - }, - "method": { - "shortName": "GetInstance", - "fullName": "google.cloud.memcache.v1.CloudMemcache.GetInstance", - "service": { - "shortName": "CloudMemcache", - "fullName": "google.cloud.memcache.v1.CloudMemcache" - } - } - } - }, - { - "regionTag": "memcache_v1_generated_CloudMemcache_CreateInstance_async", - "title": "CloudMemcache createInstance Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Instance in a given location.", - "canonical": true, - "file": "cloud_memcache.create_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateInstance", - "fullName": "google.cloud.memcache.v1.CloudMemcache.CreateInstance", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "instance_id", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": ".google.cloud.memcache.v1.Instance" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudMemcacheClient", - "fullName": "google.cloud.memcache.v1.CloudMemcacheClient" - }, - "method": { - "shortName": "CreateInstance", - "fullName": "google.cloud.memcache.v1.CloudMemcache.CreateInstance", - "service": { - "shortName": "CloudMemcache", - "fullName": "google.cloud.memcache.v1.CloudMemcache" - } - } - } - }, - { - "regionTag": "memcache_v1_generated_CloudMemcache_UpdateInstance_async", - "title": "CloudMemcache updateInstance Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing Instance in a given project and location.", - "canonical": true, - "file": "cloud_memcache.update_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateInstance", - "fullName": "google.cloud.memcache.v1.CloudMemcache.UpdateInstance", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "instance", - "type": ".google.cloud.memcache.v1.Instance" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudMemcacheClient", - "fullName": "google.cloud.memcache.v1.CloudMemcacheClient" - }, - "method": { - "shortName": "UpdateInstance", - "fullName": "google.cloud.memcache.v1.CloudMemcache.UpdateInstance", - "service": { - "shortName": "CloudMemcache", - "fullName": "google.cloud.memcache.v1.CloudMemcache" - } - } - } - }, - { - "regionTag": "memcache_v1_generated_CloudMemcache_UpdateParameters_async", - "title": "CloudMemcache updateParameters Sample", - "origin": "API_DEFINITION", - "description": " Updates the defined Memcached parameters for an existing instance. This method only stages the parameters, it must be followed by `ApplyParameters` to apply the parameters to nodes of the Memcached instance.", - "canonical": true, - "file": "cloud_memcache.update_parameters.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateParameters", - "fullName": "google.cloud.memcache.v1.CloudMemcache.UpdateParameters", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "parameters", - "type": ".google.cloud.memcache.v1.MemcacheParameters" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudMemcacheClient", - "fullName": "google.cloud.memcache.v1.CloudMemcacheClient" - }, - "method": { - "shortName": "UpdateParameters", - "fullName": "google.cloud.memcache.v1.CloudMemcache.UpdateParameters", - "service": { - "shortName": "CloudMemcache", - "fullName": "google.cloud.memcache.v1.CloudMemcache" - } - } - } - }, - { - "regionTag": "memcache_v1_generated_CloudMemcache_DeleteInstance_async", - "title": "CloudMemcache deleteInstance Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single Instance.", - "canonical": true, - "file": "cloud_memcache.delete_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteInstance", - "fullName": "google.cloud.memcache.v1.CloudMemcache.DeleteInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudMemcacheClient", - "fullName": "google.cloud.memcache.v1.CloudMemcacheClient" - }, - "method": { - "shortName": "DeleteInstance", - "fullName": "google.cloud.memcache.v1.CloudMemcache.DeleteInstance", - "service": { - "shortName": "CloudMemcache", - "fullName": "google.cloud.memcache.v1.CloudMemcache" - } - } - } - }, - { - "regionTag": "memcache_v1_generated_CloudMemcache_ApplyParameters_async", - "title": "CloudMemcache applyParameters Sample", - "origin": "API_DEFINITION", - "description": " `ApplyParameters` restarts the set of specified nodes in order to update them to the current set of parameters for the Memcached Instance.", - "canonical": true, - "file": "cloud_memcache.apply_parameters.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ApplyParameters", - "fullName": "google.cloud.memcache.v1.CloudMemcache.ApplyParameters", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "node_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "apply_all", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudMemcacheClient", - "fullName": "google.cloud.memcache.v1.CloudMemcacheClient" - }, - "method": { - "shortName": "ApplyParameters", - "fullName": "google.cloud.memcache.v1.CloudMemcache.ApplyParameters", - "service": { - "shortName": "CloudMemcache", - "fullName": "google.cloud.memcache.v1.CloudMemcache" - } - } - } - }, - { - "regionTag": "memcache_v1_generated_CloudMemcache_RescheduleMaintenance_async", - "title": "CloudMemcache rescheduleMaintenance Sample", - "origin": "API_DEFINITION", - "description": " Reschedules upcoming maintenance event.", - "canonical": true, - "file": "cloud_memcache.reschedule_maintenance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RescheduleMaintenance", - "fullName": "google.cloud.memcache.v1.CloudMemcache.RescheduleMaintenance", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "reschedule_type", - "type": ".google.cloud.memcache.v1.RescheduleMaintenanceRequest.RescheduleType" - }, - { - "name": "schedule_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudMemcacheClient", - "fullName": "google.cloud.memcache.v1.CloudMemcacheClient" - }, - "method": { - "shortName": "RescheduleMaintenance", - "fullName": "google.cloud.memcache.v1.CloudMemcache.RescheduleMaintenance", - "service": { - "shortName": "CloudMemcache", - "fullName": "google.cloud.memcache.v1.CloudMemcache" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-memcache/v1/src/index.ts b/owl-bot-staging/google-cloud-memcache/v1/src/index.ts deleted file mode 100644 index 7920946ca3b..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/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 v1 from './v1'; -const CloudMemcacheClient = v1.CloudMemcacheClient; -type CloudMemcacheClient = v1.CloudMemcacheClient; -export {v1, CloudMemcacheClient}; -export default {v1, CloudMemcacheClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_client.ts b/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_client.ts deleted file mode 100644 index 6648bde98e3..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_client.ts +++ /dev/null @@ -1,1619 +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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/cloud_memcache_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './cloud_memcache_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Configures and manages Cloud Memorystore for Memcached instances. - * - * - * The `memcache.googleapis.com` service implements the Google Cloud Memorystore - * for Memcached API and defines the following resource model for managing - * Memorystore Memcached (also called Memcached below) instances: - * * The service works with a collection of cloud projects, named: `/projects/*` - * * Each project has a collection of available locations, named: `/locations/*` - * * Each location has a collection of Memcached instances, named: - * `/instances/*` - * * As such, Memcached instances are resources of the form: - * `/projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * - * Note that location_id must be a GCP `region`; for example: - * * `projects/my-memcached-project/locations/us-central1/instances/my-memcached` - * @class - * @memberof v1 - */ -export class CloudMemcacheClient { - 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}; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - cloudMemcacheStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CloudMemcacheClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 CloudMemcacheClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof CloudMemcacheClient; - 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; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - 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 = { - instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/instances/{instance}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listInstances: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'instances') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.memcache.v1.Instance') as gax.protobuf.Type; - const createInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.memcache.v1.OperationMetadata') as gax.protobuf.Type; - const updateInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.memcache.v1.Instance') as gax.protobuf.Type; - const updateInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.memcache.v1.OperationMetadata') as gax.protobuf.Type; - const updateParametersResponse = protoFilesRoot.lookup( - '.google.cloud.memcache.v1.Instance') as gax.protobuf.Type; - const updateParametersMetadata = protoFilesRoot.lookup( - '.google.cloud.memcache.v1.OperationMetadata') as gax.protobuf.Type; - const deleteInstanceResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.memcache.v1.OperationMetadata') as gax.protobuf.Type; - const applyParametersResponse = protoFilesRoot.lookup( - '.google.cloud.memcache.v1.Instance') as gax.protobuf.Type; - const applyParametersMetadata = protoFilesRoot.lookup( - '.google.cloud.memcache.v1.OperationMetadata') as gax.protobuf.Type; - const rescheduleMaintenanceResponse = protoFilesRoot.lookup( - '.google.cloud.memcache.v1.Instance') as gax.protobuf.Type; - const rescheduleMaintenanceMetadata = protoFilesRoot.lookup( - '.google.cloud.memcache.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createInstanceResponse.decode.bind(createInstanceResponse), - createInstanceMetadata.decode.bind(createInstanceMetadata)), - updateInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateInstanceResponse.decode.bind(updateInstanceResponse), - updateInstanceMetadata.decode.bind(updateInstanceMetadata)), - updateParameters: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateParametersResponse.decode.bind(updateParametersResponse), - updateParametersMetadata.decode.bind(updateParametersMetadata)), - deleteInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteInstanceResponse.decode.bind(deleteInstanceResponse), - deleteInstanceMetadata.decode.bind(deleteInstanceMetadata)), - applyParameters: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - applyParametersResponse.decode.bind(applyParametersResponse), - applyParametersMetadata.decode.bind(applyParametersMetadata)), - rescheduleMaintenance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - rescheduleMaintenanceResponse.decode.bind(rescheduleMaintenanceResponse), - rescheduleMaintenanceMetadata.decode.bind(rescheduleMaintenanceMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.memcache.v1.CloudMemcache', 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.cloudMemcacheStub) { - return this.cloudMemcacheStub; - } - - // Put together the "service stub" for - // google.cloud.memcache.v1.CloudMemcache. - this.cloudMemcacheStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.memcache.v1.CloudMemcache') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.memcache.v1.CloudMemcache, - 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 cloudMemcacheStubMethods = - ['listInstances', 'getInstance', 'createInstance', 'updateInstance', 'updateParameters', 'deleteInstance', 'applyParameters', 'rescheduleMaintenance']; - for (const methodName of cloudMemcacheStubMethods) { - const callPromise = this.cloudMemcacheStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.cloudMemcacheStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'memcache.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 'memcache.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 -- - // ------------------- -/** - * Gets details of a single Instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Memcached instance resource name in the format: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.memcache.v1.Instance|Instance}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_memcache.get_instance.js - * region_tag:memcache_v1_generated_CloudMemcache_GetInstance_async - */ - getInstance( - request?: protos.google.cloud.memcache.v1.IGetInstanceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.memcache.v1.IInstance, - protos.google.cloud.memcache.v1.IGetInstanceRequest|undefined, {}|undefined - ]>; - getInstance( - request: protos.google.cloud.memcache.v1.IGetInstanceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.memcache.v1.IInstance, - protos.google.cloud.memcache.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request: protos.google.cloud.memcache.v1.IGetInstanceRequest, - callback: Callback< - protos.google.cloud.memcache.v1.IInstance, - protos.google.cloud.memcache.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request?: protos.google.cloud.memcache.v1.IGetInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.memcache.v1.IInstance, - protos.google.cloud.memcache.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.memcache.v1.IInstance, - protos.google.cloud.memcache.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.memcache.v1.IInstance, - protos.google.cloud.memcache.v1.IGetInstanceRequest|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.getInstance(request, options, callback); - } - -/** - * Creates a new Instance in a given location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region - * @param {string} request.instanceId - * Required. The logical name of the Memcached instance in the user - * project with the following restrictions: - * - * * Must contain only lowercase letters, numbers, and hyphens. - * * Must start with a letter. - * * Must be between 1-40 characters. - * * Must end with a number or a letter. - * * Must be unique within the user project / location. - * - * If any of the above are not met, the API raises an invalid argument error. - * @param {google.cloud.memcache.v1.Instance} request.instance - * Required. A Memcached Instance - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_memcache.create_instance.js - * region_tag:memcache_v1_generated_CloudMemcache_CreateInstance_async - */ - createInstance( - request?: protos.google.cloud.memcache.v1.ICreateInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createInstance( - request: protos.google.cloud.memcache.v1.ICreateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request: protos.google.cloud.memcache.v1.ICreateInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request?: protos.google.cloud.memcache.v1.ICreateInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_memcache.create_instance.js - * region_tag:memcache_v1_generated_CloudMemcache_CreateInstance_async - */ - async checkCreateInstanceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an existing Instance in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. - * - * * `displayName` - * @param {google.cloud.memcache.v1.Instance} request.instance - * Required. A Memcached Instance. - * Only fields specified in update_mask are updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_memcache.update_instance.js - * region_tag:memcache_v1_generated_CloudMemcache_UpdateInstance_async - */ - updateInstance( - request?: protos.google.cloud.memcache.v1.IUpdateInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateInstance( - request: protos.google.cloud.memcache.v1.IUpdateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateInstance( - request: protos.google.cloud.memcache.v1.IUpdateInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateInstance( - request?: protos.google.cloud.memcache.v1.IUpdateInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'instance.name': request.instance!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_memcache.update_instance.js - * region_tag:memcache_v1_generated_CloudMemcache_UpdateInstance_async - */ - async checkUpdateInstanceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the defined Memcached parameters for an existing instance. - * This method only stages the parameters, it must be followed by - * `ApplyParameters` to apply the parameters to nodes of the Memcached - * instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the Memcached instance for which the parameters should be - * updated. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. - * @param {google.cloud.memcache.v1.MemcacheParameters} request.parameters - * The parameters to apply to the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_memcache.update_parameters.js - * region_tag:memcache_v1_generated_CloudMemcache_UpdateParameters_async - */ - updateParameters( - request?: protos.google.cloud.memcache.v1.IUpdateParametersRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateParameters( - request: protos.google.cloud.memcache.v1.IUpdateParametersRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateParameters( - request: protos.google.cloud.memcache.v1.IUpdateParametersRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateParameters( - request?: protos.google.cloud.memcache.v1.IUpdateParametersRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateParameters(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateParameters()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_memcache.update_parameters.js - * region_tag:memcache_v1_generated_CloudMemcache_UpdateParameters_async - */ - async checkUpdateParametersProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateParameters, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single Instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Memcached instance resource name in the format: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_memcache.delete_instance.js - * region_tag:memcache_v1_generated_CloudMemcache_DeleteInstance_async - */ - deleteInstance( - request?: protos.google.cloud.memcache.v1.IDeleteInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteInstance( - request: protos.google.cloud.memcache.v1.IDeleteInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request: protos.google.cloud.memcache.v1.IDeleteInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request?: protos.google.cloud.memcache.v1.IDeleteInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_memcache.delete_instance.js - * region_tag:memcache_v1_generated_CloudMemcache_DeleteInstance_async - */ - async checkDeleteInstanceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * `ApplyParameters` restarts the set of specified nodes in order to update - * them to the current set of parameters for the Memcached Instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the Memcached instance for which parameter group updates - * should be applied. - * @param {string[]} request.nodeIds - * Nodes to which the instance-level parameter group is applied. - * @param {boolean} request.applyAll - * Whether to apply instance-level parameter group to all nodes. If set to - * true, users are restricted from specifying individual nodes, and - * `ApplyParameters` updates all nodes within the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_memcache.apply_parameters.js - * region_tag:memcache_v1_generated_CloudMemcache_ApplyParameters_async - */ - applyParameters( - request?: protos.google.cloud.memcache.v1.IApplyParametersRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - applyParameters( - request: protos.google.cloud.memcache.v1.IApplyParametersRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - applyParameters( - request: protos.google.cloud.memcache.v1.IApplyParametersRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - applyParameters( - request?: protos.google.cloud.memcache.v1.IApplyParametersRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.applyParameters(request, options, callback); - } -/** - * Check the status of the long running operation returned by `applyParameters()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_memcache.apply_parameters.js - * region_tag:memcache_v1_generated_CloudMemcache_ApplyParameters_async - */ - async checkApplyParametersProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.applyParameters, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Reschedules upcoming maintenance event. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Memcache instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - * @param {google.cloud.memcache.v1.RescheduleMaintenanceRequest.RescheduleType} request.rescheduleType - * Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well. - * @param {google.protobuf.Timestamp} request.scheduleTime - * Timestamp when the maintenance shall be rescheduled to if - * reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for - * example `2012-11-15T16:19:00.094Z`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_memcache.reschedule_maintenance.js - * region_tag:memcache_v1_generated_CloudMemcache_RescheduleMaintenance_async - */ - rescheduleMaintenance( - request?: protos.google.cloud.memcache.v1.IRescheduleMaintenanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - rescheduleMaintenance( - request: protos.google.cloud.memcache.v1.IRescheduleMaintenanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - rescheduleMaintenance( - request: protos.google.cloud.memcache.v1.IRescheduleMaintenanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - rescheduleMaintenance( - request?: protos.google.cloud.memcache.v1.IRescheduleMaintenanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'instance': request.instance ?? '', - }); - this.initialize(); - return this.innerApiCalls.rescheduleMaintenance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `rescheduleMaintenance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_memcache.reschedule_maintenance.js - * region_tag:memcache_v1_generated_CloudMemcache_RescheduleMaintenance_async - */ - async checkRescheduleMaintenanceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.rescheduleMaintenance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Instances in a given location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 1000 will be used by the service. - * Regardless of the `page_size` value, the response may include a partial - * list and a caller should only rely on response's - * {@link protos.google.cloud.memcache.v1.ListInstancesResponse.next_page_token|`next_page_token`} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. For example, exclude all Memcached instances with name as - * my-instance by specifying `"name != my-instance"`. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.memcache.v1.Instance|Instance}. - * 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 `listInstancesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listInstances( - request?: protos.google.cloud.memcache.v1.IListInstancesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.memcache.v1.IInstance[], - protos.google.cloud.memcache.v1.IListInstancesRequest|null, - protos.google.cloud.memcache.v1.IListInstancesResponse - ]>; - listInstances( - request: protos.google.cloud.memcache.v1.IListInstancesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.memcache.v1.IListInstancesRequest, - protos.google.cloud.memcache.v1.IListInstancesResponse|null|undefined, - protos.google.cloud.memcache.v1.IInstance>): void; - listInstances( - request: protos.google.cloud.memcache.v1.IListInstancesRequest, - callback: PaginationCallback< - protos.google.cloud.memcache.v1.IListInstancesRequest, - protos.google.cloud.memcache.v1.IListInstancesResponse|null|undefined, - protos.google.cloud.memcache.v1.IInstance>): void; - listInstances( - request?: protos.google.cloud.memcache.v1.IListInstancesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.memcache.v1.IListInstancesRequest, - protos.google.cloud.memcache.v1.IListInstancesResponse|null|undefined, - protos.google.cloud.memcache.v1.IInstance>, - callback?: PaginationCallback< - protos.google.cloud.memcache.v1.IListInstancesRequest, - protos.google.cloud.memcache.v1.IListInstancesResponse|null|undefined, - protos.google.cloud.memcache.v1.IInstance>): - Promise<[ - protos.google.cloud.memcache.v1.IInstance[], - protos.google.cloud.memcache.v1.IListInstancesRequest|null, - protos.google.cloud.memcache.v1.IListInstancesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listInstances(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 1000 will be used by the service. - * Regardless of the `page_size` value, the response may include a partial - * list and a caller should only rely on response's - * {@link protos.google.cloud.memcache.v1.ListInstancesResponse.next_page_token|`next_page_token`} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. For example, exclude all Memcached instances with name as - * my-instance by specifying `"name != my-instance"`. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @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 protos.google.cloud.memcache.v1.Instance|Instance} 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 `listInstancesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listInstancesStream( - request?: protos.google.cloud.memcache.v1.IListInstancesRequest, - 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['listInstances']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listInstances.createStream( - this.innerApiCalls.listInstances as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listInstances`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 1000 will be used by the service. - * Regardless of the `page_size` value, the response may include a partial - * list and a caller should only rely on response's - * {@link protos.google.cloud.memcache.v1.ListInstancesResponse.next_page_token|`next_page_token`} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. For example, exclude all Memcached instances with name as - * my-instance by specifying `"name != my-instance"`. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.memcache.v1.Instance|Instance}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cloud_memcache.list_instances.js - * region_tag:memcache_v1_generated_CloudMemcache_ListInstances_async - */ - listInstancesAsync( - request?: protos.google.cloud.memcache.v1.IListInstancesRequest, - 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['listInstances']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listInstances.asyncIterate( - this.innerApiCalls['listInstances'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified instance resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} instance - * @returns {string} Resource name string. - */ - instancePath(project:string,location:string,instance:string) { - return this.pathTemplates.instancePathTemplate.render({ - project: project, - location: location, - instance: instance, - }); - } - - /** - * Parse the project from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).project; - } - - /** - * Parse the location from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the location. - */ - matchLocationFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).location; - } - - /** - * Parse the instance from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).instance; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.cloudMemcacheStub && !this._terminated) { - return this.cloudMemcacheStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_client_config.json b/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_client_config.json deleted file mode 100644 index 6703aba61f7..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_client_config.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.cloud.memcache.v1.CloudMemcache": { - "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": { - "ListInstances": { - "timeout_millis": 1200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetInstance": { - "timeout_millis": 1200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateInstance": { - "timeout_millis": 1200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateInstance": { - "timeout_millis": 1200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateParameters": { - "timeout_millis": 1200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteInstance": { - "timeout_millis": 1200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ApplyParameters": { - "timeout_millis": 1200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RescheduleMaintenance": { - "timeout_millis": 1200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_proto_list.json b/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_proto_list.json deleted file mode 100644 index 759395dd6de..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/src/v1/cloud_memcache_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/memcache/v1/cloud_memcache.proto" -] diff --git a/owl-bot-staging/google-cloud-memcache/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-memcache/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 9ac5b347836..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.memcache.v1", - "libraryPackage": "@google-cloud/memcache", - "services": { - "CloudMemcache": { - "clients": { - "grpc": { - "libraryClient": "CloudMemcacheClient", - "rpcs": { - "GetInstance": { - "methods": [ - "getInstance" - ] - }, - "CreateInstance": { - "methods": [ - "createInstance" - ] - }, - "UpdateInstance": { - "methods": [ - "updateInstance" - ] - }, - "UpdateParameters": { - "methods": [ - "updateParameters" - ] - }, - "DeleteInstance": { - "methods": [ - "deleteInstance" - ] - }, - "ApplyParameters": { - "methods": [ - "applyParameters" - ] - }, - "RescheduleMaintenance": { - "methods": [ - "rescheduleMaintenance" - ] - }, - "ListInstances": { - "methods": [ - "listInstances", - "listInstancesStream", - "listInstancesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "CloudMemcacheClient", - "rpcs": { - "GetInstance": { - "methods": [ - "getInstance" - ] - }, - "CreateInstance": { - "methods": [ - "createInstance" - ] - }, - "UpdateInstance": { - "methods": [ - "updateInstance" - ] - }, - "UpdateParameters": { - "methods": [ - "updateParameters" - ] - }, - "DeleteInstance": { - "methods": [ - "deleteInstance" - ] - }, - "ApplyParameters": { - "methods": [ - "applyParameters" - ] - }, - "RescheduleMaintenance": { - "methods": [ - "rescheduleMaintenance" - ] - }, - "ListInstances": { - "methods": [ - "listInstances", - "listInstancesStream", - "listInstancesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-memcache/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-memcache/v1/src/v1/index.ts deleted file mode 100644 index bd2e3e67c99..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/src/v1/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 {CloudMemcacheClient} from './cloud_memcache_client'; diff --git a/owl-bot-staging/google-cloud-memcache/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-memcache/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 4a105a18a37..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/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 memcache = require('@google-cloud/memcache'); - -function main() { - const cloudMemcacheClient = new memcache.CloudMemcacheClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-memcache/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-memcache/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index b6fcb720803..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/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 {CloudMemcacheClient} from '@google-cloud/memcache'; - -// check that the client class type name can be used -function doStuffWithCloudMemcacheClient(client: CloudMemcacheClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const cloudMemcacheClient = new CloudMemcacheClient(); - doStuffWithCloudMemcacheClient(cloudMemcacheClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-memcache/v1/system-test/install.ts b/owl-bot-staging/google-cloud-memcache/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-memcache/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-memcache/v1/test/gapic_cloud_memcache_v1.ts b/owl-bot-staging/google-cloud-memcache/v1/test/gapic_cloud_memcache_v1.ts deleted file mode 100644 index 02af34118ac..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1/test/gapic_cloud_memcache_v1.ts +++ /dev/null @@ -1,2002 +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 cloudmemcacheModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.CloudMemcacheClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = cloudmemcacheModule.v1.CloudMemcacheClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = cloudmemcacheModule.v1.CloudMemcacheClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = cloudmemcacheModule.v1.CloudMemcacheClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudMemcacheStub, undefined); - await client.initialize(); - assert(client.cloudMemcacheStub); - }); - - it('has close method for the initialized client', done => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.cloudMemcacheStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudMemcacheStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - 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 cloudmemcacheModule.v1.CloudMemcacheClient({ - 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('getInstance', () => { - it('invokes getInstance without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.memcache.v1.Instance() - ); - client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); - const [response] = await client.getInstance(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance without error using callback', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.memcache.v1.Instance() - ); - client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInstance( - request, - (err?: Error|null, result?: protos.google.cloud.memcache.v1.IInstance|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance with error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance with closed client', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getInstance(request), expectedError); - }); - }); - - describe('createInstance', () => { - it('invokes createInstance without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.createInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance without error using callback', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance with call error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance with LRO error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateInstanceProgress without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateInstanceProgress with error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateInstance', () => { - it('invokes updateInstance without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.UpdateInstanceRequest() - ); - request.instance ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.UpdateInstanceRequest', ['instance', 'name']); - request.instance.name = defaultValue1; - const expectedHeaderRequestParams = `instance.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInstance without error using callback', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.UpdateInstanceRequest() - ); - request.instance ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.UpdateInstanceRequest', ['instance', 'name']); - request.instance.name = defaultValue1; - const expectedHeaderRequestParams = `instance.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInstance with call error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.UpdateInstanceRequest() - ); - request.instance ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.UpdateInstanceRequest', ['instance', 'name']); - request.instance.name = defaultValue1; - const expectedHeaderRequestParams = `instance.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInstance with LRO error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.UpdateInstanceRequest() - ); - request.instance ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.UpdateInstanceRequest', ['instance', 'name']); - request.instance.name = defaultValue1; - const expectedHeaderRequestParams = `instance.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateInstanceProgress without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateInstanceProgress with error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateParameters', () => { - it('invokes updateParameters without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.UpdateParametersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.UpdateParametersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateParameters = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateParameters(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateParameters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateParameters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateParameters without error using callback', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.UpdateParametersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.UpdateParametersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateParameters = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateParameters( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateParameters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateParameters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateParameters with call error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.UpdateParametersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.UpdateParametersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateParameters = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateParameters(request), expectedError); - const actualRequest = (client.innerApiCalls.updateParameters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateParameters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateParameters with LRO error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.UpdateParametersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.UpdateParametersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateParameters = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateParameters(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateParameters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateParameters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateParametersProgress without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateParametersProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateParametersProgress with error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateParametersProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteInstance', () => { - it('invokes deleteInstance without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance without error using callback', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance with call error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance with LRO error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteInstanceProgress without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteInstanceProgress with error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('applyParameters', () => { - it('invokes applyParameters without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.ApplyParametersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.ApplyParametersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.applyParameters = stubLongRunningCall(expectedResponse); - const [operation] = await client.applyParameters(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.applyParameters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.applyParameters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes applyParameters without error using callback', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.ApplyParametersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.ApplyParametersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.applyParameters = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.applyParameters( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.applyParameters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.applyParameters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes applyParameters with call error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.ApplyParametersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.ApplyParametersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.applyParameters = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.applyParameters(request), expectedError); - const actualRequest = (client.innerApiCalls.applyParameters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.applyParameters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes applyParameters with LRO error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.ApplyParametersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.ApplyParametersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.applyParameters = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.applyParameters(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.applyParameters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.applyParameters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkApplyParametersProgress without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkApplyParametersProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkApplyParametersProgress with error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkApplyParametersProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('rescheduleMaintenance', () => { - it('invokes rescheduleMaintenance without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.RescheduleMaintenanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.RescheduleMaintenanceRequest', ['instance']); - request.instance = defaultValue1; - const expectedHeaderRequestParams = `instance=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.rescheduleMaintenance = stubLongRunningCall(expectedResponse); - const [operation] = await client.rescheduleMaintenance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rescheduleMaintenance without error using callback', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.RescheduleMaintenanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.RescheduleMaintenanceRequest', ['instance']); - request.instance = defaultValue1; - const expectedHeaderRequestParams = `instance=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.rescheduleMaintenance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rescheduleMaintenance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rescheduleMaintenance with call error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.RescheduleMaintenanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.RescheduleMaintenanceRequest', ['instance']); - request.instance = defaultValue1; - const expectedHeaderRequestParams = `instance=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rescheduleMaintenance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.rescheduleMaintenance(request), expectedError); - const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rescheduleMaintenance with LRO error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.RescheduleMaintenanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.RescheduleMaintenanceRequest', ['instance']); - request.instance = defaultValue1; - const expectedHeaderRequestParams = `instance=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rescheduleMaintenance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.rescheduleMaintenance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRescheduleMaintenanceProgress without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRescheduleMaintenanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRescheduleMaintenanceProgress with error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRescheduleMaintenanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listInstances', () => { - it('invokes listInstances without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), - generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), - generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), - ]; - client.innerApiCalls.listInstances = stubSimpleCall(expectedResponse); - const [response] = await client.listInstances(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInstances without error using callback', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), - generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), - generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), - ]; - client.innerApiCalls.listInstances = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInstances( - request, - (err?: Error|null, result?: protos.google.cloud.memcache.v1.IInstance[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInstances with error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInstances = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInstances(request), expectedError); - const actualRequest = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInstancesStream without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), - generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), - generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), - ]; - client.descriptors.page.listInstances.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInstancesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.memcache.v1.Instance[] = []; - stream.on('data', (response: protos.google.cloud.memcache.v1.Instance) => { - 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.listInstances.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); - assert( - (client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listInstancesStream with error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listInstances.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInstancesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.memcache.v1.Instance[] = []; - stream.on('data', (response: protos.google.cloud.memcache.v1.Instance) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); - assert( - (client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInstances without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), - generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), - generateSampleMessage(new protos.google.cloud.memcache.v1.Instance()), - ]; - client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.memcache.v1.IInstance[] = []; - const iterable = client.listInstancesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInstances with error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInstancesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.memcache.v1.IInstance[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('instance', () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - instance: "instanceValue", - }; - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "locationValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInstanceName', () => { - const result = client.matchLocationFromInstanceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new cloudmemcacheModule.v1.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-memcache/v1/tsconfig.json b/owl-bot-staging/google-cloud-memcache/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-memcache/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-memcache/v1/webpack.config.js b/owl-bot-staging/google-cloud-memcache/v1/webpack.config.js deleted file mode 100644 index 798f84c54f5..00000000000 --- a/owl-bot-staging/google-cloud-memcache/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: 'CloudMemcache', - filename: './cloud-memcache.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-memcache/v1beta2/.eslintignore b/owl-bot-staging/google-cloud-memcache/v1beta2/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/.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-memcache/v1beta2/.eslintrc.json b/owl-bot-staging/google-cloud-memcache/v1beta2/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/.gitignore b/owl-bot-staging/google-cloud-memcache/v1beta2/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/.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-memcache/v1beta2/.jsdoc.js b/owl-bot-staging/google-cloud-memcache/v1beta2/.jsdoc.js deleted file mode 100644 index 3933f5c8b73..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/.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/memcache', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/.mocharc.js b/owl-bot-staging/google-cloud-memcache/v1beta2/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/.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-memcache/v1beta2/.prettierrc.js b/owl-bot-staging/google-cloud-memcache/v1beta2/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/.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-memcache/v1beta2/README.md b/owl-bot-staging/google-cloud-memcache/v1beta2/README.md deleted file mode 100644 index fc7ba0933a7..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/README.md +++ /dev/null @@ -1 +0,0 @@ -Memcache: Nodejs Client diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/package.json b/owl-bot-staging/google-cloud-memcache/v1beta2/package.json deleted file mode 100644 index ac0a246880d..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/memcache", - "version": "0.1.0", - "description": "Memcache client for Node.js", - "repository": "googleapis/nodejs-memcache", - "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 memcache", - "memcache", - "cloud memcache" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/protos/google/cloud/memcache/v1beta2/cloud_memcache.proto b/owl-bot-staging/google-cloud-memcache/v1beta2/protos/google/cloud/memcache/v1beta2/cloud_memcache.proto deleted file mode 100644 index d69951f1245..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/protos/google/cloud/memcache/v1beta2/cloud_memcache.proto +++ /dev/null @@ -1,658 +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 -// -// 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.memcache.v1beta2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/type/dayofweek.proto"; -import "google/type/timeofday.proto"; - -option go_package = "cloud.google.com/go/memcache/apiv1beta2/memcachepb;memcachepb"; -option java_multiple_files = true; -option java_outer_classname = "CloudMemcacheProto"; -option java_package = "com.google.cloud.memcache.v1beta2"; - -// Configures and manages Cloud Memorystore for Memcached instances. -// -// -// The `memcache.googleapis.com` service implements the Google Cloud Memorystore -// for Memcached API and defines the following resource model for managing -// Memorystore Memcached (also called Memcached below) instances: -// * The service works with a collection of cloud projects, named: `/projects/*` -// * Each project has a collection of available locations, named: `/locations/*` -// * Each location has a collection of Memcached instances, named: -// `/instances/*` -// * As such, Memcached instances are resources of the form: -// `/projects/{project_id}/locations/{location_id}/instances/{instance_id}` -// -// Note that location_id must be a GCP `region`; for example: -// * `projects/my-memcached-project/locations/us-central1/instances/my-memcached` -service CloudMemcache { - option (google.api.default_host) = "memcache.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists Instances in a given location. - rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) { - option (google.api.http) = { - get: "/v1beta2/{parent=projects/*/locations/*}/instances" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single Instance. - rpc GetInstance(GetInstanceRequest) returns (Instance) { - option (google.api.http) = { - get: "/v1beta2/{name=projects/*/locations/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new Instance in a given location. - rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta2/{parent=projects/*/locations/*}/instances" - body: "resource" - }; - option (google.api.method_signature) = "parent,instance_id,resource"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.memcache.v1beta2.Instance" - metadata_type: "google.cloud.memcache.v1beta2.OperationMetadata" - }; - } - - // Updates an existing Instance in a given project and location. - rpc UpdateInstance(UpdateInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta2/{resource.name=projects/*/locations/*/instances/*}" - body: "resource" - }; - option (google.api.method_signature) = "update_mask,resource"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.memcache.v1beta2.Instance" - metadata_type: "google.cloud.memcache.v1beta2.OperationMetadata" - }; - } - - // Updates the defined Memcached parameters for an existing instance. - // This method only stages the parameters, it must be followed by - // `ApplyParameters` to apply the parameters to nodes of the Memcached - // instance. - rpc UpdateParameters(UpdateParametersRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta2/{name=projects/*/locations/*/instances/*}:updateParameters" - body: "*" - }; - option (google.api.method_signature) = "name,update_mask,parameters"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.memcache.v1beta2.Instance" - metadata_type: "google.cloud.memcache.v1beta2.OperationMetadata" - }; - } - - // Deletes a single Instance. - rpc DeleteInstance(DeleteInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta2/{name=projects/*/locations/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.memcache.v1beta2.OperationMetadata" - }; - } - - // `ApplyParameters` restarts the set of specified nodes in order to update - // them to the current set of parameters for the Memcached Instance. - rpc ApplyParameters(ApplyParametersRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta2/{name=projects/*/locations/*/instances/*}:applyParameters" - body: "*" - }; - option (google.api.method_signature) = "name,node_ids,apply_all"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.memcache.v1beta2.Instance" - metadata_type: "google.cloud.memcache.v1beta2.OperationMetadata" - }; - } - - // Updates software on the selected nodes of the Instance. - rpc ApplySoftwareUpdate(ApplySoftwareUpdateRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta2/{instance=projects/*/locations/*/instances/*}:applySoftwareUpdate" - body: "*" - }; - option (google.api.method_signature) = "instance,node_ids,apply_all"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.memcache.v1beta2.Instance" - metadata_type: "google.cloud.memcache.v1beta2.OperationMetadata" - }; - } - - // Performs the apply phase of the RescheduleMaintenance verb. - rpc RescheduleMaintenance(RescheduleMaintenanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta2/{instance=projects/*/locations/*/instances/*}:rescheduleMaintenance" - body: "*" - }; - option (google.api.method_signature) = "instance, reschedule_type, schedule_time"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.memcache.v1beta2.Instance" - metadata_type: "google.cloud.memcache.v1beta2.OperationMetadata" - }; - } -} - -// A Memorystore for Memcached instance -message Instance { - option (google.api.resource) = { - type: "memcache.googleapis.com/Instance" - pattern: "projects/{project}/locations/{location}/instances/{instance}" - }; - - // Different states of a Memcached instance. - enum State { - // State not set. - STATE_UNSPECIFIED = 0; - - // Memcached instance is being created. - CREATING = 1; - - // Memcached instance has been created and ready to be used. - READY = 2; - - // Memcached instance is updating configuration such as maintenance policy - // and schedule. - UPDATING = 3; - - // Memcached instance is being deleted. - DELETING = 4; - - // Memcached instance is going through maintenance, e.g. data plane rollout. - PERFORMING_MAINTENANCE = 5; - } - - // Configuration for a Memcached Node. - message NodeConfig { - // Required. Number of cpus per Memcached node. - int32 cpu_count = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Memory size in MiB for each Memcached node. - int32 memory_size_mb = 2 [(google.api.field_behavior) = REQUIRED]; - } - - message Node { - // Different states of a Memcached node. - enum State { - // Node state is not set. - STATE_UNSPECIFIED = 0; - - // Node is being created. - CREATING = 1; - - // Node has been created and ready to be used. - READY = 2; - - // Node is being deleted. - DELETING = 3; - - // Node is being updated. - UPDATING = 4; - } - - // Output only. Identifier of the Memcached node. The node id does not - // include project or location like the Memcached instance name. - string node_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Location (GCP Zone) for the Memcached node. - string zone = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Current state of the Memcached node. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Hostname or IP address of the Memcached node used by the - // clients to connect to the Memcached server on this node. - string host = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The port number of the Memcached server on this node. - int32 port = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User defined parameters currently applied to the node. - MemcacheParameters parameters = 6; - - // Output only. Returns true if there is an update waiting to be applied - bool update_available = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - message InstanceMessage { - enum Code { - // Message Code not set. - CODE_UNSPECIFIED = 0; - - // Memcached nodes are distributed unevenly. - ZONE_DISTRIBUTION_UNBALANCED = 1; - } - - // A code that correspond to one type of user-facing message. - Code code = 1; - - // Message on memcached instance which will be exposed to users. - string message = 2; - } - - // Required. Unique name of the resource in this scope including project and - // location using the form: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // - // Note: Memcached instances are managed and addressed at the regional level - // so `location_id` here refers to a Google Cloud region; however, users may - // choose which zones Memcached nodes should be provisioned in within an - // instance. Refer to [zones][google.cloud.memcache.v1beta2.Instance.zones] field for more details. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // User provided name for the instance, which is only used for display - // purposes. Cannot be more than 80 characters. - string display_name = 2; - - // Resource labels to represent user-provided metadata. - // Refer to cloud documentation on labels for more details. - // https://cloud.google.com/compute/docs/labeling-resources - map labels = 3; - - // The full name of the Google Compute Engine - // [network](https://cloud.google.com/vpc/docs/vpc) to which the - // instance is connected. If left unspecified, the `default` network - // will be used. - string authorized_network = 4; - - // Zones in which Memcached nodes should be provisioned. - // Memcached nodes will be equally distributed across these zones. If not - // provided, the service will by default create nodes in all zones in the - // region for the instance. - repeated string zones = 5; - - // Required. Number of nodes in the Memcached instance. - int32 node_count = 6 [(google.api.field_behavior) = REQUIRED]; - - // Required. Configuration for Memcached nodes. - NodeConfig node_config = 7 [(google.api.field_behavior) = REQUIRED]; - - // The major version of Memcached software. - // If not provided, latest supported version will be used. Currently the - // latest supported major version is `MEMCACHE_1_5`. - // The minor version will be automatically determined by our system based on - // the latest supported minor version. - MemcacheVersion memcache_version = 9; - - // User defined parameters to apply to the memcached process - // on each node. - MemcacheParameters parameters = 11; - - // Output only. List of Memcached nodes. - // Refer to [Node][google.cloud.memcache.v1beta2.Instance.Node] message for more details. - repeated Node memcache_nodes = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the instance was created. - google.protobuf.Timestamp create_time = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the instance was updated. - google.protobuf.Timestamp update_time = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The state of this Memcached instance. - State state = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The full version of memcached server running on this instance. - // System automatically determines the full memcached version for an instance - // based on the input MemcacheVersion. - // The full version format will be "memcached-1.5.16". - string memcache_full_version = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // List of messages that describe the current state of the Memcached instance. - repeated InstanceMessage instance_messages = 19; - - // Output only. Endpoint for the Discovery API. - string discovery_endpoint = 20 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Returns true if there is an update waiting to be applied - bool update_available = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The maintenance policy for the instance. If not provided, - // the maintenance event will be performed based on Memorystore - // internal rollout schedule. - MaintenancePolicy maintenance_policy = 22; - - // Output only. Published maintenance schedule. - MaintenanceSchedule maintenance_schedule = 23 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Maintenance policy per instance. -message MaintenancePolicy { - // Output only. The time when the policy was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the policy was updated. - google.protobuf.Timestamp update_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Description of what this policy is for. Create/Update methods - // return INVALID_ARGUMENT if the length is greater than 512. - string description = 3; - - // Required. Maintenance window that is applied to resources covered by this - // policy. Minimum 1. For the current version, the maximum number of - // weekly_maintenance_windows is expected to be one. - repeated WeeklyMaintenanceWindow weekly_maintenance_window = 4 [(google.api.field_behavior) = REQUIRED]; -} - -// Time window specified for weekly operations. -message WeeklyMaintenanceWindow { - // Required. Allows to define schedule that runs specified day of the week. - google.type.DayOfWeek day = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Start time of the window in UTC. - google.type.TimeOfDay start_time = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Duration of the time window. - google.protobuf.Duration duration = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Upcoming maintenance schedule. -message MaintenanceSchedule { - // Output only. The start time of any upcoming scheduled maintenance for this instance. - google.protobuf.Timestamp start_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The end time of any upcoming scheduled maintenance for this instance. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The deadline that the maintenance schedule start time can not go beyond, - // including reschedule. - google.protobuf.Timestamp schedule_deadline_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request for [ListInstances][google.cloud.memcache.v1beta2.CloudMemcache.ListInstances]. -message ListInstancesRequest { - // Required. The resource name of the instance location using the form: - // `projects/{project_id}/locations/{location_id}` - // where `location_id` refers to a GCP region - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of items to return. - // - // If not specified, a default value of 1000 will be used by the service. - // Regardless of the `page_size` value, the response may include a partial - // list and a caller should only rely on response's - // [`next_page_token`][google.cloud.memcache.v1beta2.ListInstancesResponse.next_page_token] - // to determine if there are more instances left to be queried. - int32 page_size = 2; - - // The `next_page_token` value returned from a previous List request, if any. - string page_token = 3; - - // List filter. For example, exclude all Memcached instances with name as - // my-instance by specifying `"name != my-instance"`. - string filter = 4; - - // Sort results. Supported values are "name", "name desc" or "" (unsorted). - string order_by = 5; -} - -// Response for [ListInstances][google.cloud.memcache.v1beta2.CloudMemcache.ListInstances]. -message ListInstancesResponse { - // A list of Memcached instances in the project in the specified location, - // or across all locations. - // - // If the `location_id` in the parent field of the request is "-", all regions - // available to the project are queried, and the results aggregated. - repeated Instance resources = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request for [GetInstance][google.cloud.memcache.v1beta2.CloudMemcache.GetInstance]. -message GetInstanceRequest { - // Required. Memcached instance resource name in the format: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // where `location_id` refers to a GCP region - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "memcache.googleapis.com/Instance" - } - ]; -} - -// Request for [CreateInstance][google.cloud.memcache.v1beta2.CloudMemcache.CreateInstance]. -message CreateInstanceRequest { - // Required. The resource name of the instance location using the form: - // `projects/{project_id}/locations/{location_id}` - // where `location_id` refers to a GCP region - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The logical name of the Memcached instance in the user - // project with the following restrictions: - // - // * Must contain only lowercase letters, numbers, and hyphens. - // * Must start with a letter. - // * Must be between 1-40 characters. - // * Must end with a number or a letter. - // * Must be unique within the user project / location. - // - // If any of the above are not met, the API raises an invalid argument error. - string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A Memcached [Instance] resource - Instance resource = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for [UpdateInstance][google.cloud.memcache.v1beta2.CloudMemcache.UpdateInstance]. -message UpdateInstanceRequest { - // Required. Mask of fields to update. - // - // * `displayName` - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A Memcached [Instance] resource. - // Only fields specified in update_mask are updated. - Instance resource = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for [DeleteInstance][google.cloud.memcache.v1beta2.CloudMemcache.DeleteInstance]. -message DeleteInstanceRequest { - // Required. Memcached instance resource name in the format: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // where `location_id` refers to a GCP region - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "memcache.googleapis.com/Instance" - } - ]; -} - -// Request for [RescheduleMaintenance][google.cloud.memcache.v1beta2.CloudMemcache.RescheduleMaintenance]. -message RescheduleMaintenanceRequest { - // Reschedule options. - enum RescheduleType { - // Not set. - RESCHEDULE_TYPE_UNSPECIFIED = 0; - - // If the user wants to schedule the maintenance to happen now. - IMMEDIATE = 1; - - // If the user wants to use the existing maintenance policy to find the - // next available window. - NEXT_AVAILABLE_WINDOW = 2; - - // If the user wants to reschedule the maintenance to a specific time. - SPECIFIC_TIME = 3; - } - - // Required. Memcache instance resource name using the form: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // where `location_id` refers to a GCP region. - string instance = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "memcache.googleapis.com/Instance" - } - ]; - - // Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well. - RescheduleType reschedule_type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Timestamp when the maintenance shall be rescheduled to if - // reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for - // example `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp schedule_time = 3; -} - -// Request for [ApplyParameters][google.cloud.memcache.v1beta2.CloudMemcache.ApplyParameters]. -message ApplyParametersRequest { - // Required. Resource name of the Memcached instance for which parameter group updates - // should be applied. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "memcache.googleapis.com/Instance" - } - ]; - - // Nodes to which the instance-level parameter group is applied. - repeated string node_ids = 2; - - // Whether to apply instance-level parameter group to all nodes. If set to - // true, users are restricted from specifying individual nodes, and - // `ApplyParameters` updates all nodes within the instance. - bool apply_all = 3; -} - -// Request for [UpdateParameters][google.cloud.memcache.v1beta2.CloudMemcache.UpdateParameters]. -message UpdateParametersRequest { - // Required. Resource name of the Memcached instance for which the parameters should be - // updated. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "memcache.googleapis.com/Instance" - } - ]; - - // Required. Mask of fields to update. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; - - // The parameters to apply to the instance. - MemcacheParameters parameters = 3; -} - -// Request for [ApplySoftwareUpdate][google.cloud.memcache.v1beta2.CloudMemcache.ApplySoftwareUpdate]. -message ApplySoftwareUpdateRequest { - // Required. Resource name of the Memcached instance for which software update should be - // applied. - string instance = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "memcache.googleapis.com/Instance" - } - ]; - - // Nodes to which we should apply the update to. Note all the selected nodes - // are updated in parallel. - repeated string node_ids = 2; - - // Whether to apply the update to all nodes. If set to - // true, will explicitly restrict users from specifying any nodes, and apply - // software update to all nodes (where applicable) within the instance. - bool apply_all = 3; -} - -// Memcached versions supported by our service. -enum MemcacheVersion { - MEMCACHE_VERSION_UNSPECIFIED = 0; - - // Memcached 1.5 version. - MEMCACHE_1_5 = 1; -} - -message MemcacheParameters { - // Output only. The unique ID associated with this set of parameters. Users - // can use this id to determine if the parameters associated with the instance - // differ from the parameters associated with the nodes. A discrepancy between - // parameter ids can inform users that they may need to take action to apply - // parameters on nodes. - string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User defined set of parameters to use in the memcached process. - map params = 3; -} - -// Represents the metadata of a long-running operation. -message OperationMetadata { - // Output only. Time when the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_detail = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Metadata for the given [google.cloud.location.Location][google.cloud.location.Location]. -message LocationMetadata { - // Output only. The set of available zones in the location. The map is keyed - // by the lowercase ID of each zone, as defined by GCE. These keys can be - // specified in the `zones` field when creating a Memcached instance. - map available_zones = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -message ZoneMetadata { - -} diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.apply_parameters.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.apply_parameters.js deleted file mode 100644 index 3ef904fb3a7..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.apply_parameters.js +++ /dev/null @@ -1,73 +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 memcache_v1beta2_generated_CloudMemcache_ApplyParameters_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. Resource name of the Memcached instance for which parameter group updates - * should be applied. - */ - // const name = 'abc123' - /** - * Nodes to which the instance-level parameter group is applied. - */ - // const nodeIds = ['abc','def'] - /** - * Whether to apply instance-level parameter group to all nodes. If set to - * true, users are restricted from specifying individual nodes, and - * `ApplyParameters` updates all nodes within the instance. - */ - // const applyAll = true - - // Imports the Memcache library - const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; - - // Instantiates a client - const memcacheClient = new CloudMemcacheClient(); - - async function callApplyParameters() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await memcacheClient.applyParameters(request); - const [response] = await operation.promise(); - console.log(response); - } - - callApplyParameters(); - // [END memcache_v1beta2_generated_CloudMemcache_ApplyParameters_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-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.apply_software_update.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.apply_software_update.js deleted file mode 100644 index ebbdfff1cec..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.apply_software_update.js +++ /dev/null @@ -1,74 +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(instance) { - // [START memcache_v1beta2_generated_CloudMemcache_ApplySoftwareUpdate_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. Resource name of the Memcached instance for which software update should be - * applied. - */ - // const instance = 'abc123' - /** - * Nodes to which we should apply the update to. Note all the selected nodes - * are updated in parallel. - */ - // const nodeIds = ['abc','def'] - /** - * Whether to apply the update to all nodes. If set to - * true, will explicitly restrict users from specifying any nodes, and apply - * software update to all nodes (where applicable) within the instance. - */ - // const applyAll = true - - // Imports the Memcache library - const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; - - // Instantiates a client - const memcacheClient = new CloudMemcacheClient(); - - async function callApplySoftwareUpdate() { - // Construct request - const request = { - instance, - }; - - // Run request - const [operation] = await memcacheClient.applySoftwareUpdate(request); - const [response] = await operation.promise(); - console.log(response); - } - - callApplySoftwareUpdate(); - // [END memcache_v1beta2_generated_CloudMemcache_ApplySoftwareUpdate_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-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.create_instance.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.create_instance.js deleted file mode 100644 index 83148a2e55d..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.create_instance.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, instanceId, resource) { - // [START memcache_v1beta2_generated_CloudMemcache_CreateInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region - */ - // const parent = 'abc123' - /** - * Required. The logical name of the Memcached instance in the user - * project with the following restrictions: - * * Must contain only lowercase letters, numbers, and hyphens. - * * Must start with a letter. - * * Must be between 1-40 characters. - * * Must end with a number or a letter. - * * Must be unique within the user project / location. - * If any of the above are not met, the API raises an invalid argument error. - */ - // const instanceId = 'abc123' - /** - * Required. A Memcached Instance resource - */ - // const resource = {} - - // Imports the Memcache library - const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; - - // Instantiates a client - const memcacheClient = new CloudMemcacheClient(); - - async function callCreateInstance() { - // Construct request - const request = { - parent, - instanceId, - resource, - }; - - // Run request - const [operation] = await memcacheClient.createInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateInstance(); - // [END memcache_v1beta2_generated_CloudMemcache_CreateInstance_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-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.delete_instance.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.delete_instance.js deleted file mode 100644 index 7bd66b43898..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.delete_instance.js +++ /dev/null @@ -1,64 +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 memcache_v1beta2_generated_CloudMemcache_DeleteInstance_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. Memcached instance resource name in the format: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region - */ - // const name = 'abc123' - - // Imports the Memcache library - const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; - - // Instantiates a client - const memcacheClient = new CloudMemcacheClient(); - - async function callDeleteInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await memcacheClient.deleteInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteInstance(); - // [END memcache_v1beta2_generated_CloudMemcache_DeleteInstance_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-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.get_instance.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.get_instance.js deleted file mode 100644 index 86408684165..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.get_instance.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 memcache_v1beta2_generated_CloudMemcache_GetInstance_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. Memcached instance resource name in the format: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region - */ - // const name = 'abc123' - - // Imports the Memcache library - const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; - - // Instantiates a client - const memcacheClient = new CloudMemcacheClient(); - - async function callGetInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await memcacheClient.getInstance(request); - console.log(response); - } - - callGetInstance(); - // [END memcache_v1beta2_generated_CloudMemcache_GetInstance_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-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.list_instances.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.list_instances.js deleted file mode 100644 index 189dcbe7759..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.list_instances.js +++ /dev/null @@ -1,87 +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 memcache_v1beta2_generated_CloudMemcache_ListInstances_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - * If not specified, a default value of 1000 will be used by the service. - * Regardless of the `page_size` value, the response may include a partial - * list and a caller should only rely on response's - * `next_page_token` google.cloud.memcache.v1beta2.ListInstancesResponse.next_page_token - * to determine if there are more instances left to be queried. - */ - // const pageSize = 1234 - /** - * The `next_page_token` value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - /** - * List filter. For example, exclude all Memcached instances with name as - * my-instance by specifying `"name != my-instance"`. - */ - // const filter = 'abc123' - /** - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - */ - // const orderBy = 'abc123' - - // Imports the Memcache library - const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; - - // Instantiates a client - const memcacheClient = new CloudMemcacheClient(); - - async function callListInstances() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await memcacheClient.listInstancesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListInstances(); - // [END memcache_v1beta2_generated_CloudMemcache_ListInstances_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-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.reschedule_maintenance.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.reschedule_maintenance.js deleted file mode 100644 index 73bde4e413a..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.reschedule_maintenance.js +++ /dev/null @@ -1,75 +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(instance, rescheduleType) { - // [START memcache_v1beta2_generated_CloudMemcache_RescheduleMaintenance_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. Memcache instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - */ - // const instance = 'abc123' - /** - * Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well. - */ - // const rescheduleType = {} - /** - * Timestamp when the maintenance shall be rescheduled to if - * reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for - * example `2012-11-15T16:19:00.094Z`. - */ - // const scheduleTime = {} - - // Imports the Memcache library - const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; - - // Instantiates a client - const memcacheClient = new CloudMemcacheClient(); - - async function callRescheduleMaintenance() { - // Construct request - const request = { - instance, - rescheduleType, - }; - - // Run request - const [operation] = await memcacheClient.rescheduleMaintenance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRescheduleMaintenance(); - // [END memcache_v1beta2_generated_CloudMemcache_RescheduleMaintenance_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-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.update_instance.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.update_instance.js deleted file mode 100644 index 19425eca79e..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.update_instance.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(updateMask, resource) { - // [START memcache_v1beta2_generated_CloudMemcache_UpdateInstance_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. Mask of fields to update. - * * `displayName` - */ - // const updateMask = {} - /** - * Required. A Memcached Instance resource. - * Only fields specified in update_mask are updated. - */ - // const resource = {} - - // Imports the Memcache library - const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; - - // Instantiates a client - const memcacheClient = new CloudMemcacheClient(); - - async function callUpdateInstance() { - // Construct request - const request = { - updateMask, - resource, - }; - - // Run request - const [operation] = await memcacheClient.updateInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateInstance(); - // [END memcache_v1beta2_generated_CloudMemcache_UpdateInstance_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-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.update_parameters.js b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.update_parameters.js deleted file mode 100644 index 9837e22e51a..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/cloud_memcache.update_parameters.js +++ /dev/null @@ -1,72 +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, updateMask) { - // [START memcache_v1beta2_generated_CloudMemcache_UpdateParameters_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. Resource name of the Memcached instance for which the parameters should be - * updated. - */ - // const name = 'abc123' - /** - * Required. Mask of fields to update. - */ - // const updateMask = {} - /** - * The parameters to apply to the instance. - */ - // const parameters = {} - - // Imports the Memcache library - const {CloudMemcacheClient} = require('@google-cloud/memcache').v1beta2; - - // Instantiates a client - const memcacheClient = new CloudMemcacheClient(); - - async function callUpdateParameters() { - // Construct request - const request = { - name, - updateMask, - }; - - // Run request - const [operation] = await memcacheClient.updateParameters(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateParameters(); - // [END memcache_v1beta2_generated_CloudMemcache_UpdateParameters_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-memcache/v1beta2/samples/generated/v1beta2/snippet_metadata_google.cloud.memcache.v1beta2.json b/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/snippet_metadata_google.cloud.memcache.v1beta2.json deleted file mode 100644 index 29c62d4469c..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/samples/generated/v1beta2/snippet_metadata_google.cloud.memcache.v1beta2.json +++ /dev/null @@ -1,435 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-memcache", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.memcache.v1beta2", - "version": "v1beta2" - } - ] - }, - "snippets": [ - { - "regionTag": "memcache_v1beta2_generated_CloudMemcache_ListInstances_async", - "title": "CloudMemcache listInstances Sample", - "origin": "API_DEFINITION", - "description": " Lists Instances in a given location.", - "canonical": true, - "file": "cloud_memcache.list_instances.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListInstances", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.ListInstances", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.memcache.v1beta2.ListInstancesResponse", - "client": { - "shortName": "CloudMemcacheClient", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" - }, - "method": { - "shortName": "ListInstances", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.ListInstances", - "service": { - "shortName": "CloudMemcache", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" - } - } - } - }, - { - "regionTag": "memcache_v1beta2_generated_CloudMemcache_GetInstance_async", - "title": "CloudMemcache getInstance Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single Instance.", - "canonical": true, - "file": "cloud_memcache.get_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetInstance", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.GetInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.memcache.v1beta2.Instance", - "client": { - "shortName": "CloudMemcacheClient", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" - }, - "method": { - "shortName": "GetInstance", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.GetInstance", - "service": { - "shortName": "CloudMemcache", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" - } - } - } - }, - { - "regionTag": "memcache_v1beta2_generated_CloudMemcache_CreateInstance_async", - "title": "CloudMemcache createInstance Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Instance in a given location.", - "canonical": true, - "file": "cloud_memcache.create_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateInstance", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.CreateInstance", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "instance_id", - "type": "TYPE_STRING" - }, - { - "name": "resource", - "type": ".google.cloud.memcache.v1beta2.Instance" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudMemcacheClient", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" - }, - "method": { - "shortName": "CreateInstance", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.CreateInstance", - "service": { - "shortName": "CloudMemcache", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" - } - } - } - }, - { - "regionTag": "memcache_v1beta2_generated_CloudMemcache_UpdateInstance_async", - "title": "CloudMemcache updateInstance Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing Instance in a given project and location.", - "canonical": true, - "file": "cloud_memcache.update_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateInstance", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.UpdateInstance", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "resource", - "type": ".google.cloud.memcache.v1beta2.Instance" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudMemcacheClient", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" - }, - "method": { - "shortName": "UpdateInstance", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.UpdateInstance", - "service": { - "shortName": "CloudMemcache", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" - } - } - } - }, - { - "regionTag": "memcache_v1beta2_generated_CloudMemcache_UpdateParameters_async", - "title": "CloudMemcache updateParameters Sample", - "origin": "API_DEFINITION", - "description": " Updates the defined Memcached parameters for an existing instance. This method only stages the parameters, it must be followed by `ApplyParameters` to apply the parameters to nodes of the Memcached instance.", - "canonical": true, - "file": "cloud_memcache.update_parameters.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateParameters", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.UpdateParameters", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "parameters", - "type": ".google.cloud.memcache.v1beta2.MemcacheParameters" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudMemcacheClient", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" - }, - "method": { - "shortName": "UpdateParameters", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.UpdateParameters", - "service": { - "shortName": "CloudMemcache", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" - } - } - } - }, - { - "regionTag": "memcache_v1beta2_generated_CloudMemcache_DeleteInstance_async", - "title": "CloudMemcache deleteInstance Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single Instance.", - "canonical": true, - "file": "cloud_memcache.delete_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteInstance", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.DeleteInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudMemcacheClient", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" - }, - "method": { - "shortName": "DeleteInstance", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.DeleteInstance", - "service": { - "shortName": "CloudMemcache", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" - } - } - } - }, - { - "regionTag": "memcache_v1beta2_generated_CloudMemcache_ApplyParameters_async", - "title": "CloudMemcache applyParameters Sample", - "origin": "API_DEFINITION", - "description": " `ApplyParameters` restarts the set of specified nodes in order to update them to the current set of parameters for the Memcached Instance.", - "canonical": true, - "file": "cloud_memcache.apply_parameters.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ApplyParameters", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.ApplyParameters", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "node_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "apply_all", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudMemcacheClient", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" - }, - "method": { - "shortName": "ApplyParameters", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.ApplyParameters", - "service": { - "shortName": "CloudMemcache", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" - } - } - } - }, - { - "regionTag": "memcache_v1beta2_generated_CloudMemcache_ApplySoftwareUpdate_async", - "title": "CloudMemcache applySoftwareUpdate Sample", - "origin": "API_DEFINITION", - "description": " Updates software on the selected nodes of the Instance.", - "canonical": true, - "file": "cloud_memcache.apply_software_update.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ApplySoftwareUpdate", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.ApplySoftwareUpdate", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "node_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "apply_all", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudMemcacheClient", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" - }, - "method": { - "shortName": "ApplySoftwareUpdate", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.ApplySoftwareUpdate", - "service": { - "shortName": "CloudMemcache", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" - } - } - } - }, - { - "regionTag": "memcache_v1beta2_generated_CloudMemcache_RescheduleMaintenance_async", - "title": "CloudMemcache rescheduleMaintenance Sample", - "origin": "API_DEFINITION", - "description": " Performs the apply phase of the RescheduleMaintenance verb.", - "canonical": true, - "file": "cloud_memcache.reschedule_maintenance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RescheduleMaintenance", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.RescheduleMaintenance", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "reschedule_type", - "type": ".google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest.RescheduleType" - }, - { - "name": "schedule_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudMemcacheClient", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcacheClient" - }, - "method": { - "shortName": "RescheduleMaintenance", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache.RescheduleMaintenance", - "service": { - "shortName": "CloudMemcache", - "fullName": "google.cloud.memcache.v1beta2.CloudMemcache" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/src/index.ts b/owl-bot-staging/google-cloud-memcache/v1beta2/src/index.ts deleted file mode 100644 index cecd99af5a7..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/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 v1beta2 from './v1beta2'; -const CloudMemcacheClient = v1beta2.CloudMemcacheClient; -type CloudMemcacheClient = v1beta2.CloudMemcacheClient; -export {v1beta2, CloudMemcacheClient}; -export default {v1beta2, CloudMemcacheClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_client.ts b/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_client.ts deleted file mode 100644 index 86c2e73594c..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_client.ts +++ /dev/null @@ -1,1724 +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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1beta2/cloud_memcache_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './cloud_memcache_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Configures and manages Cloud Memorystore for Memcached instances. - * - * - * The `memcache.googleapis.com` service implements the Google Cloud Memorystore - * for Memcached API and defines the following resource model for managing - * Memorystore Memcached (also called Memcached below) instances: - * * The service works with a collection of cloud projects, named: `/projects/*` - * * Each project has a collection of available locations, named: `/locations/*` - * * Each location has a collection of Memcached instances, named: - * `/instances/*` - * * As such, Memcached instances are resources of the form: - * `/projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * - * Note that location_id must be a GCP `region`; for example: - * * `projects/my-memcached-project/locations/us-central1/instances/my-memcached` - * @class - * @memberof v1beta2 - */ -export class CloudMemcacheClient { - 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}; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - cloudMemcacheStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CloudMemcacheClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 CloudMemcacheClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof CloudMemcacheClient; - 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; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - 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 = { - instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/instances/{instance}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listInstances: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta2/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta2/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta2/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta2/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.memcache.v1beta2.Instance') as gax.protobuf.Type; - const createInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.memcache.v1beta2.OperationMetadata') as gax.protobuf.Type; - const updateInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.memcache.v1beta2.Instance') as gax.protobuf.Type; - const updateInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.memcache.v1beta2.OperationMetadata') as gax.protobuf.Type; - const updateParametersResponse = protoFilesRoot.lookup( - '.google.cloud.memcache.v1beta2.Instance') as gax.protobuf.Type; - const updateParametersMetadata = protoFilesRoot.lookup( - '.google.cloud.memcache.v1beta2.OperationMetadata') as gax.protobuf.Type; - const deleteInstanceResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.memcache.v1beta2.OperationMetadata') as gax.protobuf.Type; - const applyParametersResponse = protoFilesRoot.lookup( - '.google.cloud.memcache.v1beta2.Instance') as gax.protobuf.Type; - const applyParametersMetadata = protoFilesRoot.lookup( - '.google.cloud.memcache.v1beta2.OperationMetadata') as gax.protobuf.Type; - const applySoftwareUpdateResponse = protoFilesRoot.lookup( - '.google.cloud.memcache.v1beta2.Instance') as gax.protobuf.Type; - const applySoftwareUpdateMetadata = protoFilesRoot.lookup( - '.google.cloud.memcache.v1beta2.OperationMetadata') as gax.protobuf.Type; - const rescheduleMaintenanceResponse = protoFilesRoot.lookup( - '.google.cloud.memcache.v1beta2.Instance') as gax.protobuf.Type; - const rescheduleMaintenanceMetadata = protoFilesRoot.lookup( - '.google.cloud.memcache.v1beta2.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createInstanceResponse.decode.bind(createInstanceResponse), - createInstanceMetadata.decode.bind(createInstanceMetadata)), - updateInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateInstanceResponse.decode.bind(updateInstanceResponse), - updateInstanceMetadata.decode.bind(updateInstanceMetadata)), - updateParameters: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateParametersResponse.decode.bind(updateParametersResponse), - updateParametersMetadata.decode.bind(updateParametersMetadata)), - deleteInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteInstanceResponse.decode.bind(deleteInstanceResponse), - deleteInstanceMetadata.decode.bind(deleteInstanceMetadata)), - applyParameters: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - applyParametersResponse.decode.bind(applyParametersResponse), - applyParametersMetadata.decode.bind(applyParametersMetadata)), - applySoftwareUpdate: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - applySoftwareUpdateResponse.decode.bind(applySoftwareUpdateResponse), - applySoftwareUpdateMetadata.decode.bind(applySoftwareUpdateMetadata)), - rescheduleMaintenance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - rescheduleMaintenanceResponse.decode.bind(rescheduleMaintenanceResponse), - rescheduleMaintenanceMetadata.decode.bind(rescheduleMaintenanceMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.memcache.v1beta2.CloudMemcache', 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.cloudMemcacheStub) { - return this.cloudMemcacheStub; - } - - // Put together the "service stub" for - // google.cloud.memcache.v1beta2.CloudMemcache. - this.cloudMemcacheStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.memcache.v1beta2.CloudMemcache') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.memcache.v1beta2.CloudMemcache, - 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 cloudMemcacheStubMethods = - ['listInstances', 'getInstance', 'createInstance', 'updateInstance', 'updateParameters', 'deleteInstance', 'applyParameters', 'applySoftwareUpdate', 'rescheduleMaintenance']; - for (const methodName of cloudMemcacheStubMethods) { - const callPromise = this.cloudMemcacheStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.cloudMemcacheStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'memcache.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 'memcache.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 -- - // ------------------- -/** - * Gets details of a single Instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Memcached instance resource name in the format: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.memcache.v1beta2.Instance|Instance}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/cloud_memcache.get_instance.js - * region_tag:memcache_v1beta2_generated_CloudMemcache_GetInstance_async - */ - getInstance( - request?: protos.google.cloud.memcache.v1beta2.IGetInstanceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.memcache.v1beta2.IInstance, - protos.google.cloud.memcache.v1beta2.IGetInstanceRequest|undefined, {}|undefined - ]>; - getInstance( - request: protos.google.cloud.memcache.v1beta2.IGetInstanceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.memcache.v1beta2.IInstance, - protos.google.cloud.memcache.v1beta2.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request: protos.google.cloud.memcache.v1beta2.IGetInstanceRequest, - callback: Callback< - protos.google.cloud.memcache.v1beta2.IInstance, - protos.google.cloud.memcache.v1beta2.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request?: protos.google.cloud.memcache.v1beta2.IGetInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.memcache.v1beta2.IInstance, - protos.google.cloud.memcache.v1beta2.IGetInstanceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.memcache.v1beta2.IInstance, - protos.google.cloud.memcache.v1beta2.IGetInstanceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.memcache.v1beta2.IInstance, - protos.google.cloud.memcache.v1beta2.IGetInstanceRequest|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.getInstance(request, options, callback); - } - -/** - * Creates a new Instance in a given location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region - * @param {string} request.instanceId - * Required. The logical name of the Memcached instance in the user - * project with the following restrictions: - * - * * Must contain only lowercase letters, numbers, and hyphens. - * * Must start with a letter. - * * Must be between 1-40 characters. - * * Must end with a number or a letter. - * * Must be unique within the user project / location. - * - * If any of the above are not met, the API raises an invalid argument error. - * @param {google.cloud.memcache.v1beta2.Instance} request.resource - * Required. A Memcached [Instance] 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/cloud_memcache.create_instance.js - * region_tag:memcache_v1beta2_generated_CloudMemcache_CreateInstance_async - */ - createInstance( - request?: protos.google.cloud.memcache.v1beta2.ICreateInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createInstance( - request: protos.google.cloud.memcache.v1beta2.ICreateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request: protos.google.cloud.memcache.v1beta2.ICreateInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request?: protos.google.cloud.memcache.v1beta2.ICreateInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/cloud_memcache.create_instance.js - * region_tag:memcache_v1beta2_generated_CloudMemcache_CreateInstance_async - */ - async checkCreateInstanceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an existing Instance in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. - * - * * `displayName` - * @param {google.cloud.memcache.v1beta2.Instance} request.resource - * Required. A Memcached [Instance] resource. - * Only fields specified in update_mask are updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/cloud_memcache.update_instance.js - * region_tag:memcache_v1beta2_generated_CloudMemcache_UpdateInstance_async - */ - updateInstance( - request?: protos.google.cloud.memcache.v1beta2.IUpdateInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateInstance( - request: protos.google.cloud.memcache.v1beta2.IUpdateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateInstance( - request: protos.google.cloud.memcache.v1beta2.IUpdateInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateInstance( - request?: protos.google.cloud.memcache.v1beta2.IUpdateInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource.name': request.resource!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/cloud_memcache.update_instance.js - * region_tag:memcache_v1beta2_generated_CloudMemcache_UpdateInstance_async - */ - async checkUpdateInstanceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the defined Memcached parameters for an existing instance. - * This method only stages the parameters, it must be followed by - * `ApplyParameters` to apply the parameters to nodes of the Memcached - * instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the Memcached instance for which the parameters should be - * updated. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. - * @param {google.cloud.memcache.v1beta2.MemcacheParameters} request.parameters - * The parameters to apply to the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/cloud_memcache.update_parameters.js - * region_tag:memcache_v1beta2_generated_CloudMemcache_UpdateParameters_async - */ - updateParameters( - request?: protos.google.cloud.memcache.v1beta2.IUpdateParametersRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateParameters( - request: protos.google.cloud.memcache.v1beta2.IUpdateParametersRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateParameters( - request: protos.google.cloud.memcache.v1beta2.IUpdateParametersRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateParameters( - request?: protos.google.cloud.memcache.v1beta2.IUpdateParametersRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateParameters(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateParameters()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/cloud_memcache.update_parameters.js - * region_tag:memcache_v1beta2_generated_CloudMemcache_UpdateParameters_async - */ - async checkUpdateParametersProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateParameters, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single Instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Memcached instance resource name in the format: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/cloud_memcache.delete_instance.js - * region_tag:memcache_v1beta2_generated_CloudMemcache_DeleteInstance_async - */ - deleteInstance( - request?: protos.google.cloud.memcache.v1beta2.IDeleteInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteInstance( - request: protos.google.cloud.memcache.v1beta2.IDeleteInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request: protos.google.cloud.memcache.v1beta2.IDeleteInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request?: protos.google.cloud.memcache.v1beta2.IDeleteInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/cloud_memcache.delete_instance.js - * region_tag:memcache_v1beta2_generated_CloudMemcache_DeleteInstance_async - */ - async checkDeleteInstanceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * `ApplyParameters` restarts the set of specified nodes in order to update - * them to the current set of parameters for the Memcached Instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the Memcached instance for which parameter group updates - * should be applied. - * @param {string[]} request.nodeIds - * Nodes to which the instance-level parameter group is applied. - * @param {boolean} request.applyAll - * Whether to apply instance-level parameter group to all nodes. If set to - * true, users are restricted from specifying individual nodes, and - * `ApplyParameters` updates all nodes within the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/cloud_memcache.apply_parameters.js - * region_tag:memcache_v1beta2_generated_CloudMemcache_ApplyParameters_async - */ - applyParameters( - request?: protos.google.cloud.memcache.v1beta2.IApplyParametersRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - applyParameters( - request: protos.google.cloud.memcache.v1beta2.IApplyParametersRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - applyParameters( - request: protos.google.cloud.memcache.v1beta2.IApplyParametersRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - applyParameters( - request?: protos.google.cloud.memcache.v1beta2.IApplyParametersRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.applyParameters(request, options, callback); - } -/** - * Check the status of the long running operation returned by `applyParameters()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/cloud_memcache.apply_parameters.js - * region_tag:memcache_v1beta2_generated_CloudMemcache_ApplyParameters_async - */ - async checkApplyParametersProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.applyParameters, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates software on the selected nodes of the Instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Resource name of the Memcached instance for which software update should be - * applied. - * @param {string[]} request.nodeIds - * Nodes to which we should apply the update to. Note all the selected nodes - * are updated in parallel. - * @param {boolean} request.applyAll - * Whether to apply the update to all nodes. If set to - * true, will explicitly restrict users from specifying any nodes, and apply - * software update to all nodes (where applicable) within the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/cloud_memcache.apply_software_update.js - * region_tag:memcache_v1beta2_generated_CloudMemcache_ApplySoftwareUpdate_async - */ - applySoftwareUpdate( - request?: protos.google.cloud.memcache.v1beta2.IApplySoftwareUpdateRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - applySoftwareUpdate( - request: protos.google.cloud.memcache.v1beta2.IApplySoftwareUpdateRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - applySoftwareUpdate( - request: protos.google.cloud.memcache.v1beta2.IApplySoftwareUpdateRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - applySoftwareUpdate( - request?: protos.google.cloud.memcache.v1beta2.IApplySoftwareUpdateRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'instance': request.instance ?? '', - }); - this.initialize(); - return this.innerApiCalls.applySoftwareUpdate(request, options, callback); - } -/** - * Check the status of the long running operation returned by `applySoftwareUpdate()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/cloud_memcache.apply_software_update.js - * region_tag:memcache_v1beta2_generated_CloudMemcache_ApplySoftwareUpdate_async - */ - async checkApplySoftwareUpdateProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.applySoftwareUpdate, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Performs the apply phase of the RescheduleMaintenance verb. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Memcache instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - * @param {google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest.RescheduleType} request.rescheduleType - * Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well. - * @param {google.protobuf.Timestamp} request.scheduleTime - * Timestamp when the maintenance shall be rescheduled to if - * reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for - * example `2012-11-15T16:19:00.094Z`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/cloud_memcache.reschedule_maintenance.js - * region_tag:memcache_v1beta2_generated_CloudMemcache_RescheduleMaintenance_async - */ - rescheduleMaintenance( - request?: protos.google.cloud.memcache.v1beta2.IRescheduleMaintenanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - rescheduleMaintenance( - request: protos.google.cloud.memcache.v1beta2.IRescheduleMaintenanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - rescheduleMaintenance( - request: protos.google.cloud.memcache.v1beta2.IRescheduleMaintenanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - rescheduleMaintenance( - request?: protos.google.cloud.memcache.v1beta2.IRescheduleMaintenanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'instance': request.instance ?? '', - }); - this.initialize(); - return this.innerApiCalls.rescheduleMaintenance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `rescheduleMaintenance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/cloud_memcache.reschedule_maintenance.js - * region_tag:memcache_v1beta2_generated_CloudMemcache_RescheduleMaintenance_async - */ - async checkRescheduleMaintenanceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.rescheduleMaintenance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Instances in a given location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 1000 will be used by the service. - * Regardless of the `page_size` value, the response may include a partial - * list and a caller should only rely on response's - * {@link protos.google.cloud.memcache.v1beta2.ListInstancesResponse.next_page_token|`next_page_token`} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. For example, exclude all Memcached instances with name as - * my-instance by specifying `"name != my-instance"`. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.memcache.v1beta2.Instance|Instance}. - * 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 `listInstancesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listInstances( - request?: protos.google.cloud.memcache.v1beta2.IListInstancesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.memcache.v1beta2.IInstance[], - protos.google.cloud.memcache.v1beta2.IListInstancesRequest|null, - protos.google.cloud.memcache.v1beta2.IListInstancesResponse - ]>; - listInstances( - request: protos.google.cloud.memcache.v1beta2.IListInstancesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.memcache.v1beta2.IListInstancesRequest, - protos.google.cloud.memcache.v1beta2.IListInstancesResponse|null|undefined, - protos.google.cloud.memcache.v1beta2.IInstance>): void; - listInstances( - request: protos.google.cloud.memcache.v1beta2.IListInstancesRequest, - callback: PaginationCallback< - protos.google.cloud.memcache.v1beta2.IListInstancesRequest, - protos.google.cloud.memcache.v1beta2.IListInstancesResponse|null|undefined, - protos.google.cloud.memcache.v1beta2.IInstance>): void; - listInstances( - request?: protos.google.cloud.memcache.v1beta2.IListInstancesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.memcache.v1beta2.IListInstancesRequest, - protos.google.cloud.memcache.v1beta2.IListInstancesResponse|null|undefined, - protos.google.cloud.memcache.v1beta2.IInstance>, - callback?: PaginationCallback< - protos.google.cloud.memcache.v1beta2.IListInstancesRequest, - protos.google.cloud.memcache.v1beta2.IListInstancesResponse|null|undefined, - protos.google.cloud.memcache.v1beta2.IInstance>): - Promise<[ - protos.google.cloud.memcache.v1beta2.IInstance[], - protos.google.cloud.memcache.v1beta2.IListInstancesRequest|null, - protos.google.cloud.memcache.v1beta2.IListInstancesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listInstances(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 1000 will be used by the service. - * Regardless of the `page_size` value, the response may include a partial - * list and a caller should only rely on response's - * {@link protos.google.cloud.memcache.v1beta2.ListInstancesResponse.next_page_token|`next_page_token`} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. For example, exclude all Memcached instances with name as - * my-instance by specifying `"name != my-instance"`. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @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 protos.google.cloud.memcache.v1beta2.Instance|Instance} 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 `listInstancesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listInstancesStream( - request?: protos.google.cloud.memcache.v1beta2.IListInstancesRequest, - 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['listInstances']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listInstances.createStream( - this.innerApiCalls.listInstances as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listInstances`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 1000 will be used by the service. - * Regardless of the `page_size` value, the response may include a partial - * list and a caller should only rely on response's - * {@link protos.google.cloud.memcache.v1beta2.ListInstancesResponse.next_page_token|`next_page_token`} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. For example, exclude all Memcached instances with name as - * my-instance by specifying `"name != my-instance"`. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.memcache.v1beta2.Instance|Instance}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta2/cloud_memcache.list_instances.js - * region_tag:memcache_v1beta2_generated_CloudMemcache_ListInstances_async - */ - listInstancesAsync( - request?: protos.google.cloud.memcache.v1beta2.IListInstancesRequest, - 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['listInstances']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listInstances.asyncIterate( - this.innerApiCalls['listInstances'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified instance resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} instance - * @returns {string} Resource name string. - */ - instancePath(project:string,location:string,instance:string) { - return this.pathTemplates.instancePathTemplate.render({ - project: project, - location: location, - instance: instance, - }); - } - - /** - * Parse the project from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).project; - } - - /** - * Parse the location from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the location. - */ - matchLocationFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).location; - } - - /** - * Parse the instance from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).instance; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.cloudMemcacheStub && !this._terminated) { - return this.cloudMemcacheStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_client_config.json b/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_client_config.json deleted file mode 100644 index efab044ce2f..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_client_config.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "interfaces": { - "google.cloud.memcache.v1beta2.CloudMemcache": { - "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": { - "ListInstances": { - "timeout_millis": 1200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetInstance": { - "timeout_millis": 1200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateInstance": { - "timeout_millis": 1200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateInstance": { - "timeout_millis": 1200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateParameters": { - "timeout_millis": 1200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteInstance": { - "timeout_millis": 1200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ApplyParameters": { - "timeout_millis": 1200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ApplySoftwareUpdate": { - "timeout_millis": 1200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RescheduleMaintenance": { - "timeout_millis": 1200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_proto_list.json b/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_proto_list.json deleted file mode 100644 index f37919f31b7..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/cloud_memcache_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/memcache/v1beta2/cloud_memcache.proto" -] diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/gapic_metadata.json b/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/gapic_metadata.json deleted file mode 100644 index a1b142ce36e..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/gapic_metadata.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.memcache.v1beta2", - "libraryPackage": "@google-cloud/memcache", - "services": { - "CloudMemcache": { - "clients": { - "grpc": { - "libraryClient": "CloudMemcacheClient", - "rpcs": { - "GetInstance": { - "methods": [ - "getInstance" - ] - }, - "CreateInstance": { - "methods": [ - "createInstance" - ] - }, - "UpdateInstance": { - "methods": [ - "updateInstance" - ] - }, - "UpdateParameters": { - "methods": [ - "updateParameters" - ] - }, - "DeleteInstance": { - "methods": [ - "deleteInstance" - ] - }, - "ApplyParameters": { - "methods": [ - "applyParameters" - ] - }, - "ApplySoftwareUpdate": { - "methods": [ - "applySoftwareUpdate" - ] - }, - "RescheduleMaintenance": { - "methods": [ - "rescheduleMaintenance" - ] - }, - "ListInstances": { - "methods": [ - "listInstances", - "listInstancesStream", - "listInstancesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "CloudMemcacheClient", - "rpcs": { - "GetInstance": { - "methods": [ - "getInstance" - ] - }, - "CreateInstance": { - "methods": [ - "createInstance" - ] - }, - "UpdateInstance": { - "methods": [ - "updateInstance" - ] - }, - "UpdateParameters": { - "methods": [ - "updateParameters" - ] - }, - "DeleteInstance": { - "methods": [ - "deleteInstance" - ] - }, - "ApplyParameters": { - "methods": [ - "applyParameters" - ] - }, - "ApplySoftwareUpdate": { - "methods": [ - "applySoftwareUpdate" - ] - }, - "RescheduleMaintenance": { - "methods": [ - "rescheduleMaintenance" - ] - }, - "ListInstances": { - "methods": [ - "listInstances", - "listInstancesStream", - "listInstancesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/index.ts b/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/index.ts deleted file mode 100644 index bd2e3e67c99..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/src/v1beta2/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 {CloudMemcacheClient} from './cloud_memcache_client'; diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-memcache/v1beta2/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 4a105a18a37..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/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 memcache = require('@google-cloud/memcache'); - -function main() { - const cloudMemcacheClient = new memcache.CloudMemcacheClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-memcache/v1beta2/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index b6fcb720803..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/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 {CloudMemcacheClient} from '@google-cloud/memcache'; - -// check that the client class type name can be used -function doStuffWithCloudMemcacheClient(client: CloudMemcacheClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const cloudMemcacheClient = new CloudMemcacheClient(); - doStuffWithCloudMemcacheClient(cloudMemcacheClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/system-test/install.ts b/owl-bot-staging/google-cloud-memcache/v1beta2/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/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-memcache/v1beta2/test/gapic_cloud_memcache_v1beta2.ts b/owl-bot-staging/google-cloud-memcache/v1beta2/test/gapic_cloud_memcache_v1beta2.ts deleted file mode 100644 index 04b716b3a60..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/test/gapic_cloud_memcache_v1beta2.ts +++ /dev/null @@ -1,2156 +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 cloudmemcacheModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta2.CloudMemcacheClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = cloudmemcacheModule.v1beta2.CloudMemcacheClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = cloudmemcacheModule.v1beta2.CloudMemcacheClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = cloudmemcacheModule.v1beta2.CloudMemcacheClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudMemcacheStub, undefined); - await client.initialize(); - assert(client.cloudMemcacheStub); - }); - - it('has close method for the initialized client', done => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.cloudMemcacheStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudMemcacheStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - 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 cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - 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('getInstance', () => { - it('invokes getInstance without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.Instance() - ); - client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); - const [response] = await client.getInstance(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance without error using callback', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.Instance() - ); - client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInstance( - request, - (err?: Error|null, result?: protos.google.cloud.memcache.v1beta2.IInstance|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance with error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance with closed client', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getInstance(request), expectedError); - }); - }); - - describe('createInstance', () => { - it('invokes createInstance without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.createInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance without error using callback', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance with call error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance with LRO error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateInstanceProgress without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateInstanceProgress with error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateInstance', () => { - it('invokes updateInstance without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.UpdateInstanceRequest() - ); - request.resource ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.UpdateInstanceRequest', ['resource', 'name']); - request.resource.name = defaultValue1; - const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInstance without error using callback', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.UpdateInstanceRequest() - ); - request.resource ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.UpdateInstanceRequest', ['resource', 'name']); - request.resource.name = defaultValue1; - const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInstance with call error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.UpdateInstanceRequest() - ); - request.resource ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.UpdateInstanceRequest', ['resource', 'name']); - request.resource.name = defaultValue1; - const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInstance with LRO error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.UpdateInstanceRequest() - ); - request.resource ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.UpdateInstanceRequest', ['resource', 'name']); - request.resource.name = defaultValue1; - const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateInstanceProgress without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateInstanceProgress with error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateParameters', () => { - it('invokes updateParameters without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.UpdateParametersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.UpdateParametersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateParameters = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateParameters(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateParameters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateParameters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateParameters without error using callback', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.UpdateParametersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.UpdateParametersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateParameters = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateParameters( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateParameters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateParameters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateParameters with call error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.UpdateParametersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.UpdateParametersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateParameters = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateParameters(request), expectedError); - const actualRequest = (client.innerApiCalls.updateParameters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateParameters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateParameters with LRO error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.UpdateParametersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.UpdateParametersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateParameters = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateParameters(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateParameters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateParameters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateParametersProgress without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateParametersProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateParametersProgress with error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateParametersProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteInstance', () => { - it('invokes deleteInstance without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance without error using callback', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance with call error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance with LRO error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteInstanceProgress without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteInstanceProgress with error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('applyParameters', () => { - it('invokes applyParameters without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.ApplyParametersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.ApplyParametersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.applyParameters = stubLongRunningCall(expectedResponse); - const [operation] = await client.applyParameters(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.applyParameters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.applyParameters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes applyParameters without error using callback', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.ApplyParametersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.ApplyParametersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.applyParameters = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.applyParameters( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.applyParameters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.applyParameters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes applyParameters with call error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.ApplyParametersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.ApplyParametersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.applyParameters = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.applyParameters(request), expectedError); - const actualRequest = (client.innerApiCalls.applyParameters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.applyParameters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes applyParameters with LRO error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.ApplyParametersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.ApplyParametersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.applyParameters = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.applyParameters(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.applyParameters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.applyParameters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkApplyParametersProgress without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkApplyParametersProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkApplyParametersProgress with error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkApplyParametersProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('applySoftwareUpdate', () => { - it('invokes applySoftwareUpdate without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest', ['instance']); - request.instance = defaultValue1; - const expectedHeaderRequestParams = `instance=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.applySoftwareUpdate = stubLongRunningCall(expectedResponse); - const [operation] = await client.applySoftwareUpdate(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.applySoftwareUpdate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.applySoftwareUpdate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes applySoftwareUpdate without error using callback', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest', ['instance']); - request.instance = defaultValue1; - const expectedHeaderRequestParams = `instance=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.applySoftwareUpdate = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.applySoftwareUpdate( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.applySoftwareUpdate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.applySoftwareUpdate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes applySoftwareUpdate with call error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest', ['instance']); - request.instance = defaultValue1; - const expectedHeaderRequestParams = `instance=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.applySoftwareUpdate = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.applySoftwareUpdate(request), expectedError); - const actualRequest = (client.innerApiCalls.applySoftwareUpdate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.applySoftwareUpdate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes applySoftwareUpdate with LRO error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest', ['instance']); - request.instance = defaultValue1; - const expectedHeaderRequestParams = `instance=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.applySoftwareUpdate = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.applySoftwareUpdate(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.applySoftwareUpdate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.applySoftwareUpdate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkApplySoftwareUpdateProgress without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkApplySoftwareUpdateProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkApplySoftwareUpdateProgress with error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkApplySoftwareUpdateProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('rescheduleMaintenance', () => { - it('invokes rescheduleMaintenance without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest', ['instance']); - request.instance = defaultValue1; - const expectedHeaderRequestParams = `instance=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.rescheduleMaintenance = stubLongRunningCall(expectedResponse); - const [operation] = await client.rescheduleMaintenance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rescheduleMaintenance without error using callback', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest', ['instance']); - request.instance = defaultValue1; - const expectedHeaderRequestParams = `instance=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.rescheduleMaintenance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rescheduleMaintenance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rescheduleMaintenance with call error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest', ['instance']); - request.instance = defaultValue1; - const expectedHeaderRequestParams = `instance=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rescheduleMaintenance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.rescheduleMaintenance(request), expectedError); - const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rescheduleMaintenance with LRO error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.RescheduleMaintenanceRequest', ['instance']); - request.instance = defaultValue1; - const expectedHeaderRequestParams = `instance=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rescheduleMaintenance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.rescheduleMaintenance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRescheduleMaintenanceProgress without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRescheduleMaintenanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRescheduleMaintenanceProgress with error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRescheduleMaintenanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listInstances', () => { - it('invokes listInstances without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), - generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), - generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), - ]; - client.innerApiCalls.listInstances = stubSimpleCall(expectedResponse); - const [response] = await client.listInstances(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInstances without error using callback', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), - generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), - generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), - ]; - client.innerApiCalls.listInstances = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInstances( - request, - (err?: Error|null, result?: protos.google.cloud.memcache.v1beta2.IInstance[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInstances with error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInstances = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInstances(request), expectedError); - const actualRequest = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInstancesStream without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), - generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), - generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), - ]; - client.descriptors.page.listInstances.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInstancesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.memcache.v1beta2.Instance[] = []; - stream.on('data', (response: protos.google.cloud.memcache.v1beta2.Instance) => { - 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.listInstances.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); - assert( - (client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listInstancesStream with error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listInstances.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInstancesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.memcache.v1beta2.Instance[] = []; - stream.on('data', (response: protos.google.cloud.memcache.v1beta2.Instance) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); - assert( - (client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInstances without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), - generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), - generateSampleMessage(new protos.google.cloud.memcache.v1beta2.Instance()), - ]; - client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.memcache.v1beta2.IInstance[] = []; - const iterable = client.listInstancesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInstances with error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.memcache.v1beta2.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.memcache.v1beta2.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInstancesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.memcache.v1beta2.IInstance[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('instance', () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - instance: "instanceValue", - }; - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "locationValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInstanceName', () => { - const result = client.matchLocationFromInstanceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new cloudmemcacheModule.v1beta2.CloudMemcacheClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-memcache/v1beta2/tsconfig.json b/owl-bot-staging/google-cloud-memcache/v1beta2/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/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-memcache/v1beta2/webpack.config.js b/owl-bot-staging/google-cloud-memcache/v1beta2/webpack.config.js deleted file mode 100644 index 798f84c54f5..00000000000 --- a/owl-bot-staging/google-cloud-memcache/v1beta2/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: 'CloudMemcache', - filename: './cloud-memcache.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-metastore/v1/.eslintignore b/owl-bot-staging/google-cloud-metastore/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-metastore/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-metastore/v1/.eslintrc.json b/owl-bot-staging/google-cloud-metastore/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/.gitignore b/owl-bot-staging/google-cloud-metastore/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-metastore/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-metastore/v1/.jsdoc.js b/owl-bot-staging/google-cloud-metastore/v1/.jsdoc.js deleted file mode 100644 index 77430ad8c15..00000000000 --- a/owl-bot-staging/google-cloud-metastore/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/dataproc-metastore', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-metastore/v1/.mocharc.js b/owl-bot-staging/google-cloud-metastore/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-metastore/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-metastore/v1/.prettierrc.js b/owl-bot-staging/google-cloud-metastore/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-metastore/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-metastore/v1/README.md b/owl-bot-staging/google-cloud-metastore/v1/README.md deleted file mode 100644 index 24afb9017c6..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Metastore: Nodejs Client diff --git a/owl-bot-staging/google-cloud-metastore/v1/package.json b/owl-bot-staging/google-cloud-metastore/v1/package.json deleted file mode 100644 index e14926927ea..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "@google-cloud/dataproc-metastore", - "version": "0.1.0", - "description": "Metastore client for Node.js", - "repository": "googleapis/nodejs-metastore", - "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 metastore", - "metastore", - "dataproc metastore", - "dataproc metastore federation" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore.proto b/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore.proto deleted file mode 100644 index 1c999e9ba3a..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore.proto +++ /dev/null @@ -1,1602 +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 -// -// 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.metastore.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; -import "google/type/dayofweek.proto"; - -option go_package = "cloud.google.com/go/metastore/apiv1/metastorepb;metastorepb"; -option java_multiple_files = true; -option java_outer_classname = "MetastoreProto"; -option java_package = "com.google.cloud.metastore.v1"; -option php_namespace = "Google\\Cloud\\Metastore\\V1"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Network" - pattern: "projects/{project}/global/networks/{network}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Subnetwork" - pattern: "projects/{project}/regions/{region}/subnetworks/{subnetwork}" -}; -option (google.api.resource_definition) = { - type: "dataplex.googleapis.com/Lake" - pattern: "projects/{project}/locations/{location}/lakes/{lake}" -}; - -// Configures and manages metastore services. -// Metastore services are fully managed, highly available, autoscaled, -// autohealing, OSS-native deployments of technical metadata management -// software. Each metastore service exposes a network endpoint through which -// metadata queries are served. Metadata queries can originate from a variety -// of sources, including Apache Hive, Apache Presto, and Apache Spark. -// -// The Dataproc Metastore API defines the following resource model: -// -// * The service works with a collection of Google Cloud projects, named: -// `/projects/*` -// * Each project has a collection of available locations, named: `/locations/*` -// (a location must refer to a Google Cloud `region`) -// * Each location has a collection of services, named: `/services/*` -// * Dataproc Metastore services are resources with names of the form: -// -// `/projects/{project_number}/locations/{location_id}/services/{service_id}`. -service DataprocMetastore { - option (google.api.default_host) = "metastore.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists services in a project and location. - rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/services" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a single service. - rpc GetService(GetServiceRequest) returns (Service) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/services/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a metastore service in a project and location. - rpc CreateService(CreateServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/services" - body: "service" - }; - option (google.api.method_signature) = "parent,service,service_id"; - option (google.longrunning.operation_info) = { - response_type: "Service" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Updates the parameters of a single service. - rpc UpdateService(UpdateServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{service.name=projects/*/locations/*/services/*}" - body: "service" - }; - option (google.api.method_signature) = "service,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Service" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Deletes a single service. - rpc DeleteService(DeleteServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/services/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Lists imports in a service. - rpc ListMetadataImports(ListMetadataImportsRequest) - returns (ListMetadataImportsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/services/*}/metadataImports" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single import. - rpc GetMetadataImport(GetMetadataImportRequest) returns (MetadataImport) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/services/*/metadataImports/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new MetadataImport in a given project and location. - rpc CreateMetadataImport(CreateMetadataImportRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/services/*}/metadataImports" - body: "metadata_import" - }; - option (google.api.method_signature) = - "parent,metadata_import,metadata_import_id"; - option (google.longrunning.operation_info) = { - response_type: "MetadataImport" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Updates a single import. - // Only the description field of MetadataImport is supported to be updated. - rpc UpdateMetadataImport(UpdateMetadataImportRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{metadata_import.name=projects/*/locations/*/services/*/metadataImports/*}" - body: "metadata_import" - }; - option (google.api.method_signature) = "metadata_import,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "MetadataImport" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Exports metadata from a service. - rpc ExportMetadata(ExportMetadataRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{service=projects/*/locations/*/services/*}:exportMetadata" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "MetadataExport" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Restores a service from a backup. - rpc RestoreService(RestoreServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{service=projects/*/locations/*/services/*}:restore" - body: "*" - }; - option (google.api.method_signature) = "service,backup"; - option (google.longrunning.operation_info) = { - response_type: "Restore" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Lists backups in a service. - rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/services/*}/backups" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single backup. - rpc GetBackup(GetBackupRequest) returns (Backup) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/services/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new backup in a given project and location. - rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/services/*}/backups" - body: "backup" - }; - option (google.api.method_signature) = "parent,backup,backup_id"; - option (google.longrunning.operation_info) = { - response_type: "Backup" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Deletes a single backup. - rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/services/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Query DPMS metadata. - rpc QueryMetadata(QueryMetadataRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{service=projects/*/locations/*/services/*}:queryMetadata" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "QueryMetadataResponse" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Move a table to another database. - rpc MoveTableToDatabase(MoveTableToDatabaseRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{service=projects/*/locations/*/services/*}:moveTableToDatabase" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "MoveTableToDatabaseResponse" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Alter metadata resource location. The metadata resource can be a database, - // table, or partition. This functionality only updates the parent directory - // for the respective metadata resource and does not transfer any existing - // data to the new location. - rpc AlterMetadataResourceLocation(AlterMetadataResourceLocationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{service=projects/*/locations/*/services/*}:alterLocation" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "AlterMetadataResourceLocationResponse" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } -} - -// A managed metastore service that serves metadata queries. -message Service { - option (google.api.resource) = { - type: "metastore.googleapis.com/Service" - pattern: "projects/{project}/locations/{location}/services/{service}" - }; - - // The current state of the metastore service. - enum State { - // The state of the metastore service is unknown. - STATE_UNSPECIFIED = 0; - - // The metastore service is in the process of being created. - CREATING = 1; - - // The metastore service is running and ready to serve queries. - ACTIVE = 2; - - // The metastore service is entering suspension. Its query-serving - // availability may cease unexpectedly. - SUSPENDING = 3; - - // The metastore service is suspended and unable to serve queries. - SUSPENDED = 4; - - // The metastore service is being updated. It remains usable but cannot - // accept additional update requests or be deleted at this time. - UPDATING = 5; - - // The metastore service is undergoing deletion. It cannot be used. - DELETING = 6; - - // The metastore service has encountered an error and cannot be used. The - // metastore service should be deleted. - ERROR = 7; - } - - // Available service tiers. - enum Tier { - // The tier is not set. - TIER_UNSPECIFIED = 0; - - // The developer tier provides limited scalability and no fault tolerance. - // Good for low-cost proof-of-concept. - DEVELOPER = 1; - - // The enterprise tier provides multi-zone high availability, and sufficient - // scalability for enterprise-level Dataproc Metastore workloads. - ENTERPRISE = 3; - } - - // Release channels bundle features of varying levels of stability. Newer - // features may be introduced initially into less stable release channels and - // can be automatically promoted into more stable release channels. - enum ReleaseChannel { - // Release channel is not specified. - RELEASE_CHANNEL_UNSPECIFIED = 0; - - // The `CANARY` release channel contains the newest features, which may be - // unstable and subject to unresolved issues with no known workarounds. - // Services using the `CANARY` release channel are not subject to any SLAs. - CANARY = 1; - - // The `STABLE` release channel contains features that are considered stable - // and have been validated for production use. - STABLE = 2; - } - - // The backend database type for the metastore service. - enum DatabaseType { - // The DATABASE_TYPE is not set. - DATABASE_TYPE_UNSPECIFIED = 0; - - // MySQL is used to persist the metastore data. - MYSQL = 1; - - // Spanner is used to persist the metastore data. - SPANNER = 2; - } - - // Configuration properties specific to the underlying metastore service - // technology (the software that serves metastore queries). - oneof metastore_config { - // Configuration information specific to running Hive metastore - // software as the metastore service. - HiveMetastoreConfig hive_metastore_config = 5; - } - - // Immutable. The relative resource name of the metastore service, in the - // following format: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the metastore service was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metastore service was last updated. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-defined labels for the metastore service. - map labels = 4; - - // Immutable. The relative resource name of the VPC network on which the - // instance can be accessed. It is specified in the following form: - // - // `projects/{project_number}/global/networks/{network_id}`. - string network = 7 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; - - // Output only. The URI of the endpoint used to access the metastore service. - string endpoint_uri = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The TCP port at which the metastore service is reached. Default: 9083. - int32 port = 9; - - // Output only. The current state of the metastore service. - State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current state of the - // metastore service, if available. - string state_message = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A Cloud Storage URI (starting with `gs://`) that specifies - // where artifacts related to the metastore service are stored. - string artifact_gcs_uri = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The tier of the service. - Tier tier = 13; - - // The one hour maintenance window of the metastore service. This specifies - // when the service can be restarted for maintenance purposes in UTC time. - // Maintenance window is not needed for services with the SPANNER - // database type. - MaintenanceWindow maintenance_window = 15; - - // Output only. The globally unique resource identifier of the metastore - // service. - string uid = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The metadata management activities of the metastore service. - MetadataManagementActivity metadata_management_activity = 17 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Immutable. The release channel of the service. - // If unspecified, defaults to `STABLE`. - ReleaseChannel release_channel = 19 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. Information used to configure the Dataproc Metastore service to - // encrypt customer data at rest. Cannot be updated. - EncryptionConfig encryption_config = 20 - [(google.api.field_behavior) = IMMUTABLE]; - - // The configuration specifying the network settings for the - // Dataproc Metastore service. - NetworkConfig network_config = 21; - - // Immutable. The database type that the Metastore service stores its data. - DatabaseType database_type = 22 [(google.api.field_behavior) = IMMUTABLE]; - - // The configuration specifying telemetry settings for the Dataproc Metastore - // service. If unspecified defaults to `JSON`. - TelemetryConfig telemetry_config = 23; - - // Scaling configuration of the metastore service. - ScalingConfig scaling_config = 24; -} - -// Maintenance window. This specifies when Dataproc Metastore -// may perform system maintenance operation to the service. -message MaintenanceWindow { - // The hour of day (0-23) when the window starts. - google.protobuf.Int32Value hour_of_day = 1; - - // The day of week, when the window starts. - google.type.DayOfWeek day_of_week = 2; -} - -// Specifies configuration information specific to running Hive metastore -// software as the metastore service. -message HiveMetastoreConfig { - // Protocols available for serving the metastore service endpoint. - enum EndpointProtocol { - // The protocol is not set. - ENDPOINT_PROTOCOL_UNSPECIFIED = 0; - - // Use the legacy Apache Thrift protocol for the metastore service endpoint. - THRIFT = 1; - - // Use the modernized gRPC protocol for the metastore service endpoint. - GRPC = 2; - } - - // Immutable. The Hive metastore schema version. - string version = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // A mapping of Hive metastore configuration key-value pairs to apply to the - // Hive metastore (configured in `hive-site.xml`). The mappings - // override system defaults (some keys cannot be overridden). These - // overrides are also applied to auxiliary versions and can be further - // customized in the auxiliary version's `AuxiliaryVersionConfig`. - map config_overrides = 2; - - // Information used to configure the Hive metastore service as a service - // principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` - // method and specify this field's path - // (`hive_metastore_config.kerberos_config`) in the request's `update_mask` - // while omitting this field from the request's `service`. - KerberosConfig kerberos_config = 3; - - // The protocol to use for the metastore service endpoint. If unspecified, - // defaults to `THRIFT`. - EndpointProtocol endpoint_protocol = 4; - - // A mapping of Hive metastore version to the auxiliary version - // configuration. When specified, a secondary Hive metastore service is - // created along with the primary service. All auxiliary versions must be less - // than the service's primary version. The key is the auxiliary service name - // and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This - // means that the first character must be a lowercase letter, and all the - // following characters must be hyphens, lowercase letters, or digits, except - // the last character, which cannot be a hyphen. - map auxiliary_versions = 5; -} - -// Configuration information for a Kerberos principal. -message KerberosConfig { - // A Kerberos keytab file that can be used to authenticate a service principal - // with a Kerberos Key Distribution Center (KDC). - Secret keytab = 1; - - // A Kerberos principal that exists in the both the keytab the KDC - // to authenticate as. A typical principal is of the form - // `primary/instance@REALM`, but there is no exact format. - string principal = 2; - - // A Cloud Storage URI that specifies the path to a - // krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, - // although the file does not need to be named krb5.conf explicitly. - string krb5_config_gcs_uri = 3; -} - -// A securely stored value. -message Secret { - oneof value { - // The relative resource name of a Secret Manager secret version, in the - // following form: - // - // `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. - string cloud_secret = 2; - } -} - -// Encryption settings for the service. -message EncryptionConfig { - // The fully qualified customer provided Cloud KMS key name to use for - // customer data encryption, in the following form: - // - // `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. - string kms_key = 1; -} - -// Configuration information for the auxiliary service versions. -message AuxiliaryVersionConfig { - // The Hive metastore version of the auxiliary service. It must be less - // than the primary Hive metastore service's version. - string version = 1; - - // A mapping of Hive metastore configuration key-value pairs to apply to the - // auxiliary Hive metastore (configured in `hive-site.xml`) in addition to - // the primary version's overrides. If keys are present in both the auxiliary - // version's overrides and the primary version's overrides, the value from - // the auxiliary version's overrides takes precedence. - map config_overrides = 2; - - // Output only. The network configuration contains the endpoint URI(s) of the - // auxiliary Hive metastore service. - NetworkConfig network_config = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Network configuration for the Dataproc Metastore service. -message NetworkConfig { - // Contains information of the customer's network configurations. - message Consumer { - oneof vpc_resource { - // Immutable. The subnetwork of the customer project from which an IP - // address is reserved and used as the Dataproc Metastore service's - // endpoint. It is accessible to hosts in the subnet and to all - // hosts in a subnet in the same region and same network. There must - // be at least one IP address available in the subnet's primary range. The - // subnet is specified in the following form: - // - // `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` - string subnetwork = 1 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { - type: "compute.googleapis.com/Subnetwork" - } - ]; - } - - // Output only. The URI of the endpoint used to access the metastore - // service. - string endpoint_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Immutable. The consumer-side network configuration for the Dataproc - // Metastore instance. - repeated Consumer consumers = 1 [(google.api.field_behavior) = IMMUTABLE]; -} - -// Telemetry Configuration for the Dataproc Metastore service. -message TelemetryConfig { - enum LogFormat { - // The LOG_FORMAT is not set. - LOG_FORMAT_UNSPECIFIED = 0; - - // Logging output uses the legacy `textPayload` format. - LEGACY = 1; - - // Logging output uses the `jsonPayload` format. - JSON = 2; - } - - // The output format of the Dataproc Metastore service's logs. - LogFormat log_format = 1; -} - -// The metadata management activities of the metastore service. -message MetadataManagementActivity { - // Output only. The latest metadata exports of the metastore service. - repeated MetadataExport metadata_exports = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The latest restores of the metastore service. - repeated Restore restores = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A metastore resource that imports metadata. -message MetadataImport { - option (google.api.resource) = { - type: "metastore.googleapis.com/MetadataImport" - pattern: "projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}" - }; - - // A specification of the location of and metadata about a database dump from - // a relational database management system. - message DatabaseDump { - // The type of the database. - enum DatabaseType { - // The type of the source database is unknown. - DATABASE_TYPE_UNSPECIFIED = 0; - - // The type of the source database is MySQL. - MYSQL = 1; - } - - // The type of the database. - DatabaseType database_type = 1 [deprecated = true]; - - // A Cloud Storage object or folder URI that specifies the source from which - // to import metadata. It must begin with `gs://`. - string gcs_uri = 2; - - // The name of the source database. - string source_database = 3 [deprecated = true]; - - // Optional. The type of the database dump. If unspecified, defaults to - // `MYSQL`. - DatabaseDumpSpec.Type type = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // The current state of the metadata import. - enum State { - // The state of the metadata import is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata import is running. - RUNNING = 1; - - // The metadata import completed successfully. - SUCCEEDED = 2; - - // The metadata import is being updated. - UPDATING = 3; - - // The metadata import failed, and attempted metadata changes were rolled - // back. - FAILED = 4; - } - - // The metadata to be imported. - oneof metadata { - // Immutable. A database dump from a pre-existing metastore's database. - DatabaseDump database_dump = 6 [(google.api.field_behavior) = IMMUTABLE]; - } - - // Immutable. The relative resource name of the metadata import, of the form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // The description of the metadata import. - string description = 2; - - // Output only. The time when the metadata import was started. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metadata import was last updated. - google.protobuf.Timestamp update_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metadata import finished. - google.protobuf.Timestamp end_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the metadata import. - State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a metadata export operation. -message MetadataExport { - // The current state of the metadata export. - enum State { - // The state of the metadata export is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata export is running. - RUNNING = 1; - - // The metadata export completed successfully. - SUCCEEDED = 2; - - // The metadata export failed. - FAILED = 3; - - // The metadata export is cancelled. - CANCELLED = 4; - } - - oneof destination { - // Output only. A Cloud Storage URI of a folder that metadata are exported - // to, in the form of - // `gs:////`, where - // `` is automatically generated. - string destination_gcs_uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. The time when the export started. - google.protobuf.Timestamp start_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the export ended. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the export. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The type of the database dump. - DatabaseDumpSpec.Type database_dump_type = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a backup resource. -message Backup { - option (google.api.resource) = { - type: "metastore.googleapis.com/Backup" - pattern: "projects/{project}/locations/{location}/services/{service}/backups/{backup}" - }; - - // The current state of the backup. - enum State { - // The state of the backup is unknown. - STATE_UNSPECIFIED = 0; - - // The backup is being created. - CREATING = 1; - - // The backup is being deleted. - DELETING = 2; - - // The backup is active and ready to use. - ACTIVE = 3; - - // The backup failed. - FAILED = 4; - - // The backup is being restored. - RESTORING = 5; - } - - // Immutable. The relative resource name of the backup, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the backup was started. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the backup finished creating. - google.protobuf.Timestamp end_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the backup. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The revision of the service at the time of backup. - Service service_revision = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The description of the backup. - string description = 6; - - // Output only. Services that are restoring from the backup. - repeated string restoring_services = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a metadata restore operation. -message Restore { - // The current state of the restore. - enum State { - // The state of the metadata restore is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata restore is running. - RUNNING = 1; - - // The metadata restore completed successfully. - SUCCEEDED = 2; - - // The metadata restore failed. - FAILED = 3; - - // The metadata restore is cancelled. - CANCELLED = 4; - } - - // The type of restore. If unspecified, defaults to `METADATA_ONLY`. - enum RestoreType { - // The restore type is unknown. - RESTORE_TYPE_UNSPECIFIED = 0; - - // The service's metadata and configuration are restored. - FULL = 1; - - // Only the service's metadata is restored. - METADATA_ONLY = 2; - } - - // Output only. The time when the restore started. - google.protobuf.Timestamp start_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the restore ended. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the restore. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The relative resource name of the metastore service backup to - // restore from, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string backup = 4 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Output only. The type of restore. - RestoreType type = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The restore details containing the revision of the service to - // be restored to, in format of JSON. - string details = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents the scaling configuration of a metastore service. -message ScalingConfig { - // Metastore instance sizes. - enum InstanceSize { - // Unspecified instance size - INSTANCE_SIZE_UNSPECIFIED = 0; - - // Extra small instance size, maps to a scaling factor of 0.1. - EXTRA_SMALL = 1; - - // Small instance size, maps to a scaling factor of 0.5. - SMALL = 2; - - // Medium instance size, maps to a scaling factor of 1.0. - MEDIUM = 3; - - // Large instance size, maps to a scaling factor of 3.0. - LARGE = 4; - - // Extra large instance size, maps to a scaling factor of 6.0. - EXTRA_LARGE = 5; - } - - // Represents either a predetermined instance size or a numeric - // scaling factor. - oneof scaling_model { - // An enum of readable instance sizes, with each instance size mapping to a - // float value (e.g. InstanceSize.EXTRA_SMALL = scaling_factor(0.1)) - InstanceSize instance_size = 1; - - // Scaling factor, increments of 0.1 for values less than 1.0, and - // increments of 1.0 for values greater than 1.0. - float scaling_factor = 2; - } -} - -// Request message for -// [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices]. -message ListServicesRequest { - // Required. The relative resource name of the location of metastore services - // to list, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. The maximum number of services to return. The response may - // contain less than the maximum number. If unspecified, no more than 500 - // services are returned. The maximum value is 1000; values above 1000 are - // changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous - // [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] - // must match the call that provided the page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices]. -message ListServicesResponse { - // The services in the specified location. - repeated Service services = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [DataprocMetastore.GetService][google.cloud.metastore.v1.DataprocMetastore.GetService]. -message GetServiceRequest { - // Required. The relative resource name of the metastore service to retrieve, - // in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; -} - -// Request message for -// [DataprocMetastore.CreateService][google.cloud.metastore.v1.DataprocMetastore.CreateService]. -message CreateServiceRequest { - // Required. The relative resource name of the location in which to create a - // metastore service, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The ID of the metastore service, which is used as the final - // component of the metastore service's name. - // - // This value must be between 2 and 63 characters long inclusive, begin with a - // letter, end with a letter or number, and consist of alpha-numeric - // ASCII characters or hyphens. - string service_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Metastore service to create. The `name` field is - // ignored. The ID of the created metastore service must be provided in - // the request's `service_id` field. - Service service = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.UpdateService][google.cloud.metastore.v1.DataprocMetastore.UpdateService]. -message UpdateServiceRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metastore service resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The metastore service to update. The server only merges fields - // in the service if they are specified in `update_mask`. - // - // The metastore service's `name` field is used to identify the metastore - // service to be updated. - Service service = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.DeleteService][google.cloud.metastore.v1.DataprocMetastore.DeleteService]. -message DeleteServiceRequest { - // Required. The relative resource name of the metastore service to delete, in - // the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports]. -message ListMetadataImportsRequest { - // Required. The relative resource name of the service whose metadata imports - // to list, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/MetadataImport" - } - ]; - - // Optional. The maximum number of imports to return. The response may contain - // less than the maximum number. If unspecified, no more than 500 imports are - // returned. The maximum value is 1000; values above 1000 are changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous - // [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] - // must match the call that provided the page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports]. -message ListMetadataImportsResponse { - // The imports in the specified service. - repeated MetadataImport metadata_imports = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [DataprocMetastore.GetMetadataImport][google.cloud.metastore.v1.DataprocMetastore.GetMetadataImport]. -message GetMetadataImportRequest { - // Required. The relative resource name of the metadata import to retrieve, in - // the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/MetadataImport" - } - ]; -} - -// Request message for -// [DataprocMetastore.CreateMetadataImport][google.cloud.metastore.v1.DataprocMetastore.CreateMetadataImport]. -message CreateMetadataImportRequest { - // Required. The relative resource name of the service in which to create a - // metastore import, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/MetadataImport" - } - ]; - - // Required. The ID of the metadata import, which is used as the final - // component of the metadata import's name. - // - // This value must be between 1 and 64 characters long, begin with a letter, - // end with a letter or number, and consist of alpha-numeric ASCII characters - // or hyphens. - string metadata_import_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The metadata import to create. The `name` field is ignored. The - // ID of the created metadata import must be provided in the request's - // `metadata_import_id` field. - MetadataImport metadata_import = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.UpdateMetadataImport][google.cloud.metastore.v1.DataprocMetastore.UpdateMetadataImport]. -message UpdateMetadataImportRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metadata import resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The metadata import to update. The server only merges fields - // in the import if they are specified in `update_mask`. - // - // The metadata import's `name` field is used to identify the metastore - // import to be updated. - MetadataImport metadata_import = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups]. -message ListBackupsRequest { - // Required. The relative resource name of the service whose backups to - // list, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. The maximum number of backups to return. The response may contain - // less than the maximum number. If unspecified, no more than 500 backups are - // returned. The maximum value is 1000; values above 1000 are changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous - // [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups] - // must match the call that provided the page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups]. -message ListBackupsResponse { - // The backups of the specified service. - repeated Backup backups = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [DataprocMetastore.GetBackup][google.cloud.metastore.v1.DataprocMetastore.GetBackup]. -message GetBackupRequest { - // Required. The relative resource name of the backup to retrieve, in the - // following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; -} - -// Request message for -// [DataprocMetastore.CreateBackup][google.cloud.metastore.v1.DataprocMetastore.CreateBackup]. -message CreateBackupRequest { - // Required. The relative resource name of the service in which to create a - // backup of the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Backup" - } - ]; - - // Required. The ID of the backup, which is used as the final component of the - // backup's name. - // - // This value must be between 1 and 64 characters long, begin with a letter, - // end with a letter or number, and consist of alpha-numeric ASCII characters - // or hyphens. - string backup_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The backup to create. The `name` field is ignored. The ID of the - // created backup must be provided in the request's `backup_id` field. - Backup backup = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.DeleteBackup][google.cloud.metastore.v1.DataprocMetastore.DeleteBackup]. -message DeleteBackupRequest { - // Required. The relative resource name of the backup to delete, in the - // following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.ExportMetadata][google.cloud.metastore.v1.DataprocMetastore.ExportMetadata]. -message ExportMetadataRequest { - // Required. Destination that metadata is exported to. - oneof destination { - // A Cloud Storage URI of a folder, in the format - // `gs:///`. A sub-folder - // `` containing exported files will be created below it. - string destination_gcs_folder = 2; - } - - // Required. The relative resource name of the metastore service to run - // export, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The type of the database dump. If unspecified, defaults to - // `MYSQL`. - DatabaseDumpSpec.Type database_dump_type = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [DataprocMetastore.Restore][]. -message RestoreServiceRequest { - // Required. The relative resource name of the metastore service to run - // restore, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The relative resource name of the metastore service backup to - // restore from, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string backup = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - Restore.RestoreType restore_type = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents the metadata of a long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the caller has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a - // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - // `Code.CANCELLED`. - bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Metadata about the service in a location. -message LocationMetadata { - // A specification of a supported version of the Hive Metastore software. - message HiveMetastoreVersion { - // The semantic version of the Hive Metastore software. - string version = 1; - - // Whether `version` will be chosen by the server if a metastore service is - // created with a `HiveMetastoreConfig` that omits the `version`. - bool is_default = 2; - } - - // The versions of Hive Metastore that can be used when creating a new - // metastore service in this location. The server guarantees that exactly one - // `HiveMetastoreVersion` in the list will set `is_default`. - repeated HiveMetastoreVersion supported_hive_metastore_versions = 1; -} - -// The specification of database dump to import from or export to. -message DatabaseDumpSpec { - // The type of the database dump. - enum Type { - // The type of the database dump is unknown. - TYPE_UNSPECIFIED = 0; - - // Database dump is a MySQL dump file. - MYSQL = 1; - - // Database dump contains Avro files. - AVRO = 2; - } -} - -// Request message for -// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1.DataprocMetastore.QueryMetadata]. -message QueryMetadataRequest { - // Required. The relative resource name of the metastore service to query - // metadata, in the following format: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Required. A read-only SQL query to execute against the metadata database. - // The query cannot change or mutate the data. - string query = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for -// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1.DataprocMetastore.QueryMetadata]. -message QueryMetadataResponse { - // The manifest URI is link to a JSON instance in Cloud Storage. - // This instance manifests immediately along with QueryMetadataResponse. The - // content of the URI is not retriable until the long-running operation query - // against the metadata finishes. - string result_manifest_uri = 1; -} - -// Error details in public error message for -// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1.DataprocMetastore.QueryMetadata]. -message ErrorDetails { - // Additional structured details about this error. - // - // Keys define the failure items. - // Value describes the exception or details of the item. - map details = 1; -} - -// Request message for -// [DataprocMetastore.MoveTableToDatabase][google.cloud.metastore.v1.DataprocMetastore.MoveTableToDatabase]. -message MoveTableToDatabaseRequest { - // Required. The relative resource name of the metastore service to mutate - // metadata, in the following format: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The name of the table to be moved. - string table_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The name of the database where the table resides. - string db_name = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The name of the database where the table should be moved. - string destination_db_name = 4 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for -// [DataprocMetastore.MoveTableToDatabase][google.cloud.metastore.v1.DataprocMetastore.MoveTableToDatabase]. -message MoveTableToDatabaseResponse {} - -// Request message for -// [DataprocMetastore.AlterMetadataResourceLocation][google.cloud.metastore.v1.DataprocMetastore.AlterMetadataResourceLocation]. -message AlterMetadataResourceLocationRequest { - // Required. The relative resource name of the metastore service to mutate - // metadata, in the following format: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The relative metadata resource name in the following format. - // - // `databases/{database_id}` - // or - // `databases/{database_id}/tables/{table_id}` - // or - // `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` - string resource_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The new location URI for the metadata resource. - string location_uri = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for -// [DataprocMetastore.AlterMetadataResourceLocation][google.cloud.metastore.v1.DataprocMetastore.AlterMetadataResourceLocation]. -message AlterMetadataResourceLocationResponse {} diff --git a/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore_federation.proto b/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore_federation.proto deleted file mode 100644 index dbe25125fe6..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore_federation.proto +++ /dev/null @@ -1,374 +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 -// -// 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.metastore.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/metastore/v1/metastore.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/metastore/apiv1/metastorepb;metastorepb"; -option java_multiple_files = true; -option java_outer_classname = "MetastoreFederationProto"; -option java_package = "com.google.cloud.metastore.v1"; - -// Configures and manages metastore federation services. -// Dataproc Metastore Federation Service allows federating a collection of -// backend metastores like BigQuery, Dataplex Lakes, and other Dataproc -// Metastores. The Federation Service exposes a gRPC URL through which metadata -// from the backend metastores are served at query time. -// -// The Dataproc Metastore Federation API defines the following resource model: -// * The service works with a collection of Google Cloud projects. -// * Each project has a collection of available locations. -// * Each location has a collection of federations. -// * Dataproc Metastore Federations are resources with names of the -// form: -// `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. -service DataprocMetastoreFederation { - option (google.api.default_host) = "metastore.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists federations in a project and location. - rpc ListFederations(ListFederationsRequest) - returns (ListFederationsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/federations" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a single federation. - rpc GetFederation(GetFederationRequest) returns (Federation) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/federations/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a metastore federation in a project and location. - rpc CreateFederation(CreateFederationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/federations" - body: "federation" - }; - option (google.api.method_signature) = "parent,federation,federation_id"; - option (google.longrunning.operation_info) = { - response_type: "Federation" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Updates the fields of a federation. - rpc UpdateFederation(UpdateFederationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{federation.name=projects/*/locations/*/federations/*}" - body: "federation" - }; - option (google.api.method_signature) = "federation,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Federation" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Deletes a single federation. - rpc DeleteFederation(DeleteFederationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/federations/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } -} - -// Represents a federation of multiple backend metastores. -message Federation { - option (google.api.resource) = { - type: "metastore.googleapis.com/Federation" - pattern: "projects/{project}/locations/{location}/federations/{federation}" - }; - - // The current state of the federation. - enum State { - // The state of the metastore federation is unknown. - STATE_UNSPECIFIED = 0; - - // The metastore federation is in the process of being created. - CREATING = 1; - - // The metastore federation is running and ready to serve queries. - ACTIVE = 2; - - // The metastore federation is being updated. It remains usable but cannot - // accept additional update requests or be deleted at this time. - UPDATING = 3; - - // The metastore federation is undergoing deletion. It cannot be used. - DELETING = 4; - - // The metastore federation has encountered an error and cannot be used. The - // metastore federation should be deleted. - ERROR = 5; - } - - // Immutable. The relative resource name of the federation, of the - // form: - // projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the metastore federation was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metastore federation was last updated. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-defined labels for the metastore federation. - map labels = 4; - - // Immutable. The Apache Hive metastore version of the federation. All backend - // metastore versions must be compatible with the federation version. - string version = 5 [(google.api.field_behavior) = IMMUTABLE]; - - // A map from `BackendMetastore` rank to `BackendMetastore`s from which the - // federation service serves metadata at query time. The map key represents - // the order in which `BackendMetastore`s should be evaluated to resolve - // database names at query time and should be greater than or equal to zero. A - // `BackendMetastore` with a lower number will be evaluated before a - // `BackendMetastore` with a higher number. - map backend_metastores = 6; - - // Output only. The federation endpoint. - string endpoint_uri = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the federation. - State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current state of the - // metastore federation, if available. - string state_message = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The globally unique resource identifier of the metastore - // federation. - string uid = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents a backend metastore for the federation. -message BackendMetastore { - // The type of the backend metastore. - enum MetastoreType { - // The metastore type is not set. - METASTORE_TYPE_UNSPECIFIED = 0; - - // The backend metastore is BigQuery. - BIGQUERY = 2; - - // The backend metastore is Dataproc Metastore. - DATAPROC_METASTORE = 3; - } - - // The relative resource name of the metastore that is being federated. - // The formats of the relative resource names for the currently supported - // metastores are listed below: - // - // * BigQuery - // * `projects/{project_id}` - // * Dataproc Metastore - // * `projects/{project_id}/locations/{location}/services/{service_id}` - string name = 1; - - // The type of the backend metastore. - MetastoreType metastore_type = 2; -} - -// Request message for ListFederations. -message ListFederationsRequest { - // Required. The relative resource name of the location of metastore - // federations to list, in the following form: - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Federation" - } - ]; - - // Optional. The maximum number of federations to return. The response may - // contain less than the maximum number. If unspecified, no more than 500 - // services are returned. The maximum value is 1000; values above 1000 are - // changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous ListFederationServices - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // ListFederationServices must match the call that provided the - // page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for ListFederations -message ListFederationsResponse { - // The services in the specified location. - repeated Federation federations = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for GetFederation. -message GetFederationRequest { - // Required. The relative resource name of the metastore federation to - // retrieve, in the following form: - // - // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Federation" - } - ]; -} - -// Request message for CreateFederation. -message CreateFederationRequest { - // Required. The relative resource name of the location in which to create a - // federation service, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Federation" - } - ]; - - // Required. The ID of the metastore federation, which is used as the final - // component of the metastore federation's name. - // - // This value must be between 2 and 63 characters long inclusive, begin with a - // letter, end with a letter or number, and consist of alpha-numeric - // ASCII characters or hyphens. - string federation_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Metastore Federation to create. The `name` field is - // ignored. The ID of the created metastore federation must be - // provided in the request's `federation_id` field. - Federation federation = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for UpdateFederation. -message UpdateFederationRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metastore federation resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The metastore federation to update. The server only merges fields - // in the service if they are specified in `update_mask`. - // - // The metastore federation's `name` field is used to identify the - // metastore service to be updated. - Federation federation = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for DeleteFederation. -message DeleteFederationRequest { - // Required. The relative resource name of the metastore federation to delete, - // in the following form: - // - // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Federation" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.alter_metadata_resource_location.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.alter_metadata_resource_location.js deleted file mode 100644 index 1d91860b5ec..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.alter_metadata_resource_location.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(service, resourceName, locationUri) { - // [START metastore_v1_generated_DataprocMetastore_AlterMetadataResourceLocation_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 relative resource name of the metastore service to mutate - * metadata, in the following format: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Required. The relative metadata resource name in the following format. - * `databases/{database_id}` - * or - * `databases/{database_id}/tables/{table_id}` - * or - * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` - */ - // const resourceName = 'abc123' - /** - * Required. The new location URI for the metadata resource. - */ - // const locationUri = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callAlterMetadataResourceLocation() { - // Construct request - const request = { - service, - resourceName, - locationUri, - }; - - // Run request - const [operation] = await metastoreClient.alterMetadataResourceLocation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAlterMetadataResourceLocation(); - // [END metastore_v1_generated_DataprocMetastore_AlterMetadataResourceLocation_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-metastore/v1/samples/generated/v1/dataproc_metastore.create_backup.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_backup.js deleted file mode 100644 index b5125a4e358..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_backup.js +++ /dev/null @@ -1,92 +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, backupId, backup) { - // [START metastore_v1_generated_DataprocMetastore_CreateBackup_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 relative resource name of the service in which to create a - * backup of the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the backup, which is used as the final component of the - * backup's name. - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - */ - // const backupId = 'abc123' - /** - * Required. The backup to create. The `name` field is ignored. The ID of the - * created backup must be provided in the request's `backup_id` field. - */ - // const backup = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateBackup() { - // Construct request - const request = { - parent, - backupId, - backup, - }; - - // Run request - const [operation] = await metastoreClient.createBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateBackup(); - // [END metastore_v1_generated_DataprocMetastore_CreateBackup_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-metastore/v1/samples/generated/v1/dataproc_metastore.create_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_metadata_import.js deleted file mode 100644 index 1ffe0918b16..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_metadata_import.js +++ /dev/null @@ -1,93 +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, metadataImportId, metadataImport) { - // [START metastore_v1_generated_DataprocMetastore_CreateMetadataImport_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 relative resource name of the service in which to create a - * metastore import, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metadata import, which is used as the final - * component of the metadata import's name. - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - */ - // const metadataImportId = 'abc123' - /** - * Required. The metadata import to create. The `name` field is ignored. The - * ID of the created metadata import must be provided in the request's - * `metadata_import_id` field. - */ - // const metadataImport = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateMetadataImport() { - // Construct request - const request = { - parent, - metadataImportId, - metadataImport, - }; - - // Run request - const [operation] = await metastoreClient.createMetadataImport(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateMetadataImport(); - // [END metastore_v1_generated_DataprocMetastore_CreateMetadataImport_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-metastore/v1/samples/generated/v1/dataproc_metastore.create_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_service.js deleted file mode 100644 index b78b1404bc9..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_service.js +++ /dev/null @@ -1,93 +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, serviceId, service) { - // [START metastore_v1_generated_DataprocMetastore_CreateService_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 relative resource name of the location in which to create a - * metastore service, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metastore service, which is used as the final - * component of the metastore service's name. - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - */ - // const serviceId = 'abc123' - /** - * Required. The Metastore service to create. The `name` field is - * ignored. The ID of the created metastore service must be provided in - * the request's `service_id` field. - */ - // const service = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateService() { - // Construct request - const request = { - parent, - serviceId, - service, - }; - - // Run request - const [operation] = await metastoreClient.createService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateService(); - // [END metastore_v1_generated_DataprocMetastore_CreateService_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-metastore/v1/samples/generated/v1/dataproc_metastore.delete_backup.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_backup.js deleted file mode 100644 index 6dca464ce9f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_backup.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(name) { - // [START metastore_v1_generated_DataprocMetastore_DeleteBackup_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 relative resource name of the backup to delete, in the - * following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callDeleteBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteBackup(); - // [END metastore_v1_generated_DataprocMetastore_DeleteBackup_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-metastore/v1/samples/generated/v1/dataproc_metastore.delete_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_service.js deleted file mode 100644 index af62ce30ef0..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_service.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(name) { - // [START metastore_v1_generated_DataprocMetastore_DeleteService_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 relative resource name of the metastore service to delete, in - * the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callDeleteService() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteService(); - // [END metastore_v1_generated_DataprocMetastore_DeleteService_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-metastore/v1/samples/generated/v1/dataproc_metastore.export_metadata.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.export_metadata.js deleted file mode 100644 index 7b4a90f37ac..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.export_metadata.js +++ /dev/null @@ -1,88 +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(service) { - // [START metastore_v1_generated_DataprocMetastore_ExportMetadata_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. - */ - /** - * A Cloud Storage URI of a folder, in the format - * `gs:///`. A sub-folder - * `` containing exported files will be created below it. - */ - // const destinationGcsFolder = 'abc123' - /** - * Required. The relative resource name of the metastore service to run - * export, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - /** - * Optional. The type of the database dump. If unspecified, defaults to - * `MYSQL`. - */ - // const databaseDumpType = {} - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callExportMetadata() { - // Construct request - const request = { - service, - }; - - // Run request - const [operation] = await metastoreClient.exportMetadata(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportMetadata(); - // [END metastore_v1_generated_DataprocMetastore_ExportMetadata_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-metastore/v1/samples/generated/v1/dataproc_metastore.get_backup.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_backup.js deleted file mode 100644 index 9d32738c1b3..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_backup.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 metastore_v1_generated_DataprocMetastore_GetBackup_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 relative resource name of the backup to retrieve, in the - * following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getBackup(request); - console.log(response); - } - - callGetBackup(); - // [END metastore_v1_generated_DataprocMetastore_GetBackup_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-metastore/v1/samples/generated/v1/dataproc_metastore.get_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_metadata_import.js deleted file mode 100644 index 95024e88fbb..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_metadata_import.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 metastore_v1_generated_DataprocMetastore_GetMetadataImport_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 relative resource name of the metadata import to retrieve, in - * the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetMetadataImport() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getMetadataImport(request); - console.log(response); - } - - callGetMetadataImport(); - // [END metastore_v1_generated_DataprocMetastore_GetMetadataImport_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-metastore/v1/samples/generated/v1/dataproc_metastore.get_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_service.js deleted file mode 100644 index d3aa046e1d2..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_service.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 metastore_v1_generated_DataprocMetastore_GetService_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 relative resource name of the metastore service to retrieve, - * in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetService() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getService(request); - console.log(response); - } - - callGetService(); - // [END metastore_v1_generated_DataprocMetastore_GetService_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-metastore/v1/samples/generated/v1/dataproc_metastore.list_backups.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_backups.js deleted file mode 100644 index e3863fb2b47..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_backups.js +++ /dev/null @@ -1,91 +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 metastore_v1_generated_DataprocMetastore_ListBackups_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 relative resource name of the service whose backups to - * list, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous - * DataprocMetastore.ListBackups google.cloud.metastore.v1.DataprocMetastore.ListBackups - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListBackups google.cloud.metastore.v1.DataprocMetastore.ListBackups - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListBackups() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listBackupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBackups(); - // [END metastore_v1_generated_DataprocMetastore_ListBackups_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-metastore/v1/samples/generated/v1/dataproc_metastore.list_metadata_imports.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_metadata_imports.js deleted file mode 100644 index dcddf3121f9..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_metadata_imports.js +++ /dev/null @@ -1,91 +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 metastore_v1_generated_DataprocMetastore_ListMetadataImports_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 relative resource name of the service whose metadata imports - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous - * DataprocMetastore.ListServices google.cloud.metastore.v1.DataprocMetastore.ListServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListServices google.cloud.metastore.v1.DataprocMetastore.ListServices - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListMetadataImports() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listMetadataImportsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMetadataImports(); - // [END metastore_v1_generated_DataprocMetastore_ListMetadataImports_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-metastore/v1/samples/generated/v1/dataproc_metastore.list_services.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_services.js deleted file mode 100644 index 7d49b03464b..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_services.js +++ /dev/null @@ -1,92 +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 metastore_v1_generated_DataprocMetastore_ListServices_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 relative resource name of the location of metastore services - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous - * DataprocMetastore.ListServices google.cloud.metastore.v1.DataprocMetastore.ListServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListServices google.cloud.metastore.v1.DataprocMetastore.ListServices - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListServices() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listServicesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListServices(); - // [END metastore_v1_generated_DataprocMetastore_ListServices_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-metastore/v1/samples/generated/v1/dataproc_metastore.move_table_to_database.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.move_table_to_database.js deleted file mode 100644 index 4f15ad1f664..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.move_table_to_database.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(service, tableName, dbName, destinationDbName) { - // [START metastore_v1_generated_DataprocMetastore_MoveTableToDatabase_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 relative resource name of the metastore service to mutate - * metadata, in the following format: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Required. The name of the table to be moved. - */ - // const tableName = 'abc123' - /** - * Required. The name of the database where the table resides. - */ - // const dbName = 'abc123' - /** - * Required. The name of the database where the table should be moved. - */ - // const destinationDbName = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callMoveTableToDatabase() { - // Construct request - const request = { - service, - tableName, - dbName, - destinationDbName, - }; - - // Run request - const [operation] = await metastoreClient.moveTableToDatabase(request); - const [response] = await operation.promise(); - console.log(response); - } - - callMoveTableToDatabase(); - // [END metastore_v1_generated_DataprocMetastore_MoveTableToDatabase_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-metastore/v1/samples/generated/v1/dataproc_metastore.query_metadata.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.query_metadata.js deleted file mode 100644 index b514ada0518..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.query_metadata.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(service, query) { - // [START metastore_v1_generated_DataprocMetastore_QueryMetadata_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 relative resource name of the metastore service to query - * metadata, in the following format: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Required. A read-only SQL query to execute against the metadata database. - * The query cannot change or mutate the data. - */ - // const query = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callQueryMetadata() { - // Construct request - const request = { - service, - query, - }; - - // Run request - const [operation] = await metastoreClient.queryMetadata(request); - const [response] = await operation.promise(); - console.log(response); - } - - callQueryMetadata(); - // [END metastore_v1_generated_DataprocMetastore_QueryMetadata_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-metastore/v1/samples/generated/v1/dataproc_metastore.restore_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.restore_service.js deleted file mode 100644 index 10e3459c45f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.restore_service.js +++ /dev/null @@ -1,88 +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(service, backup) { - // [START metastore_v1_generated_DataprocMetastore_RestoreService_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 relative resource name of the metastore service to run - * restore, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Required. The relative resource name of the metastore service backup to - * restore from, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const backup = 'abc123' - /** - * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - */ - // const restoreType = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callRestoreService() { - // Construct request - const request = { - service, - backup, - }; - - // Run request - const [operation] = await metastoreClient.restoreService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRestoreService(); - // [END metastore_v1_generated_DataprocMetastore_RestoreService_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-metastore/v1/samples/generated/v1/dataproc_metastore.update_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_metadata_import.js deleted file mode 100644 index 4e8c75e9ea5..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_metadata_import.js +++ /dev/null @@ -1,86 +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(updateMask, metadataImport) { - // [START metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_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. A field mask used to specify the fields to be overwritten in the - * metadata import resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metadata import to update. The server only merges fields - * in the import if they are specified in `update_mask`. - * The metadata import's `name` field is used to identify the metastore - * import to be updated. - */ - // const metadataImport = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callUpdateMetadataImport() { - // Construct request - const request = { - updateMask, - metadataImport, - }; - - // Run request - const [operation] = await metastoreClient.updateMetadataImport(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateMetadataImport(); - // [END metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_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-metastore/v1/samples/generated/v1/dataproc_metastore.update_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_service.js deleted file mode 100644 index 8ea20cde6f8..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_service.js +++ /dev/null @@ -1,86 +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(updateMask, service) { - // [START metastore_v1_generated_DataprocMetastore_UpdateService_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. A field mask used to specify the fields to be overwritten in the - * metastore service resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metastore service to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * The metastore service's `name` field is used to identify the metastore - * service to be updated. - */ - // const service = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callUpdateService() { - // Construct request - const request = { - updateMask, - service, - }; - - // Run request - const [operation] = await metastoreClient.updateService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateService(); - // [END metastore_v1_generated_DataprocMetastore_UpdateService_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-metastore/v1/samples/generated/v1/dataproc_metastore_federation.create_federation.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.create_federation.js deleted file mode 100644 index 6c5a670a8c2..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.create_federation.js +++ /dev/null @@ -1,93 +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, federationId, federation) { - // [START metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_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 relative resource name of the location in which to create a - * federation service, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metastore federation, which is used as the final - * component of the metastore federation's name. - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - */ - // const federationId = 'abc123' - /** - * Required. The Metastore Federation to create. The `name` field is - * ignored. The ID of the created metastore federation must be - * provided in the request's `federation_id` field. - */ - // const federation = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callCreateFederation() { - // Construct request - const request = { - parent, - federationId, - federation, - }; - - // Run request - const [operation] = await metastoreClient.createFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateFederation(); - // [END metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_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-metastore/v1/samples/generated/v1/dataproc_metastore_federation.delete_federation.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.delete_federation.js deleted file mode 100644 index 43dd7799202..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.delete_federation.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(name) { - // [START metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_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 relative resource name of the metastore federation to delete, - * in the following form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callDeleteFederation() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteFederation(); - // [END metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_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-metastore/v1/samples/generated/v1/dataproc_metastore_federation.get_federation.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.get_federation.js deleted file mode 100644 index 0dad1bb458a..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.get_federation.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 metastore_v1_generated_DataprocMetastoreFederation_GetFederation_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 relative resource name of the metastore federation to - * retrieve, in the following form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callGetFederation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getFederation(request); - console.log(response); - } - - callGetFederation(); - // [END metastore_v1_generated_DataprocMetastoreFederation_GetFederation_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-metastore/v1/samples/generated/v1/dataproc_metastore_federation.list_federations.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.list_federations.js deleted file mode 100644 index 5d4161729e9..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.list_federations.js +++ /dev/null @@ -1,91 +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 metastore_v1_generated_DataprocMetastoreFederation_ListFederations_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 relative resource name of the location of metastore - * federations to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of federations to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callListFederations() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listFederationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFederations(); - // [END metastore_v1_generated_DataprocMetastoreFederation_ListFederations_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-metastore/v1/samples/generated/v1/dataproc_metastore_federation.update_federation.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.update_federation.js deleted file mode 100644 index 05989a1af86..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.update_federation.js +++ /dev/null @@ -1,86 +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(updateMask, federation) { - // [START metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_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. A field mask used to specify the fields to be overwritten in the - * metastore federation resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metastore federation to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * The metastore federation's `name` field is used to identify the - * metastore service to be updated. - */ - // const federation = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callUpdateFederation() { - // Construct request - const request = { - updateMask, - federation, - }; - - // Run request - const [operation] = await metastoreClient.updateFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateFederation(); - // [END metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_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-metastore/v1/samples/generated/v1/snippet_metadata_google.cloud.metastore.v1.json b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/snippet_metadata_google.cloud.metastore.v1.json deleted file mode 100644 index 455874f87e7..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/snippet_metadata_google.cloud.metastore.v1.json +++ /dev/null @@ -1,1131 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-metastore", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.metastore.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "metastore_v1_generated_DataprocMetastore_ListServices_async", - "title": "DataprocMetastore listServices Sample", - "origin": "API_DEFINITION", - "description": " Lists services in a project and location.", - "canonical": true, - "file": "dataproc_metastore.list_services.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServices", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListServices", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1.ListServicesResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListServices", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListServices", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_GetService_async", - "title": "DataprocMetastore getService Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a single service.", - "canonical": true, - "file": "dataproc_metastore.get_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetService", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1.Service", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_CreateService_async", - "title": "DataprocMetastore createService Sample", - "origin": "API_DEFINITION", - "description": " Creates a metastore service in a project and location.", - "canonical": true, - "file": "dataproc_metastore.create_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateService", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "service_id", - "type": "TYPE_STRING" - }, - { - "name": "service", - "type": ".google.cloud.metastore.v1.Service" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_UpdateService_async", - "title": "DataprocMetastore updateService Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of a single service.", - "canonical": true, - "file": "dataproc_metastore.update_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.UpdateService", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "service", - "type": ".google.cloud.metastore.v1.Service" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "UpdateService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.UpdateService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_DeleteService_async", - "title": "DataprocMetastore deleteService Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single service.", - "canonical": true, - "file": "dataproc_metastore.delete_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.DeleteService", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "DeleteService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.DeleteService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_ListMetadataImports_async", - "title": "DataprocMetastore listMetadataImports Sample", - "origin": "API_DEFINITION", - "description": " Lists imports in a service.", - "canonical": true, - "file": "dataproc_metastore.list_metadata_imports.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMetadataImports", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1.ListMetadataImportsResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListMetadataImports", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_GetMetadataImport_async", - "title": "DataprocMetastore getMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single import.", - "canonical": true, - "file": "dataproc_metastore.get_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetMetadataImport", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetMetadataImport", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1.MetadataImport", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetMetadataImport", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_CreateMetadataImport_async", - "title": "DataprocMetastore createMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Creates a new MetadataImport in a given project and location.", - "canonical": true, - "file": "dataproc_metastore.create_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMetadataImport", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateMetadataImport", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "metadata_import_id", - "type": "TYPE_STRING" - }, - { - "name": "metadata_import", - "type": ".google.cloud.metastore.v1.MetadataImport" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateMetadataImport", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_async", - "title": "DataprocMetastore updateMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Updates a single import. Only the description field of MetadataImport is supported to be updated.", - "canonical": true, - "file": "dataproc_metastore.update_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateMetadataImport", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.UpdateMetadataImport", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "metadata_import", - "type": ".google.cloud.metastore.v1.MetadataImport" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "UpdateMetadataImport", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.UpdateMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_ExportMetadata_async", - "title": "DataprocMetastore exportMetadata Sample", - "origin": "API_DEFINITION", - "description": " Exports metadata from a service.", - "canonical": true, - "file": "dataproc_metastore.export_metadata.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportMetadata", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.ExportMetadata", - "async": true, - "parameters": [ - { - "name": "destination_gcs_folder", - "type": "TYPE_STRING" - }, - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "database_dump_type", - "type": ".google.cloud.metastore.v1.DatabaseDumpSpec.Type" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "ExportMetadata", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.ExportMetadata", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_RestoreService_async", - "title": "DataprocMetastore restoreService Sample", - "origin": "API_DEFINITION", - "description": " Restores a service from a backup.", - "canonical": true, - "file": "dataproc_metastore.restore_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RestoreService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.RestoreService", - "async": true, - "parameters": [ - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": "TYPE_STRING" - }, - { - "name": "restore_type", - "type": ".google.cloud.metastore.v1.Restore.RestoreType" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "RestoreService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.RestoreService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_ListBackups_async", - "title": "DataprocMetastore listBackups Sample", - "origin": "API_DEFINITION", - "description": " Lists backups in a service.", - "canonical": true, - "file": "dataproc_metastore.list_backups.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBackups", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListBackups", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1.ListBackupsResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListBackups", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListBackups", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_GetBackup_async", - "title": "DataprocMetastore getBackup Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single backup.", - "canonical": true, - "file": "dataproc_metastore.get_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBackup", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1.Backup", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetBackup", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_CreateBackup_async", - "title": "DataprocMetastore createBackup Sample", - "origin": "API_DEFINITION", - "description": " Creates a new backup in a given project and location.", - "canonical": true, - "file": "dataproc_metastore.create_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBackup", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateBackup", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "backup_id", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": ".google.cloud.metastore.v1.Backup" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateBackup", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_DeleteBackup_async", - "title": "DataprocMetastore deleteBackup Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single backup.", - "canonical": true, - "file": "dataproc_metastore.delete_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.DeleteBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.DeleteBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_QueryMetadata_async", - "title": "DataprocMetastore queryMetadata Sample", - "origin": "API_DEFINITION", - "description": " Query DPMS metadata.", - "canonical": true, - "file": "dataproc_metastore.query_metadata.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "QueryMetadata", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.QueryMetadata", - "async": true, - "parameters": [ - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "QueryMetadata", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.QueryMetadata", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_MoveTableToDatabase_async", - "title": "DataprocMetastore moveTableToDatabase Sample", - "origin": "API_DEFINITION", - "description": " Move a table to another database.", - "canonical": true, - "file": "dataproc_metastore.move_table_to_database.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "MoveTableToDatabase", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.MoveTableToDatabase", - "async": true, - "parameters": [ - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "table_name", - "type": "TYPE_STRING" - }, - { - "name": "db_name", - "type": "TYPE_STRING" - }, - { - "name": "destination_db_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "MoveTableToDatabase", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.MoveTableToDatabase", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_AlterMetadataResourceLocation_async", - "title": "DataprocMetastore alterMetadataResourceLocation Sample", - "origin": "API_DEFINITION", - "description": " Alter metadata resource location. The metadata resource can be a database, table, or partition. This functionality only updates the parent directory for the respective metadata resource and does not transfer any existing data to the new location.", - "canonical": true, - "file": "dataproc_metastore.alter_metadata_resource_location.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AlterMetadataResourceLocation", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.AlterMetadataResourceLocation", - "async": true, - "parameters": [ - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "resource_name", - "type": "TYPE_STRING" - }, - { - "name": "location_uri", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "AlterMetadataResourceLocation", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.AlterMetadataResourceLocation", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_ListFederations_async", - "title": "DataprocMetastore listFederations Sample", - "origin": "API_DEFINITION", - "description": " Lists federations in a project and location.", - "canonical": true, - "file": "dataproc_metastore_federation.list_federations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFederations", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.ListFederations", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1.ListFederationsResponse", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "ListFederations", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.ListFederations", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_GetFederation_async", - "title": "DataprocMetastore getFederation Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a single federation.", - "canonical": true, - "file": "dataproc_metastore_federation.get_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.GetFederation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1.Federation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "GetFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.GetFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_async", - "title": "DataprocMetastore createFederation Sample", - "origin": "API_DEFINITION", - "description": " Creates a metastore federation in a project and location.", - "canonical": true, - "file": "dataproc_metastore_federation.create_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.CreateFederation", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "federation_id", - "type": "TYPE_STRING" - }, - { - "name": "federation", - "type": ".google.cloud.metastore.v1.Federation" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "CreateFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.CreateFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_async", - "title": "DataprocMetastore updateFederation Sample", - "origin": "API_DEFINITION", - "description": " Updates the fields of a federation.", - "canonical": true, - "file": "dataproc_metastore_federation.update_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.UpdateFederation", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "federation", - "type": ".google.cloud.metastore.v1.Federation" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "UpdateFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.UpdateFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_async", - "title": "DataprocMetastore deleteFederation Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single federation.", - "canonical": true, - "file": "dataproc_metastore_federation.delete_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.DeleteFederation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "DeleteFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.DeleteFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1/src/index.ts deleted file mode 100644 index f51a12e6a33..00000000000 --- a/owl-bot-staging/google-cloud-metastore/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 DataprocMetastoreClient = v1.DataprocMetastoreClient; -type DataprocMetastoreClient = v1.DataprocMetastoreClient; -const DataprocMetastoreFederationClient = v1.DataprocMetastoreFederationClient; -type DataprocMetastoreFederationClient = v1.DataprocMetastoreFederationClient; -export {v1, DataprocMetastoreClient, DataprocMetastoreFederationClient}; -export default {v1, DataprocMetastoreClient, DataprocMetastoreFederationClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client.ts b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client.ts deleted file mode 100644 index a15f7a8831c..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client.ts +++ /dev/null @@ -1,3409 +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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/dataproc_metastore_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './dataproc_metastore_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Configures and manages metastore services. - * Metastore services are fully managed, highly available, autoscaled, - * autohealing, OSS-native deployments of technical metadata management - * software. Each metastore service exposes a network endpoint through which - * metadata queries are served. Metadata queries can originate from a variety - * of sources, including Apache Hive, Apache Presto, and Apache Spark. - * - * The Dataproc Metastore API defines the following resource model: - * - * * The service works with a collection of Google Cloud projects, named: - * `/projects/*` - * * Each project has a collection of available locations, named: `/locations/*` - * (a location must refer to a Google Cloud `region`) - * * Each location has a collection of services, named: `/services/*` - * * Dataproc Metastore services are resources with names of the form: - * - * `/projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @class - * @memberof v1 - */ -export class DataprocMetastoreClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - dataprocMetastoreStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DataprocMetastoreClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 DataprocMetastoreClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DataprocMetastoreClient; - 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; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - 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 = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' - ), - federationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/federations/{federation}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - metadataImportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' - ), - networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{network}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listServices: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'services'), - listMetadataImports: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metadataImports'), - listBackups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.Service') as gax.protobuf.Type; - const createServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const updateServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.Service') as gax.protobuf.Type; - const updateServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const deleteServiceResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const createMetadataImportResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.MetadataImport') as gax.protobuf.Type; - const createMetadataImportMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const updateMetadataImportResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.MetadataImport') as gax.protobuf.Type; - const updateMetadataImportMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const exportMetadataResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.MetadataExport') as gax.protobuf.Type; - const exportMetadataMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const restoreServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.Restore') as gax.protobuf.Type; - const restoreServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const createBackupResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.Backup') as gax.protobuf.Type; - const createBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const deleteBackupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const queryMetadataResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.QueryMetadataResponse') as gax.protobuf.Type; - const queryMetadataMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const moveTableToDatabaseResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.MoveTableToDatabaseResponse') as gax.protobuf.Type; - const moveTableToDatabaseMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const alterMetadataResourceLocationResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.AlterMetadataResourceLocationResponse') as gax.protobuf.Type; - const alterMetadataResourceLocationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createServiceResponse.decode.bind(createServiceResponse), - createServiceMetadata.decode.bind(createServiceMetadata)), - updateService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateServiceResponse.decode.bind(updateServiceResponse), - updateServiceMetadata.decode.bind(updateServiceMetadata)), - deleteService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteServiceResponse.decode.bind(deleteServiceResponse), - deleteServiceMetadata.decode.bind(deleteServiceMetadata)), - createMetadataImport: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createMetadataImportResponse.decode.bind(createMetadataImportResponse), - createMetadataImportMetadata.decode.bind(createMetadataImportMetadata)), - updateMetadataImport: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateMetadataImportResponse.decode.bind(updateMetadataImportResponse), - updateMetadataImportMetadata.decode.bind(updateMetadataImportMetadata)), - exportMetadata: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportMetadataResponse.decode.bind(exportMetadataResponse), - exportMetadataMetadata.decode.bind(exportMetadataMetadata)), - restoreService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - restoreServiceResponse.decode.bind(restoreServiceResponse), - restoreServiceMetadata.decode.bind(restoreServiceMetadata)), - createBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBackupResponse.decode.bind(createBackupResponse), - createBackupMetadata.decode.bind(createBackupMetadata)), - deleteBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteBackupResponse.decode.bind(deleteBackupResponse), - deleteBackupMetadata.decode.bind(deleteBackupMetadata)), - queryMetadata: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - queryMetadataResponse.decode.bind(queryMetadataResponse), - queryMetadataMetadata.decode.bind(queryMetadataMetadata)), - moveTableToDatabase: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - moveTableToDatabaseResponse.decode.bind(moveTableToDatabaseResponse), - moveTableToDatabaseMetadata.decode.bind(moveTableToDatabaseMetadata)), - alterMetadataResourceLocation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - alterMetadataResourceLocationResponse.decode.bind(alterMetadataResourceLocationResponse), - alterMetadataResourceLocationMetadata.decode.bind(alterMetadataResourceLocationMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.metastore.v1.DataprocMetastore', 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.dataprocMetastoreStub) { - return this.dataprocMetastoreStub; - } - - // Put together the "service stub" for - // google.cloud.metastore.v1.DataprocMetastore. - this.dataprocMetastoreStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1.DataprocMetastore') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.metastore.v1.DataprocMetastore, - 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 dataprocMetastoreStubMethods = - ['listServices', 'getService', 'createService', 'updateService', 'deleteService', 'listMetadataImports', 'getMetadataImport', 'createMetadataImport', 'updateMetadataImport', 'exportMetadata', 'restoreService', 'listBackups', 'getBackup', 'createBackup', 'deleteBackup', 'queryMetadata', 'moveTableToDatabase', 'alterMetadataResourceLocation']; - for (const methodName of dataprocMetastoreStubMethods) { - const callPromise = this.dataprocMetastoreStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.dataprocMetastoreStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'metastore.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 'metastore.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 -- - // ------------------- -/** - * Gets the details of a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore service to retrieve, - * in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.metastore.v1.Service|Service}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.get_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_GetService_async - */ - getService( - request?: protos.google.cloud.metastore.v1.IGetServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1.IService, - protos.google.cloud.metastore.v1.IGetServiceRequest|undefined, {}|undefined - ]>; - getService( - request: protos.google.cloud.metastore.v1.IGetServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1.IService, - protos.google.cloud.metastore.v1.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; - getService( - request: protos.google.cloud.metastore.v1.IGetServiceRequest, - callback: Callback< - protos.google.cloud.metastore.v1.IService, - protos.google.cloud.metastore.v1.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; - getService( - request?: protos.google.cloud.metastore.v1.IGetServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1.IService, - protos.google.cloud.metastore.v1.IGetServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1.IService, - protos.google.cloud.metastore.v1.IGetServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1.IService, - protos.google.cloud.metastore.v1.IGetServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getService(request, options, callback); - } -/** - * Gets details of a single import. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metadata import to retrieve, in - * the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_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 protos.google.cloud.metastore.v1.MetadataImport|MetadataImport}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.get_metadata_import.js - * region_tag:metastore_v1_generated_DataprocMetastore_GetMetadataImport_async - */ - getMetadataImport( - request?: protos.google.cloud.metastore.v1.IGetMetadataImportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1.IMetadataImport, - protos.google.cloud.metastore.v1.IGetMetadataImportRequest|undefined, {}|undefined - ]>; - getMetadataImport( - request: protos.google.cloud.metastore.v1.IGetMetadataImportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1.IMetadataImport, - protos.google.cloud.metastore.v1.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): void; - getMetadataImport( - request: protos.google.cloud.metastore.v1.IGetMetadataImportRequest, - callback: Callback< - protos.google.cloud.metastore.v1.IMetadataImport, - protos.google.cloud.metastore.v1.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): void; - getMetadataImport( - request?: protos.google.cloud.metastore.v1.IGetMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1.IMetadataImport, - protos.google.cloud.metastore.v1.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1.IMetadataImport, - protos.google.cloud.metastore.v1.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1.IMetadataImport, - protos.google.cloud.metastore.v1.IGetMetadataImportRequest|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.getMetadataImport(request, options, callback); - } -/** - * Gets details of a single backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the backup to retrieve, in the - * following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_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 protos.google.cloud.metastore.v1.Backup|Backup}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.get_backup.js - * region_tag:metastore_v1_generated_DataprocMetastore_GetBackup_async - */ - getBackup( - request?: protos.google.cloud.metastore.v1.IGetBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1.IBackup, - protos.google.cloud.metastore.v1.IGetBackupRequest|undefined, {}|undefined - ]>; - getBackup( - request: protos.google.cloud.metastore.v1.IGetBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1.IBackup, - protos.google.cloud.metastore.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request: protos.google.cloud.metastore.v1.IGetBackupRequest, - callback: Callback< - protos.google.cloud.metastore.v1.IBackup, - protos.google.cloud.metastore.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request?: protos.google.cloud.metastore.v1.IGetBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1.IBackup, - protos.google.cloud.metastore.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1.IBackup, - protos.google.cloud.metastore.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1.IBackup, - protos.google.cloud.metastore.v1.IGetBackupRequest|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.getBackup(request, options, callback); - } - -/** - * Creates a metastore service in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location in which to create a - * metastore service, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {string} request.serviceId - * Required. The ID of the metastore service, which is used as the final - * component of the metastore service's name. - * - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - * @param {google.cloud.metastore.v1.Service} request.service - * Required. The Metastore service to create. The `name` field is - * ignored. The ID of the created metastore service must be provided in - * the request's `service_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.create_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_CreateService_async - */ - createService( - request?: protos.google.cloud.metastore.v1.ICreateServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createService( - request: protos.google.cloud.metastore.v1.ICreateServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createService( - request: protos.google.cloud.metastore.v1.ICreateServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createService( - request?: protos.google.cloud.metastore.v1.ICreateServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.create_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_CreateService_async - */ - async checkCreateServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the parameters of a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metastore service resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1.Service} request.service - * Required. The metastore service to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * - * The metastore service's `name` field is used to identify the metastore - * service to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.update_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_UpdateService_async - */ - updateService( - request?: protos.google.cloud.metastore.v1.IUpdateServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateService( - request: protos.google.cloud.metastore.v1.IUpdateServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateService( - request: protos.google.cloud.metastore.v1.IUpdateServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateService( - request?: protos.google.cloud.metastore.v1.IUpdateServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service.name': request.service!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.update_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_UpdateService_async - */ - async checkUpdateServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore service to delete, in - * the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.delete_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_DeleteService_async - */ - deleteService( - request?: protos.google.cloud.metastore.v1.IDeleteServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteService( - request: protos.google.cloud.metastore.v1.IDeleteServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteService( - request: protos.google.cloud.metastore.v1.IDeleteServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteService( - request?: protos.google.cloud.metastore.v1.IDeleteServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.delete_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_DeleteService_async - */ - async checkDeleteServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new MetadataImport in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service in which to create a - * metastore import, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} request.metadataImportId - * Required. The ID of the metadata import, which is used as the final - * component of the metadata import's name. - * - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - * @param {google.cloud.metastore.v1.MetadataImport} request.metadataImport - * Required. The metadata import to create. The `name` field is ignored. The - * ID of the created metadata import must be provided in the request's - * `metadata_import_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.create_metadata_import.js - * region_tag:metastore_v1_generated_DataprocMetastore_CreateMetadataImport_async - */ - createMetadataImport( - request?: protos.google.cloud.metastore.v1.ICreateMetadataImportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createMetadataImport( - request: protos.google.cloud.metastore.v1.ICreateMetadataImportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMetadataImport( - request: protos.google.cloud.metastore.v1.ICreateMetadataImportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMetadataImport( - request?: protos.google.cloud.metastore.v1.ICreateMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createMetadataImport(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createMetadataImport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.create_metadata_import.js - * region_tag:metastore_v1_generated_DataprocMetastore_CreateMetadataImport_async - */ - async checkCreateMetadataImportProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMetadataImport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates a single import. - * Only the description field of MetadataImport is supported to be updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metadata import resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1.MetadataImport} request.metadataImport - * Required. The metadata import to update. The server only merges fields - * in the import if they are specified in `update_mask`. - * - * The metadata import's `name` field is used to identify the metastore - * import to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.update_metadata_import.js - * region_tag:metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_async - */ - updateMetadataImport( - request?: protos.google.cloud.metastore.v1.IUpdateMetadataImportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateMetadataImport( - request: protos.google.cloud.metastore.v1.IUpdateMetadataImportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMetadataImport( - request: protos.google.cloud.metastore.v1.IUpdateMetadataImportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMetadataImport( - request?: protos.google.cloud.metastore.v1.IUpdateMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metadata_import.name': request.metadataImport!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateMetadataImport(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateMetadataImport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.update_metadata_import.js - * region_tag:metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_async - */ - async checkUpdateMetadataImportProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMetadataImport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Exports metadata from a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.destinationGcsFolder - * A Cloud Storage URI of a folder, in the format - * `gs:///`. A sub-folder - * `` containing exported files will be created below it. - * @param {string} request.service - * Required. The relative resource name of the metastore service to run - * export, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {google.cloud.metastore.v1.DatabaseDumpSpec.Type} [request.databaseDumpType] - * Optional. The type of the database dump. If unspecified, defaults to - * `MYSQL`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.export_metadata.js - * region_tag:metastore_v1_generated_DataprocMetastore_ExportMetadata_async - */ - exportMetadata( - request?: protos.google.cloud.metastore.v1.IExportMetadataRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportMetadata( - request: protos.google.cloud.metastore.v1.IExportMetadataRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportMetadata( - request: protos.google.cloud.metastore.v1.IExportMetadataRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportMetadata( - request?: protos.google.cloud.metastore.v1.IExportMetadataRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.exportMetadata(request, options, callback); - } -/** - * Check the status of the long running operation returned by `exportMetadata()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.export_metadata.js - * region_tag:metastore_v1_generated_DataprocMetastore_ExportMetadata_async - */ - async checkExportMetadataProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportMetadata, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Restores a service from a backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.service - * Required. The relative resource name of the metastore service to run - * restore, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} request.backup - * Required. The relative resource name of the metastore service backup to - * restore from, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - * @param {google.cloud.metastore.v1.Restore.RestoreType} [request.restoreType] - * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.restore_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_RestoreService_async - */ - restoreService( - request?: protos.google.cloud.metastore.v1.IRestoreServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - restoreService( - request: protos.google.cloud.metastore.v1.IRestoreServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreService( - request: protos.google.cloud.metastore.v1.IRestoreServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreService( - request?: protos.google.cloud.metastore.v1.IRestoreServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.restoreService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `restoreService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.restore_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_RestoreService_async - */ - async checkRestoreServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new backup in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service in which to create a - * backup of the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} request.backupId - * Required. The ID of the backup, which is used as the final component of the - * backup's name. - * - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - * @param {google.cloud.metastore.v1.Backup} request.backup - * Required. The backup to create. The `name` field is ignored. The ID of the - * created backup must be provided in the request's `backup_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.create_backup.js - * region_tag:metastore_v1_generated_DataprocMetastore_CreateBackup_async - */ - createBackup( - request?: protos.google.cloud.metastore.v1.ICreateBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createBackup( - request: protos.google.cloud.metastore.v1.ICreateBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request: protos.google.cloud.metastore.v1.ICreateBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request?: protos.google.cloud.metastore.v1.ICreateBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.create_backup.js - * region_tag:metastore_v1_generated_DataprocMetastore_CreateBackup_async - */ - async checkCreateBackupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the backup to delete, in the - * following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.delete_backup.js - * region_tag:metastore_v1_generated_DataprocMetastore_DeleteBackup_async - */ - deleteBackup( - request?: protos.google.cloud.metastore.v1.IDeleteBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteBackup( - request: protos.google.cloud.metastore.v1.IDeleteBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request: protos.google.cloud.metastore.v1.IDeleteBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request?: protos.google.cloud.metastore.v1.IDeleteBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.delete_backup.js - * region_tag:metastore_v1_generated_DataprocMetastore_DeleteBackup_async - */ - async checkDeleteBackupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteBackup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Query DPMS metadata. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.service - * Required. The relative resource name of the metastore service to query - * metadata, in the following format: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} request.query - * Required. A read-only SQL query to execute against the metadata database. - * The query cannot change or mutate the data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.query_metadata.js - * region_tag:metastore_v1_generated_DataprocMetastore_QueryMetadata_async - */ - queryMetadata( - request?: protos.google.cloud.metastore.v1.IQueryMetadataRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - queryMetadata( - request: protos.google.cloud.metastore.v1.IQueryMetadataRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - queryMetadata( - request: protos.google.cloud.metastore.v1.IQueryMetadataRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - queryMetadata( - request?: protos.google.cloud.metastore.v1.IQueryMetadataRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.queryMetadata(request, options, callback); - } -/** - * Check the status of the long running operation returned by `queryMetadata()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.query_metadata.js - * region_tag:metastore_v1_generated_DataprocMetastore_QueryMetadata_async - */ - async checkQueryMetadataProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.queryMetadata, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Move a table to another database. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.service - * Required. The relative resource name of the metastore service to mutate - * metadata, in the following format: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} request.tableName - * Required. The name of the table to be moved. - * @param {string} request.dbName - * Required. The name of the database where the table resides. - * @param {string} request.destinationDbName - * Required. The name of the database where the table should be moved. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.move_table_to_database.js - * region_tag:metastore_v1_generated_DataprocMetastore_MoveTableToDatabase_async - */ - moveTableToDatabase( - request?: protos.google.cloud.metastore.v1.IMoveTableToDatabaseRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - moveTableToDatabase( - request: protos.google.cloud.metastore.v1.IMoveTableToDatabaseRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - moveTableToDatabase( - request: protos.google.cloud.metastore.v1.IMoveTableToDatabaseRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - moveTableToDatabase( - request?: protos.google.cloud.metastore.v1.IMoveTableToDatabaseRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.moveTableToDatabase(request, options, callback); - } -/** - * Check the status of the long running operation returned by `moveTableToDatabase()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.move_table_to_database.js - * region_tag:metastore_v1_generated_DataprocMetastore_MoveTableToDatabase_async - */ - async checkMoveTableToDatabaseProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.moveTableToDatabase, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Alter metadata resource location. The metadata resource can be a database, - * table, or partition. This functionality only updates the parent directory - * for the respective metadata resource and does not transfer any existing - * data to the new location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.service - * Required. The relative resource name of the metastore service to mutate - * metadata, in the following format: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} request.resourceName - * Required. The relative metadata resource name in the following format. - * - * `databases/{database_id}` - * or - * `databases/{database_id}/tables/{table_id}` - * or - * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` - * @param {string} request.locationUri - * Required. The new location URI for the metadata 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.alter_metadata_resource_location.js - * region_tag:metastore_v1_generated_DataprocMetastore_AlterMetadataResourceLocation_async - */ - alterMetadataResourceLocation( - request?: protos.google.cloud.metastore.v1.IAlterMetadataResourceLocationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - alterMetadataResourceLocation( - request: protos.google.cloud.metastore.v1.IAlterMetadataResourceLocationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - alterMetadataResourceLocation( - request: protos.google.cloud.metastore.v1.IAlterMetadataResourceLocationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - alterMetadataResourceLocation( - request?: protos.google.cloud.metastore.v1.IAlterMetadataResourceLocationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.alterMetadataResourceLocation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `alterMetadataResourceLocation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.alter_metadata_resource_location.js - * region_tag:metastore_v1_generated_DataprocMetastore_AlterMetadataResourceLocation_async - */ - async checkAlterMetadataResourceLocationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.alterMetadataResourceLocation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists services in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1.Service|Service}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listServicesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listServices( - request?: protos.google.cloud.metastore.v1.IListServicesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1.IService[], - protos.google.cloud.metastore.v1.IListServicesRequest|null, - protos.google.cloud.metastore.v1.IListServicesResponse - ]>; - listServices( - request: protos.google.cloud.metastore.v1.IListServicesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1.IListServicesRequest, - protos.google.cloud.metastore.v1.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1.IService>): void; - listServices( - request: protos.google.cloud.metastore.v1.IListServicesRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1.IListServicesRequest, - protos.google.cloud.metastore.v1.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1.IService>): void; - listServices( - request?: protos.google.cloud.metastore.v1.IListServicesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1.IListServicesRequest, - protos.google.cloud.metastore.v1.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1.IService>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1.IListServicesRequest, - protos.google.cloud.metastore.v1.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1.IService>): - Promise<[ - protos.google.cloud.metastore.v1.IService[], - protos.google.cloud.metastore.v1.IListServicesRequest|null, - protos.google.cloud.metastore.v1.IListServicesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listServices(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 protos.google.cloud.metastore.v1.Service|Service} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listServicesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listServicesStream( - request?: protos.google.cloud.metastore.v1.IListServicesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listServices.createStream( - this.innerApiCalls.listServices as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listServices`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.metastore.v1.Service|Service}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.list_services.js - * region_tag:metastore_v1_generated_DataprocMetastore_ListServices_async - */ - listServicesAsync( - request?: protos.google.cloud.metastore.v1.IListServicesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listServices.asyncIterate( - this.innerApiCalls['listServices'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists imports in a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1.MetadataImport|MetadataImport}. - * 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 `listMetadataImportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMetadataImports( - request?: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1.IMetadataImport[], - protos.google.cloud.metastore.v1.IListMetadataImportsRequest|null, - protos.google.cloud.metastore.v1.IListMetadataImportsResponse - ]>; - listMetadataImports( - request: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1.IMetadataImport>): void; - listMetadataImports( - request: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1.IMetadataImport>): void; - listMetadataImports( - request?: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1.IMetadataImport>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1.IMetadataImport>): - Promise<[ - protos.google.cloud.metastore.v1.IMetadataImport[], - protos.google.cloud.metastore.v1.IListMetadataImportsRequest|null, - protos.google.cloud.metastore.v1.IListMetadataImportsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listMetadataImports(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 protos.google.cloud.metastore.v1.MetadataImport|MetadataImport} 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 `listMetadataImportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMetadataImportsStream( - request?: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - 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['listMetadataImports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMetadataImports.createStream( - this.innerApiCalls.listMetadataImports as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMetadataImports`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.metastore.v1.MetadataImport|MetadataImport}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.list_metadata_imports.js - * region_tag:metastore_v1_generated_DataprocMetastore_ListMetadataImports_async - */ - listMetadataImportsAsync( - request?: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - 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['listMetadataImports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMetadataImports.asyncIterate( - this.innerApiCalls['listMetadataImports'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists backups in a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1.Backup|Backup}. - * 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 `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBackups( - request?: protos.google.cloud.metastore.v1.IListBackupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1.IBackup[], - protos.google.cloud.metastore.v1.IListBackupsRequest|null, - protos.google.cloud.metastore.v1.IListBackupsResponse - ]>; - listBackups( - request: protos.google.cloud.metastore.v1.IListBackupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1.IListBackupsRequest, - protos.google.cloud.metastore.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1.IBackup>): void; - listBackups( - request: protos.google.cloud.metastore.v1.IListBackupsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1.IListBackupsRequest, - protos.google.cloud.metastore.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1.IBackup>): void; - listBackups( - request?: protos.google.cloud.metastore.v1.IListBackupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1.IListBackupsRequest, - protos.google.cloud.metastore.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1.IBackup>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1.IListBackupsRequest, - protos.google.cloud.metastore.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1.IBackup>): - Promise<[ - protos.google.cloud.metastore.v1.IBackup[], - protos.google.cloud.metastore.v1.IListBackupsRequest|null, - protos.google.cloud.metastore.v1.IListBackupsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listBackups(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 protos.google.cloud.metastore.v1.Backup|Backup} 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 `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBackupsStream( - request?: protos.google.cloud.metastore.v1.IListBackupsRequest, - 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['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.createStream( - this.innerApiCalls.listBackups as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBackups`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.metastore.v1.Backup|Backup}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.list_backups.js - * region_tag:metastore_v1_generated_DataprocMetastore_ListBackups_async - */ - listBackupsAsync( - request?: protos.google.cloud.metastore.v1.IListBackupsRequest, - 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['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.asyncIterate( - this.innerApiCalls['listBackups'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project:string,location:string,service:string,backup:string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - location: location, - service: service, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the location from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).location; - } - - /** - * Parse the service from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the service. - */ - matchServiceFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).service; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified federation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} federation - * @returns {string} Resource name string. - */ - federationPath(project:string,location:string,federation:string) { - return this.pathTemplates.federationPathTemplate.render({ - project: project, - location: location, - federation: federation, - }); - } - - /** - * Parse the project from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).project; - } - - /** - * Parse the location from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).location; - } - - /** - * Parse the federation from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the federation. - */ - matchFederationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).federation; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified metadataImport resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} metadata_import - * @returns {string} Resource name string. - */ - metadataImportPath(project:string,location:string,service:string,metadataImport:string) { - return this.pathTemplates.metadataImportPathTemplate.render({ - project: project, - location: location, - service: service, - metadata_import: metadataImport, - }); - } - - /** - * Parse the project from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; - } - - /** - * Parse the location from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; - } - - /** - * Parse the service from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the service. - */ - matchServiceFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; - } - - /** - * Parse the metadata_import from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the metadata_import. - */ - matchMetadataImportFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; - } - - /** - * Return a fully-qualified network resource name string. - * - * @param {string} project - * @param {string} network - * @returns {string} Resource name string. - */ - networkPath(project:string,network:string) { - return this.pathTemplates.networkPathTemplate.render({ - project: project, - network: network, - }); - } - - /** - * Parse the project from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).project; - } - - /** - * Parse the network from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the network. - */ - matchNetworkFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).network; - } - - /** - * 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 service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - service: service, - }); - } - - /** - * Parse the project from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).project; - } - - /** - * Parse the location from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).location; - } - - /** - * Parse the service from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).service; - } - - /** - * 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.dataprocMetastoreStub && !this._terminated) { - return this.dataprocMetastoreStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client_config.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client_config.json deleted file mode 100644 index 14466cef361..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client_config.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "interfaces": { - "google.cloud.metastore.v1.DataprocMetastore": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListServices": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetService": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListMetadataImports": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ExportMetadata": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RestoreService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBackups": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetBackup": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "QueryMetadata": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "MoveTableToDatabase": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "AlterMetadataResourceLocation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client.ts b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client.ts deleted file mode 100644 index 7efef4213fa..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client.ts +++ /dev/null @@ -1,1714 +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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/dataproc_metastore_federation_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './dataproc_metastore_federation_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Configures and manages metastore federation services. - * Dataproc Metastore Federation Service allows federating a collection of - * backend metastores like BigQuery, Dataplex Lakes, and other Dataproc - * Metastores. The Federation Service exposes a gRPC URL through which metadata - * from the backend metastores are served at query time. - * - * The Dataproc Metastore Federation API defines the following resource model: - * * The service works with a collection of Google Cloud projects. - * * Each project has a collection of available locations. - * * Each location has a collection of federations. - * * Dataproc Metastore Federations are resources with names of the - * form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - * @class - * @memberof v1 - */ -export class DataprocMetastoreFederationClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - dataprocMetastoreFederationStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DataprocMetastoreFederationClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 DataprocMetastoreFederationClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DataprocMetastoreFederationClient; - 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; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - 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 = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' - ), - federationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/federations/{federation}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - metadataImportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ), - }; - - // 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 = { - listFederations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'federations') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createFederationResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.Federation') as gax.protobuf.Type; - const createFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const updateFederationResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.Federation') as gax.protobuf.Type; - const updateFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const deleteFederationResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createFederationResponse.decode.bind(createFederationResponse), - createFederationMetadata.decode.bind(createFederationMetadata)), - updateFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateFederationResponse.decode.bind(updateFederationResponse), - updateFederationMetadata.decode.bind(updateFederationMetadata)), - deleteFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteFederationResponse.decode.bind(deleteFederationResponse), - deleteFederationMetadata.decode.bind(deleteFederationMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.metastore.v1.DataprocMetastoreFederation', 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.dataprocMetastoreFederationStub) { - return this.dataprocMetastoreFederationStub; - } - - // Put together the "service stub" for - // google.cloud.metastore.v1.DataprocMetastoreFederation. - this.dataprocMetastoreFederationStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1.DataprocMetastoreFederation') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.metastore.v1.DataprocMetastoreFederation, - 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 dataprocMetastoreFederationStubMethods = - ['listFederations', 'getFederation', 'createFederation', 'updateFederation', 'deleteFederation']; - for (const methodName of dataprocMetastoreFederationStubMethods) { - const callPromise = this.dataprocMetastoreFederationStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.dataprocMetastoreFederationStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'metastore.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 'metastore.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 -- - // ------------------- -/** - * Gets the details of a single federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore federation to - * retrieve, in the following form: - * - * `projects/{project_number}/locations/{location_id}/federations/{federation_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 protos.google.cloud.metastore.v1.Federation|Federation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore_federation.get_federation.js - * region_tag:metastore_v1_generated_DataprocMetastoreFederation_GetFederation_async - */ - getFederation( - request?: protos.google.cloud.metastore.v1.IGetFederationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1.IFederation, - protos.google.cloud.metastore.v1.IGetFederationRequest|undefined, {}|undefined - ]>; - getFederation( - request: protos.google.cloud.metastore.v1.IGetFederationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1.IFederation, - protos.google.cloud.metastore.v1.IGetFederationRequest|null|undefined, - {}|null|undefined>): void; - getFederation( - request: protos.google.cloud.metastore.v1.IGetFederationRequest, - callback: Callback< - protos.google.cloud.metastore.v1.IFederation, - protos.google.cloud.metastore.v1.IGetFederationRequest|null|undefined, - {}|null|undefined>): void; - getFederation( - request?: protos.google.cloud.metastore.v1.IGetFederationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1.IFederation, - protos.google.cloud.metastore.v1.IGetFederationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1.IFederation, - protos.google.cloud.metastore.v1.IGetFederationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1.IFederation, - protos.google.cloud.metastore.v1.IGetFederationRequest|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.getFederation(request, options, callback); - } - -/** - * Creates a metastore federation in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location in which to create a - * federation service, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {string} request.federationId - * Required. The ID of the metastore federation, which is used as the final - * component of the metastore federation's name. - * - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - * @param {google.cloud.metastore.v1.Federation} request.federation - * Required. The Metastore Federation to create. The `name` field is - * ignored. The ID of the created metastore federation must be - * provided in the request's `federation_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore_federation.create_federation.js - * region_tag:metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_async - */ - createFederation( - request?: protos.google.cloud.metastore.v1.ICreateFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createFederation( - request: protos.google.cloud.metastore.v1.ICreateFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFederation( - request: protos.google.cloud.metastore.v1.ICreateFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFederation( - request?: protos.google.cloud.metastore.v1.ICreateFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore_federation.create_federation.js - * region_tag:metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_async - */ - async checkCreateFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the fields of a federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metastore federation resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1.Federation} request.federation - * Required. The metastore federation to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * - * The metastore federation's `name` field is used to identify the - * metastore service to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore_federation.update_federation.js - * region_tag:metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_async - */ - updateFederation( - request?: protos.google.cloud.metastore.v1.IUpdateFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateFederation( - request: protos.google.cloud.metastore.v1.IUpdateFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFederation( - request: protos.google.cloud.metastore.v1.IUpdateFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFederation( - request?: protos.google.cloud.metastore.v1.IUpdateFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'federation.name': request.federation!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore_federation.update_federation.js - * region_tag:metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_async - */ - async checkUpdateFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore federation to delete, - * in the following form: - * - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore_federation.delete_federation.js - * region_tag:metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_async - */ - deleteFederation( - request?: protos.google.cloud.metastore.v1.IDeleteFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteFederation( - request: protos.google.cloud.metastore.v1.IDeleteFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFederation( - request: protos.google.cloud.metastore.v1.IDeleteFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFederation( - request?: protos.google.cloud.metastore.v1.IDeleteFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore_federation.delete_federation.js - * region_tag:metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_async - */ - async checkDeleteFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists federations in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore - * federations to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1.Federation|Federation}. - * 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 `listFederationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFederations( - request?: protos.google.cloud.metastore.v1.IListFederationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1.IFederation[], - protos.google.cloud.metastore.v1.IListFederationsRequest|null, - protos.google.cloud.metastore.v1.IListFederationsResponse - ]>; - listFederations( - request: protos.google.cloud.metastore.v1.IListFederationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1.IListFederationsRequest, - protos.google.cloud.metastore.v1.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1.IFederation>): void; - listFederations( - request: protos.google.cloud.metastore.v1.IListFederationsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1.IListFederationsRequest, - protos.google.cloud.metastore.v1.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1.IFederation>): void; - listFederations( - request?: protos.google.cloud.metastore.v1.IListFederationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1.IListFederationsRequest, - protos.google.cloud.metastore.v1.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1.IFederation>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1.IListFederationsRequest, - protos.google.cloud.metastore.v1.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1.IFederation>): - Promise<[ - protos.google.cloud.metastore.v1.IFederation[], - protos.google.cloud.metastore.v1.IListFederationsRequest|null, - protos.google.cloud.metastore.v1.IListFederationsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listFederations(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore - * federations to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 protos.google.cloud.metastore.v1.Federation|Federation} 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 `listFederationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFederationsStream( - request?: protos.google.cloud.metastore.v1.IListFederationsRequest, - 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['listFederations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFederations.createStream( - this.innerApiCalls.listFederations as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFederations`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore - * federations to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.metastore.v1.Federation|Federation}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore_federation.list_federations.js - * region_tag:metastore_v1_generated_DataprocMetastoreFederation_ListFederations_async - */ - listFederationsAsync( - request?: protos.google.cloud.metastore.v1.IListFederationsRequest, - 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['listFederations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFederations.asyncIterate( - this.innerApiCalls['listFederations'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project:string,location:string,service:string,backup:string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - location: location, - service: service, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the location from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).location; - } - - /** - * Parse the service from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the service. - */ - matchServiceFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).service; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified federation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} federation - * @returns {string} Resource name string. - */ - federationPath(project:string,location:string,federation:string) { - return this.pathTemplates.federationPathTemplate.render({ - project: project, - location: location, - federation: federation, - }); - } - - /** - * Parse the project from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).project; - } - - /** - * Parse the location from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).location; - } - - /** - * Parse the federation from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the federation. - */ - matchFederationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).federation; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified metadataImport resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} metadata_import - * @returns {string} Resource name string. - */ - metadataImportPath(project:string,location:string,service:string,metadataImport:string) { - return this.pathTemplates.metadataImportPathTemplate.render({ - project: project, - location: location, - service: service, - metadata_import: metadataImport, - }); - } - - /** - * Parse the project from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; - } - - /** - * Parse the location from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; - } - - /** - * Parse the service from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the service. - */ - matchServiceFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; - } - - /** - * Parse the metadata_import from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the metadata_import. - */ - matchMetadataImportFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; - } - - /** - * 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 service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - service: service, - }); - } - - /** - * Parse the project from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).project; - } - - /** - * Parse the location from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).location; - } - - /** - * Parse the service from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).service; - } - - /** - * 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.dataprocMetastoreFederationStub && !this._terminated) { - return this.dataprocMetastoreFederationStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client_config.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client_config.json deleted file mode 100644 index 71c66a13e4c..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.metastore.v1.DataprocMetastoreFederation": { - "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": { - "ListFederations": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_proto_list.json deleted file mode 100644 index 76860a15e6b..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/metastore/v1/metastore.proto", - "../../protos/google/cloud/metastore/v1/metastore_federation.proto" -] diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_proto_list.json deleted file mode 100644 index 76860a15e6b..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/metastore/v1/metastore.proto", - "../../protos/google/cloud/metastore/v1/metastore_federation.proto" -] diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 78edaccc411..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,283 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.metastore.v1", - "libraryPackage": "@google-cloud/dataproc-metastore", - "services": { - "DataprocMetastore": { - "clients": { - "grpc": { - "libraryClient": "DataprocMetastoreClient", - "rpcs": { - "GetService": { - "methods": [ - "getService" - ] - }, - "GetMetadataImport": { - "methods": [ - "getMetadataImport" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "CreateService": { - "methods": [ - "createService" - ] - }, - "UpdateService": { - "methods": [ - "updateService" - ] - }, - "DeleteService": { - "methods": [ - "deleteService" - ] - }, - "CreateMetadataImport": { - "methods": [ - "createMetadataImport" - ] - }, - "UpdateMetadataImport": { - "methods": [ - "updateMetadataImport" - ] - }, - "ExportMetadata": { - "methods": [ - "exportMetadata" - ] - }, - "RestoreService": { - "methods": [ - "restoreService" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "QueryMetadata": { - "methods": [ - "queryMetadata" - ] - }, - "MoveTableToDatabase": { - "methods": [ - "moveTableToDatabase" - ] - }, - "AlterMetadataResourceLocation": { - "methods": [ - "alterMetadataResourceLocation" - ] - }, - "ListServices": { - "methods": [ - "listServices", - "listServicesStream", - "listServicesAsync" - ] - }, - "ListMetadataImports": { - "methods": [ - "listMetadataImports", - "listMetadataImportsStream", - "listMetadataImportsAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "DataprocMetastoreClient", - "rpcs": { - "GetService": { - "methods": [ - "getService" - ] - }, - "GetMetadataImport": { - "methods": [ - "getMetadataImport" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "CreateService": { - "methods": [ - "createService" - ] - }, - "UpdateService": { - "methods": [ - "updateService" - ] - }, - "DeleteService": { - "methods": [ - "deleteService" - ] - }, - "CreateMetadataImport": { - "methods": [ - "createMetadataImport" - ] - }, - "UpdateMetadataImport": { - "methods": [ - "updateMetadataImport" - ] - }, - "ExportMetadata": { - "methods": [ - "exportMetadata" - ] - }, - "RestoreService": { - "methods": [ - "restoreService" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "QueryMetadata": { - "methods": [ - "queryMetadata" - ] - }, - "MoveTableToDatabase": { - "methods": [ - "moveTableToDatabase" - ] - }, - "AlterMetadataResourceLocation": { - "methods": [ - "alterMetadataResourceLocation" - ] - }, - "ListServices": { - "methods": [ - "listServices", - "listServicesStream", - "listServicesAsync" - ] - }, - "ListMetadataImports": { - "methods": [ - "listMetadataImports", - "listMetadataImportsStream", - "listMetadataImportsAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - } - } - }, - "DataprocMetastoreFederation": { - "clients": { - "grpc": { - "libraryClient": "DataprocMetastoreFederationClient", - "rpcs": { - "GetFederation": { - "methods": [ - "getFederation" - ] - }, - "CreateFederation": { - "methods": [ - "createFederation" - ] - }, - "UpdateFederation": { - "methods": [ - "updateFederation" - ] - }, - "DeleteFederation": { - "methods": [ - "deleteFederation" - ] - }, - "ListFederations": { - "methods": [ - "listFederations", - "listFederationsStream", - "listFederationsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "DataprocMetastoreFederationClient", - "rpcs": { - "GetFederation": { - "methods": [ - "getFederation" - ] - }, - "CreateFederation": { - "methods": [ - "createFederation" - ] - }, - "UpdateFederation": { - "methods": [ - "updateFederation" - ] - }, - "DeleteFederation": { - "methods": [ - "deleteFederation" - ] - }, - "ListFederations": { - "methods": [ - "listFederations", - "listFederationsStream", - "listFederationsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-metastore/v1/src/v1/index.ts deleted file mode 100644 index 74baf047ec9..00000000000 --- a/owl-bot-staging/google-cloud-metastore/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 {DataprocMetastoreClient} from './dataproc_metastore_client'; -export {DataprocMetastoreFederationClient} from './dataproc_metastore_federation_client'; diff --git a/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 2d137ce8c89..00000000000 --- a/owl-bot-staging/google-cloud-metastore/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 metastore = require('@google-cloud/dataproc-metastore'); - -function main() { - const dataprocMetastoreClient = new metastore.DataprocMetastoreClient(); - const dataprocMetastoreFederationClient = new metastore.DataprocMetastoreFederationClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 15fe58ac669..00000000000 --- a/owl-bot-staging/google-cloud-metastore/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 {DataprocMetastoreClient, DataprocMetastoreFederationClient} from '@google-cloud/dataproc-metastore'; - -// check that the client class type name can be used -function doStuffWithDataprocMetastoreClient(client: DataprocMetastoreClient) { - client.close(); -} -function doStuffWithDataprocMetastoreFederationClient(client: DataprocMetastoreFederationClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const dataprocMetastoreClient = new DataprocMetastoreClient(); - doStuffWithDataprocMetastoreClient(dataprocMetastoreClient); - // check that the client instance can be created - const dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); - doStuffWithDataprocMetastoreFederationClient(dataprocMetastoreFederationClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1/system-test/install.ts b/owl-bot-staging/google-cloud-metastore/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-metastore/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-metastore/v1/test/gapic_dataproc_metastore_federation_v1.ts b/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_federation_v1.ts deleted file mode 100644 index 69f92c3064e..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_federation_v1.ts +++ /dev/null @@ -1,2000 +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 dataprocmetastorefederationModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.DataprocMetastoreFederationClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); - await client.initialize(); - assert(client.dataprocMetastoreFederationStub); - }); - - it('has close method for the initialized client', done => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.dataprocMetastoreFederationStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - 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 dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - 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('getFederation', () => { - it('invokes getFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1.Federation() - ); - client.innerApiCalls.getFederation = stubSimpleCall(expectedResponse); - const [response] = await client.getFederation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1.Federation() - ); - client.innerApiCalls.getFederation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFederation( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1.IFederation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFederation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation with closed client', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFederation(request), expectedError); - }); - }); - - describe('createFederation', () => { - it('invokes createFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateFederation', () => { - it('invokes updateFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteFederation', () => { - it('invokes deleteFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listFederations', () => { - it('invokes listFederations without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - ]; - client.innerApiCalls.listFederations = stubSimpleCall(expectedResponse); - const [response] = await client.listFederations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederations without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - ]; - client.innerApiCalls.listFederations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFederations( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1.IFederation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederations with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFederations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFederations(request), expectedError); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederationsStream without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - ]; - client.descriptors.page.listFederations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFederationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1.Federation[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1.Federation) => { - 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.listFederations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); - assert( - (client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFederationsStream with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFederations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFederationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1.Federation[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1.Federation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); - assert( - (client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFederations without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - ]; - client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1.IFederation[] = []; - const iterable = client.listFederationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFederations with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFederationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1.IFederation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('backup', () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - backup: "backupValue", - }; - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackupName', () => { - const result = client.matchLocationFromBackupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromBackupName', () => { - const result = client.matchServiceFromBackupName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('federation', () => { - const fakePath = "/rendered/path/federation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - federation: "federationValue", - }; - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.federationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.federationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('federationPath', () => { - const result = client.federationPath("projectValue", "locationValue", "federationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.federationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFederationName', () => { - const result = client.matchProjectFromFederationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFederationName', () => { - const result = client.matchLocationFromFederationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFederationFromFederationName', () => { - const result = client.matchFederationFromFederationName(fakePath); - assert.strictEqual(result, "federationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('metadataImport', () => { - const fakePath = "/rendered/path/metadataImport"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - metadata_import: "metadataImportValue", - }; - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.metadataImportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.metadataImportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('metadataImportPath', () => { - const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMetadataImportName', () => { - const result = client.matchProjectFromMetadataImportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMetadataImportName', () => { - const result = client.matchLocationFromMetadataImportName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromMetadataImportName', () => { - const result = client.matchServiceFromMetadataImportName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetadataImportFromMetadataImportName', () => { - const result = client.matchMetadataImportFromMetadataImportName(fakePath); - assert.strictEqual(result, "metadataImportValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - 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('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - }; - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePath', () => { - const result = client.servicePath("projectValue", "locationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceName', () => { - const result = client.matchProjectFromServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServiceName', () => { - const result = client.matchLocationFromServiceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_v1.ts b/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_v1.ts deleted file mode 100644 index bd1f6637432..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_v1.ts +++ /dev/null @@ -1,4134 +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 dataprocmetastoreModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.DataprocMetastoreClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = dataprocmetastoreModule.v1.DataprocMetastoreClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = dataprocmetastoreModule.v1.DataprocMetastoreClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = dataprocmetastoreModule.v1.DataprocMetastoreClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreStub, undefined); - await client.initialize(); - assert(client.dataprocMetastoreStub); - }); - - it('has close method for the initialized client', done => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.dataprocMetastoreStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - 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 dataprocmetastoreModule.v1.DataprocMetastoreClient({ - 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('getService', () => { - it('invokes getService without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1.Service() - ); - client.innerApiCalls.getService = stubSimpleCall(expectedResponse); - const [response] = await client.getService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1.Service() - ); - client.innerApiCalls.getService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getService( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1.IService|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getService(request), expectedError); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with closed client', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getService(request), expectedError); - }); - }); - - describe('getMetadataImport', () => { - it('invokes getMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1.MetadataImport() - ); - client.innerApiCalls.getMetadataImport = stubSimpleCall(expectedResponse); - const [response] = await client.getMetadataImport(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1.MetadataImport() - ); - client.innerApiCalls.getMetadataImport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMetadataImport( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1.IMetadataImport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMetadataImport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport with closed client', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getMetadataImport(request), expectedError); - }); - }); - - describe('getBackup', () => { - it('invokes getBackup without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); - const [response] = await client.getBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackup( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1.IBackup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with closed client', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBackup(request), expectedError); - }); - }); - - describe('createService', () => { - it('invokes createService without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createService = stubLongRunningCall(expectedResponse); - const [operation] = await client.createService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createService(request), expectedError); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateService', () => { - it('invokes updateService without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateService = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateService(request), expectedError); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteService', () => { - it('invokes deleteService without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteService = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteService(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createMetadataImport', () => { - it('invokes createMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMetadataImport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMetadataImport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMetadataImport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMetadataImport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateMetadataImportProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateMetadataImportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateMetadataImportProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMetadataImportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateMetadataImport', () => { - it('invokes updateMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMetadataImport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMetadataImport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMetadataImport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMetadataImport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateMetadataImportProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateMetadataImportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateMetadataImportProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMetadataImportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('exportMetadata', () => { - it('invokes exportMetadata without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportMetadata = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportMetadata(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportMetadata = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportMetadata( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportMetadata(request), expectedError); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportMetadata(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportMetadataProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportMetadataProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportMetadataProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportMetadataProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('restoreService', () => { - it('invokes restoreService without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.restoreService = stubLongRunningCall(expectedResponse); - const [operation] = await client.restoreService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.restoreService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.restoreService(request), expectedError); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.restoreService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRestoreServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRestoreServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRestoreServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRestoreServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createBackup', () => { - it('invokes createBackup without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBackup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateBackupProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateBackupProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteBackup', () => { - it('invokes deleteBackup without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteBackup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteBackupProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteBackupProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('queryMetadata', () => { - it('invokes queryMetadata without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.QueryMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.QueryMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.queryMetadata = stubLongRunningCall(expectedResponse); - const [operation] = await client.queryMetadata(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes queryMetadata without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.QueryMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.QueryMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.queryMetadata = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.queryMetadata( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes queryMetadata with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.QueryMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.QueryMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.queryMetadata = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.queryMetadata(request), expectedError); - const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes queryMetadata with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.QueryMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.QueryMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.queryMetadata = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.queryMetadata(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkQueryMetadataProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkQueryMetadataProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkQueryMetadataProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkQueryMetadataProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('moveTableToDatabase', () => { - it('invokes moveTableToDatabase without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.MoveTableToDatabaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.MoveTableToDatabaseRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(expectedResponse); - const [operation] = await client.moveTableToDatabase(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes moveTableToDatabase without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.MoveTableToDatabaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.MoveTableToDatabaseRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.moveTableToDatabase = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.moveTableToDatabase( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes moveTableToDatabase with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.MoveTableToDatabaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.MoveTableToDatabaseRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.moveTableToDatabase(request), expectedError); - const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes moveTableToDatabase with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.MoveTableToDatabaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.MoveTableToDatabaseRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.moveTableToDatabase(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkMoveTableToDatabaseProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkMoveTableToDatabaseProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkMoveTableToDatabaseProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkMoveTableToDatabaseProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('alterMetadataResourceLocation', () => { - it('invokes alterMetadataResourceLocation without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.AlterMetadataResourceLocationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.AlterMetadataResourceLocationRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(expectedResponse); - const [operation] = await client.alterMetadataResourceLocation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes alterMetadataResourceLocation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.AlterMetadataResourceLocationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.AlterMetadataResourceLocationRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.alterMetadataResourceLocation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes alterMetadataResourceLocation with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.AlterMetadataResourceLocationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.AlterMetadataResourceLocationRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.alterMetadataResourceLocation(request), expectedError); - const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes alterMetadataResourceLocation with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.AlterMetadataResourceLocationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.AlterMetadataResourceLocationRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.alterMetadataResourceLocation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAlterMetadataResourceLocationProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAlterMetadataResourceLocationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAlterMetadataResourceLocationProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAlterMetadataResourceLocationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listServices', () => { - it('invokes listServices without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); - const [response] = await client.listServices(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServices( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1.IService[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServices = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServices(request), expectedError); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServicesStream without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - ]; - client.descriptors.page.listServices.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1.Service[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listServicesStream with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1.Service[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServices without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - ]; - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1.IService[] = []; - const iterable = client.listServicesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServices with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServicesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1.IService[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listMetadataImports', () => { - it('invokes listMetadataImports without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - ]; - client.innerApiCalls.listMetadataImports = stubSimpleCall(expectedResponse); - const [response] = await client.listMetadataImports(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImports without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - ]; - client.innerApiCalls.listMetadataImports = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMetadataImports( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1.IMetadataImport[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImports with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMetadataImports = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMetadataImports(request), expectedError); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImportsStream without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - ]; - client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMetadataImportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1.MetadataImport[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1.MetadataImport) => { - 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.listMetadataImports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); - assert( - (client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listMetadataImportsStream with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMetadataImportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1.MetadataImport[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1.MetadataImport) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); - assert( - (client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMetadataImports without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - ]; - client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1.IMetadataImport[] = []; - const iterable = client.listMetadataImportsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMetadataImports with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMetadataImportsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1.IMetadataImport[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listBackups', () => { - it('invokes listBackups without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); - const [response] = await client.listBackups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackups( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1.IBackup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBackups(request), expectedError); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackupsStream without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - ]; - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1.Backup[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1.Backup) => { - 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.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBackupsStream with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1.Backup[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackups without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - ]; - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1.IBackup[] = []; - const iterable = client.listBackupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackups with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBackupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1.IBackup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('backup', () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - backup: "backupValue", - }; - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackupName', () => { - const result = client.matchLocationFromBackupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromBackupName', () => { - const result = client.matchServiceFromBackupName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('federation', () => { - const fakePath = "/rendered/path/federation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - federation: "federationValue", - }; - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.federationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.federationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('federationPath', () => { - const result = client.federationPath("projectValue", "locationValue", "federationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.federationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFederationName', () => { - const result = client.matchProjectFromFederationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFederationName', () => { - const result = client.matchLocationFromFederationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFederationFromFederationName', () => { - const result = client.matchFederationFromFederationName(fakePath); - assert.strictEqual(result, "federationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('metadataImport', () => { - const fakePath = "/rendered/path/metadataImport"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - metadata_import: "metadataImportValue", - }; - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.metadataImportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.metadataImportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('metadataImportPath', () => { - const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMetadataImportName', () => { - const result = client.matchProjectFromMetadataImportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMetadataImportName', () => { - const result = client.matchLocationFromMetadataImportName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromMetadataImportName', () => { - const result = client.matchServiceFromMetadataImportName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetadataImportFromMetadataImportName', () => { - const result = client.matchMetadataImportFromMetadataImportName(fakePath); - assert.strictEqual(result, "metadataImportValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('network', () => { - const fakePath = "/rendered/path/network"; - const expectedParameters = { - project: "projectValue", - network: "networkValue", - }; - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.networkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath("projectValue", "networkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkFromNetworkName', () => { - const result = client.matchNetworkFromNetworkName(fakePath); - assert.strictEqual(result, "networkValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - 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('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - }; - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePath', () => { - const result = client.servicePath("projectValue", "locationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceName', () => { - const result = client.matchProjectFromServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServiceName', () => { - const result = client.matchLocationFromServiceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-metastore/v1/tsconfig.json b/owl-bot-staging/google-cloud-metastore/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-metastore/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-metastore/v1/webpack.config.js b/owl-bot-staging/google-cloud-metastore/v1/webpack.config.js deleted file mode 100644 index 6fc45cb3d30..00000000000 --- a/owl-bot-staging/google-cloud-metastore/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: 'DataprocMetastore', - filename: './dataproc-metastore.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-metastore/v1alpha/.eslintignore b/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/.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-metastore/v1alpha/.eslintrc.json b/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/.gitignore b/owl-bot-staging/google-cloud-metastore/v1alpha/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/.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-metastore/v1alpha/.jsdoc.js b/owl-bot-staging/google-cloud-metastore/v1alpha/.jsdoc.js deleted file mode 100644 index 77430ad8c15..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/.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/dataproc-metastore', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/.mocharc.js b/owl-bot-staging/google-cloud-metastore/v1alpha/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/.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-metastore/v1alpha/.prettierrc.js b/owl-bot-staging/google-cloud-metastore/v1alpha/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/.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-metastore/v1alpha/README.md b/owl-bot-staging/google-cloud-metastore/v1alpha/README.md deleted file mode 100644 index 24afb9017c6..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/README.md +++ /dev/null @@ -1 +0,0 @@ -Metastore: Nodejs Client diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/package.json b/owl-bot-staging/google-cloud-metastore/v1alpha/package.json deleted file mode 100644 index e14926927ea..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "@google-cloud/dataproc-metastore", - "version": "0.1.0", - "description": "Metastore client for Node.js", - "repository": "googleapis/nodejs-metastore", - "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 metastore", - "metastore", - "dataproc metastore", - "dataproc metastore federation" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore.proto b/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore.proto deleted file mode 100644 index e23b043c703..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore.proto +++ /dev/null @@ -1,1681 +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 -// -// 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.metastore.v1alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; -import "google/type/dayofweek.proto"; - -option go_package = "cloud.google.com/go/metastore/apiv1alpha/metastorepb;metastorepb"; -option java_multiple_files = true; -option java_outer_classname = "MetastoreProto"; -option java_package = "com.google.cloud.metastore.v1alpha"; -option php_namespace = "Google\\Cloud\\Metastore\\V1alpha"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Network" - pattern: "projects/{project}/global/networks/{network}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Subnetwork" - pattern: "projects/{project}/regions/{region}/subnetworks/{subnetwork}" -}; -option (google.api.resource_definition) = { - type: "dataplex.googleapis.com/Lake" - pattern: "projects/{project}/locations/{location}/lakes/{lake}" -}; - -// Configures and manages metastore services. -// Metastore services are fully managed, highly available, autoscaled, -// autohealing, OSS-native deployments of technical metadata management -// software. Each metastore service exposes a network endpoint through which -// metadata queries are served. Metadata queries can originate from a variety -// of sources, including Apache Hive, Apache Presto, and Apache Spark. -// -// The Dataproc Metastore API defines the following resource model: -// -// * The service works with a collection of Google Cloud projects, named: -// `/projects/*` -// * Each project has a collection of available locations, named: `/locations/*` -// (a location must refer to a Google Cloud `region`) -// * Each location has a collection of services, named: `/services/*` -// * Dataproc Metastore services are resources with names of the form: -// -// `/projects/{project_number}/locations/{location_id}/services/{service_id}`. -service DataprocMetastore { - option (google.api.default_host) = "metastore.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists services in a project and location. - rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*/locations/*}/services" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a single service. - rpc GetService(GetServiceRequest) returns (Service) { - option (google.api.http) = { - get: "/v1alpha/{name=projects/*/locations/*/services/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a metastore service in a project and location. - rpc CreateService(CreateServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha/{parent=projects/*/locations/*}/services" - body: "service" - }; - option (google.api.method_signature) = "parent,service,service_id"; - option (google.longrunning.operation_info) = { - response_type: "Service" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Updates the parameters of a single service. - rpc UpdateService(UpdateServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1alpha/{service.name=projects/*/locations/*/services/*}" - body: "service" - }; - option (google.api.method_signature) = "service,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Service" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Deletes a single service. - rpc DeleteService(DeleteServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1alpha/{name=projects/*/locations/*/services/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Lists imports in a service. - rpc ListMetadataImports(ListMetadataImportsRequest) - returns (ListMetadataImportsResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*/locations/*/services/*}/metadataImports" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single import. - rpc GetMetadataImport(GetMetadataImportRequest) returns (MetadataImport) { - option (google.api.http) = { - get: "/v1alpha/{name=projects/*/locations/*/services/*/metadataImports/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new MetadataImport in a given project and location. - rpc CreateMetadataImport(CreateMetadataImportRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha/{parent=projects/*/locations/*/services/*}/metadataImports" - body: "metadata_import" - }; - option (google.api.method_signature) = - "parent,metadata_import,metadata_import_id"; - option (google.longrunning.operation_info) = { - response_type: "MetadataImport" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Updates a single import. - // Only the description field of MetadataImport is supported to be updated. - rpc UpdateMetadataImport(UpdateMetadataImportRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1alpha/{metadata_import.name=projects/*/locations/*/services/*/metadataImports/*}" - body: "metadata_import" - }; - option (google.api.method_signature) = "metadata_import,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "MetadataImport" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Exports metadata from a service. - rpc ExportMetadata(ExportMetadataRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha/{service=projects/*/locations/*/services/*}:exportMetadata" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "MetadataExport" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Restores a service from a backup. - rpc RestoreService(RestoreServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha/{service=projects/*/locations/*/services/*}:restore" - body: "*" - }; - option (google.api.method_signature) = "service,backup"; - option (google.longrunning.operation_info) = { - response_type: "Restore" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Lists backups in a service. - rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*/locations/*/services/*}/backups" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single backup. - rpc GetBackup(GetBackupRequest) returns (Backup) { - option (google.api.http) = { - get: "/v1alpha/{name=projects/*/locations/*/services/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new backup in a given project and location. - rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha/{parent=projects/*/locations/*/services/*}/backups" - body: "backup" - }; - option (google.api.method_signature) = "parent,backup,backup_id"; - option (google.longrunning.operation_info) = { - response_type: "Backup" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Deletes a single backup. - rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1alpha/{name=projects/*/locations/*/services/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Removes the attached IAM policies for a resource - rpc RemoveIamPolicy(RemoveIamPolicyRequest) - returns (RemoveIamPolicyResponse) { - option (google.api.http) = { - post: "/v1alpha/{resource=projects/*/locations/*/services/*/**}:removeIamPolicy" - body: "*" - }; - } - - // Query DPMS metadata. - rpc QueryMetadata(QueryMetadataRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha/{service=projects/*/locations/*/services/*}:queryMetadata" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "QueryMetadataResponse" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Move a table to another database. - rpc MoveTableToDatabase(MoveTableToDatabaseRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha/{service=projects/*/locations/*/services/*}:moveTableToDatabase" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "MoveTableToDatabaseResponse" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Alter metadata resource location. The metadata resource can be a database, - // table, or partition. This functionality only updates the parent directory - // for the respective metadata resource and does not transfer any existing - // data to the new location. - rpc AlterMetadataResourceLocation(AlterMetadataResourceLocationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha/{service=projects/*/locations/*/services/*}:alterLocation" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "AlterMetadataResourceLocationResponse" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } -} - -// A managed metastore service that serves metadata queries. -message Service { - option (google.api.resource) = { - type: "metastore.googleapis.com/Service" - pattern: "projects/{project}/locations/{location}/services/{service}" - }; - - // The current state of the metastore service. - enum State { - // The state of the metastore service is unknown. - STATE_UNSPECIFIED = 0; - - // The metastore service is in the process of being created. - CREATING = 1; - - // The metastore service is running and ready to serve queries. - ACTIVE = 2; - - // The metastore service is entering suspension. Its query-serving - // availability may cease unexpectedly. - SUSPENDING = 3; - - // The metastore service is suspended and unable to serve queries. - SUSPENDED = 4; - - // The metastore service is being updated. It remains usable but cannot - // accept additional update requests or be deleted at this time. - UPDATING = 5; - - // The metastore service is undergoing deletion. It cannot be used. - DELETING = 6; - - // The metastore service has encountered an error and cannot be used. The - // metastore service should be deleted. - ERROR = 7; - } - - // Available service tiers. - enum Tier { - // The tier is not set. - TIER_UNSPECIFIED = 0; - - // The developer tier provides limited scalability and no fault tolerance. - // Good for low-cost proof-of-concept. - DEVELOPER = 1; - - // The enterprise tier provides multi-zone high availability, and sufficient - // scalability for enterprise-level Dataproc Metastore workloads. - ENTERPRISE = 3; - } - - // Release channels bundle features of varying levels of stability. Newer - // features may be introduced initially into less stable release channels and - // can be automatically promoted into more stable release channels. - enum ReleaseChannel { - // Release channel is not specified. - RELEASE_CHANNEL_UNSPECIFIED = 0; - - // The `CANARY` release channel contains the newest features, which may be - // unstable and subject to unresolved issues with no known workarounds. - // Services using the `CANARY` release channel are not subject to any SLAs. - CANARY = 1; - - // The `STABLE` release channel contains features that are considered stable - // and have been validated for production use. - STABLE = 2; - } - - // The backend database type for the metastore service. - enum DatabaseType { - // The DATABASE_TYPE is not set. - DATABASE_TYPE_UNSPECIFIED = 0; - - // MySQL is used to persist the metastore data. - MYSQL = 1; - - // Spanner is used to persist the metastore data. - SPANNER = 2; - } - - // Configuration properties specific to the underlying metastore service - // technology (the software that serves metastore queries). - oneof metastore_config { - // Configuration information specific to running Hive metastore - // software as the metastore service. - HiveMetastoreConfig hive_metastore_config = 5; - } - - // Immutable. The relative resource name of the metastore service, in the - // following format: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the metastore service was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metastore service was last updated. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-defined labels for the metastore service. - map labels = 4; - - // Immutable. The relative resource name of the VPC network on which the - // instance can be accessed. It is specified in the following form: - // - // `projects/{project_number}/global/networks/{network_id}`. - string network = 7 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; - - // Output only. The URI of the endpoint used to access the metastore service. - string endpoint_uri = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The TCP port at which the metastore service is reached. Default: 9083. - int32 port = 9; - - // Output only. The current state of the metastore service. - State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current state of the - // metastore service, if available. - string state_message = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A Cloud Storage URI (starting with `gs://`) that specifies - // where artifacts related to the metastore service are stored. - string artifact_gcs_uri = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The tier of the service. - Tier tier = 13; - - // The setting that defines how metastore metadata should be integrated with - // external services and systems. - MetadataIntegration metadata_integration = 14; - - // The one hour maintenance window of the metastore service. This specifies - // when the service can be restarted for maintenance purposes in UTC time. - // Maintenance window is not needed for services with the SPANNER - // database type. - MaintenanceWindow maintenance_window = 15; - - // Output only. The globally unique resource identifier of the metastore - // service. - string uid = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The metadata management activities of the metastore service. - MetadataManagementActivity metadata_management_activity = 17 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Immutable. The release channel of the service. - // If unspecified, defaults to `STABLE`. - ReleaseChannel release_channel = 19 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. Information used to configure the Dataproc Metastore service to - // encrypt customer data at rest. Cannot be updated. - EncryptionConfig encryption_config = 20 - [(google.api.field_behavior) = IMMUTABLE]; - - // The configuration specifying the network settings for the - // Dataproc Metastore service. - NetworkConfig network_config = 21; - - // Immutable. The database type that the Metastore service stores its data. - DatabaseType database_type = 22 [(google.api.field_behavior) = IMMUTABLE]; - - // The configuration specifying telemetry settings for the Dataproc Metastore - // service. If unspecified defaults to `JSON`. - TelemetryConfig telemetry_config = 23; - - // Scaling configuration of the metastore service. - ScalingConfig scaling_config = 24; -} - -// Specifies how metastore metadata should be integrated with external services. -message MetadataIntegration { - // The integration config for the Data Catalog service. - DataCatalogConfig data_catalog_config = 1; - - // The integration config for the Dataplex service. - DataplexConfig dataplex_config = 2; -} - -// Specifies how metastore metadata should be integrated with the Data Catalog -// service. -message DataCatalogConfig { - // Defines whether the metastore metadata should be synced to Data Catalog. - // The default value is to disable syncing metastore metadata to Data Catalog. - bool enabled = 2; -} - -// Specifies how metastore metadata should be integrated with the Dataplex -// service. -message DataplexConfig { - // A reference to the Lake resources that this metastore service is attached - // to. The key is the lake resource name. Example: - // `projects/{project_number}/locations/{location_id}/lakes/{lake_id}`. - map lake_resources = 1; -} - -// Represents a Lake resource -message Lake { - // The Lake resource name. - // Example: - // `projects/{project_number}/locations/{location_id}/lakes/{lake_id}` - string name = 1 [ - (google.api.resource_reference) = { type: "dataplex.googleapis.com/Lake" } - ]; -} - -// Maintenance window. This specifies when Dataproc Metastore -// may perform system maintenance operation to the service. -message MaintenanceWindow { - // The hour of day (0-23) when the window starts. - google.protobuf.Int32Value hour_of_day = 1; - - // The day of week, when the window starts. - google.type.DayOfWeek day_of_week = 2; -} - -// Specifies configuration information specific to running Hive metastore -// software as the metastore service. -message HiveMetastoreConfig { - // Protocols available for serving the metastore service endpoint. - enum EndpointProtocol { - // The protocol is not set. - ENDPOINT_PROTOCOL_UNSPECIFIED = 0; - - // Use the legacy Apache Thrift protocol for the metastore service endpoint. - THRIFT = 1; - - // Use the modernized gRPC protocol for the metastore service endpoint. - GRPC = 2; - } - - // Immutable. The Hive metastore schema version. - string version = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // A mapping of Hive metastore configuration key-value pairs to apply to the - // Hive metastore (configured in `hive-site.xml`). The mappings - // override system defaults (some keys cannot be overridden). These - // overrides are also applied to auxiliary versions and can be further - // customized in the auxiliary version's `AuxiliaryVersionConfig`. - map config_overrides = 2; - - // Information used to configure the Hive metastore service as a service - // principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` - // method and specify this field's path - // (`hive_metastore_config.kerberos_config`) in the request's `update_mask` - // while omitting this field from the request's `service`. - KerberosConfig kerberos_config = 3; - - // The protocol to use for the metastore service endpoint. If unspecified, - // defaults to `THRIFT`. - EndpointProtocol endpoint_protocol = 4; - - // A mapping of Hive metastore version to the auxiliary version - // configuration. When specified, a secondary Hive metastore service is - // created along with the primary service. All auxiliary versions must be less - // than the service's primary version. The key is the auxiliary service name - // and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This - // means that the first character must be a lowercase letter, and all the - // following characters must be hyphens, lowercase letters, or digits, except - // the last character, which cannot be a hyphen. - map auxiliary_versions = 5; -} - -// Configuration information for a Kerberos principal. -message KerberosConfig { - // A Kerberos keytab file that can be used to authenticate a service principal - // with a Kerberos Key Distribution Center (KDC). - Secret keytab = 1; - - // A Kerberos principal that exists in the both the keytab the KDC - // to authenticate as. A typical principal is of the form - // `primary/instance@REALM`, but there is no exact format. - string principal = 2; - - // A Cloud Storage URI that specifies the path to a - // krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, - // although the file does not need to be named krb5.conf explicitly. - string krb5_config_gcs_uri = 3; -} - -// A securely stored value. -message Secret { - oneof value { - // The relative resource name of a Secret Manager secret version, in the - // following form: - // - // `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. - string cloud_secret = 2; - } -} - -// Encryption settings for the service. -message EncryptionConfig { - // The fully qualified customer provided Cloud KMS key name to use for - // customer data encryption, in the following form: - // - // `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. - string kms_key = 1; -} - -// Configuration information for the auxiliary service versions. -message AuxiliaryVersionConfig { - // The Hive metastore version of the auxiliary service. It must be less - // than the primary Hive metastore service's version. - string version = 1; - - // A mapping of Hive metastore configuration key-value pairs to apply to the - // auxiliary Hive metastore (configured in `hive-site.xml`) in addition to - // the primary version's overrides. If keys are present in both the auxiliary - // version's overrides and the primary version's overrides, the value from - // the auxiliary version's overrides takes precedence. - map config_overrides = 2; - - // Output only. The network configuration contains the endpoint URI(s) of the - // auxiliary Hive metastore service. - NetworkConfig network_config = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Network configuration for the Dataproc Metastore service. -message NetworkConfig { - // Contains information of the customer's network configurations. - message Consumer { - oneof vpc_resource { - // Immutable. The subnetwork of the customer project from which an IP - // address is reserved and used as the Dataproc Metastore service's - // endpoint. It is accessible to hosts in the subnet and to all - // hosts in a subnet in the same region and same network. There must - // be at least one IP address available in the subnet's primary range. The - // subnet is specified in the following form: - // - // `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` - string subnetwork = 1 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { - type: "compute.googleapis.com/Subnetwork" - } - ]; - } - - // Output only. The URI of the endpoint used to access the metastore - // service. - string endpoint_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Immutable. The consumer-side network configuration for the Dataproc - // Metastore instance. - repeated Consumer consumers = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Enables custom routes to be imported and exported for the Dataproc - // Metastore service's peered VPC network. - bool custom_routes_enabled = 2; -} - -// Telemetry Configuration for the Dataproc Metastore service. -message TelemetryConfig { - enum LogFormat { - // The LOG_FORMAT is not set. - LOG_FORMAT_UNSPECIFIED = 0; - - // Logging output uses the legacy `textPayload` format. - LEGACY = 1; - - // Logging output uses the `jsonPayload` format. - JSON = 2; - } - - // The output format of the Dataproc Metastore service's logs. - LogFormat log_format = 1; -} - -// The metadata management activities of the metastore service. -message MetadataManagementActivity { - // Output only. The latest metadata exports of the metastore service. - repeated MetadataExport metadata_exports = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The latest restores of the metastore service. - repeated Restore restores = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A metastore resource that imports metadata. -message MetadataImport { - option (google.api.resource) = { - type: "metastore.googleapis.com/MetadataImport" - pattern: "projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}" - }; - - // A specification of the location of and metadata about a database dump from - // a relational database management system. - message DatabaseDump { - // The type of the database. - enum DatabaseType { - // The type of the source database is unknown. - DATABASE_TYPE_UNSPECIFIED = 0; - - // The type of the source database is MySQL. - MYSQL = 1; - } - - // The type of the database. - DatabaseType database_type = 1 [deprecated = true]; - - // A Cloud Storage object or folder URI that specifies the source from which - // to import metadata. It must begin with `gs://`. - string gcs_uri = 2; - - // The name of the source database. - string source_database = 3 [deprecated = true]; - - // Optional. The type of the database dump. If unspecified, defaults to - // `MYSQL`. - DatabaseDumpSpec.Type type = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // The current state of the metadata import. - enum State { - // The state of the metadata import is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata import is running. - RUNNING = 1; - - // The metadata import completed successfully. - SUCCEEDED = 2; - - // The metadata import is being updated. - UPDATING = 3; - - // The metadata import failed, and attempted metadata changes were rolled - // back. - FAILED = 4; - } - - // The metadata to be imported. - oneof metadata { - // Immutable. A database dump from a pre-existing metastore's database. - DatabaseDump database_dump = 6 [(google.api.field_behavior) = IMMUTABLE]; - } - - // Immutable. The relative resource name of the metadata import, of the form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // The description of the metadata import. - string description = 2; - - // Output only. The time when the metadata import was started. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metadata import was last updated. - google.protobuf.Timestamp update_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metadata import finished. - google.protobuf.Timestamp end_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the metadata import. - State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a metadata export operation. -message MetadataExport { - // The current state of the metadata export. - enum State { - // The state of the metadata export is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata export is running. - RUNNING = 1; - - // The metadata export completed successfully. - SUCCEEDED = 2; - - // The metadata export failed. - FAILED = 3; - - // The metadata export is cancelled. - CANCELLED = 4; - } - - oneof destination { - // Output only. A Cloud Storage URI of a folder that metadata are exported - // to, in the form of - // `gs:////`, where - // `` is automatically generated. - string destination_gcs_uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. The time when the export started. - google.protobuf.Timestamp start_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the export ended. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the export. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The type of the database dump. - DatabaseDumpSpec.Type database_dump_type = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a backup resource. -message Backup { - option (google.api.resource) = { - type: "metastore.googleapis.com/Backup" - pattern: "projects/{project}/locations/{location}/services/{service}/backups/{backup}" - }; - - // The current state of the backup. - enum State { - // The state of the backup is unknown. - STATE_UNSPECIFIED = 0; - - // The backup is being created. - CREATING = 1; - - // The backup is being deleted. - DELETING = 2; - - // The backup is active and ready to use. - ACTIVE = 3; - - // The backup failed. - FAILED = 4; - - // The backup is being restored. - RESTORING = 5; - } - - // Immutable. The relative resource name of the backup, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the backup was started. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the backup finished creating. - google.protobuf.Timestamp end_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the backup. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The revision of the service at the time of backup. - Service service_revision = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The description of the backup. - string description = 6; - - // Output only. Services that are restoring from the backup. - repeated string restoring_services = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a metadata restore operation. -message Restore { - // The current state of the restore. - enum State { - // The state of the metadata restore is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata restore is running. - RUNNING = 1; - - // The metadata restore completed successfully. - SUCCEEDED = 2; - - // The metadata restore failed. - FAILED = 3; - - // The metadata restore is cancelled. - CANCELLED = 4; - } - - // The type of restore. If unspecified, defaults to `METADATA_ONLY`. - enum RestoreType { - // The restore type is unknown. - RESTORE_TYPE_UNSPECIFIED = 0; - - // The service's metadata and configuration are restored. - FULL = 1; - - // Only the service's metadata is restored. - METADATA_ONLY = 2; - } - - // Output only. The time when the restore started. - google.protobuf.Timestamp start_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the restore ended. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the restore. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The relative resource name of the metastore service backup to - // restore from, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string backup = 4 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Output only. The type of restore. - RestoreType type = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The restore details containing the revision of the service to - // be restored to, in format of JSON. - string details = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents the scaling configuration of a metastore service. -message ScalingConfig { - // Metastore instance sizes. - enum InstanceSize { - // Unspecified instance size - INSTANCE_SIZE_UNSPECIFIED = 0; - - // Extra small instance size, maps to a scaling factor of 0.1. - EXTRA_SMALL = 1; - - // Small instance size, maps to a scaling factor of 0.5. - SMALL = 2; - - // Medium instance size, maps to a scaling factor of 1.0. - MEDIUM = 3; - - // Large instance size, maps to a scaling factor of 3.0. - LARGE = 4; - - // Extra large instance size, maps to a scaling factor of 6.0. - EXTRA_LARGE = 5; - } - - // Represents either a predetermined instance size or a numeric - // scaling factor. - oneof scaling_model { - // An enum of readable instance sizes, with each instance size mapping to a - // float value (e.g. InstanceSize.EXTRA_SMALL = scaling_factor(0.1)) - InstanceSize instance_size = 1; - - // Scaling factor, increments of 0.1 for values less than 1.0, and - // increments of 1.0 for values greater than 1.0. - float scaling_factor = 2; - } -} - -// Request message for -// [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices]. -message ListServicesRequest { - // Required. The relative resource name of the location of metastore services - // to list, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. The maximum number of services to return. The response may - // contain less than the maximum number. If unspecified, no more than 500 - // services are returned. The maximum value is 1000; values above 1000 are - // changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous - // [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] - // must match the call that provided the page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices]. -message ListServicesResponse { - // The services in the specified location. - repeated Service services = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [DataprocMetastore.GetService][google.cloud.metastore.v1alpha.DataprocMetastore.GetService]. -message GetServiceRequest { - // Required. The relative resource name of the metastore service to retrieve, - // in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; -} - -// Request message for -// [DataprocMetastore.CreateService][google.cloud.metastore.v1alpha.DataprocMetastore.CreateService]. -message CreateServiceRequest { - // Required. The relative resource name of the location in which to create a - // metastore service, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The ID of the metastore service, which is used as the final - // component of the metastore service's name. - // - // This value must be between 2 and 63 characters long inclusive, begin with a - // letter, end with a letter or number, and consist of alpha-numeric - // ASCII characters or hyphens. - string service_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Metastore service to create. The `name` field is - // ignored. The ID of the created metastore service must be provided in - // the request's `service_id` field. - Service service = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.UpdateService][google.cloud.metastore.v1alpha.DataprocMetastore.UpdateService]. -message UpdateServiceRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metastore service resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The metastore service to update. The server only merges fields - // in the service if they are specified in `update_mask`. - // - // The metastore service's `name` field is used to identify the metastore - // service to be updated. - Service service = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.DeleteService][google.cloud.metastore.v1alpha.DataprocMetastore.DeleteService]. -message DeleteServiceRequest { - // Required. The relative resource name of the metastore service to delete, in - // the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1alpha.DataprocMetastore.ListMetadataImports]. -message ListMetadataImportsRequest { - // Required. The relative resource name of the service whose metadata imports - // to list, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/MetadataImport" - } - ]; - - // Optional. The maximum number of imports to return. The response may contain - // less than the maximum number. If unspecified, no more than 500 imports are - // returned. The maximum value is 1000; values above 1000 are changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous - // [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] - // must match the call that provided the page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1alpha.DataprocMetastore.ListMetadataImports]. -message ListMetadataImportsResponse { - // The imports in the specified service. - repeated MetadataImport metadata_imports = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [DataprocMetastore.GetMetadataImport][google.cloud.metastore.v1alpha.DataprocMetastore.GetMetadataImport]. -message GetMetadataImportRequest { - // Required. The relative resource name of the metadata import to retrieve, in - // the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/MetadataImport" - } - ]; -} - -// Request message for -// [DataprocMetastore.CreateMetadataImport][google.cloud.metastore.v1alpha.DataprocMetastore.CreateMetadataImport]. -message CreateMetadataImportRequest { - // Required. The relative resource name of the service in which to create a - // metastore import, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/MetadataImport" - } - ]; - - // Required. The ID of the metadata import, which is used as the final - // component of the metadata import's name. - // - // This value must be between 1 and 64 characters long, begin with a letter, - // end with a letter or number, and consist of alpha-numeric ASCII characters - // or hyphens. - string metadata_import_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The metadata import to create. The `name` field is ignored. The - // ID of the created metadata import must be provided in the request's - // `metadata_import_id` field. - MetadataImport metadata_import = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.UpdateMetadataImport][google.cloud.metastore.v1alpha.DataprocMetastore.UpdateMetadataImport]. -message UpdateMetadataImportRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metadata import resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The metadata import to update. The server only merges fields - // in the import if they are specified in `update_mask`. - // - // The metadata import's `name` field is used to identify the metastore - // import to be updated. - MetadataImport metadata_import = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups]. -message ListBackupsRequest { - // Required. The relative resource name of the service whose backups to - // list, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. The maximum number of backups to return. The response may contain - // less than the maximum number. If unspecified, no more than 500 backups are - // returned. The maximum value is 1000; values above 1000 are changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous - // [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups] - // must match the call that provided the page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups]. -message ListBackupsResponse { - // The backups of the specified service. - repeated Backup backups = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [DataprocMetastore.GetBackup][google.cloud.metastore.v1alpha.DataprocMetastore.GetBackup]. -message GetBackupRequest { - // Required. The relative resource name of the backup to retrieve, in the - // following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; -} - -// Request message for -// [DataprocMetastore.CreateBackup][google.cloud.metastore.v1alpha.DataprocMetastore.CreateBackup]. -message CreateBackupRequest { - // Required. The relative resource name of the service in which to create a - // backup of the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Backup" - } - ]; - - // Required. The ID of the backup, which is used as the final component of the - // backup's name. - // - // This value must be between 1 and 64 characters long, begin with a letter, - // end with a letter or number, and consist of alpha-numeric ASCII characters - // or hyphens. - string backup_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The backup to create. The `name` field is ignored. The ID of the - // created backup must be provided in the request's `backup_id` field. - Backup backup = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.DeleteBackup][google.cloud.metastore.v1alpha.DataprocMetastore.DeleteBackup]. -message DeleteBackupRequest { - // Required. The relative resource name of the backup to delete, in the - // following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.ExportMetadata][google.cloud.metastore.v1alpha.DataprocMetastore.ExportMetadata]. -message ExportMetadataRequest { - // Required. Destination that metadata is exported to. - oneof destination { - // A Cloud Storage URI of a folder, in the format - // `gs:///`. A sub-folder - // `` containing exported files will be created below it. - string destination_gcs_folder = 2; - } - - // Required. The relative resource name of the metastore service to run - // export, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The type of the database dump. If unspecified, defaults to - // `MYSQL`. - DatabaseDumpSpec.Type database_dump_type = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [DataprocMetastore.Restore][]. -message RestoreServiceRequest { - // Required. The relative resource name of the metastore service to run - // restore, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The relative resource name of the metastore service backup to - // restore from, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string backup = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - Restore.RestoreType restore_type = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents the metadata of a long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the caller has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a - // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - // `Code.CANCELLED`. - bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Metadata about the service in a location. -message LocationMetadata { - // A specification of a supported version of the Hive Metastore software. - message HiveMetastoreVersion { - // The semantic version of the Hive Metastore software. - string version = 1; - - // Whether `version` will be chosen by the server if a metastore service is - // created with a `HiveMetastoreConfig` that omits the `version`. - bool is_default = 2; - } - - // The versions of Hive Metastore that can be used when creating a new - // metastore service in this location. The server guarantees that exactly one - // `HiveMetastoreVersion` in the list will set `is_default`. - repeated HiveMetastoreVersion supported_hive_metastore_versions = 1; -} - -// The specification of database dump to import from or export to. -message DatabaseDumpSpec { - // The type of the database dump. - enum Type { - // The type of the database dump is unknown. - TYPE_UNSPECIFIED = 0; - - // Database dump is a MySQL dump file. - MYSQL = 1; - - // Database dump contains Avro files. - AVRO = 2; - } -} - -// Request message for -// [DataprocMetastore.RemoveIamPolicy][google.cloud.metastore.v1alpha.DataprocMetastore.RemoveIamPolicy]. -message RemoveIamPolicyRequest { - // Required. The relative resource name of the dataplane resource to remove - // IAM policy, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` - // or - // `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. - string resource = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "*" } - ]; - - // Optional. Removes IAM policy attached to database or table asynchronously - // when it is set. The default is false. - bool asynchronous = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [DataprocMetastore.RemoveIamPolicy][google.cloud.metastore.v1alpha.DataprocMetastore.RemoveIamPolicy]. -message RemoveIamPolicyResponse { - // True if the policy is successfully removed. - bool success = 1; -} - -// Request message for -// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1alpha.DataprocMetastore.QueryMetadata]. -message QueryMetadataRequest { - // Required. The relative resource name of the metastore service to query - // metadata, in the following format: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Required. A read-only SQL query to execute against the metadata database. - // The query cannot change or mutate the data. - string query = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for -// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1alpha.DataprocMetastore.QueryMetadata]. -message QueryMetadataResponse { - // The manifest URI is link to a JSON instance in Cloud Storage. - // This instance manifests immediately along with QueryMetadataResponse. The - // content of the URI is not retriable until the long-running operation query - // against the metadata finishes. - string result_manifest_uri = 1; -} - -// Error details in public error message for -// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1alpha.DataprocMetastore.QueryMetadata]. -message ErrorDetails { - // Additional structured details about this error. - // - // Keys define the failure items. - // Value describes the exception or details of the item. - map details = 1; -} - -// Request message for -// [DataprocMetastore.MoveTableToDatabase][google.cloud.metastore.v1alpha.DataprocMetastore.MoveTableToDatabase]. -message MoveTableToDatabaseRequest { - // Required. The relative resource name of the metastore service to mutate - // metadata, in the following format: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The name of the table to be moved. - string table_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The name of the database where the table resides. - string db_name = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The name of the database where the table should be moved. - string destination_db_name = 4 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for -// [DataprocMetastore.MoveTableToDatabase][google.cloud.metastore.v1alpha.DataprocMetastore.MoveTableToDatabase]. -message MoveTableToDatabaseResponse {} - -// Request message for -// [DataprocMetastore.AlterMetadataResourceLocation][google.cloud.metastore.v1alpha.DataprocMetastore.AlterMetadataResourceLocation]. -message AlterMetadataResourceLocationRequest { - // Required. The relative resource name of the metastore service to mutate - // metadata, in the following format: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The relative metadata resource name in the following format. - // - // `databases/{database_id}` - // or - // `databases/{database_id}/tables/{table_id}` - // or - // `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` - string resource_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The new location URI for the metadata resource. - string location_uri = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for -// [DataprocMetastore.AlterMetadataResourceLocation][google.cloud.metastore.v1alpha.DataprocMetastore.AlterMetadataResourceLocation]. -message AlterMetadataResourceLocationResponse {} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore_federation.proto b/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore_federation.proto deleted file mode 100644 index bdb1ecb3783..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore_federation.proto +++ /dev/null @@ -1,377 +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 -// -// 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.metastore.v1alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/metastore/v1alpha/metastore.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/metastore/apiv1alpha/metastorepb;metastorepb"; -option java_multiple_files = true; -option java_outer_classname = "MetastoreFederationProto"; -option java_package = "com.google.cloud.metastore.v1alpha"; - -// Configures and manages metastore federation services. -// Dataproc Metastore Federation Service allows federating a collection of -// backend metastores like BigQuery, Dataplex Lakes, and other Dataproc -// Metastores. The Federation Service exposes a gRPC URL through which metadata -// from the backend metastores are served at query time. -// -// The Dataproc Metastore Federation API defines the following resource model: -// * The service works with a collection of Google Cloud projects. -// * Each project has a collection of available locations. -// * Each location has a collection of federations. -// * Dataproc Metastore Federations are resources with names of the -// form: -// `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. -service DataprocMetastoreFederation { - option (google.api.default_host) = "metastore.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists federations in a project and location. - rpc ListFederations(ListFederationsRequest) - returns (ListFederationsResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*/locations/*}/federations" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a single federation. - rpc GetFederation(GetFederationRequest) returns (Federation) { - option (google.api.http) = { - get: "/v1alpha/{name=projects/*/locations/*/federations/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a metastore federation in a project and location. - rpc CreateFederation(CreateFederationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha/{parent=projects/*/locations/*}/federations" - body: "federation" - }; - option (google.api.method_signature) = "parent,federation,federation_id"; - option (google.longrunning.operation_info) = { - response_type: "Federation" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Updates the fields of a federation. - rpc UpdateFederation(UpdateFederationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1alpha/{federation.name=projects/*/locations/*/federations/*}" - body: "federation" - }; - option (google.api.method_signature) = "federation,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Federation" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Deletes a single federation. - rpc DeleteFederation(DeleteFederationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1alpha/{name=projects/*/locations/*/federations/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } -} - -// Represents a federation of multiple backend metastores. -message Federation { - option (google.api.resource) = { - type: "metastore.googleapis.com/Federation" - pattern: "projects/{project}/locations/{location}/federations/{federation}" - }; - - // The current state of the federation. - enum State { - // The state of the metastore federation is unknown. - STATE_UNSPECIFIED = 0; - - // The metastore federation is in the process of being created. - CREATING = 1; - - // The metastore federation is running and ready to serve queries. - ACTIVE = 2; - - // The metastore federation is being updated. It remains usable but cannot - // accept additional update requests or be deleted at this time. - UPDATING = 3; - - // The metastore federation is undergoing deletion. It cannot be used. - DELETING = 4; - - // The metastore federation has encountered an error and cannot be used. The - // metastore federation should be deleted. - ERROR = 5; - } - - // Immutable. The relative resource name of the federation, of the - // form: - // projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the metastore federation was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metastore federation was last updated. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-defined labels for the metastore federation. - map labels = 4; - - // Immutable. The Apache Hive metastore version of the federation. All backend - // metastore versions must be compatible with the federation version. - string version = 5 [(google.api.field_behavior) = IMMUTABLE]; - - // A map from `BackendMetastore` rank to `BackendMetastore`s from which the - // federation service serves metadata at query time. The map key represents - // the order in which `BackendMetastore`s should be evaluated to resolve - // database names at query time and should be greater than or equal to zero. A - // `BackendMetastore` with a lower number will be evaluated before a - // `BackendMetastore` with a higher number. - map backend_metastores = 6; - - // Output only. The federation endpoint. - string endpoint_uri = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the federation. - State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current state of the - // metastore federation, if available. - string state_message = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The globally unique resource identifier of the metastore - // federation. - string uid = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents a backend metastore for the federation. -message BackendMetastore { - // The type of the backend metastore. - enum MetastoreType { - // The metastore type is not set. - METASTORE_TYPE_UNSPECIFIED = 0; - - // The backend metastore is Dataplex. - DATAPLEX = 1; - - // The backend metastore is BigQuery. - BIGQUERY = 2; - - // The backend metastore is Dataproc Metastore. - DATAPROC_METASTORE = 3; - } - - // The relative resource name of the metastore that is being federated. - // The formats of the relative resource names for the currently supported - // metastores are listed below: - // - // * BigQuery - // * `projects/{project_id}` - // * Dataproc Metastore - // * `projects/{project_id}/locations/{location}/services/{service_id}` - string name = 1; - - // The type of the backend metastore. - MetastoreType metastore_type = 2; -} - -// Request message for ListFederations. -message ListFederationsRequest { - // Required. The relative resource name of the location of metastore - // federations to list, in the following form: - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Federation" - } - ]; - - // Optional. The maximum number of federations to return. The response may - // contain less than the maximum number. If unspecified, no more than 500 - // services are returned. The maximum value is 1000; values above 1000 are - // changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous ListFederationServices - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // ListFederationServices must match the call that provided the - // page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for ListFederations -message ListFederationsResponse { - // The services in the specified location. - repeated Federation federations = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for GetFederation. -message GetFederationRequest { - // Required. The relative resource name of the metastore federation to - // retrieve, in the following form: - // - // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Federation" - } - ]; -} - -// Request message for CreateFederation. -message CreateFederationRequest { - // Required. The relative resource name of the location in which to create a - // federation service, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Federation" - } - ]; - - // Required. The ID of the metastore federation, which is used as the final - // component of the metastore federation's name. - // - // This value must be between 2 and 63 characters long inclusive, begin with a - // letter, end with a letter or number, and consist of alpha-numeric - // ASCII characters or hyphens. - string federation_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Metastore Federation to create. The `name` field is - // ignored. The ID of the created metastore federation must be - // provided in the request's `federation_id` field. - Federation federation = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for UpdateFederation. -message UpdateFederationRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metastore federation resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The metastore federation to update. The server only merges fields - // in the service if they are specified in `update_mask`. - // - // The metastore federation's `name` field is used to identify the - // metastore service to be updated. - Federation federation = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for DeleteFederation. -message DeleteFederationRequest { - // Required. The relative resource name of the metastore federation to delete, - // in the following form: - // - // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Federation" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.alter_metadata_resource_location.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.alter_metadata_resource_location.js deleted file mode 100644 index edaff4f8c93..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.alter_metadata_resource_location.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(service, resourceName, locationUri) { - // [START metastore_v1alpha_generated_DataprocMetastore_AlterMetadataResourceLocation_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 relative resource name of the metastore service to mutate - * metadata, in the following format: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Required. The relative metadata resource name in the following format. - * `databases/{database_id}` - * or - * `databases/{database_id}/tables/{table_id}` - * or - * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` - */ - // const resourceName = 'abc123' - /** - * Required. The new location URI for the metadata resource. - */ - // const locationUri = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callAlterMetadataResourceLocation() { - // Construct request - const request = { - service, - resourceName, - locationUri, - }; - - // Run request - const [operation] = await metastoreClient.alterMetadataResourceLocation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAlterMetadataResourceLocation(); - // [END metastore_v1alpha_generated_DataprocMetastore_AlterMetadataResourceLocation_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_backup.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_backup.js deleted file mode 100644 index 01fc9ff0020..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_backup.js +++ /dev/null @@ -1,92 +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, backupId, backup) { - // [START metastore_v1alpha_generated_DataprocMetastore_CreateBackup_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 relative resource name of the service in which to create a - * backup of the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the backup, which is used as the final component of the - * backup's name. - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - */ - // const backupId = 'abc123' - /** - * Required. The backup to create. The `name` field is ignored. The ID of the - * created backup must be provided in the request's `backup_id` field. - */ - // const backup = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateBackup() { - // Construct request - const request = { - parent, - backupId, - backup, - }; - - // Run request - const [operation] = await metastoreClient.createBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateBackup(); - // [END metastore_v1alpha_generated_DataprocMetastore_CreateBackup_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js deleted file mode 100644 index 5c2dcb559d3..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js +++ /dev/null @@ -1,93 +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, metadataImportId, metadataImport) { - // [START metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_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 relative resource name of the service in which to create a - * metastore import, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metadata import, which is used as the final - * component of the metadata import's name. - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - */ - // const metadataImportId = 'abc123' - /** - * Required. The metadata import to create. The `name` field is ignored. The - * ID of the created metadata import must be provided in the request's - * `metadata_import_id` field. - */ - // const metadataImport = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateMetadataImport() { - // Construct request - const request = { - parent, - metadataImportId, - metadataImport, - }; - - // Run request - const [operation] = await metastoreClient.createMetadataImport(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateMetadataImport(); - // [END metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_service.js deleted file mode 100644 index 88a34fdc55f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_service.js +++ /dev/null @@ -1,93 +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, serviceId, service) { - // [START metastore_v1alpha_generated_DataprocMetastore_CreateService_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 relative resource name of the location in which to create a - * metastore service, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metastore service, which is used as the final - * component of the metastore service's name. - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - */ - // const serviceId = 'abc123' - /** - * Required. The Metastore service to create. The `name` field is - * ignored. The ID of the created metastore service must be provided in - * the request's `service_id` field. - */ - // const service = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateService() { - // Construct request - const request = { - parent, - serviceId, - service, - }; - - // Run request - const [operation] = await metastoreClient.createService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateService(); - // [END metastore_v1alpha_generated_DataprocMetastore_CreateService_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_backup.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_backup.js deleted file mode 100644 index 445c2bc2431..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_backup.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(name) { - // [START metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_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 relative resource name of the backup to delete, in the - * following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callDeleteBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteBackup(); - // [END metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_service.js deleted file mode 100644 index 05af070f4ed..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_service.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(name) { - // [START metastore_v1alpha_generated_DataprocMetastore_DeleteService_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 relative resource name of the metastore service to delete, in - * the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callDeleteService() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteService(); - // [END metastore_v1alpha_generated_DataprocMetastore_DeleteService_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.export_metadata.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.export_metadata.js deleted file mode 100644 index 46f43eb57d9..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.export_metadata.js +++ /dev/null @@ -1,88 +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(service) { - // [START metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_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. - */ - /** - * A Cloud Storage URI of a folder, in the format - * `gs:///`. A sub-folder - * `` containing exported files will be created below it. - */ - // const destinationGcsFolder = 'abc123' - /** - * Required. The relative resource name of the metastore service to run - * export, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - /** - * Optional. The type of the database dump. If unspecified, defaults to - * `MYSQL`. - */ - // const databaseDumpType = {} - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callExportMetadata() { - // Construct request - const request = { - service, - }; - - // Run request - const [operation] = await metastoreClient.exportMetadata(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportMetadata(); - // [END metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_backup.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_backup.js deleted file mode 100644 index fcc4667c506..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_backup.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 metastore_v1alpha_generated_DataprocMetastore_GetBackup_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 relative resource name of the backup to retrieve, in the - * following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getBackup(request); - console.log(response); - } - - callGetBackup(); - // [END metastore_v1alpha_generated_DataprocMetastore_GetBackup_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js deleted file mode 100644 index 9f7b5e8f8a0..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_metadata_import.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 metastore_v1alpha_generated_DataprocMetastore_GetMetadataImport_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 relative resource name of the metadata import to retrieve, in - * the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetMetadataImport() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getMetadataImport(request); - console.log(response); - } - - callGetMetadataImport(); - // [END metastore_v1alpha_generated_DataprocMetastore_GetMetadataImport_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_service.js deleted file mode 100644 index 286eb652440..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_service.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 metastore_v1alpha_generated_DataprocMetastore_GetService_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 relative resource name of the metastore service to retrieve, - * in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetService() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getService(request); - console.log(response); - } - - callGetService(); - // [END metastore_v1alpha_generated_DataprocMetastore_GetService_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_backups.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_backups.js deleted file mode 100644 index e4fbe141848..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_backups.js +++ /dev/null @@ -1,91 +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 metastore_v1alpha_generated_DataprocMetastore_ListBackups_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 relative resource name of the service whose backups to - * list, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous - * DataprocMetastore.ListBackups google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListBackups google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListBackups() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listBackupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBackups(); - // [END metastore_v1alpha_generated_DataprocMetastore_ListBackups_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js deleted file mode 100644 index d51efef9cfa..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js +++ /dev/null @@ -1,91 +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 metastore_v1alpha_generated_DataprocMetastore_ListMetadataImports_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 relative resource name of the service whose metadata imports - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous - * DataprocMetastore.ListServices google.cloud.metastore.v1alpha.DataprocMetastore.ListServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListServices google.cloud.metastore.v1alpha.DataprocMetastore.ListServices - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListMetadataImports() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listMetadataImportsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMetadataImports(); - // [END metastore_v1alpha_generated_DataprocMetastore_ListMetadataImports_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_services.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_services.js deleted file mode 100644 index d02e18afd32..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_services.js +++ /dev/null @@ -1,92 +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 metastore_v1alpha_generated_DataprocMetastore_ListServices_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 relative resource name of the location of metastore services - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous - * DataprocMetastore.ListServices google.cloud.metastore.v1alpha.DataprocMetastore.ListServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListServices google.cloud.metastore.v1alpha.DataprocMetastore.ListServices - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListServices() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listServicesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListServices(); - // [END metastore_v1alpha_generated_DataprocMetastore_ListServices_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.move_table_to_database.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.move_table_to_database.js deleted file mode 100644 index 4a47afc91c1..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.move_table_to_database.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(service, tableName, dbName, destinationDbName) { - // [START metastore_v1alpha_generated_DataprocMetastore_MoveTableToDatabase_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 relative resource name of the metastore service to mutate - * metadata, in the following format: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Required. The name of the table to be moved. - */ - // const tableName = 'abc123' - /** - * Required. The name of the database where the table resides. - */ - // const dbName = 'abc123' - /** - * Required. The name of the database where the table should be moved. - */ - // const destinationDbName = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callMoveTableToDatabase() { - // Construct request - const request = { - service, - tableName, - dbName, - destinationDbName, - }; - - // Run request - const [operation] = await metastoreClient.moveTableToDatabase(request); - const [response] = await operation.promise(); - console.log(response); - } - - callMoveTableToDatabase(); - // [END metastore_v1alpha_generated_DataprocMetastore_MoveTableToDatabase_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.query_metadata.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.query_metadata.js deleted file mode 100644 index f44e0884f3c..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.query_metadata.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(service, query) { - // [START metastore_v1alpha_generated_DataprocMetastore_QueryMetadata_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 relative resource name of the metastore service to query - * metadata, in the following format: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Required. A read-only SQL query to execute against the metadata database. - * The query cannot change or mutate the data. - */ - // const query = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callQueryMetadata() { - // Construct request - const request = { - service, - query, - }; - - // Run request - const [operation] = await metastoreClient.queryMetadata(request); - const [response] = await operation.promise(); - console.log(response); - } - - callQueryMetadata(); - // [END metastore_v1alpha_generated_DataprocMetastore_QueryMetadata_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.remove_iam_policy.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.remove_iam_policy.js deleted file mode 100644 index b233a6b57f6..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.remove_iam_policy.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) { - // [START metastore_v1alpha_generated_DataprocMetastore_RemoveIamPolicy_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 relative resource name of the dataplane resource to remove - * IAM policy, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` - * or - * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. - */ - // const resource = 'abc123' - /** - * Optional. Removes IAM policy attached to database or table asynchronously - * when it is set. The default is false. - */ - // const asynchronous = true - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callRemoveIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await metastoreClient.removeIamPolicy(request); - console.log(response); - } - - callRemoveIamPolicy(); - // [END metastore_v1alpha_generated_DataprocMetastore_RemoveIamPolicy_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.restore_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.restore_service.js deleted file mode 100644 index 46c59ad1046..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.restore_service.js +++ /dev/null @@ -1,88 +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(service, backup) { - // [START metastore_v1alpha_generated_DataprocMetastore_RestoreService_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 relative resource name of the metastore service to run - * restore, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Required. The relative resource name of the metastore service backup to - * restore from, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const backup = 'abc123' - /** - * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - */ - // const restoreType = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callRestoreService() { - // Construct request - const request = { - service, - backup, - }; - - // Run request - const [operation] = await metastoreClient.restoreService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRestoreService(); - // [END metastore_v1alpha_generated_DataprocMetastore_RestoreService_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js deleted file mode 100644 index 3eb592036d0..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js +++ /dev/null @@ -1,86 +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(updateMask, metadataImport) { - // [START metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_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. A field mask used to specify the fields to be overwritten in the - * metadata import resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metadata import to update. The server only merges fields - * in the import if they are specified in `update_mask`. - * The metadata import's `name` field is used to identify the metastore - * import to be updated. - */ - // const metadataImport = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callUpdateMetadataImport() { - // Construct request - const request = { - updateMask, - metadataImport, - }; - - // Run request - const [operation] = await metastoreClient.updateMetadataImport(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateMetadataImport(); - // [END metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_service.js deleted file mode 100644 index 6fa09b2d6f6..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_service.js +++ /dev/null @@ -1,86 +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(updateMask, service) { - // [START metastore_v1alpha_generated_DataprocMetastore_UpdateService_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. A field mask used to specify the fields to be overwritten in the - * metastore service resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metastore service to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * The metastore service's `name` field is used to identify the metastore - * service to be updated. - */ - // const service = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callUpdateService() { - // Construct request - const request = { - updateMask, - service, - }; - - // Run request - const [operation] = await metastoreClient.updateService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateService(); - // [END metastore_v1alpha_generated_DataprocMetastore_UpdateService_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js deleted file mode 100644 index 0db971f3b7c..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js +++ /dev/null @@ -1,93 +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, federationId, federation) { - // [START metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_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 relative resource name of the location in which to create a - * federation service, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metastore federation, which is used as the final - * component of the metastore federation's name. - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - */ - // const federationId = 'abc123' - /** - * Required. The Metastore Federation to create. The `name` field is - * ignored. The ID of the created metastore federation must be - * provided in the request's `federation_id` field. - */ - // const federation = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callCreateFederation() { - // Construct request - const request = { - parent, - federationId, - federation, - }; - - // Run request - const [operation] = await metastoreClient.createFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateFederation(); - // [END metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js deleted file mode 100644 index 73a47a15bc8..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.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(name) { - // [START metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_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 relative resource name of the metastore federation to delete, - * in the following form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callDeleteFederation() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteFederation(); - // [END metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js deleted file mode 100644 index 6b818a7f456..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.get_federation.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 metastore_v1alpha_generated_DataprocMetastoreFederation_GetFederation_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 relative resource name of the metastore federation to - * retrieve, in the following form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callGetFederation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getFederation(request); - console.log(response); - } - - callGetFederation(); - // [END metastore_v1alpha_generated_DataprocMetastoreFederation_GetFederation_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js deleted file mode 100644 index c1fa26438b8..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js +++ /dev/null @@ -1,91 +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 metastore_v1alpha_generated_DataprocMetastoreFederation_ListFederations_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 relative resource name of the location of metastore - * federations to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of federations to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callListFederations() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listFederationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFederations(); - // [END metastore_v1alpha_generated_DataprocMetastoreFederation_ListFederations_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-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js deleted file mode 100644 index 28da7dd4d24..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js +++ /dev/null @@ -1,86 +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(updateMask, federation) { - // [START metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_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. A field mask used to specify the fields to be overwritten in the - * metastore federation resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metastore federation to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * The metastore federation's `name` field is used to identify the - * metastore service to be updated. - */ - // const federation = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callUpdateFederation() { - // Construct request - const request = { - updateMask, - federation, - }; - - // Run request - const [operation] = await metastoreClient.updateFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateFederation(); - // [END metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_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-metastore/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.metastore.v1alpha.json b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.metastore.v1alpha.json deleted file mode 100644 index d44e4ba53b9..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.metastore.v1alpha.json +++ /dev/null @@ -1,1175 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-metastore", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.metastore.v1alpha", - "version": "v1alpha" - } - ] - }, - "snippets": [ - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_ListServices_async", - "title": "DataprocMetastore listServices Sample", - "origin": "API_DEFINITION", - "description": " Lists services in a project and location.", - "canonical": true, - "file": "dataproc_metastore.list_services.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServices", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListServices", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1alpha.ListServicesResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListServices", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListServices", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_GetService_async", - "title": "DataprocMetastore getService Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a single service.", - "canonical": true, - "file": "dataproc_metastore.get_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetService", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1alpha.Service", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_CreateService_async", - "title": "DataprocMetastore createService Sample", - "origin": "API_DEFINITION", - "description": " Creates a metastore service in a project and location.", - "canonical": true, - "file": "dataproc_metastore.create_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateService", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "service_id", - "type": "TYPE_STRING" - }, - { - "name": "service", - "type": ".google.cloud.metastore.v1alpha.Service" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_UpdateService_async", - "title": "DataprocMetastore updateService Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of a single service.", - "canonical": true, - "file": "dataproc_metastore.update_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.UpdateService", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "service", - "type": ".google.cloud.metastore.v1alpha.Service" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "UpdateService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.UpdateService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_DeleteService_async", - "title": "DataprocMetastore deleteService Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single service.", - "canonical": true, - "file": "dataproc_metastore.delete_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.DeleteService", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "DeleteService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.DeleteService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_ListMetadataImports_async", - "title": "DataprocMetastore listMetadataImports Sample", - "origin": "API_DEFINITION", - "description": " Lists imports in a service.", - "canonical": true, - "file": "dataproc_metastore.list_metadata_imports.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMetadataImports", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListMetadataImports", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1alpha.ListMetadataImportsResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListMetadataImports", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListMetadataImports", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_GetMetadataImport_async", - "title": "DataprocMetastore getMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single import.", - "canonical": true, - "file": "dataproc_metastore.get_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetMetadataImport", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetMetadataImport", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1alpha.MetadataImport", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetMetadataImport", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_async", - "title": "DataprocMetastore createMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Creates a new MetadataImport in a given project and location.", - "canonical": true, - "file": "dataproc_metastore.create_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMetadataImport", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateMetadataImport", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "metadata_import_id", - "type": "TYPE_STRING" - }, - { - "name": "metadata_import", - "type": ".google.cloud.metastore.v1alpha.MetadataImport" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateMetadataImport", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_async", - "title": "DataprocMetastore updateMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Updates a single import. Only the description field of MetadataImport is supported to be updated.", - "canonical": true, - "file": "dataproc_metastore.update_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateMetadataImport", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.UpdateMetadataImport", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "metadata_import", - "type": ".google.cloud.metastore.v1alpha.MetadataImport" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "UpdateMetadataImport", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.UpdateMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_async", - "title": "DataprocMetastore exportMetadata Sample", - "origin": "API_DEFINITION", - "description": " Exports metadata from a service.", - "canonical": true, - "file": "dataproc_metastore.export_metadata.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportMetadata", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ExportMetadata", - "async": true, - "parameters": [ - { - "name": "destination_gcs_folder", - "type": "TYPE_STRING" - }, - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "database_dump_type", - "type": ".google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "ExportMetadata", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ExportMetadata", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_RestoreService_async", - "title": "DataprocMetastore restoreService Sample", - "origin": "API_DEFINITION", - "description": " Restores a service from a backup.", - "canonical": true, - "file": "dataproc_metastore.restore_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RestoreService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.RestoreService", - "async": true, - "parameters": [ - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": "TYPE_STRING" - }, - { - "name": "restore_type", - "type": ".google.cloud.metastore.v1alpha.Restore.RestoreType" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "RestoreService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.RestoreService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_ListBackups_async", - "title": "DataprocMetastore listBackups Sample", - "origin": "API_DEFINITION", - "description": " Lists backups in a service.", - "canonical": true, - "file": "dataproc_metastore.list_backups.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBackups", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1alpha.ListBackupsResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListBackups", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_GetBackup_async", - "title": "DataprocMetastore getBackup Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single backup.", - "canonical": true, - "file": "dataproc_metastore.get_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBackup", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1alpha.Backup", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetBackup", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_CreateBackup_async", - "title": "DataprocMetastore createBackup Sample", - "origin": "API_DEFINITION", - "description": " Creates a new backup in a given project and location.", - "canonical": true, - "file": "dataproc_metastore.create_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBackup", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateBackup", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "backup_id", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": ".google.cloud.metastore.v1alpha.Backup" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateBackup", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_async", - "title": "DataprocMetastore deleteBackup Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single backup.", - "canonical": true, - "file": "dataproc_metastore.delete_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.DeleteBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.DeleteBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_RemoveIamPolicy_async", - "title": "DataprocMetastore removeIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Removes the attached IAM policies for a resource", - "canonical": true, - "file": "dataproc_metastore.remove_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveIamPolicy", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.RemoveIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "asynchronous", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.metastore.v1alpha.RemoveIamPolicyResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "RemoveIamPolicy", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.RemoveIamPolicy", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_QueryMetadata_async", - "title": "DataprocMetastore queryMetadata Sample", - "origin": "API_DEFINITION", - "description": " Query DPMS metadata.", - "canonical": true, - "file": "dataproc_metastore.query_metadata.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "QueryMetadata", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.QueryMetadata", - "async": true, - "parameters": [ - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "QueryMetadata", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.QueryMetadata", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_MoveTableToDatabase_async", - "title": "DataprocMetastore moveTableToDatabase Sample", - "origin": "API_DEFINITION", - "description": " Move a table to another database.", - "canonical": true, - "file": "dataproc_metastore.move_table_to_database.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "MoveTableToDatabase", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.MoveTableToDatabase", - "async": true, - "parameters": [ - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "table_name", - "type": "TYPE_STRING" - }, - { - "name": "db_name", - "type": "TYPE_STRING" - }, - { - "name": "destination_db_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "MoveTableToDatabase", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.MoveTableToDatabase", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_AlterMetadataResourceLocation_async", - "title": "DataprocMetastore alterMetadataResourceLocation Sample", - "origin": "API_DEFINITION", - "description": " Alter metadata resource location. The metadata resource can be a database, table, or partition. This functionality only updates the parent directory for the respective metadata resource and does not transfer any existing data to the new location.", - "canonical": true, - "file": "dataproc_metastore.alter_metadata_resource_location.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AlterMetadataResourceLocation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.AlterMetadataResourceLocation", - "async": true, - "parameters": [ - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "resource_name", - "type": "TYPE_STRING" - }, - { - "name": "location_uri", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "AlterMetadataResourceLocation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.AlterMetadataResourceLocation", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_ListFederations_async", - "title": "DataprocMetastore listFederations Sample", - "origin": "API_DEFINITION", - "description": " Lists federations in a project and location.", - "canonical": true, - "file": "dataproc_metastore_federation.list_federations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFederations", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.ListFederations", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1alpha.ListFederationsResponse", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "ListFederations", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.ListFederations", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_GetFederation_async", - "title": "DataprocMetastore getFederation Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a single federation.", - "canonical": true, - "file": "dataproc_metastore_federation.get_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.GetFederation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1alpha.Federation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "GetFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.GetFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_async", - "title": "DataprocMetastore createFederation Sample", - "origin": "API_DEFINITION", - "description": " Creates a metastore federation in a project and location.", - "canonical": true, - "file": "dataproc_metastore_federation.create_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.CreateFederation", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "federation_id", - "type": "TYPE_STRING" - }, - { - "name": "federation", - "type": ".google.cloud.metastore.v1alpha.Federation" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "CreateFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.CreateFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_async", - "title": "DataprocMetastore updateFederation Sample", - "origin": "API_DEFINITION", - "description": " Updates the fields of a federation.", - "canonical": true, - "file": "dataproc_metastore_federation.update_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.UpdateFederation", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "federation", - "type": ".google.cloud.metastore.v1alpha.Federation" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "UpdateFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.UpdateFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_async", - "title": "DataprocMetastore deleteFederation Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single federation.", - "canonical": true, - "file": "dataproc_metastore_federation.delete_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.DeleteFederation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "DeleteFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.DeleteFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/src/index.ts deleted file mode 100644 index a48e74fca36..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/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 v1alpha from './v1alpha'; -const DataprocMetastoreClient = v1alpha.DataprocMetastoreClient; -type DataprocMetastoreClient = v1alpha.DataprocMetastoreClient; -const DataprocMetastoreFederationClient = v1alpha.DataprocMetastoreFederationClient; -type DataprocMetastoreFederationClient = v1alpha.DataprocMetastoreFederationClient; -export {v1alpha, DataprocMetastoreClient, DataprocMetastoreFederationClient}; -export default {v1alpha, DataprocMetastoreClient, DataprocMetastoreFederationClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client.ts deleted file mode 100644 index 1f48a103e94..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client.ts +++ /dev/null @@ -1,3539 +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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1alpha/dataproc_metastore_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './dataproc_metastore_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Configures and manages metastore services. - * Metastore services are fully managed, highly available, autoscaled, - * autohealing, OSS-native deployments of technical metadata management - * software. Each metastore service exposes a network endpoint through which - * metadata queries are served. Metadata queries can originate from a variety - * of sources, including Apache Hive, Apache Presto, and Apache Spark. - * - * The Dataproc Metastore API defines the following resource model: - * - * * The service works with a collection of Google Cloud projects, named: - * `/projects/*` - * * Each project has a collection of available locations, named: `/locations/*` - * (a location must refer to a Google Cloud `region`) - * * Each location has a collection of services, named: `/services/*` - * * Dataproc Metastore services are resources with names of the form: - * - * `/projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @class - * @memberof v1alpha - */ -export class DataprocMetastoreClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - dataprocMetastoreStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DataprocMetastoreClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 DataprocMetastoreClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DataprocMetastoreClient; - 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; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - 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 = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' - ), - federationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/federations/{federation}' - ), - lakePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/lakes/{lake}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - metadataImportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' - ), - networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{network}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listServices: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'services'), - listMetadataImports: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metadataImports'), - listBackups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.Service') as gax.protobuf.Type; - const createServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const updateServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.Service') as gax.protobuf.Type; - const updateServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const deleteServiceResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const createMetadataImportResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.MetadataImport') as gax.protobuf.Type; - const createMetadataImportMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const updateMetadataImportResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.MetadataImport') as gax.protobuf.Type; - const updateMetadataImportMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const exportMetadataResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.MetadataExport') as gax.protobuf.Type; - const exportMetadataMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const restoreServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.Restore') as gax.protobuf.Type; - const restoreServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const createBackupResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.Backup') as gax.protobuf.Type; - const createBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const deleteBackupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const queryMetadataResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.QueryMetadataResponse') as gax.protobuf.Type; - const queryMetadataMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const moveTableToDatabaseResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.MoveTableToDatabaseResponse') as gax.protobuf.Type; - const moveTableToDatabaseMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const alterMetadataResourceLocationResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationResponse') as gax.protobuf.Type; - const alterMetadataResourceLocationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createServiceResponse.decode.bind(createServiceResponse), - createServiceMetadata.decode.bind(createServiceMetadata)), - updateService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateServiceResponse.decode.bind(updateServiceResponse), - updateServiceMetadata.decode.bind(updateServiceMetadata)), - deleteService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteServiceResponse.decode.bind(deleteServiceResponse), - deleteServiceMetadata.decode.bind(deleteServiceMetadata)), - createMetadataImport: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createMetadataImportResponse.decode.bind(createMetadataImportResponse), - createMetadataImportMetadata.decode.bind(createMetadataImportMetadata)), - updateMetadataImport: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateMetadataImportResponse.decode.bind(updateMetadataImportResponse), - updateMetadataImportMetadata.decode.bind(updateMetadataImportMetadata)), - exportMetadata: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportMetadataResponse.decode.bind(exportMetadataResponse), - exportMetadataMetadata.decode.bind(exportMetadataMetadata)), - restoreService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - restoreServiceResponse.decode.bind(restoreServiceResponse), - restoreServiceMetadata.decode.bind(restoreServiceMetadata)), - createBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBackupResponse.decode.bind(createBackupResponse), - createBackupMetadata.decode.bind(createBackupMetadata)), - deleteBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteBackupResponse.decode.bind(deleteBackupResponse), - deleteBackupMetadata.decode.bind(deleteBackupMetadata)), - queryMetadata: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - queryMetadataResponse.decode.bind(queryMetadataResponse), - queryMetadataMetadata.decode.bind(queryMetadataMetadata)), - moveTableToDatabase: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - moveTableToDatabaseResponse.decode.bind(moveTableToDatabaseResponse), - moveTableToDatabaseMetadata.decode.bind(moveTableToDatabaseMetadata)), - alterMetadataResourceLocation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - alterMetadataResourceLocationResponse.decode.bind(alterMetadataResourceLocationResponse), - alterMetadataResourceLocationMetadata.decode.bind(alterMetadataResourceLocationMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.metastore.v1alpha.DataprocMetastore', 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.dataprocMetastoreStub) { - return this.dataprocMetastoreStub; - } - - // Put together the "service stub" for - // google.cloud.metastore.v1alpha.DataprocMetastore. - this.dataprocMetastoreStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1alpha.DataprocMetastore') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.metastore.v1alpha.DataprocMetastore, - 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 dataprocMetastoreStubMethods = - ['listServices', 'getService', 'createService', 'updateService', 'deleteService', 'listMetadataImports', 'getMetadataImport', 'createMetadataImport', 'updateMetadataImport', 'exportMetadata', 'restoreService', 'listBackups', 'getBackup', 'createBackup', 'deleteBackup', 'removeIamPolicy', 'queryMetadata', 'moveTableToDatabase', 'alterMetadataResourceLocation']; - for (const methodName of dataprocMetastoreStubMethods) { - const callPromise = this.dataprocMetastoreStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.dataprocMetastoreStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'metastore.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 'metastore.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 -- - // ------------------- -/** - * Gets the details of a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore service to retrieve, - * in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.metastore.v1alpha.Service|Service}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.get_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_GetService_async - */ - getService( - request?: protos.google.cloud.metastore.v1alpha.IGetServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1alpha.IService, - protos.google.cloud.metastore.v1alpha.IGetServiceRequest|undefined, {}|undefined - ]>; - getService( - request: protos.google.cloud.metastore.v1alpha.IGetServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IService, - protos.google.cloud.metastore.v1alpha.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; - getService( - request: protos.google.cloud.metastore.v1alpha.IGetServiceRequest, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IService, - protos.google.cloud.metastore.v1alpha.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; - getService( - request?: protos.google.cloud.metastore.v1alpha.IGetServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1alpha.IService, - protos.google.cloud.metastore.v1alpha.IGetServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1alpha.IService, - protos.google.cloud.metastore.v1alpha.IGetServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1alpha.IService, - protos.google.cloud.metastore.v1alpha.IGetServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getService(request, options, callback); - } -/** - * Gets details of a single import. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metadata import to retrieve, in - * the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_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 protos.google.cloud.metastore.v1alpha.MetadataImport|MetadataImport}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_GetMetadataImport_async - */ - getMetadataImport( - request?: protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1alpha.IMetadataImport, - protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|undefined, {}|undefined - ]>; - getMetadataImport( - request: protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IMetadataImport, - protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): void; - getMetadataImport( - request: protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IMetadataImport, - protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): void; - getMetadataImport( - request?: protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1alpha.IMetadataImport, - protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1alpha.IMetadataImport, - protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1alpha.IMetadataImport, - protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|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.getMetadataImport(request, options, callback); - } -/** - * Gets details of a single backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the backup to retrieve, in the - * following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_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 protos.google.cloud.metastore.v1alpha.Backup|Backup}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.get_backup.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_GetBackup_async - */ - getBackup( - request?: protos.google.cloud.metastore.v1alpha.IGetBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1alpha.IBackup, - protos.google.cloud.metastore.v1alpha.IGetBackupRequest|undefined, {}|undefined - ]>; - getBackup( - request: protos.google.cloud.metastore.v1alpha.IGetBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IBackup, - protos.google.cloud.metastore.v1alpha.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request: protos.google.cloud.metastore.v1alpha.IGetBackupRequest, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IBackup, - protos.google.cloud.metastore.v1alpha.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request?: protos.google.cloud.metastore.v1alpha.IGetBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1alpha.IBackup, - protos.google.cloud.metastore.v1alpha.IGetBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1alpha.IBackup, - protos.google.cloud.metastore.v1alpha.IGetBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1alpha.IBackup, - protos.google.cloud.metastore.v1alpha.IGetBackupRequest|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.getBackup(request, options, callback); - } -/** - * Removes the attached IAM policies for a resource - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * Required. The relative resource name of the dataplane resource to remove - * IAM policy, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` - * or - * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. - * @param {boolean} [request.asynchronous] - * Optional. Removes IAM policy attached to database or table asynchronously - * when it is set. The default is false. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.metastore.v1alpha.RemoveIamPolicyResponse|RemoveIamPolicyResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.remove_iam_policy.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_RemoveIamPolicy_async - */ - removeIamPolicy( - request?: protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyResponse, - protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest|undefined, {}|undefined - ]>; - removeIamPolicy( - request: protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyResponse, - protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - removeIamPolicy( - request: protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyResponse, - protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - removeIamPolicy( - request?: protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyResponse, - protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyResponse, - protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyResponse, - protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyRequest|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.removeIamPolicy(request, options, callback); - } - -/** - * Creates a metastore service in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location in which to create a - * metastore service, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {string} request.serviceId - * Required. The ID of the metastore service, which is used as the final - * component of the metastore service's name. - * - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - * @param {google.cloud.metastore.v1alpha.Service} request.service - * Required. The Metastore service to create. The `name` field is - * ignored. The ID of the created metastore service must be provided in - * the request's `service_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.create_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateService_async - */ - createService( - request?: protos.google.cloud.metastore.v1alpha.ICreateServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createService( - request: protos.google.cloud.metastore.v1alpha.ICreateServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createService( - request: protos.google.cloud.metastore.v1alpha.ICreateServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createService( - request?: protos.google.cloud.metastore.v1alpha.ICreateServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.create_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateService_async - */ - async checkCreateServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the parameters of a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metastore service resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1alpha.Service} request.service - * Required. The metastore service to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * - * The metastore service's `name` field is used to identify the metastore - * service to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.update_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_UpdateService_async - */ - updateService( - request?: protos.google.cloud.metastore.v1alpha.IUpdateServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateService( - request: protos.google.cloud.metastore.v1alpha.IUpdateServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateService( - request: protos.google.cloud.metastore.v1alpha.IUpdateServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateService( - request?: protos.google.cloud.metastore.v1alpha.IUpdateServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service.name': request.service!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.update_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_UpdateService_async - */ - async checkUpdateServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore service to delete, in - * the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.delete_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_DeleteService_async - */ - deleteService( - request?: protos.google.cloud.metastore.v1alpha.IDeleteServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteService( - request: protos.google.cloud.metastore.v1alpha.IDeleteServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteService( - request: protos.google.cloud.metastore.v1alpha.IDeleteServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteService( - request?: protos.google.cloud.metastore.v1alpha.IDeleteServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.delete_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_DeleteService_async - */ - async checkDeleteServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new MetadataImport in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service in which to create a - * metastore import, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} request.metadataImportId - * Required. The ID of the metadata import, which is used as the final - * component of the metadata import's name. - * - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - * @param {google.cloud.metastore.v1alpha.MetadataImport} request.metadataImport - * Required. The metadata import to create. The `name` field is ignored. The - * ID of the created metadata import must be provided in the request's - * `metadata_import_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_async - */ - createMetadataImport( - request?: protos.google.cloud.metastore.v1alpha.ICreateMetadataImportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createMetadataImport( - request: protos.google.cloud.metastore.v1alpha.ICreateMetadataImportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMetadataImport( - request: protos.google.cloud.metastore.v1alpha.ICreateMetadataImportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMetadataImport( - request?: protos.google.cloud.metastore.v1alpha.ICreateMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createMetadataImport(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createMetadataImport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_async - */ - async checkCreateMetadataImportProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMetadataImport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates a single import. - * Only the description field of MetadataImport is supported to be updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metadata import resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1alpha.MetadataImport} request.metadataImport - * Required. The metadata import to update. The server only merges fields - * in the import if they are specified in `update_mask`. - * - * The metadata import's `name` field is used to identify the metastore - * import to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_async - */ - updateMetadataImport( - request?: protos.google.cloud.metastore.v1alpha.IUpdateMetadataImportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateMetadataImport( - request: protos.google.cloud.metastore.v1alpha.IUpdateMetadataImportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMetadataImport( - request: protos.google.cloud.metastore.v1alpha.IUpdateMetadataImportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMetadataImport( - request?: protos.google.cloud.metastore.v1alpha.IUpdateMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metadata_import.name': request.metadataImport!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateMetadataImport(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateMetadataImport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_async - */ - async checkUpdateMetadataImportProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMetadataImport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Exports metadata from a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.destinationGcsFolder - * A Cloud Storage URI of a folder, in the format - * `gs:///`. A sub-folder - * `` containing exported files will be created below it. - * @param {string} request.service - * Required. The relative resource name of the metastore service to run - * export, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type} [request.databaseDumpType] - * Optional. The type of the database dump. If unspecified, defaults to - * `MYSQL`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.export_metadata.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_async - */ - exportMetadata( - request?: protos.google.cloud.metastore.v1alpha.IExportMetadataRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportMetadata( - request: protos.google.cloud.metastore.v1alpha.IExportMetadataRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportMetadata( - request: protos.google.cloud.metastore.v1alpha.IExportMetadataRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportMetadata( - request?: protos.google.cloud.metastore.v1alpha.IExportMetadataRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.exportMetadata(request, options, callback); - } -/** - * Check the status of the long running operation returned by `exportMetadata()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.export_metadata.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_async - */ - async checkExportMetadataProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportMetadata, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Restores a service from a backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.service - * Required. The relative resource name of the metastore service to run - * restore, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} request.backup - * Required. The relative resource name of the metastore service backup to - * restore from, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - * @param {google.cloud.metastore.v1alpha.Restore.RestoreType} [request.restoreType] - * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.restore_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_RestoreService_async - */ - restoreService( - request?: protos.google.cloud.metastore.v1alpha.IRestoreServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - restoreService( - request: protos.google.cloud.metastore.v1alpha.IRestoreServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreService( - request: protos.google.cloud.metastore.v1alpha.IRestoreServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreService( - request?: protos.google.cloud.metastore.v1alpha.IRestoreServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.restoreService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `restoreService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.restore_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_RestoreService_async - */ - async checkRestoreServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new backup in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service in which to create a - * backup of the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} request.backupId - * Required. The ID of the backup, which is used as the final component of the - * backup's name. - * - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - * @param {google.cloud.metastore.v1alpha.Backup} request.backup - * Required. The backup to create. The `name` field is ignored. The ID of the - * created backup must be provided in the request's `backup_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.create_backup.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateBackup_async - */ - createBackup( - request?: protos.google.cloud.metastore.v1alpha.ICreateBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createBackup( - request: protos.google.cloud.metastore.v1alpha.ICreateBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request: protos.google.cloud.metastore.v1alpha.ICreateBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request?: protos.google.cloud.metastore.v1alpha.ICreateBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.create_backup.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateBackup_async - */ - async checkCreateBackupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the backup to delete, in the - * following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.delete_backup.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_async - */ - deleteBackup( - request?: protos.google.cloud.metastore.v1alpha.IDeleteBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteBackup( - request: protos.google.cloud.metastore.v1alpha.IDeleteBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request: protos.google.cloud.metastore.v1alpha.IDeleteBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request?: protos.google.cloud.metastore.v1alpha.IDeleteBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.delete_backup.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_async - */ - async checkDeleteBackupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteBackup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Query DPMS metadata. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.service - * Required. The relative resource name of the metastore service to query - * metadata, in the following format: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} request.query - * Required. A read-only SQL query to execute against the metadata database. - * The query cannot change or mutate the data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.query_metadata.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_QueryMetadata_async - */ - queryMetadata( - request?: protos.google.cloud.metastore.v1alpha.IQueryMetadataRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - queryMetadata( - request: protos.google.cloud.metastore.v1alpha.IQueryMetadataRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - queryMetadata( - request: protos.google.cloud.metastore.v1alpha.IQueryMetadataRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - queryMetadata( - request?: protos.google.cloud.metastore.v1alpha.IQueryMetadataRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.queryMetadata(request, options, callback); - } -/** - * Check the status of the long running operation returned by `queryMetadata()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.query_metadata.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_QueryMetadata_async - */ - async checkQueryMetadataProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.queryMetadata, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Move a table to another database. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.service - * Required. The relative resource name of the metastore service to mutate - * metadata, in the following format: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} request.tableName - * Required. The name of the table to be moved. - * @param {string} request.dbName - * Required. The name of the database where the table resides. - * @param {string} request.destinationDbName - * Required. The name of the database where the table should be moved. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.move_table_to_database.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_MoveTableToDatabase_async - */ - moveTableToDatabase( - request?: protos.google.cloud.metastore.v1alpha.IMoveTableToDatabaseRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - moveTableToDatabase( - request: protos.google.cloud.metastore.v1alpha.IMoveTableToDatabaseRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - moveTableToDatabase( - request: protos.google.cloud.metastore.v1alpha.IMoveTableToDatabaseRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - moveTableToDatabase( - request?: protos.google.cloud.metastore.v1alpha.IMoveTableToDatabaseRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.moveTableToDatabase(request, options, callback); - } -/** - * Check the status of the long running operation returned by `moveTableToDatabase()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.move_table_to_database.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_MoveTableToDatabase_async - */ - async checkMoveTableToDatabaseProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.moveTableToDatabase, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Alter metadata resource location. The metadata resource can be a database, - * table, or partition. This functionality only updates the parent directory - * for the respective metadata resource and does not transfer any existing - * data to the new location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.service - * Required. The relative resource name of the metastore service to mutate - * metadata, in the following format: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} request.resourceName - * Required. The relative metadata resource name in the following format. - * - * `databases/{database_id}` - * or - * `databases/{database_id}/tables/{table_id}` - * or - * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` - * @param {string} request.locationUri - * Required. The new location URI for the metadata 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.alter_metadata_resource_location.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_AlterMetadataResourceLocation_async - */ - alterMetadataResourceLocation( - request?: protos.google.cloud.metastore.v1alpha.IAlterMetadataResourceLocationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - alterMetadataResourceLocation( - request: protos.google.cloud.metastore.v1alpha.IAlterMetadataResourceLocationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - alterMetadataResourceLocation( - request: protos.google.cloud.metastore.v1alpha.IAlterMetadataResourceLocationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - alterMetadataResourceLocation( - request?: protos.google.cloud.metastore.v1alpha.IAlterMetadataResourceLocationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.alterMetadataResourceLocation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `alterMetadataResourceLocation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.alter_metadata_resource_location.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_AlterMetadataResourceLocation_async - */ - async checkAlterMetadataResourceLocationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.alterMetadataResourceLocation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists services in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1alpha.Service|Service}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listServicesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listServices( - request?: protos.google.cloud.metastore.v1alpha.IListServicesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1alpha.IService[], - protos.google.cloud.metastore.v1alpha.IListServicesRequest|null, - protos.google.cloud.metastore.v1alpha.IListServicesResponse - ]>; - listServices( - request: protos.google.cloud.metastore.v1alpha.IListServicesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListServicesRequest, - protos.google.cloud.metastore.v1alpha.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IService>): void; - listServices( - request: protos.google.cloud.metastore.v1alpha.IListServicesRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListServicesRequest, - protos.google.cloud.metastore.v1alpha.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IService>): void; - listServices( - request?: protos.google.cloud.metastore.v1alpha.IListServicesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListServicesRequest, - protos.google.cloud.metastore.v1alpha.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IService>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListServicesRequest, - protos.google.cloud.metastore.v1alpha.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IService>): - Promise<[ - protos.google.cloud.metastore.v1alpha.IService[], - protos.google.cloud.metastore.v1alpha.IListServicesRequest|null, - protos.google.cloud.metastore.v1alpha.IListServicesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listServices(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 protos.google.cloud.metastore.v1alpha.Service|Service} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listServicesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listServicesStream( - request?: protos.google.cloud.metastore.v1alpha.IListServicesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listServices.createStream( - this.innerApiCalls.listServices as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listServices`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.metastore.v1alpha.Service|Service}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.list_services.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_ListServices_async - */ - listServicesAsync( - request?: protos.google.cloud.metastore.v1alpha.IListServicesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listServices.asyncIterate( - this.innerApiCalls['listServices'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists imports in a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1alpha.MetadataImport|MetadataImport}. - * 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 `listMetadataImportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMetadataImports( - request?: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1alpha.IMetadataImport[], - protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest|null, - protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse - ]>; - listMetadataImports( - request: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IMetadataImport>): void; - listMetadataImports( - request: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IMetadataImport>): void; - listMetadataImports( - request?: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IMetadataImport>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IMetadataImport>): - Promise<[ - protos.google.cloud.metastore.v1alpha.IMetadataImport[], - protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest|null, - protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listMetadataImports(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 protos.google.cloud.metastore.v1alpha.MetadataImport|MetadataImport} 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 `listMetadataImportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMetadataImportsStream( - request?: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - 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['listMetadataImports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMetadataImports.createStream( - this.innerApiCalls.listMetadataImports as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMetadataImports`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.metastore.v1alpha.MetadataImport|MetadataImport}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_ListMetadataImports_async - */ - listMetadataImportsAsync( - request?: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - 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['listMetadataImports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMetadataImports.asyncIterate( - this.innerApiCalls['listMetadataImports'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists backups in a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1alpha.Backup|Backup}. - * 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 `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBackups( - request?: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1alpha.IBackup[], - protos.google.cloud.metastore.v1alpha.IListBackupsRequest|null, - protos.google.cloud.metastore.v1alpha.IListBackupsResponse - ]>; - listBackups( - request: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - protos.google.cloud.metastore.v1alpha.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IBackup>): void; - listBackups( - request: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - protos.google.cloud.metastore.v1alpha.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IBackup>): void; - listBackups( - request?: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - protos.google.cloud.metastore.v1alpha.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IBackup>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - protos.google.cloud.metastore.v1alpha.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IBackup>): - Promise<[ - protos.google.cloud.metastore.v1alpha.IBackup[], - protos.google.cloud.metastore.v1alpha.IListBackupsRequest|null, - protos.google.cloud.metastore.v1alpha.IListBackupsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listBackups(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 protos.google.cloud.metastore.v1alpha.Backup|Backup} 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 `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBackupsStream( - request?: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - 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['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.createStream( - this.innerApiCalls.listBackups as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBackups`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.metastore.v1alpha.Backup|Backup}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.list_backups.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_ListBackups_async - */ - listBackupsAsync( - request?: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - 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['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.asyncIterate( - this.innerApiCalls['listBackups'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project:string,location:string,service:string,backup:string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - location: location, - service: service, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the location from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).location; - } - - /** - * Parse the service from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the service. - */ - matchServiceFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).service; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified federation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} federation - * @returns {string} Resource name string. - */ - federationPath(project:string,location:string,federation:string) { - return this.pathTemplates.federationPathTemplate.render({ - project: project, - location: location, - federation: federation, - }); - } - - /** - * Parse the project from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).project; - } - - /** - * Parse the location from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).location; - } - - /** - * Parse the federation from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the federation. - */ - matchFederationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).federation; - } - - /** - * Return a fully-qualified lake resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} lake - * @returns {string} Resource name string. - */ - lakePath(project:string,location:string,lake:string) { - return this.pathTemplates.lakePathTemplate.render({ - project: project, - location: location, - lake: lake, - }); - } - - /** - * Parse the project from Lake resource. - * - * @param {string} lakeName - * A fully-qualified path representing Lake resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLakeName(lakeName: string) { - return this.pathTemplates.lakePathTemplate.match(lakeName).project; - } - - /** - * Parse the location from Lake resource. - * - * @param {string} lakeName - * A fully-qualified path representing Lake resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLakeName(lakeName: string) { - return this.pathTemplates.lakePathTemplate.match(lakeName).location; - } - - /** - * Parse the lake from Lake resource. - * - * @param {string} lakeName - * A fully-qualified path representing Lake resource. - * @returns {string} A string representing the lake. - */ - matchLakeFromLakeName(lakeName: string) { - return this.pathTemplates.lakePathTemplate.match(lakeName).lake; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified metadataImport resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} metadata_import - * @returns {string} Resource name string. - */ - metadataImportPath(project:string,location:string,service:string,metadataImport:string) { - return this.pathTemplates.metadataImportPathTemplate.render({ - project: project, - location: location, - service: service, - metadata_import: metadataImport, - }); - } - - /** - * Parse the project from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; - } - - /** - * Parse the location from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; - } - - /** - * Parse the service from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the service. - */ - matchServiceFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; - } - - /** - * Parse the metadata_import from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the metadata_import. - */ - matchMetadataImportFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; - } - - /** - * Return a fully-qualified network resource name string. - * - * @param {string} project - * @param {string} network - * @returns {string} Resource name string. - */ - networkPath(project:string,network:string) { - return this.pathTemplates.networkPathTemplate.render({ - project: project, - network: network, - }); - } - - /** - * Parse the project from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).project; - } - - /** - * Parse the network from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the network. - */ - matchNetworkFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).network; - } - - /** - * 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 service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - service: service, - }); - } - - /** - * Parse the project from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).project; - } - - /** - * Parse the location from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).location; - } - - /** - * Parse the service from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).service; - } - - /** - * 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.dataprocMetastoreStub && !this._terminated) { - return this.dataprocMetastoreStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client_config.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client_config.json deleted file mode 100644 index 961e7da4d36..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client_config.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "interfaces": { - "google.cloud.metastore.v1alpha.DataprocMetastore": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListServices": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetService": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListMetadataImports": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ExportMetadata": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RestoreService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBackups": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetBackup": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RemoveIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "QueryMetadata": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "MoveTableToDatabase": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "AlterMetadataResourceLocation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client.ts deleted file mode 100644 index 8a0de346bc0..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client.ts +++ /dev/null @@ -1,1714 +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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1alpha/dataproc_metastore_federation_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './dataproc_metastore_federation_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Configures and manages metastore federation services. - * Dataproc Metastore Federation Service allows federating a collection of - * backend metastores like BigQuery, Dataplex Lakes, and other Dataproc - * Metastores. The Federation Service exposes a gRPC URL through which metadata - * from the backend metastores are served at query time. - * - * The Dataproc Metastore Federation API defines the following resource model: - * * The service works with a collection of Google Cloud projects. - * * Each project has a collection of available locations. - * * Each location has a collection of federations. - * * Dataproc Metastore Federations are resources with names of the - * form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - * @class - * @memberof v1alpha - */ -export class DataprocMetastoreFederationClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - dataprocMetastoreFederationStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DataprocMetastoreFederationClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 DataprocMetastoreFederationClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DataprocMetastoreFederationClient; - 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; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - 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 = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' - ), - federationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/federations/{federation}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - metadataImportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ), - }; - - // 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 = { - listFederations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'federations') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createFederationResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.Federation') as gax.protobuf.Type; - const createFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const updateFederationResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.Federation') as gax.protobuf.Type; - const updateFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const deleteFederationResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createFederationResponse.decode.bind(createFederationResponse), - createFederationMetadata.decode.bind(createFederationMetadata)), - updateFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateFederationResponse.decode.bind(updateFederationResponse), - updateFederationMetadata.decode.bind(updateFederationMetadata)), - deleteFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteFederationResponse.decode.bind(deleteFederationResponse), - deleteFederationMetadata.decode.bind(deleteFederationMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.metastore.v1alpha.DataprocMetastoreFederation', 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.dataprocMetastoreFederationStub) { - return this.dataprocMetastoreFederationStub; - } - - // Put together the "service stub" for - // google.cloud.metastore.v1alpha.DataprocMetastoreFederation. - this.dataprocMetastoreFederationStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1alpha.DataprocMetastoreFederation') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.metastore.v1alpha.DataprocMetastoreFederation, - 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 dataprocMetastoreFederationStubMethods = - ['listFederations', 'getFederation', 'createFederation', 'updateFederation', 'deleteFederation']; - for (const methodName of dataprocMetastoreFederationStubMethods) { - const callPromise = this.dataprocMetastoreFederationStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.dataprocMetastoreFederationStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'metastore.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 'metastore.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 -- - // ------------------- -/** - * Gets the details of a single federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore federation to - * retrieve, in the following form: - * - * `projects/{project_number}/locations/{location_id}/federations/{federation_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 protos.google.cloud.metastore.v1alpha.Federation|Federation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js - * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_GetFederation_async - */ - getFederation( - request?: protos.google.cloud.metastore.v1alpha.IGetFederationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1alpha.IFederation, - protos.google.cloud.metastore.v1alpha.IGetFederationRequest|undefined, {}|undefined - ]>; - getFederation( - request: protos.google.cloud.metastore.v1alpha.IGetFederationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IFederation, - protos.google.cloud.metastore.v1alpha.IGetFederationRequest|null|undefined, - {}|null|undefined>): void; - getFederation( - request: protos.google.cloud.metastore.v1alpha.IGetFederationRequest, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IFederation, - protos.google.cloud.metastore.v1alpha.IGetFederationRequest|null|undefined, - {}|null|undefined>): void; - getFederation( - request?: protos.google.cloud.metastore.v1alpha.IGetFederationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1alpha.IFederation, - protos.google.cloud.metastore.v1alpha.IGetFederationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1alpha.IFederation, - protos.google.cloud.metastore.v1alpha.IGetFederationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1alpha.IFederation, - protos.google.cloud.metastore.v1alpha.IGetFederationRequest|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.getFederation(request, options, callback); - } - -/** - * Creates a metastore federation in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location in which to create a - * federation service, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {string} request.federationId - * Required. The ID of the metastore federation, which is used as the final - * component of the metastore federation's name. - * - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - * @param {google.cloud.metastore.v1alpha.Federation} request.federation - * Required. The Metastore Federation to create. The `name` field is - * ignored. The ID of the created metastore federation must be - * provided in the request's `federation_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js - * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_async - */ - createFederation( - request?: protos.google.cloud.metastore.v1alpha.ICreateFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createFederation( - request: protos.google.cloud.metastore.v1alpha.ICreateFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFederation( - request: protos.google.cloud.metastore.v1alpha.ICreateFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFederation( - request?: protos.google.cloud.metastore.v1alpha.ICreateFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js - * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_async - */ - async checkCreateFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the fields of a federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metastore federation resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1alpha.Federation} request.federation - * Required. The metastore federation to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * - * The metastore federation's `name` field is used to identify the - * metastore service to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js - * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_async - */ - updateFederation( - request?: protos.google.cloud.metastore.v1alpha.IUpdateFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateFederation( - request: protos.google.cloud.metastore.v1alpha.IUpdateFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFederation( - request: protos.google.cloud.metastore.v1alpha.IUpdateFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFederation( - request?: protos.google.cloud.metastore.v1alpha.IUpdateFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'federation.name': request.federation!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js - * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_async - */ - async checkUpdateFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore federation to delete, - * in the following form: - * - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js - * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_async - */ - deleteFederation( - request?: protos.google.cloud.metastore.v1alpha.IDeleteFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteFederation( - request: protos.google.cloud.metastore.v1alpha.IDeleteFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFederation( - request: protos.google.cloud.metastore.v1alpha.IDeleteFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFederation( - request?: protos.google.cloud.metastore.v1alpha.IDeleteFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js - * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_async - */ - async checkDeleteFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists federations in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore - * federations to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1alpha.Federation|Federation}. - * 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 `listFederationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFederations( - request?: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1alpha.IFederation[], - protos.google.cloud.metastore.v1alpha.IListFederationsRequest|null, - protos.google.cloud.metastore.v1alpha.IListFederationsResponse - ]>; - listFederations( - request: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - protos.google.cloud.metastore.v1alpha.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IFederation>): void; - listFederations( - request: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - protos.google.cloud.metastore.v1alpha.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IFederation>): void; - listFederations( - request?: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - protos.google.cloud.metastore.v1alpha.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IFederation>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - protos.google.cloud.metastore.v1alpha.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IFederation>): - Promise<[ - protos.google.cloud.metastore.v1alpha.IFederation[], - protos.google.cloud.metastore.v1alpha.IListFederationsRequest|null, - protos.google.cloud.metastore.v1alpha.IListFederationsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listFederations(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore - * federations to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 protos.google.cloud.metastore.v1alpha.Federation|Federation} 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 `listFederationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFederationsStream( - request?: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - 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['listFederations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFederations.createStream( - this.innerApiCalls.listFederations as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFederations`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore - * federations to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.metastore.v1alpha.Federation|Federation}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js - * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_ListFederations_async - */ - listFederationsAsync( - request?: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - 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['listFederations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFederations.asyncIterate( - this.innerApiCalls['listFederations'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project:string,location:string,service:string,backup:string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - location: location, - service: service, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the location from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).location; - } - - /** - * Parse the service from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the service. - */ - matchServiceFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).service; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified federation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} federation - * @returns {string} Resource name string. - */ - federationPath(project:string,location:string,federation:string) { - return this.pathTemplates.federationPathTemplate.render({ - project: project, - location: location, - federation: federation, - }); - } - - /** - * Parse the project from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).project; - } - - /** - * Parse the location from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).location; - } - - /** - * Parse the federation from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the federation. - */ - matchFederationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).federation; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified metadataImport resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} metadata_import - * @returns {string} Resource name string. - */ - metadataImportPath(project:string,location:string,service:string,metadataImport:string) { - return this.pathTemplates.metadataImportPathTemplate.render({ - project: project, - location: location, - service: service, - metadata_import: metadataImport, - }); - } - - /** - * Parse the project from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; - } - - /** - * Parse the location from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; - } - - /** - * Parse the service from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the service. - */ - matchServiceFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; - } - - /** - * Parse the metadata_import from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the metadata_import. - */ - matchMetadataImportFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; - } - - /** - * 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 service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - service: service, - }); - } - - /** - * Parse the project from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).project; - } - - /** - * Parse the location from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).location; - } - - /** - * Parse the service from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).service; - } - - /** - * 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.dataprocMetastoreFederationStub && !this._terminated) { - return this.dataprocMetastoreFederationStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client_config.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client_config.json deleted file mode 100644 index f764c70b10a..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.metastore.v1alpha.DataprocMetastoreFederation": { - "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": { - "ListFederations": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_proto_list.json deleted file mode 100644 index 5aa3fc8ef92..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/metastore/v1alpha/metastore.proto", - "../../protos/google/cloud/metastore/v1alpha/metastore_federation.proto" -] diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_proto_list.json deleted file mode 100644 index 5aa3fc8ef92..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/metastore/v1alpha/metastore.proto", - "../../protos/google/cloud/metastore/v1alpha/metastore_federation.proto" -] diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/gapic_metadata.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/gapic_metadata.json deleted file mode 100644 index 6c32defcc30..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/gapic_metadata.json +++ /dev/null @@ -1,293 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.metastore.v1alpha", - "libraryPackage": "@google-cloud/dataproc-metastore", - "services": { - "DataprocMetastore": { - "clients": { - "grpc": { - "libraryClient": "DataprocMetastoreClient", - "rpcs": { - "GetService": { - "methods": [ - "getService" - ] - }, - "GetMetadataImport": { - "methods": [ - "getMetadataImport" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "RemoveIamPolicy": { - "methods": [ - "removeIamPolicy" - ] - }, - "CreateService": { - "methods": [ - "createService" - ] - }, - "UpdateService": { - "methods": [ - "updateService" - ] - }, - "DeleteService": { - "methods": [ - "deleteService" - ] - }, - "CreateMetadataImport": { - "methods": [ - "createMetadataImport" - ] - }, - "UpdateMetadataImport": { - "methods": [ - "updateMetadataImport" - ] - }, - "ExportMetadata": { - "methods": [ - "exportMetadata" - ] - }, - "RestoreService": { - "methods": [ - "restoreService" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "QueryMetadata": { - "methods": [ - "queryMetadata" - ] - }, - "MoveTableToDatabase": { - "methods": [ - "moveTableToDatabase" - ] - }, - "AlterMetadataResourceLocation": { - "methods": [ - "alterMetadataResourceLocation" - ] - }, - "ListServices": { - "methods": [ - "listServices", - "listServicesStream", - "listServicesAsync" - ] - }, - "ListMetadataImports": { - "methods": [ - "listMetadataImports", - "listMetadataImportsStream", - "listMetadataImportsAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "DataprocMetastoreClient", - "rpcs": { - "GetService": { - "methods": [ - "getService" - ] - }, - "GetMetadataImport": { - "methods": [ - "getMetadataImport" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "RemoveIamPolicy": { - "methods": [ - "removeIamPolicy" - ] - }, - "CreateService": { - "methods": [ - "createService" - ] - }, - "UpdateService": { - "methods": [ - "updateService" - ] - }, - "DeleteService": { - "methods": [ - "deleteService" - ] - }, - "CreateMetadataImport": { - "methods": [ - "createMetadataImport" - ] - }, - "UpdateMetadataImport": { - "methods": [ - "updateMetadataImport" - ] - }, - "ExportMetadata": { - "methods": [ - "exportMetadata" - ] - }, - "RestoreService": { - "methods": [ - "restoreService" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "QueryMetadata": { - "methods": [ - "queryMetadata" - ] - }, - "MoveTableToDatabase": { - "methods": [ - "moveTableToDatabase" - ] - }, - "AlterMetadataResourceLocation": { - "methods": [ - "alterMetadataResourceLocation" - ] - }, - "ListServices": { - "methods": [ - "listServices", - "listServicesStream", - "listServicesAsync" - ] - }, - "ListMetadataImports": { - "methods": [ - "listMetadataImports", - "listMetadataImportsStream", - "listMetadataImportsAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - } - } - }, - "DataprocMetastoreFederation": { - "clients": { - "grpc": { - "libraryClient": "DataprocMetastoreFederationClient", - "rpcs": { - "GetFederation": { - "methods": [ - "getFederation" - ] - }, - "CreateFederation": { - "methods": [ - "createFederation" - ] - }, - "UpdateFederation": { - "methods": [ - "updateFederation" - ] - }, - "DeleteFederation": { - "methods": [ - "deleteFederation" - ] - }, - "ListFederations": { - "methods": [ - "listFederations", - "listFederationsStream", - "listFederationsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "DataprocMetastoreFederationClient", - "rpcs": { - "GetFederation": { - "methods": [ - "getFederation" - ] - }, - "CreateFederation": { - "methods": [ - "createFederation" - ] - }, - "UpdateFederation": { - "methods": [ - "updateFederation" - ] - }, - "DeleteFederation": { - "methods": [ - "deleteFederation" - ] - }, - "ListFederations": { - "methods": [ - "listFederations", - "listFederationsStream", - "listFederationsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/index.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/index.ts deleted file mode 100644 index 74baf047ec9..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/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 {DataprocMetastoreClient} from './dataproc_metastore_client'; -export {DataprocMetastoreFederationClient} from './dataproc_metastore_federation_client'; diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 2d137ce8c89..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/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 metastore = require('@google-cloud/dataproc-metastore'); - -function main() { - const dataprocMetastoreClient = new metastore.DataprocMetastoreClient(); - const dataprocMetastoreFederationClient = new metastore.DataprocMetastoreFederationClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 15fe58ac669..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/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 {DataprocMetastoreClient, DataprocMetastoreFederationClient} from '@google-cloud/dataproc-metastore'; - -// check that the client class type name can be used -function doStuffWithDataprocMetastoreClient(client: DataprocMetastoreClient) { - client.close(); -} -function doStuffWithDataprocMetastoreFederationClient(client: DataprocMetastoreFederationClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const dataprocMetastoreClient = new DataprocMetastoreClient(); - doStuffWithDataprocMetastoreClient(dataprocMetastoreClient); - // check that the client instance can be created - const dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); - doStuffWithDataprocMetastoreFederationClient(dataprocMetastoreFederationClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/install.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/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-metastore/v1alpha/test/gapic_dataproc_metastore_federation_v1alpha.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_federation_v1alpha.ts deleted file mode 100644 index 479f5fdeeff..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_federation_v1alpha.ts +++ /dev/null @@ -1,2000 +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 dataprocmetastorefederationModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1alpha.DataprocMetastoreFederationClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); - await client.initialize(); - assert(client.dataprocMetastoreFederationStub); - }); - - it('has close method for the initialized client', done => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.dataprocMetastoreFederationStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - 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 dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - 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('getFederation', () => { - it('invokes getFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.Federation() - ); - client.innerApiCalls.getFederation = stubSimpleCall(expectedResponse); - const [response] = await client.getFederation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.Federation() - ); - client.innerApiCalls.getFederation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFederation( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IFederation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFederation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation with closed client', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFederation(request), expectedError); - }); - }); - - describe('createFederation', () => { - it('invokes createFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateFederation', () => { - it('invokes updateFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteFederation', () => { - it('invokes deleteFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listFederations', () => { - it('invokes listFederations without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - ]; - client.innerApiCalls.listFederations = stubSimpleCall(expectedResponse); - const [response] = await client.listFederations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederations without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - ]; - client.innerApiCalls.listFederations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFederations( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IFederation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederations with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFederations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFederations(request), expectedError); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederationsStream without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - ]; - client.descriptors.page.listFederations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFederationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1alpha.Federation[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Federation) => { - 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.listFederations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); - assert( - (client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFederationsStream with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFederations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFederationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1alpha.Federation[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Federation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); - assert( - (client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFederations without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - ]; - client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1alpha.IFederation[] = []; - const iterable = client.listFederationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFederations with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFederationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1alpha.IFederation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('backup', () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - backup: "backupValue", - }; - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackupName', () => { - const result = client.matchLocationFromBackupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromBackupName', () => { - const result = client.matchServiceFromBackupName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('federation', () => { - const fakePath = "/rendered/path/federation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - federation: "federationValue", - }; - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.federationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.federationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('federationPath', () => { - const result = client.federationPath("projectValue", "locationValue", "federationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.federationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFederationName', () => { - const result = client.matchProjectFromFederationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFederationName', () => { - const result = client.matchLocationFromFederationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFederationFromFederationName', () => { - const result = client.matchFederationFromFederationName(fakePath); - assert.strictEqual(result, "federationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('metadataImport', () => { - const fakePath = "/rendered/path/metadataImport"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - metadata_import: "metadataImportValue", - }; - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.metadataImportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.metadataImportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('metadataImportPath', () => { - const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMetadataImportName', () => { - const result = client.matchProjectFromMetadataImportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMetadataImportName', () => { - const result = client.matchLocationFromMetadataImportName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromMetadataImportName', () => { - const result = client.matchServiceFromMetadataImportName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetadataImportFromMetadataImportName', () => { - const result = client.matchMetadataImportFromMetadataImportName(fakePath); - assert.strictEqual(result, "metadataImportValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - 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('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - }; - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePath', () => { - const result = client.servicePath("projectValue", "locationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceName', () => { - const result = client.matchProjectFromServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServiceName', () => { - const result = client.matchLocationFromServiceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_v1alpha.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_v1alpha.ts deleted file mode 100644 index 5eb9c5c1346..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_v1alpha.ts +++ /dev/null @@ -1,4288 +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 dataprocmetastoreModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1alpha.DataprocMetastoreClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = dataprocmetastoreModule.v1alpha.DataprocMetastoreClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = dataprocmetastoreModule.v1alpha.DataprocMetastoreClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = dataprocmetastoreModule.v1alpha.DataprocMetastoreClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreStub, undefined); - await client.initialize(); - assert(client.dataprocMetastoreStub); - }); - - it('has close method for the initialized client', done => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.dataprocMetastoreStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - 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 dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - 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('getService', () => { - it('invokes getService without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.Service() - ); - client.innerApiCalls.getService = stubSimpleCall(expectedResponse); - const [response] = await client.getService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.Service() - ); - client.innerApiCalls.getService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getService( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IService|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getService(request), expectedError); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with closed client', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getService(request), expectedError); - }); - }); - - describe('getMetadataImport', () => { - it('invokes getMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.MetadataImport() - ); - client.innerApiCalls.getMetadataImport = stubSimpleCall(expectedResponse); - const [response] = await client.getMetadataImport(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.MetadataImport() - ); - client.innerApiCalls.getMetadataImport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMetadataImport( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IMetadataImport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMetadataImport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport with closed client', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getMetadataImport(request), expectedError); - }); - }); - - describe('getBackup', () => { - it('invokes getBackup without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); - const [response] = await client.getBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackup( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IBackup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with closed client', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBackup(request), expectedError); - }); - }); - - describe('removeIamPolicy', () => { - it('invokes removeIamPolicy without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.RemoveIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.RemoveIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.RemoveIamPolicyResponse() - ); - client.innerApiCalls.removeIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.removeIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeIamPolicy without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.RemoveIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.RemoveIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.RemoveIamPolicyResponse() - ); - client.innerApiCalls.removeIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeIamPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IRemoveIamPolicyResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeIamPolicy with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.RemoveIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.RemoveIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.removeIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.removeIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeIamPolicy with closed client', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.RemoveIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.RemoveIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.removeIamPolicy(request), expectedError); - }); - }); - - describe('createService', () => { - it('invokes createService without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createService = stubLongRunningCall(expectedResponse); - const [operation] = await client.createService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createService(request), expectedError); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateService', () => { - it('invokes updateService without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateService = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateService(request), expectedError); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteService', () => { - it('invokes deleteService without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteService = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteService(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createMetadataImport', () => { - it('invokes createMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMetadataImport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMetadataImport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMetadataImport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMetadataImport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateMetadataImportProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateMetadataImportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateMetadataImportProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMetadataImportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateMetadataImport', () => { - it('invokes updateMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMetadataImport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMetadataImport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMetadataImport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMetadataImport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateMetadataImportProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateMetadataImportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateMetadataImportProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMetadataImportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('exportMetadata', () => { - it('invokes exportMetadata without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportMetadata = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportMetadata(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportMetadata = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportMetadata( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportMetadata(request), expectedError); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportMetadata(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportMetadataProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportMetadataProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportMetadataProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportMetadataProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('restoreService', () => { - it('invokes restoreService without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.restoreService = stubLongRunningCall(expectedResponse); - const [operation] = await client.restoreService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.restoreService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.restoreService(request), expectedError); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.restoreService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRestoreServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRestoreServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRestoreServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRestoreServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createBackup', () => { - it('invokes createBackup without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBackup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateBackupProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateBackupProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteBackup', () => { - it('invokes deleteBackup without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteBackup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteBackupProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteBackupProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('queryMetadata', () => { - it('invokes queryMetadata without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.QueryMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.QueryMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.queryMetadata = stubLongRunningCall(expectedResponse); - const [operation] = await client.queryMetadata(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes queryMetadata without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.QueryMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.QueryMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.queryMetadata = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.queryMetadata( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes queryMetadata with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.QueryMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.QueryMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.queryMetadata = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.queryMetadata(request), expectedError); - const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes queryMetadata with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.QueryMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.QueryMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.queryMetadata = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.queryMetadata(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkQueryMetadataProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkQueryMetadataProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkQueryMetadataProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkQueryMetadataProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('moveTableToDatabase', () => { - it('invokes moveTableToDatabase without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.MoveTableToDatabaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.MoveTableToDatabaseRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(expectedResponse); - const [operation] = await client.moveTableToDatabase(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes moveTableToDatabase without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.MoveTableToDatabaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.MoveTableToDatabaseRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.moveTableToDatabase = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.moveTableToDatabase( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes moveTableToDatabase with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.MoveTableToDatabaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.MoveTableToDatabaseRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.moveTableToDatabase(request), expectedError); - const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes moveTableToDatabase with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.MoveTableToDatabaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.MoveTableToDatabaseRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.moveTableToDatabase(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkMoveTableToDatabaseProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkMoveTableToDatabaseProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkMoveTableToDatabaseProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkMoveTableToDatabaseProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('alterMetadataResourceLocation', () => { - it('invokes alterMetadataResourceLocation without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(expectedResponse); - const [operation] = await client.alterMetadataResourceLocation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes alterMetadataResourceLocation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.alterMetadataResourceLocation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes alterMetadataResourceLocation with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.alterMetadataResourceLocation(request), expectedError); - const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes alterMetadataResourceLocation with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.AlterMetadataResourceLocationRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.alterMetadataResourceLocation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAlterMetadataResourceLocationProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAlterMetadataResourceLocationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAlterMetadataResourceLocationProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAlterMetadataResourceLocationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listServices', () => { - it('invokes listServices without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); - const [response] = await client.listServices(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServices( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IService[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServices = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServices(request), expectedError); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServicesStream without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - ]; - client.descriptors.page.listServices.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1alpha.Service[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listServicesStream with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1alpha.Service[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServices without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - ]; - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1alpha.IService[] = []; - const iterable = client.listServicesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServices with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServicesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1alpha.IService[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listMetadataImports', () => { - it('invokes listMetadataImports without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - ]; - client.innerApiCalls.listMetadataImports = stubSimpleCall(expectedResponse); - const [response] = await client.listMetadataImports(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImports without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - ]; - client.innerApiCalls.listMetadataImports = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMetadataImports( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IMetadataImport[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImports with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMetadataImports = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMetadataImports(request), expectedError); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImportsStream without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - ]; - client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMetadataImportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1alpha.MetadataImport[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1alpha.MetadataImport) => { - 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.listMetadataImports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); - assert( - (client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listMetadataImportsStream with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMetadataImportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1alpha.MetadataImport[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1alpha.MetadataImport) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); - assert( - (client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMetadataImports without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - ]; - client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1alpha.IMetadataImport[] = []; - const iterable = client.listMetadataImportsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMetadataImports with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMetadataImportsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1alpha.IMetadataImport[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listBackups', () => { - it('invokes listBackups without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); - const [response] = await client.listBackups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackups( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IBackup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBackups(request), expectedError); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackupsStream without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - ]; - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1alpha.Backup[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Backup) => { - 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.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBackupsStream with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1alpha.Backup[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackups without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - ]; - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1alpha.IBackup[] = []; - const iterable = client.listBackupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackups with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBackupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1alpha.IBackup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('backup', () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - backup: "backupValue", - }; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackupName', () => { - const result = client.matchLocationFromBackupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromBackupName', () => { - const result = client.matchServiceFromBackupName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('federation', () => { - const fakePath = "/rendered/path/federation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - federation: "federationValue", - }; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.federationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.federationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('federationPath', () => { - const result = client.federationPath("projectValue", "locationValue", "federationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.federationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFederationName', () => { - const result = client.matchProjectFromFederationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFederationName', () => { - const result = client.matchLocationFromFederationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFederationFromFederationName', () => { - const result = client.matchFederationFromFederationName(fakePath); - assert.strictEqual(result, "federationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('lake', () => { - const fakePath = "/rendered/path/lake"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - lake: "lakeValue", - }; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.lakePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.lakePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('lakePath', () => { - const result = client.lakePath("projectValue", "locationValue", "lakeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.lakePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLakeName', () => { - const result = client.matchProjectFromLakeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.lakePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLakeName', () => { - const result = client.matchLocationFromLakeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.lakePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLakeFromLakeName', () => { - const result = client.matchLakeFromLakeName(fakePath); - assert.strictEqual(result, "lakeValue"); - assert((client.pathTemplates.lakePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('metadataImport', () => { - const fakePath = "/rendered/path/metadataImport"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - metadata_import: "metadataImportValue", - }; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.metadataImportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.metadataImportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('metadataImportPath', () => { - const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMetadataImportName', () => { - const result = client.matchProjectFromMetadataImportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMetadataImportName', () => { - const result = client.matchLocationFromMetadataImportName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromMetadataImportName', () => { - const result = client.matchServiceFromMetadataImportName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetadataImportFromMetadataImportName', () => { - const result = client.matchMetadataImportFromMetadataImportName(fakePath); - assert.strictEqual(result, "metadataImportValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('network', () => { - const fakePath = "/rendered/path/network"; - const expectedParameters = { - project: "projectValue", - network: "networkValue", - }; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.networkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath("projectValue", "networkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkFromNetworkName', () => { - const result = client.matchNetworkFromNetworkName(fakePath); - assert.strictEqual(result, "networkValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - 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('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - }; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePath', () => { - const result = client.servicePath("projectValue", "locationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceName', () => { - const result = client.matchProjectFromServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServiceName', () => { - const result = client.matchLocationFromServiceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/tsconfig.json b/owl-bot-staging/google-cloud-metastore/v1alpha/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/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-metastore/v1alpha/webpack.config.js b/owl-bot-staging/google-cloud-metastore/v1alpha/webpack.config.js deleted file mode 100644 index 6fc45cb3d30..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/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: 'DataprocMetastore', - filename: './dataproc-metastore.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-metastore/v1beta/.eslintignore b/owl-bot-staging/google-cloud-metastore/v1beta/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/.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-metastore/v1beta/.eslintrc.json b/owl-bot-staging/google-cloud-metastore/v1beta/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/.gitignore b/owl-bot-staging/google-cloud-metastore/v1beta/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/.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-metastore/v1beta/.jsdoc.js b/owl-bot-staging/google-cloud-metastore/v1beta/.jsdoc.js deleted file mode 100644 index 77430ad8c15..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/.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/dataproc-metastore', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/.mocharc.js b/owl-bot-staging/google-cloud-metastore/v1beta/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/.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-metastore/v1beta/.prettierrc.js b/owl-bot-staging/google-cloud-metastore/v1beta/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/.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-metastore/v1beta/README.md b/owl-bot-staging/google-cloud-metastore/v1beta/README.md deleted file mode 100644 index 24afb9017c6..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/README.md +++ /dev/null @@ -1 +0,0 @@ -Metastore: Nodejs Client diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/package.json b/owl-bot-staging/google-cloud-metastore/v1beta/package.json deleted file mode 100644 index e14926927ea..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "@google-cloud/dataproc-metastore", - "version": "0.1.0", - "description": "Metastore client for Node.js", - "repository": "googleapis/nodejs-metastore", - "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 metastore", - "metastore", - "dataproc metastore", - "dataproc metastore federation" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore.proto b/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore.proto deleted file mode 100644 index 88718fdf718..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore.proto +++ /dev/null @@ -1,1681 +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 -// -// 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.metastore.v1beta; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; -import "google/type/dayofweek.proto"; - -option go_package = "cloud.google.com/go/metastore/apiv1beta/metastorepb;metastorepb"; -option java_multiple_files = true; -option java_outer_classname = "MetastoreProto"; -option java_package = "com.google.cloud.metastore.v1beta"; -option php_namespace = "Google\\Cloud\\Metastore\\V1beta"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Network" - pattern: "projects/{project}/global/networks/{network}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Subnetwork" - pattern: "projects/{project}/regions/{region}/subnetworks/{subnetwork}" -}; -option (google.api.resource_definition) = { - type: "dataplex.googleapis.com/Lake" - pattern: "projects/{project}/locations/{location}/lakes/{lake}" -}; - -// Configures and manages metastore services. -// Metastore services are fully managed, highly available, autoscaled, -// autohealing, OSS-native deployments of technical metadata management -// software. Each metastore service exposes a network endpoint through which -// metadata queries are served. Metadata queries can originate from a variety -// of sources, including Apache Hive, Apache Presto, and Apache Spark. -// -// The Dataproc Metastore API defines the following resource model: -// -// * The service works with a collection of Google Cloud projects, named: -// `/projects/*` -// * Each project has a collection of available locations, named: `/locations/*` -// (a location must refer to a Google Cloud `region`) -// * Each location has a collection of services, named: `/services/*` -// * Dataproc Metastore services are resources with names of the form: -// -// `/projects/{project_number}/locations/{location_id}/services/{service_id}`. -service DataprocMetastore { - option (google.api.default_host) = "metastore.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists services in a project and location. - rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/locations/*}/services" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a single service. - rpc GetService(GetServiceRequest) returns (Service) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/locations/*/services/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a metastore service in a project and location. - rpc CreateService(CreateServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{parent=projects/*/locations/*}/services" - body: "service" - }; - option (google.api.method_signature) = "parent,service,service_id"; - option (google.longrunning.operation_info) = { - response_type: "Service" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Updates the parameters of a single service. - rpc UpdateService(UpdateServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta/{service.name=projects/*/locations/*/services/*}" - body: "service" - }; - option (google.api.method_signature) = "service,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Service" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Deletes a single service. - rpc DeleteService(DeleteServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta/{name=projects/*/locations/*/services/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Lists imports in a service. - rpc ListMetadataImports(ListMetadataImportsRequest) - returns (ListMetadataImportsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/locations/*/services/*}/metadataImports" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single import. - rpc GetMetadataImport(GetMetadataImportRequest) returns (MetadataImport) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/locations/*/services/*/metadataImports/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new MetadataImport in a given project and location. - rpc CreateMetadataImport(CreateMetadataImportRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{parent=projects/*/locations/*/services/*}/metadataImports" - body: "metadata_import" - }; - option (google.api.method_signature) = - "parent,metadata_import,metadata_import_id"; - option (google.longrunning.operation_info) = { - response_type: "MetadataImport" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Updates a single import. - // Only the description field of MetadataImport is supported to be updated. - rpc UpdateMetadataImport(UpdateMetadataImportRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta/{metadata_import.name=projects/*/locations/*/services/*/metadataImports/*}" - body: "metadata_import" - }; - option (google.api.method_signature) = "metadata_import,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "MetadataImport" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Exports metadata from a service. - rpc ExportMetadata(ExportMetadataRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{service=projects/*/locations/*/services/*}:exportMetadata" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "MetadataExport" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Restores a service from a backup. - rpc RestoreService(RestoreServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{service=projects/*/locations/*/services/*}:restore" - body: "*" - }; - option (google.api.method_signature) = "service,backup"; - option (google.longrunning.operation_info) = { - response_type: "Restore" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Lists backups in a service. - rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/locations/*/services/*}/backups" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single backup. - rpc GetBackup(GetBackupRequest) returns (Backup) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/locations/*/services/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new backup in a given project and location. - rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{parent=projects/*/locations/*/services/*}/backups" - body: "backup" - }; - option (google.api.method_signature) = "parent,backup,backup_id"; - option (google.longrunning.operation_info) = { - response_type: "Backup" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Deletes a single backup. - rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta/{name=projects/*/locations/*/services/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Removes the attached IAM policies for a resource - rpc RemoveIamPolicy(RemoveIamPolicyRequest) - returns (RemoveIamPolicyResponse) { - option (google.api.http) = { - post: "/v1beta/{resource=projects/*/locations/*/services/*/**}:removeIamPolicy" - body: "*" - }; - } - - // Query DPMS metadata. - rpc QueryMetadata(QueryMetadataRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{service=projects/*/locations/*/services/*}:queryMetadata" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "QueryMetadataResponse" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Move a table to another database. - rpc MoveTableToDatabase(MoveTableToDatabaseRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{service=projects/*/locations/*/services/*}:moveTableToDatabase" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "MoveTableToDatabaseResponse" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Alter metadata resource location. The metadata resource can be a database, - // table, or partition. This functionality only updates the parent directory - // for the respective metadata resource and does not transfer any existing - // data to the new location. - rpc AlterMetadataResourceLocation(AlterMetadataResourceLocationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{service=projects/*/locations/*/services/*}:alterLocation" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "AlterMetadataResourceLocationResponse" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } -} - -// A managed metastore service that serves metadata queries. -message Service { - option (google.api.resource) = { - type: "metastore.googleapis.com/Service" - pattern: "projects/{project}/locations/{location}/services/{service}" - }; - - // The current state of the metastore service. - enum State { - // The state of the metastore service is unknown. - STATE_UNSPECIFIED = 0; - - // The metastore service is in the process of being created. - CREATING = 1; - - // The metastore service is running and ready to serve queries. - ACTIVE = 2; - - // The metastore service is entering suspension. Its query-serving - // availability may cease unexpectedly. - SUSPENDING = 3; - - // The metastore service is suspended and unable to serve queries. - SUSPENDED = 4; - - // The metastore service is being updated. It remains usable but cannot - // accept additional update requests or be deleted at this time. - UPDATING = 5; - - // The metastore service is undergoing deletion. It cannot be used. - DELETING = 6; - - // The metastore service has encountered an error and cannot be used. The - // metastore service should be deleted. - ERROR = 7; - } - - // Available service tiers. - enum Tier { - // The tier is not set. - TIER_UNSPECIFIED = 0; - - // The developer tier provides limited scalability and no fault tolerance. - // Good for low-cost proof-of-concept. - DEVELOPER = 1; - - // The enterprise tier provides multi-zone high availability, and sufficient - // scalability for enterprise-level Dataproc Metastore workloads. - ENTERPRISE = 3; - } - - // Release channels bundle features of varying levels of stability. Newer - // features may be introduced initially into less stable release channels and - // can be automatically promoted into more stable release channels. - enum ReleaseChannel { - // Release channel is not specified. - RELEASE_CHANNEL_UNSPECIFIED = 0; - - // The `CANARY` release channel contains the newest features, which may be - // unstable and subject to unresolved issues with no known workarounds. - // Services using the `CANARY` release channel are not subject to any SLAs. - CANARY = 1; - - // The `STABLE` release channel contains features that are considered stable - // and have been validated for production use. - STABLE = 2; - } - - // The backend database type for the metastore service. - enum DatabaseType { - // The DATABASE_TYPE is not set. - DATABASE_TYPE_UNSPECIFIED = 0; - - // MySQL is used to persist the metastore data. - MYSQL = 1; - - // Spanner is used to persist the metastore data. - SPANNER = 2; - } - - // Configuration properties specific to the underlying metastore service - // technology (the software that serves metastore queries). - oneof metastore_config { - // Configuration information specific to running Hive metastore - // software as the metastore service. - HiveMetastoreConfig hive_metastore_config = 5; - } - - // Immutable. The relative resource name of the metastore service, in the - // following format: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the metastore service was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metastore service was last updated. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-defined labels for the metastore service. - map labels = 4; - - // Immutable. The relative resource name of the VPC network on which the - // instance can be accessed. It is specified in the following form: - // - // `projects/{project_number}/global/networks/{network_id}`. - string network = 7 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; - - // Output only. The URI of the endpoint used to access the metastore service. - string endpoint_uri = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The TCP port at which the metastore service is reached. Default: 9083. - int32 port = 9; - - // Output only. The current state of the metastore service. - State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current state of the - // metastore service, if available. - string state_message = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A Cloud Storage URI (starting with `gs://`) that specifies - // where artifacts related to the metastore service are stored. - string artifact_gcs_uri = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The tier of the service. - Tier tier = 13; - - // The setting that defines how metastore metadata should be integrated with - // external services and systems. - MetadataIntegration metadata_integration = 14; - - // The one hour maintenance window of the metastore service. This specifies - // when the service can be restarted for maintenance purposes in UTC time. - // Maintenance window is not needed for services with the SPANNER - // database type. - MaintenanceWindow maintenance_window = 15; - - // Output only. The globally unique resource identifier of the metastore - // service. - string uid = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The metadata management activities of the metastore service. - MetadataManagementActivity metadata_management_activity = 17 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Immutable. The release channel of the service. - // If unspecified, defaults to `STABLE`. - ReleaseChannel release_channel = 19 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. Information used to configure the Dataproc Metastore service to - // encrypt customer data at rest. Cannot be updated. - EncryptionConfig encryption_config = 20 - [(google.api.field_behavior) = IMMUTABLE]; - - // The configuration specifying the network settings for the - // Dataproc Metastore service. - NetworkConfig network_config = 21; - - // Immutable. The database type that the Metastore service stores its data. - DatabaseType database_type = 22 [(google.api.field_behavior) = IMMUTABLE]; - - // The configuration specifying telemetry settings for the Dataproc Metastore - // service. If unspecified defaults to `JSON`. - TelemetryConfig telemetry_config = 23; - - // Scaling configuration of the metastore service. - ScalingConfig scaling_config = 24; -} - -// Specifies how metastore metadata should be integrated with external services. -message MetadataIntegration { - // The integration config for the Data Catalog service. - DataCatalogConfig data_catalog_config = 1; - - // The integration config for the Dataplex service. - DataplexConfig dataplex_config = 2; -} - -// Specifies how metastore metadata should be integrated with the Data Catalog -// service. -message DataCatalogConfig { - // Defines whether the metastore metadata should be synced to Data Catalog. - // The default value is to disable syncing metastore metadata to Data Catalog. - bool enabled = 2; -} - -// Specifies how metastore metadata should be integrated with the Dataplex -// service. -message DataplexConfig { - // A reference to the Lake resources that this metastore service is attached - // to. The key is the lake resource name. Example: - // `projects/{project_number}/locations/{location_id}/lakes/{lake_id}`. - map lake_resources = 1; -} - -// Represents a Lake resource -message Lake { - // The Lake resource name. - // Example: - // `projects/{project_number}/locations/{location_id}/lakes/{lake_id}` - string name = 1 [ - (google.api.resource_reference) = { type: "dataplex.googleapis.com/Lake" } - ]; -} - -// Maintenance window. This specifies when Dataproc Metastore -// may perform system maintenance operation to the service. -message MaintenanceWindow { - // The hour of day (0-23) when the window starts. - google.protobuf.Int32Value hour_of_day = 1; - - // The day of week, when the window starts. - google.type.DayOfWeek day_of_week = 2; -} - -// Specifies configuration information specific to running Hive metastore -// software as the metastore service. -message HiveMetastoreConfig { - // Protocols available for serving the metastore service endpoint. - enum EndpointProtocol { - // The protocol is not set. - ENDPOINT_PROTOCOL_UNSPECIFIED = 0; - - // Use the legacy Apache Thrift protocol for the metastore service endpoint. - THRIFT = 1; - - // Use the modernized gRPC protocol for the metastore service endpoint. - GRPC = 2; - } - - // Immutable. The Hive metastore schema version. - string version = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // A mapping of Hive metastore configuration key-value pairs to apply to the - // Hive metastore (configured in `hive-site.xml`). The mappings - // override system defaults (some keys cannot be overridden). These - // overrides are also applied to auxiliary versions and can be further - // customized in the auxiliary version's `AuxiliaryVersionConfig`. - map config_overrides = 2; - - // Information used to configure the Hive metastore service as a service - // principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` - // method and specify this field's path - // (`hive_metastore_config.kerberos_config`) in the request's `update_mask` - // while omitting this field from the request's `service`. - KerberosConfig kerberos_config = 3; - - // The protocol to use for the metastore service endpoint. If unspecified, - // defaults to `THRIFT`. - EndpointProtocol endpoint_protocol = 4; - - // A mapping of Hive metastore version to the auxiliary version - // configuration. When specified, a secondary Hive metastore service is - // created along with the primary service. All auxiliary versions must be less - // than the service's primary version. The key is the auxiliary service name - // and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This - // means that the first character must be a lowercase letter, and all the - // following characters must be hyphens, lowercase letters, or digits, except - // the last character, which cannot be a hyphen. - map auxiliary_versions = 5; -} - -// Configuration information for a Kerberos principal. -message KerberosConfig { - // A Kerberos keytab file that can be used to authenticate a service principal - // with a Kerberos Key Distribution Center (KDC). - Secret keytab = 1; - - // A Kerberos principal that exists in the both the keytab the KDC - // to authenticate as. A typical principal is of the form - // `primary/instance@REALM`, but there is no exact format. - string principal = 2; - - // A Cloud Storage URI that specifies the path to a - // krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, - // although the file does not need to be named krb5.conf explicitly. - string krb5_config_gcs_uri = 3; -} - -// A securely stored value. -message Secret { - oneof value { - // The relative resource name of a Secret Manager secret version, in the - // following form: - // - // `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. - string cloud_secret = 2; - } -} - -// Encryption settings for the service. -message EncryptionConfig { - // The fully qualified customer provided Cloud KMS key name to use for - // customer data encryption, in the following form: - // - // `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. - string kms_key = 1; -} - -// Configuration information for the auxiliary service versions. -message AuxiliaryVersionConfig { - // The Hive metastore version of the auxiliary service. It must be less - // than the primary Hive metastore service's version. - string version = 1; - - // A mapping of Hive metastore configuration key-value pairs to apply to the - // auxiliary Hive metastore (configured in `hive-site.xml`) in addition to - // the primary version's overrides. If keys are present in both the auxiliary - // version's overrides and the primary version's overrides, the value from - // the auxiliary version's overrides takes precedence. - map config_overrides = 2; - - // Output only. The network configuration contains the endpoint URI(s) of the - // auxiliary Hive metastore service. - NetworkConfig network_config = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Network configuration for the Dataproc Metastore service. -message NetworkConfig { - // Contains information of the customer's network configurations. - message Consumer { - oneof vpc_resource { - // Immutable. The subnetwork of the customer project from which an IP - // address is reserved and used as the Dataproc Metastore service's - // endpoint. It is accessible to hosts in the subnet and to all - // hosts in a subnet in the same region and same network. There must - // be at least one IP address available in the subnet's primary range. The - // subnet is specified in the following form: - // - // `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` - string subnetwork = 1 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { - type: "compute.googleapis.com/Subnetwork" - } - ]; - } - - // Output only. The URI of the endpoint used to access the metastore - // service. - string endpoint_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Immutable. The consumer-side network configuration for the Dataproc - // Metastore instance. - repeated Consumer consumers = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Enables custom routes to be imported and exported for the Dataproc - // Metastore service's peered VPC network. - bool custom_routes_enabled = 2; -} - -// Telemetry Configuration for the Dataproc Metastore service. -message TelemetryConfig { - enum LogFormat { - // The LOG_FORMAT is not set. - LOG_FORMAT_UNSPECIFIED = 0; - - // Logging output uses the legacy `textPayload` format. - LEGACY = 1; - - // Logging output uses the `jsonPayload` format. - JSON = 2; - } - - // The output format of the Dataproc Metastore service's logs. - LogFormat log_format = 1; -} - -// The metadata management activities of the metastore service. -message MetadataManagementActivity { - // Output only. The latest metadata exports of the metastore service. - repeated MetadataExport metadata_exports = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The latest restores of the metastore service. - repeated Restore restores = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A metastore resource that imports metadata. -message MetadataImport { - option (google.api.resource) = { - type: "metastore.googleapis.com/MetadataImport" - pattern: "projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}" - }; - - // A specification of the location of and metadata about a database dump from - // a relational database management system. - message DatabaseDump { - // The type of the database. - enum DatabaseType { - // The type of the source database is unknown. - DATABASE_TYPE_UNSPECIFIED = 0; - - // The type of the source database is MySQL. - MYSQL = 1; - } - - // The type of the database. - DatabaseType database_type = 1 [deprecated = true]; - - // A Cloud Storage object or folder URI that specifies the source from which - // to import metadata. It must begin with `gs://`. - string gcs_uri = 2; - - // The name of the source database. - string source_database = 3 [deprecated = true]; - - // Optional. The type of the database dump. If unspecified, defaults to - // `MYSQL`. - DatabaseDumpSpec.Type type = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // The current state of the metadata import. - enum State { - // The state of the metadata import is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata import is running. - RUNNING = 1; - - // The metadata import completed successfully. - SUCCEEDED = 2; - - // The metadata import is being updated. - UPDATING = 3; - - // The metadata import failed, and attempted metadata changes were rolled - // back. - FAILED = 4; - } - - // The metadata to be imported. - oneof metadata { - // Immutable. A database dump from a pre-existing metastore's database. - DatabaseDump database_dump = 6 [(google.api.field_behavior) = IMMUTABLE]; - } - - // Immutable. The relative resource name of the metadata import, of the form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // The description of the metadata import. - string description = 2; - - // Output only. The time when the metadata import was started. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metadata import was last updated. - google.protobuf.Timestamp update_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metadata import finished. - google.protobuf.Timestamp end_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the metadata import. - State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a metadata export operation. -message MetadataExport { - // The current state of the metadata export. - enum State { - // The state of the metadata export is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata export is running. - RUNNING = 1; - - // The metadata export completed successfully. - SUCCEEDED = 2; - - // The metadata export failed. - FAILED = 3; - - // The metadata export is cancelled. - CANCELLED = 4; - } - - oneof destination { - // Output only. A Cloud Storage URI of a folder that metadata are exported - // to, in the form of - // `gs:////`, where - // `` is automatically generated. - string destination_gcs_uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. The time when the export started. - google.protobuf.Timestamp start_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the export ended. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the export. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The type of the database dump. - DatabaseDumpSpec.Type database_dump_type = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a backup resource. -message Backup { - option (google.api.resource) = { - type: "metastore.googleapis.com/Backup" - pattern: "projects/{project}/locations/{location}/services/{service}/backups/{backup}" - }; - - // The current state of the backup. - enum State { - // The state of the backup is unknown. - STATE_UNSPECIFIED = 0; - - // The backup is being created. - CREATING = 1; - - // The backup is being deleted. - DELETING = 2; - - // The backup is active and ready to use. - ACTIVE = 3; - - // The backup failed. - FAILED = 4; - - // The backup is being restored. - RESTORING = 5; - } - - // Immutable. The relative resource name of the backup, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the backup was started. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the backup finished creating. - google.protobuf.Timestamp end_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the backup. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The revision of the service at the time of backup. - Service service_revision = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The description of the backup. - string description = 6; - - // Output only. Services that are restoring from the backup. - repeated string restoring_services = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a metadata restore operation. -message Restore { - // The current state of the restore. - enum State { - // The state of the metadata restore is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata restore is running. - RUNNING = 1; - - // The metadata restore completed successfully. - SUCCEEDED = 2; - - // The metadata restore failed. - FAILED = 3; - - // The metadata restore is cancelled. - CANCELLED = 4; - } - - // The type of restore. If unspecified, defaults to `METADATA_ONLY`. - enum RestoreType { - // The restore type is unknown. - RESTORE_TYPE_UNSPECIFIED = 0; - - // The service's metadata and configuration are restored. - FULL = 1; - - // Only the service's metadata is restored. - METADATA_ONLY = 2; - } - - // Output only. The time when the restore started. - google.protobuf.Timestamp start_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the restore ended. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the restore. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The relative resource name of the metastore service backup to - // restore from, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string backup = 4 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Output only. The type of restore. - RestoreType type = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The restore details containing the revision of the service to - // be restored to, in format of JSON. - string details = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents the scaling configuration of a metastore service. -message ScalingConfig { - // Metastore instance sizes. - enum InstanceSize { - // Unspecified instance size - INSTANCE_SIZE_UNSPECIFIED = 0; - - // Extra small instance size, maps to a scaling factor of 0.1. - EXTRA_SMALL = 1; - - // Small instance size, maps to a scaling factor of 0.5. - SMALL = 2; - - // Medium instance size, maps to a scaling factor of 1.0. - MEDIUM = 3; - - // Large instance size, maps to a scaling factor of 3.0. - LARGE = 4; - - // Extra large instance size, maps to a scaling factor of 6.0. - EXTRA_LARGE = 5; - } - - // Represents either a predetermined instance size or a numeric - // scaling factor. - oneof scaling_model { - // An enum of readable instance sizes, with each instance size mapping to a - // float value (e.g. InstanceSize.EXTRA_SMALL = scaling_factor(0.1)) - InstanceSize instance_size = 1; - - // Scaling factor, increments of 0.1 for values less than 1.0, and - // increments of 1.0 for values greater than 1.0. - float scaling_factor = 2; - } -} - -// Request message for -// [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices]. -message ListServicesRequest { - // Required. The relative resource name of the location of metastore services - // to list, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. The maximum number of services to return. The response may - // contain less than the maximum number. If unspecified, no more than 500 - // services are returned. The maximum value is 1000; values above 1000 are - // changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous - // [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] - // must match the call that provided the page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices]. -message ListServicesResponse { - // The services in the specified location. - repeated Service services = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [DataprocMetastore.GetService][google.cloud.metastore.v1beta.DataprocMetastore.GetService]. -message GetServiceRequest { - // Required. The relative resource name of the metastore service to retrieve, - // in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; -} - -// Request message for -// [DataprocMetastore.CreateService][google.cloud.metastore.v1beta.DataprocMetastore.CreateService]. -message CreateServiceRequest { - // Required. The relative resource name of the location in which to create a - // metastore service, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The ID of the metastore service, which is used as the final - // component of the metastore service's name. - // - // This value must be between 2 and 63 characters long inclusive, begin with a - // letter, end with a letter or number, and consist of alpha-numeric - // ASCII characters or hyphens. - string service_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Metastore service to create. The `name` field is - // ignored. The ID of the created metastore service must be provided in - // the request's `service_id` field. - Service service = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.UpdateService][google.cloud.metastore.v1beta.DataprocMetastore.UpdateService]. -message UpdateServiceRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metastore service resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The metastore service to update. The server only merges fields - // in the service if they are specified in `update_mask`. - // - // The metastore service's `name` field is used to identify the metastore - // service to be updated. - Service service = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.DeleteService][google.cloud.metastore.v1beta.DataprocMetastore.DeleteService]. -message DeleteServiceRequest { - // Required. The relative resource name of the metastore service to delete, in - // the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1beta.DataprocMetastore.ListMetadataImports]. -message ListMetadataImportsRequest { - // Required. The relative resource name of the service whose metadata imports - // to list, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/MetadataImport" - } - ]; - - // Optional. The maximum number of imports to return. The response may contain - // less than the maximum number. If unspecified, no more than 500 imports are - // returned. The maximum value is 1000; values above 1000 are changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous - // [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] - // must match the call that provided the page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1beta.DataprocMetastore.ListMetadataImports]. -message ListMetadataImportsResponse { - // The imports in the specified service. - repeated MetadataImport metadata_imports = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [DataprocMetastore.GetMetadataImport][google.cloud.metastore.v1beta.DataprocMetastore.GetMetadataImport]. -message GetMetadataImportRequest { - // Required. The relative resource name of the metadata import to retrieve, in - // the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/MetadataImport" - } - ]; -} - -// Request message for -// [DataprocMetastore.CreateMetadataImport][google.cloud.metastore.v1beta.DataprocMetastore.CreateMetadataImport]. -message CreateMetadataImportRequest { - // Required. The relative resource name of the service in which to create a - // metastore import, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/MetadataImport" - } - ]; - - // Required. The ID of the metadata import, which is used as the final - // component of the metadata import's name. - // - // This value must be between 1 and 64 characters long, begin with a letter, - // end with a letter or number, and consist of alpha-numeric ASCII characters - // or hyphens. - string metadata_import_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The metadata import to create. The `name` field is ignored. The - // ID of the created metadata import must be provided in the request's - // `metadata_import_id` field. - MetadataImport metadata_import = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.UpdateMetadataImport][google.cloud.metastore.v1beta.DataprocMetastore.UpdateMetadataImport]. -message UpdateMetadataImportRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metadata import resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The metadata import to update. The server only merges fields - // in the import if they are specified in `update_mask`. - // - // The metadata import's `name` field is used to identify the metastore - // import to be updated. - MetadataImport metadata_import = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups]. -message ListBackupsRequest { - // Required. The relative resource name of the service whose backups to - // list, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. The maximum number of backups to return. The response may contain - // less than the maximum number. If unspecified, no more than 500 backups are - // returned. The maximum value is 1000; values above 1000 are changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous - // [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups] - // must match the call that provided the page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups]. -message ListBackupsResponse { - // The backups of the specified service. - repeated Backup backups = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [DataprocMetastore.GetBackup][google.cloud.metastore.v1beta.DataprocMetastore.GetBackup]. -message GetBackupRequest { - // Required. The relative resource name of the backup to retrieve, in the - // following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; -} - -// Request message for -// [DataprocMetastore.CreateBackup][google.cloud.metastore.v1beta.DataprocMetastore.CreateBackup]. -message CreateBackupRequest { - // Required. The relative resource name of the service in which to create a - // backup of the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Backup" - } - ]; - - // Required. The ID of the backup, which is used as the final component of the - // backup's name. - // - // This value must be between 1 and 64 characters long, begin with a letter, - // end with a letter or number, and consist of alpha-numeric ASCII characters - // or hyphens. - string backup_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The backup to create. The `name` field is ignored. The ID of the - // created backup must be provided in the request's `backup_id` field. - Backup backup = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.DeleteBackup][google.cloud.metastore.v1beta.DataprocMetastore.DeleteBackup]. -message DeleteBackupRequest { - // Required. The relative resource name of the backup to delete, in the - // following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.ExportMetadata][google.cloud.metastore.v1beta.DataprocMetastore.ExportMetadata]. -message ExportMetadataRequest { - // Required. Destination that metadata is exported to. - oneof destination { - // A Cloud Storage URI of a folder, in the format - // `gs:///`. A sub-folder - // `` containing exported files will be created below it. - string destination_gcs_folder = 2; - } - - // Required. The relative resource name of the metastore service to run - // export, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The type of the database dump. If unspecified, defaults to - // `MYSQL`. - DatabaseDumpSpec.Type database_dump_type = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [DataprocMetastore.Restore][]. -message RestoreServiceRequest { - // Required. The relative resource name of the metastore service to run - // restore, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The relative resource name of the metastore service backup to - // restore from, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string backup = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - Restore.RestoreType restore_type = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents the metadata of a long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the caller has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a - // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - // `Code.CANCELLED`. - bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Metadata about the service in a location. -message LocationMetadata { - // A specification of a supported version of the Hive Metastore software. - message HiveMetastoreVersion { - // The semantic version of the Hive Metastore software. - string version = 1; - - // Whether `version` will be chosen by the server if a metastore service is - // created with a `HiveMetastoreConfig` that omits the `version`. - bool is_default = 2; - } - - // The versions of Hive Metastore that can be used when creating a new - // metastore service in this location. The server guarantees that exactly one - // `HiveMetastoreVersion` in the list will set `is_default`. - repeated HiveMetastoreVersion supported_hive_metastore_versions = 1; -} - -// The specification of database dump to import from or export to. -message DatabaseDumpSpec { - // The type of the database dump. - enum Type { - // The type of the database dump is unknown. - TYPE_UNSPECIFIED = 0; - - // Database dump is a MySQL dump file. - MYSQL = 1; - - // Database dump contains Avro files. - AVRO = 2; - } -} - -// Request message for -// [DataprocMetastore.RemoveIamPolicy][google.cloud.metastore.v1beta.DataprocMetastore.RemoveIamPolicy]. -message RemoveIamPolicyRequest { - // Required. The relative resource name of the dataplane resource to remove - // IAM policy, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` - // or - // `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. - string resource = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "*" } - ]; - - // Optional. Removes IAM policy attached to database or table asynchronously - // when it is set. The default is false. - bool asynchronous = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [DataprocMetastore.RemoveIamPolicy][google.cloud.metastore.v1beta.DataprocMetastore.RemoveIamPolicy]. -message RemoveIamPolicyResponse { - // True if the policy is successfully removed. - bool success = 1; -} - -// Request message for -// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1beta.DataprocMetastore.QueryMetadata]. -message QueryMetadataRequest { - // Required. The relative resource name of the metastore service to query - // metadata, in the following format: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Required. A read-only SQL query to execute against the metadata database. - // The query cannot change or mutate the data. - string query = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for -// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1beta.DataprocMetastore.QueryMetadata]. -message QueryMetadataResponse { - // The manifest URI is link to a JSON instance in Cloud Storage. - // This instance manifests immediately along with QueryMetadataResponse. The - // content of the URI is not retriable until the long-running operation query - // against the metadata finishes. - string result_manifest_uri = 1; -} - -// Error details in public error message for -// [DataprocMetastore.QueryMetadata][google.cloud.metastore.v1beta.DataprocMetastore.QueryMetadata]. -message ErrorDetails { - // Additional structured details about this error. - // - // Keys define the failure items. - // Value describes the exception or details of the item. - map details = 1; -} - -// Request message for -// [DataprocMetastore.MoveTableToDatabase][google.cloud.metastore.v1beta.DataprocMetastore.MoveTableToDatabase]. -message MoveTableToDatabaseRequest { - // Required. The relative resource name of the metastore service to mutate - // metadata, in the following format: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The name of the table to be moved. - string table_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The name of the database where the table resides. - string db_name = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The name of the database where the table should be moved. - string destination_db_name = 4 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for -// [DataprocMetastore.MoveTableToDatabase][google.cloud.metastore.v1beta.DataprocMetastore.MoveTableToDatabase]. -message MoveTableToDatabaseResponse {} - -// Request message for -// [DataprocMetastore.AlterMetadataResourceLocation][google.cloud.metastore.v1beta.DataprocMetastore.AlterMetadataResourceLocation]. -message AlterMetadataResourceLocationRequest { - // Required. The relative resource name of the metastore service to mutate - // metadata, in the following format: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The relative metadata resource name in the following format. - // - // `databases/{database_id}` - // or - // `databases/{database_id}/tables/{table_id}` - // or - // `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` - string resource_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The new location URI for the metadata resource. - string location_uri = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for -// [DataprocMetastore.AlterMetadataResourceLocation][google.cloud.metastore.v1beta.DataprocMetastore.AlterMetadataResourceLocation]. -message AlterMetadataResourceLocationResponse {} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore_federation.proto b/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore_federation.proto deleted file mode 100644 index 26bc70e7c4b..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore_federation.proto +++ /dev/null @@ -1,377 +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 -// -// 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.metastore.v1beta; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/metastore/v1beta/metastore.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/metastore/apiv1beta/metastorepb;metastorepb"; -option java_multiple_files = true; -option java_outer_classname = "MetastoreFederationProto"; -option java_package = "com.google.cloud.metastore.v1beta"; - -// Configures and manages metastore federation services. -// Dataproc Metastore Federation Service allows federating a collection of -// backend metastores like BigQuery, Dataplex Lakes, and other Dataproc -// Metastores. The Federation Service exposes a gRPC URL through which metadata -// from the backend metastores are served at query time. -// -// The Dataproc Metastore Federation API defines the following resource model: -// * The service works with a collection of Google Cloud projects. -// * Each project has a collection of available locations. -// * Each location has a collection of federations. -// * Dataproc Metastore Federations are resources with names of the -// form: -// `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. -service DataprocMetastoreFederation { - option (google.api.default_host) = "metastore.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists federations in a project and location. - rpc ListFederations(ListFederationsRequest) - returns (ListFederationsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/locations/*}/federations" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a single federation. - rpc GetFederation(GetFederationRequest) returns (Federation) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/locations/*/federations/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a metastore federation in a project and location. - rpc CreateFederation(CreateFederationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{parent=projects/*/locations/*}/federations" - body: "federation" - }; - option (google.api.method_signature) = "parent,federation,federation_id"; - option (google.longrunning.operation_info) = { - response_type: "Federation" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Updates the fields of a federation. - rpc UpdateFederation(UpdateFederationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta/{federation.name=projects/*/locations/*/federations/*}" - body: "federation" - }; - option (google.api.method_signature) = "federation,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Federation" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Deletes a single federation. - rpc DeleteFederation(DeleteFederationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta/{name=projects/*/locations/*/federations/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } -} - -// Represents a federation of multiple backend metastores. -message Federation { - option (google.api.resource) = { - type: "metastore.googleapis.com/Federation" - pattern: "projects/{project}/locations/{location}/federations/{federation}" - }; - - // The current state of the federation. - enum State { - // The state of the metastore federation is unknown. - STATE_UNSPECIFIED = 0; - - // The metastore federation is in the process of being created. - CREATING = 1; - - // The metastore federation is running and ready to serve queries. - ACTIVE = 2; - - // The metastore federation is being updated. It remains usable but cannot - // accept additional update requests or be deleted at this time. - UPDATING = 3; - - // The metastore federation is undergoing deletion. It cannot be used. - DELETING = 4; - - // The metastore federation has encountered an error and cannot be used. The - // metastore federation should be deleted. - ERROR = 5; - } - - // Immutable. The relative resource name of the federation, of the - // form: - // projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the metastore federation was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metastore federation was last updated. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-defined labels for the metastore federation. - map labels = 4; - - // Immutable. The Apache Hive metastore version of the federation. All backend - // metastore versions must be compatible with the federation version. - string version = 5 [(google.api.field_behavior) = IMMUTABLE]; - - // A map from `BackendMetastore` rank to `BackendMetastore`s from which the - // federation service serves metadata at query time. The map key represents - // the order in which `BackendMetastore`s should be evaluated to resolve - // database names at query time and should be greater than or equal to zero. A - // `BackendMetastore` with a lower number will be evaluated before a - // `BackendMetastore` with a higher number. - map backend_metastores = 6; - - // Output only. The federation endpoint. - string endpoint_uri = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the federation. - State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current state of the - // metastore federation, if available. - string state_message = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The globally unique resource identifier of the metastore - // federation. - string uid = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents a backend metastore for the federation. -message BackendMetastore { - // The type of the backend metastore. - enum MetastoreType { - // The metastore type is not set. - METASTORE_TYPE_UNSPECIFIED = 0; - - // The backend metastore is Dataplex. - DATAPLEX = 1; - - // The backend metastore is BigQuery. - BIGQUERY = 2; - - // The backend metastore is Dataproc Metastore. - DATAPROC_METASTORE = 3; - } - - // The relative resource name of the metastore that is being federated. - // The formats of the relative resource names for the currently supported - // metastores are listed below: - // - // * BigQuery - // * `projects/{project_id}` - // * Dataproc Metastore - // * `projects/{project_id}/locations/{location}/services/{service_id}` - string name = 1; - - // The type of the backend metastore. - MetastoreType metastore_type = 2; -} - -// Request message for ListFederations. -message ListFederationsRequest { - // Required. The relative resource name of the location of metastore - // federations to list, in the following form: - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Federation" - } - ]; - - // Optional. The maximum number of federations to return. The response may - // contain less than the maximum number. If unspecified, no more than 500 - // services are returned. The maximum value is 1000; values above 1000 are - // changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous ListFederationServices - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // ListFederationServices must match the call that provided the - // page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for ListFederations -message ListFederationsResponse { - // The services in the specified location. - repeated Federation federations = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for GetFederation. -message GetFederationRequest { - // Required. The relative resource name of the metastore federation to - // retrieve, in the following form: - // - // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Federation" - } - ]; -} - -// Request message for CreateFederation. -message CreateFederationRequest { - // Required. The relative resource name of the location in which to create a - // federation service, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Federation" - } - ]; - - // Required. The ID of the metastore federation, which is used as the final - // component of the metastore federation's name. - // - // This value must be between 2 and 63 characters long inclusive, begin with a - // letter, end with a letter or number, and consist of alpha-numeric - // ASCII characters or hyphens. - string federation_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Metastore Federation to create. The `name` field is - // ignored. The ID of the created metastore federation must be - // provided in the request's `federation_id` field. - Federation federation = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for UpdateFederation. -message UpdateFederationRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metastore federation resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The metastore federation to update. The server only merges fields - // in the service if they are specified in `update_mask`. - // - // The metastore federation's `name` field is used to identify the - // metastore service to be updated. - Federation federation = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for DeleteFederation. -message DeleteFederationRequest { - // Required. The relative resource name of the metastore federation to delete, - // in the following form: - // - // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Federation" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.alter_metadata_resource_location.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.alter_metadata_resource_location.js deleted file mode 100644 index 38e953d3de0..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.alter_metadata_resource_location.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(service, resourceName, locationUri) { - // [START metastore_v1beta_generated_DataprocMetastore_AlterMetadataResourceLocation_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 relative resource name of the metastore service to mutate - * metadata, in the following format: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Required. The relative metadata resource name in the following format. - * `databases/{database_id}` - * or - * `databases/{database_id}/tables/{table_id}` - * or - * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` - */ - // const resourceName = 'abc123' - /** - * Required. The new location URI for the metadata resource. - */ - // const locationUri = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callAlterMetadataResourceLocation() { - // Construct request - const request = { - service, - resourceName, - locationUri, - }; - - // Run request - const [operation] = await metastoreClient.alterMetadataResourceLocation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAlterMetadataResourceLocation(); - // [END metastore_v1beta_generated_DataprocMetastore_AlterMetadataResourceLocation_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_backup.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_backup.js deleted file mode 100644 index e1b1491a0d3..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_backup.js +++ /dev/null @@ -1,92 +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, backupId, backup) { - // [START metastore_v1beta_generated_DataprocMetastore_CreateBackup_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 relative resource name of the service in which to create a - * backup of the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the backup, which is used as the final component of the - * backup's name. - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - */ - // const backupId = 'abc123' - /** - * Required. The backup to create. The `name` field is ignored. The ID of the - * created backup must be provided in the request's `backup_id` field. - */ - // const backup = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateBackup() { - // Construct request - const request = { - parent, - backupId, - backup, - }; - - // Run request - const [operation] = await metastoreClient.createBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateBackup(); - // [END metastore_v1beta_generated_DataprocMetastore_CreateBackup_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_metadata_import.js deleted file mode 100644 index f9a950f4592..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_metadata_import.js +++ /dev/null @@ -1,93 +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, metadataImportId, metadataImport) { - // [START metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_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 relative resource name of the service in which to create a - * metastore import, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metadata import, which is used as the final - * component of the metadata import's name. - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - */ - // const metadataImportId = 'abc123' - /** - * Required. The metadata import to create. The `name` field is ignored. The - * ID of the created metadata import must be provided in the request's - * `metadata_import_id` field. - */ - // const metadataImport = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateMetadataImport() { - // Construct request - const request = { - parent, - metadataImportId, - metadataImport, - }; - - // Run request - const [operation] = await metastoreClient.createMetadataImport(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateMetadataImport(); - // [END metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_service.js deleted file mode 100644 index 0c1b2062b33..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_service.js +++ /dev/null @@ -1,93 +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, serviceId, service) { - // [START metastore_v1beta_generated_DataprocMetastore_CreateService_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 relative resource name of the location in which to create a - * metastore service, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metastore service, which is used as the final - * component of the metastore service's name. - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - */ - // const serviceId = 'abc123' - /** - * Required. The Metastore service to create. The `name` field is - * ignored. The ID of the created metastore service must be provided in - * the request's `service_id` field. - */ - // const service = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateService() { - // Construct request - const request = { - parent, - serviceId, - service, - }; - - // Run request - const [operation] = await metastoreClient.createService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateService(); - // [END metastore_v1beta_generated_DataprocMetastore_CreateService_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_backup.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_backup.js deleted file mode 100644 index 0196cd3b504..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_backup.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(name) { - // [START metastore_v1beta_generated_DataprocMetastore_DeleteBackup_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 relative resource name of the backup to delete, in the - * following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callDeleteBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteBackup(); - // [END metastore_v1beta_generated_DataprocMetastore_DeleteBackup_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_service.js deleted file mode 100644 index 12ddd0e4aed..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_service.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(name) { - // [START metastore_v1beta_generated_DataprocMetastore_DeleteService_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 relative resource name of the metastore service to delete, in - * the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callDeleteService() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteService(); - // [END metastore_v1beta_generated_DataprocMetastore_DeleteService_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.export_metadata.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.export_metadata.js deleted file mode 100644 index e9238cc82a6..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.export_metadata.js +++ /dev/null @@ -1,88 +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(service) { - // [START metastore_v1beta_generated_DataprocMetastore_ExportMetadata_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. - */ - /** - * A Cloud Storage URI of a folder, in the format - * `gs:///`. A sub-folder - * `` containing exported files will be created below it. - */ - // const destinationGcsFolder = 'abc123' - /** - * Required. The relative resource name of the metastore service to run - * export, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - /** - * Optional. The type of the database dump. If unspecified, defaults to - * `MYSQL`. - */ - // const databaseDumpType = {} - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callExportMetadata() { - // Construct request - const request = { - service, - }; - - // Run request - const [operation] = await metastoreClient.exportMetadata(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportMetadata(); - // [END metastore_v1beta_generated_DataprocMetastore_ExportMetadata_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_backup.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_backup.js deleted file mode 100644 index 32b40425fb1..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_backup.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 metastore_v1beta_generated_DataprocMetastore_GetBackup_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 relative resource name of the backup to retrieve, in the - * following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getBackup(request); - console.log(response); - } - - callGetBackup(); - // [END metastore_v1beta_generated_DataprocMetastore_GetBackup_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_metadata_import.js deleted file mode 100644 index 5b1a4f1dab0..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_metadata_import.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 metastore_v1beta_generated_DataprocMetastore_GetMetadataImport_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 relative resource name of the metadata import to retrieve, in - * the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetMetadataImport() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getMetadataImport(request); - console.log(response); - } - - callGetMetadataImport(); - // [END metastore_v1beta_generated_DataprocMetastore_GetMetadataImport_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_service.js deleted file mode 100644 index 29d9d24a065..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_service.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 metastore_v1beta_generated_DataprocMetastore_GetService_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 relative resource name of the metastore service to retrieve, - * in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetService() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getService(request); - console.log(response); - } - - callGetService(); - // [END metastore_v1beta_generated_DataprocMetastore_GetService_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_backups.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_backups.js deleted file mode 100644 index 4b16fd343db..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_backups.js +++ /dev/null @@ -1,91 +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 metastore_v1beta_generated_DataprocMetastore_ListBackups_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 relative resource name of the service whose backups to - * list, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous - * DataprocMetastore.ListBackups google.cloud.metastore.v1beta.DataprocMetastore.ListBackups - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListBackups google.cloud.metastore.v1beta.DataprocMetastore.ListBackups - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListBackups() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listBackupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBackups(); - // [END metastore_v1beta_generated_DataprocMetastore_ListBackups_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js deleted file mode 100644 index 77aab9b6734..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js +++ /dev/null @@ -1,91 +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 metastore_v1beta_generated_DataprocMetastore_ListMetadataImports_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 relative resource name of the service whose metadata imports - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous - * DataprocMetastore.ListServices google.cloud.metastore.v1beta.DataprocMetastore.ListServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListServices google.cloud.metastore.v1beta.DataprocMetastore.ListServices - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListMetadataImports() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listMetadataImportsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMetadataImports(); - // [END metastore_v1beta_generated_DataprocMetastore_ListMetadataImports_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_services.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_services.js deleted file mode 100644 index 82da40a0bf7..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_services.js +++ /dev/null @@ -1,92 +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 metastore_v1beta_generated_DataprocMetastore_ListServices_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 relative resource name of the location of metastore services - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous - * DataprocMetastore.ListServices google.cloud.metastore.v1beta.DataprocMetastore.ListServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListServices google.cloud.metastore.v1beta.DataprocMetastore.ListServices - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListServices() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listServicesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListServices(); - // [END metastore_v1beta_generated_DataprocMetastore_ListServices_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.move_table_to_database.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.move_table_to_database.js deleted file mode 100644 index 87c44d71349..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.move_table_to_database.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(service, tableName, dbName, destinationDbName) { - // [START metastore_v1beta_generated_DataprocMetastore_MoveTableToDatabase_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 relative resource name of the metastore service to mutate - * metadata, in the following format: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Required. The name of the table to be moved. - */ - // const tableName = 'abc123' - /** - * Required. The name of the database where the table resides. - */ - // const dbName = 'abc123' - /** - * Required. The name of the database where the table should be moved. - */ - // const destinationDbName = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callMoveTableToDatabase() { - // Construct request - const request = { - service, - tableName, - dbName, - destinationDbName, - }; - - // Run request - const [operation] = await metastoreClient.moveTableToDatabase(request); - const [response] = await operation.promise(); - console.log(response); - } - - callMoveTableToDatabase(); - // [END metastore_v1beta_generated_DataprocMetastore_MoveTableToDatabase_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.query_metadata.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.query_metadata.js deleted file mode 100644 index 58c230ba3a8..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.query_metadata.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(service, query) { - // [START metastore_v1beta_generated_DataprocMetastore_QueryMetadata_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 relative resource name of the metastore service to query - * metadata, in the following format: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Required. A read-only SQL query to execute against the metadata database. - * The query cannot change or mutate the data. - */ - // const query = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callQueryMetadata() { - // Construct request - const request = { - service, - query, - }; - - // Run request - const [operation] = await metastoreClient.queryMetadata(request); - const [response] = await operation.promise(); - console.log(response); - } - - callQueryMetadata(); - // [END metastore_v1beta_generated_DataprocMetastore_QueryMetadata_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.remove_iam_policy.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.remove_iam_policy.js deleted file mode 100644 index a41e69f7ca2..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.remove_iam_policy.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) { - // [START metastore_v1beta_generated_DataprocMetastore_RemoveIamPolicy_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 relative resource name of the dataplane resource to remove - * IAM policy, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` - * or - * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. - */ - // const resource = 'abc123' - /** - * Optional. Removes IAM policy attached to database or table asynchronously - * when it is set. The default is false. - */ - // const asynchronous = true - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callRemoveIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await metastoreClient.removeIamPolicy(request); - console.log(response); - } - - callRemoveIamPolicy(); - // [END metastore_v1beta_generated_DataprocMetastore_RemoveIamPolicy_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.restore_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.restore_service.js deleted file mode 100644 index a136f331f7d..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.restore_service.js +++ /dev/null @@ -1,88 +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(service, backup) { - // [START metastore_v1beta_generated_DataprocMetastore_RestoreService_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 relative resource name of the metastore service to run - * restore, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Required. The relative resource name of the metastore service backup to - * restore from, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const backup = 'abc123' - /** - * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - */ - // const restoreType = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callRestoreService() { - // Construct request - const request = { - service, - backup, - }; - - // Run request - const [operation] = await metastoreClient.restoreService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRestoreService(); - // [END metastore_v1beta_generated_DataprocMetastore_RestoreService_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_metadata_import.js deleted file mode 100644 index 444f7592572..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_metadata_import.js +++ /dev/null @@ -1,86 +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(updateMask, metadataImport) { - // [START metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_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. A field mask used to specify the fields to be overwritten in the - * metadata import resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metadata import to update. The server only merges fields - * in the import if they are specified in `update_mask`. - * The metadata import's `name` field is used to identify the metastore - * import to be updated. - */ - // const metadataImport = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callUpdateMetadataImport() { - // Construct request - const request = { - updateMask, - metadataImport, - }; - - // Run request - const [operation] = await metastoreClient.updateMetadataImport(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateMetadataImport(); - // [END metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_service.js deleted file mode 100644 index 425e2be3d1e..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_service.js +++ /dev/null @@ -1,86 +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(updateMask, service) { - // [START metastore_v1beta_generated_DataprocMetastore_UpdateService_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. A field mask used to specify the fields to be overwritten in the - * metastore service resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metastore service to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * The metastore service's `name` field is used to identify the metastore - * service to be updated. - */ - // const service = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callUpdateService() { - // Construct request - const request = { - updateMask, - service, - }; - - // Run request - const [operation] = await metastoreClient.updateService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateService(); - // [END metastore_v1beta_generated_DataprocMetastore_UpdateService_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.create_federation.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.create_federation.js deleted file mode 100644 index 62c079f2fc9..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.create_federation.js +++ /dev/null @@ -1,93 +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, federationId, federation) { - // [START metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_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 relative resource name of the location in which to create a - * federation service, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metastore federation, which is used as the final - * component of the metastore federation's name. - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - */ - // const federationId = 'abc123' - /** - * Required. The Metastore Federation to create. The `name` field is - * ignored. The ID of the created metastore federation must be - * provided in the request's `federation_id` field. - */ - // const federation = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callCreateFederation() { - // Construct request - const request = { - parent, - federationId, - federation, - }; - - // Run request - const [operation] = await metastoreClient.createFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateFederation(); - // [END metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js deleted file mode 100644 index 34a48faaaaf..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.delete_federation.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(name) { - // [START metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_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 relative resource name of the metastore federation to delete, - * in the following form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callDeleteFederation() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteFederation(); - // [END metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.get_federation.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.get_federation.js deleted file mode 100644 index 307b17c5520..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.get_federation.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 metastore_v1beta_generated_DataprocMetastoreFederation_GetFederation_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 relative resource name of the metastore federation to - * retrieve, in the following form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callGetFederation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getFederation(request); - console.log(response); - } - - callGetFederation(); - // [END metastore_v1beta_generated_DataprocMetastoreFederation_GetFederation_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.list_federations.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.list_federations.js deleted file mode 100644 index 3bea1d7fa6f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.list_federations.js +++ /dev/null @@ -1,91 +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 metastore_v1beta_generated_DataprocMetastoreFederation_ListFederations_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 relative resource name of the location of metastore - * federations to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of federations to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callListFederations() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listFederationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFederations(); - // [END metastore_v1beta_generated_DataprocMetastoreFederation_ListFederations_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-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.update_federation.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.update_federation.js deleted file mode 100644 index 7f5e7c4e1bb..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.update_federation.js +++ /dev/null @@ -1,86 +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(updateMask, federation) { - // [START metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_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. A field mask used to specify the fields to be overwritten in the - * metastore federation resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metastore federation to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * The metastore federation's `name` field is used to identify the - * metastore service to be updated. - */ - // const federation = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callUpdateFederation() { - // Construct request - const request = { - updateMask, - federation, - }; - - // Run request - const [operation] = await metastoreClient.updateFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateFederation(); - // [END metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_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-metastore/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.metastore.v1beta.json b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.metastore.v1beta.json deleted file mode 100644 index efc6983feb1..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.metastore.v1beta.json +++ /dev/null @@ -1,1175 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-metastore", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.metastore.v1beta", - "version": "v1beta" - } - ] - }, - "snippets": [ - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_ListServices_async", - "title": "DataprocMetastore listServices Sample", - "origin": "API_DEFINITION", - "description": " Lists services in a project and location.", - "canonical": true, - "file": "dataproc_metastore.list_services.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServices", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListServices", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1beta.ListServicesResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListServices", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListServices", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_GetService_async", - "title": "DataprocMetastore getService Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a single service.", - "canonical": true, - "file": "dataproc_metastore.get_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetService", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1beta.Service", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_CreateService_async", - "title": "DataprocMetastore createService Sample", - "origin": "API_DEFINITION", - "description": " Creates a metastore service in a project and location.", - "canonical": true, - "file": "dataproc_metastore.create_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateService", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "service_id", - "type": "TYPE_STRING" - }, - { - "name": "service", - "type": ".google.cloud.metastore.v1beta.Service" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_UpdateService_async", - "title": "DataprocMetastore updateService Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of a single service.", - "canonical": true, - "file": "dataproc_metastore.update_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.UpdateService", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "service", - "type": ".google.cloud.metastore.v1beta.Service" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "UpdateService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.UpdateService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_DeleteService_async", - "title": "DataprocMetastore deleteService Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single service.", - "canonical": true, - "file": "dataproc_metastore.delete_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.DeleteService", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "DeleteService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.DeleteService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_ListMetadataImports_async", - "title": "DataprocMetastore listMetadataImports Sample", - "origin": "API_DEFINITION", - "description": " Lists imports in a service.", - "canonical": true, - "file": "dataproc_metastore.list_metadata_imports.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMetadataImports", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListMetadataImports", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1beta.ListMetadataImportsResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListMetadataImports", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListMetadataImports", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_GetMetadataImport_async", - "title": "DataprocMetastore getMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single import.", - "canonical": true, - "file": "dataproc_metastore.get_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetMetadataImport", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetMetadataImport", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1beta.MetadataImport", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetMetadataImport", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_async", - "title": "DataprocMetastore createMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Creates a new MetadataImport in a given project and location.", - "canonical": true, - "file": "dataproc_metastore.create_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMetadataImport", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateMetadataImport", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "metadata_import_id", - "type": "TYPE_STRING" - }, - { - "name": "metadata_import", - "type": ".google.cloud.metastore.v1beta.MetadataImport" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateMetadataImport", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_async", - "title": "DataprocMetastore updateMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Updates a single import. Only the description field of MetadataImport is supported to be updated.", - "canonical": true, - "file": "dataproc_metastore.update_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateMetadataImport", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.UpdateMetadataImport", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "metadata_import", - "type": ".google.cloud.metastore.v1beta.MetadataImport" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "UpdateMetadataImport", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.UpdateMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_ExportMetadata_async", - "title": "DataprocMetastore exportMetadata Sample", - "origin": "API_DEFINITION", - "description": " Exports metadata from a service.", - "canonical": true, - "file": "dataproc_metastore.export_metadata.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportMetadata", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ExportMetadata", - "async": true, - "parameters": [ - { - "name": "destination_gcs_folder", - "type": "TYPE_STRING" - }, - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "database_dump_type", - "type": ".google.cloud.metastore.v1beta.DatabaseDumpSpec.Type" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "ExportMetadata", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ExportMetadata", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_RestoreService_async", - "title": "DataprocMetastore restoreService Sample", - "origin": "API_DEFINITION", - "description": " Restores a service from a backup.", - "canonical": true, - "file": "dataproc_metastore.restore_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RestoreService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.RestoreService", - "async": true, - "parameters": [ - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": "TYPE_STRING" - }, - { - "name": "restore_type", - "type": ".google.cloud.metastore.v1beta.Restore.RestoreType" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "RestoreService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.RestoreService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_ListBackups_async", - "title": "DataprocMetastore listBackups Sample", - "origin": "API_DEFINITION", - "description": " Lists backups in a service.", - "canonical": true, - "file": "dataproc_metastore.list_backups.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBackups", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListBackups", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1beta.ListBackupsResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListBackups", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListBackups", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_GetBackup_async", - "title": "DataprocMetastore getBackup Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single backup.", - "canonical": true, - "file": "dataproc_metastore.get_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBackup", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1beta.Backup", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetBackup", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_CreateBackup_async", - "title": "DataprocMetastore createBackup Sample", - "origin": "API_DEFINITION", - "description": " Creates a new backup in a given project and location.", - "canonical": true, - "file": "dataproc_metastore.create_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBackup", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateBackup", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "backup_id", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": ".google.cloud.metastore.v1beta.Backup" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateBackup", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_DeleteBackup_async", - "title": "DataprocMetastore deleteBackup Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single backup.", - "canonical": true, - "file": "dataproc_metastore.delete_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.DeleteBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.DeleteBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_RemoveIamPolicy_async", - "title": "DataprocMetastore removeIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Removes the attached IAM policies for a resource", - "canonical": true, - "file": "dataproc_metastore.remove_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveIamPolicy", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.RemoveIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "asynchronous", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.metastore.v1beta.RemoveIamPolicyResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "RemoveIamPolicy", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.RemoveIamPolicy", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_QueryMetadata_async", - "title": "DataprocMetastore queryMetadata Sample", - "origin": "API_DEFINITION", - "description": " Query DPMS metadata.", - "canonical": true, - "file": "dataproc_metastore.query_metadata.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "QueryMetadata", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.QueryMetadata", - "async": true, - "parameters": [ - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "QueryMetadata", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.QueryMetadata", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_MoveTableToDatabase_async", - "title": "DataprocMetastore moveTableToDatabase Sample", - "origin": "API_DEFINITION", - "description": " Move a table to another database.", - "canonical": true, - "file": "dataproc_metastore.move_table_to_database.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "MoveTableToDatabase", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.MoveTableToDatabase", - "async": true, - "parameters": [ - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "table_name", - "type": "TYPE_STRING" - }, - { - "name": "db_name", - "type": "TYPE_STRING" - }, - { - "name": "destination_db_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "MoveTableToDatabase", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.MoveTableToDatabase", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_AlterMetadataResourceLocation_async", - "title": "DataprocMetastore alterMetadataResourceLocation Sample", - "origin": "API_DEFINITION", - "description": " Alter metadata resource location. The metadata resource can be a database, table, or partition. This functionality only updates the parent directory for the respective metadata resource and does not transfer any existing data to the new location.", - "canonical": true, - "file": "dataproc_metastore.alter_metadata_resource_location.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AlterMetadataResourceLocation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.AlterMetadataResourceLocation", - "async": true, - "parameters": [ - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "resource_name", - "type": "TYPE_STRING" - }, - { - "name": "location_uri", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "AlterMetadataResourceLocation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.AlterMetadataResourceLocation", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_ListFederations_async", - "title": "DataprocMetastore listFederations Sample", - "origin": "API_DEFINITION", - "description": " Lists federations in a project and location.", - "canonical": true, - "file": "dataproc_metastore_federation.list_federations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFederations", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.ListFederations", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1beta.ListFederationsResponse", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "ListFederations", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.ListFederations", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_GetFederation_async", - "title": "DataprocMetastore getFederation Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a single federation.", - "canonical": true, - "file": "dataproc_metastore_federation.get_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.GetFederation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1beta.Federation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "GetFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.GetFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_async", - "title": "DataprocMetastore createFederation Sample", - "origin": "API_DEFINITION", - "description": " Creates a metastore federation in a project and location.", - "canonical": true, - "file": "dataproc_metastore_federation.create_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.CreateFederation", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "federation_id", - "type": "TYPE_STRING" - }, - { - "name": "federation", - "type": ".google.cloud.metastore.v1beta.Federation" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "CreateFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.CreateFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_async", - "title": "DataprocMetastore updateFederation Sample", - "origin": "API_DEFINITION", - "description": " Updates the fields of a federation.", - "canonical": true, - "file": "dataproc_metastore_federation.update_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.UpdateFederation", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "federation", - "type": ".google.cloud.metastore.v1beta.Federation" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "UpdateFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.UpdateFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_async", - "title": "DataprocMetastore deleteFederation Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single federation.", - "canonical": true, - "file": "dataproc_metastore_federation.delete_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.DeleteFederation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "DeleteFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.DeleteFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1beta/src/index.ts deleted file mode 100644 index e31d0dee438..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/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 v1beta from './v1beta'; -const DataprocMetastoreClient = v1beta.DataprocMetastoreClient; -type DataprocMetastoreClient = v1beta.DataprocMetastoreClient; -const DataprocMetastoreFederationClient = v1beta.DataprocMetastoreFederationClient; -type DataprocMetastoreFederationClient = v1beta.DataprocMetastoreFederationClient; -export {v1beta, DataprocMetastoreClient, DataprocMetastoreFederationClient}; -export default {v1beta, DataprocMetastoreClient, DataprocMetastoreFederationClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client.ts b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client.ts deleted file mode 100644 index 777f3bcf8f6..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client.ts +++ /dev/null @@ -1,3539 +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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1beta/dataproc_metastore_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './dataproc_metastore_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Configures and manages metastore services. - * Metastore services are fully managed, highly available, autoscaled, - * autohealing, OSS-native deployments of technical metadata management - * software. Each metastore service exposes a network endpoint through which - * metadata queries are served. Metadata queries can originate from a variety - * of sources, including Apache Hive, Apache Presto, and Apache Spark. - * - * The Dataproc Metastore API defines the following resource model: - * - * * The service works with a collection of Google Cloud projects, named: - * `/projects/*` - * * Each project has a collection of available locations, named: `/locations/*` - * (a location must refer to a Google Cloud `region`) - * * Each location has a collection of services, named: `/services/*` - * * Dataproc Metastore services are resources with names of the form: - * - * `/projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @class - * @memberof v1beta - */ -export class DataprocMetastoreClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - dataprocMetastoreStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DataprocMetastoreClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 DataprocMetastoreClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DataprocMetastoreClient; - 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; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - 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 = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' - ), - federationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/federations/{federation}' - ), - lakePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/lakes/{lake}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - metadataImportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' - ), - networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{network}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listServices: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'services'), - listMetadataImports: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metadataImports'), - listBackups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.Service') as gax.protobuf.Type; - const createServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const updateServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.Service') as gax.protobuf.Type; - const updateServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const deleteServiceResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const createMetadataImportResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.MetadataImport') as gax.protobuf.Type; - const createMetadataImportMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const updateMetadataImportResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.MetadataImport') as gax.protobuf.Type; - const updateMetadataImportMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const exportMetadataResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.MetadataExport') as gax.protobuf.Type; - const exportMetadataMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const restoreServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.Restore') as gax.protobuf.Type; - const restoreServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const createBackupResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.Backup') as gax.protobuf.Type; - const createBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const deleteBackupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const queryMetadataResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.QueryMetadataResponse') as gax.protobuf.Type; - const queryMetadataMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const moveTableToDatabaseResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.MoveTableToDatabaseResponse') as gax.protobuf.Type; - const moveTableToDatabaseMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const alterMetadataResourceLocationResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.AlterMetadataResourceLocationResponse') as gax.protobuf.Type; - const alterMetadataResourceLocationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createServiceResponse.decode.bind(createServiceResponse), - createServiceMetadata.decode.bind(createServiceMetadata)), - updateService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateServiceResponse.decode.bind(updateServiceResponse), - updateServiceMetadata.decode.bind(updateServiceMetadata)), - deleteService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteServiceResponse.decode.bind(deleteServiceResponse), - deleteServiceMetadata.decode.bind(deleteServiceMetadata)), - createMetadataImport: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createMetadataImportResponse.decode.bind(createMetadataImportResponse), - createMetadataImportMetadata.decode.bind(createMetadataImportMetadata)), - updateMetadataImport: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateMetadataImportResponse.decode.bind(updateMetadataImportResponse), - updateMetadataImportMetadata.decode.bind(updateMetadataImportMetadata)), - exportMetadata: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportMetadataResponse.decode.bind(exportMetadataResponse), - exportMetadataMetadata.decode.bind(exportMetadataMetadata)), - restoreService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - restoreServiceResponse.decode.bind(restoreServiceResponse), - restoreServiceMetadata.decode.bind(restoreServiceMetadata)), - createBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBackupResponse.decode.bind(createBackupResponse), - createBackupMetadata.decode.bind(createBackupMetadata)), - deleteBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteBackupResponse.decode.bind(deleteBackupResponse), - deleteBackupMetadata.decode.bind(deleteBackupMetadata)), - queryMetadata: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - queryMetadataResponse.decode.bind(queryMetadataResponse), - queryMetadataMetadata.decode.bind(queryMetadataMetadata)), - moveTableToDatabase: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - moveTableToDatabaseResponse.decode.bind(moveTableToDatabaseResponse), - moveTableToDatabaseMetadata.decode.bind(moveTableToDatabaseMetadata)), - alterMetadataResourceLocation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - alterMetadataResourceLocationResponse.decode.bind(alterMetadataResourceLocationResponse), - alterMetadataResourceLocationMetadata.decode.bind(alterMetadataResourceLocationMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.metastore.v1beta.DataprocMetastore', 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.dataprocMetastoreStub) { - return this.dataprocMetastoreStub; - } - - // Put together the "service stub" for - // google.cloud.metastore.v1beta.DataprocMetastore. - this.dataprocMetastoreStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1beta.DataprocMetastore') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.metastore.v1beta.DataprocMetastore, - 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 dataprocMetastoreStubMethods = - ['listServices', 'getService', 'createService', 'updateService', 'deleteService', 'listMetadataImports', 'getMetadataImport', 'createMetadataImport', 'updateMetadataImport', 'exportMetadata', 'restoreService', 'listBackups', 'getBackup', 'createBackup', 'deleteBackup', 'removeIamPolicy', 'queryMetadata', 'moveTableToDatabase', 'alterMetadataResourceLocation']; - for (const methodName of dataprocMetastoreStubMethods) { - const callPromise = this.dataprocMetastoreStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.dataprocMetastoreStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'metastore.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 'metastore.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 -- - // ------------------- -/** - * Gets the details of a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore service to retrieve, - * in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.metastore.v1beta.Service|Service}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.get_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_GetService_async - */ - getService( - request?: protos.google.cloud.metastore.v1beta.IGetServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1beta.IService, - protos.google.cloud.metastore.v1beta.IGetServiceRequest|undefined, {}|undefined - ]>; - getService( - request: protos.google.cloud.metastore.v1beta.IGetServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1beta.IService, - protos.google.cloud.metastore.v1beta.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; - getService( - request: protos.google.cloud.metastore.v1beta.IGetServiceRequest, - callback: Callback< - protos.google.cloud.metastore.v1beta.IService, - protos.google.cloud.metastore.v1beta.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; - getService( - request?: protos.google.cloud.metastore.v1beta.IGetServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1beta.IService, - protos.google.cloud.metastore.v1beta.IGetServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1beta.IService, - protos.google.cloud.metastore.v1beta.IGetServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1beta.IService, - protos.google.cloud.metastore.v1beta.IGetServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getService(request, options, callback); - } -/** - * Gets details of a single import. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metadata import to retrieve, in - * the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_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 protos.google.cloud.metastore.v1beta.MetadataImport|MetadataImport}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.get_metadata_import.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_GetMetadataImport_async - */ - getMetadataImport( - request?: protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1beta.IMetadataImport, - protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|undefined, {}|undefined - ]>; - getMetadataImport( - request: protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1beta.IMetadataImport, - protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): void; - getMetadataImport( - request: protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest, - callback: Callback< - protos.google.cloud.metastore.v1beta.IMetadataImport, - protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): void; - getMetadataImport( - request?: protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1beta.IMetadataImport, - protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1beta.IMetadataImport, - protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1beta.IMetadataImport, - protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|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.getMetadataImport(request, options, callback); - } -/** - * Gets details of a single backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the backup to retrieve, in the - * following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_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 protos.google.cloud.metastore.v1beta.Backup|Backup}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.get_backup.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_GetBackup_async - */ - getBackup( - request?: protos.google.cloud.metastore.v1beta.IGetBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1beta.IBackup, - protos.google.cloud.metastore.v1beta.IGetBackupRequest|undefined, {}|undefined - ]>; - getBackup( - request: protos.google.cloud.metastore.v1beta.IGetBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1beta.IBackup, - protos.google.cloud.metastore.v1beta.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request: protos.google.cloud.metastore.v1beta.IGetBackupRequest, - callback: Callback< - protos.google.cloud.metastore.v1beta.IBackup, - protos.google.cloud.metastore.v1beta.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request?: protos.google.cloud.metastore.v1beta.IGetBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1beta.IBackup, - protos.google.cloud.metastore.v1beta.IGetBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1beta.IBackup, - protos.google.cloud.metastore.v1beta.IGetBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1beta.IBackup, - protos.google.cloud.metastore.v1beta.IGetBackupRequest|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.getBackup(request, options, callback); - } -/** - * Removes the attached IAM policies for a resource - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * Required. The relative resource name of the dataplane resource to remove - * IAM policy, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}` - * or - * `projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}`. - * @param {boolean} [request.asynchronous] - * Optional. Removes IAM policy attached to database or table asynchronously - * when it is set. The default is false. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.metastore.v1beta.RemoveIamPolicyResponse|RemoveIamPolicyResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.remove_iam_policy.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_RemoveIamPolicy_async - */ - removeIamPolicy( - request?: protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1beta.IRemoveIamPolicyResponse, - protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest|undefined, {}|undefined - ]>; - removeIamPolicy( - request: protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1beta.IRemoveIamPolicyResponse, - protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - removeIamPolicy( - request: protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest, - callback: Callback< - protos.google.cloud.metastore.v1beta.IRemoveIamPolicyResponse, - protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - removeIamPolicy( - request?: protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1beta.IRemoveIamPolicyResponse, - protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1beta.IRemoveIamPolicyResponse, - protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1beta.IRemoveIamPolicyResponse, - protos.google.cloud.metastore.v1beta.IRemoveIamPolicyRequest|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.removeIamPolicy(request, options, callback); - } - -/** - * Creates a metastore service in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location in which to create a - * metastore service, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {string} request.serviceId - * Required. The ID of the metastore service, which is used as the final - * component of the metastore service's name. - * - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - * @param {google.cloud.metastore.v1beta.Service} request.service - * Required. The Metastore service to create. The `name` field is - * ignored. The ID of the created metastore service must be provided in - * the request's `service_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.create_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateService_async - */ - createService( - request?: protos.google.cloud.metastore.v1beta.ICreateServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createService( - request: protos.google.cloud.metastore.v1beta.ICreateServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createService( - request: protos.google.cloud.metastore.v1beta.ICreateServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createService( - request?: protos.google.cloud.metastore.v1beta.ICreateServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.create_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateService_async - */ - async checkCreateServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the parameters of a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metastore service resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1beta.Service} request.service - * Required. The metastore service to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * - * The metastore service's `name` field is used to identify the metastore - * service to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.update_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_UpdateService_async - */ - updateService( - request?: protos.google.cloud.metastore.v1beta.IUpdateServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateService( - request: protos.google.cloud.metastore.v1beta.IUpdateServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateService( - request: protos.google.cloud.metastore.v1beta.IUpdateServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateService( - request?: protos.google.cloud.metastore.v1beta.IUpdateServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service.name': request.service!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.update_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_UpdateService_async - */ - async checkUpdateServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore service to delete, in - * the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.delete_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_DeleteService_async - */ - deleteService( - request?: protos.google.cloud.metastore.v1beta.IDeleteServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteService( - request: protos.google.cloud.metastore.v1beta.IDeleteServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteService( - request: protos.google.cloud.metastore.v1beta.IDeleteServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteService( - request?: protos.google.cloud.metastore.v1beta.IDeleteServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.delete_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_DeleteService_async - */ - async checkDeleteServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new MetadataImport in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service in which to create a - * metastore import, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} request.metadataImportId - * Required. The ID of the metadata import, which is used as the final - * component of the metadata import's name. - * - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - * @param {google.cloud.metastore.v1beta.MetadataImport} request.metadataImport - * Required. The metadata import to create. The `name` field is ignored. The - * ID of the created metadata import must be provided in the request's - * `metadata_import_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.create_metadata_import.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_async - */ - createMetadataImport( - request?: protos.google.cloud.metastore.v1beta.ICreateMetadataImportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createMetadataImport( - request: protos.google.cloud.metastore.v1beta.ICreateMetadataImportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMetadataImport( - request: protos.google.cloud.metastore.v1beta.ICreateMetadataImportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMetadataImport( - request?: protos.google.cloud.metastore.v1beta.ICreateMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createMetadataImport(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createMetadataImport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.create_metadata_import.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_async - */ - async checkCreateMetadataImportProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMetadataImport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates a single import. - * Only the description field of MetadataImport is supported to be updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metadata import resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1beta.MetadataImport} request.metadataImport - * Required. The metadata import to update. The server only merges fields - * in the import if they are specified in `update_mask`. - * - * The metadata import's `name` field is used to identify the metastore - * import to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.update_metadata_import.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_async - */ - updateMetadataImport( - request?: protos.google.cloud.metastore.v1beta.IUpdateMetadataImportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateMetadataImport( - request: protos.google.cloud.metastore.v1beta.IUpdateMetadataImportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMetadataImport( - request: protos.google.cloud.metastore.v1beta.IUpdateMetadataImportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMetadataImport( - request?: protos.google.cloud.metastore.v1beta.IUpdateMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metadata_import.name': request.metadataImport!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateMetadataImport(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateMetadataImport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.update_metadata_import.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_async - */ - async checkUpdateMetadataImportProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMetadataImport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Exports metadata from a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.destinationGcsFolder - * A Cloud Storage URI of a folder, in the format - * `gs:///`. A sub-folder - * `` containing exported files will be created below it. - * @param {string} request.service - * Required. The relative resource name of the metastore service to run - * export, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {google.cloud.metastore.v1beta.DatabaseDumpSpec.Type} [request.databaseDumpType] - * Optional. The type of the database dump. If unspecified, defaults to - * `MYSQL`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.export_metadata.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_ExportMetadata_async - */ - exportMetadata( - request?: protos.google.cloud.metastore.v1beta.IExportMetadataRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportMetadata( - request: protos.google.cloud.metastore.v1beta.IExportMetadataRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportMetadata( - request: protos.google.cloud.metastore.v1beta.IExportMetadataRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportMetadata( - request?: protos.google.cloud.metastore.v1beta.IExportMetadataRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.exportMetadata(request, options, callback); - } -/** - * Check the status of the long running operation returned by `exportMetadata()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.export_metadata.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_ExportMetadata_async - */ - async checkExportMetadataProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportMetadata, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Restores a service from a backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.service - * Required. The relative resource name of the metastore service to run - * restore, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} request.backup - * Required. The relative resource name of the metastore service backup to - * restore from, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - * @param {google.cloud.metastore.v1beta.Restore.RestoreType} [request.restoreType] - * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.restore_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_RestoreService_async - */ - restoreService( - request?: protos.google.cloud.metastore.v1beta.IRestoreServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - restoreService( - request: protos.google.cloud.metastore.v1beta.IRestoreServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreService( - request: protos.google.cloud.metastore.v1beta.IRestoreServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreService( - request?: protos.google.cloud.metastore.v1beta.IRestoreServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.restoreService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `restoreService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.restore_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_RestoreService_async - */ - async checkRestoreServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new backup in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service in which to create a - * backup of the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} request.backupId - * Required. The ID of the backup, which is used as the final component of the - * backup's name. - * - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - * @param {google.cloud.metastore.v1beta.Backup} request.backup - * Required. The backup to create. The `name` field is ignored. The ID of the - * created backup must be provided in the request's `backup_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.create_backup.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateBackup_async - */ - createBackup( - request?: protos.google.cloud.metastore.v1beta.ICreateBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createBackup( - request: protos.google.cloud.metastore.v1beta.ICreateBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request: protos.google.cloud.metastore.v1beta.ICreateBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request?: protos.google.cloud.metastore.v1beta.ICreateBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.create_backup.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateBackup_async - */ - async checkCreateBackupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the backup to delete, in the - * following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.delete_backup.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_DeleteBackup_async - */ - deleteBackup( - request?: protos.google.cloud.metastore.v1beta.IDeleteBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteBackup( - request: protos.google.cloud.metastore.v1beta.IDeleteBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request: protos.google.cloud.metastore.v1beta.IDeleteBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request?: protos.google.cloud.metastore.v1beta.IDeleteBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.delete_backup.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_DeleteBackup_async - */ - async checkDeleteBackupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteBackup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Query DPMS metadata. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.service - * Required. The relative resource name of the metastore service to query - * metadata, in the following format: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} request.query - * Required. A read-only SQL query to execute against the metadata database. - * The query cannot change or mutate the data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.query_metadata.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_QueryMetadata_async - */ - queryMetadata( - request?: protos.google.cloud.metastore.v1beta.IQueryMetadataRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - queryMetadata( - request: protos.google.cloud.metastore.v1beta.IQueryMetadataRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - queryMetadata( - request: protos.google.cloud.metastore.v1beta.IQueryMetadataRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - queryMetadata( - request?: protos.google.cloud.metastore.v1beta.IQueryMetadataRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.queryMetadata(request, options, callback); - } -/** - * Check the status of the long running operation returned by `queryMetadata()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.query_metadata.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_QueryMetadata_async - */ - async checkQueryMetadataProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.queryMetadata, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Move a table to another database. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.service - * Required. The relative resource name of the metastore service to mutate - * metadata, in the following format: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} request.tableName - * Required. The name of the table to be moved. - * @param {string} request.dbName - * Required. The name of the database where the table resides. - * @param {string} request.destinationDbName - * Required. The name of the database where the table should be moved. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.move_table_to_database.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_MoveTableToDatabase_async - */ - moveTableToDatabase( - request?: protos.google.cloud.metastore.v1beta.IMoveTableToDatabaseRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - moveTableToDatabase( - request: protos.google.cloud.metastore.v1beta.IMoveTableToDatabaseRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - moveTableToDatabase( - request: protos.google.cloud.metastore.v1beta.IMoveTableToDatabaseRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - moveTableToDatabase( - request?: protos.google.cloud.metastore.v1beta.IMoveTableToDatabaseRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.moveTableToDatabase(request, options, callback); - } -/** - * Check the status of the long running operation returned by `moveTableToDatabase()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.move_table_to_database.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_MoveTableToDatabase_async - */ - async checkMoveTableToDatabaseProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.moveTableToDatabase, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Alter metadata resource location. The metadata resource can be a database, - * table, or partition. This functionality only updates the parent directory - * for the respective metadata resource and does not transfer any existing - * data to the new location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.service - * Required. The relative resource name of the metastore service to mutate - * metadata, in the following format: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} request.resourceName - * Required. The relative metadata resource name in the following format. - * - * `databases/{database_id}` - * or - * `databases/{database_id}/tables/{table_id}` - * or - * `databases/{database_id}/tables/{table_id}/partitions/{partition_id}` - * @param {string} request.locationUri - * Required. The new location URI for the metadata 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.alter_metadata_resource_location.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_AlterMetadataResourceLocation_async - */ - alterMetadataResourceLocation( - request?: protos.google.cloud.metastore.v1beta.IAlterMetadataResourceLocationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - alterMetadataResourceLocation( - request: protos.google.cloud.metastore.v1beta.IAlterMetadataResourceLocationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - alterMetadataResourceLocation( - request: protos.google.cloud.metastore.v1beta.IAlterMetadataResourceLocationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - alterMetadataResourceLocation( - request?: protos.google.cloud.metastore.v1beta.IAlterMetadataResourceLocationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.alterMetadataResourceLocation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `alterMetadataResourceLocation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.alter_metadata_resource_location.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_AlterMetadataResourceLocation_async - */ - async checkAlterMetadataResourceLocationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.alterMetadataResourceLocation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists services in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1beta.Service|Service}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listServicesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listServices( - request?: protos.google.cloud.metastore.v1beta.IListServicesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1beta.IService[], - protos.google.cloud.metastore.v1beta.IListServicesRequest|null, - protos.google.cloud.metastore.v1beta.IListServicesResponse - ]>; - listServices( - request: protos.google.cloud.metastore.v1beta.IListServicesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListServicesRequest, - protos.google.cloud.metastore.v1beta.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IService>): void; - listServices( - request: protos.google.cloud.metastore.v1beta.IListServicesRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListServicesRequest, - protos.google.cloud.metastore.v1beta.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IService>): void; - listServices( - request?: protos.google.cloud.metastore.v1beta.IListServicesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1beta.IListServicesRequest, - protos.google.cloud.metastore.v1beta.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IService>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListServicesRequest, - protos.google.cloud.metastore.v1beta.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IService>): - Promise<[ - protos.google.cloud.metastore.v1beta.IService[], - protos.google.cloud.metastore.v1beta.IListServicesRequest|null, - protos.google.cloud.metastore.v1beta.IListServicesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listServices(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 protos.google.cloud.metastore.v1beta.Service|Service} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listServicesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listServicesStream( - request?: protos.google.cloud.metastore.v1beta.IListServicesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listServices.createStream( - this.innerApiCalls.listServices as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listServices`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.metastore.v1beta.Service|Service}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.list_services.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_ListServices_async - */ - listServicesAsync( - request?: protos.google.cloud.metastore.v1beta.IListServicesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listServices.asyncIterate( - this.innerApiCalls['listServices'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists imports in a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1beta.MetadataImport|MetadataImport}. - * 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 `listMetadataImportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMetadataImports( - request?: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1beta.IMetadataImport[], - protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest|null, - protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse - ]>; - listMetadataImports( - request: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IMetadataImport>): void; - listMetadataImports( - request: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IMetadataImport>): void; - listMetadataImports( - request?: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IMetadataImport>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IMetadataImport>): - Promise<[ - protos.google.cloud.metastore.v1beta.IMetadataImport[], - protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest|null, - protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listMetadataImports(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 protos.google.cloud.metastore.v1beta.MetadataImport|MetadataImport} 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 `listMetadataImportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMetadataImportsStream( - request?: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - 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['listMetadataImports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMetadataImports.createStream( - this.innerApiCalls.listMetadataImports as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMetadataImports`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.metastore.v1beta.MetadataImport|MetadataImport}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_ListMetadataImports_async - */ - listMetadataImportsAsync( - request?: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - 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['listMetadataImports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMetadataImports.asyncIterate( - this.innerApiCalls['listMetadataImports'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists backups in a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1beta.Backup|Backup}. - * 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 `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBackups( - request?: protos.google.cloud.metastore.v1beta.IListBackupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1beta.IBackup[], - protos.google.cloud.metastore.v1beta.IListBackupsRequest|null, - protos.google.cloud.metastore.v1beta.IListBackupsResponse - ]>; - listBackups( - request: protos.google.cloud.metastore.v1beta.IListBackupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListBackupsRequest, - protos.google.cloud.metastore.v1beta.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IBackup>): void; - listBackups( - request: protos.google.cloud.metastore.v1beta.IListBackupsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListBackupsRequest, - protos.google.cloud.metastore.v1beta.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IBackup>): void; - listBackups( - request?: protos.google.cloud.metastore.v1beta.IListBackupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1beta.IListBackupsRequest, - protos.google.cloud.metastore.v1beta.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IBackup>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListBackupsRequest, - protos.google.cloud.metastore.v1beta.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IBackup>): - Promise<[ - protos.google.cloud.metastore.v1beta.IBackup[], - protos.google.cloud.metastore.v1beta.IListBackupsRequest|null, - protos.google.cloud.metastore.v1beta.IListBackupsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listBackups(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 protos.google.cloud.metastore.v1beta.Backup|Backup} 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 `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBackupsStream( - request?: protos.google.cloud.metastore.v1beta.IListBackupsRequest, - 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['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.createStream( - this.innerApiCalls.listBackups as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBackups`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link protos.google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.metastore.v1beta.Backup|Backup}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.list_backups.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_ListBackups_async - */ - listBackupsAsync( - request?: protos.google.cloud.metastore.v1beta.IListBackupsRequest, - 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['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.asyncIterate( - this.innerApiCalls['listBackups'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project:string,location:string,service:string,backup:string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - location: location, - service: service, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the location from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).location; - } - - /** - * Parse the service from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the service. - */ - matchServiceFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).service; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified federation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} federation - * @returns {string} Resource name string. - */ - federationPath(project:string,location:string,federation:string) { - return this.pathTemplates.federationPathTemplate.render({ - project: project, - location: location, - federation: federation, - }); - } - - /** - * Parse the project from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).project; - } - - /** - * Parse the location from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).location; - } - - /** - * Parse the federation from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the federation. - */ - matchFederationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).federation; - } - - /** - * Return a fully-qualified lake resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} lake - * @returns {string} Resource name string. - */ - lakePath(project:string,location:string,lake:string) { - return this.pathTemplates.lakePathTemplate.render({ - project: project, - location: location, - lake: lake, - }); - } - - /** - * Parse the project from Lake resource. - * - * @param {string} lakeName - * A fully-qualified path representing Lake resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLakeName(lakeName: string) { - return this.pathTemplates.lakePathTemplate.match(lakeName).project; - } - - /** - * Parse the location from Lake resource. - * - * @param {string} lakeName - * A fully-qualified path representing Lake resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLakeName(lakeName: string) { - return this.pathTemplates.lakePathTemplate.match(lakeName).location; - } - - /** - * Parse the lake from Lake resource. - * - * @param {string} lakeName - * A fully-qualified path representing Lake resource. - * @returns {string} A string representing the lake. - */ - matchLakeFromLakeName(lakeName: string) { - return this.pathTemplates.lakePathTemplate.match(lakeName).lake; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified metadataImport resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} metadata_import - * @returns {string} Resource name string. - */ - metadataImportPath(project:string,location:string,service:string,metadataImport:string) { - return this.pathTemplates.metadataImportPathTemplate.render({ - project: project, - location: location, - service: service, - metadata_import: metadataImport, - }); - } - - /** - * Parse the project from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; - } - - /** - * Parse the location from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; - } - - /** - * Parse the service from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the service. - */ - matchServiceFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; - } - - /** - * Parse the metadata_import from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the metadata_import. - */ - matchMetadataImportFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; - } - - /** - * Return a fully-qualified network resource name string. - * - * @param {string} project - * @param {string} network - * @returns {string} Resource name string. - */ - networkPath(project:string,network:string) { - return this.pathTemplates.networkPathTemplate.render({ - project: project, - network: network, - }); - } - - /** - * Parse the project from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).project; - } - - /** - * Parse the network from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the network. - */ - matchNetworkFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).network; - } - - /** - * 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 service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - service: service, - }); - } - - /** - * Parse the project from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).project; - } - - /** - * Parse the location from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).location; - } - - /** - * Parse the service from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).service; - } - - /** - * 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.dataprocMetastoreStub && !this._terminated) { - return this.dataprocMetastoreStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client_config.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client_config.json deleted file mode 100644 index fd4e34e7f36..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client_config.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "interfaces": { - "google.cloud.metastore.v1beta.DataprocMetastore": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListServices": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetService": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListMetadataImports": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ExportMetadata": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RestoreService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBackups": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetBackup": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RemoveIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "QueryMetadata": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "MoveTableToDatabase": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "AlterMetadataResourceLocation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client.ts b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client.ts deleted file mode 100644 index 54f736af14d..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client.ts +++ /dev/null @@ -1,1714 +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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1beta/dataproc_metastore_federation_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './dataproc_metastore_federation_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Configures and manages metastore federation services. - * Dataproc Metastore Federation Service allows federating a collection of - * backend metastores like BigQuery, Dataplex Lakes, and other Dataproc - * Metastores. The Federation Service exposes a gRPC URL through which metadata - * from the backend metastores are served at query time. - * - * The Dataproc Metastore Federation API defines the following resource model: - * * The service works with a collection of Google Cloud projects. - * * Each project has a collection of available locations. - * * Each location has a collection of federations. - * * Dataproc Metastore Federations are resources with names of the - * form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - * @class - * @memberof v1beta - */ -export class DataprocMetastoreFederationClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - dataprocMetastoreFederationStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DataprocMetastoreFederationClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 DataprocMetastoreFederationClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DataprocMetastoreFederationClient; - 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; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - 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 = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' - ), - federationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/federations/{federation}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - metadataImportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ), - }; - - // 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 = { - listFederations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'federations') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createFederationResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.Federation') as gax.protobuf.Type; - const createFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const updateFederationResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.Federation') as gax.protobuf.Type; - const updateFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const deleteFederationResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createFederationResponse.decode.bind(createFederationResponse), - createFederationMetadata.decode.bind(createFederationMetadata)), - updateFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateFederationResponse.decode.bind(updateFederationResponse), - updateFederationMetadata.decode.bind(updateFederationMetadata)), - deleteFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteFederationResponse.decode.bind(deleteFederationResponse), - deleteFederationMetadata.decode.bind(deleteFederationMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.metastore.v1beta.DataprocMetastoreFederation', 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.dataprocMetastoreFederationStub) { - return this.dataprocMetastoreFederationStub; - } - - // Put together the "service stub" for - // google.cloud.metastore.v1beta.DataprocMetastoreFederation. - this.dataprocMetastoreFederationStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1beta.DataprocMetastoreFederation') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.metastore.v1beta.DataprocMetastoreFederation, - 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 dataprocMetastoreFederationStubMethods = - ['listFederations', 'getFederation', 'createFederation', 'updateFederation', 'deleteFederation']; - for (const methodName of dataprocMetastoreFederationStubMethods) { - const callPromise = this.dataprocMetastoreFederationStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.dataprocMetastoreFederationStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'metastore.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 'metastore.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 -- - // ------------------- -/** - * Gets the details of a single federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore federation to - * retrieve, in the following form: - * - * `projects/{project_number}/locations/{location_id}/federations/{federation_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 protos.google.cloud.metastore.v1beta.Federation|Federation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore_federation.get_federation.js - * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_GetFederation_async - */ - getFederation( - request?: protos.google.cloud.metastore.v1beta.IGetFederationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1beta.IFederation, - protos.google.cloud.metastore.v1beta.IGetFederationRequest|undefined, {}|undefined - ]>; - getFederation( - request: protos.google.cloud.metastore.v1beta.IGetFederationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1beta.IFederation, - protos.google.cloud.metastore.v1beta.IGetFederationRequest|null|undefined, - {}|null|undefined>): void; - getFederation( - request: protos.google.cloud.metastore.v1beta.IGetFederationRequest, - callback: Callback< - protos.google.cloud.metastore.v1beta.IFederation, - protos.google.cloud.metastore.v1beta.IGetFederationRequest|null|undefined, - {}|null|undefined>): void; - getFederation( - request?: protos.google.cloud.metastore.v1beta.IGetFederationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1beta.IFederation, - protos.google.cloud.metastore.v1beta.IGetFederationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1beta.IFederation, - protos.google.cloud.metastore.v1beta.IGetFederationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1beta.IFederation, - protos.google.cloud.metastore.v1beta.IGetFederationRequest|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.getFederation(request, options, callback); - } - -/** - * Creates a metastore federation in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location in which to create a - * federation service, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {string} request.federationId - * Required. The ID of the metastore federation, which is used as the final - * component of the metastore federation's name. - * - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - * @param {google.cloud.metastore.v1beta.Federation} request.federation - * Required. The Metastore Federation to create. The `name` field is - * ignored. The ID of the created metastore federation must be - * provided in the request's `federation_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore_federation.create_federation.js - * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_async - */ - createFederation( - request?: protos.google.cloud.metastore.v1beta.ICreateFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createFederation( - request: protos.google.cloud.metastore.v1beta.ICreateFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFederation( - request: protos.google.cloud.metastore.v1beta.ICreateFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFederation( - request?: protos.google.cloud.metastore.v1beta.ICreateFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore_federation.create_federation.js - * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_async - */ - async checkCreateFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the fields of a federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metastore federation resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1beta.Federation} request.federation - * Required. The metastore federation to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * - * The metastore federation's `name` field is used to identify the - * metastore service to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore_federation.update_federation.js - * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_async - */ - updateFederation( - request?: protos.google.cloud.metastore.v1beta.IUpdateFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateFederation( - request: protos.google.cloud.metastore.v1beta.IUpdateFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFederation( - request: protos.google.cloud.metastore.v1beta.IUpdateFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFederation( - request?: protos.google.cloud.metastore.v1beta.IUpdateFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'federation.name': request.federation!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore_federation.update_federation.js - * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_async - */ - async checkUpdateFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore federation to delete, - * in the following form: - * - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js - * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_async - */ - deleteFederation( - request?: protos.google.cloud.metastore.v1beta.IDeleteFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteFederation( - request: protos.google.cloud.metastore.v1beta.IDeleteFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFederation( - request: protos.google.cloud.metastore.v1beta.IDeleteFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFederation( - request?: protos.google.cloud.metastore.v1beta.IDeleteFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js - * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_async - */ - async checkDeleteFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists federations in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore - * federations to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.metastore.v1beta.Federation|Federation}. - * 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 `listFederationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFederations( - request?: protos.google.cloud.metastore.v1beta.IListFederationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1beta.IFederation[], - protos.google.cloud.metastore.v1beta.IListFederationsRequest|null, - protos.google.cloud.metastore.v1beta.IListFederationsResponse - ]>; - listFederations( - request: protos.google.cloud.metastore.v1beta.IListFederationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListFederationsRequest, - protos.google.cloud.metastore.v1beta.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IFederation>): void; - listFederations( - request: protos.google.cloud.metastore.v1beta.IListFederationsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListFederationsRequest, - protos.google.cloud.metastore.v1beta.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IFederation>): void; - listFederations( - request?: protos.google.cloud.metastore.v1beta.IListFederationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1beta.IListFederationsRequest, - protos.google.cloud.metastore.v1beta.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IFederation>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListFederationsRequest, - protos.google.cloud.metastore.v1beta.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IFederation>): - Promise<[ - protos.google.cloud.metastore.v1beta.IFederation[], - protos.google.cloud.metastore.v1beta.IListFederationsRequest|null, - protos.google.cloud.metastore.v1beta.IListFederationsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listFederations(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore - * federations to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 protos.google.cloud.metastore.v1beta.Federation|Federation} 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 `listFederationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFederationsStream( - request?: protos.google.cloud.metastore.v1beta.IListFederationsRequest, - 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['listFederations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFederations.createStream( - this.innerApiCalls.listFederations as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFederations`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore - * federations to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.metastore.v1beta.Federation|Federation}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore_federation.list_federations.js - * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_ListFederations_async - */ - listFederationsAsync( - request?: protos.google.cloud.metastore.v1beta.IListFederationsRequest, - 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['listFederations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFederations.asyncIterate( - this.innerApiCalls['listFederations'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project:string,location:string,service:string,backup:string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - location: location, - service: service, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the location from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).location; - } - - /** - * Parse the service from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the service. - */ - matchServiceFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).service; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified federation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} federation - * @returns {string} Resource name string. - */ - federationPath(project:string,location:string,federation:string) { - return this.pathTemplates.federationPathTemplate.render({ - project: project, - location: location, - federation: federation, - }); - } - - /** - * Parse the project from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).project; - } - - /** - * Parse the location from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).location; - } - - /** - * Parse the federation from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the federation. - */ - matchFederationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).federation; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified metadataImport resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} metadata_import - * @returns {string} Resource name string. - */ - metadataImportPath(project:string,location:string,service:string,metadataImport:string) { - return this.pathTemplates.metadataImportPathTemplate.render({ - project: project, - location: location, - service: service, - metadata_import: metadataImport, - }); - } - - /** - * Parse the project from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; - } - - /** - * Parse the location from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; - } - - /** - * Parse the service from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the service. - */ - matchServiceFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; - } - - /** - * Parse the metadata_import from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the metadata_import. - */ - matchMetadataImportFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; - } - - /** - * 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 service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - service: service, - }); - } - - /** - * Parse the project from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).project; - } - - /** - * Parse the location from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).location; - } - - /** - * Parse the service from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).service; - } - - /** - * 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.dataprocMetastoreFederationStub && !this._terminated) { - return this.dataprocMetastoreFederationStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client_config.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client_config.json deleted file mode 100644 index e6e1944d917..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.metastore.v1beta.DataprocMetastoreFederation": { - "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": { - "ListFederations": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_proto_list.json deleted file mode 100644 index aaeb52eb5c3..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/metastore/v1beta/metastore.proto", - "../../protos/google/cloud/metastore/v1beta/metastore_federation.proto" -] diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_proto_list.json deleted file mode 100644 index aaeb52eb5c3..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/metastore/v1beta/metastore.proto", - "../../protos/google/cloud/metastore/v1beta/metastore_federation.proto" -] diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/gapic_metadata.json deleted file mode 100644 index 7d471236061..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/gapic_metadata.json +++ /dev/null @@ -1,293 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.metastore.v1beta", - "libraryPackage": "@google-cloud/dataproc-metastore", - "services": { - "DataprocMetastore": { - "clients": { - "grpc": { - "libraryClient": "DataprocMetastoreClient", - "rpcs": { - "GetService": { - "methods": [ - "getService" - ] - }, - "GetMetadataImport": { - "methods": [ - "getMetadataImport" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "RemoveIamPolicy": { - "methods": [ - "removeIamPolicy" - ] - }, - "CreateService": { - "methods": [ - "createService" - ] - }, - "UpdateService": { - "methods": [ - "updateService" - ] - }, - "DeleteService": { - "methods": [ - "deleteService" - ] - }, - "CreateMetadataImport": { - "methods": [ - "createMetadataImport" - ] - }, - "UpdateMetadataImport": { - "methods": [ - "updateMetadataImport" - ] - }, - "ExportMetadata": { - "methods": [ - "exportMetadata" - ] - }, - "RestoreService": { - "methods": [ - "restoreService" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "QueryMetadata": { - "methods": [ - "queryMetadata" - ] - }, - "MoveTableToDatabase": { - "methods": [ - "moveTableToDatabase" - ] - }, - "AlterMetadataResourceLocation": { - "methods": [ - "alterMetadataResourceLocation" - ] - }, - "ListServices": { - "methods": [ - "listServices", - "listServicesStream", - "listServicesAsync" - ] - }, - "ListMetadataImports": { - "methods": [ - "listMetadataImports", - "listMetadataImportsStream", - "listMetadataImportsAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "DataprocMetastoreClient", - "rpcs": { - "GetService": { - "methods": [ - "getService" - ] - }, - "GetMetadataImport": { - "methods": [ - "getMetadataImport" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "RemoveIamPolicy": { - "methods": [ - "removeIamPolicy" - ] - }, - "CreateService": { - "methods": [ - "createService" - ] - }, - "UpdateService": { - "methods": [ - "updateService" - ] - }, - "DeleteService": { - "methods": [ - "deleteService" - ] - }, - "CreateMetadataImport": { - "methods": [ - "createMetadataImport" - ] - }, - "UpdateMetadataImport": { - "methods": [ - "updateMetadataImport" - ] - }, - "ExportMetadata": { - "methods": [ - "exportMetadata" - ] - }, - "RestoreService": { - "methods": [ - "restoreService" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "QueryMetadata": { - "methods": [ - "queryMetadata" - ] - }, - "MoveTableToDatabase": { - "methods": [ - "moveTableToDatabase" - ] - }, - "AlterMetadataResourceLocation": { - "methods": [ - "alterMetadataResourceLocation" - ] - }, - "ListServices": { - "methods": [ - "listServices", - "listServicesStream", - "listServicesAsync" - ] - }, - "ListMetadataImports": { - "methods": [ - "listMetadataImports", - "listMetadataImportsStream", - "listMetadataImportsAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - } - } - }, - "DataprocMetastoreFederation": { - "clients": { - "grpc": { - "libraryClient": "DataprocMetastoreFederationClient", - "rpcs": { - "GetFederation": { - "methods": [ - "getFederation" - ] - }, - "CreateFederation": { - "methods": [ - "createFederation" - ] - }, - "UpdateFederation": { - "methods": [ - "updateFederation" - ] - }, - "DeleteFederation": { - "methods": [ - "deleteFederation" - ] - }, - "ListFederations": { - "methods": [ - "listFederations", - "listFederationsStream", - "listFederationsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "DataprocMetastoreFederationClient", - "rpcs": { - "GetFederation": { - "methods": [ - "getFederation" - ] - }, - "CreateFederation": { - "methods": [ - "createFederation" - ] - }, - "UpdateFederation": { - "methods": [ - "updateFederation" - ] - }, - "DeleteFederation": { - "methods": [ - "deleteFederation" - ] - }, - "ListFederations": { - "methods": [ - "listFederations", - "listFederationsStream", - "listFederationsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/index.ts b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/index.ts deleted file mode 100644 index 74baf047ec9..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/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 {DataprocMetastoreClient} from './dataproc_metastore_client'; -export {DataprocMetastoreFederationClient} from './dataproc_metastore_federation_client'; diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 2d137ce8c89..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/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 metastore = require('@google-cloud/dataproc-metastore'); - -function main() { - const dataprocMetastoreClient = new metastore.DataprocMetastoreClient(); - const dataprocMetastoreFederationClient = new metastore.DataprocMetastoreFederationClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 15fe58ac669..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/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 {DataprocMetastoreClient, DataprocMetastoreFederationClient} from '@google-cloud/dataproc-metastore'; - -// check that the client class type name can be used -function doStuffWithDataprocMetastoreClient(client: DataprocMetastoreClient) { - client.close(); -} -function doStuffWithDataprocMetastoreFederationClient(client: DataprocMetastoreFederationClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const dataprocMetastoreClient = new DataprocMetastoreClient(); - doStuffWithDataprocMetastoreClient(dataprocMetastoreClient); - // check that the client instance can be created - const dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); - doStuffWithDataprocMetastoreFederationClient(dataprocMetastoreFederationClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/system-test/install.ts b/owl-bot-staging/google-cloud-metastore/v1beta/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/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-metastore/v1beta/test/gapic_dataproc_metastore_federation_v1beta.ts b/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_federation_v1beta.ts deleted file mode 100644 index c5d952f69ad..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_federation_v1beta.ts +++ /dev/null @@ -1,2000 +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 dataprocmetastorefederationModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta.DataprocMetastoreFederationClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); - await client.initialize(); - assert(client.dataprocMetastoreFederationStub); - }); - - it('has close method for the initialized client', done => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.dataprocMetastoreFederationStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - 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 dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - 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('getFederation', () => { - it('invokes getFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.Federation() - ); - client.innerApiCalls.getFederation = stubSimpleCall(expectedResponse); - const [response] = await client.getFederation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.Federation() - ); - client.innerApiCalls.getFederation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFederation( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IFederation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFederation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation with closed client', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFederation(request), expectedError); - }); - }); - - describe('createFederation', () => { - it('invokes createFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateFederation', () => { - it('invokes updateFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteFederation', () => { - it('invokes deleteFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listFederations', () => { - it('invokes listFederations without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - ]; - client.innerApiCalls.listFederations = stubSimpleCall(expectedResponse); - const [response] = await client.listFederations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederations without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - ]; - client.innerApiCalls.listFederations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFederations( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IFederation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederations with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFederations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFederations(request), expectedError); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederationsStream without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - ]; - client.descriptors.page.listFederations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFederationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1beta.Federation[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1beta.Federation) => { - 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.listFederations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); - assert( - (client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFederationsStream with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFederations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFederationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1beta.Federation[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1beta.Federation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); - assert( - (client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFederations without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - ]; - client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1beta.IFederation[] = []; - const iterable = client.listFederationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFederations with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFederationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1beta.IFederation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('backup', () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - backup: "backupValue", - }; - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackupName', () => { - const result = client.matchLocationFromBackupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromBackupName', () => { - const result = client.matchServiceFromBackupName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('federation', () => { - const fakePath = "/rendered/path/federation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - federation: "federationValue", - }; - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.federationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.federationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('federationPath', () => { - const result = client.federationPath("projectValue", "locationValue", "federationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.federationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFederationName', () => { - const result = client.matchProjectFromFederationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFederationName', () => { - const result = client.matchLocationFromFederationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFederationFromFederationName', () => { - const result = client.matchFederationFromFederationName(fakePath); - assert.strictEqual(result, "federationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('metadataImport', () => { - const fakePath = "/rendered/path/metadataImport"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - metadata_import: "metadataImportValue", - }; - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.metadataImportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.metadataImportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('metadataImportPath', () => { - const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMetadataImportName', () => { - const result = client.matchProjectFromMetadataImportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMetadataImportName', () => { - const result = client.matchLocationFromMetadataImportName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromMetadataImportName', () => { - const result = client.matchServiceFromMetadataImportName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetadataImportFromMetadataImportName', () => { - const result = client.matchMetadataImportFromMetadataImportName(fakePath); - assert.strictEqual(result, "metadataImportValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - 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('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - }; - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePath', () => { - const result = client.servicePath("projectValue", "locationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceName', () => { - const result = client.matchProjectFromServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServiceName', () => { - const result = client.matchLocationFromServiceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_v1beta.ts b/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_v1beta.ts deleted file mode 100644 index 5256e743c03..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_v1beta.ts +++ /dev/null @@ -1,4288 +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 dataprocmetastoreModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta.DataprocMetastoreClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = dataprocmetastoreModule.v1beta.DataprocMetastoreClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = dataprocmetastoreModule.v1beta.DataprocMetastoreClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = dataprocmetastoreModule.v1beta.DataprocMetastoreClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreStub, undefined); - await client.initialize(); - assert(client.dataprocMetastoreStub); - }); - - it('has close method for the initialized client', done => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.dataprocMetastoreStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - 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 dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - 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('getService', () => { - it('invokes getService without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.Service() - ); - client.innerApiCalls.getService = stubSimpleCall(expectedResponse); - const [response] = await client.getService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.Service() - ); - client.innerApiCalls.getService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getService( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IService|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getService(request), expectedError); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with closed client', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getService(request), expectedError); - }); - }); - - describe('getMetadataImport', () => { - it('invokes getMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.MetadataImport() - ); - client.innerApiCalls.getMetadataImport = stubSimpleCall(expectedResponse); - const [response] = await client.getMetadataImport(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.MetadataImport() - ); - client.innerApiCalls.getMetadataImport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMetadataImport( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IMetadataImport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMetadataImport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport with closed client', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getMetadataImport(request), expectedError); - }); - }); - - describe('getBackup', () => { - it('invokes getBackup without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); - const [response] = await client.getBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackup( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IBackup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with closed client', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBackup(request), expectedError); - }); - }); - - describe('removeIamPolicy', () => { - it('invokes removeIamPolicy without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.RemoveIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.RemoveIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.RemoveIamPolicyResponse() - ); - client.innerApiCalls.removeIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.removeIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeIamPolicy without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.RemoveIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.RemoveIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.RemoveIamPolicyResponse() - ); - client.innerApiCalls.removeIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeIamPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IRemoveIamPolicyResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeIamPolicy with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.RemoveIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.RemoveIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.removeIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.removeIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeIamPolicy with closed client', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.RemoveIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.RemoveIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.removeIamPolicy(request), expectedError); - }); - }); - - describe('createService', () => { - it('invokes createService without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createService = stubLongRunningCall(expectedResponse); - const [operation] = await client.createService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createService(request), expectedError); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateService', () => { - it('invokes updateService without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateService = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateService(request), expectedError); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteService', () => { - it('invokes deleteService without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteService = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteService(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createMetadataImport', () => { - it('invokes createMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMetadataImport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMetadataImport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMetadataImport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMetadataImport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateMetadataImportProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateMetadataImportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateMetadataImportProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMetadataImportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateMetadataImport', () => { - it('invokes updateMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMetadataImport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMetadataImport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMetadataImport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMetadataImport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateMetadataImportProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateMetadataImportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateMetadataImportProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMetadataImportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('exportMetadata', () => { - it('invokes exportMetadata without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportMetadata = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportMetadata(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportMetadata = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportMetadata( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportMetadata(request), expectedError); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportMetadata(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportMetadataProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportMetadataProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportMetadataProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportMetadataProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('restoreService', () => { - it('invokes restoreService without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.restoreService = stubLongRunningCall(expectedResponse); - const [operation] = await client.restoreService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.restoreService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.restoreService(request), expectedError); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.restoreService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRestoreServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRestoreServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRestoreServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRestoreServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createBackup', () => { - it('invokes createBackup without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBackup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateBackupProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateBackupProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteBackup', () => { - it('invokes deleteBackup without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteBackup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteBackupProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteBackupProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('queryMetadata', () => { - it('invokes queryMetadata without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.QueryMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.QueryMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.queryMetadata = stubLongRunningCall(expectedResponse); - const [operation] = await client.queryMetadata(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes queryMetadata without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.QueryMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.QueryMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.queryMetadata = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.queryMetadata( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes queryMetadata with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.QueryMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.QueryMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.queryMetadata = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.queryMetadata(request), expectedError); - const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes queryMetadata with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.QueryMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.QueryMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.queryMetadata = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.queryMetadata(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkQueryMetadataProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkQueryMetadataProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkQueryMetadataProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkQueryMetadataProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('moveTableToDatabase', () => { - it('invokes moveTableToDatabase without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.MoveTableToDatabaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.MoveTableToDatabaseRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(expectedResponse); - const [operation] = await client.moveTableToDatabase(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes moveTableToDatabase without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.MoveTableToDatabaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.MoveTableToDatabaseRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.moveTableToDatabase = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.moveTableToDatabase( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes moveTableToDatabase with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.MoveTableToDatabaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.MoveTableToDatabaseRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.moveTableToDatabase(request), expectedError); - const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes moveTableToDatabase with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.MoveTableToDatabaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.MoveTableToDatabaseRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.moveTableToDatabase = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.moveTableToDatabase(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.moveTableToDatabase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkMoveTableToDatabaseProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkMoveTableToDatabaseProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkMoveTableToDatabaseProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkMoveTableToDatabaseProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('alterMetadataResourceLocation', () => { - it('invokes alterMetadataResourceLocation without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.AlterMetadataResourceLocationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.AlterMetadataResourceLocationRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(expectedResponse); - const [operation] = await client.alterMetadataResourceLocation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes alterMetadataResourceLocation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.AlterMetadataResourceLocationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.AlterMetadataResourceLocationRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.alterMetadataResourceLocation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes alterMetadataResourceLocation with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.AlterMetadataResourceLocationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.AlterMetadataResourceLocationRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.alterMetadataResourceLocation(request), expectedError); - const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes alterMetadataResourceLocation with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.AlterMetadataResourceLocationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.AlterMetadataResourceLocationRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.alterMetadataResourceLocation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.alterMetadataResourceLocation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.alterMetadataResourceLocation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAlterMetadataResourceLocationProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAlterMetadataResourceLocationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAlterMetadataResourceLocationProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAlterMetadataResourceLocationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listServices', () => { - it('invokes listServices without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); - const [response] = await client.listServices(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServices( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IService[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServices = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServices(request), expectedError); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServicesStream without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - ]; - client.descriptors.page.listServices.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1beta.Service[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1beta.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listServicesStream with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1beta.Service[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1beta.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServices without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - ]; - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1beta.IService[] = []; - const iterable = client.listServicesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServices with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServicesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1beta.IService[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listMetadataImports', () => { - it('invokes listMetadataImports without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - ]; - client.innerApiCalls.listMetadataImports = stubSimpleCall(expectedResponse); - const [response] = await client.listMetadataImports(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImports without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - ]; - client.innerApiCalls.listMetadataImports = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMetadataImports( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IMetadataImport[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImports with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMetadataImports = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMetadataImports(request), expectedError); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImportsStream without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - ]; - client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMetadataImportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1beta.MetadataImport[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1beta.MetadataImport) => { - 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.listMetadataImports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); - assert( - (client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listMetadataImportsStream with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMetadataImportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1beta.MetadataImport[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1beta.MetadataImport) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); - assert( - (client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMetadataImports without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - ]; - client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1beta.IMetadataImport[] = []; - const iterable = client.listMetadataImportsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMetadataImports with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMetadataImportsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1beta.IMetadataImport[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listBackups', () => { - it('invokes listBackups without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); - const [response] = await client.listBackups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackups( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IBackup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBackups(request), expectedError); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackupsStream without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - ]; - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1beta.Backup[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1beta.Backup) => { - 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.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBackupsStream with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1beta.Backup[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1beta.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackups without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - ]; - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1beta.IBackup[] = []; - const iterable = client.listBackupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackups with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBackupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1beta.IBackup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('backup', () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - backup: "backupValue", - }; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackupName', () => { - const result = client.matchLocationFromBackupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromBackupName', () => { - const result = client.matchServiceFromBackupName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('federation', () => { - const fakePath = "/rendered/path/federation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - federation: "federationValue", - }; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.federationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.federationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('federationPath', () => { - const result = client.federationPath("projectValue", "locationValue", "federationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.federationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFederationName', () => { - const result = client.matchProjectFromFederationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFederationName', () => { - const result = client.matchLocationFromFederationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFederationFromFederationName', () => { - const result = client.matchFederationFromFederationName(fakePath); - assert.strictEqual(result, "federationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('lake', () => { - const fakePath = "/rendered/path/lake"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - lake: "lakeValue", - }; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.lakePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.lakePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('lakePath', () => { - const result = client.lakePath("projectValue", "locationValue", "lakeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.lakePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLakeName', () => { - const result = client.matchProjectFromLakeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.lakePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLakeName', () => { - const result = client.matchLocationFromLakeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.lakePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLakeFromLakeName', () => { - const result = client.matchLakeFromLakeName(fakePath); - assert.strictEqual(result, "lakeValue"); - assert((client.pathTemplates.lakePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('metadataImport', () => { - const fakePath = "/rendered/path/metadataImport"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - metadata_import: "metadataImportValue", - }; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.metadataImportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.metadataImportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('metadataImportPath', () => { - const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMetadataImportName', () => { - const result = client.matchProjectFromMetadataImportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMetadataImportName', () => { - const result = client.matchLocationFromMetadataImportName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromMetadataImportName', () => { - const result = client.matchServiceFromMetadataImportName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetadataImportFromMetadataImportName', () => { - const result = client.matchMetadataImportFromMetadataImportName(fakePath); - assert.strictEqual(result, "metadataImportValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('network', () => { - const fakePath = "/rendered/path/network"; - const expectedParameters = { - project: "projectValue", - network: "networkValue", - }; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.networkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath("projectValue", "networkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkFromNetworkName', () => { - const result = client.matchNetworkFromNetworkName(fakePath); - assert.strictEqual(result, "networkValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - 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('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - }; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePath', () => { - const result = client.servicePath("projectValue", "locationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceName', () => { - const result = client.matchProjectFromServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServiceName', () => { - const result = client.matchLocationFromServiceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/tsconfig.json b/owl-bot-staging/google-cloud-metastore/v1beta/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/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-metastore/v1beta/webpack.config.js b/owl-bot-staging/google-cloud-metastore/v1beta/webpack.config.js deleted file mode 100644 index 6fc45cb3d30..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/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: 'DataprocMetastore', - filename: './dataproc-metastore.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-migrationcenter/v1/.eslintignore b/owl-bot-staging/google-cloud-migrationcenter/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/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-migrationcenter/v1/.eslintrc.json b/owl-bot-staging/google-cloud-migrationcenter/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/.gitignore b/owl-bot-staging/google-cloud-migrationcenter/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/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-migrationcenter/v1/.jsdoc.js b/owl-bot-staging/google-cloud-migrationcenter/v1/.jsdoc.js deleted file mode 100644 index f1b6cfef310..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/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/migrationcenter', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/.mocharc.js b/owl-bot-staging/google-cloud-migrationcenter/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/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-migrationcenter/v1/.prettierrc.js b/owl-bot-staging/google-cloud-migrationcenter/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/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-migrationcenter/v1/README.md b/owl-bot-staging/google-cloud-migrationcenter/v1/README.md deleted file mode 100644 index 5b938c183dd..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Migrationcenter: Nodejs Client diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/package.json b/owl-bot-staging/google-cloud-migrationcenter/v1/package.json deleted file mode 100644 index 9385a298f55..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/migrationcenter", - "version": "0.1.0", - "description": "Migrationcenter client for Node.js", - "repository": "googleapis/nodejs-migrationcenter", - "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 migrationcenter", - "migrationcenter", - "migration center" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/protos/google/cloud/migrationcenter/v1/migrationcenter.proto b/owl-bot-staging/google-cloud-migrationcenter/v1/protos/google/cloud/migrationcenter/v1/migrationcenter.proto deleted file mode 100644 index cc9df8da065..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/protos/google/cloud/migrationcenter/v1/migrationcenter.proto +++ /dev/null @@ -1,4005 +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 -// -// 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.migrationcenter.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/type/date.proto"; -import "google/type/money.proto"; - -option csharp_namespace = "Google.Cloud.MigrationCenter.V1"; -option go_package = "cloud.google.com/go/migrationcenter/apiv1/migrationcenterpb;migrationcenterpb"; -option java_multiple_files = true; -option java_outer_classname = "MigrationCenterProto"; -option java_package = "com.google.cloud.migrationcenter.v1"; -option php_namespace = "Google\\Cloud\\MigrationCenter\\V1"; -option ruby_package = "Google::Cloud::MigrationCenter::V1"; - -// Service describing handlers for resources. -service MigrationCenter { - option (google.api.default_host) = "migrationcenter.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists all the assets in a given project and location. - rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/assets" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of an asset. - rpc GetAsset(GetAssetRequest) returns (Asset) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/assets/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the parameters of an asset. - rpc UpdateAsset(UpdateAssetRequest) returns (Asset) { - option (google.api.http) = { - patch: "/v1/{asset.name=projects/*/locations/*/assets/*}" - body: "asset" - }; - option (google.api.method_signature) = "asset,update_mask"; - } - - // Updates the parameters of a list of assets. - rpc BatchUpdateAssets(BatchUpdateAssetsRequest) - returns (BatchUpdateAssetsResponse) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/assets:batchUpdate" - body: "*" - }; - option (google.api.method_signature) = "parent,requests"; - } - - // Deletes an asset. - rpc DeleteAsset(DeleteAssetRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/assets/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes list of Assets. - rpc BatchDeleteAssets(BatchDeleteAssetsRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/assets:batchDelete" - body: "*" - }; - option (google.api.method_signature) = "parent,names"; - } - - // Reports a set of frames. - rpc ReportAssetFrames(ReportAssetFramesRequest) - returns (ReportAssetFramesResponse) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/assets:reportAssetFrames" - body: "frames" - }; - } - - // Aggregates the requested fields based on provided function. - rpc AggregateAssetsValues(AggregateAssetsValuesRequest) - returns (AggregateAssetsValuesResponse) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/assets:aggregateValues" - body: "*" - }; - } - - // Creates an import job. - rpc CreateImportJob(CreateImportJobRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/importJobs" - body: "import_job" - }; - option (google.api.method_signature) = "parent,import_job,import_job_id"; - option (google.longrunning.operation_info) = { - response_type: "ImportJob" - metadata_type: "OperationMetadata" - }; - } - - // Lists all import jobs. - rpc ListImportJobs(ListImportJobsRequest) returns (ListImportJobsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/importJobs" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of an import job. - rpc GetImportJob(GetImportJobRequest) returns (ImportJob) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/importJobs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes an import job. - rpc DeleteImportJob(DeleteImportJobRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/importJobs/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Updates an import job. - rpc UpdateImportJob(UpdateImportJobRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{import_job.name=projects/*/locations/*/importJobs/*}" - body: "import_job" - }; - option (google.api.method_signature) = "import_job,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "ImportJob" - metadata_type: "OperationMetadata" - }; - } - - // Validates an import job. - rpc ValidateImportJob(ValidateImportJobRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/importJobs/*}:validate" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Runs an import job. - rpc RunImportJob(RunImportJobRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/importJobs/*}:run" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Gets an import data file. - rpc GetImportDataFile(GetImportDataFileRequest) returns (ImportDataFile) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/importJobs/*/importDataFiles/*}" - }; - option (google.api.method_signature) = "name"; - } - - // List import data files. - rpc ListImportDataFiles(ListImportDataFilesRequest) - returns (ListImportDataFilesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/importJobs/*}/importDataFiles" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates an import data file. - rpc CreateImportDataFile(CreateImportDataFileRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/importJobs/*}/importDataFiles" - body: "import_data_file" - }; - option (google.api.method_signature) = - "parent,import_data_file,import_data_file_id"; - option (google.longrunning.operation_info) = { - response_type: "ImportDataFile" - metadata_type: "OperationMetadata" - }; - } - - // Delete an import data file. - rpc DeleteImportDataFile(DeleteImportDataFileRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/importJobs/*/importDataFiles/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Lists all groups in a given project and location. - rpc ListGroups(ListGroupsRequest) returns (ListGroupsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/groups" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a group. - rpc GetGroup(GetGroupRequest) returns (Group) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/groups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new group in a given project and location. - rpc CreateGroup(CreateGroupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/groups" - body: "group" - }; - option (google.api.method_signature) = "parent,group,group_id"; - option (google.longrunning.operation_info) = { - response_type: "Group" - metadata_type: "OperationMetadata" - }; - } - - // Updates the parameters of a group. - rpc UpdateGroup(UpdateGroupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{group.name=projects/*/locations/*/groups/*}" - body: "group" - }; - option (google.api.method_signature) = "group,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Group" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a group. - rpc DeleteGroup(DeleteGroupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/groups/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Adds assets to a group. - rpc AddAssetsToGroup(AddAssetsToGroupRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{group=projects/*/locations/*/groups/*}:addAssets" - body: "*" - }; - option (google.api.method_signature) = "group"; - option (google.longrunning.operation_info) = { - response_type: "Group" - metadata_type: "OperationMetadata" - }; - } - - // Removes assets from a group. - rpc RemoveAssetsFromGroup(RemoveAssetsFromGroupRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{group=projects/*/locations/*/groups/*}:removeAssets" - body: "*" - }; - option (google.api.method_signature) = "group"; - option (google.longrunning.operation_info) = { - response_type: "Group" - metadata_type: "OperationMetadata" - }; - } - - // Lists all error frames in a given source and location. - rpc ListErrorFrames(ListErrorFramesRequest) - returns (ListErrorFramesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/sources/*}/errorFrames" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of an error frame. - rpc GetErrorFrame(GetErrorFrameRequest) returns (ErrorFrame) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/sources/*/errorFrames/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all the sources in a given project and location. - rpc ListSources(ListSourcesRequest) returns (ListSourcesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/sources" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a source. - rpc GetSource(GetSourceRequest) returns (Source) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/sources/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new source in a given project and location. - rpc CreateSource(CreateSourceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/sources" - body: "source" - }; - option (google.api.method_signature) = "parent,source,source_id"; - option (google.longrunning.operation_info) = { - response_type: "Source" - metadata_type: "OperationMetadata" - }; - } - - // Updates the parameters of a source. - rpc UpdateSource(UpdateSourceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{source.name=projects/*/locations/*/sources/*}" - body: "source" - }; - option (google.api.method_signature) = "source,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Source" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a source. - rpc DeleteSource(DeleteSourceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/sources/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Lists all the preference sets in a given project and location. - rpc ListPreferenceSets(ListPreferenceSetsRequest) - returns (ListPreferenceSetsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/preferenceSets" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a preference set. - rpc GetPreferenceSet(GetPreferenceSetRequest) returns (PreferenceSet) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/preferenceSets/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new preference set in a given project and location. - rpc CreatePreferenceSet(CreatePreferenceSetRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/preferenceSets" - body: "preference_set" - }; - option (google.api.method_signature) = - "parent,preference_set,preference_set_id"; - option (google.longrunning.operation_info) = { - response_type: "PreferenceSet" - metadata_type: "OperationMetadata" - }; - } - - // Updates the parameters of a preference set. - rpc UpdatePreferenceSet(UpdatePreferenceSetRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{preference_set.name=projects/*/locations/*/preferenceSets/*}" - body: "preference_set" - }; - option (google.api.method_signature) = "preference_set,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "PreferenceSet" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a preference set. - rpc DeletePreferenceSet(DeletePreferenceSetRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/preferenceSets/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Gets the details of regional settings. - rpc GetSettings(GetSettingsRequest) returns (Settings) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/settings}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the regional-level project settings. - rpc UpdateSettings(UpdateSettingsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{settings.name=projects/*/locations/*/settings}" - body: "settings" - }; - option (google.api.method_signature) = "settings,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Settings" - metadata_type: "OperationMetadata" - }; - } - - // Creates a report configuration. - rpc CreateReportConfig(CreateReportConfigRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/reportConfigs" - body: "report_config" - }; - option (google.api.method_signature) = - "parent,report_config,report_config_id"; - option (google.longrunning.operation_info) = { - response_type: "ReportConfig" - metadata_type: "OperationMetadata" - }; - } - - // Gets details of a single ReportConfig. - rpc GetReportConfig(GetReportConfigRequest) returns (ReportConfig) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/reportConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists ReportConfigs in a given project and location. - rpc ListReportConfigs(ListReportConfigsRequest) - returns (ListReportConfigsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/reportConfigs" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a ReportConfig. - rpc DeleteReportConfig(DeleteReportConfigRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/reportConfigs/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Creates a report. - rpc CreateReport(CreateReportRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/reportConfigs/*}/reports" - body: "report" - }; - option (google.api.method_signature) = "parent,report,report_id"; - option (google.longrunning.operation_info) = { - response_type: "Report" - metadata_type: "OperationMetadata" - }; - } - - // Gets details of a single Report. - rpc GetReport(GetReportRequest) returns (Report) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/reportConfigs/*/reports/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists Reports in a given ReportConfig. - rpc ListReports(ListReportsRequest) returns (ListReportsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/reportConfigs/*}/reports" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a Report. - rpc DeleteReport(DeleteReportRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/reportConfigs/*/reports/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } -} - -// An asset represents a resource in your environment. Asset types include -// virtual machines and databases. -message Asset { - option (google.api.resource) = { - type: "migrationcenter.googleapis.com/Asset" - pattern: "projects/{project}/locations/{location}/assets/{asset}" - }; - - // Output only. The full name of the asset. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when the asset was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when the asset was last updated. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels as key value pairs. - map labels = 4; - - // Generic asset attributes. - map attributes = 5; - - // The internal information of an asset. Only one field can be specified - // with different attributes based on the type of the asset. - oneof AssetDetails { - // Output only. Asset information specific for virtual and physical - // machines. - MachineDetails machine_details = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. The list of insights associated with the asset. - InsightList insight_list = 20 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Performance data for the asset. - AssetPerformanceData performance_data = 21 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The list of sources contributing to the asset. - repeated string sources = 22 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Source" - } - ]; - - // Output only. The list of groups that the asset is assigned to. - repeated string assigned_groups = 23 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Group" - } - ]; -} - -// The preferences that apply to all assets in a given context. -message PreferenceSet { - option (google.api.resource) = { - type: "migrationcenter.googleapis.com/PreferenceSet" - pattern: "projects/{project}/locations/{location}/preferenceSets/{preference_set}" - }; - - // Output only. Name of the preference set. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when the preference set was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when the preference set was last updated. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-friendly display name. Maximum length is 63 characters. - string display_name = 4; - - // A description of the preference set. - string description = 5; - - // A set of preferences that applies to all virtual machines in the context. - VirtualMachinePreferences virtual_machine_preferences = 6; -} - -// A resource that represents the background job that imports asset frames. -message ImportJob { - option (google.api.resource) = { - type: "migrationcenter.googleapis.com/ImportJob" - pattern: "projects/{project}/locations/{location}/importJobs/{import_job}" - }; - - // Enumerates possible states of an import job. - enum ImportJobState { - // Default value. - IMPORT_JOB_STATE_UNSPECIFIED = 0; - - // The import job is pending. - IMPORT_JOB_STATE_PENDING = 1; - - // The processing of the import job is ongoing. - IMPORT_JOB_STATE_RUNNING = 2; - - // The import job processing has completed. - IMPORT_JOB_STATE_COMPLETED = 3; - - // The import job failed to be processed. - IMPORT_JOB_STATE_FAILED = 4; - - // The import job is being validated. - IMPORT_JOB_STATE_VALIDATING = 5; - - // The import job contains blocking errors. - IMPORT_JOB_STATE_FAILED_VALIDATION = 6; - - // The validation of the job completed with no blocking errors. - IMPORT_JOB_STATE_READY = 7; - } - - // Output only. The full name of the import job. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-friendly display name. Maximum length is 63 characters. - string display_name = 2; - - // Output only. The timestamp when the import job was created. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when the import job was last updated. - google.protobuf.Timestamp update_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when the import job was completed. - google.protobuf.Timestamp complete_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The state of the import job. - ImportJobState state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels as key value pairs. - map labels = 7; - - // Required. Reference to a source. - string asset_source = 8 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Source" - } - ]; - - // Holds the various report types of an import job. - oneof report { - // Output only. The report with the validation results of the import job. - ValidationReport validation_report = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The report with the results of running the import job. - ExecutionReport execution_report = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - } -} - -// A resource that represents a payload file in an import job. -message ImportDataFile { - option (google.api.resource) = { - type: "migrationcenter.googleapis.com/ImportDataFile" - pattern: "projects/{project}/locations/{location}/importJobs/{import_job}/importDataFiles/{import_data_file}" - }; - - // Enumerates possible states of an import data file. - enum State { - // Default value. - STATE_UNSPECIFIED = 0; - - // The data file is being created. - CREATING = 1; - - // The data file completed initialization. - ACTIVE = 2; - } - - // Output only. The name of the file. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-friendly display name. Maximum length is 63 characters. - string display_name = 6; - - // Required. The payload format. - ImportJobFormat format = 2 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The timestamp when the file was created. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The state of the import data file. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - oneof file_info { - // Information about a file that is uploaded to a storage service. - UploadFileInfo upload_file_info = 5; - } -} - -// A resource that represents an asset group. -// The purpose of an asset group is to bundle a set of assets that have -// something in common, while allowing users to add annotations to the group. -// An asset can belong to multiple groups. -message Group { - option (google.api.resource) = { - type: "migrationcenter.googleapis.com/Group" - pattern: "projects/{project}/locations/{location}/groups/{group}" - }; - - // Output only. The name of the group. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when the group was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when the group was last updated. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels as key value pairs. - map labels = 4; - - // User-friendly display name. - string display_name = 5; - - // The description of the resource. - string description = 6; -} - -// Message representing a frame which failed to be processed due to an error. -message ErrorFrame { - option (google.api.resource) = { - type: "migrationcenter.googleapis.com/ErrorFrame" - pattern: "projects/{project}/locations/{location}/sources/{source}/errorFrames/{error_frame}" - }; - - // Output only. The identifier of the ErrorFrame. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. All the violations that were detected for the frame. - repeated FrameViolationEntry violations = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The frame that was originally reported. - AssetFrame original_frame = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Frame ingestion time. - google.protobuf.Timestamp ingestion_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Source represents an object from which asset information is -// streamed to Migration Center. -message Source { - option (google.api.resource) = { - type: "migrationcenter.googleapis.com/Source" - pattern: "projects/{project}/locations/{location}/sources/{source}" - }; - - enum SourceType { - // Unspecified - SOURCE_TYPE_UNKNOWN = 0; - - // Manually uploaded file (e.g. CSV) - SOURCE_TYPE_UPLOAD = 1; - - // Guest-level info - SOURCE_TYPE_GUEST_OS_SCAN = 2; - - // Inventory-level scan - SOURCE_TYPE_INVENTORY_SCAN = 3; - - // Third-party owned sources. - SOURCE_TYPE_CUSTOM = 4; - } - - // Enumerates possible states of a source. - enum State { - // Unspecified. - STATE_UNSPECIFIED = 0; - - // The source is active and ready to be used. - ACTIVE = 1; - - // In the process of being deleted. - DELETING = 2; - - // Source is in an invalid state. Asset frames reported to it will be - // ignored. - INVALID = 3; - } - - // Output only. The full name of the source. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when the source was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when the source was last updated. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-friendly display name. - string display_name = 4; - - // Free-text description. - string description = 5; - - // Data source type. - SourceType type = 6; - - // The information confidence of the source. - // The higher the value, the higher the confidence. - int32 priority = 7; - - // If `true`, the source is managed by other service(s). - bool managed = 8; - - // Output only. Number of frames that are still being processed. - int32 pending_frame_count = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of frames that were reported by the source and - // contained errors. - int32 error_frame_count = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The state of the source. - State state = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The groups and associated preference sets on which -// we can generate reports. -message ReportConfig { - option (google.api.resource) = { - type: "migrationcenter.googleapis.com/ReportConfig" - pattern: "projects/{project}/locations/{location}/reportConfigs/{report_config}" - }; - - // Represents a combination of a group with a preference set. - message GroupPreferenceSetAssignment { - // Required. Name of the group. - string group = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Group" - } - ]; - - // Required. Name of the Preference Set. - string preference_set = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/PreferenceSet" - } - ]; - } - - // Output only. Name of resource. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when the resource was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp when the resource was last updated. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-friendly display name. Maximum length is 63 characters. - string display_name = 4; - - // Free-text description. - string description = 5; - - // Required. Collection of combinations of groups and preference sets. - repeated GroupPreferenceSetAssignment group_preferenceset_assignments = 6 - [(google.api.field_behavior) = REQUIRED]; -} - -// Report represents a point-in-time rendering of the ReportConfig results. -message Report { - option (google.api.resource) = { - type: "migrationcenter.googleapis.com/Report" - pattern: "projects/{project}/locations/{location}/reportConfigs/{report_config}/reports/{report}" - }; - - // Report type. - enum Type { - // Default Report type. - TYPE_UNSPECIFIED = 0; - - // Total cost of ownership Report type. - TOTAL_COST_OF_OWNERSHIP = 1; - } - - // Report creation state. - enum State { - // Default Report creation state. - STATE_UNSPECIFIED = 0; - - // Creating Report. - PENDING = 1; - - // Successfully created Report. - SUCCEEDED = 2; - - // Failed to create Report. - FAILED = 3; - } - - // Output only. Name of resource. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Creation timestamp. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update timestamp. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-friendly display name. Maximum length is 63 characters. - string display_name = 4; - - // Free-text description. - string description = 5; - - // Report type. - Type type = 6; - - // Report creation state. - State state = 7; - - // Output only. Summary view of the Report. - ReportSummary summary = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have been cancelled successfully - // have [Operation.error][] value with a - // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - // `Code.CANCELLED`. - bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Message for requesting a list of assets. -message ListAssetsRequest { - // Required. Parent value for `ListAssetsRequest`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/Asset" - } - ]; - - // Requested page size. Server may return fewer items than requested. - // If unspecified, server will pick an appropriate default. - int32 page_size = 2; - - // A token identifying a page of results the server should return. - string page_token = 3; - - // Filtering results. - string filter = 4; - - // Field to sort by. See https://google.aip.dev/132#ordering for more details. - string order_by = 5; - - // View of the assets. Defaults to BASIC. - AssetView view = 6; -} - -// Response message for listing assets. -message ListAssetsResponse { - // A list of assets. - repeated Asset assets = 1; - - // A token identifying a page of results the server should return. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Message for getting a Asset. -message GetAssetRequest { - // Required. Name of the resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Asset" - } - ]; - - // View of the assets. Defaults to BASIC. - AssetView view = 2; -} - -// A request to update an asset. -message UpdateAssetRequest { - // Required. Field mask is used to specify the fields to be overwritten in the - // `Asset` resource by the update. - // The values specified in the `update_mask` field are relative to the - // resource, not the full request. - // A field will be overwritten if it is in the mask. - // A single * value in the mask lets you to overwrite all fields. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The resource being updated. - Asset asset = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to update a list of assets. -message BatchUpdateAssetsRequest { - // Required. Parent value for batch asset update. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/Asset" - } - ]; - - // Required. The request message specifying the resources to update. - // A maximum of 1000 assets can be modified in a batch. - repeated UpdateAssetRequest requests = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Response for updating a list of assets. -message BatchUpdateAssetsResponse { - // Update asset content. - // The content only includes values after field mask being applied. - repeated Asset assets = 1; -} - -// A request to delete an asset. -message DeleteAssetRequest { - // Required. Name of the resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Asset" - } - ]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to delete a list of asset. -message BatchDeleteAssetsRequest { - // Required. Parent value for batch asset delete. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/Asset" - } - ]; - - // Required. The IDs of the assets to delete. - // A maximum of 1000 assets can be deleted in a batch. - // Format: projects/{project}/locations/{location}/assets/{name}. - repeated string names = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Asset" - } - ]; - - // Optional. When this value is set to `true` the request is a no-op for - // non-existing assets. See https://google.aip.dev/135#delete-if-existing for - // additional details. Default value is `false`. - bool allow_missing = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to report a set of asset frames. -message ReportAssetFramesRequest { - // Required. Parent of the resource. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Collection of frames data. - Frames frames = 2; - - // Required. Reference to a source. - string source = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Source" - } - ]; -} - -// A response to a call to `ReportAssetFrame`. -message ReportAssetFramesResponse {} - -// A request to aggregate one or more values. -message AggregateAssetsValuesRequest { - // Required. Parent value for `AggregateAssetsValuesRequest`. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Array of aggregations to perform. - // Up to 25 aggregations can be defined. - repeated Aggregation aggregations = 2; - - // The aggregation will be performed on assets that match the provided filter. - string filter = 3; -} - -// A response to a request to aggregated assets values. -message AggregateAssetsValuesResponse { - // The aggregation results. - repeated AggregationResult results = 1; -} - -// A request to create an import job. -message CreateImportJobRequest { - // Required. Value for parent. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/ImportJob" - } - ]; - - // Required. ID of the import job. - string import_job_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The resource being created. - ImportJob import_job = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to list import jobs. -message ListImportJobsRequest { - // Required. Parent value for `ListImportJobsRequest`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/ImportJob" - } - ]; - - // Requested page size. Server may return fewer items than requested. - // If unspecified, server will pick an appropriate default. - int32 page_size = 2; - - // A token identifying a page of results the server should return. - string page_token = 3; - - // Filtering results. - string filter = 4; - - // Field to sort by. See https://google.aip.dev/132#ordering for more details. - string order_by = 5; - - // Optional. The level of details of each import job. - // Default value is BASIC. - ImportJobView view = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// A response for listing import jobs. -message ListImportJobsResponse { - // The list of import jobs. - repeated ImportJob import_jobs = 1; - - // A token identifying a page of results the server should return. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// A request to get an import job. -message GetImportJobRequest { - // Required. Name of the resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/ImportJob" - } - ]; - - // Optional. The level of details of the import job. - // Default value is FULL. - ImportJobView view = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to delete an import job. -message DeleteImportJobRequest { - // Required. Name of the resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/ImportJob" - } - ]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to `true`, any `ImportDataFiles` of this job will also be - // deleted If set to `false`, the request only works if the job has no data - // files. - bool force = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to update an import job. -message UpdateImportJobRequest { - // Required. Field mask is used to specify the fields to be overwritten in the - // `Asset` resource by the update. - // The values specified in the `update_mask` field are relative to the - // resource, not the full request. - // A field will be overwritten if it is in the mask. - // A single * value in the mask lets you to overwrite all fields. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The resource being updated - ImportJob import_job = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to validate an import job. -message ValidateImportJobRequest { - // Required. The name of the import job to validate. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/ImportJob" - } - ]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to run an import job. -message RunImportJobRequest { - // Required. The name of the import job to run. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/ImportJob" - } - ]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to get an import data file. -message GetImportDataFileRequest { - // Required. Name of the ImportDataFile. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/ImportDataFile" - } - ]; -} - -// A request to list import data files of an import job. -message ListImportDataFilesRequest { - // Required. Name of the parent of the `ImportDataFiles` resource. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/ImportDataFile" - } - ]; - - // The maximum number of data files to return. The service may return - // fewer than this value. If unspecified, at most 500 data files 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 `ListImportDataFiles` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListImportDataFiles` - // must match the call that provided the page token. - string page_token = 3; - - // Filtering results. - string filter = 4; - - // Field to sort by. See https://google.aip.dev/132#ordering for more details. - string order_by = 5; -} - -// Response for listing payload files of an import job. -message ListImportDataFilesResponse { - // The list of import data files. - repeated ImportDataFile import_data_files = 1; - - // A token that can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// A request to create an `ImportDataFile` resource. -message CreateImportDataFileRequest { - // Required. Name of the parent of the ImportDataFile. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/ImportDataFile" - } - ]; - - // Required. The ID of the new data file. - string import_data_file_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The resource being created. - ImportDataFile import_data_file = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to delete an `ImportDataFile` resource. -message DeleteImportDataFileRequest { - // Required. Name of the ImportDataFile to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/ImportDataFile" - } - ]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to list groups. -message ListGroupsRequest { - // Required. Parent value for `ListGroupsRequest`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/Group" - } - ]; - - // Requested page size. Server may return fewer items than requested. - // If unspecified, server will pick an appropriate default. - int32 page_size = 2; - - // A token identifying a page of results the server should return. - string page_token = 3; - - // Filtering results. - string filter = 4; - - // Field to sort by. See https://google.aip.dev/132#ordering for more details. - string order_by = 5; -} - -// A response for listing groups. -message ListGroupsResponse { - // The list of Group - repeated Group groups = 1; - - // A token identifying a page of results the server should return. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// A request to get a group. -message GetGroupRequest { - // Required. Name of the resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Group" - } - ]; -} - -// A request to create a group. -message CreateGroupRequest { - // Required. Value for parent. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/Group" - } - ]; - - // Required. User specified ID for the group. It will become the last - // component of the group name. The ID must be unique within the project, must - // conform with RFC-1034, is restricted to lower-cased letters, and has a - // maximum length of 63 characters. The ID must match the regular expression: - // `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. - string group_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The group resource being created. - Group group = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to update a group. -message UpdateGroupRequest { - // Required. Field mask is used to specify the fields to be overwritten in the - // `Group` resource by the update. - // The values specified in the `update_mask` are relative to the resource, not - // the full request. A field will be overwritten if it is in the mask. - // A single * value in the mask lets you to overwrite all fields. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The group resource being updated. - Group group = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to delete a group. -message DeleteGroupRequest { - // Required. Name of the group resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Group" - } - ]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to add assets to a group. -message AddAssetsToGroupRequest { - // Required. Group reference. - string group = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Group" - } - ]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. List of assets to be added. - // The maximum number of assets that can be added in a single request is - // 1000. - AssetList assets = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. When this value is set to `false` and one of the given assets is - // already an existing member of the group, the operation fails with an - // `Already Exists` error. When set to `true` this situation is silently - // ignored by the server. - // - // Default value is `false`. - bool allow_existing = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to remove assets from a group. -message RemoveAssetsFromGroupRequest { - // Required. Group reference. - string group = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Group" - } - ]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. List of assets to be removed. - // The maximum number of assets that can be removed in a single request is - // 1000. - AssetList assets = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. When this value is set to `false` and one of the given assets is - // not an existing member of the group, the operation fails with a `Not Found` - // error. When set to `true` this situation is silently ignored by the server. - // - // Default value is `false`. - bool allow_missing = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to list error frames for a source. -message ListErrorFramesRequest { - // Required. Parent value (the source) for `ListErrorFramesRequest`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/ErrorFrame" - } - ]; - - // Requested page size. Server may return fewer items than requested. - // If unspecified, server will pick an appropriate default. - int32 page_size = 2; - - // A token identifying a page of results the server should return. - string page_token = 3; - - // Optional. An optional view mode to control the level of details of each - // error frame. The default is a BASIC frame view. - ErrorFrameView view = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// A response for listing error frames. -message ListErrorFramesResponse { - // The list of error frames. - repeated ErrorFrame error_frames = 1; - - // A token identifying a page of results the server should return. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -message GetErrorFrameRequest { - // Required. The name of the frame to retrieve. - // Format: - // projects/{project}/locations/{location}/sources/{source}/errorFrames/{error_frame} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/ErrorFrame" - } - ]; - - // Optional. An optional view mode to control the level of details for the - // frame. The default is a basic frame view. - ErrorFrameView view = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request for a list of sources. -message ListSourcesRequest { - // Required. Parent value for `ListSourcesRequest`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/Source" - } - ]; - - // Requested page size. The server may return fewer items than requested. - // If unspecified, the server will pick an appropriate default value. - int32 page_size = 2; - - // A token identifying a page of results that the server should return. - string page_token = 3; - - // Filtering results. - string filter = 4; - - // Field to sort by. See https://google.aip.dev/132#ordering for more details. - string order_by = 5; -} - -// Response message for listing sources. -message ListSourcesResponse { - // The list of sources. - repeated Source sources = 1; - - // A token identifying a page of results the server should return. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// A request to get a source. -message GetSourceRequest { - // Required. Name of the resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Source" - } - ]; -} - -// A request to create a source. -message CreateSourceRequest { - // Required. Value for parent. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/Source" - } - ]; - - // Required. User specified ID for the source. It will become the last - // component of the source name. The ID must be unique within the project, - // must conform with RFC-1034, is restricted to lower-cased letters, and has a - // maximum length of 63 characters. The ID must match the regular expression: - // `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. - string source_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The resource being created. - Source source = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to update a source. -message UpdateSourceRequest { - // Required. Field mask is used to specify the fields to be overwritten in the - // `Source` resource by the update. - // The values specified in the `update_mask` field are relative to the - // resource, not the full request. - // A field will be overwritten if it is in the mask. - // A single * value in the mask lets you to overwrite all fields. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The resource being updated - Source source = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to delete a source. -message DeleteSourceRequest { - // Required. Name of the resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Source" - } - ]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for listing preference sets. -message ListPreferenceSetsRequest { - // Required. Parent value for `ListPreferenceSetsRequest`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/PreferenceSet" - } - ]; - - // Requested page size. Server may return fewer items than requested. - // If unspecified, at most 500 preference sets will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // A token identifying a page of results the server should return. - string page_token = 3; - - // Field to sort by. See https://google.aip.dev/132#ordering for more details. - string order_by = 5; -} - -// Response message for listing preference sets. -message ListPreferenceSetsResponse { - // The list of PreferenceSets - repeated PreferenceSet preference_sets = 1; - - // A token identifying a page of results the server should return. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// A request to get a preference set. -message GetPreferenceSetRequest { - // Required. Name of the resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/PreferenceSet" - } - ]; -} - -// A request to create a preference set. -message CreatePreferenceSetRequest { - // Required. Value for parent. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/PreferenceSet" - } - ]; - - // Required. User specified ID for the preference set. It will become the last - // component of the preference set name. The ID must be unique within the - // project, must conform with RFC-1034, is restricted to lower-cased letters, - // and has a maximum length of 63 characters. The ID must match the regular - // expression - // `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. - string preference_set_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The preference set resource being created. - PreferenceSet preference_set = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to update a preference set. -message UpdatePreferenceSetRequest { - // Required. Field mask is used to specify the fields to be overwritten in the - // `PreferenceSet` resource by the update. - // The values specified in the `update_mask` field are relative to the - // resource, not the full request. - // A field will be overwritten if it is in the mask. - // A single * value in the mask lets you to overwrite all fields. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The preference set resource being updated. - PreferenceSet preference_set = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to delete a preference set. -message DeletePreferenceSetRequest { - // Required. Name of the group resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/PreferenceSet" - } - ]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to get the settings. -message GetSettingsRequest { - // Required. Name of the resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Settings" - } - ]; -} - -// A request to update the settings. -message UpdateSettingsRequest { - // Required. Field mask is used to specify the fields to be overwritten in the - // `Settings` resource by the update. - // The values specified in the `update_mask` field are relative to the - // resource, not the full request. - // A field will be overwritten if it is in the mask. - // A single * value in the mask lets you to overwrite all fields. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The project settings resource being updated. - Settings settings = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to create a `ReportConfig` resource. -message CreateReportConfigRequest { - // Required. Value for parent. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/ReportConfig" - } - ]; - - // Required. User specified ID for the report config. It will become the last - // component of the report config name. The ID must be unique within the - // project, must conform with RFC-1034, is restricted to lower-cased letters, - // and has a maximum length of 63 characters. The ID must match the regular - // expression: [a-z]([a-z0-9-]{0,61}[a-z0-9])?. - string report_config_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The report config set resource being created. - ReportConfig report_config = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to delete a ReportConfig. -message DeleteReportConfigRequest { - // Required. Name of the resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/ReportConfig" - } - ]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to `true`, any child `Reports` of this entity will also be - // deleted. If set to `false`, the request only works if the resource has no - // children. - bool force = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to get a Report. -message GetReportRequest { - // Required. Name of the resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Report" - } - ]; - - // Determines what information to retrieve for the Report. - ReportView view = 6; -} - -// A request for a list of Reports. -message ListReportsRequest { - // Required. Parent value for `ListReportsRequest`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/Report" - } - ]; - - // Requested page size. The server may return fewer items than requested. - // If unspecified, the server will pick an appropriate default value. - int32 page_size = 2; - - // A token identifying a page of results that the server should return. - string page_token = 3; - - // Filtering results. - string filter = 4; - - // Field to sort by. See https://google.aip.dev/132#ordering for more details. - string order_by = 5; - - // Determines what information to retrieve for each Report. - ReportView view = 6; -} - -// Response message for listing Reports. -message ListReportsResponse { - // The list of Reports. - repeated Report reports = 1; - - // A token identifying a page of results the server should return. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// A request to delete a Report. -message DeleteReportRequest { - // Required. Name of the resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Report" - } - ]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to get a `ReportConfig` resource. -message GetReportConfigRequest { - // Required. Name of the resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/ReportConfig" - } - ]; -} - -// A request to get a list of `ReportConfig` resources. -message ListReportConfigsRequest { - // Required. Parent value for `ListReportConfigsRequest`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/ReportConfig" - } - ]; - - // Requested page size. Server may return fewer items than requested. - // If unspecified, server will pick an appropriate default. - int32 page_size = 2; - - // A token identifying a page of results the server should return. - string page_token = 3; - - // Filtering results. - string filter = 4; - - // Field to sort by. See https://google.aip.dev/132#ordering for more details. - string order_by = 5; -} - -// Response message for listing report configs. -message ListReportConfigsResponse { - // A list of report configs. - repeated ReportConfig report_configs = 1; - - // A token identifying a page of results the server should return. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Message for creating a Report. -message CreateReportRequest { - // Required. Value for parent. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "migrationcenter.googleapis.com/Report" - } - ]; - - // Required. User specified id for the report. It will become the last - // component of the report name. The id must be unique within the project, - // must conform with RFC-1034, is restricted to lower-cased letters, and has a - // maximum length of 63 characters. The id must match the regular expression: - // [a-z]([a-z0-9-]{0,61}[a-z0-9])?. - string report_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The report resource being created. - Report report = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique - // request ID so that if you must retry your request, the server will know to - // ignore the request if it has already been completed. The server will - // guarantee that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Collection of frame data. -message Frames { - // A repeated field of asset data. - repeated AssetFrame frames_data = 1; -} - -// Contains data reported from an inventory source on an asset. -message AssetFrame { - // The internal data of the frame is a oneof field depending on the type - // of asset information in the frame. - oneof FrameData { - // Asset information specific for virtual machines. - MachineDetails machine_details = 1; - } - - // The time the data was reported. - google.protobuf.Timestamp report_time = 10; - - // Labels as key value pairs. - map labels = 11; - - // Generic asset attributes. - map attributes = 12; - - // Asset performance data samples. - repeated PerformanceSample performance_samples = 13; - - // Optional. Trace token is optionally provided to assist with debugging and - // traceability. - string trace_token = 14 [(google.api.field_behavior) = OPTIONAL]; -} - -// Details of a machine. -message MachineDetails { - // Machine power state. - enum PowerState { - // Power state is unknown. - POWER_STATE_UNSPECIFIED = 0; - - // The machine is preparing to enter the ACTIVE state. An instance may enter - // the PENDING state when it launches for the first time, or when it is - // started after being in the SUSPENDED state. - PENDING = 1; - - // The machine is active. - ACTIVE = 2; - - // The machine is being turned off. - SUSPENDING = 3; - - // The machine is off. - SUSPENDED = 4; - - // The machine is being deleted from the hosting platform. - DELETING = 5; - - // The machine is deleted from the hosting platform. - DELETED = 6; - } - - // Machine unique identifier. - string uuid = 1; - - // Machine name. - string machine_name = 2; - - // Machine creation time. - google.protobuf.Timestamp create_time = 3; - - // Number of CPU cores in the machine. Must be non-negative. - int32 core_count = 4; - - // The amount of memory in the machine. Must be non-negative. - int32 memory_mb = 5; - - // Power state of the machine. - PowerState power_state = 6; - - // Architecture details (vendor, CPU architecture). - MachineArchitectureDetails architecture = 7; - - // Guest OS information. - GuestOsDetails guest_os = 8; - - // Network details. - MachineNetworkDetails network = 9; - - // Disk details. - MachineDiskDetails disks = 10; - - // Platform specific information. - PlatformDetails platform = 11; -} - -// Details of the machine architecture. -message MachineArchitectureDetails { - // Firmware type. - enum FirmwareType { - // Unspecified or unknown. - FIRMWARE_TYPE_UNSPECIFIED = 0; - - // BIOS firmware. - BIOS = 1; - - // EFI firmware. - EFI = 2; - } - - // CPU hyper-threading support. - enum CpuHyperThreading { - // Unspecified or unknown. - CPU_HYPER_THREADING_UNSPECIFIED = 0; - - // Hyper-threading is disabled. - DISABLED = 1; - - // Hyper-threading is enabled. - ENABLED = 2; - } - - // CPU architecture, e.g., "x64-based PC", "x86_64", "i686" etc. - string cpu_architecture = 1; - - // CPU name, e.g., "Intel Xeon E5-2690", "AMD EPYC 7571" etc. - string cpu_name = 2; - - // Hardware vendor. - string vendor = 3; - - // Number of CPU threads allocated to the machine. - int32 cpu_thread_count = 4; - - // Number of processor sockets allocated to the machine. - int32 cpu_socket_count = 5; - - // BIOS Details. - BiosDetails bios = 6; - - // Firmware type. - FirmwareType firmware_type = 7; - - // CPU hyper-threading support. - CpuHyperThreading hyperthreading = 8; -} - -// Details about the BIOS. -message BiosDetails { - // BIOS name. - string bios_name = 1; - - // BIOS ID. - string id = 2; - - // BIOS manufacturer. - string manufacturer = 3; - - // BIOS version. - string version = 4; - - // BIOS release date. - google.type.Date release_date = 5; - - // SMBIOS UUID. - string smbios_uuid = 6; -} - -// Details of network adapters and settings. -message MachineNetworkDetails { - // The primary IP address of the machine. - string primary_ip_address = 1; - - // The public IP address of the machine. - string public_ip_address = 2; - - // MAC address of the machine. - // This property is used to uniqly identify the machine. - string primary_mac_address = 3; - - // List of network adapters. - NetworkAdapterList adapters = 4; -} - -// List of network adapters. -message NetworkAdapterList { - // Network adapter entries. - repeated NetworkAdapterDetails entries = 1; -} - -// Details of network adapter. -message NetworkAdapterDetails { - // Network adapter type (e.g. VMXNET3). - string adapter_type = 1; - - // MAC address. - string mac_address = 2; - - // NetworkAddressList - NetworkAddressList addresses = 3; -} - -// List of allocated/assigned network addresses. -message NetworkAddressList { - // Network address entries. - repeated NetworkAddress entries = 1; -} - -// Details of network address. -message NetworkAddress { - // Network address assignment. - enum AddressAssignment { - // Unknown (default value). - ADDRESS_ASSIGNMENT_UNSPECIFIED = 0; - - // Staticly assigned IP. - ADDRESS_ASSIGNMENT_STATIC = 1; - - // Dynamically assigned IP (DHCP). - ADDRESS_ASSIGNMENT_DHCP = 2; - } - - // Assigned or configured IP Address. - string ip_address = 1; - - // Subnet mask. - string subnet_mask = 2; - - // Broadcast address. - string bcast = 3; - - // Fully qualified domain name. - string fqdn = 4; - - // Whether DHCP is used to assign addresses. - AddressAssignment assignment = 5; -} - -// Details of machine disks. -message MachineDiskDetails { - // Disk total Capacity. - int64 total_capacity_bytes = 1; - - // Total disk free space. - int64 total_free_bytes = 2; - - // List of disks. - DiskEntryList disks = 3; -} - -// VM disks. -message DiskEntryList { - // Disk entries. - repeated DiskEntry entries = 1; -} - -// Single disk entry. -message DiskEntry { - // Disks interface type. - enum InterfaceType { - // Interface type unknown or unspecified. - INTERFACE_TYPE_UNSPECIFIED = 0; - - // IDE interface type. - IDE = 1; - - // SATA interface type. - SATA = 2; - - // SAS interface type. - SAS = 3; - - // SCSI interface type. - SCSI = 4; - - // NVME interface type. - NVME = 5; - - // FC interface type. - FC = 6; - - // iSCSI interface type. - ISCSI = 7; - } - - // Disk capacity. - int64 capacity_bytes = 1; - - // Disk free space. - int64 free_bytes = 2; - - // Disk label. - string disk_label = 3; - - // Disk label type (e.g. BIOS/GPT) - string disk_label_type = 4; - - // Disks interface type. - InterfaceType interface_type = 5; - - // Partition layout. - DiskPartitionList partitions = 6; - - // Disk hardware address (e.g. 0:1 for SCSI). - string hw_address = 7; - - // Additional details for specific platforms. - oneof platform_specific { - // VMware disk details. - VmwareDiskConfig vmware = 20; - } -} - -// Disk partition list. -message DiskPartitionList { - // Partition entries. - repeated DiskPartition entries = 1; -} - -// Disk Partition details. -message DiskPartition { - // Partition type. - string type = 1; - - // Partition file system. - string file_system = 2; - - // Mount pount (Linux/Windows) or drive letter (Windows). - string mount_point = 3; - - // Partition capacity. - int64 capacity_bytes = 4; - - // Partition free space. - int64 free_bytes = 5; - - // Partition UUID. - string uuid = 6; - - // Sub-partitions. - DiskPartitionList sub_partitions = 7; -} - -// VMware disk config details. -message VmwareDiskConfig { - // VMDK backing type possible values. - enum BackingType { - // Default value. - BACKING_TYPE_UNSPECIFIED = 0; - - // Flat v1. - BACKING_TYPE_FLAT_V1 = 1; - - // Flat v2. - BACKING_TYPE_FLAT_V2 = 2; - - // Persistent memory, also known as Non-Volatile Memory (NVM). - BACKING_TYPE_PMEM = 3; - - // Raw Disk Memory v1. - BACKING_TYPE_RDM_V1 = 4; - - // Raw Disk Memory v2. - BACKING_TYPE_RDM_V2 = 5; - - // SEsparse is a snapshot format introduced in vSphere 5.5 for large disks. - BACKING_TYPE_SESPARSE = 6; - - // SEsparse v1. - BACKING_TYPE_SESPARSE_V1 = 7; - - // SEsparse v1. - BACKING_TYPE_SESPARSE_V2 = 8; - } - - // VMDK disk mode. - enum VmdkMode { - // VMDK disk mode unspecified or unknown. - VMDK_MODE_UNSPECIFIED = 0; - - // Dependent disk mode. - DEPENDENT = 1; - - // Independent - Persistent disk mode. - INDEPENDENT_PERSISTENT = 2; - - // Independent - Nonpersistent disk mode. - INDEPENDENT_NONPERSISTENT = 3; - } - - // RDM compatibility mode. - enum RdmCompatibility { - // Compatibility mode unspecified or unknown. - RDM_COMPATIBILITY_UNSPECIFIED = 0; - - // Physical compatibility mode. - PHYSICAL_COMPATIBILITY = 1; - - // Virtual compatibility mode. - VIRTUAL_COMPATIBILITY = 2; - } - - // VMDK backing type. - BackingType backing_type = 1; - - // Is VMDK shared with other VMs. - bool shared = 2; - - // VMDK disk mode. - VmdkMode vmdk_mode = 3; - - // RDM compatibility mode. - RdmCompatibility rdm_compatibility = 4; -} - -// Information from Guest-level collections. -message GuestOsDetails { - // The name of the operating system. - string os_name = 1; - - // What family the OS belong to, if known. - OperatingSystemFamily family = 2; - - // The version of the operating system. - string version = 3; - - // OS and app configuration. - GuestConfigDetails config = 4; - - // Runtime information. - GuestRuntimeDetails runtime = 5; -} - -// Guest OS config information. -message GuestConfigDetails { - // Security-Enhanced Linux (SELinux) mode. - enum SeLinuxMode { - // SELinux mode unknown or unspecified. - SE_LINUX_MODE_UNSPECIFIED = 0; - - // SELinux is disabled. - SE_LINUX_MODE_DISABLED = 1; - - // SELinux permissive mode. - SE_LINUX_MODE_PERMISSIVE = 2; - - // SELinux enforcing mode. - SE_LINUX_MODE_ENFORCING = 3; - } - - // OS issue (typically /etc/issue in Linux). - string issue = 1; - - // Mount list (Linux fstab). - FstabEntryList fstab = 2; - - // Hosts file (/etc/hosts). - HostsEntryList hosts = 3; - - // NFS exports. - NfsExportList nfs_exports = 4; - - // Security-Enhanced Linux (SELinux) mode. - SeLinuxMode selinux_mode = 5; -} - -// Fstab content. -message FstabEntryList { - // Fstab entries. - repeated FstabEntry entries = 1; -} - -// Single fstab entry. -message FstabEntry { - // The block special device or remote filesystem to be mounted. - string spec = 1; - - // The mount point for the filesystem. - string file = 2; - - // The type of the filesystem. - string vfstype = 3; - - // Mount options associated with the filesystem. - string mntops = 4; - - // Used by dump to determine which filesystems need to be dumped. - int32 freq = 5; - - // Used by the fsck(8) program to determine the order in which filesystem - // checks are done at reboot time. - int32 passno = 6; -} - -// Hosts content. -message HostsEntryList { - // Hosts entries. - repeated HostsEntry entries = 1; -} - -// Single /etc/hosts entry. -message HostsEntry { - // IP (raw, IPv4/6 agnostic). - string ip = 1; - - // List of host names / aliases. - repeated string host_names = 2; -} - -// NFS exports. -message NfsExportList { - // NFS export entries. - repeated NfsExport entries = 1; -} - -// NFS export. -message NfsExport { - // The directory being exported. - string export_directory = 1; - - // The hosts or networks to which the export is being shared. - repeated string hosts = 2; -} - -// Guest OS runtime information. -message GuestRuntimeDetails { - // Running background services. - RunningServiceList services = 1; - - // Running processes. - RunningProcessList processes = 2; - - // Runtime network information (connections, ports). - RuntimeNetworkInfo network = 3; - - // Last time the OS was booted. - google.protobuf.Timestamp last_boot_time = 4; - - // Domain, e.g. c.stratozone-development.internal. - string domain = 5; - - // Machine name. - string machine_name = 6; - - // Installed applications information. - GuestInstalledApplicationList installed_apps = 7; - - // Open files information. - OpenFileList open_file_list = 8; -} - -// List of running guest OS services. -message RunningServiceList { - // Running service entries. - repeated RunningService entries = 1; -} - -// Guest OS running service details. -message RunningService { - // Service state (OS-agnostic). - enum State { - // Service state unspecified. - STATE_UNSPECIFIED = 0; - - // Service is active. - ACTIVE = 1; - - // Service is paused. - PAUSED = 2; - - // Service is stopped. - STOPPED = 3; - } - - // Service start mode (OS-agnostic). - enum StartMode { - // Start mode unspecified. - START_MODE_UNSPECIFIED = 0; - - // The service is a device driver started by the system loader. - BOOT = 1; - - // The service is a device driver started by the IOInitSystem function. - SYSTEM = 2; - - // The service is started by the operating system, at system start-up - AUTO = 3; - - // The service is started only manually, by a user. - MANUAL = 4; - - // The service is disabled. - DISABLED = 5; - } - - // Service name. - string service_name = 1; - - // Service state (OS-agnostic). - State state = 2; - - // Service start mode (OS-agnostic). - StartMode start_mode = 3; - - // Service binary path. - string exe_path = 4; - - // Service command line. - string cmdline = 5; - - // Service pid. - int64 pid = 6; -} - -// List of running guest OS processes. -message RunningProcessList { - // Running process entries. - repeated RunningProcess entries = 1; -} - -// Guest OS running process details. -message RunningProcess { - // Process ID. - int64 pid = 1; - - // Process binary path. - string exe_path = 2; - - // Process full command line. - string cmdline = 3; - - // User running the process. - string user = 4; - - // Process extended attributes. - map attributes = 100; -} - -// Runtime networking information. -message RuntimeNetworkInfo { - // Time of the last network scan. - google.protobuf.Timestamp scan_time = 1; - - // Network connections. - NetworkConnectionList connections = 2; -} - -// Network connection list. -message NetworkConnectionList { - // Network connection entries. - repeated NetworkConnection entries = 1; -} - -message NetworkConnection { - // Network connection state. - enum State { - // Connection state is unknown or unspecified. - STATE_UNSPECIFIED = 0; - - // The connection is being opened. - OPENING = 1; - - // The connection is open. - OPEN = 2; - - // Listening for incoming connections. - LISTEN = 3; - - // The connection is being closed. - CLOSING = 4; - - // The connection is closed. - CLOSED = 5; - } - - // Connection protocol (e.g. TCP/UDP). - string protocol = 1; - - // Local IP address. - string local_ip_address = 2; - - // Local port. - int32 local_port = 3; - - // Remote IP address. - string remote_ip_address = 4; - - // Remote port. - int32 remote_port = 5; - - // Network connection state. - State state = 6; - - // Process ID. - int64 pid = 7; - - // Process or service name. - string process_name = 8; -} - -// Guest installed application list. -message GuestInstalledApplicationList { - // Application entries. - repeated GuestInstalledApplication entries = 1; -} - -// Guest installed application information. -message GuestInstalledApplication { - // Installed application name. - string application_name = 1; - - // Installed application vendor. - string vendor = 2; - - // The time when the application was installed. - google.protobuf.Timestamp install_time = 3; - - // Source path. - string path = 4; - - // Installed application version. - string version = 5; -} - -// Open file list. -message OpenFileList { - // Open file details entries. - repeated OpenFileDetails entries = 1; -} - -// Open file Information. -message OpenFileDetails { - // Opened file command. - string command = 1; - - // Opened file user. - string user = 2; - - // Opened file file type. - string file_type = 3; - - // Opened file file path. - string file_path = 4; -} - -// Information about the platform. -message PlatformDetails { - oneof vendor_details { - // VMware specific details. - VmwarePlatformDetails vmware_details = 1; - - // AWS EC2 specific details. - AwsEc2PlatformDetails aws_ec2_details = 2; - - // Azure VM specific details. - AzureVmPlatformDetails azure_vm_details = 3; - - // Generic platform details. - GenericPlatformDetails generic_details = 4; - - // Physical machines platform details. - PhysicalPlatformDetails physical_details = 5; - } -} - -// VMware specific details. -message VmwarePlatformDetails { - // vCenter version. - string vcenter_version = 1; - - // ESX version. - string esx_version = 2; - - // VMware os enum - - // https://vdc-repo.vmware.com/vmwb-repository/dcr-public/da47f910-60ac-438b-8b9b-6122f4d14524/16b7274a-bf8b-4b4c-a05e-746f2aa93c8c/doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html. - string osid = 3; - - // Folder name in vCenter where asset resides. - string vcenter_folder = 4; - - // vCenter URI used in collection. - string vcenter_uri = 5; - - // vCenter VM ID. - string vcenter_vm_id = 6; -} - -// AWS EC2 specific details. -message AwsEc2PlatformDetails { - // AWS platform's machine type label. - string machine_type_label = 1; - - // The location of the machine in the AWS format. - string location = 2; -} - -// Azure VM specific details. -message AzureVmPlatformDetails { - // Azure platform's machine type label. - string machine_type_label = 1; - - // The location of the machine in the Azure format. - string location = 2; - - // Azure platform's provisioning state. - string provisioning_state = 3; -} - -// Generic platform details. -message GenericPlatformDetails { - // Free text representation of the machine location. - // The format of this field should not be relied on. Different VMs in the same - // location may have different string values for this field. - string location = 1; -} - -// Platform specific details for Physical Machines. -message PhysicalPlatformDetails { - // Free text representation of the machine location. - // The format of this field should not be relied on. Different machines in the - // same location may have different string values for this field. - string location = 1; -} - -// Memory usage sample. -message MemoryUsageSample { - // Percentage of system memory utilized. Must be in the interval [0, 100]. - float utilized_percentage = 1; -} - -// CPU usage sample. -message CpuUsageSample { - // Percentage of total CPU capacity utilized. Must be in the interval [0, - // 100]. On most systems can be calculated using 100 - idle percentage. - float utilized_percentage = 1; -} - -// Network usage sample. Values are across all network interfaces. -message NetworkUsageSample { - // Average network ingress in B/s sampled over a short window. - // Must be non-negative. - float average_ingress_bps = 1; - - // Average network egress in B/s sampled over a short window. - // Must be non-negative. - float average_egress_bps = 2; -} - -// Disk usage sample. Values are across all disks. -message DiskUsageSample { - // Average IOPS sampled over a short window. Must be non-negative. - float average_iops = 1; -} - -// Performance data sample. -message PerformanceSample { - // Time the sample was collected. - google.protobuf.Timestamp sample_time = 1; - - // Memory usage sample. - MemoryUsageSample memory = 2; - - // CPU usage sample. - CpuUsageSample cpu = 3; - - // Network usage sample. - NetworkUsageSample network = 4; - - // Disk usage sample. - DiskUsageSample disk = 5; -} - -// Performance data for an asset. -message AssetPerformanceData { - // Daily resource usage aggregations. - // Contains all of the data available for an asset, up to the last 420 days. - // Aggregations are sorted from oldest to most recent. - repeated DailyResourceUsageAggregation daily_resource_usage_aggregations = 1; -} - -// Usage data aggregation for a single day. -message DailyResourceUsageAggregation { - // Statistical aggregation of samples for a single resource usage. - message Stats { - // Average usage value. - float average = 1; - - // Median usage value. - float median = 2; - - // 95th percentile usage value. - float nintey_fifth_percentile = 3; - - // Peak usage value. - float peak = 4; - } - - // Statistical aggregation of CPU usage. - message CPU { - // CPU utilization percentage. - Stats utilization_percentage = 1; - } - - // Statistical aggregation of memory usage. - message Memory { - // Memory utilization percentage. - Stats utilization_percentage = 1; - } - - // Statistical aggregation of network usage. - message Network { - // Network ingress in B/s. - Stats ingress_bps = 1; - - // Network egress in B/s. - Stats egress_bps = 2; - } - - // Statistical aggregation of disk usage. - message Disk { - // Disk I/O operations per second. - Stats iops = 1; - } - - // Aggregation date. Day boundaries are at midnight UTC. - google.type.Date date = 1; - - // CPU usage. - CPU cpu = 2; - - // Memory usage. - Memory memory = 3; - - // Network usage. - Network network = 4; - - // Disk usage. - Disk disk = 5; -} - -// Message containing insights list. -message InsightList { - // Output only. Insights of the list. - repeated Insight insights = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Update timestamp. - google.protobuf.Timestamp update_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// An insight about an asset. -message Insight { - oneof insight { - // Output only. An insight about potential migrations for an asset. - MigrationInsight migration_insight = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - } -} - -// An insight about potential migrations for an asset. -message MigrationInsight { - // Output only. Description of how well the asset this insight is associated - // with fits the proposed migration. - FitDescriptor fit = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A target for the migration. - oneof migration_target { - // Output only. A Google Compute Engine target. - ComputeEngineMigrationTarget compute_engine_target = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - } -} - -// Compute engine migration target. -message ComputeEngineMigrationTarget { - // Description of the suggested shape for the migration target. - ComputeEngineShapeDescriptor shape = 1; -} - -// Describes the fit level of an asset for migration to a specific target. -message FitDescriptor { - // Fit level. - enum FitLevel { - // Not enough information. - FIT_LEVEL_UNSPECIFIED = 0; - - // Fit. - FIT = 1; - - // No Fit. - NO_FIT = 2; - - // Fit with effort. - REQUIRES_EFFORT = 3; - } - - // Fit level. - FitLevel fit_level = 1; -} - -// Compute Engine target shape descriptor. -message ComputeEngineShapeDescriptor { - // Memory in mebibytes. - int32 memory_mb = 1; - - // Number of physical cores. - int32 physical_core_count = 2; - - // Number of logical cores. - int32 logical_core_count = 3; - - // Compute Engine machine series. - string series = 4; - - // Compute Engine machine type. - string machine_type = 5; -} - -// Message describing an aggregation. The message includes the aggregation type, -// parameters, and the field on which to perform the aggregation. -message Aggregation { - // Object count. - message Count {} - - // Sum of field values. - message Sum {} - - // Histogram of bucketed assets counts by field value. - message Histogram { - // Lower bounds of buckets. - // The response will contain `n+1` buckets for `n` bounds. - // The first bucket will count all assets for which the field value is - // smaller than the first bound. - // Subsequent buckets will count assets for which the field value is - // greater or equal to a lower bound and smaller than the next one. - // The last bucket will count assets for which the field value is greater or - // equal to the final lower bound. - // You can define up to 20 lower bounds. - repeated double lower_bounds = 1; - } - - // Frequency distribution of all field values. - message Frequency {} - - // The name of the field on which to aggregate. - string field = 1; - - oneof aggregation_function { - // Count the number of matching objects. - Count count = 2; - - // Sum over a numeric field. - Sum sum = 3; - - // Creates a bucketed histogram of field values. - Histogram histogram = 4; - - // Creates a frequency distribution of all field values. - Frequency frequency = 5; - } -} - -// Message describing a result of an aggregation. -message AggregationResult { - // The result of a count aggregation. - message Count { - int64 value = 1; - } - - // The result of a sum aggregation. - message Sum { - double value = 1; - } - - // The result of a bucketed histogram aggregation. - message Histogram { - // A histogram bucket with a lower and upper bound, and a count of items - // with a field value between those bounds. - // The lower bound is inclusive and the upper bound is exclusive. - // Lower bound may be -infinity and upper bound may be infinity. - message Bucket { - // Lower bound - inclusive. - double lower_bound = 1; - - // Upper bound - exclusive. - double upper_bound = 2; - - // Count of items in the bucket. - int64 count = 3; - } - - // Buckets in the histogram. - // There will be `n+1` buckets matching `n` lower bounds in the request. - // The first bucket will be from -infinity to the first bound. - // Subsequent buckets will be between one bound and the next. - // The final bucket will be from the final bound to infinity. - repeated Bucket buckets = 1; - } - - // The result of a frequency distribution aggregation. - message Frequency { - map values = 1; - } - - string field = 1; - - oneof result { - Count count = 2; - - Sum sum = 3; - - Histogram histogram = 4; - - Frequency frequency = 5; - } -} - -// A resource that aggregates the validation errors found in an import job file. -message FileValidationReport { - // The name of the file. - string file_name = 1; - - // Partial list of rows that encountered validation error. - repeated ImportRowError row_errors = 2; - - // Flag indicating that processing was aborted due to maximum number of - // errors. - bool partial_report = 3; - - // List of file level errors. - repeated ImportError file_errors = 4; -} - -// A resource that aggregates errors across import job files. -message ValidationReport { - // List of errors found in files. - repeated FileValidationReport file_validations = 1; - - // List of job level errors. - repeated ImportError job_errors = 2; -} - -// A resource that reports result of the import job execution. -message ExecutionReport { - // Total number of asset frames reported for the import job. - int32 frames_reported = 1; - - // Validation errors encountered during the execution of the import job. - ValidationReport execution_errors = 2; - - // Total number of rows in the import job. - int32 total_rows_count = 3; -} - -// A resource that reports the errors encountered while processing an -// import job. -message ImportError { - // Enumerate possible error severity. - enum Severity { - SEVERITY_UNSPECIFIED = 0; - - ERROR = 1; - - WARNING = 2; - - INFO = 3; - } - - // The error information. - string error_details = 1; - - // The severity of the error. - Severity severity = 2; -} - -// A resource that reports the import job errors at row level. -message ImportRowError { - // The row number where the error was detected. - int32 row_number = 1 [deprecated = true]; - - // The name of the VM in the row. - string vm_name = 2; - - // The VM UUID. - string vm_uuid = 3; - - // The list of errors detected in the row. - repeated ImportError errors = 4; -} - -// A resource that contains a URI to which a data file can be uploaded. -message UploadFileInfo { - // Output only. Upload URI for the file. - string signed_uri = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The headers that were used to sign the URI. - map headers = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Expiration time of the upload URI. - google.protobuf.Timestamp uri_expiration_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Lists the asset IDs of all assets. -message AssetList { - // Required. A list of asset IDs - repeated string asset_ids = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/Asset" - } - ]; -} - -// A resource that contains a single violation of a reported `AssetFrame` -// resource. -message FrameViolationEntry { - // The field of the original frame where the violation occurred. - string field = 1; - - // A message describing the violation. - string violation = 2; -} - -// VirtualMachinePreferences enables you to create sets of assumptions, for -// example, a geographical location and pricing track, for your migrated virtual -// machines. The set of preferences influence recommendations for migrating -// virtual machine assets. -message VirtualMachinePreferences { - // Region preferences for assets using this preference set. - // If you are unsure which value to set, the migration service API region is - // often a good value to start with. - RegionPreferences region_preferences = 3; - - // Commitment plan to consider when calculating costs for virtual machine - // insights and recommendations. - // If you are unsure which value to set, a 3 year commitment plan is often a - // good value to start with. - CommitmentPlan commitment_plan = 4; - - // Sizing optimization strategy specifies the preferred strategy used when - // extrapolating usage data to calculate insights and recommendations for a - // virtual machine. - // If you are unsure which value to set, a moderate sizing optimization - // strategy is often a good value to start with. - SizingOptimizationStrategy sizing_optimization_strategy = 5; - - // Compute Engine preferences concern insights and recommendations for Compute - // Engine target. - ComputeEnginePreferences compute_engine_preferences = 6; -} - -// The user preferences relating to Compute Engine target platform. -message ComputeEnginePreferences { - // Preferences concerning the machine types to consider on Compute Engine. - MachinePreferences machine_preferences = 2; - - // License type to consider when calculating costs for virtual machine - // insights and recommendations. If unspecified, costs are calculated - // based on the default licensing plan. - LicenseType license_type = 3; -} - -// The type of machines to consider when calculating virtual machine migration -// insights and recommendations. -// Not all machine types are available in all zones and regions. -message MachinePreferences { - // Compute Engine machine series to consider for insights and recommendations. - // If empty, no restriction is applied on the machine series. - repeated MachineSeries allowed_machine_series = 1; -} - -// A Compute Engine machine series. -message MachineSeries { - // Code to identify a Compute Engine machine series. Consult - // https://cloud.google.com/compute/docs/machine-resource#machine_type_comparison - // for more details on the available series. - string code = 1; -} - -// The user preferences relating to target regions. -message RegionPreferences { - // A list of preferred regions, - // ordered by the most preferred region first. - // Set only valid Google Cloud region names. - // See https://cloud.google.com/compute/docs/regions-zones - // for available regions. - repeated string preferred_regions = 1; -} - -// Describes the Migration Center settings related to the project. -message Settings { - option (google.api.resource) = { - type: "migrationcenter.googleapis.com/Settings" - pattern: "projects/{project}/locations/{location}/settings" - }; - - // Output only. The name of the resource. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The preference set used by default for a project. - string preference_set = 2 [(google.api.resource_reference) = { - type: "migrationcenter.googleapis.com/PreferenceSet" - }]; -} - -// Describes the Summary view of a Report, which contains aggregated values -// for all the groups and preference sets included in this Report. -message ReportSummary { - // Describes a collection of data points rendered as a Chart. - message ChartData { - // Describes a single data point in the Chart. - message DataPoint { - // The X-axis label for this data point. - string label = 1; - - // The Y-axis value for this data point. - double value = 2; - } - - // Each data point in the chart is represented as a name-value pair - // with the name being the x-axis label, and the value being the y-axis - // value. - repeated DataPoint data_points = 1; - } - - // Utilization Chart is a specific type of visualization which displays - // a metric classified into "Used" and "Free" buckets. - message UtilizationChartData { - // Aggregate value which falls into the "Used" bucket. - int64 used = 1; - - // Aggregate value which falls into the "Free" bucket. - int64 free = 2; - } - - // A Histogram Chart shows a distribution of values into buckets, showing - // a count of values which fall into a bucket. - message HistogramChartData { - // A histogram bucket with a lower and upper bound, and a count of items - // with a field value between those bounds. - // The lower bound is inclusive and the upper bound is exclusive. - // Lower bound may be -infinity and upper bound may be infinity. - message Bucket { - // Lower bound - inclusive. - int64 lower_bound = 1; - - // Upper bound - exclusive. - int64 upper_bound = 2; - - // Count of items in the bucket. - int64 count = 3; - } - - // Buckets in the histogram. - // There will be `n+1` buckets matching `n` lower bounds in the request. - // The first bucket will be from -infinity to the first bound. - // Subsequent buckets will be between one bound and the next. - // The final bucket will be from the final bound to infinity. - repeated Bucket buckets = 1; - } - - // Aggregate statistics for a collection of assets. - message AssetAggregateStats { - // Sum of the memory in bytes of all the assets in this collection. - int64 total_memory_bytes = 1; - - // Sum of persistent storage in bytes of all the assets in this collection. - int64 total_storage_bytes = 2; - - // Sum of the CPU core count of all the assets in this collection. - int64 total_cores = 3; - - // Count of the number of unique assets in this collection. - int64 total_assets = 4; - - // Total memory split into Used/Free buckets. - UtilizationChartData memory_utilization_chart = 5; - - // Total memory split into Used/Free buckets. - UtilizationChartData storage_utilization_chart = 6; - - // Count of assets grouped by Operating System families. - ChartData operating_system = 7; - - // Histogram showing a distribution of CPU core counts. - HistogramChartData core_count_histogram = 8; - - // Histogram showing a distribution of memory sizes. - HistogramChartData memory_bytes_histogram = 9; - - // Histogram showing a distribution of memory sizes. - HistogramChartData storage_bytes_histogram = 10; - } - - // Represents a data point tracking the count of assets allocated for a - // specific Machine Series. - message MachineSeriesAllocation { - // The Machine Series (e.g. "E2", "N2") - MachineSeries machine_series = 1; - - // Count of assets allocated to this machine series. - int64 allocated_asset_count = 2; - } - - // A set of findings that applies to assets destined for Compute Engine. - message ComputeEngineFinding { - // Set of regions in which the assets were allocated. - repeated string allocated_regions = 1; - - // Count of assets which were allocated. - int64 allocated_asset_count = 2; - - // Distribution of assets based on the Machine Series. - repeated MachineSeriesAllocation machine_series_allocations = 3; - - // Set of disk types allocated to assets. - repeated PersistentDiskType allocated_disk_types = 4; - } - - // Summary Findings for a specific Group/PreferenceSet combination. - message GroupPreferenceSetFinding { - // Display Name of the Preference Set - string display_name = 1; - - // Description for the Preference Set. - string description = 2; - - // A set of preferences that applies to all machines in the context. - VirtualMachinePreferences machine_preferences = 3; - - // Total monthly cost for this preference set. - google.type.Money monthly_cost_total = 4; - - // Compute monthly cost for this preference set. - google.type.Money monthly_cost_compute = 5; - - // Licensing monthly cost for this preference set. - google.type.Money monthly_cost_os_license = 6; - - // Network Egress monthly cost for this preference set. - google.type.Money monthly_cost_network_egress = 7; - - // Storage monthly cost for this preference set. - google.type.Money monthly_cost_storage = 8; - - // Miscellaneous monthly cost for this preference set. - google.type.Money monthly_cost_other = 9; - - // A set of findings that applies to Compute Engine machines in the input. - ComputeEngineFinding compute_engine_finding = 10; - } - - // Summary Findings for a specific Group. - message GroupFinding { - // Display Name for the Group. - string display_name = 1; - - // Description for the Group. - string description = 2; - - // Summary statistics for all the assets in this group. - AssetAggregateStats asset_aggregate_stats = 3; - - // Count of the number of assets in this group which are also included - // in another group within the same report. - int64 overlapping_asset_count = 4; - - // Findings for each of the PreferenceSets for this group. - repeated GroupPreferenceSetFinding preference_set_findings = 5; - } - - // Aggregate statistics for all the assets across all the groups. - AssetAggregateStats all_assets_stats = 1; - - // Findings for each Group included in this report. - repeated GroupFinding group_findings = 2; -} - -// Specifies the types of asset views that provide complete or partial details -// of an asset. -enum AssetView { - // The asset view is not specified. The API displays the basic view by - // default. - ASSET_VIEW_UNSPECIFIED = 0; - - // The asset view includes only basic metadata of the asset. - ASSET_VIEW_BASIC = 1; - - // The asset view includes all the metadata of an asset and performance data. - ASSET_VIEW_FULL = 2; -} - -// Known categories of operating systems. -enum OperatingSystemFamily { - OS_FAMILY_UNKNOWN = 0; - - // Microsoft Windows Server and Desktop. - OS_FAMILY_WINDOWS = 1; - - // Various Linux flavors. - OS_FAMILY_LINUX = 2; - - // Non-Linux Unix flavors. - OS_FAMILY_UNIX = 3; -} - -// Specifies the data formats supported by Migration Center. -enum ImportJobFormat { - // Default value. - IMPORT_JOB_FORMAT_UNSPECIFIED = 0; - - // RVTools format (XLSX). - IMPORT_JOB_FORMAT_RVTOOLS_XLSX = 1; - - // RVTools format (CSV). - IMPORT_JOB_FORMAT_RVTOOLS_CSV = 2; - - // CSV format exported from AWS using the - // [AWS collection - // script][https://github.com/GoogleCloudPlatform/aws-to-stratozone-export]. - IMPORT_JOB_FORMAT_EXPORTED_AWS_CSV = 4; - - // CSV format exported from Azure using the - // [Azure collection - // script][https://github.com/GoogleCloudPlatform/azure-to-stratozone-export]. - IMPORT_JOB_FORMAT_EXPORTED_AZURE_CSV = 5; - - // CSV format created manually and following the StratoZone format. For more - // information, see [Manually create and upload data - // tables][https://cloud.google.com/migrate/stratozone/docs/import-data-portal]. - IMPORT_JOB_FORMAT_STRATOZONE_CSV = 6; -} - -// Specifies the types of import job views that provide complete or partial -// details of an import job. -enum ImportJobView { - // The import job view is not specified. The API displays the basic view by - // default. - IMPORT_JOB_VIEW_UNSPECIFIED = 0; - - // The import job view includes basic metadata of an import job. - // This view does not include payload information. - IMPORT_JOB_VIEW_BASIC = 1; - - // The import job view includes all metadata of an import job. - IMPORT_JOB_VIEW_FULL = 2; -} - -// ErrorFrameView can be specified in ErrorFrames List and Get requests to -// control the level of details that is returned for the original frame. -enum ErrorFrameView { - // Value is unset. The system will fallback to the default value. - ERROR_FRAME_VIEW_UNSPECIFIED = 0; - - // Include basic frame data, but not the full contents. - ERROR_FRAME_VIEW_BASIC = 1; - - // Include everything. - ERROR_FRAME_VIEW_FULL = 2; -} - -// The persistent disk (PD) types of Compute Engine virtual machines. -enum PersistentDiskType { - // Unspecified (default value). - // Selecting this value allows the system to use any disk type according - // to reported usage. This a good value to start with. - PERSISTENT_DISK_TYPE_UNSPECIFIED = 0; - - // Standard HDD Persistent Disk. - PERSISTENT_DISK_TYPE_STANDARD = 1; - - // Balanced Persistent Disk. - PERSISTENT_DISK_TYPE_BALANCED = 2; - - // SSD Persistent Disk. - PERSISTENT_DISK_TYPE_SSD = 3; -} - -// The License type for premium images (RHEL, RHEL for SAP, SLES, SLES for SAP, -// Windows Server). -enum LicenseType { - // Unspecified (default value). - LICENSE_TYPE_UNSPECIFIED = 0; - - // Default Google Cloud licensing plan. Licensing is charged per usage. - // This a good value to start with. - LICENSE_TYPE_DEFAULT = 1; - - // Bring-your-own-license (BYOL) plan. User provides the OS license. - LICENSE_TYPE_BRING_YOUR_OWN_LICENSE = 2; -} - -// The sizing optimization strategy preferences of a virtual machine. This -// strategy, in addition to actual usage data of the virtual machine, can help -// determine the recommended shape on the target platform. -enum SizingOptimizationStrategy { - // Unspecified (default value). - SIZING_OPTIMIZATION_STRATEGY_UNSPECIFIED = 0; - - // No optimization applied. Virtual machine sizing matches as closely as - // possible the machine shape on the source site, not considering any actual - // performance data. - SIZING_OPTIMIZATION_STRATEGY_SAME_AS_SOURCE = 1; - - // Virtual machine sizing will match the reported usage and shape, with some - // slack. This a good value to start with. - SIZING_OPTIMIZATION_STRATEGY_MODERATE = 2; - - // Virtual machine sizing will match the reported usage, with little slack. - // Using this option can help reduce costs. - SIZING_OPTIMIZATION_STRATEGY_AGGRESSIVE = 3; -} - -// The plan of commitments for VM resource-based committed use discount (CUD). -enum CommitmentPlan { - // Unspecified commitment plan. - COMMITMENT_PLAN_UNSPECIFIED = 0; - - // No commitment plan. - COMMITMENT_PLAN_NONE = 1; - - // 1 year commitment. - COMMITMENT_PLAN_ONE_YEAR = 2; - - // 3 years commitment. - COMMITMENT_PLAN_THREE_YEARS = 3; -} - -// Specifies the types of views that provide complete or partial details -// of a Report. -enum ReportView { - // The report view is not specified. The API displays the basic view by - // default. - REPORT_VIEW_UNSPECIFIED = 0; - - // The report view includes only basic metadata of the Report. Useful for - // list views. - REPORT_VIEW_BASIC = 1; - - // The report view includes all the metadata of the Report. Useful for - // preview. - REPORT_VIEW_FULL = 2; - - // The report view includes the standard metadata of an report. Useful for - // detail view. - REPORT_VIEW_STANDARD = 3; -} diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.add_assets_to_group.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.add_assets_to_group.js deleted file mode 100644 index 6d6f38dff5c..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.add_assets_to_group.js +++ /dev/null @@ -1,91 +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(group, assets) { - // [START migrationcenter_v1_generated_MigrationCenter_AddAssetsToGroup_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. Group reference. - */ - // const group = 'abc123' - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - /** - * Required. List of assets to be added. - * The maximum number of assets that can be added in a single request is - * 1000. - */ - // const assets = {} - /** - * Optional. When this value is set to `false` and one of the given assets is - * already an existing member of the group, the operation fails with an - * `Already Exists` error. When set to `true` this situation is silently - * ignored by the server. - * Default value is `false`. - */ - // const allowExisting = true - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callAddAssetsToGroup() { - // Construct request - const request = { - group, - assets, - }; - - // Run request - const [operation] = await migrationcenterClient.addAssetsToGroup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAddAssetsToGroup(); - // [END migrationcenter_v1_generated_MigrationCenter_AddAssetsToGroup_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-migrationcenter/v1/samples/generated/v1/migration_center.aggregate_assets_values.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.aggregate_assets_values.js deleted file mode 100644 index 79d01f9f78b..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.aggregate_assets_values.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(parent) { - // [START migrationcenter_v1_generated_MigrationCenter_AggregateAssetsValues_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. Parent value for `AggregateAssetsValuesRequest`. - */ - // const parent = 'abc123' - /** - * Array of aggregations to perform. - * Up to 25 aggregations can be defined. - */ - // const aggregations = [1,2,3,4] - /** - * The aggregation will be performed on assets that match the provided filter. - */ - // const filter = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callAggregateAssetsValues() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await migrationcenterClient.aggregateAssetsValues(request); - console.log(response); - } - - callAggregateAssetsValues(); - // [END migrationcenter_v1_generated_MigrationCenter_AggregateAssetsValues_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-migrationcenter/v1/samples/generated/v1/migration_center.batch_delete_assets.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.batch_delete_assets.js deleted file mode 100644 index 90d06123302..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.batch_delete_assets.js +++ /dev/null @@ -1,74 +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, names) { - // [START migrationcenter_v1_generated_MigrationCenter_BatchDeleteAssets_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. Parent value for batch asset delete. - */ - // const parent = 'abc123' - /** - * Required. The IDs of the assets to delete. - * A maximum of 1000 assets can be deleted in a batch. - * Format: projects/{project}/locations/{location}/assets/{name}. - */ - // const names = ['abc','def'] - /** - * Optional. When this value is set to `true` the request is a no-op for - * non-existing assets. See https://google.aip.dev/135#delete-if-existing for - * additional details. Default value is `false`. - */ - // const allowMissing = true - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callBatchDeleteAssets() { - // Construct request - const request = { - parent, - names, - }; - - // Run request - const response = await migrationcenterClient.batchDeleteAssets(request); - console.log(response); - } - - callBatchDeleteAssets(); - // [END migrationcenter_v1_generated_MigrationCenter_BatchDeleteAssets_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-migrationcenter/v1/samples/generated/v1/migration_center.batch_update_assets.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.batch_update_assets.js deleted file mode 100644 index 9989849c2c2..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.batch_update_assets.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, requests) { - // [START migrationcenter_v1_generated_MigrationCenter_BatchUpdateAssets_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. Parent value for batch asset update. - */ - // const parent = 'abc123' - /** - * Required. The request message specifying the resources to update. - * A maximum of 1000 assets can be modified in a batch. - */ - // const requests = [1,2,3,4] - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callBatchUpdateAssets() { - // Construct request - const request = { - parent, - requests, - }; - - // Run request - const response = await migrationcenterClient.batchUpdateAssets(request); - console.log(response); - } - - callBatchUpdateAssets(); - // [END migrationcenter_v1_generated_MigrationCenter_BatchUpdateAssets_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-migrationcenter/v1/samples/generated/v1/migration_center.create_group.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_group.js deleted file mode 100644 index 0b5c90400c9..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_group.js +++ /dev/null @@ -1,90 +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, groupId, group) { - // [START migrationcenter_v1_generated_MigrationCenter_CreateGroup_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. Value for parent. - */ - // const parent = 'abc123' - /** - * Required. User specified ID for the group. It will become the last - * component of the group name. The ID must be unique within the project, must - * conform with RFC-1034, is restricted to lower-cased letters, and has a - * maximum length of 63 characters. The ID must match the regular expression: - * `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. - */ - // const groupId = 'abc123' - /** - * Required. The group resource being created. - */ - // const group = {} - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callCreateGroup() { - // Construct request - const request = { - parent, - groupId, - group, - }; - - // Run request - const [operation] = await migrationcenterClient.createGroup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateGroup(); - // [END migrationcenter_v1_generated_MigrationCenter_CreateGroup_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-migrationcenter/v1/samples/generated/v1/migration_center.create_import_data_file.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_import_data_file.js deleted file mode 100644 index 695050601ef..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_import_data_file.js +++ /dev/null @@ -1,86 +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, importDataFileId, importDataFile) { - // [START migrationcenter_v1_generated_MigrationCenter_CreateImportDataFile_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 parent of the ImportDataFile. - */ - // const parent = 'abc123' - /** - * Required. The ID of the new data file. - */ - // const importDataFileId = 'abc123' - /** - * Required. The resource being created. - */ - // const importDataFile = {} - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callCreateImportDataFile() { - // Construct request - const request = { - parent, - importDataFileId, - importDataFile, - }; - - // Run request - const [operation] = await migrationcenterClient.createImportDataFile(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateImportDataFile(); - // [END migrationcenter_v1_generated_MigrationCenter_CreateImportDataFile_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-migrationcenter/v1/samples/generated/v1/migration_center.create_import_job.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_import_job.js deleted file mode 100644 index 247fb6d627a..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_import_job.js +++ /dev/null @@ -1,86 +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, importJobId, importJob) { - // [START migrationcenter_v1_generated_MigrationCenter_CreateImportJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Value for parent. - */ - // const parent = 'abc123' - /** - * Required. ID of the import job. - */ - // const importJobId = 'abc123' - /** - * Required. The resource being created. - */ - // const importJob = {} - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callCreateImportJob() { - // Construct request - const request = { - parent, - importJobId, - importJob, - }; - - // Run request - const [operation] = await migrationcenterClient.createImportJob(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateImportJob(); - // [END migrationcenter_v1_generated_MigrationCenter_CreateImportJob_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-migrationcenter/v1/samples/generated/v1/migration_center.create_preference_set.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_preference_set.js deleted file mode 100644 index 420acdb1105..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_preference_set.js +++ /dev/null @@ -1,91 +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, preferenceSetId, preferenceSet) { - // [START migrationcenter_v1_generated_MigrationCenter_CreatePreferenceSet_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. Value for parent. - */ - // const parent = 'abc123' - /** - * Required. User specified ID for the preference set. It will become the last - * component of the preference set name. The ID must be unique within the - * project, must conform with RFC-1034, is restricted to lower-cased letters, - * and has a maximum length of 63 characters. The ID must match the regular - * expression - * `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. - */ - // const preferenceSetId = 'abc123' - /** - * Required. The preference set resource being created. - */ - // const preferenceSet = {} - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callCreatePreferenceSet() { - // Construct request - const request = { - parent, - preferenceSetId, - preferenceSet, - }; - - // Run request - const [operation] = await migrationcenterClient.createPreferenceSet(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreatePreferenceSet(); - // [END migrationcenter_v1_generated_MigrationCenter_CreatePreferenceSet_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-migrationcenter/v1/samples/generated/v1/migration_center.create_report.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_report.js deleted file mode 100644 index a479c8924d1..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_report.js +++ /dev/null @@ -1,90 +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, reportId, report) { - // [START migrationcenter_v1_generated_MigrationCenter_CreateReport_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. Value for parent. - */ - // const parent = 'abc123' - /** - * Required. User specified id for the report. It will become the last - * component of the report name. The id must be unique within the project, - * must conform with RFC-1034, is restricted to lower-cased letters, and has a - * maximum length of 63 characters. The id must match the regular expression: - * [a-z]([a-z0-9-]{0,61}[a-z0-9])?. - */ - // const reportId = 'abc123' - /** - * Required. The report resource being created. - */ - // const report = {} - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callCreateReport() { - // Construct request - const request = { - parent, - reportId, - report, - }; - - // Run request - const [operation] = await migrationcenterClient.createReport(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateReport(); - // [END migrationcenter_v1_generated_MigrationCenter_CreateReport_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-migrationcenter/v1/samples/generated/v1/migration_center.create_report_config.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_report_config.js deleted file mode 100644 index e1fcf0284b1..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_report_config.js +++ /dev/null @@ -1,90 +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, reportConfigId, reportConfig) { - // [START migrationcenter_v1_generated_MigrationCenter_CreateReportConfig_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. Value for parent. - */ - // const parent = 'abc123' - /** - * Required. User specified ID for the report config. It will become the last - * component of the report config name. The ID must be unique within the - * project, must conform with RFC-1034, is restricted to lower-cased letters, - * and has a maximum length of 63 characters. The ID must match the regular - * expression: [a-z]([a-z0-9-]{0,61}[a-z0-9])?. - */ - // const reportConfigId = 'abc123' - /** - * Required. The report config set resource being created. - */ - // const reportConfig = {} - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callCreateReportConfig() { - // Construct request - const request = { - parent, - reportConfigId, - reportConfig, - }; - - // Run request - const [operation] = await migrationcenterClient.createReportConfig(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateReportConfig(); - // [END migrationcenter_v1_generated_MigrationCenter_CreateReportConfig_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-migrationcenter/v1/samples/generated/v1/migration_center.create_source.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_source.js deleted file mode 100644 index f30cf115eaa..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.create_source.js +++ /dev/null @@ -1,90 +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, sourceId, source) { - // [START migrationcenter_v1_generated_MigrationCenter_CreateSource_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. Value for parent. - */ - // const parent = 'abc123' - /** - * Required. User specified ID for the source. It will become the last - * component of the source name. The ID must be unique within the project, - * must conform with RFC-1034, is restricted to lower-cased letters, and has a - * maximum length of 63 characters. The ID must match the regular expression: - * `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. - */ - // const sourceId = 'abc123' - /** - * Required. The resource being created. - */ - // const source = {} - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callCreateSource() { - // Construct request - const request = { - parent, - sourceId, - source, - }; - - // Run request - const [operation] = await migrationcenterClient.createSource(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateSource(); - // [END migrationcenter_v1_generated_MigrationCenter_CreateSource_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-migrationcenter/v1/samples/generated/v1/migration_center.delete_asset.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_asset.js deleted file mode 100644 index de097c8327c..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_asset.js +++ /dev/null @@ -1,75 +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 migrationcenter_v1_generated_MigrationCenter_DeleteAsset_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 resource. - */ - // const name = 'abc123' - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callDeleteAsset() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await migrationcenterClient.deleteAsset(request); - console.log(response); - } - - callDeleteAsset(); - // [END migrationcenter_v1_generated_MigrationCenter_DeleteAsset_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-migrationcenter/v1/samples/generated/v1/migration_center.delete_group.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_group.js deleted file mode 100644 index 9c79154d440..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_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(name) { - // [START migrationcenter_v1_generated_MigrationCenter_DeleteGroup_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 group resource. - */ - // const name = 'abc123' - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callDeleteGroup() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await migrationcenterClient.deleteGroup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteGroup(); - // [END migrationcenter_v1_generated_MigrationCenter_DeleteGroup_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-migrationcenter/v1/samples/generated/v1/migration_center.delete_import_data_file.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_import_data_file.js deleted file mode 100644 index 902114e5fcd..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_import_data_file.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(name) { - // [START migrationcenter_v1_generated_MigrationCenter_DeleteImportDataFile_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 ImportDataFile to delete. - */ - // const name = 'abc123' - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callDeleteImportDataFile() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await migrationcenterClient.deleteImportDataFile(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteImportDataFile(); - // [END migrationcenter_v1_generated_MigrationCenter_DeleteImportDataFile_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-migrationcenter/v1/samples/generated/v1/migration_center.delete_import_job.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_import_job.js deleted file mode 100644 index 88747c5bcbf..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_import_job.js +++ /dev/null @@ -1,82 +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 migrationcenter_v1_generated_MigrationCenter_DeleteImportJob_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 resource. - */ - // const name = 'abc123' - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - /** - * Optional. If set to `true`, any `ImportDataFiles` of this job will also be - * deleted If set to `false`, the request only works if the job has no data - * files. - */ - // const force = true - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callDeleteImportJob() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await migrationcenterClient.deleteImportJob(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteImportJob(); - // [END migrationcenter_v1_generated_MigrationCenter_DeleteImportJob_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-migrationcenter/v1/samples/generated/v1/migration_center.delete_preference_set.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_preference_set.js deleted file mode 100644 index 89e8c93eb10..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_preference_set.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(name) { - // [START migrationcenter_v1_generated_MigrationCenter_DeletePreferenceSet_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 group resource. - */ - // const name = 'abc123' - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callDeletePreferenceSet() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await migrationcenterClient.deletePreferenceSet(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeletePreferenceSet(); - // [END migrationcenter_v1_generated_MigrationCenter_DeletePreferenceSet_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-migrationcenter/v1/samples/generated/v1/migration_center.delete_report.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_report.js deleted file mode 100644 index 3633b153353..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_report.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(name) { - // [START migrationcenter_v1_generated_MigrationCenter_DeleteReport_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 resource. - */ - // const name = 'abc123' - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callDeleteReport() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await migrationcenterClient.deleteReport(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteReport(); - // [END migrationcenter_v1_generated_MigrationCenter_DeleteReport_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-migrationcenter/v1/samples/generated/v1/migration_center.delete_report_config.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_report_config.js deleted file mode 100644 index 0d8b5064510..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_report_config.js +++ /dev/null @@ -1,82 +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 migrationcenter_v1_generated_MigrationCenter_DeleteReportConfig_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 resource. - */ - // const name = 'abc123' - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - /** - * Optional. If set to `true`, any child `Reports` of this entity will also be - * deleted. If set to `false`, the request only works if the resource has no - * children. - */ - // const force = true - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callDeleteReportConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await migrationcenterClient.deleteReportConfig(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteReportConfig(); - // [END migrationcenter_v1_generated_MigrationCenter_DeleteReportConfig_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-migrationcenter/v1/samples/generated/v1/migration_center.delete_source.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_source.js deleted file mode 100644 index 256f5f9f835..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.delete_source.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(name) { - // [START migrationcenter_v1_generated_MigrationCenter_DeleteSource_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 resource. - */ - // const name = 'abc123' - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callDeleteSource() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await migrationcenterClient.deleteSource(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteSource(); - // [END migrationcenter_v1_generated_MigrationCenter_DeleteSource_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-migrationcenter/v1/samples/generated/v1/migration_center.get_asset.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_asset.js deleted file mode 100644 index 685695d8ba5..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_asset.js +++ /dev/null @@ -1,65 +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 migrationcenter_v1_generated_MigrationCenter_GetAsset_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 resource. - */ - // const name = 'abc123' - /** - * View of the assets. Defaults to BASIC. - */ - // const view = {} - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callGetAsset() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await migrationcenterClient.getAsset(request); - console.log(response); - } - - callGetAsset(); - // [END migrationcenter_v1_generated_MigrationCenter_GetAsset_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-migrationcenter/v1/samples/generated/v1/migration_center.get_error_frame.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_error_frame.js deleted file mode 100644 index 16b728fd650..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_error_frame.js +++ /dev/null @@ -1,68 +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 migrationcenter_v1_generated_MigrationCenter_GetErrorFrame_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the frame to retrieve. - * Format: - * projects/{project}/locations/{location}/sources/{source}/errorFrames/{error_frame} - */ - // const name = 'abc123' - /** - * Optional. An optional view mode to control the level of details for the - * frame. The default is a basic frame view. - */ - // const view = {} - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callGetErrorFrame() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await migrationcenterClient.getErrorFrame(request); - console.log(response); - } - - callGetErrorFrame(); - // [END migrationcenter_v1_generated_MigrationCenter_GetErrorFrame_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-migrationcenter/v1/samples/generated/v1/migration_center.get_group.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_group.js deleted file mode 100644 index dac01d54448..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_group.js +++ /dev/null @@ -1,61 +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 migrationcenter_v1_generated_MigrationCenter_GetGroup_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 resource. - */ - // const name = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callGetGroup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await migrationcenterClient.getGroup(request); - console.log(response); - } - - callGetGroup(); - // [END migrationcenter_v1_generated_MigrationCenter_GetGroup_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-migrationcenter/v1/samples/generated/v1/migration_center.get_import_data_file.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_import_data_file.js deleted file mode 100644 index 376ac86d3b8..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_import_data_file.js +++ /dev/null @@ -1,61 +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 migrationcenter_v1_generated_MigrationCenter_GetImportDataFile_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 ImportDataFile. - */ - // const name = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callGetImportDataFile() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await migrationcenterClient.getImportDataFile(request); - console.log(response); - } - - callGetImportDataFile(); - // [END migrationcenter_v1_generated_MigrationCenter_GetImportDataFile_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-migrationcenter/v1/samples/generated/v1/migration_center.get_import_job.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_import_job.js deleted file mode 100644 index c699e4c26f2..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_import_job.js +++ /dev/null @@ -1,66 +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 migrationcenter_v1_generated_MigrationCenter_GetImportJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the resource. - */ - // const name = 'abc123' - /** - * Optional. The level of details of the import job. - * Default value is FULL. - */ - // const view = {} - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callGetImportJob() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await migrationcenterClient.getImportJob(request); - console.log(response); - } - - callGetImportJob(); - // [END migrationcenter_v1_generated_MigrationCenter_GetImportJob_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-migrationcenter/v1/samples/generated/v1/migration_center.get_preference_set.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_preference_set.js deleted file mode 100644 index 4ef5fe4cdb2..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_preference_set.js +++ /dev/null @@ -1,61 +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 migrationcenter_v1_generated_MigrationCenter_GetPreferenceSet_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 resource. - */ - // const name = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callGetPreferenceSet() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await migrationcenterClient.getPreferenceSet(request); - console.log(response); - } - - callGetPreferenceSet(); - // [END migrationcenter_v1_generated_MigrationCenter_GetPreferenceSet_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-migrationcenter/v1/samples/generated/v1/migration_center.get_report.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_report.js deleted file mode 100644 index b2372181acd..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_report.js +++ /dev/null @@ -1,65 +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 migrationcenter_v1_generated_MigrationCenter_GetReport_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 resource. - */ - // const name = 'abc123' - /** - * Determines what information to retrieve for the Report. - */ - // const view = {} - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callGetReport() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await migrationcenterClient.getReport(request); - console.log(response); - } - - callGetReport(); - // [END migrationcenter_v1_generated_MigrationCenter_GetReport_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-migrationcenter/v1/samples/generated/v1/migration_center.get_report_config.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_report_config.js deleted file mode 100644 index f3fe98ba3b7..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_report_config.js +++ /dev/null @@ -1,61 +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 migrationcenter_v1_generated_MigrationCenter_GetReportConfig_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 resource. - */ - // const name = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callGetReportConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await migrationcenterClient.getReportConfig(request); - console.log(response); - } - - callGetReportConfig(); - // [END migrationcenter_v1_generated_MigrationCenter_GetReportConfig_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-migrationcenter/v1/samples/generated/v1/migration_center.get_settings.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_settings.js deleted file mode 100644 index 03ac7f9df43..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_settings.js +++ /dev/null @@ -1,61 +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 migrationcenter_v1_generated_MigrationCenter_GetSettings_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 resource. - */ - // const name = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callGetSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await migrationcenterClient.getSettings(request); - console.log(response); - } - - callGetSettings(); - // [END migrationcenter_v1_generated_MigrationCenter_GetSettings_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-migrationcenter/v1/samples/generated/v1/migration_center.get_source.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_source.js deleted file mode 100644 index e7a0f0e633b..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.get_source.js +++ /dev/null @@ -1,61 +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 migrationcenter_v1_generated_MigrationCenter_GetSource_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 resource. - */ - // const name = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callGetSource() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await migrationcenterClient.getSource(request); - console.log(response); - } - - callGetSource(); - // [END migrationcenter_v1_generated_MigrationCenter_GetSource_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-migrationcenter/v1/samples/generated/v1/migration_center.list_assets.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_assets.js deleted file mode 100644 index 64d61a8f049..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_assets.js +++ /dev/null @@ -1,84 +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 migrationcenter_v1_generated_MigrationCenter_ListAssets_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. Parent value for `ListAssetsRequest`. - */ - // const parent = 'abc123' - /** - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * A token identifying a page of results the server should return. - */ - // const pageToken = 'abc123' - /** - * Filtering results. - */ - // const filter = 'abc123' - /** - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - */ - // const orderBy = 'abc123' - /** - * View of the assets. Defaults to BASIC. - */ - // const view = {} - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callListAssets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await migrationcenterClient.listAssetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAssets(); - // [END migrationcenter_v1_generated_MigrationCenter_ListAssets_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-migrationcenter/v1/samples/generated/v1/migration_center.list_error_frames.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_error_frames.js deleted file mode 100644 index 98aa716d979..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_error_frames.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(parent) { - // [START migrationcenter_v1_generated_MigrationCenter_ListErrorFrames_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. Parent value (the source) for `ListErrorFramesRequest`. - */ - // const parent = 'abc123' - /** - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * A token identifying a page of results the server should return. - */ - // const pageToken = 'abc123' - /** - * Optional. An optional view mode to control the level of details of each - * error frame. The default is a BASIC frame view. - */ - // const view = {} - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callListErrorFrames() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await migrationcenterClient.listErrorFramesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListErrorFrames(); - // [END migrationcenter_v1_generated_MigrationCenter_ListErrorFrames_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-migrationcenter/v1/samples/generated/v1/migration_center.list_groups.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_groups.js deleted file mode 100644 index 8cc19c32d4b..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_groups.js +++ /dev/null @@ -1,80 +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 migrationcenter_v1_generated_MigrationCenter_ListGroups_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. Parent value for `ListGroupsRequest`. - */ - // const parent = 'abc123' - /** - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * A token identifying a page of results the server should return. - */ - // const pageToken = 'abc123' - /** - * Filtering results. - */ - // const filter = 'abc123' - /** - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - */ - // const orderBy = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callListGroups() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await migrationcenterClient.listGroupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListGroups(); - // [END migrationcenter_v1_generated_MigrationCenter_ListGroups_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-migrationcenter/v1/samples/generated/v1/migration_center.list_import_data_files.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_import_data_files.js deleted file mode 100644 index 7b4f1818fbd..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_import_data_files.js +++ /dev/null @@ -1,85 +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 migrationcenter_v1_generated_MigrationCenter_ListImportDataFiles_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 parent of the `ImportDataFiles` resource. - */ - // const parent = 'abc123' - /** - * The maximum number of data files to return. The service may return - * fewer than this value. If unspecified, at most 500 data files 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 `ListImportDataFiles` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListImportDataFiles` - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Filtering results. - */ - // const filter = 'abc123' - /** - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - */ - // const orderBy = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callListImportDataFiles() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await migrationcenterClient.listImportDataFilesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListImportDataFiles(); - // [END migrationcenter_v1_generated_MigrationCenter_ListImportDataFiles_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-migrationcenter/v1/samples/generated/v1/migration_center.list_import_jobs.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_import_jobs.js deleted file mode 100644 index 4e4759abf66..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_import_jobs.js +++ /dev/null @@ -1,85 +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 migrationcenter_v1_generated_MigrationCenter_ListImportJobs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Parent value for `ListImportJobsRequest`. - */ - // const parent = 'abc123' - /** - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * A token identifying a page of results the server should return. - */ - // const pageToken = 'abc123' - /** - * Filtering results. - */ - // const filter = 'abc123' - /** - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - */ - // const orderBy = 'abc123' - /** - * Optional. The level of details of each import job. - * Default value is BASIC. - */ - // const view = {} - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callListImportJobs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await migrationcenterClient.listImportJobsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListImportJobs(); - // [END migrationcenter_v1_generated_MigrationCenter_ListImportJobs_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-migrationcenter/v1/samples/generated/v1/migration_center.list_preference_sets.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_preference_sets.js deleted file mode 100644 index 76101cc5817..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_preference_sets.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(parent) { - // [START migrationcenter_v1_generated_MigrationCenter_ListPreferenceSets_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. Parent value for `ListPreferenceSetsRequest`. - */ - // const parent = 'abc123' - /** - * Requested page size. Server may return fewer items than requested. - * If unspecified, at most 500 preference sets will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * A token identifying a page of results the server should return. - */ - // const pageToken = 'abc123' - /** - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - */ - // const orderBy = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callListPreferenceSets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await migrationcenterClient.listPreferenceSetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListPreferenceSets(); - // [END migrationcenter_v1_generated_MigrationCenter_ListPreferenceSets_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-migrationcenter/v1/samples/generated/v1/migration_center.list_report_configs.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_report_configs.js deleted file mode 100644 index dbe28a0bd57..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_report_configs.js +++ /dev/null @@ -1,80 +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 migrationcenter_v1_generated_MigrationCenter_ListReportConfigs_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. Parent value for `ListReportConfigsRequest`. - */ - // const parent = 'abc123' - /** - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * A token identifying a page of results the server should return. - */ - // const pageToken = 'abc123' - /** - * Filtering results. - */ - // const filter = 'abc123' - /** - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - */ - // const orderBy = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callListReportConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await migrationcenterClient.listReportConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListReportConfigs(); - // [END migrationcenter_v1_generated_MigrationCenter_ListReportConfigs_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-migrationcenter/v1/samples/generated/v1/migration_center.list_reports.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_reports.js deleted file mode 100644 index 8b28e027bb5..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_reports.js +++ /dev/null @@ -1,84 +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 migrationcenter_v1_generated_MigrationCenter_ListReports_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. Parent value for `ListReportsRequest`. - */ - // const parent = 'abc123' - /** - * Requested page size. The server may return fewer items than requested. - * If unspecified, the server will pick an appropriate default value. - */ - // const pageSize = 1234 - /** - * A token identifying a page of results that the server should return. - */ - // const pageToken = 'abc123' - /** - * Filtering results. - */ - // const filter = 'abc123' - /** - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - */ - // const orderBy = 'abc123' - /** - * Determines what information to retrieve for each Report. - */ - // const view = {} - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callListReports() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await migrationcenterClient.listReportsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListReports(); - // [END migrationcenter_v1_generated_MigrationCenter_ListReports_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-migrationcenter/v1/samples/generated/v1/migration_center.list_sources.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_sources.js deleted file mode 100644 index 3267e4da451..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.list_sources.js +++ /dev/null @@ -1,80 +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 migrationcenter_v1_generated_MigrationCenter_ListSources_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. Parent value for `ListSourcesRequest`. - */ - // const parent = 'abc123' - /** - * Requested page size. The server may return fewer items than requested. - * If unspecified, the server will pick an appropriate default value. - */ - // const pageSize = 1234 - /** - * A token identifying a page of results that the server should return. - */ - // const pageToken = 'abc123' - /** - * Filtering results. - */ - // const filter = 'abc123' - /** - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - */ - // const orderBy = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callListSources() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await migrationcenterClient.listSourcesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSources(); - // [END migrationcenter_v1_generated_MigrationCenter_ListSources_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-migrationcenter/v1/samples/generated/v1/migration_center.remove_assets_from_group.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.remove_assets_from_group.js deleted file mode 100644 index 50188b16260..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.remove_assets_from_group.js +++ /dev/null @@ -1,90 +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(group, assets) { - // [START migrationcenter_v1_generated_MigrationCenter_RemoveAssetsFromGroup_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. Group reference. - */ - // const group = 'abc123' - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - /** - * Required. List of assets to be removed. - * The maximum number of assets that can be removed in a single request is - * 1000. - */ - // const assets = {} - /** - * Optional. When this value is set to `false` and one of the given assets is - * not an existing member of the group, the operation fails with a `Not Found` - * error. When set to `true` this situation is silently ignored by the server. - * Default value is `false`. - */ - // const allowMissing = true - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callRemoveAssetsFromGroup() { - // Construct request - const request = { - group, - assets, - }; - - // Run request - const [operation] = await migrationcenterClient.removeAssetsFromGroup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRemoveAssetsFromGroup(); - // [END migrationcenter_v1_generated_MigrationCenter_RemoveAssetsFromGroup_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-migrationcenter/v1/samples/generated/v1/migration_center.report_asset_frames.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.report_asset_frames.js deleted file mode 100644 index 1a23e61d7e1..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.report_asset_frames.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(parent, source) { - // [START migrationcenter_v1_generated_MigrationCenter_ReportAssetFrames_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. Parent of the resource. - */ - // const parent = 'abc123' - /** - * Collection of frames data. - */ - // const frames = {} - /** - * Required. Reference to a source. - */ - // const source = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callReportAssetFrames() { - // Construct request - const request = { - parent, - source, - }; - - // Run request - const response = await migrationcenterClient.reportAssetFrames(request); - console.log(response); - } - - callReportAssetFrames(); - // [END migrationcenter_v1_generated_MigrationCenter_ReportAssetFrames_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-migrationcenter/v1/samples/generated/v1/migration_center.run_import_job.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.run_import_job.js deleted file mode 100644 index d83b215ec73..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.run_import_job.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(name) { - // [START migrationcenter_v1_generated_MigrationCenter_RunImportJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the import job to run. - */ - // const name = 'abc123' - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callRunImportJob() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await migrationcenterClient.runImportJob(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRunImportJob(); - // [END migrationcenter_v1_generated_MigrationCenter_RunImportJob_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-migrationcenter/v1/samples/generated/v1/migration_center.update_asset.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_asset.js deleted file mode 100644 index 9c440d5b5d3..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_asset.js +++ /dev/null @@ -1,85 +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(updateMask, asset) { - // [START migrationcenter_v1_generated_MigrationCenter_UpdateAsset_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. Field mask is used to specify the fields to be overwritten in the - * `Asset` resource by the update. - * The values specified in the `update_mask` field are relative to the - * resource, not the full request. - * A field will be overwritten if it is in the mask. - * A single * value in the mask lets you to overwrite all fields. - */ - // const updateMask = {} - /** - * Required. The resource being updated. - */ - // const asset = {} - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callUpdateAsset() { - // Construct request - const request = { - updateMask, - asset, - }; - - // Run request - const response = await migrationcenterClient.updateAsset(request); - console.log(response); - } - - callUpdateAsset(); - // [END migrationcenter_v1_generated_MigrationCenter_UpdateAsset_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-migrationcenter/v1/samples/generated/v1/migration_center.update_group.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_group.js deleted file mode 100644 index 47977d57c2c..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_group.js +++ /dev/null @@ -1,85 +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(updateMask, group) { - // [START migrationcenter_v1_generated_MigrationCenter_UpdateGroup_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. Field mask is used to specify the fields to be overwritten in the - * `Group` resource by the update. - * The values specified in the `update_mask` are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. - * A single * value in the mask lets you to overwrite all fields. - */ - // const updateMask = {} - /** - * Required. The group resource being updated. - */ - // const group = {} - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callUpdateGroup() { - // Construct request - const request = { - updateMask, - group, - }; - - // Run request - const [operation] = await migrationcenterClient.updateGroup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateGroup(); - // [END migrationcenter_v1_generated_MigrationCenter_UpdateGroup_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-migrationcenter/v1/samples/generated/v1/migration_center.update_import_job.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_import_job.js deleted file mode 100644 index 2557f14131c..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_import_job.js +++ /dev/null @@ -1,86 +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(updateMask, importJob) { - // [START migrationcenter_v1_generated_MigrationCenter_UpdateImportJob_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. Field mask is used to specify the fields to be overwritten in the - * `Asset` resource by the update. - * The values specified in the `update_mask` field are relative to the - * resource, not the full request. - * A field will be overwritten if it is in the mask. - * A single * value in the mask lets you to overwrite all fields. - */ - // const updateMask = {} - /** - * Required. The resource being updated - */ - // const importJob = {} - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callUpdateImportJob() { - // Construct request - const request = { - updateMask, - importJob, - }; - - // Run request - const [operation] = await migrationcenterClient.updateImportJob(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateImportJob(); - // [END migrationcenter_v1_generated_MigrationCenter_UpdateImportJob_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-migrationcenter/v1/samples/generated/v1/migration_center.update_preference_set.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_preference_set.js deleted file mode 100644 index c86caa43c1b..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_preference_set.js +++ /dev/null @@ -1,86 +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(updateMask, preferenceSet) { - // [START migrationcenter_v1_generated_MigrationCenter_UpdatePreferenceSet_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. Field mask is used to specify the fields to be overwritten in the - * `PreferenceSet` resource by the update. - * The values specified in the `update_mask` field are relative to the - * resource, not the full request. - * A field will be overwritten if it is in the mask. - * A single * value in the mask lets you to overwrite all fields. - */ - // const updateMask = {} - /** - * Required. The preference set resource being updated. - */ - // const preferenceSet = {} - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callUpdatePreferenceSet() { - // Construct request - const request = { - updateMask, - preferenceSet, - }; - - // Run request - const [operation] = await migrationcenterClient.updatePreferenceSet(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdatePreferenceSet(); - // [END migrationcenter_v1_generated_MigrationCenter_UpdatePreferenceSet_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-migrationcenter/v1/samples/generated/v1/migration_center.update_settings.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_settings.js deleted file mode 100644 index 695a6e09fd9..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_settings.js +++ /dev/null @@ -1,86 +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(updateMask, settings) { - // [START migrationcenter_v1_generated_MigrationCenter_UpdateSettings_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. Field mask is used to specify the fields to be overwritten in the - * `Settings` resource by the update. - * The values specified in the `update_mask` field are relative to the - * resource, not the full request. - * A field will be overwritten if it is in the mask. - * A single * value in the mask lets you to overwrite all fields. - */ - // const updateMask = {} - /** - * Required. The project settings resource being updated. - */ - // const settings = {} - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callUpdateSettings() { - // Construct request - const request = { - updateMask, - settings, - }; - - // Run request - const [operation] = await migrationcenterClient.updateSettings(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateSettings(); - // [END migrationcenter_v1_generated_MigrationCenter_UpdateSettings_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-migrationcenter/v1/samples/generated/v1/migration_center.update_source.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_source.js deleted file mode 100644 index 18705108a5d..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.update_source.js +++ /dev/null @@ -1,86 +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(updateMask, source) { - // [START migrationcenter_v1_generated_MigrationCenter_UpdateSource_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. Field mask is used to specify the fields to be overwritten in the - * `Source` resource by the update. - * The values specified in the `update_mask` field are relative to the - * resource, not the full request. - * A field will be overwritten if it is in the mask. - * A single * value in the mask lets you to overwrite all fields. - */ - // const updateMask = {} - /** - * Required. The resource being updated - */ - // const source = {} - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callUpdateSource() { - // Construct request - const request = { - updateMask, - source, - }; - - // Run request - const [operation] = await migrationcenterClient.updateSource(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateSource(); - // [END migrationcenter_v1_generated_MigrationCenter_UpdateSource_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-migrationcenter/v1/samples/generated/v1/migration_center.validate_import_job.js b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.validate_import_job.js deleted file mode 100644 index 2b8f730b5e6..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/migration_center.validate_import_job.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(name) { - // [START migrationcenter_v1_generated_MigrationCenter_ValidateImportJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the import job to validate. - */ - // const name = 'abc123' - /** - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Migrationcenter library - const {MigrationCenterClient} = require('@google-cloud/migrationcenter').v1; - - // Instantiates a client - const migrationcenterClient = new MigrationCenterClient(); - - async function callValidateImportJob() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await migrationcenterClient.validateImportJob(request); - const [response] = await operation.promise(); - console.log(response); - } - - callValidateImportJob(); - // [END migrationcenter_v1_generated_MigrationCenter_ValidateImportJob_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-migrationcenter/v1/samples/generated/v1/snippet_metadata_google.cloud.migrationcenter.v1.json b/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/snippet_metadata_google.cloud.migrationcenter.v1.json deleted file mode 100644 index 75fc84ee26d..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/samples/generated/v1/snippet_metadata_google.cloud.migrationcenter.v1.json +++ /dev/null @@ -1,2331 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-migrationcenter", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.migrationcenter.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListAssets_async", - "title": "MigrationCenter listAssets Sample", - "origin": "API_DEFINITION", - "description": " Lists all the assets in a given project and location.", - "canonical": true, - "file": "migration_center.list_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAssets", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.migrationcenter.v1.AssetView" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.ListAssetsResponse", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "ListAssets", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListAssets", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetAsset_async", - "title": "MigrationCenter getAsset Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of an asset.", - "canonical": true, - "file": "migration_center.get_asset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAsset", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetAsset", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.migrationcenter.v1.AssetView" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.Asset", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "GetAsset", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetAsset", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_UpdateAsset_async", - "title": "MigrationCenter updateAsset Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of an asset.", - "canonical": true, - "file": "migration_center.update_asset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAsset", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateAsset", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "asset", - "type": ".google.cloud.migrationcenter.v1.Asset" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.Asset", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "UpdateAsset", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateAsset", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_BatchUpdateAssets_async", - "title": "MigrationCenter batchUpdateAssets Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of a list of assets.", - "canonical": true, - "file": "migration_center.batch_update_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchUpdateAssets", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.BatchUpdateAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.BatchUpdateAssetsResponse", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "BatchUpdateAssets", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.BatchUpdateAssets", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_DeleteAsset_async", - "title": "MigrationCenter deleteAsset Sample", - "origin": "API_DEFINITION", - "description": " Deletes an asset.", - "canonical": true, - "file": "migration_center.delete_asset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAsset", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteAsset", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "DeleteAsset", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteAsset", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_BatchDeleteAssets_async", - "title": "MigrationCenter batchDeleteAssets Sample", - "origin": "API_DEFINITION", - "description": " Deletes list of Assets.", - "canonical": true, - "file": "migration_center.batch_delete_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchDeleteAssets", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.BatchDeleteAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "names", - "type": "TYPE_STRING[]" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "BatchDeleteAssets", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.BatchDeleteAssets", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_ReportAssetFrames_async", - "title": "MigrationCenter reportAssetFrames Sample", - "origin": "API_DEFINITION", - "description": " Reports a set of frames.", - "canonical": true, - "file": "migration_center.report_asset_frames.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReportAssetFrames", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ReportAssetFrames", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "frames", - "type": ".google.cloud.migrationcenter.v1.Frames" - }, - { - "name": "source", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.ReportAssetFramesResponse", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "ReportAssetFrames", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ReportAssetFrames", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_AggregateAssetsValues_async", - "title": "MigrationCenter aggregateAssetsValues Sample", - "origin": "API_DEFINITION", - "description": " Aggregates the requested fields based on provided function.", - "canonical": true, - "file": "migration_center.aggregate_assets_values.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AggregateAssetsValues", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.AggregateAssetsValues", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "aggregations", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.AggregateAssetsValuesResponse", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "AggregateAssetsValues", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.AggregateAssetsValues", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_CreateImportJob_async", - "title": "MigrationCenter createImportJob Sample", - "origin": "API_DEFINITION", - "description": " Creates an import job.", - "canonical": true, - "file": "migration_center.create_import_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateImportJob", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateImportJob", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "import_job_id", - "type": "TYPE_STRING" - }, - { - "name": "import_job", - "type": ".google.cloud.migrationcenter.v1.ImportJob" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "CreateImportJob", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateImportJob", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListImportJobs_async", - "title": "MigrationCenter listImportJobs Sample", - "origin": "API_DEFINITION", - "description": " Lists all import jobs.", - "canonical": true, - "file": "migration_center.list_import_jobs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListImportJobs", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListImportJobs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.migrationcenter.v1.ImportJobView" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.ListImportJobsResponse", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "ListImportJobs", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListImportJobs", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetImportJob_async", - "title": "MigrationCenter getImportJob Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of an import job.", - "canonical": true, - "file": "migration_center.get_import_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetImportJob", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetImportJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.migrationcenter.v1.ImportJobView" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.ImportJob", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "GetImportJob", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetImportJob", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_DeleteImportJob_async", - "title": "MigrationCenter deleteImportJob Sample", - "origin": "API_DEFINITION", - "description": " Deletes an import job.", - "canonical": true, - "file": "migration_center.delete_import_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteImportJob", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteImportJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "DeleteImportJob", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteImportJob", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_UpdateImportJob_async", - "title": "MigrationCenter updateImportJob Sample", - "origin": "API_DEFINITION", - "description": " Updates an import job.", - "canonical": true, - "file": "migration_center.update_import_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateImportJob", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateImportJob", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "import_job", - "type": ".google.cloud.migrationcenter.v1.ImportJob" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "UpdateImportJob", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateImportJob", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_ValidateImportJob_async", - "title": "MigrationCenter validateImportJob Sample", - "origin": "API_DEFINITION", - "description": " Validates an import job.", - "canonical": true, - "file": "migration_center.validate_import_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ValidateImportJob", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ValidateImportJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "ValidateImportJob", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ValidateImportJob", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_RunImportJob_async", - "title": "MigrationCenter runImportJob Sample", - "origin": "API_DEFINITION", - "description": " Runs an import job.", - "canonical": true, - "file": "migration_center.run_import_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RunImportJob", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.RunImportJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "RunImportJob", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.RunImportJob", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetImportDataFile_async", - "title": "MigrationCenter getImportDataFile Sample", - "origin": "API_DEFINITION", - "description": " Gets an import data file.", - "canonical": true, - "file": "migration_center.get_import_data_file.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetImportDataFile", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetImportDataFile", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.ImportDataFile", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "GetImportDataFile", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetImportDataFile", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListImportDataFiles_async", - "title": "MigrationCenter listImportDataFiles Sample", - "origin": "API_DEFINITION", - "description": " List import data files.", - "canonical": true, - "file": "migration_center.list_import_data_files.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListImportDataFiles", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListImportDataFiles", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.ListImportDataFilesResponse", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "ListImportDataFiles", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListImportDataFiles", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_CreateImportDataFile_async", - "title": "MigrationCenter createImportDataFile Sample", - "origin": "API_DEFINITION", - "description": " Creates an import data file.", - "canonical": true, - "file": "migration_center.create_import_data_file.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateImportDataFile", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateImportDataFile", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "import_data_file_id", - "type": "TYPE_STRING" - }, - { - "name": "import_data_file", - "type": ".google.cloud.migrationcenter.v1.ImportDataFile" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "CreateImportDataFile", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateImportDataFile", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_DeleteImportDataFile_async", - "title": "MigrationCenter deleteImportDataFile Sample", - "origin": "API_DEFINITION", - "description": " Delete an import data file.", - "canonical": true, - "file": "migration_center.delete_import_data_file.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteImportDataFile", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteImportDataFile", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "DeleteImportDataFile", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteImportDataFile", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListGroups_async", - "title": "MigrationCenter listGroups Sample", - "origin": "API_DEFINITION", - "description": " Lists all groups in a given project and location.", - "canonical": true, - "file": "migration_center.list_groups.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListGroups", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListGroups", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.ListGroupsResponse", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "ListGroups", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListGroups", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetGroup_async", - "title": "MigrationCenter getGroup Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a group.", - "canonical": true, - "file": "migration_center.get_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetGroup", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetGroup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.Group", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "GetGroup", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetGroup", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_CreateGroup_async", - "title": "MigrationCenter createGroup Sample", - "origin": "API_DEFINITION", - "description": " Creates a new group in a given project and location.", - "canonical": true, - "file": "migration_center.create_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateGroup", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateGroup", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "group_id", - "type": "TYPE_STRING" - }, - { - "name": "group", - "type": ".google.cloud.migrationcenter.v1.Group" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "CreateGroup", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateGroup", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_UpdateGroup_async", - "title": "MigrationCenter updateGroup Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of a group.", - "canonical": true, - "file": "migration_center.update_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateGroup", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateGroup", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "group", - "type": ".google.cloud.migrationcenter.v1.Group" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "UpdateGroup", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateGroup", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_DeleteGroup_async", - "title": "MigrationCenter deleteGroup Sample", - "origin": "API_DEFINITION", - "description": " Deletes a group.", - "canonical": true, - "file": "migration_center.delete_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteGroup", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteGroup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "DeleteGroup", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteGroup", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_AddAssetsToGroup_async", - "title": "MigrationCenter addAssetsToGroup Sample", - "origin": "API_DEFINITION", - "description": " Adds assets to a group.", - "canonical": true, - "file": "migration_center.add_assets_to_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddAssetsToGroup", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.AddAssetsToGroup", - "async": true, - "parameters": [ - { - "name": "group", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "assets", - "type": ".google.cloud.migrationcenter.v1.AssetList" - }, - { - "name": "allow_existing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "AddAssetsToGroup", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.AddAssetsToGroup", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_RemoveAssetsFromGroup_async", - "title": "MigrationCenter removeAssetsFromGroup Sample", - "origin": "API_DEFINITION", - "description": " Removes assets from a group.", - "canonical": true, - "file": "migration_center.remove_assets_from_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveAssetsFromGroup", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.RemoveAssetsFromGroup", - "async": true, - "parameters": [ - { - "name": "group", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "assets", - "type": ".google.cloud.migrationcenter.v1.AssetList" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "RemoveAssetsFromGroup", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.RemoveAssetsFromGroup", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListErrorFrames_async", - "title": "MigrationCenter listErrorFrames Sample", - "origin": "API_DEFINITION", - "description": " Lists all error frames in a given source and location.", - "canonical": true, - "file": "migration_center.list_error_frames.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListErrorFrames", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListErrorFrames", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.migrationcenter.v1.ErrorFrameView" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.ListErrorFramesResponse", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "ListErrorFrames", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListErrorFrames", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetErrorFrame_async", - "title": "MigrationCenter getErrorFrame Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of an error frame.", - "canonical": true, - "file": "migration_center.get_error_frame.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetErrorFrame", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetErrorFrame", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.migrationcenter.v1.ErrorFrameView" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.ErrorFrame", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "GetErrorFrame", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetErrorFrame", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListSources_async", - "title": "MigrationCenter listSources Sample", - "origin": "API_DEFINITION", - "description": " Lists all the sources in a given project and location.", - "canonical": true, - "file": "migration_center.list_sources.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSources", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListSources", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.ListSourcesResponse", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "ListSources", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListSources", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetSource_async", - "title": "MigrationCenter getSource Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a source.", - "canonical": true, - "file": "migration_center.get_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSource", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetSource", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.Source", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "GetSource", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetSource", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_CreateSource_async", - "title": "MigrationCenter createSource Sample", - "origin": "API_DEFINITION", - "description": " Creates a new source in a given project and location.", - "canonical": true, - "file": "migration_center.create_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSource", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateSource", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "source_id", - "type": "TYPE_STRING" - }, - { - "name": "source", - "type": ".google.cloud.migrationcenter.v1.Source" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "CreateSource", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateSource", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_UpdateSource_async", - "title": "MigrationCenter updateSource Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of a source.", - "canonical": true, - "file": "migration_center.update_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSource", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateSource", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "source", - "type": ".google.cloud.migrationcenter.v1.Source" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "UpdateSource", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateSource", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_DeleteSource_async", - "title": "MigrationCenter deleteSource Sample", - "origin": "API_DEFINITION", - "description": " Deletes a source.", - "canonical": true, - "file": "migration_center.delete_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteSource", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteSource", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "DeleteSource", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteSource", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListPreferenceSets_async", - "title": "MigrationCenter listPreferenceSets Sample", - "origin": "API_DEFINITION", - "description": " Lists all the preference sets in a given project and location.", - "canonical": true, - "file": "migration_center.list_preference_sets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListPreferenceSets", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListPreferenceSets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.ListPreferenceSetsResponse", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "ListPreferenceSets", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListPreferenceSets", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetPreferenceSet_async", - "title": "MigrationCenter getPreferenceSet Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a preference set.", - "canonical": true, - "file": "migration_center.get_preference_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetPreferenceSet", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetPreferenceSet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.PreferenceSet", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "GetPreferenceSet", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetPreferenceSet", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_CreatePreferenceSet_async", - "title": "MigrationCenter createPreferenceSet Sample", - "origin": "API_DEFINITION", - "description": " Creates a new preference set in a given project and location.", - "canonical": true, - "file": "migration_center.create_preference_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreatePreferenceSet", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreatePreferenceSet", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "preference_set_id", - "type": "TYPE_STRING" - }, - { - "name": "preference_set", - "type": ".google.cloud.migrationcenter.v1.PreferenceSet" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "CreatePreferenceSet", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreatePreferenceSet", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_UpdatePreferenceSet_async", - "title": "MigrationCenter updatePreferenceSet Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of a preference set.", - "canonical": true, - "file": "migration_center.update_preference_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdatePreferenceSet", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdatePreferenceSet", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "preference_set", - "type": ".google.cloud.migrationcenter.v1.PreferenceSet" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "UpdatePreferenceSet", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdatePreferenceSet", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_DeletePreferenceSet_async", - "title": "MigrationCenter deletePreferenceSet Sample", - "origin": "API_DEFINITION", - "description": " Deletes a preference set.", - "canonical": true, - "file": "migration_center.delete_preference_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeletePreferenceSet", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeletePreferenceSet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "DeletePreferenceSet", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeletePreferenceSet", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetSettings_async", - "title": "MigrationCenter getSettings Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of regional settings.", - "canonical": true, - "file": "migration_center.get_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSettings", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.Settings", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "GetSettings", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetSettings", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_UpdateSettings_async", - "title": "MigrationCenter updateSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates the regional-level project settings.", - "canonical": true, - "file": "migration_center.update_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSettings", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateSettings", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "settings", - "type": ".google.cloud.migrationcenter.v1.Settings" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "UpdateSettings", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.UpdateSettings", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_CreateReportConfig_async", - "title": "MigrationCenter createReportConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a report configuration.", - "canonical": true, - "file": "migration_center.create_report_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateReportConfig", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateReportConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "report_config_id", - "type": "TYPE_STRING" - }, - { - "name": "report_config", - "type": ".google.cloud.migrationcenter.v1.ReportConfig" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "CreateReportConfig", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateReportConfig", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetReportConfig_async", - "title": "MigrationCenter getReportConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single ReportConfig.", - "canonical": true, - "file": "migration_center.get_report_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetReportConfig", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetReportConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.ReportConfig", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "GetReportConfig", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetReportConfig", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListReportConfigs_async", - "title": "MigrationCenter listReportConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists ReportConfigs in a given project and location.", - "canonical": true, - "file": "migration_center.list_report_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListReportConfigs", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListReportConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.ListReportConfigsResponse", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "ListReportConfigs", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListReportConfigs", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_DeleteReportConfig_async", - "title": "MigrationCenter deleteReportConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes a ReportConfig.", - "canonical": true, - "file": "migration_center.delete_report_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteReportConfig", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteReportConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "DeleteReportConfig", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteReportConfig", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_CreateReport_async", - "title": "MigrationCenter createReport Sample", - "origin": "API_DEFINITION", - "description": " Creates a report.", - "canonical": true, - "file": "migration_center.create_report.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateReport", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateReport", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "report_id", - "type": "TYPE_STRING" - }, - { - "name": "report", - "type": ".google.cloud.migrationcenter.v1.Report" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "CreateReport", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.CreateReport", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_GetReport_async", - "title": "MigrationCenter getReport Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single Report.", - "canonical": true, - "file": "migration_center.get_report.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetReport", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetReport", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.migrationcenter.v1.ReportView" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.Report", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "GetReport", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.GetReport", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_ListReports_async", - "title": "MigrationCenter listReports Sample", - "origin": "API_DEFINITION", - "description": " Lists Reports in a given ReportConfig.", - "canonical": true, - "file": "migration_center.list_reports.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListReports", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListReports", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.migrationcenter.v1.ReportView" - } - ], - "resultType": ".google.cloud.migrationcenter.v1.ListReportsResponse", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "ListReports", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.ListReports", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - }, - { - "regionTag": "migrationcenter_v1_generated_MigrationCenter_DeleteReport_async", - "title": "MigrationCenter deleteReport Sample", - "origin": "API_DEFINITION", - "description": " Deletes a Report.", - "canonical": true, - "file": "migration_center.delete_report.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteReport", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteReport", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MigrationCenterClient", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenterClient" - }, - "method": { - "shortName": "DeleteReport", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter.DeleteReport", - "service": { - "shortName": "MigrationCenter", - "fullName": "google.cloud.migrationcenter.v1.MigrationCenter" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/src/index.ts b/owl-bot-staging/google-cloud-migrationcenter/v1/src/index.ts deleted file mode 100644 index a300b552d6d..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/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 v1 from './v1'; -const MigrationCenterClient = v1.MigrationCenterClient; -type MigrationCenterClient = v1.MigrationCenterClient; -export {v1, MigrationCenterClient}; -export default {v1, MigrationCenterClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 495ff3d70b9..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,539 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.migrationcenter.v1", - "libraryPackage": "@google-cloud/migrationcenter", - "services": { - "MigrationCenter": { - "clients": { - "grpc": { - "libraryClient": "MigrationCenterClient", - "rpcs": { - "GetAsset": { - "methods": [ - "getAsset" - ] - }, - "UpdateAsset": { - "methods": [ - "updateAsset" - ] - }, - "BatchUpdateAssets": { - "methods": [ - "batchUpdateAssets" - ] - }, - "DeleteAsset": { - "methods": [ - "deleteAsset" - ] - }, - "BatchDeleteAssets": { - "methods": [ - "batchDeleteAssets" - ] - }, - "ReportAssetFrames": { - "methods": [ - "reportAssetFrames" - ] - }, - "AggregateAssetsValues": { - "methods": [ - "aggregateAssetsValues" - ] - }, - "GetImportJob": { - "methods": [ - "getImportJob" - ] - }, - "GetImportDataFile": { - "methods": [ - "getImportDataFile" - ] - }, - "GetGroup": { - "methods": [ - "getGroup" - ] - }, - "GetErrorFrame": { - "methods": [ - "getErrorFrame" - ] - }, - "GetSource": { - "methods": [ - "getSource" - ] - }, - "GetPreferenceSet": { - "methods": [ - "getPreferenceSet" - ] - }, - "GetSettings": { - "methods": [ - "getSettings" - ] - }, - "GetReportConfig": { - "methods": [ - "getReportConfig" - ] - }, - "GetReport": { - "methods": [ - "getReport" - ] - }, - "CreateImportJob": { - "methods": [ - "createImportJob" - ] - }, - "DeleteImportJob": { - "methods": [ - "deleteImportJob" - ] - }, - "UpdateImportJob": { - "methods": [ - "updateImportJob" - ] - }, - "ValidateImportJob": { - "methods": [ - "validateImportJob" - ] - }, - "RunImportJob": { - "methods": [ - "runImportJob" - ] - }, - "CreateImportDataFile": { - "methods": [ - "createImportDataFile" - ] - }, - "DeleteImportDataFile": { - "methods": [ - "deleteImportDataFile" - ] - }, - "CreateGroup": { - "methods": [ - "createGroup" - ] - }, - "UpdateGroup": { - "methods": [ - "updateGroup" - ] - }, - "DeleteGroup": { - "methods": [ - "deleteGroup" - ] - }, - "AddAssetsToGroup": { - "methods": [ - "addAssetsToGroup" - ] - }, - "RemoveAssetsFromGroup": { - "methods": [ - "removeAssetsFromGroup" - ] - }, - "CreateSource": { - "methods": [ - "createSource" - ] - }, - "UpdateSource": { - "methods": [ - "updateSource" - ] - }, - "DeleteSource": { - "methods": [ - "deleteSource" - ] - }, - "CreatePreferenceSet": { - "methods": [ - "createPreferenceSet" - ] - }, - "UpdatePreferenceSet": { - "methods": [ - "updatePreferenceSet" - ] - }, - "DeletePreferenceSet": { - "methods": [ - "deletePreferenceSet" - ] - }, - "UpdateSettings": { - "methods": [ - "updateSettings" - ] - }, - "CreateReportConfig": { - "methods": [ - "createReportConfig" - ] - }, - "DeleteReportConfig": { - "methods": [ - "deleteReportConfig" - ] - }, - "CreateReport": { - "methods": [ - "createReport" - ] - }, - "DeleteReport": { - "methods": [ - "deleteReport" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "ListImportJobs": { - "methods": [ - "listImportJobs", - "listImportJobsStream", - "listImportJobsAsync" - ] - }, - "ListImportDataFiles": { - "methods": [ - "listImportDataFiles", - "listImportDataFilesStream", - "listImportDataFilesAsync" - ] - }, - "ListGroups": { - "methods": [ - "listGroups", - "listGroupsStream", - "listGroupsAsync" - ] - }, - "ListErrorFrames": { - "methods": [ - "listErrorFrames", - "listErrorFramesStream", - "listErrorFramesAsync" - ] - }, - "ListSources": { - "methods": [ - "listSources", - "listSourcesStream", - "listSourcesAsync" - ] - }, - "ListPreferenceSets": { - "methods": [ - "listPreferenceSets", - "listPreferenceSetsStream", - "listPreferenceSetsAsync" - ] - }, - "ListReportConfigs": { - "methods": [ - "listReportConfigs", - "listReportConfigsStream", - "listReportConfigsAsync" - ] - }, - "ListReports": { - "methods": [ - "listReports", - "listReportsStream", - "listReportsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "MigrationCenterClient", - "rpcs": { - "GetAsset": { - "methods": [ - "getAsset" - ] - }, - "UpdateAsset": { - "methods": [ - "updateAsset" - ] - }, - "BatchUpdateAssets": { - "methods": [ - "batchUpdateAssets" - ] - }, - "DeleteAsset": { - "methods": [ - "deleteAsset" - ] - }, - "BatchDeleteAssets": { - "methods": [ - "batchDeleteAssets" - ] - }, - "ReportAssetFrames": { - "methods": [ - "reportAssetFrames" - ] - }, - "AggregateAssetsValues": { - "methods": [ - "aggregateAssetsValues" - ] - }, - "GetImportJob": { - "methods": [ - "getImportJob" - ] - }, - "GetImportDataFile": { - "methods": [ - "getImportDataFile" - ] - }, - "GetGroup": { - "methods": [ - "getGroup" - ] - }, - "GetErrorFrame": { - "methods": [ - "getErrorFrame" - ] - }, - "GetSource": { - "methods": [ - "getSource" - ] - }, - "GetPreferenceSet": { - "methods": [ - "getPreferenceSet" - ] - }, - "GetSettings": { - "methods": [ - "getSettings" - ] - }, - "GetReportConfig": { - "methods": [ - "getReportConfig" - ] - }, - "GetReport": { - "methods": [ - "getReport" - ] - }, - "CreateImportJob": { - "methods": [ - "createImportJob" - ] - }, - "DeleteImportJob": { - "methods": [ - "deleteImportJob" - ] - }, - "UpdateImportJob": { - "methods": [ - "updateImportJob" - ] - }, - "ValidateImportJob": { - "methods": [ - "validateImportJob" - ] - }, - "RunImportJob": { - "methods": [ - "runImportJob" - ] - }, - "CreateImportDataFile": { - "methods": [ - "createImportDataFile" - ] - }, - "DeleteImportDataFile": { - "methods": [ - "deleteImportDataFile" - ] - }, - "CreateGroup": { - "methods": [ - "createGroup" - ] - }, - "UpdateGroup": { - "methods": [ - "updateGroup" - ] - }, - "DeleteGroup": { - "methods": [ - "deleteGroup" - ] - }, - "AddAssetsToGroup": { - "methods": [ - "addAssetsToGroup" - ] - }, - "RemoveAssetsFromGroup": { - "methods": [ - "removeAssetsFromGroup" - ] - }, - "CreateSource": { - "methods": [ - "createSource" - ] - }, - "UpdateSource": { - "methods": [ - "updateSource" - ] - }, - "DeleteSource": { - "methods": [ - "deleteSource" - ] - }, - "CreatePreferenceSet": { - "methods": [ - "createPreferenceSet" - ] - }, - "UpdatePreferenceSet": { - "methods": [ - "updatePreferenceSet" - ] - }, - "DeletePreferenceSet": { - "methods": [ - "deletePreferenceSet" - ] - }, - "UpdateSettings": { - "methods": [ - "updateSettings" - ] - }, - "CreateReportConfig": { - "methods": [ - "createReportConfig" - ] - }, - "DeleteReportConfig": { - "methods": [ - "deleteReportConfig" - ] - }, - "CreateReport": { - "methods": [ - "createReport" - ] - }, - "DeleteReport": { - "methods": [ - "deleteReport" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "ListImportJobs": { - "methods": [ - "listImportJobs", - "listImportJobsStream", - "listImportJobsAsync" - ] - }, - "ListImportDataFiles": { - "methods": [ - "listImportDataFiles", - "listImportDataFilesStream", - "listImportDataFilesAsync" - ] - }, - "ListGroups": { - "methods": [ - "listGroups", - "listGroupsStream", - "listGroupsAsync" - ] - }, - "ListErrorFrames": { - "methods": [ - "listErrorFrames", - "listErrorFramesStream", - "listErrorFramesAsync" - ] - }, - "ListSources": { - "methods": [ - "listSources", - "listSourcesStream", - "listSourcesAsync" - ] - }, - "ListPreferenceSets": { - "methods": [ - "listPreferenceSets", - "listPreferenceSetsStream", - "listPreferenceSetsAsync" - ] - }, - "ListReportConfigs": { - "methods": [ - "listReportConfigs", - "listReportConfigsStream", - "listReportConfigsAsync" - ] - }, - "ListReports": { - "methods": [ - "listReports", - "listReportsStream", - "listReportsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/index.ts deleted file mode 100644 index 5d0aac892c2..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/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 {MigrationCenterClient} from './migration_center_client'; diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_client.ts b/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_client.ts deleted file mode 100644 index e5c7d4758a6..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_client.ts +++ /dev/null @@ -1,6782 +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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/migration_center_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './migration_center_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service describing handlers for resources. - * @class - * @memberof v1 - */ -export class MigrationCenterClient { - 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}; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - migrationCenterStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of MigrationCenterClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 MigrationCenterClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof MigrationCenterClient; - 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; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - 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 = { - assetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/assets/{asset}' - ), - errorFramePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sources/{source}/errorFrames/{error_frame}' - ), - groupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/groups/{group}' - ), - importDataFilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/importJobs/{import_job}/importDataFiles/{import_data_file}' - ), - importJobPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/importJobs/{import_job}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - preferenceSetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/preferenceSets/{preference_set}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - reportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/reportConfigs/{report_config}/reports/{report}' - ), - reportConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/reportConfigs/{report_config}' - ), - settingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/settings' - ), - sourcePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sources/{source}' - ), - }; - - // 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 = { - listAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'assets'), - listImportJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'importJobs'), - listImportDataFiles: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'importDataFiles'), - listGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groups'), - listErrorFrames: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'errorFrames'), - listSources: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sources'), - listPreferenceSets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'preferenceSets'), - listReportConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'reportConfigs'), - listReports: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'reports') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createImportJobResponse = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.ImportJob') as gax.protobuf.Type; - const createImportJobMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const deleteImportJobResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteImportJobMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const updateImportJobResponse = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.ImportJob') as gax.protobuf.Type; - const updateImportJobMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const validateImportJobResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const validateImportJobMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const runImportJobResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const runImportJobMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const createImportDataFileResponse = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.ImportDataFile') as gax.protobuf.Type; - const createImportDataFileMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const deleteImportDataFileResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteImportDataFileMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const createGroupResponse = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.Group') as gax.protobuf.Type; - const createGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const updateGroupResponse = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.Group') as gax.protobuf.Type; - const updateGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const deleteGroupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const addAssetsToGroupResponse = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.Group') as gax.protobuf.Type; - const addAssetsToGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const removeAssetsFromGroupResponse = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.Group') as gax.protobuf.Type; - const removeAssetsFromGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const createSourceResponse = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.Source') as gax.protobuf.Type; - const createSourceMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const updateSourceResponse = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.Source') as gax.protobuf.Type; - const updateSourceMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const deleteSourceResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteSourceMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const createPreferenceSetResponse = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.PreferenceSet') as gax.protobuf.Type; - const createPreferenceSetMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const updatePreferenceSetResponse = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.PreferenceSet') as gax.protobuf.Type; - const updatePreferenceSetMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const deletePreferenceSetResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deletePreferenceSetMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const updateSettingsResponse = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.Settings') as gax.protobuf.Type; - const updateSettingsMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const createReportConfigResponse = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.ReportConfig') as gax.protobuf.Type; - const createReportConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const deleteReportConfigResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteReportConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const createReportResponse = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.Report') as gax.protobuf.Type; - const createReportMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - const deleteReportResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteReportMetadata = protoFilesRoot.lookup( - '.google.cloud.migrationcenter.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createImportJob: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createImportJobResponse.decode.bind(createImportJobResponse), - createImportJobMetadata.decode.bind(createImportJobMetadata)), - deleteImportJob: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteImportJobResponse.decode.bind(deleteImportJobResponse), - deleteImportJobMetadata.decode.bind(deleteImportJobMetadata)), - updateImportJob: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateImportJobResponse.decode.bind(updateImportJobResponse), - updateImportJobMetadata.decode.bind(updateImportJobMetadata)), - validateImportJob: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - validateImportJobResponse.decode.bind(validateImportJobResponse), - validateImportJobMetadata.decode.bind(validateImportJobMetadata)), - runImportJob: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - runImportJobResponse.decode.bind(runImportJobResponse), - runImportJobMetadata.decode.bind(runImportJobMetadata)), - createImportDataFile: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createImportDataFileResponse.decode.bind(createImportDataFileResponse), - createImportDataFileMetadata.decode.bind(createImportDataFileMetadata)), - deleteImportDataFile: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteImportDataFileResponse.decode.bind(deleteImportDataFileResponse), - deleteImportDataFileMetadata.decode.bind(deleteImportDataFileMetadata)), - createGroup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createGroupResponse.decode.bind(createGroupResponse), - createGroupMetadata.decode.bind(createGroupMetadata)), - updateGroup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateGroupResponse.decode.bind(updateGroupResponse), - updateGroupMetadata.decode.bind(updateGroupMetadata)), - deleteGroup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteGroupResponse.decode.bind(deleteGroupResponse), - deleteGroupMetadata.decode.bind(deleteGroupMetadata)), - addAssetsToGroup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - addAssetsToGroupResponse.decode.bind(addAssetsToGroupResponse), - addAssetsToGroupMetadata.decode.bind(addAssetsToGroupMetadata)), - removeAssetsFromGroup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - removeAssetsFromGroupResponse.decode.bind(removeAssetsFromGroupResponse), - removeAssetsFromGroupMetadata.decode.bind(removeAssetsFromGroupMetadata)), - createSource: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createSourceResponse.decode.bind(createSourceResponse), - createSourceMetadata.decode.bind(createSourceMetadata)), - updateSource: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateSourceResponse.decode.bind(updateSourceResponse), - updateSourceMetadata.decode.bind(updateSourceMetadata)), - deleteSource: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteSourceResponse.decode.bind(deleteSourceResponse), - deleteSourceMetadata.decode.bind(deleteSourceMetadata)), - createPreferenceSet: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createPreferenceSetResponse.decode.bind(createPreferenceSetResponse), - createPreferenceSetMetadata.decode.bind(createPreferenceSetMetadata)), - updatePreferenceSet: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updatePreferenceSetResponse.decode.bind(updatePreferenceSetResponse), - updatePreferenceSetMetadata.decode.bind(updatePreferenceSetMetadata)), - deletePreferenceSet: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deletePreferenceSetResponse.decode.bind(deletePreferenceSetResponse), - deletePreferenceSetMetadata.decode.bind(deletePreferenceSetMetadata)), - updateSettings: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateSettingsResponse.decode.bind(updateSettingsResponse), - updateSettingsMetadata.decode.bind(updateSettingsMetadata)), - createReportConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createReportConfigResponse.decode.bind(createReportConfigResponse), - createReportConfigMetadata.decode.bind(createReportConfigMetadata)), - deleteReportConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteReportConfigResponse.decode.bind(deleteReportConfigResponse), - deleteReportConfigMetadata.decode.bind(deleteReportConfigMetadata)), - createReport: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createReportResponse.decode.bind(createReportResponse), - createReportMetadata.decode.bind(createReportMetadata)), - deleteReport: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteReportResponse.decode.bind(deleteReportResponse), - deleteReportMetadata.decode.bind(deleteReportMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.migrationcenter.v1.MigrationCenter', 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.migrationCenterStub) { - return this.migrationCenterStub; - } - - // Put together the "service stub" for - // google.cloud.migrationcenter.v1.MigrationCenter. - this.migrationCenterStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.migrationcenter.v1.MigrationCenter') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.migrationcenter.v1.MigrationCenter, - 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 migrationCenterStubMethods = - ['listAssets', 'getAsset', 'updateAsset', 'batchUpdateAssets', 'deleteAsset', 'batchDeleteAssets', 'reportAssetFrames', 'aggregateAssetsValues', 'createImportJob', 'listImportJobs', 'getImportJob', 'deleteImportJob', 'updateImportJob', 'validateImportJob', 'runImportJob', 'getImportDataFile', 'listImportDataFiles', 'createImportDataFile', 'deleteImportDataFile', 'listGroups', 'getGroup', 'createGroup', 'updateGroup', 'deleteGroup', 'addAssetsToGroup', 'removeAssetsFromGroup', 'listErrorFrames', 'getErrorFrame', 'listSources', 'getSource', 'createSource', 'updateSource', 'deleteSource', 'listPreferenceSets', 'getPreferenceSet', 'createPreferenceSet', 'updatePreferenceSet', 'deletePreferenceSet', 'getSettings', 'updateSettings', 'createReportConfig', 'getReportConfig', 'listReportConfigs', 'deleteReportConfig', 'createReport', 'getReport', 'listReports', 'deleteReport']; - for (const methodName of migrationCenterStubMethods) { - const callPromise = this.migrationCenterStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.migrationCenterStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'migrationcenter.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 'migrationcenter.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 -- - // ------------------- -/** - * Gets the details of an asset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @param {google.cloud.migrationcenter.v1.AssetView} request.view - * View of the assets. Defaults to BASIC. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.Asset|Asset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.get_asset.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_GetAsset_async - */ - getAsset( - request?: protos.google.cloud.migrationcenter.v1.IGetAssetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IAsset, - protos.google.cloud.migrationcenter.v1.IGetAssetRequest|undefined, {}|undefined - ]>; - getAsset( - request: protos.google.cloud.migrationcenter.v1.IGetAssetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IAsset, - protos.google.cloud.migrationcenter.v1.IGetAssetRequest|null|undefined, - {}|null|undefined>): void; - getAsset( - request: protos.google.cloud.migrationcenter.v1.IGetAssetRequest, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IAsset, - protos.google.cloud.migrationcenter.v1.IGetAssetRequest|null|undefined, - {}|null|undefined>): void; - getAsset( - request?: protos.google.cloud.migrationcenter.v1.IGetAssetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.migrationcenter.v1.IAsset, - protos.google.cloud.migrationcenter.v1.IGetAssetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.migrationcenter.v1.IAsset, - protos.google.cloud.migrationcenter.v1.IGetAssetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IAsset, - protos.google.cloud.migrationcenter.v1.IGetAssetRequest|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.getAsset(request, options, callback); - } -/** - * Updates the parameters of an asset. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `Asset` resource by the update. - * The values specified in the `update_mask` field are relative to the - * resource, not the full request. - * A field will be overwritten if it is in the mask. - * A single * value in the mask lets you to overwrite all fields. - * @param {google.cloud.migrationcenter.v1.Asset} request.asset - * Required. The resource being updated. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.Asset|Asset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.update_asset.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateAsset_async - */ - updateAsset( - request?: protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IAsset, - protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest|undefined, {}|undefined - ]>; - updateAsset( - request: protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IAsset, - protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest|null|undefined, - {}|null|undefined>): void; - updateAsset( - request: protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IAsset, - protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest|null|undefined, - {}|null|undefined>): void; - updateAsset( - request?: protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.migrationcenter.v1.IAsset, - protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.migrationcenter.v1.IAsset, - protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IAsset, - protos.google.cloud.migrationcenter.v1.IUpdateAssetRequest|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({ - 'asset.name': request.asset!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateAsset(request, options, callback); - } -/** - * Updates the parameters of a list of assets. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for batch asset update. - * @param {number[]} request.requests - * Required. The request message specifying the resources to update. - * A maximum of 1000 assets can be modified in a batch. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.BatchUpdateAssetsResponse|BatchUpdateAssetsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.batch_update_assets.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_BatchUpdateAssets_async - */ - batchUpdateAssets( - request?: protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsResponse, - protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest|undefined, {}|undefined - ]>; - batchUpdateAssets( - request: protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsResponse, - protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest|null|undefined, - {}|null|undefined>): void; - batchUpdateAssets( - request: protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsResponse, - protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest|null|undefined, - {}|null|undefined>): void; - batchUpdateAssets( - request?: protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsResponse, - protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsResponse, - protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsResponse, - protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsRequest|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.batchUpdateAssets(request, options, callback); - } -/** - * Deletes an asset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.delete_asset.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteAsset_async - */ - deleteAsset( - request?: protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest|undefined, {}|undefined - ]>; - deleteAsset( - request: protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest|null|undefined, - {}|null|undefined>): void; - deleteAsset( - request: protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest|null|undefined, - {}|null|undefined>): void; - deleteAsset( - request?: protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.migrationcenter.v1.IDeleteAssetRequest|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.deleteAsset(request, options, callback); - } -/** - * Deletes list of Assets. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for batch asset delete. - * @param {string[]} request.names - * Required. The IDs of the assets to delete. - * A maximum of 1000 assets can be deleted in a batch. - * Format: projects/{project}/locations/{location}/assets/{name}. - * @param {boolean} [request.allowMissing] - * Optional. When this value is set to `true` the request is a no-op for - * non-existing assets. See https://google.aip.dev/135#delete-if-existing for - * additional details. Default value is `false`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.batch_delete_assets.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_BatchDeleteAssets_async - */ - batchDeleteAssets( - request?: protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest|undefined, {}|undefined - ]>; - batchDeleteAssets( - request: protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest|null|undefined, - {}|null|undefined>): void; - batchDeleteAssets( - request: protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest|null|undefined, - {}|null|undefined>): void; - batchDeleteAssets( - request?: protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.migrationcenter.v1.IBatchDeleteAssetsRequest|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.batchDeleteAssets(request, options, callback); - } -/** - * Reports a set of frames. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent of the resource. - * @param {google.cloud.migrationcenter.v1.Frames} request.frames - * Collection of frames data. - * @param {string} request.source - * Required. Reference to a source. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.ReportAssetFramesResponse|ReportAssetFramesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.report_asset_frames.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_ReportAssetFrames_async - */ - reportAssetFrames( - request?: protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IReportAssetFramesResponse, - protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest|undefined, {}|undefined - ]>; - reportAssetFrames( - request: protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IReportAssetFramesResponse, - protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest|null|undefined, - {}|null|undefined>): void; - reportAssetFrames( - request: protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IReportAssetFramesResponse, - protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest|null|undefined, - {}|null|undefined>): void; - reportAssetFrames( - request?: protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.migrationcenter.v1.IReportAssetFramesResponse, - protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.migrationcenter.v1.IReportAssetFramesResponse, - protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IReportAssetFramesResponse, - protos.google.cloud.migrationcenter.v1.IReportAssetFramesRequest|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.reportAssetFrames(request, options, callback); - } -/** - * Aggregates the requested fields based on provided function. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for `AggregateAssetsValuesRequest`. - * @param {number[]} request.aggregations - * Array of aggregations to perform. - * Up to 25 aggregations can be defined. - * @param {string} request.filter - * The aggregation will be performed on assets that match the provided filter. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.AggregateAssetsValuesResponse|AggregateAssetsValuesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.aggregate_assets_values.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_AggregateAssetsValues_async - */ - aggregateAssetsValues( - request?: protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesResponse, - protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest|undefined, {}|undefined - ]>; - aggregateAssetsValues( - request: protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesResponse, - protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest|null|undefined, - {}|null|undefined>): void; - aggregateAssetsValues( - request: protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesResponse, - protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest|null|undefined, - {}|null|undefined>): void; - aggregateAssetsValues( - request?: protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesResponse, - protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesResponse, - protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesResponse, - protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesRequest|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.aggregateAssetsValues(request, options, callback); - } -/** - * Gets the details of an import job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @param {google.cloud.migrationcenter.v1.ImportJobView} [request.view] - * Optional. The level of details of the import job. - * Default value is FULL. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.ImportJob|ImportJob}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.get_import_job.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_GetImportJob_async - */ - getImportJob( - request?: protos.google.cloud.migrationcenter.v1.IGetImportJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IImportJob, - protos.google.cloud.migrationcenter.v1.IGetImportJobRequest|undefined, {}|undefined - ]>; - getImportJob( - request: protos.google.cloud.migrationcenter.v1.IGetImportJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IImportJob, - protos.google.cloud.migrationcenter.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>): void; - getImportJob( - request: protos.google.cloud.migrationcenter.v1.IGetImportJobRequest, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IImportJob, - protos.google.cloud.migrationcenter.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>): void; - getImportJob( - request?: protos.google.cloud.migrationcenter.v1.IGetImportJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.migrationcenter.v1.IImportJob, - protos.google.cloud.migrationcenter.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.migrationcenter.v1.IImportJob, - protos.google.cloud.migrationcenter.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IImportJob, - protos.google.cloud.migrationcenter.v1.IGetImportJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getImportJob(request, options, callback); - } -/** - * Gets an import data file. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the ImportDataFile. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.ImportDataFile|ImportDataFile}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.get_import_data_file.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_GetImportDataFile_async - */ - getImportDataFile( - request?: protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IImportDataFile, - protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest|undefined, {}|undefined - ]>; - getImportDataFile( - request: protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IImportDataFile, - protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest|null|undefined, - {}|null|undefined>): void; - getImportDataFile( - request: protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IImportDataFile, - protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest|null|undefined, - {}|null|undefined>): void; - getImportDataFile( - request?: protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.migrationcenter.v1.IImportDataFile, - protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.migrationcenter.v1.IImportDataFile, - protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IImportDataFile, - protos.google.cloud.migrationcenter.v1.IGetImportDataFileRequest|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.getImportDataFile(request, options, callback); - } -/** - * Gets the details of a group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the 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 protos.google.cloud.migrationcenter.v1.Group|Group}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.get_group.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_GetGroup_async - */ - getGroup( - request?: protos.google.cloud.migrationcenter.v1.IGetGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IGroup, - protos.google.cloud.migrationcenter.v1.IGetGroupRequest|undefined, {}|undefined - ]>; - getGroup( - request: protos.google.cloud.migrationcenter.v1.IGetGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IGroup, - protos.google.cloud.migrationcenter.v1.IGetGroupRequest|null|undefined, - {}|null|undefined>): void; - getGroup( - request: protos.google.cloud.migrationcenter.v1.IGetGroupRequest, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IGroup, - protos.google.cloud.migrationcenter.v1.IGetGroupRequest|null|undefined, - {}|null|undefined>): void; - getGroup( - request?: protos.google.cloud.migrationcenter.v1.IGetGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.migrationcenter.v1.IGroup, - protos.google.cloud.migrationcenter.v1.IGetGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.migrationcenter.v1.IGroup, - protos.google.cloud.migrationcenter.v1.IGetGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IGroup, - protos.google.cloud.migrationcenter.v1.IGetGroupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getGroup(request, options, callback); - } -/** - * Gets the details of an error frame. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the frame to retrieve. - * Format: - * projects/{project}/locations/{location}/sources/{source}/errorFrames/{error_frame} - * @param {google.cloud.migrationcenter.v1.ErrorFrameView} [request.view] - * Optional. An optional view mode to control the level of details for the - * frame. The default is a basic frame view. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.ErrorFrame|ErrorFrame}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.get_error_frame.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_GetErrorFrame_async - */ - getErrorFrame( - request?: protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IErrorFrame, - protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest|undefined, {}|undefined - ]>; - getErrorFrame( - request: protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IErrorFrame, - protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest|null|undefined, - {}|null|undefined>): void; - getErrorFrame( - request: protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IErrorFrame, - protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest|null|undefined, - {}|null|undefined>): void; - getErrorFrame( - request?: protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.migrationcenter.v1.IErrorFrame, - protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.migrationcenter.v1.IErrorFrame, - protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IErrorFrame, - protos.google.cloud.migrationcenter.v1.IGetErrorFrameRequest|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.getErrorFrame(request, options, callback); - } -/** - * Gets the details of a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the 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 protos.google.cloud.migrationcenter.v1.Source|Source}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.get_source.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_GetSource_async - */ - getSource( - request?: protos.google.cloud.migrationcenter.v1.IGetSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.ISource, - protos.google.cloud.migrationcenter.v1.IGetSourceRequest|undefined, {}|undefined - ]>; - getSource( - request: protos.google.cloud.migrationcenter.v1.IGetSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.migrationcenter.v1.ISource, - protos.google.cloud.migrationcenter.v1.IGetSourceRequest|null|undefined, - {}|null|undefined>): void; - getSource( - request: protos.google.cloud.migrationcenter.v1.IGetSourceRequest, - callback: Callback< - protos.google.cloud.migrationcenter.v1.ISource, - protos.google.cloud.migrationcenter.v1.IGetSourceRequest|null|undefined, - {}|null|undefined>): void; - getSource( - request?: protos.google.cloud.migrationcenter.v1.IGetSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.migrationcenter.v1.ISource, - protos.google.cloud.migrationcenter.v1.IGetSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.migrationcenter.v1.ISource, - protos.google.cloud.migrationcenter.v1.IGetSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.migrationcenter.v1.ISource, - protos.google.cloud.migrationcenter.v1.IGetSourceRequest|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.getSource(request, options, callback); - } -/** - * Gets the details of a preference set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the 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 protos.google.cloud.migrationcenter.v1.PreferenceSet|PreferenceSet}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.get_preference_set.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_GetPreferenceSet_async - */ - getPreferenceSet( - request?: protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IPreferenceSet, - protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest|undefined, {}|undefined - ]>; - getPreferenceSet( - request: protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IPreferenceSet, - protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest|null|undefined, - {}|null|undefined>): void; - getPreferenceSet( - request: protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IPreferenceSet, - protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest|null|undefined, - {}|null|undefined>): void; - getPreferenceSet( - request?: protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.migrationcenter.v1.IPreferenceSet, - protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.migrationcenter.v1.IPreferenceSet, - protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IPreferenceSet, - protos.google.cloud.migrationcenter.v1.IGetPreferenceSetRequest|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.getPreferenceSet(request, options, callback); - } -/** - * Gets the details of regional settings. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the 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 protos.google.cloud.migrationcenter.v1.Settings|Settings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.get_settings.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_GetSettings_async - */ - getSettings( - request?: protos.google.cloud.migrationcenter.v1.IGetSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.ISettings, - protos.google.cloud.migrationcenter.v1.IGetSettingsRequest|undefined, {}|undefined - ]>; - getSettings( - request: protos.google.cloud.migrationcenter.v1.IGetSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.migrationcenter.v1.ISettings, - protos.google.cloud.migrationcenter.v1.IGetSettingsRequest|null|undefined, - {}|null|undefined>): void; - getSettings( - request: protos.google.cloud.migrationcenter.v1.IGetSettingsRequest, - callback: Callback< - protos.google.cloud.migrationcenter.v1.ISettings, - protos.google.cloud.migrationcenter.v1.IGetSettingsRequest|null|undefined, - {}|null|undefined>): void; - getSettings( - request?: protos.google.cloud.migrationcenter.v1.IGetSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.migrationcenter.v1.ISettings, - protos.google.cloud.migrationcenter.v1.IGetSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.migrationcenter.v1.ISettings, - protos.google.cloud.migrationcenter.v1.IGetSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.migrationcenter.v1.ISettings, - protos.google.cloud.migrationcenter.v1.IGetSettingsRequest|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.getSettings(request, options, callback); - } -/** - * Gets details of a single ReportConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the 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 protos.google.cloud.migrationcenter.v1.ReportConfig|ReportConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.get_report_config.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_GetReportConfig_async - */ - getReportConfig( - request?: protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IReportConfig, - protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest|undefined, {}|undefined - ]>; - getReportConfig( - request: protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IReportConfig, - protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest|null|undefined, - {}|null|undefined>): void; - getReportConfig( - request: protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IReportConfig, - protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest|null|undefined, - {}|null|undefined>): void; - getReportConfig( - request?: protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.migrationcenter.v1.IReportConfig, - protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.migrationcenter.v1.IReportConfig, - protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IReportConfig, - protos.google.cloud.migrationcenter.v1.IGetReportConfigRequest|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.getReportConfig(request, options, callback); - } -/** - * Gets details of a single Report. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @param {google.cloud.migrationcenter.v1.ReportView} request.view - * Determines what information to retrieve for the Report. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.Report|Report}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.get_report.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_GetReport_async - */ - getReport( - request?: protos.google.cloud.migrationcenter.v1.IGetReportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IReport, - protos.google.cloud.migrationcenter.v1.IGetReportRequest|undefined, {}|undefined - ]>; - getReport( - request: protos.google.cloud.migrationcenter.v1.IGetReportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IReport, - protos.google.cloud.migrationcenter.v1.IGetReportRequest|null|undefined, - {}|null|undefined>): void; - getReport( - request: protos.google.cloud.migrationcenter.v1.IGetReportRequest, - callback: Callback< - protos.google.cloud.migrationcenter.v1.IReport, - protos.google.cloud.migrationcenter.v1.IGetReportRequest|null|undefined, - {}|null|undefined>): void; - getReport( - request?: protos.google.cloud.migrationcenter.v1.IGetReportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.migrationcenter.v1.IReport, - protos.google.cloud.migrationcenter.v1.IGetReportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.migrationcenter.v1.IReport, - protos.google.cloud.migrationcenter.v1.IGetReportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IReport, - protos.google.cloud.migrationcenter.v1.IGetReportRequest|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.getReport(request, options, callback); - } - -/** - * Creates an import job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.importJobId - * Required. ID of the import job. - * @param {google.cloud.migrationcenter.v1.ImportJob} request.importJob - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.create_import_job.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateImportJob_async - */ - createImportJob( - request?: protos.google.cloud.migrationcenter.v1.ICreateImportJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createImportJob( - request: protos.google.cloud.migrationcenter.v1.ICreateImportJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createImportJob( - request: protos.google.cloud.migrationcenter.v1.ICreateImportJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createImportJob( - request?: protos.google.cloud.migrationcenter.v1.ICreateImportJobRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createImportJob(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createImportJob()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.create_import_job.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateImportJob_async - */ - async checkCreateImportJobProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createImportJob, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes an import job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.force] - * Optional. If set to `true`, any `ImportDataFiles` of this job will also be - * deleted If set to `false`, the request only works if the job has no data - * files. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.delete_import_job.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteImportJob_async - */ - deleteImportJob( - request?: protos.google.cloud.migrationcenter.v1.IDeleteImportJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteImportJob( - request: protos.google.cloud.migrationcenter.v1.IDeleteImportJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteImportJob( - request: protos.google.cloud.migrationcenter.v1.IDeleteImportJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteImportJob( - request?: protos.google.cloud.migrationcenter.v1.IDeleteImportJobRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteImportJob(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteImportJob()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.delete_import_job.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteImportJob_async - */ - async checkDeleteImportJobProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteImportJob, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an import job. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `Asset` resource by the update. - * The values specified in the `update_mask` field are relative to the - * resource, not the full request. - * A field will be overwritten if it is in the mask. - * A single * value in the mask lets you to overwrite all fields. - * @param {google.cloud.migrationcenter.v1.ImportJob} request.importJob - * Required. The resource being updated - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.update_import_job.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateImportJob_async - */ - updateImportJob( - request?: protos.google.cloud.migrationcenter.v1.IUpdateImportJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateImportJob( - request: protos.google.cloud.migrationcenter.v1.IUpdateImportJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateImportJob( - request: protos.google.cloud.migrationcenter.v1.IUpdateImportJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateImportJob( - request?: protos.google.cloud.migrationcenter.v1.IUpdateImportJobRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'import_job.name': request.importJob!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateImportJob(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateImportJob()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.update_import_job.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateImportJob_async - */ - async checkUpdateImportJobProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateImportJob, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Validates an import job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the import job to validate. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.validate_import_job.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_ValidateImportJob_async - */ - validateImportJob( - request?: protos.google.cloud.migrationcenter.v1.IValidateImportJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - validateImportJob( - request: protos.google.cloud.migrationcenter.v1.IValidateImportJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - validateImportJob( - request: protos.google.cloud.migrationcenter.v1.IValidateImportJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - validateImportJob( - request?: protos.google.cloud.migrationcenter.v1.IValidateImportJobRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.validateImportJob(request, options, callback); - } -/** - * Check the status of the long running operation returned by `validateImportJob()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.validate_import_job.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_ValidateImportJob_async - */ - async checkValidateImportJobProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.validateImportJob, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Runs an import job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the import job to run. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.run_import_job.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_RunImportJob_async - */ - runImportJob( - request?: protos.google.cloud.migrationcenter.v1.IRunImportJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - runImportJob( - request: protos.google.cloud.migrationcenter.v1.IRunImportJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runImportJob( - request: protos.google.cloud.migrationcenter.v1.IRunImportJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runImportJob( - request?: protos.google.cloud.migrationcenter.v1.IRunImportJobRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.runImportJob(request, options, callback); - } -/** - * Check the status of the long running operation returned by `runImportJob()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.run_import_job.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_RunImportJob_async - */ - async checkRunImportJobProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runImportJob, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates an import data file. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the parent of the ImportDataFile. - * @param {string} request.importDataFileId - * Required. The ID of the new data file. - * @param {google.cloud.migrationcenter.v1.ImportDataFile} request.importDataFile - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.create_import_data_file.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateImportDataFile_async - */ - createImportDataFile( - request?: protos.google.cloud.migrationcenter.v1.ICreateImportDataFileRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createImportDataFile( - request: protos.google.cloud.migrationcenter.v1.ICreateImportDataFileRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createImportDataFile( - request: protos.google.cloud.migrationcenter.v1.ICreateImportDataFileRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createImportDataFile( - request?: protos.google.cloud.migrationcenter.v1.ICreateImportDataFileRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createImportDataFile(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createImportDataFile()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.create_import_data_file.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateImportDataFile_async - */ - async checkCreateImportDataFileProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createImportDataFile, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Delete an import data file. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the ImportDataFile to delete. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.delete_import_data_file.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteImportDataFile_async - */ - deleteImportDataFile( - request?: protos.google.cloud.migrationcenter.v1.IDeleteImportDataFileRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteImportDataFile( - request: protos.google.cloud.migrationcenter.v1.IDeleteImportDataFileRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteImportDataFile( - request: protos.google.cloud.migrationcenter.v1.IDeleteImportDataFileRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteImportDataFile( - request?: protos.google.cloud.migrationcenter.v1.IDeleteImportDataFileRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteImportDataFile(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteImportDataFile()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.delete_import_data_file.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteImportDataFile_async - */ - async checkDeleteImportDataFileProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteImportDataFile, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new group in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.groupId - * Required. User specified ID for the group. It will become the last - * component of the group name. The ID must be unique within the project, must - * conform with RFC-1034, is restricted to lower-cased letters, and has a - * maximum length of 63 characters. The ID must match the regular expression: - * `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. - * @param {google.cloud.migrationcenter.v1.Group} request.group - * Required. The group resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.create_group.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateGroup_async - */ - createGroup( - request?: protos.google.cloud.migrationcenter.v1.ICreateGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createGroup( - request: protos.google.cloud.migrationcenter.v1.ICreateGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createGroup( - request: protos.google.cloud.migrationcenter.v1.ICreateGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createGroup( - request?: protos.google.cloud.migrationcenter.v1.ICreateGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createGroup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createGroup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.create_group.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateGroup_async - */ - async checkCreateGroupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the parameters of a group. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `Group` resource by the update. - * The values specified in the `update_mask` are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. - * A single * value in the mask lets you to overwrite all fields. - * @param {google.cloud.migrationcenter.v1.Group} request.group - * Required. The group resource being updated. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.update_group.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateGroup_async - */ - updateGroup( - request?: protos.google.cloud.migrationcenter.v1.IUpdateGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateGroup( - request: protos.google.cloud.migrationcenter.v1.IUpdateGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateGroup( - request: protos.google.cloud.migrationcenter.v1.IUpdateGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateGroup( - request?: protos.google.cloud.migrationcenter.v1.IUpdateGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'group.name': request.group!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateGroup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateGroup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.update_group.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateGroup_async - */ - async checkUpdateGroupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the group resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.delete_group.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteGroup_async - */ - deleteGroup( - request?: protos.google.cloud.migrationcenter.v1.IDeleteGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteGroup( - request: protos.google.cloud.migrationcenter.v1.IDeleteGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteGroup( - request: protos.google.cloud.migrationcenter.v1.IDeleteGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteGroup( - request?: protos.google.cloud.migrationcenter.v1.IDeleteGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteGroup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteGroup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.delete_group.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteGroup_async - */ - async checkDeleteGroupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Adds assets to a group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.group - * Required. Group reference. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {google.cloud.migrationcenter.v1.AssetList} request.assets - * Required. List of assets to be added. - * The maximum number of assets that can be added in a single request is - * 1000. - * @param {boolean} [request.allowExisting] - * Optional. When this value is set to `false` and one of the given assets is - * already an existing member of the group, the operation fails with an - * `Already Exists` error. When set to `true` this situation is silently - * ignored by the server. - * - * Default value is `false`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.add_assets_to_group.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_AddAssetsToGroup_async - */ - addAssetsToGroup( - request?: protos.google.cloud.migrationcenter.v1.IAddAssetsToGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - addAssetsToGroup( - request: protos.google.cloud.migrationcenter.v1.IAddAssetsToGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - addAssetsToGroup( - request: protos.google.cloud.migrationcenter.v1.IAddAssetsToGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - addAssetsToGroup( - request?: protos.google.cloud.migrationcenter.v1.IAddAssetsToGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'group': request.group ?? '', - }); - this.initialize(); - return this.innerApiCalls.addAssetsToGroup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `addAssetsToGroup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.add_assets_to_group.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_AddAssetsToGroup_async - */ - async checkAddAssetsToGroupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.addAssetsToGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Removes assets from a group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.group - * Required. Group reference. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {google.cloud.migrationcenter.v1.AssetList} request.assets - * Required. List of assets to be removed. - * The maximum number of assets that can be removed in a single request is - * 1000. - * @param {boolean} [request.allowMissing] - * Optional. When this value is set to `false` and one of the given assets is - * not an existing member of the group, the operation fails with a `Not Found` - * error. When set to `true` this situation is silently ignored by the server. - * - * Default value is `false`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.remove_assets_from_group.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_RemoveAssetsFromGroup_async - */ - removeAssetsFromGroup( - request?: protos.google.cloud.migrationcenter.v1.IRemoveAssetsFromGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - removeAssetsFromGroup( - request: protos.google.cloud.migrationcenter.v1.IRemoveAssetsFromGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - removeAssetsFromGroup( - request: protos.google.cloud.migrationcenter.v1.IRemoveAssetsFromGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - removeAssetsFromGroup( - request?: protos.google.cloud.migrationcenter.v1.IRemoveAssetsFromGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'group': request.group ?? '', - }); - this.initialize(); - return this.innerApiCalls.removeAssetsFromGroup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `removeAssetsFromGroup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.remove_assets_from_group.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_RemoveAssetsFromGroup_async - */ - async checkRemoveAssetsFromGroupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.removeAssetsFromGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new source in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.sourceId - * Required. User specified ID for the source. It will become the last - * component of the source name. The ID must be unique within the project, - * must conform with RFC-1034, is restricted to lower-cased letters, and has a - * maximum length of 63 characters. The ID must match the regular expression: - * `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. - * @param {google.cloud.migrationcenter.v1.Source} request.source - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.create_source.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateSource_async - */ - createSource( - request?: protos.google.cloud.migrationcenter.v1.ICreateSourceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createSource( - request: protos.google.cloud.migrationcenter.v1.ICreateSourceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createSource( - request: protos.google.cloud.migrationcenter.v1.ICreateSourceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createSource( - request?: protos.google.cloud.migrationcenter.v1.ICreateSourceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createSource(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createSource()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.create_source.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateSource_async - */ - async checkCreateSourceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createSource, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the parameters of a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `Source` resource by the update. - * The values specified in the `update_mask` field are relative to the - * resource, not the full request. - * A field will be overwritten if it is in the mask. - * A single * value in the mask lets you to overwrite all fields. - * @param {google.cloud.migrationcenter.v1.Source} request.source - * Required. The resource being updated - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.update_source.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateSource_async - */ - updateSource( - request?: protos.google.cloud.migrationcenter.v1.IUpdateSourceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateSource( - request: protos.google.cloud.migrationcenter.v1.IUpdateSourceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateSource( - request: protos.google.cloud.migrationcenter.v1.IUpdateSourceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateSource( - request?: protos.google.cloud.migrationcenter.v1.IUpdateSourceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'source.name': request.source!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSource(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateSource()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.update_source.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateSource_async - */ - async checkUpdateSourceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateSource, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.delete_source.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteSource_async - */ - deleteSource( - request?: protos.google.cloud.migrationcenter.v1.IDeleteSourceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteSource( - request: protos.google.cloud.migrationcenter.v1.IDeleteSourceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteSource( - request: protos.google.cloud.migrationcenter.v1.IDeleteSourceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteSource( - request?: protos.google.cloud.migrationcenter.v1.IDeleteSourceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteSource(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteSource()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.delete_source.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteSource_async - */ - async checkDeleteSourceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteSource, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new preference set in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.preferenceSetId - * Required. User specified ID for the preference set. It will become the last - * component of the preference set name. The ID must be unique within the - * project, must conform with RFC-1034, is restricted to lower-cased letters, - * and has a maximum length of 63 characters. The ID must match the regular - * expression - * `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. - * @param {google.cloud.migrationcenter.v1.PreferenceSet} request.preferenceSet - * Required. The preference set resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.create_preference_set.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_CreatePreferenceSet_async - */ - createPreferenceSet( - request?: protos.google.cloud.migrationcenter.v1.ICreatePreferenceSetRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createPreferenceSet( - request: protos.google.cloud.migrationcenter.v1.ICreatePreferenceSetRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createPreferenceSet( - request: protos.google.cloud.migrationcenter.v1.ICreatePreferenceSetRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createPreferenceSet( - request?: protos.google.cloud.migrationcenter.v1.ICreatePreferenceSetRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createPreferenceSet(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createPreferenceSet()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.create_preference_set.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_CreatePreferenceSet_async - */ - async checkCreatePreferenceSetProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createPreferenceSet, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the parameters of a preference set. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `PreferenceSet` resource by the update. - * The values specified in the `update_mask` field are relative to the - * resource, not the full request. - * A field will be overwritten if it is in the mask. - * A single * value in the mask lets you to overwrite all fields. - * @param {google.cloud.migrationcenter.v1.PreferenceSet} request.preferenceSet - * Required. The preference set resource being updated. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.update_preference_set.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdatePreferenceSet_async - */ - updatePreferenceSet( - request?: protos.google.cloud.migrationcenter.v1.IUpdatePreferenceSetRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updatePreferenceSet( - request: protos.google.cloud.migrationcenter.v1.IUpdatePreferenceSetRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updatePreferenceSet( - request: protos.google.cloud.migrationcenter.v1.IUpdatePreferenceSetRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updatePreferenceSet( - request?: protos.google.cloud.migrationcenter.v1.IUpdatePreferenceSetRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'preference_set.name': request.preferenceSet!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updatePreferenceSet(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updatePreferenceSet()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.update_preference_set.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdatePreferenceSet_async - */ - async checkUpdatePreferenceSetProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updatePreferenceSet, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a preference set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the group resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.delete_preference_set.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_DeletePreferenceSet_async - */ - deletePreferenceSet( - request?: protos.google.cloud.migrationcenter.v1.IDeletePreferenceSetRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deletePreferenceSet( - request: protos.google.cloud.migrationcenter.v1.IDeletePreferenceSetRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deletePreferenceSet( - request: protos.google.cloud.migrationcenter.v1.IDeletePreferenceSetRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deletePreferenceSet( - request?: protos.google.cloud.migrationcenter.v1.IDeletePreferenceSetRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deletePreferenceSet(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deletePreferenceSet()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.delete_preference_set.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_DeletePreferenceSet_async - */ - async checkDeletePreferenceSetProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePreferenceSet, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the regional-level project settings. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `Settings` resource by the update. - * The values specified in the `update_mask` field are relative to the - * resource, not the full request. - * A field will be overwritten if it is in the mask. - * A single * value in the mask lets you to overwrite all fields. - * @param {google.cloud.migrationcenter.v1.Settings} request.settings - * Required. The project settings resource being updated. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.update_settings.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateSettings_async - */ - updateSettings( - request?: protos.google.cloud.migrationcenter.v1.IUpdateSettingsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateSettings( - request: protos.google.cloud.migrationcenter.v1.IUpdateSettingsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateSettings( - request: protos.google.cloud.migrationcenter.v1.IUpdateSettingsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateSettings( - request?: protos.google.cloud.migrationcenter.v1.IUpdateSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'settings.name': request.settings!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSettings(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateSettings()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.update_settings.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_UpdateSettings_async - */ - async checkUpdateSettingsProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateSettings, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a report configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.reportConfigId - * Required. User specified ID for the report config. It will become the last - * component of the report config name. The ID must be unique within the - * project, must conform with RFC-1034, is restricted to lower-cased letters, - * and has a maximum length of 63 characters. The ID must match the regular - * expression: [a-z]([a-z0-9-]{0,61}[a-z0-9])?. - * @param {google.cloud.migrationcenter.v1.ReportConfig} request.reportConfig - * Required. The report config set resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.create_report_config.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateReportConfig_async - */ - createReportConfig( - request?: protos.google.cloud.migrationcenter.v1.ICreateReportConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createReportConfig( - request: protos.google.cloud.migrationcenter.v1.ICreateReportConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createReportConfig( - request: protos.google.cloud.migrationcenter.v1.ICreateReportConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createReportConfig( - request?: protos.google.cloud.migrationcenter.v1.ICreateReportConfigRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createReportConfig(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createReportConfig()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.create_report_config.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateReportConfig_async - */ - async checkCreateReportConfigProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createReportConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a ReportConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.force] - * Optional. If set to `true`, any child `Reports` of this entity will also be - * deleted. If set to `false`, the request only works if the resource has no - * children. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.delete_report_config.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteReportConfig_async - */ - deleteReportConfig( - request?: protos.google.cloud.migrationcenter.v1.IDeleteReportConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteReportConfig( - request: protos.google.cloud.migrationcenter.v1.IDeleteReportConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteReportConfig( - request: protos.google.cloud.migrationcenter.v1.IDeleteReportConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteReportConfig( - request?: protos.google.cloud.migrationcenter.v1.IDeleteReportConfigRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteReportConfig(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteReportConfig()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.delete_report_config.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteReportConfig_async - */ - async checkDeleteReportConfigProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteReportConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a report. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.reportId - * Required. User specified id for the report. It will become the last - * component of the report name. The id must be unique within the project, - * must conform with RFC-1034, is restricted to lower-cased letters, and has a - * maximum length of 63 characters. The id must match the regular expression: - * [a-z]([a-z0-9-]{0,61}[a-z0-9])?. - * @param {google.cloud.migrationcenter.v1.Report} request.report - * Required. The report resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.create_report.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateReport_async - */ - createReport( - request?: protos.google.cloud.migrationcenter.v1.ICreateReportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createReport( - request: protos.google.cloud.migrationcenter.v1.ICreateReportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createReport( - request: protos.google.cloud.migrationcenter.v1.ICreateReportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createReport( - request?: protos.google.cloud.migrationcenter.v1.ICreateReportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createReport(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createReport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.create_report.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_CreateReport_async - */ - async checkCreateReportProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createReport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a Report. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.delete_report.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteReport_async - */ - deleteReport( - request?: protos.google.cloud.migrationcenter.v1.IDeleteReportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteReport( - request: protos.google.cloud.migrationcenter.v1.IDeleteReportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteReport( - request: protos.google.cloud.migrationcenter.v1.IDeleteReportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteReport( - request?: protos.google.cloud.migrationcenter.v1.IDeleteReportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteReport(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteReport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.delete_report.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_DeleteReport_async - */ - async checkDeleteReportProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteReport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all the assets in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for `ListAssetsRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {google.cloud.migrationcenter.v1.AssetView} request.view - * View of the assets. Defaults to BASIC. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.Asset|Asset}. - * 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 `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAssets( - request?: protos.google.cloud.migrationcenter.v1.IListAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IAsset[], - protos.google.cloud.migrationcenter.v1.IListAssetsRequest|null, - protos.google.cloud.migrationcenter.v1.IListAssetsResponse - ]>; - listAssets( - request: protos.google.cloud.migrationcenter.v1.IListAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListAssetsRequest, - protos.google.cloud.migrationcenter.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IAsset>): void; - listAssets( - request: protos.google.cloud.migrationcenter.v1.IListAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListAssetsRequest, - protos.google.cloud.migrationcenter.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IAsset>): void; - listAssets( - request?: protos.google.cloud.migrationcenter.v1.IListAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListAssetsRequest, - protos.google.cloud.migrationcenter.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IAsset>, - callback?: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListAssetsRequest, - protos.google.cloud.migrationcenter.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IAsset>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IAsset[], - protos.google.cloud.migrationcenter.v1.IListAssetsRequest|null, - protos.google.cloud.migrationcenter.v1.IListAssetsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listAssets(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. Parent value for `ListAssetsRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {google.cloud.migrationcenter.v1.AssetView} request.view - * View of the assets. Defaults to BASIC. - * @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 protos.google.cloud.migrationcenter.v1.Asset|Asset} 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 `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAssetsStream( - request?: protos.google.cloud.migrationcenter.v1.IListAssetsRequest, - 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['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.createStream( - this.innerApiCalls.listAssets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAssets`, 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. Parent value for `ListAssetsRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {google.cloud.migrationcenter.v1.AssetView} request.view - * View of the assets. Defaults to BASIC. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.migrationcenter.v1.Asset|Asset}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.list_assets.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_ListAssets_async - */ - listAssetsAsync( - request?: protos.google.cloud.migrationcenter.v1.IListAssetsRequest, - 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['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.asyncIterate( - this.innerApiCalls['listAssets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all import jobs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for `ListImportJobsRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {google.cloud.migrationcenter.v1.ImportJobView} [request.view] - * Optional. The level of details of each import job. - * Default value is BASIC. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.ImportJob|ImportJob}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listImportJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listImportJobs( - request?: protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IImportJob[], - protos.google.cloud.migrationcenter.v1.IListImportJobsRequest|null, - protos.google.cloud.migrationcenter.v1.IListImportJobsResponse - ]>; - listImportJobs( - request: protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, - protos.google.cloud.migrationcenter.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IImportJob>): void; - listImportJobs( - request: protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, - protos.google.cloud.migrationcenter.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IImportJob>): void; - listImportJobs( - request?: protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, - protos.google.cloud.migrationcenter.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IImportJob>, - callback?: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, - protos.google.cloud.migrationcenter.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IImportJob>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IImportJob[], - protos.google.cloud.migrationcenter.v1.IListImportJobsRequest|null, - protos.google.cloud.migrationcenter.v1.IListImportJobsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listImportJobs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for `ListImportJobsRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {google.cloud.migrationcenter.v1.ImportJobView} [request.view] - * Optional. The level of details of each import job. - * Default value is BASIC. - * @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 protos.google.cloud.migrationcenter.v1.ImportJob|ImportJob} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listImportJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listImportJobsStream( - request?: protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listImportJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listImportJobs.createStream( - this.innerApiCalls.listImportJobs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listImportJobs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for `ListImportJobsRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {google.cloud.migrationcenter.v1.ImportJobView} [request.view] - * Optional. The level of details of each import job. - * Default value is BASIC. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.migrationcenter.v1.ImportJob|ImportJob}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.list_import_jobs.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_ListImportJobs_async - */ - listImportJobsAsync( - request?: protos.google.cloud.migrationcenter.v1.IListImportJobsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listImportJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listImportJobs.asyncIterate( - this.innerApiCalls['listImportJobs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * List import data files. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the parent of the `ImportDataFiles` resource. - * @param {number} request.pageSize - * The maximum number of data files to return. The service may return - * fewer than this value. If unspecified, at most 500 data files 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 `ListImportDataFiles` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListImportDataFiles` - * must match the call that provided the page token. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.ImportDataFile|ImportDataFile}. - * 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 `listImportDataFilesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listImportDataFiles( - request?: protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IImportDataFile[], - protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest|null, - protos.google.cloud.migrationcenter.v1.IListImportDataFilesResponse - ]>; - listImportDataFiles( - request: protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, - protos.google.cloud.migrationcenter.v1.IListImportDataFilesResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IImportDataFile>): void; - listImportDataFiles( - request: protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, - protos.google.cloud.migrationcenter.v1.IListImportDataFilesResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IImportDataFile>): void; - listImportDataFiles( - request?: protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, - protos.google.cloud.migrationcenter.v1.IListImportDataFilesResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IImportDataFile>, - callback?: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, - protos.google.cloud.migrationcenter.v1.IListImportDataFilesResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IImportDataFile>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IImportDataFile[], - protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest|null, - protos.google.cloud.migrationcenter.v1.IListImportDataFilesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listImportDataFiles(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. Name of the parent of the `ImportDataFiles` resource. - * @param {number} request.pageSize - * The maximum number of data files to return. The service may return - * fewer than this value. If unspecified, at most 500 data files 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 `ListImportDataFiles` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListImportDataFiles` - * must match the call that provided the page token. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @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 protos.google.cloud.migrationcenter.v1.ImportDataFile|ImportDataFile} 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 `listImportDataFilesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listImportDataFilesStream( - request?: protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, - 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['listImportDataFiles']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listImportDataFiles.createStream( - this.innerApiCalls.listImportDataFiles as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listImportDataFiles`, 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. Name of the parent of the `ImportDataFiles` resource. - * @param {number} request.pageSize - * The maximum number of data files to return. The service may return - * fewer than this value. If unspecified, at most 500 data files 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 `ListImportDataFiles` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListImportDataFiles` - * must match the call that provided the page token. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.migrationcenter.v1.ImportDataFile|ImportDataFile}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.list_import_data_files.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_ListImportDataFiles_async - */ - listImportDataFilesAsync( - request?: protos.google.cloud.migrationcenter.v1.IListImportDataFilesRequest, - 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['listImportDataFiles']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listImportDataFiles.asyncIterate( - this.innerApiCalls['listImportDataFiles'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all groups in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for `ListGroupsRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.Group|Group}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listGroupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listGroups( - request?: protos.google.cloud.migrationcenter.v1.IListGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IGroup[], - protos.google.cloud.migrationcenter.v1.IListGroupsRequest|null, - protos.google.cloud.migrationcenter.v1.IListGroupsResponse - ]>; - listGroups( - request: protos.google.cloud.migrationcenter.v1.IListGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListGroupsRequest, - protos.google.cloud.migrationcenter.v1.IListGroupsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IGroup>): void; - listGroups( - request: protos.google.cloud.migrationcenter.v1.IListGroupsRequest, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListGroupsRequest, - protos.google.cloud.migrationcenter.v1.IListGroupsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IGroup>): void; - listGroups( - request?: protos.google.cloud.migrationcenter.v1.IListGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListGroupsRequest, - protos.google.cloud.migrationcenter.v1.IListGroupsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IGroup>, - callback?: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListGroupsRequest, - protos.google.cloud.migrationcenter.v1.IListGroupsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IGroup>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IGroup[], - protos.google.cloud.migrationcenter.v1.IListGroupsRequest|null, - protos.google.cloud.migrationcenter.v1.IListGroupsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listGroups(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for `ListGroupsRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @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 protos.google.cloud.migrationcenter.v1.Group|Group} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listGroupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listGroupsStream( - request?: protos.google.cloud.migrationcenter.v1.IListGroupsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listGroups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listGroups.createStream( - this.innerApiCalls.listGroups as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listGroups`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for `ListGroupsRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.migrationcenter.v1.Group|Group}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.list_groups.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_ListGroups_async - */ - listGroupsAsync( - request?: protos.google.cloud.migrationcenter.v1.IListGroupsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listGroups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listGroups.asyncIterate( - this.innerApiCalls['listGroups'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all error frames in a given source and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value (the source) for `ListErrorFramesRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {google.cloud.migrationcenter.v1.ErrorFrameView} [request.view] - * Optional. An optional view mode to control the level of details of each - * error frame. The default is a BASIC frame view. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.ErrorFrame|ErrorFrame}. - * 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 `listErrorFramesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listErrorFrames( - request?: protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IErrorFrame[], - protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest|null, - protos.google.cloud.migrationcenter.v1.IListErrorFramesResponse - ]>; - listErrorFrames( - request: protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, - protos.google.cloud.migrationcenter.v1.IListErrorFramesResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IErrorFrame>): void; - listErrorFrames( - request: protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, - protos.google.cloud.migrationcenter.v1.IListErrorFramesResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IErrorFrame>): void; - listErrorFrames( - request?: protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, - protos.google.cloud.migrationcenter.v1.IListErrorFramesResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IErrorFrame>, - callback?: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, - protos.google.cloud.migrationcenter.v1.IListErrorFramesResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IErrorFrame>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IErrorFrame[], - protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest|null, - protos.google.cloud.migrationcenter.v1.IListErrorFramesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listErrorFrames(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. Parent value (the source) for `ListErrorFramesRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {google.cloud.migrationcenter.v1.ErrorFrameView} [request.view] - * Optional. An optional view mode to control the level of details of each - * error frame. The default is a BASIC frame view. - * @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 protos.google.cloud.migrationcenter.v1.ErrorFrame|ErrorFrame} 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 `listErrorFramesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listErrorFramesStream( - request?: protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, - 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['listErrorFrames']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listErrorFrames.createStream( - this.innerApiCalls.listErrorFrames as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listErrorFrames`, 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. Parent value (the source) for `ListErrorFramesRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {google.cloud.migrationcenter.v1.ErrorFrameView} [request.view] - * Optional. An optional view mode to control the level of details of each - * error frame. The default is a BASIC frame view. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.migrationcenter.v1.ErrorFrame|ErrorFrame}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.list_error_frames.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_ListErrorFrames_async - */ - listErrorFramesAsync( - request?: protos.google.cloud.migrationcenter.v1.IListErrorFramesRequest, - 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['listErrorFrames']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listErrorFrames.asyncIterate( - this.innerApiCalls['listErrorFrames'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all the sources in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for `ListSourcesRequest`. - * @param {number} request.pageSize - * Requested page size. The server may return fewer items than requested. - * If unspecified, the server will pick an appropriate default value. - * @param {string} request.pageToken - * A token identifying a page of results that the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.Source|Source}. - * 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 `listSourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSources( - request?: protos.google.cloud.migrationcenter.v1.IListSourcesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.ISource[], - protos.google.cloud.migrationcenter.v1.IListSourcesRequest|null, - protos.google.cloud.migrationcenter.v1.IListSourcesResponse - ]>; - listSources( - request: protos.google.cloud.migrationcenter.v1.IListSourcesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListSourcesRequest, - protos.google.cloud.migrationcenter.v1.IListSourcesResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.ISource>): void; - listSources( - request: protos.google.cloud.migrationcenter.v1.IListSourcesRequest, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListSourcesRequest, - protos.google.cloud.migrationcenter.v1.IListSourcesResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.ISource>): void; - listSources( - request?: protos.google.cloud.migrationcenter.v1.IListSourcesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListSourcesRequest, - protos.google.cloud.migrationcenter.v1.IListSourcesResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.ISource>, - callback?: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListSourcesRequest, - protos.google.cloud.migrationcenter.v1.IListSourcesResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.ISource>): - Promise<[ - protos.google.cloud.migrationcenter.v1.ISource[], - protos.google.cloud.migrationcenter.v1.IListSourcesRequest|null, - protos.google.cloud.migrationcenter.v1.IListSourcesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listSources(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. Parent value for `ListSourcesRequest`. - * @param {number} request.pageSize - * Requested page size. The server may return fewer items than requested. - * If unspecified, the server will pick an appropriate default value. - * @param {string} request.pageToken - * A token identifying a page of results that the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @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 protos.google.cloud.migrationcenter.v1.Source|Source} 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 `listSourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSourcesStream( - request?: protos.google.cloud.migrationcenter.v1.IListSourcesRequest, - 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['listSources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSources.createStream( - this.innerApiCalls.listSources as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSources`, 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. Parent value for `ListSourcesRequest`. - * @param {number} request.pageSize - * Requested page size. The server may return fewer items than requested. - * If unspecified, the server will pick an appropriate default value. - * @param {string} request.pageToken - * A token identifying a page of results that the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.migrationcenter.v1.Source|Source}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.list_sources.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_ListSources_async - */ - listSourcesAsync( - request?: protos.google.cloud.migrationcenter.v1.IListSourcesRequest, - 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['listSources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSources.asyncIterate( - this.innerApiCalls['listSources'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all the preference sets in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for `ListPreferenceSetsRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, at most 500 preference sets will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.PreferenceSet|PreferenceSet}. - * 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 `listPreferenceSetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listPreferenceSets( - request?: protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IPreferenceSet[], - protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest|null, - protos.google.cloud.migrationcenter.v1.IListPreferenceSetsResponse - ]>; - listPreferenceSets( - request: protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, - protos.google.cloud.migrationcenter.v1.IListPreferenceSetsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IPreferenceSet>): void; - listPreferenceSets( - request: protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, - protos.google.cloud.migrationcenter.v1.IListPreferenceSetsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IPreferenceSet>): void; - listPreferenceSets( - request?: protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, - protos.google.cloud.migrationcenter.v1.IListPreferenceSetsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IPreferenceSet>, - callback?: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, - protos.google.cloud.migrationcenter.v1.IListPreferenceSetsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IPreferenceSet>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IPreferenceSet[], - protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest|null, - protos.google.cloud.migrationcenter.v1.IListPreferenceSetsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listPreferenceSets(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. Parent value for `ListPreferenceSetsRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, at most 500 preference sets will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @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 protos.google.cloud.migrationcenter.v1.PreferenceSet|PreferenceSet} 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 `listPreferenceSetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listPreferenceSetsStream( - request?: protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, - 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['listPreferenceSets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPreferenceSets.createStream( - this.innerApiCalls.listPreferenceSets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listPreferenceSets`, 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. Parent value for `ListPreferenceSetsRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, at most 500 preference sets will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.migrationcenter.v1.PreferenceSet|PreferenceSet}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.list_preference_sets.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_ListPreferenceSets_async - */ - listPreferenceSetsAsync( - request?: protos.google.cloud.migrationcenter.v1.IListPreferenceSetsRequest, - 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['listPreferenceSets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPreferenceSets.asyncIterate( - this.innerApiCalls['listPreferenceSets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists ReportConfigs in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for `ListReportConfigsRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.ReportConfig|ReportConfig}. - * 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 `listReportConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listReportConfigs( - request?: protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IReportConfig[], - protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest|null, - protos.google.cloud.migrationcenter.v1.IListReportConfigsResponse - ]>; - listReportConfigs( - request: protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, - protos.google.cloud.migrationcenter.v1.IListReportConfigsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IReportConfig>): void; - listReportConfigs( - request: protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, - protos.google.cloud.migrationcenter.v1.IListReportConfigsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IReportConfig>): void; - listReportConfigs( - request?: protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, - protos.google.cloud.migrationcenter.v1.IListReportConfigsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IReportConfig>, - callback?: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, - protos.google.cloud.migrationcenter.v1.IListReportConfigsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IReportConfig>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IReportConfig[], - protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest|null, - protos.google.cloud.migrationcenter.v1.IListReportConfigsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listReportConfigs(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. Parent value for `ListReportConfigsRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @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 protos.google.cloud.migrationcenter.v1.ReportConfig|ReportConfig} 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 `listReportConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listReportConfigsStream( - request?: protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, - 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['listReportConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listReportConfigs.createStream( - this.innerApiCalls.listReportConfigs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listReportConfigs`, 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. Parent value for `ListReportConfigsRequest`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.migrationcenter.v1.ReportConfig|ReportConfig}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.list_report_configs.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_ListReportConfigs_async - */ - listReportConfigsAsync( - request?: protos.google.cloud.migrationcenter.v1.IListReportConfigsRequest, - 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['listReportConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listReportConfigs.asyncIterate( - this.innerApiCalls['listReportConfigs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists Reports in a given ReportConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for `ListReportsRequest`. - * @param {number} request.pageSize - * Requested page size. The server may return fewer items than requested. - * If unspecified, the server will pick an appropriate default value. - * @param {string} request.pageToken - * A token identifying a page of results that the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {google.cloud.migrationcenter.v1.ReportView} request.view - * Determines what information to retrieve for each Report. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.migrationcenter.v1.Report|Report}. - * 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 `listReportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listReports( - request?: protos.google.cloud.migrationcenter.v1.IListReportsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.migrationcenter.v1.IReport[], - protos.google.cloud.migrationcenter.v1.IListReportsRequest|null, - protos.google.cloud.migrationcenter.v1.IListReportsResponse - ]>; - listReports( - request: protos.google.cloud.migrationcenter.v1.IListReportsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListReportsRequest, - protos.google.cloud.migrationcenter.v1.IListReportsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IReport>): void; - listReports( - request: protos.google.cloud.migrationcenter.v1.IListReportsRequest, - callback: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListReportsRequest, - protos.google.cloud.migrationcenter.v1.IListReportsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IReport>): void; - listReports( - request?: protos.google.cloud.migrationcenter.v1.IListReportsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListReportsRequest, - protos.google.cloud.migrationcenter.v1.IListReportsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IReport>, - callback?: PaginationCallback< - protos.google.cloud.migrationcenter.v1.IListReportsRequest, - protos.google.cloud.migrationcenter.v1.IListReportsResponse|null|undefined, - protos.google.cloud.migrationcenter.v1.IReport>): - Promise<[ - protos.google.cloud.migrationcenter.v1.IReport[], - protos.google.cloud.migrationcenter.v1.IListReportsRequest|null, - protos.google.cloud.migrationcenter.v1.IListReportsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listReports(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. Parent value for `ListReportsRequest`. - * @param {number} request.pageSize - * Requested page size. The server may return fewer items than requested. - * If unspecified, the server will pick an appropriate default value. - * @param {string} request.pageToken - * A token identifying a page of results that the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {google.cloud.migrationcenter.v1.ReportView} request.view - * Determines what information to retrieve for each Report. - * @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 protos.google.cloud.migrationcenter.v1.Report|Report} 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 `listReportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listReportsStream( - request?: protos.google.cloud.migrationcenter.v1.IListReportsRequest, - 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['listReports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listReports.createStream( - this.innerApiCalls.listReports as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listReports`, 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. Parent value for `ListReportsRequest`. - * @param {number} request.pageSize - * Requested page size. The server may return fewer items than requested. - * If unspecified, the server will pick an appropriate default value. - * @param {string} request.pageToken - * A token identifying a page of results that the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {google.cloud.migrationcenter.v1.ReportView} request.view - * Determines what information to retrieve for each Report. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.migrationcenter.v1.Report|Report}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/migration_center.list_reports.js - * region_tag:migrationcenter_v1_generated_MigrationCenter_ListReports_async - */ - listReportsAsync( - request?: protos.google.cloud.migrationcenter.v1.IListReportsRequest, - 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['listReports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listReports.asyncIterate( - this.innerApiCalls['listReports'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified asset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} asset - * @returns {string} Resource name string. - */ - assetPath(project:string,location:string,asset:string) { - return this.pathTemplates.assetPathTemplate.render({ - project: project, - location: location, - asset: asset, - }); - } - - /** - * Parse the project from Asset resource. - * - * @param {string} assetName - * A fully-qualified path representing Asset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAssetName(assetName: string) { - return this.pathTemplates.assetPathTemplate.match(assetName).project; - } - - /** - * Parse the location from Asset resource. - * - * @param {string} assetName - * A fully-qualified path representing Asset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAssetName(assetName: string) { - return this.pathTemplates.assetPathTemplate.match(assetName).location; - } - - /** - * Parse the asset from Asset resource. - * - * @param {string} assetName - * A fully-qualified path representing Asset resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromAssetName(assetName: string) { - return this.pathTemplates.assetPathTemplate.match(assetName).asset; - } - - /** - * Return a fully-qualified errorFrame resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} source - * @param {string} error_frame - * @returns {string} Resource name string. - */ - errorFramePath(project:string,location:string,source:string,errorFrame:string) { - return this.pathTemplates.errorFramePathTemplate.render({ - project: project, - location: location, - source: source, - error_frame: errorFrame, - }); - } - - /** - * Parse the project from ErrorFrame resource. - * - * @param {string} errorFrameName - * A fully-qualified path representing ErrorFrame resource. - * @returns {string} A string representing the project. - */ - matchProjectFromErrorFrameName(errorFrameName: string) { - return this.pathTemplates.errorFramePathTemplate.match(errorFrameName).project; - } - - /** - * Parse the location from ErrorFrame resource. - * - * @param {string} errorFrameName - * A fully-qualified path representing ErrorFrame resource. - * @returns {string} A string representing the location. - */ - matchLocationFromErrorFrameName(errorFrameName: string) { - return this.pathTemplates.errorFramePathTemplate.match(errorFrameName).location; - } - - /** - * Parse the source from ErrorFrame resource. - * - * @param {string} errorFrameName - * A fully-qualified path representing ErrorFrame resource. - * @returns {string} A string representing the source. - */ - matchSourceFromErrorFrameName(errorFrameName: string) { - return this.pathTemplates.errorFramePathTemplate.match(errorFrameName).source; - } - - /** - * Parse the error_frame from ErrorFrame resource. - * - * @param {string} errorFrameName - * A fully-qualified path representing ErrorFrame resource. - * @returns {string} A string representing the error_frame. - */ - matchErrorFrameFromErrorFrameName(errorFrameName: string) { - return this.pathTemplates.errorFramePathTemplate.match(errorFrameName).error_frame; - } - - /** - * Return a fully-qualified group resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} group - * @returns {string} Resource name string. - */ - groupPath(project:string,location:string,group:string) { - return this.pathTemplates.groupPathTemplate.render({ - project: project, - location: location, - group: group, - }); - } - - /** - * Parse the project from Group resource. - * - * @param {string} groupName - * A fully-qualified path representing Group resource. - * @returns {string} A string representing the project. - */ - matchProjectFromGroupName(groupName: string) { - return this.pathTemplates.groupPathTemplate.match(groupName).project; - } - - /** - * Parse the location from Group resource. - * - * @param {string} groupName - * A fully-qualified path representing Group resource. - * @returns {string} A string representing the location. - */ - matchLocationFromGroupName(groupName: string) { - return this.pathTemplates.groupPathTemplate.match(groupName).location; - } - - /** - * Parse the group from Group resource. - * - * @param {string} groupName - * A fully-qualified path representing Group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromGroupName(groupName: string) { - return this.pathTemplates.groupPathTemplate.match(groupName).group; - } - - /** - * Return a fully-qualified importDataFile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} import_job - * @param {string} import_data_file - * @returns {string} Resource name string. - */ - importDataFilePath(project:string,location:string,importJob:string,importDataFile:string) { - return this.pathTemplates.importDataFilePathTemplate.render({ - project: project, - location: location, - import_job: importJob, - import_data_file: importDataFile, - }); - } - - /** - * Parse the project from ImportDataFile resource. - * - * @param {string} importDataFileName - * A fully-qualified path representing ImportDataFile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromImportDataFileName(importDataFileName: string) { - return this.pathTemplates.importDataFilePathTemplate.match(importDataFileName).project; - } - - /** - * Parse the location from ImportDataFile resource. - * - * @param {string} importDataFileName - * A fully-qualified path representing ImportDataFile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromImportDataFileName(importDataFileName: string) { - return this.pathTemplates.importDataFilePathTemplate.match(importDataFileName).location; - } - - /** - * Parse the import_job from ImportDataFile resource. - * - * @param {string} importDataFileName - * A fully-qualified path representing ImportDataFile resource. - * @returns {string} A string representing the import_job. - */ - matchImportJobFromImportDataFileName(importDataFileName: string) { - return this.pathTemplates.importDataFilePathTemplate.match(importDataFileName).import_job; - } - - /** - * Parse the import_data_file from ImportDataFile resource. - * - * @param {string} importDataFileName - * A fully-qualified path representing ImportDataFile resource. - * @returns {string} A string representing the import_data_file. - */ - matchImportDataFileFromImportDataFileName(importDataFileName: string) { - return this.pathTemplates.importDataFilePathTemplate.match(importDataFileName).import_data_file; - } - - /** - * Return a fully-qualified importJob resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} import_job - * @returns {string} Resource name string. - */ - importJobPath(project:string,location:string,importJob:string) { - return this.pathTemplates.importJobPathTemplate.render({ - project: project, - location: location, - import_job: importJob, - }); - } - - /** - * Parse the project from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the project. - */ - matchProjectFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).project; - } - - /** - * Parse the location from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the location. - */ - matchLocationFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).location; - } - - /** - * Parse the import_job from ImportJob resource. - * - * @param {string} importJobName - * A fully-qualified path representing ImportJob resource. - * @returns {string} A string representing the import_job. - */ - matchImportJobFromImportJobName(importJobName: string) { - return this.pathTemplates.importJobPathTemplate.match(importJobName).import_job; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified preferenceSet resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} preference_set - * @returns {string} Resource name string. - */ - preferenceSetPath(project:string,location:string,preferenceSet:string) { - return this.pathTemplates.preferenceSetPathTemplate.render({ - project: project, - location: location, - preference_set: preferenceSet, - }); - } - - /** - * Parse the project from PreferenceSet resource. - * - * @param {string} preferenceSetName - * A fully-qualified path representing PreferenceSet resource. - * @returns {string} A string representing the project. - */ - matchProjectFromPreferenceSetName(preferenceSetName: string) { - return this.pathTemplates.preferenceSetPathTemplate.match(preferenceSetName).project; - } - - /** - * Parse the location from PreferenceSet resource. - * - * @param {string} preferenceSetName - * A fully-qualified path representing PreferenceSet resource. - * @returns {string} A string representing the location. - */ - matchLocationFromPreferenceSetName(preferenceSetName: string) { - return this.pathTemplates.preferenceSetPathTemplate.match(preferenceSetName).location; - } - - /** - * Parse the preference_set from PreferenceSet resource. - * - * @param {string} preferenceSetName - * A fully-qualified path representing PreferenceSet resource. - * @returns {string} A string representing the preference_set. - */ - matchPreferenceSetFromPreferenceSetName(preferenceSetName: string) { - return this.pathTemplates.preferenceSetPathTemplate.match(preferenceSetName).preference_set; - } - - /** - * 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 report resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} report_config - * @param {string} report - * @returns {string} Resource name string. - */ - reportPath(project:string,location:string,reportConfig:string,report:string) { - return this.pathTemplates.reportPathTemplate.render({ - project: project, - location: location, - report_config: reportConfig, - report: report, - }); - } - - /** - * Parse the project from Report resource. - * - * @param {string} reportName - * A fully-qualified path representing Report resource. - * @returns {string} A string representing the project. - */ - matchProjectFromReportName(reportName: string) { - return this.pathTemplates.reportPathTemplate.match(reportName).project; - } - - /** - * Parse the location from Report resource. - * - * @param {string} reportName - * A fully-qualified path representing Report resource. - * @returns {string} A string representing the location. - */ - matchLocationFromReportName(reportName: string) { - return this.pathTemplates.reportPathTemplate.match(reportName).location; - } - - /** - * Parse the report_config from Report resource. - * - * @param {string} reportName - * A fully-qualified path representing Report resource. - * @returns {string} A string representing the report_config. - */ - matchReportConfigFromReportName(reportName: string) { - return this.pathTemplates.reportPathTemplate.match(reportName).report_config; - } - - /** - * Parse the report from Report resource. - * - * @param {string} reportName - * A fully-qualified path representing Report resource. - * @returns {string} A string representing the report. - */ - matchReportFromReportName(reportName: string) { - return this.pathTemplates.reportPathTemplate.match(reportName).report; - } - - /** - * Return a fully-qualified reportConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} report_config - * @returns {string} Resource name string. - */ - reportConfigPath(project:string,location:string,reportConfig:string) { - return this.pathTemplates.reportConfigPathTemplate.render({ - project: project, - location: location, - report_config: reportConfig, - }); - } - - /** - * Parse the project from ReportConfig resource. - * - * @param {string} reportConfigName - * A fully-qualified path representing ReportConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromReportConfigName(reportConfigName: string) { - return this.pathTemplates.reportConfigPathTemplate.match(reportConfigName).project; - } - - /** - * Parse the location from ReportConfig resource. - * - * @param {string} reportConfigName - * A fully-qualified path representing ReportConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromReportConfigName(reportConfigName: string) { - return this.pathTemplates.reportConfigPathTemplate.match(reportConfigName).location; - } - - /** - * Parse the report_config from ReportConfig resource. - * - * @param {string} reportConfigName - * A fully-qualified path representing ReportConfig resource. - * @returns {string} A string representing the report_config. - */ - matchReportConfigFromReportConfigName(reportConfigName: string) { - return this.pathTemplates.reportConfigPathTemplate.match(reportConfigName).report_config; - } - - /** - * Return a fully-qualified settings resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - settingsPath(project:string,location:string) { - return this.pathTemplates.settingsPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Settings resource. - * - * @param {string} settingsName - * A fully-qualified path representing Settings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSettingsName(settingsName: string) { - return this.pathTemplates.settingsPathTemplate.match(settingsName).project; - } - - /** - * Parse the location from Settings resource. - * - * @param {string} settingsName - * A fully-qualified path representing Settings resource. - * @returns {string} A string representing the location. - */ - matchLocationFromSettingsName(settingsName: string) { - return this.pathTemplates.settingsPathTemplate.match(settingsName).location; - } - - /** - * Return a fully-qualified source resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} source - * @returns {string} Resource name string. - */ - sourcePath(project:string,location:string,source:string) { - return this.pathTemplates.sourcePathTemplate.render({ - project: project, - location: location, - source: source, - }); - } - - /** - * Parse the project from Source resource. - * - * @param {string} sourceName - * A fully-qualified path representing Source resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSourceName(sourceName: string) { - return this.pathTemplates.sourcePathTemplate.match(sourceName).project; - } - - /** - * Parse the location from Source resource. - * - * @param {string} sourceName - * A fully-qualified path representing Source resource. - * @returns {string} A string representing the location. - */ - matchLocationFromSourceName(sourceName: string) { - return this.pathTemplates.sourcePathTemplate.match(sourceName).location; - } - - /** - * Parse the source from Source resource. - * - * @param {string} sourceName - * A fully-qualified path representing Source resource. - * @returns {string} A string representing the source. - */ - matchSourceFromSourceName(sourceName: string) { - return this.pathTemplates.sourcePathTemplate.match(sourceName).source; - } - - /** - * 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.migrationCenterStub && !this._terminated) { - return this.migrationCenterStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_client_config.json b/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_client_config.json deleted file mode 100644 index bfe0532b5d2..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_client_config.json +++ /dev/null @@ -1,266 +0,0 @@ -{ - "interfaces": { - "google.cloud.migrationcenter.v1.MigrationCenter": { - "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": { - "ListAssets": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetAsset": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateAsset": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "BatchUpdateAssets": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteAsset": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "BatchDeleteAssets": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReportAssetFrames": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AggregateAssetsValues": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateImportJob": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListImportJobs": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetImportJob": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteImportJob": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateImportJob": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ValidateImportJob": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RunImportJob": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetImportDataFile": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListImportDataFiles": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateImportDataFile": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteImportDataFile": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListGroups": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetGroup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateGroup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateGroup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteGroup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AddAssetsToGroup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RemoveAssetsFromGroup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListErrorFrames": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetErrorFrame": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListSources": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateSource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteSource": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListPreferenceSets": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetPreferenceSet": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreatePreferenceSet": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdatePreferenceSet": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeletePreferenceSet": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSettings": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSettings": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateReportConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetReportConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListReportConfigs": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteReportConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateReport": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetReport": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListReports": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteReport": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_proto_list.json b/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_proto_list.json deleted file mode 100644 index fe313474b10..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/src/v1/migration_center_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/migrationcenter/v1/migrationcenter.proto" -] diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-migrationcenter/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index ccaaf8f06d7..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/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 migrationcenter = require('@google-cloud/migrationcenter'); - -function main() { - const migrationCenterClient = new migrationcenter.MigrationCenterClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-migrationcenter/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index eddee14f908..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/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 {MigrationCenterClient} from '@google-cloud/migrationcenter'; - -// check that the client class type name can be used -function doStuffWithMigrationCenterClient(client: MigrationCenterClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const migrationCenterClient = new MigrationCenterClient(); - doStuffWithMigrationCenterClient(migrationCenterClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/system-test/install.ts b/owl-bot-staging/google-cloud-migrationcenter/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/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-migrationcenter/v1/test/gapic_migration_center_v1.ts b/owl-bot-staging/google-cloud-migrationcenter/v1/test/gapic_migration_center_v1.ts deleted file mode 100644 index ed30550ccb4..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/v1/test/gapic_migration_center_v1.ts +++ /dev/null @@ -1,8680 +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 migrationcenterModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.MigrationCenterClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = migrationcenterModule.v1.MigrationCenterClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = migrationcenterModule.v1.MigrationCenterClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = migrationcenterModule.v1.MigrationCenterClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new migrationcenterModule.v1.MigrationCenterClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.migrationCenterStub, undefined); - await client.initialize(); - assert(client.migrationCenterStub); - }); - - it('has close method for the initialized client', done => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.migrationCenterStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.migrationCenterStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new migrationcenterModule.v1.MigrationCenterClient({ - 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 migrationcenterModule.v1.MigrationCenterClient({ - 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('getAsset', () => { - it('invokes getAsset without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.Asset() - ); - client.innerApiCalls.getAsset = stubSimpleCall(expectedResponse); - const [response] = await client.getAsset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAsset without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.Asset() - ); - client.innerApiCalls.getAsset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAsset( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IAsset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAsset with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAsset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAsset(request), expectedError); - const actualRequest = (client.innerApiCalls.getAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAsset with closed client', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetAssetRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAsset(request), expectedError); - }); - }); - - describe('updateAsset', () => { - it('invokes updateAsset without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateAssetRequest() - ); - request.asset ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateAssetRequest', ['asset', 'name']); - request.asset.name = defaultValue1; - const expectedHeaderRequestParams = `asset.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.Asset() - ); - client.innerApiCalls.updateAsset = stubSimpleCall(expectedResponse); - const [response] = await client.updateAsset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAsset without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateAssetRequest() - ); - request.asset ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateAssetRequest', ['asset', 'name']); - request.asset.name = defaultValue1; - const expectedHeaderRequestParams = `asset.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.Asset() - ); - client.innerApiCalls.updateAsset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAsset( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IAsset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAsset with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateAssetRequest() - ); - request.asset ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateAssetRequest', ['asset', 'name']); - request.asset.name = defaultValue1; - const expectedHeaderRequestParams = `asset.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAsset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAsset(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAsset with closed client', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateAssetRequest() - ); - request.asset ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateAssetRequest', ['asset', 'name']); - request.asset.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateAsset(request), expectedError); - }); - }); - - describe('batchUpdateAssets', () => { - it('invokes batchUpdateAssets without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.BatchUpdateAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.BatchUpdateAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.BatchUpdateAssetsResponse() - ); - client.innerApiCalls.batchUpdateAssets = stubSimpleCall(expectedResponse); - const [response] = await client.batchUpdateAssets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchUpdateAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchUpdateAssets without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.BatchUpdateAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.BatchUpdateAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.BatchUpdateAssetsResponse() - ); - client.innerApiCalls.batchUpdateAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchUpdateAssets( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IBatchUpdateAssetsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchUpdateAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchUpdateAssets with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.BatchUpdateAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.BatchUpdateAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchUpdateAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.batchUpdateAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchUpdateAssets with closed client', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.BatchUpdateAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.BatchUpdateAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.batchUpdateAssets(request), expectedError); - }); - }); - - describe('deleteAsset', () => { - it('invokes deleteAsset without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAsset = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAsset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAsset without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAsset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAsset( - 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.deleteAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAsset with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAsset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAsset(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAsset with closed client', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteAssetRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteAsset(request), expectedError); - }); - }); - - describe('batchDeleteAssets', () => { - it('invokes batchDeleteAssets without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.BatchDeleteAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.BatchDeleteAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.batchDeleteAssets = stubSimpleCall(expectedResponse); - const [response] = await client.batchDeleteAssets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchDeleteAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchDeleteAssets without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.BatchDeleteAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.BatchDeleteAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.batchDeleteAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchDeleteAssets( - 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.batchDeleteAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchDeleteAssets with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.BatchDeleteAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.BatchDeleteAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchDeleteAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.batchDeleteAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchDeleteAssets with closed client', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.BatchDeleteAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.BatchDeleteAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.batchDeleteAssets(request), expectedError); - }); - }); - - describe('reportAssetFrames', () => { - it('invokes reportAssetFrames without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ReportAssetFramesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ReportAssetFramesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ReportAssetFramesResponse() - ); - client.innerApiCalls.reportAssetFrames = stubSimpleCall(expectedResponse); - const [response] = await client.reportAssetFrames(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reportAssetFrames as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reportAssetFrames as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reportAssetFrames without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ReportAssetFramesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ReportAssetFramesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ReportAssetFramesResponse() - ); - client.innerApiCalls.reportAssetFrames = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reportAssetFrames( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IReportAssetFramesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reportAssetFrames as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reportAssetFrames as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reportAssetFrames with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ReportAssetFramesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ReportAssetFramesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.reportAssetFrames = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.reportAssetFrames(request), expectedError); - const actualRequest = (client.innerApiCalls.reportAssetFrames as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reportAssetFrames as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reportAssetFrames with closed client', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ReportAssetFramesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ReportAssetFramesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.reportAssetFrames(request), expectedError); - }); - }); - - describe('aggregateAssetsValues', () => { - it('invokes aggregateAssetsValues without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.AggregateAssetsValuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.AggregateAssetsValuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.AggregateAssetsValuesResponse() - ); - client.innerApiCalls.aggregateAssetsValues = stubSimpleCall(expectedResponse); - const [response] = await client.aggregateAssetsValues(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.aggregateAssetsValues as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.aggregateAssetsValues as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes aggregateAssetsValues without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.AggregateAssetsValuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.AggregateAssetsValuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.AggregateAssetsValuesResponse() - ); - client.innerApiCalls.aggregateAssetsValues = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.aggregateAssetsValues( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IAggregateAssetsValuesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.aggregateAssetsValues as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.aggregateAssetsValues as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes aggregateAssetsValues with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.AggregateAssetsValuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.AggregateAssetsValuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.aggregateAssetsValues = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.aggregateAssetsValues(request), expectedError); - const actualRequest = (client.innerApiCalls.aggregateAssetsValues as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.aggregateAssetsValues as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes aggregateAssetsValues with closed client', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.AggregateAssetsValuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.AggregateAssetsValuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.aggregateAssetsValues(request), expectedError); - }); - }); - - describe('getImportJob', () => { - it('invokes getImportJob without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ImportJob() - ); - client.innerApiCalls.getImportJob = stubSimpleCall(expectedResponse); - const [response] = await client.getImportJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getImportJob without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ImportJob() - ); - client.innerApiCalls.getImportJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getImportJob( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IImportJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getImportJob with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getImportJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getImportJob(request), expectedError); - const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getImportJob with closed client', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getImportJob(request), expectedError); - }); - }); - - describe('getImportDataFile', () => { - it('invokes getImportDataFile without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetImportDataFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetImportDataFileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ImportDataFile() - ); - client.innerApiCalls.getImportDataFile = stubSimpleCall(expectedResponse); - const [response] = await client.getImportDataFile(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getImportDataFile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImportDataFile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getImportDataFile without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetImportDataFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetImportDataFileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ImportDataFile() - ); - client.innerApiCalls.getImportDataFile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getImportDataFile( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IImportDataFile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getImportDataFile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImportDataFile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getImportDataFile with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetImportDataFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetImportDataFileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getImportDataFile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getImportDataFile(request), expectedError); - const actualRequest = (client.innerApiCalls.getImportDataFile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImportDataFile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getImportDataFile with closed client', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetImportDataFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetImportDataFileRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getImportDataFile(request), expectedError); - }); - }); - - describe('getGroup', () => { - it('invokes getGroup without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.Group() - ); - client.innerApiCalls.getGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGroup without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.Group() - ); - client.innerApiCalls.getGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGroup( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGroup with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGroup with closed client', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getGroup(request), expectedError); - }); - }); - - describe('getErrorFrame', () => { - it('invokes getErrorFrame without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetErrorFrameRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetErrorFrameRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ErrorFrame() - ); - client.innerApiCalls.getErrorFrame = stubSimpleCall(expectedResponse); - const [response] = await client.getErrorFrame(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getErrorFrame as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getErrorFrame as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getErrorFrame without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetErrorFrameRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetErrorFrameRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ErrorFrame() - ); - client.innerApiCalls.getErrorFrame = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getErrorFrame( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IErrorFrame|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getErrorFrame as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getErrorFrame as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getErrorFrame with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetErrorFrameRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetErrorFrameRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getErrorFrame = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getErrorFrame(request), expectedError); - const actualRequest = (client.innerApiCalls.getErrorFrame as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getErrorFrame as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getErrorFrame with closed client', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetErrorFrameRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetErrorFrameRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getErrorFrame(request), expectedError); - }); - }); - - describe('getSource', () => { - it('invokes getSource without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.Source() - ); - client.innerApiCalls.getSource = stubSimpleCall(expectedResponse); - const [response] = await client.getSource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSource without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.Source() - ); - client.innerApiCalls.getSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSource( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSource with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSource(request), expectedError); - const actualRequest = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSource with closed client', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSource(request), expectedError); - }); - }); - - describe('getPreferenceSet', () => { - it('invokes getPreferenceSet without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetPreferenceSetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetPreferenceSetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.PreferenceSet() - ); - client.innerApiCalls.getPreferenceSet = stubSimpleCall(expectedResponse); - const [response] = await client.getPreferenceSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPreferenceSet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPreferenceSet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPreferenceSet without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetPreferenceSetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetPreferenceSetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.PreferenceSet() - ); - client.innerApiCalls.getPreferenceSet = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPreferenceSet( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IPreferenceSet|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPreferenceSet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPreferenceSet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPreferenceSet with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetPreferenceSetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetPreferenceSetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getPreferenceSet = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getPreferenceSet(request), expectedError); - const actualRequest = (client.innerApiCalls.getPreferenceSet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPreferenceSet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPreferenceSet with closed client', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetPreferenceSetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetPreferenceSetRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getPreferenceSet(request), expectedError); - }); - }); - - describe('getSettings', () => { - it('invokes getSettings without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.Settings() - ); - client.innerApiCalls.getSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.Settings() - ); - client.innerApiCalls.getSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSettings( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.ISettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings with closed client', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSettings(request), expectedError); - }); - }); - - describe('getReportConfig', () => { - it('invokes getReportConfig without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetReportConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetReportConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ReportConfig() - ); - client.innerApiCalls.getReportConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getReportConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getReportConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getReportConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReportConfig without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetReportConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetReportConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ReportConfig() - ); - client.innerApiCalls.getReportConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getReportConfig( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IReportConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getReportConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getReportConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReportConfig with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetReportConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetReportConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getReportConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getReportConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getReportConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getReportConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReportConfig with closed client', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetReportConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetReportConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getReportConfig(request), expectedError); - }); - }); - - describe('getReport', () => { - it('invokes getReport without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.Report() - ); - client.innerApiCalls.getReport = stubSimpleCall(expectedResponse); - const [response] = await client.getReport(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReport without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.Report() - ); - client.innerApiCalls.getReport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getReport( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IReport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReport with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getReport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getReport(request), expectedError); - const actualRequest = (client.innerApiCalls.getReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReport with closed client', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.GetReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.GetReportRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getReport(request), expectedError); - }); - }); - - describe('createImportJob', () => { - it('invokes createImportJob without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateImportJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createImportJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.createImportJob(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImportJob without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateImportJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createImportJob = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createImportJob( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImportJob with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateImportJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createImportJob = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createImportJob(request), expectedError); - const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImportJob with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateImportJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createImportJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createImportJob(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateImportJobProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateImportJobProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateImportJobProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateImportJobProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteImportJob', () => { - it('invokes deleteImportJob without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteImportJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteImportJob(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteImportJob without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteImportJob = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteImportJob( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteImportJob with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteImportJob = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteImportJob(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteImportJob with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteImportJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteImportJob(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteImportJobProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteImportJobProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteImportJobProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteImportJobProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateImportJob', () => { - it('invokes updateImportJob without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateImportJobRequest() - ); - request.importJob ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateImportJobRequest', ['importJob', 'name']); - request.importJob.name = defaultValue1; - const expectedHeaderRequestParams = `import_job.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateImportJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateImportJob(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateImportJob without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateImportJobRequest() - ); - request.importJob ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateImportJobRequest', ['importJob', 'name']); - request.importJob.name = defaultValue1; - const expectedHeaderRequestParams = `import_job.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateImportJob = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateImportJob( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateImportJob with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateImportJobRequest() - ); - request.importJob ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateImportJobRequest', ['importJob', 'name']); - request.importJob.name = defaultValue1; - const expectedHeaderRequestParams = `import_job.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateImportJob = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateImportJob(request), expectedError); - const actualRequest = (client.innerApiCalls.updateImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateImportJob with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateImportJobRequest() - ); - request.importJob ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateImportJobRequest', ['importJob', 'name']); - request.importJob.name = defaultValue1; - const expectedHeaderRequestParams = `import_job.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateImportJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateImportJob(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateImportJobProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateImportJobProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateImportJobProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateImportJobProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('validateImportJob', () => { - it('invokes validateImportJob without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ValidateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ValidateImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.validateImportJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.validateImportJob(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.validateImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.validateImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes validateImportJob without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ValidateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ValidateImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.validateImportJob = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.validateImportJob( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.validateImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.validateImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes validateImportJob with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ValidateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ValidateImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.validateImportJob = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.validateImportJob(request), expectedError); - const actualRequest = (client.innerApiCalls.validateImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.validateImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes validateImportJob with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ValidateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ValidateImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.validateImportJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.validateImportJob(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.validateImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.validateImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkValidateImportJobProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkValidateImportJobProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkValidateImportJobProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkValidateImportJobProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('runImportJob', () => { - it('invokes runImportJob without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.RunImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.RunImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runImportJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.runImportJob(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runImportJob without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.RunImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.RunImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runImportJob = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runImportJob( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runImportJob with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.RunImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.RunImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.runImportJob = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.runImportJob(request), expectedError); - const actualRequest = (client.innerApiCalls.runImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runImportJob with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.RunImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.RunImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.runImportJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.runImportJob(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.runImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRunImportJobProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRunImportJobProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRunImportJobProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRunImportJobProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createImportDataFile', () => { - it('invokes createImportDataFile without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateImportDataFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateImportDataFileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createImportDataFile = stubLongRunningCall(expectedResponse); - const [operation] = await client.createImportDataFile(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createImportDataFile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImportDataFile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImportDataFile without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateImportDataFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateImportDataFileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createImportDataFile = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createImportDataFile( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createImportDataFile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImportDataFile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImportDataFile with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateImportDataFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateImportDataFileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createImportDataFile = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createImportDataFile(request), expectedError); - const actualRequest = (client.innerApiCalls.createImportDataFile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImportDataFile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImportDataFile with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateImportDataFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateImportDataFileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createImportDataFile = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createImportDataFile(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createImportDataFile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImportDataFile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateImportDataFileProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateImportDataFileProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateImportDataFileProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateImportDataFileProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteImportDataFile', () => { - it('invokes deleteImportDataFile without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteImportDataFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteImportDataFileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteImportDataFile = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteImportDataFile(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteImportDataFile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteImportDataFile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteImportDataFile without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteImportDataFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteImportDataFileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteImportDataFile = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteImportDataFile( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteImportDataFile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteImportDataFile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteImportDataFile with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteImportDataFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteImportDataFileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteImportDataFile = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteImportDataFile(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteImportDataFile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteImportDataFile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteImportDataFile with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteImportDataFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteImportDataFileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteImportDataFile = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteImportDataFile(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteImportDataFile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteImportDataFile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteImportDataFileProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteImportDataFileProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteImportDataFileProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteImportDataFileProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createGroup', () => { - it('invokes createGroup without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGroup without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGroup with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGroup with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateGroupProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateGroupProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateGroup', () => { - it('invokes updateGroup without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedHeaderRequestParams = `group.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGroup without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedHeaderRequestParams = `group.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGroup with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedHeaderRequestParams = `group.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGroup with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedHeaderRequestParams = `group.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateGroupProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateGroupProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteGroup', () => { - it('invokes deleteGroup without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGroup without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGroup with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGroup with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteGroupProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteGroupProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('addAssetsToGroup', () => { - it('invokes addAssetsToGroup without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.AddAssetsToGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.AddAssetsToGroupRequest', ['group']); - request.group = defaultValue1; - const expectedHeaderRequestParams = `group=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addAssetsToGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.addAssetsToGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addAssetsToGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addAssetsToGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addAssetsToGroup without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.AddAssetsToGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.AddAssetsToGroupRequest', ['group']); - request.group = defaultValue1; - const expectedHeaderRequestParams = `group=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addAssetsToGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addAssetsToGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addAssetsToGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addAssetsToGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addAssetsToGroup with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.AddAssetsToGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.AddAssetsToGroupRequest', ['group']); - request.group = defaultValue1; - const expectedHeaderRequestParams = `group=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.addAssetsToGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.addAssetsToGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.addAssetsToGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addAssetsToGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addAssetsToGroup with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.AddAssetsToGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.AddAssetsToGroupRequest', ['group']); - request.group = defaultValue1; - const expectedHeaderRequestParams = `group=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.addAssetsToGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.addAssetsToGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.addAssetsToGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addAssetsToGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAddAssetsToGroupProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAddAssetsToGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAddAssetsToGroupProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAddAssetsToGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('removeAssetsFromGroup', () => { - it('invokes removeAssetsFromGroup without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.RemoveAssetsFromGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.RemoveAssetsFromGroupRequest', ['group']); - request.group = defaultValue1; - const expectedHeaderRequestParams = `group=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeAssetsFromGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.removeAssetsFromGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeAssetsFromGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeAssetsFromGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeAssetsFromGroup without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.RemoveAssetsFromGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.RemoveAssetsFromGroupRequest', ['group']); - request.group = defaultValue1; - const expectedHeaderRequestParams = `group=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeAssetsFromGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeAssetsFromGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeAssetsFromGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeAssetsFromGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeAssetsFromGroup with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.RemoveAssetsFromGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.RemoveAssetsFromGroupRequest', ['group']); - request.group = defaultValue1; - const expectedHeaderRequestParams = `group=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeAssetsFromGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.removeAssetsFromGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.removeAssetsFromGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeAssetsFromGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeAssetsFromGroup with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.RemoveAssetsFromGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.RemoveAssetsFromGroupRequest', ['group']); - request.group = defaultValue1; - const expectedHeaderRequestParams = `group=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeAssetsFromGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.removeAssetsFromGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.removeAssetsFromGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeAssetsFromGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRemoveAssetsFromGroupProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRemoveAssetsFromGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRemoveAssetsFromGroupProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRemoveAssetsFromGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createSource', () => { - it('invokes createSource without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSource = stubLongRunningCall(expectedResponse); - const [operation] = await client.createSource(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSource without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSource = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSource( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSource with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSource = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createSource(request), expectedError); - const actualRequest = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSource with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSource = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createSource(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateSourceProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateSourceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateSourceProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateSourceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateSource', () => { - it('invokes updateSource without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedHeaderRequestParams = `source.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSource = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateSource(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSource without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedHeaderRequestParams = `source.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSource = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSource( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSource with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedHeaderRequestParams = `source.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSource = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateSource(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSource with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedHeaderRequestParams = `source.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSource = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateSource(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateSourceProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateSourceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateSourceProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateSourceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteSource', () => { - it('invokes deleteSource without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSource = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteSource(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSource without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSource = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSource( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSource with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSource = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteSource(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSource with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSource = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteSource(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteSourceProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteSourceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteSourceProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteSourceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createPreferenceSet', () => { - it('invokes createPreferenceSet without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreatePreferenceSetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreatePreferenceSetRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPreferenceSet = stubLongRunningCall(expectedResponse); - const [operation] = await client.createPreferenceSet(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPreferenceSet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPreferenceSet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPreferenceSet without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreatePreferenceSetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreatePreferenceSetRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPreferenceSet = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createPreferenceSet( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPreferenceSet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPreferenceSet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPreferenceSet with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreatePreferenceSetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreatePreferenceSetRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPreferenceSet = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createPreferenceSet(request), expectedError); - const actualRequest = (client.innerApiCalls.createPreferenceSet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPreferenceSet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPreferenceSet with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreatePreferenceSetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreatePreferenceSetRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPreferenceSet = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createPreferenceSet(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createPreferenceSet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPreferenceSet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreatePreferenceSetProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreatePreferenceSetProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreatePreferenceSetProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreatePreferenceSetProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updatePreferenceSet', () => { - it('invokes updatePreferenceSet without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdatePreferenceSetRequest() - ); - request.preferenceSet ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdatePreferenceSetRequest', ['preferenceSet', 'name']); - request.preferenceSet.name = defaultValue1; - const expectedHeaderRequestParams = `preference_set.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updatePreferenceSet = stubLongRunningCall(expectedResponse); - const [operation] = await client.updatePreferenceSet(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updatePreferenceSet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePreferenceSet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updatePreferenceSet without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdatePreferenceSetRequest() - ); - request.preferenceSet ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdatePreferenceSetRequest', ['preferenceSet', 'name']); - request.preferenceSet.name = defaultValue1; - const expectedHeaderRequestParams = `preference_set.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updatePreferenceSet = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updatePreferenceSet( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updatePreferenceSet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePreferenceSet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updatePreferenceSet with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdatePreferenceSetRequest() - ); - request.preferenceSet ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdatePreferenceSetRequest', ['preferenceSet', 'name']); - request.preferenceSet.name = defaultValue1; - const expectedHeaderRequestParams = `preference_set.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updatePreferenceSet = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updatePreferenceSet(request), expectedError); - const actualRequest = (client.innerApiCalls.updatePreferenceSet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePreferenceSet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updatePreferenceSet with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdatePreferenceSetRequest() - ); - request.preferenceSet ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdatePreferenceSetRequest', ['preferenceSet', 'name']); - request.preferenceSet.name = defaultValue1; - const expectedHeaderRequestParams = `preference_set.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updatePreferenceSet = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updatePreferenceSet(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updatePreferenceSet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePreferenceSet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdatePreferenceSetProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdatePreferenceSetProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdatePreferenceSetProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdatePreferenceSetProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deletePreferenceSet', () => { - it('invokes deletePreferenceSet without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeletePreferenceSetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeletePreferenceSetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePreferenceSet = stubLongRunningCall(expectedResponse); - const [operation] = await client.deletePreferenceSet(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePreferenceSet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePreferenceSet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePreferenceSet without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeletePreferenceSetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeletePreferenceSetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePreferenceSet = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deletePreferenceSet( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePreferenceSet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePreferenceSet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePreferenceSet with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeletePreferenceSetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeletePreferenceSetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePreferenceSet = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deletePreferenceSet(request), expectedError); - const actualRequest = (client.innerApiCalls.deletePreferenceSet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePreferenceSet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePreferenceSet with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeletePreferenceSetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeletePreferenceSetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePreferenceSet = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deletePreferenceSet(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deletePreferenceSet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePreferenceSet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeletePreferenceSetProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeletePreferenceSetProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeletePreferenceSetProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeletePreferenceSetProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateSettings', () => { - it('invokes updateSettings without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateSettingsRequest() - ); - request.settings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateSettingsRequest', ['settings', 'name']); - request.settings.name = defaultValue1; - const expectedHeaderRequestParams = `settings.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSettings = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateSettings(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateSettingsRequest() - ); - request.settings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateSettingsRequest', ['settings', 'name']); - request.settings.name = defaultValue1; - const expectedHeaderRequestParams = `settings.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSettings = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSettings( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateSettingsRequest() - ); - request.settings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateSettingsRequest', ['settings', 'name']); - request.settings.name = defaultValue1; - const expectedHeaderRequestParams = `settings.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSettings = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.UpdateSettingsRequest() - ); - request.settings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.UpdateSettingsRequest', ['settings', 'name']); - request.settings.name = defaultValue1; - const expectedHeaderRequestParams = `settings.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSettings = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateSettings(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateSettingsProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateSettingsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateSettingsProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateSettingsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createReportConfig', () => { - it('invokes createReportConfig without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateReportConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateReportConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createReportConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.createReportConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createReportConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createReportConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReportConfig without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateReportConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateReportConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createReportConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createReportConfig( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createReportConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createReportConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReportConfig with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateReportConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateReportConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createReportConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createReportConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createReportConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createReportConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReportConfig with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateReportConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateReportConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createReportConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createReportConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createReportConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createReportConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateReportConfigProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateReportConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateReportConfigProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateReportConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteReportConfig', () => { - it('invokes deleteReportConfig without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteReportConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteReportConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteReportConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteReportConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteReportConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteReportConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReportConfig without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteReportConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteReportConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteReportConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteReportConfig( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteReportConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteReportConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReportConfig with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteReportConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteReportConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteReportConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteReportConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteReportConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteReportConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReportConfig with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteReportConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteReportConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteReportConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteReportConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteReportConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteReportConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteReportConfigProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteReportConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteReportConfigProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteReportConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createReport', () => { - it('invokes createReport without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateReportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createReport = stubLongRunningCall(expectedResponse); - const [operation] = await client.createReport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReport without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateReportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createReport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createReport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReport with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateReportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createReport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createReport(request), expectedError); - const actualRequest = (client.innerApiCalls.createReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReport with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.CreateReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.CreateReportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createReport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createReport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateReportProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateReportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateReportProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateReportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteReport', () => { - it('invokes deleteReport without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteReport = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteReport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReport without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteReport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteReport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReport with call error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteReport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteReport(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReport with LRO error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.DeleteReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.DeleteReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteReport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteReport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteReportProgress without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteReportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteReportProgress with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteReportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listAssets', () => { - it('invokes listAssets without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), - ]; - client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); - const [response] = await client.listAssets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssets without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), - ]; - client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAssets( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IAsset[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssets with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssetsStream without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), - ]; - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.Asset[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.Asset) => { - 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.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAssetsStream with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.Asset[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.Asset) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAssets without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Asset()), - ]; - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.migrationcenter.v1.IAsset[] = []; - const iterable = client.listAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAssets with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.migrationcenter.v1.IAsset[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listImportJobs', () => { - it('invokes listImportJobs without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), - ]; - client.innerApiCalls.listImportJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listImportJobs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listImportJobs without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), - ]; - client.innerApiCalls.listImportJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listImportJobs( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IImportJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listImportJobs with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listImportJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listImportJobs(request), expectedError); - const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listImportJobsStream without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), - ]; - client.descriptors.page.listImportJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listImportJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.ImportJob[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.ImportJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listImportJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listImportJobs, request)); - assert( - (client.descriptors.page.listImportJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listImportJobsStream with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listImportJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listImportJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.ImportJob[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.ImportJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listImportJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listImportJobs, request)); - assert( - (client.descriptors.page.listImportJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listImportJobs without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportJob()), - ]; - client.descriptors.page.listImportJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.migrationcenter.v1.IImportJob[] = []; - const iterable = client.listImportJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listImportJobs with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listImportJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listImportJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.migrationcenter.v1.IImportJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listImportDataFiles', () => { - it('invokes listImportDataFiles without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListImportDataFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportDataFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), - ]; - client.innerApiCalls.listImportDataFiles = stubSimpleCall(expectedResponse); - const [response] = await client.listImportDataFiles(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listImportDataFiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImportDataFiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listImportDataFiles without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListImportDataFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportDataFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), - ]; - client.innerApiCalls.listImportDataFiles = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listImportDataFiles( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IImportDataFile[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listImportDataFiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImportDataFiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listImportDataFiles with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListImportDataFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportDataFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listImportDataFiles = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listImportDataFiles(request), expectedError); - const actualRequest = (client.innerApiCalls.listImportDataFiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImportDataFiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listImportDataFilesStream without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListImportDataFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportDataFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), - ]; - client.descriptors.page.listImportDataFiles.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listImportDataFilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.ImportDataFile[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.ImportDataFile) => { - 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.listImportDataFiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listImportDataFiles, request)); - assert( - (client.descriptors.page.listImportDataFiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listImportDataFilesStream with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListImportDataFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportDataFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listImportDataFiles.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listImportDataFilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.ImportDataFile[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.ImportDataFile) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listImportDataFiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listImportDataFiles, request)); - assert( - (client.descriptors.page.listImportDataFiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listImportDataFiles without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListImportDataFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportDataFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ImportDataFile()), - ]; - client.descriptors.page.listImportDataFiles.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.migrationcenter.v1.IImportDataFile[] = []; - const iterable = client.listImportDataFilesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listImportDataFiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listImportDataFiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listImportDataFiles with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListImportDataFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListImportDataFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listImportDataFiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listImportDataFilesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.migrationcenter.v1.IImportDataFile[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listImportDataFiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listImportDataFiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listGroups', () => { - it('invokes listGroups without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), - ]; - client.innerApiCalls.listGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroups without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), - ]; - client.innerApiCalls.listGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listGroups( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroups with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroupsStream without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), - ]; - client.descriptors.page.listGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.Group[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.Group) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGroups, request)); - assert( - (client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listGroupsStream with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.Group[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.Group) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGroups, request)); - assert( - (client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGroups without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Group()), - ]; - client.descriptors.page.listGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.migrationcenter.v1.IGroup[] = []; - const iterable = client.listGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGroups with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.migrationcenter.v1.IGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listErrorFrames', () => { - it('invokes listErrorFrames without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListErrorFramesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListErrorFramesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), - ]; - client.innerApiCalls.listErrorFrames = stubSimpleCall(expectedResponse); - const [response] = await client.listErrorFrames(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listErrorFrames as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listErrorFrames as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listErrorFrames without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListErrorFramesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListErrorFramesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), - ]; - client.innerApiCalls.listErrorFrames = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listErrorFrames( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IErrorFrame[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listErrorFrames as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listErrorFrames as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listErrorFrames with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListErrorFramesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListErrorFramesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listErrorFrames = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listErrorFrames(request), expectedError); - const actualRequest = (client.innerApiCalls.listErrorFrames as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listErrorFrames as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listErrorFramesStream without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListErrorFramesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListErrorFramesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), - ]; - client.descriptors.page.listErrorFrames.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listErrorFramesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.ErrorFrame[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.ErrorFrame) => { - 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.listErrorFrames.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listErrorFrames, request)); - assert( - (client.descriptors.page.listErrorFrames.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listErrorFramesStream with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListErrorFramesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListErrorFramesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listErrorFrames.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listErrorFramesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.ErrorFrame[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.ErrorFrame) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listErrorFrames.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listErrorFrames, request)); - assert( - (client.descriptors.page.listErrorFrames.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listErrorFrames without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListErrorFramesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListErrorFramesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ErrorFrame()), - ]; - client.descriptors.page.listErrorFrames.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.migrationcenter.v1.IErrorFrame[] = []; - const iterable = client.listErrorFramesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listErrorFrames.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listErrorFrames.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listErrorFrames with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListErrorFramesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListErrorFramesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listErrorFrames.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listErrorFramesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.migrationcenter.v1.IErrorFrame[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listErrorFrames.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listErrorFrames.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listSources', () => { - it('invokes listSources without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), - ]; - client.innerApiCalls.listSources = stubSimpleCall(expectedResponse); - const [response] = await client.listSources(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSources without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), - ]; - client.innerApiCalls.listSources = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSources( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.ISource[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSources with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSources = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSources(request), expectedError); - const actualRequest = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSourcesStream without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), - ]; - client.descriptors.page.listSources.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.Source[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.Source) => { - 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.listSources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSources, request)); - assert( - (client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listSourcesStream with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSources.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.Source[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.Source) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSources, request)); - assert( - (client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSources without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Source()), - ]; - client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.migrationcenter.v1.ISource[] = []; - const iterable = client.listSourcesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSources with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSourcesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.migrationcenter.v1.ISource[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listPreferenceSets', () => { - it('invokes listPreferenceSets without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), - ]; - client.innerApiCalls.listPreferenceSets = stubSimpleCall(expectedResponse); - const [response] = await client.listPreferenceSets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPreferenceSets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPreferenceSets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPreferenceSets without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), - ]; - client.innerApiCalls.listPreferenceSets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPreferenceSets( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IPreferenceSet[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPreferenceSets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPreferenceSets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPreferenceSets with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPreferenceSets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPreferenceSets(request), expectedError); - const actualRequest = (client.innerApiCalls.listPreferenceSets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPreferenceSets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPreferenceSetsStream without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), - ]; - client.descriptors.page.listPreferenceSets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPreferenceSetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.PreferenceSet[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.PreferenceSet) => { - 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.listPreferenceSets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPreferenceSets, request)); - assert( - (client.descriptors.page.listPreferenceSets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listPreferenceSetsStream with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPreferenceSets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPreferenceSetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.PreferenceSet[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.PreferenceSet) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPreferenceSets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPreferenceSets, request)); - assert( - (client.descriptors.page.listPreferenceSets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPreferenceSets without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.PreferenceSet()), - ]; - client.descriptors.page.listPreferenceSets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.migrationcenter.v1.IPreferenceSet[] = []; - const iterable = client.listPreferenceSetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPreferenceSets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPreferenceSets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPreferenceSets with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListPreferenceSetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPreferenceSets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPreferenceSetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.migrationcenter.v1.IPreferenceSet[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPreferenceSets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPreferenceSets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listReportConfigs', () => { - it('invokes listReportConfigs without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListReportConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), - ]; - client.innerApiCalls.listReportConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listReportConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listReportConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listReportConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReportConfigs without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListReportConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), - ]; - client.innerApiCalls.listReportConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listReportConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IReportConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listReportConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listReportConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReportConfigs with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListReportConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listReportConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listReportConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listReportConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listReportConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReportConfigsStream without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListReportConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), - ]; - client.descriptors.page.listReportConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listReportConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.ReportConfig[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.ReportConfig) => { - 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.listReportConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listReportConfigs, request)); - assert( - (client.descriptors.page.listReportConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listReportConfigsStream with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListReportConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listReportConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listReportConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.ReportConfig[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.ReportConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listReportConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listReportConfigs, request)); - assert( - (client.descriptors.page.listReportConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listReportConfigs without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListReportConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.ReportConfig()), - ]; - client.descriptors.page.listReportConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.migrationcenter.v1.IReportConfig[] = []; - const iterable = client.listReportConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listReportConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listReportConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listReportConfigs with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListReportConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listReportConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listReportConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.migrationcenter.v1.IReportConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listReportConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listReportConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listReports', () => { - it('invokes listReports without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListReportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), - ]; - client.innerApiCalls.listReports = stubSimpleCall(expectedResponse); - const [response] = await client.listReports(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listReports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listReports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReports without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListReportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), - ]; - client.innerApiCalls.listReports = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listReports( - request, - (err?: Error|null, result?: protos.google.cloud.migrationcenter.v1.IReport[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listReports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listReports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReports with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListReportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listReports = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listReports(request), expectedError); - const actualRequest = (client.innerApiCalls.listReports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listReports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReportsStream without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListReportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), - ]; - client.descriptors.page.listReports.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listReportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.Report[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.Report) => { - 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.listReports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listReports, request)); - assert( - (client.descriptors.page.listReports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listReportsStream with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListReportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listReports.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listReportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.migrationcenter.v1.Report[] = []; - stream.on('data', (response: protos.google.cloud.migrationcenter.v1.Report) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listReports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listReports, request)); - assert( - (client.descriptors.page.listReports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listReports without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListReportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), - generateSampleMessage(new protos.google.cloud.migrationcenter.v1.Report()), - ]; - client.descriptors.page.listReports.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.migrationcenter.v1.IReport[] = []; - const iterable = client.listReportsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listReports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listReports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listReports with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.migrationcenter.v1.ListReportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.migrationcenter.v1.ListReportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listReports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listReportsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.migrationcenter.v1.IReport[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listReports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listReports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('asset', () => { - const fakePath = "/rendered/path/asset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - asset: "assetValue", - }; - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.assetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.assetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('assetPath', () => { - const result = client.assetPath("projectValue", "locationValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.assetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAssetName', () => { - const result = client.matchProjectFromAssetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAssetName', () => { - const result = client.matchLocationFromAssetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromAssetName', () => { - const result = client.matchAssetFromAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('errorFrame', () => { - const fakePath = "/rendered/path/errorFrame"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - source: "sourceValue", - error_frame: "errorFrameValue", - }; - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.errorFramePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.errorFramePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('errorFramePath', () => { - const result = client.errorFramePath("projectValue", "locationValue", "sourceValue", "errorFrameValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.errorFramePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromErrorFrameName', () => { - const result = client.matchProjectFromErrorFrameName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.errorFramePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromErrorFrameName', () => { - const result = client.matchLocationFromErrorFrameName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.errorFramePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromErrorFrameName', () => { - const result = client.matchSourceFromErrorFrameName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.errorFramePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchErrorFrameFromErrorFrameName', () => { - const result = client.matchErrorFrameFromErrorFrameName(fakePath); - assert.strictEqual(result, "errorFrameValue"); - assert((client.pathTemplates.errorFramePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('group', () => { - const fakePath = "/rendered/path/group"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - group: "groupValue", - }; - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.groupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.groupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('groupPath', () => { - const result = client.groupPath("projectValue", "locationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.groupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGroupName', () => { - const result = client.matchProjectFromGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.groupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGroupName', () => { - const result = client.matchLocationFromGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.groupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromGroupName', () => { - const result = client.matchGroupFromGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.groupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('importDataFile', () => { - const fakePath = "/rendered/path/importDataFile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - import_job: "importJobValue", - import_data_file: "importDataFileValue", - }; - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.importDataFilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.importDataFilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('importDataFilePath', () => { - const result = client.importDataFilePath("projectValue", "locationValue", "importJobValue", "importDataFileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.importDataFilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromImportDataFileName', () => { - const result = client.matchProjectFromImportDataFileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.importDataFilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromImportDataFileName', () => { - const result = client.matchLocationFromImportDataFileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.importDataFilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchImportJobFromImportDataFileName', () => { - const result = client.matchImportJobFromImportDataFileName(fakePath); - assert.strictEqual(result, "importJobValue"); - assert((client.pathTemplates.importDataFilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchImportDataFileFromImportDataFileName', () => { - const result = client.matchImportDataFileFromImportDataFileName(fakePath); - assert.strictEqual(result, "importDataFileValue"); - assert((client.pathTemplates.importDataFilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('importJob', () => { - const fakePath = "/rendered/path/importJob"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - import_job: "importJobValue", - }; - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.importJobPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.importJobPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('importJobPath', () => { - const result = client.importJobPath("projectValue", "locationValue", "importJobValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.importJobPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromImportJobName', () => { - const result = client.matchProjectFromImportJobName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromImportJobName', () => { - const result = client.matchLocationFromImportJobName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchImportJobFromImportJobName', () => { - const result = client.matchImportJobFromImportJobName(fakePath); - assert.strictEqual(result, "importJobValue"); - assert((client.pathTemplates.importJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('preferenceSet', () => { - const fakePath = "/rendered/path/preferenceSet"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - preference_set: "preferenceSetValue", - }; - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.preferenceSetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.preferenceSetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('preferenceSetPath', () => { - const result = client.preferenceSetPath("projectValue", "locationValue", "preferenceSetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.preferenceSetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPreferenceSetName', () => { - const result = client.matchProjectFromPreferenceSetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.preferenceSetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPreferenceSetName', () => { - const result = client.matchLocationFromPreferenceSetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.preferenceSetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPreferenceSetFromPreferenceSetName', () => { - const result = client.matchPreferenceSetFromPreferenceSetName(fakePath); - assert.strictEqual(result, "preferenceSetValue"); - assert((client.pathTemplates.preferenceSetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new migrationcenterModule.v1.MigrationCenterClient({ - 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('report', () => { - const fakePath = "/rendered/path/report"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - report_config: "reportConfigValue", - report: "reportValue", - }; - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.reportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.reportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('reportPath', () => { - const result = client.reportPath("projectValue", "locationValue", "reportConfigValue", "reportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.reportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromReportName', () => { - const result = client.matchProjectFromReportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.reportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromReportName', () => { - const result = client.matchLocationFromReportName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.reportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchReportConfigFromReportName', () => { - const result = client.matchReportConfigFromReportName(fakePath); - assert.strictEqual(result, "reportConfigValue"); - assert((client.pathTemplates.reportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchReportFromReportName', () => { - const result = client.matchReportFromReportName(fakePath); - assert.strictEqual(result, "reportValue"); - assert((client.pathTemplates.reportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('reportConfig', () => { - const fakePath = "/rendered/path/reportConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - report_config: "reportConfigValue", - }; - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.reportConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.reportConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('reportConfigPath', () => { - const result = client.reportConfigPath("projectValue", "locationValue", "reportConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.reportConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromReportConfigName', () => { - const result = client.matchProjectFromReportConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.reportConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromReportConfigName', () => { - const result = client.matchLocationFromReportConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.reportConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchReportConfigFromReportConfigName', () => { - const result = client.matchReportConfigFromReportConfigName(fakePath); - assert.strictEqual(result, "reportConfigValue"); - assert((client.pathTemplates.reportConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('settings', () => { - const fakePath = "/rendered/path/settings"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.settingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.settingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('settingsPath', () => { - const result = client.settingsPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.settingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSettingsName', () => { - const result = client.matchProjectFromSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.settingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSettingsName', () => { - const result = client.matchLocationFromSettingsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.settingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('source', () => { - const fakePath = "/rendered/path/source"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - source: "sourceValue", - }; - const client = new migrationcenterModule.v1.MigrationCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.sourcePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sourcePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sourcePath', () => { - const result = client.sourcePath("projectValue", "locationValue", "sourceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sourcePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSourceName', () => { - const result = client.matchProjectFromSourceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSourceName', () => { - const result = client.matchLocationFromSourceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromSourceName', () => { - const result = client.matchSourceFromSourceName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.sourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-migrationcenter/v1/tsconfig.json b/owl-bot-staging/google-cloud-migrationcenter/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/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-migrationcenter/v1/webpack.config.js b/owl-bot-staging/google-cloud-migrationcenter/v1/webpack.config.js deleted file mode 100644 index f1e62781a30..00000000000 --- a/owl-bot-staging/google-cloud-migrationcenter/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: 'MigrationCenter', - filename: './migration-center.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-networkconnectivity/v1/.eslintignore b/owl-bot-staging/google-cloud-networkconnectivity/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/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-networkconnectivity/v1/.eslintrc.json b/owl-bot-staging/google-cloud-networkconnectivity/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/.gitignore b/owl-bot-staging/google-cloud-networkconnectivity/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/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-networkconnectivity/v1/.jsdoc.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/.jsdoc.js deleted file mode 100644 index 37865cfe2ea..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/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/network-connectivity', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/.mocharc.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/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-networkconnectivity/v1/.prettierrc.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/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-networkconnectivity/v1/README.md b/owl-bot-staging/google-cloud-networkconnectivity/v1/README.md deleted file mode 100644 index 086026da9e1..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Networkconnectivity: Nodejs Client diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/package.json b/owl-bot-staging/google-cloud-networkconnectivity/v1/package.json deleted file mode 100644 index 3944e98cf57..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/network-connectivity", - "version": "0.1.0", - "description": "Networkconnectivity client for Node.js", - "repository": "googleapis/nodejs-networkconnectivity", - "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 networkconnectivity", - "networkconnectivity", - "hub service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/protos/google/cloud/networkconnectivity/v1/common.proto b/owl-bot-staging/google-cloud-networkconnectivity/v1/protos/google/cloud/networkconnectivity/v1/common.proto deleted file mode 100644 index 89253048935..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/protos/google/cloud/networkconnectivity/v1/common.proto +++ /dev/null @@ -1,64 +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.networkconnectivity.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1"; -option go_package = "cloud.google.com/go/networkconnectivity/apiv1/networkconnectivitypb;networkconnectivitypb"; -option java_multiple_files = true; -option java_outer_classname = "CommonProto"; -option java_package = "com.google.cloud.networkconnectivity.v1"; -option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1"; -option ruby_package = "Google::Cloud::NetworkConnectivity::V1"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/InterconnectAttachment" - pattern: "projects/{project}/regions/{region}/interconnectAttachments/{resource_id}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Network" - pattern: "projects/{project}/global/networks/{resource_id}" -}; - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have been cancelled successfully - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/protos/google/cloud/networkconnectivity/v1/hub.proto b/owl-bot-staging/google-cloud-networkconnectivity/v1/protos/google/cloud/networkconnectivity/v1/hub.proto deleted file mode 100644 index eef97978f3d..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/protos/google/cloud/networkconnectivity/v1/hub.proto +++ /dev/null @@ -1,694 +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.networkconnectivity.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1"; -option go_package = "cloud.google.com/go/networkconnectivity/apiv1/networkconnectivitypb;networkconnectivitypb"; -option java_multiple_files = true; -option java_outer_classname = "HubProto"; -option java_package = "com.google.cloud.networkconnectivity.v1"; -option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1"; -option ruby_package = "Google::Cloud::NetworkConnectivity::V1"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/VpnTunnel" - pattern: "projects/{project}/regions/{region}/vpnTunnels/{resource_id}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Instance" - pattern: "projects/{project}/zones/{zone}/instances/{instance}" -}; - -// Network Connectivity Center is a hub-and-spoke abstraction for network -// connectivity management in Google Cloud. It reduces operational complexity -// through a simple, centralized connectivity management model. -service HubService { - option (google.api.default_host) = "networkconnectivity.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists the Network Connectivity Center hubs associated with a given project. - rpc ListHubs(ListHubsRequest) returns (ListHubsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/global}/hubs" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details about a Network Connectivity Center hub. - rpc GetHub(GetHubRequest) returns (Hub) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/global/hubs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new Network Connectivity Center hub in the specified project. - rpc CreateHub(CreateHubRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/global}/hubs" - body: "hub" - }; - option (google.api.method_signature) = "parent,hub,hub_id"; - option (google.longrunning.operation_info) = { - response_type: "Hub" - metadata_type: "OperationMetadata" - }; - } - - // Updates the description and/or labels of a Network Connectivity Center - // hub. - rpc UpdateHub(UpdateHubRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{hub.name=projects/*/locations/global/hubs/*}" - body: "hub" - }; - option (google.api.method_signature) = "hub,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Hub" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a Network Connectivity Center hub. - rpc DeleteHub(DeleteHubRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/global/hubs/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Lists the Network Connectivity Center spokes in a specified project and - // location. - rpc ListSpokes(ListSpokesRequest) returns (ListSpokesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/spokes" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details about a Network Connectivity Center spoke. - rpc GetSpoke(GetSpokeRequest) returns (Spoke) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/spokes/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a Network Connectivity Center spoke. - rpc CreateSpoke(CreateSpokeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/spokes" - body: "spoke" - }; - option (google.api.method_signature) = "parent,spoke,spoke_id"; - option (google.longrunning.operation_info) = { - response_type: "Spoke" - metadata_type: "OperationMetadata" - }; - } - - // Updates the parameters of a Network Connectivity Center spoke. - rpc UpdateSpoke(UpdateSpokeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{spoke.name=projects/*/locations/*/spokes/*}" - body: "spoke" - }; - option (google.api.method_signature) = "spoke,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Spoke" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a Network Connectivity Center spoke. - rpc DeleteSpoke(DeleteSpokeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/spokes/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } -} - -// Supported features for a location -enum LocationFeature { - // No publicly supported feature in this location - LOCATION_FEATURE_UNSPECIFIED = 0; - - // Site-to-cloud spokes are supported in this location - SITE_TO_CLOUD_SPOKES = 1; - - // Site-to-site spokes are supported in this location - SITE_TO_SITE_SPOKES = 2; -} - -// The State enum represents the lifecycle stage of a Network Connectivity -// Center resource. -enum State { - // No state information available - STATE_UNSPECIFIED = 0; - - // The resource's create operation is in progress - CREATING = 1; - - // The resource is active - ACTIVE = 2; - - // The resource's Delete operation is in progress - DELETING = 3; - - // The resource's Update operation is in progress - UPDATING = 6; -} - -// A Network Connectivity Center hub is a collection of spokes. A single hub -// can contain spokes from multiple regions. However, if any of a hub's spokes -// use the data transfer feature, the resources associated with those spokes -// must all reside in the same VPC network. Spokes that do not use data -// transfer can be associated with any VPC network in your project. -message Hub { - option (google.api.resource) = { - type: "networkconnectivity.googleapis.com/Hub" - pattern: "projects/{project}/locations/global/hubs/{hub}" - }; - - // Immutable. The name of the hub. Hub names must be unique. They use the - // following form: - // `projects/{project_number}/locations/global/hubs/{hub_id}` - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time the hub was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the hub was last updated. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional labels in key:value format. For more information about labels, see - // [Requirements for - // labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements). - map labels = 4; - - // An optional description of the hub. - string description = 5; - - // Output only. The Google-generated UUID for the hub. This value is unique - // across all hub resources. If a hub is deleted and another with the same - // name is created, the new hub is assigned a different unique_id. - string unique_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current lifecycle state of this hub. - State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The VPC networks associated with this hub's spokes. - // - // This field is read-only. Network Connectivity Center automatically - // populates it based on the set of spokes attached to the hub. - repeated RoutingVPC routing_vpcs = 10; -} - -// RoutingVPC contains information about the VPC networks associated -// with the spokes of a Network Connectivity Center hub. -message RoutingVPC { - // The URI of the VPC network. - string uri = 1 [ - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; - - // Output only. If true, indicates that this VPC network is currently - // associated with spokes that use the data transfer feature (spokes where the - // site_to_site_data_transfer field is set to true). If you create new spokes - // that use data transfer, they must be associated with this VPC network. At - // most, one VPC network will have this field set to true. - bool required_for_new_site_to_site_data_transfer_spokes = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A Network Connectivity Center spoke represents a connection between your -// Google Cloud network resources and a non-Google-Cloud network. -// -// When you create a spoke, you associate it with a hub. You must also identify -// a value for exactly one of the following fields: -// -// * linked_vpn_tunnels -// * linked_interconnect_attachments -// * linked_router_appliance_instances -message Spoke { - option (google.api.resource) = { - type: "networkconnectivity.googleapis.com/Spoke" - pattern: "projects/{project}/locations/{location}/spokes/{spoke}" - }; - - // Immutable. The name of the spoke. Spoke names must be unique. They use the - // following form: - // `projects/{project_number}/locations/{region}/spokes/{spoke_id}` - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time the spoke was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the spoke was last updated. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional labels in key:value format. For more information about labels, see - // [Requirements for - // labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements). - map labels = 4; - - // An optional description of the spoke. - string description = 5; - - // Immutable. The name of the hub that this spoke is attached to. - string hub = 6 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Hub" - } - ]; - - // VPN tunnels that are associated with the spoke. - LinkedVpnTunnels linked_vpn_tunnels = 17; - - // VLAN attachments that are associated with the spoke. - LinkedInterconnectAttachments linked_interconnect_attachments = 18; - - // Router appliance instances that are associated with the spoke. - LinkedRouterApplianceInstances linked_router_appliance_instances = 19; - - // Output only. The Google-generated UUID for the spoke. This value is unique - // across all spoke resources. If a spoke is deleted and another with the same - // name is created, the new spoke is assigned a different unique_id. - string unique_id = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current lifecycle state of this spoke. - State state = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request for -// [HubService.ListHubs][google.cloud.networkconnectivity.v1.HubService.ListHubs] -// method. -message ListHubsRequest { - // Required. The parent resource's name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of results per page that should be returned. - int32 page_size = 2; - - // The page token. - string page_token = 3; - - // An expression that filters the results listed in the response. - string filter = 4; - - // Sort the results by a certain order. - string order_by = 5; -} - -// Response for -// [HubService.ListHubs][google.cloud.networkconnectivity.v1.HubService.ListHubs] -// method. -message ListHubsResponse { - // The requested hubs. - repeated Hub hubs = 1; - - // The next pagination token in the List response. It should be used as - // page_token for the following request. An empty value means no more result. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request for -// [HubService.GetHub][google.cloud.networkconnectivity.v1.HubService.GetHub] -// method. -message GetHubRequest { - // Required. The name of the hub resource to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Hub" - } - ]; -} - -// Request for -// [HubService.CreateHub][google.cloud.networkconnectivity.v1.HubService.CreateHub] -// method. -message CreateHubRequest { - // Required. The parent resource. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. A unique identifier for the hub. - string hub_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The initial values for a new hub. - Hub hub = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A unique request ID (optional). If you specify this ID, you can - // use it in cases when you need to retry your request. When you need to - // retry, this ID lets the server know that it can ignore the request if it - // has already been completed. The server guarantees that for at least 60 - // minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check to see whether the original operation - // was received. If it was, the server ignores the second request. This - // behavior prevents clients from mistakenly creating duplicate commitments. - // - // The request ID must be a valid UUID, with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for -// [HubService.UpdateHub][google.cloud.networkconnectivity.v1.HubService.UpdateHub] -// method. -message UpdateHubRequest { - // Optional. In the case of an update to an existing hub, field mask is used - // to specify the fields to be overwritten. The fields specified in the - // update_mask are relative to the resource, not the full request. A field is - // overwritten if it is in the mask. If the user does not provide a mask, then - // all fields are overwritten. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Required. The state that the hub should be in after the update. - Hub hub = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A unique request ID (optional). If you specify this ID, you can - // use it in cases when you need to retry your request. When you need to - // retry, this ID lets the server know that it can ignore the request if it - // has already been completed. The server guarantees that for at least 60 - // minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check to see whether the original operation - // was received. If it was, the server ignores the second request. This - // behavior prevents clients from mistakenly creating duplicate commitments. - // - // The request ID must be a valid UUID, with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request for -// [HubService.DeleteHub][google.cloud.networkconnectivity.v1.HubService.DeleteHub]. -message DeleteHubRequest { - // Required. The name of the hub to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Hub" - } - ]; - - // Optional. A unique request ID (optional). If you specify this ID, you can - // use it in cases when you need to retry your request. When you need to - // retry, this ID lets the server know that it can ignore the request if it - // has already been completed. The server guarantees that for at least 60 - // minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check to see whether the original operation - // was received. If it was, the server ignores the second request. This - // behavior prevents clients from mistakenly creating duplicate commitments. - // - // The request ID must be a valid UUID, with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request for -// [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes]. -message ListSpokesRequest { - // Required. The parent resource. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of results per page that should be returned. - int32 page_size = 2; - - // The page token. - string page_token = 3; - - // An expression that filters the results listed in the response. - string filter = 4; - - // Sort the results by a certain order. - string order_by = 5; -} - -// The response for -// [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes]. -message ListSpokesResponse { - // The requested spokes. - repeated Spoke spokes = 1; - - // The next pagination token in the List response. It should be used as - // page_token for the following request. An empty value means no more result. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// The request for -// [HubService.GetSpoke][google.cloud.networkconnectivity.v1.HubService.GetSpoke]. -message GetSpokeRequest { - // Required. The name of the spoke resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Spoke" - } - ]; -} - -// The request for -// [HubService.CreateSpoke][google.cloud.networkconnectivity.v1.HubService.CreateSpoke]. -message CreateSpokeRequest { - // Required. The parent resource. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. Unique id for the spoke to create. - string spoke_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The initial values for a new spoke. - Spoke spoke = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A unique request ID (optional). If you specify this ID, you can - // use it in cases when you need to retry your request. When you need to - // retry, this ID lets the server know that it can ignore the request if it - // has already been completed. The server guarantees that for at least 60 - // minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check to see whether the original operation - // was received. If it was, the server ignores the second request. This - // behavior prevents clients from mistakenly creating duplicate commitments. - // - // The request ID must be a valid UUID, with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for -// [HubService.UpdateSpoke][google.cloud.networkconnectivity.v1.HubService.UpdateSpoke] -// method. -message UpdateSpokeRequest { - // Optional. In the case of an update to an existing spoke, field mask is used - // to specify the fields to be overwritten. The fields specified in the - // update_mask are relative to the resource, not the full request. A field is - // overwritten if it is in the mask. If the user does not provide a mask, then - // all fields are overwritten. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Required. The state that the spoke should be in after the update. - Spoke spoke = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A unique request ID (optional). If you specify this ID, you can - // use it in cases when you need to retry your request. When you need to - // retry, this ID lets the server know that it can ignore the request if it - // has already been completed. The server guarantees that for at least 60 - // minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check to see whether the original operation - // was received. If it was, the server ignores the second request. This - // behavior prevents clients from mistakenly creating duplicate commitments. - // - // The request ID must be a valid UUID, with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request for -// [HubService.DeleteSpoke][google.cloud.networkconnectivity.v1.HubService.DeleteSpoke]. -message DeleteSpokeRequest { - // Required. The name of the spoke to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Spoke" - } - ]; - - // Optional. A unique request ID (optional). If you specify this ID, you can - // use it in cases when you need to retry your request. When you need to - // retry, this ID lets the server know that it can ignore the request if it - // has already been completed. The server guarantees that for at least 60 - // minutes after the first request. - // - // For example, consider a situation where you make an initial request and - // the request times out. If you make the request again with the same request - // ID, the server can check to see whether the original operation - // was received. If it was, the server ignores the second request. This - // behavior prevents clients from mistakenly creating duplicate commitments. - // - // The request ID must be a valid UUID, with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// A collection of Cloud VPN tunnel resources. These resources should be -// redundant HA VPN tunnels that all advertise the same prefixes to Google -// Cloud. Alternatively, in a passive/active configuration, all tunnels -// should be capable of advertising the same prefixes. -message LinkedVpnTunnels { - // The URIs of linked VPN tunnel resources. - repeated string uris = 1 [(google.api.resource_reference) = { - type: "compute.googleapis.com/VpnTunnel" - }]; - - // A value that controls whether site-to-site data transfer is enabled for - // these resources. Data transfer is available only in [supported - // locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations). - bool site_to_site_data_transfer = 2; - - // Output only. The VPC network where these VPN tunnels are located. - string vpc_network = 3 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; -} - -// A collection of VLAN attachment resources. These resources should -// be redundant attachments that all advertise the same prefixes to Google -// Cloud. Alternatively, in active/passive configurations, all attachments -// should be capable of advertising the same prefixes. -message LinkedInterconnectAttachments { - // The URIs of linked interconnect attachment resources - repeated string uris = 1 [(google.api.resource_reference) = { - type: "compute.googleapis.com/InterconnectAttachment" - }]; - - // A value that controls whether site-to-site data transfer is enabled for - // these resources. Data transfer is available only in [supported - // locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations). - bool site_to_site_data_transfer = 2; - - // Output only. The VPC network where these VLAN attachments are located. - string vpc_network = 3 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; -} - -// A collection of router appliance instances. If you configure multiple router -// appliance instances to receive data from the same set of sites outside of -// Google Cloud, we recommend that you associate those instances with the same -// spoke. -message LinkedRouterApplianceInstances { - // The list of router appliance instances. - repeated RouterApplianceInstance instances = 1; - - // A value that controls whether site-to-site data transfer is enabled for - // these resources. Data transfer is available only in [supported - // locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations). - bool site_to_site_data_transfer = 2; - - // Output only. The VPC network where these router appliance instances are - // located. - string vpc_network = 3 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; -} - -// A router appliance instance is a Compute Engine virtual machine (VM) instance -// that acts as a BGP speaker. A router appliance instance is specified by the -// URI of the VM and the internal IP address of one of the VM's network -// interfaces. -message RouterApplianceInstance { - // The URI of the VM. - string virtual_machine = 1 [(google.api.resource_reference) = { - type: "compute.googleapis.com/Instance" - }]; - - // The IP address on the VM to use for peering. - string ip_address = 3; -} - -// Metadata about locations -message LocationMetadata { - // List of supported features - repeated LocationFeature location_features = 1; -} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.create_hub.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.create_hub.js deleted file mode 100644 index 5386f809b62..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.create_hub.js +++ /dev/null @@ -1,87 +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, hubId, hub) { - // [START networkconnectivity_v1_generated_HubService_CreateHub_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 parent resource. - */ - // const parent = 'abc123' - /** - * Required. A unique identifier for the hub. - */ - // const hubId = 'abc123' - /** - * Required. The initial values for a new hub. - */ - // const hub = {} - /** - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly creating duplicate commitments. - * The request ID must be a valid UUID, with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callCreateHub() { - // Construct request - const request = { - parent, - hubId, - hub, - }; - - // Run request - const [operation] = await networkconnectivityClient.createHub(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateHub(); - // [END networkconnectivity_v1_generated_HubService_CreateHub_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-networkconnectivity/v1/samples/generated/v1/hub_service.create_spoke.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.create_spoke.js deleted file mode 100644 index 8838c551a7d..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.create_spoke.js +++ /dev/null @@ -1,87 +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, spokeId, spoke) { - // [START networkconnectivity_v1_generated_HubService_CreateSpoke_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 parent resource. - */ - // const parent = 'abc123' - /** - * Required. Unique id for the spoke to create. - */ - // const spokeId = 'abc123' - /** - * Required. The initial values for a new spoke. - */ - // const spoke = {} - /** - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly creating duplicate commitments. - * The request ID must be a valid UUID, with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callCreateSpoke() { - // Construct request - const request = { - parent, - spokeId, - spoke, - }; - - // Run request - const [operation] = await networkconnectivityClient.createSpoke(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateSpoke(); - // [END networkconnectivity_v1_generated_HubService_CreateSpoke_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-networkconnectivity/v1/samples/generated/v1/hub_service.delete_hub.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.delete_hub.js deleted file mode 100644 index 380e2478bb1..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.delete_hub.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(name) { - // [START networkconnectivity_v1_generated_HubService_DeleteHub_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the hub to delete. - */ - // const name = 'abc123' - /** - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly creating duplicate commitments. - * The request ID must be a valid UUID, with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callDeleteHub() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await networkconnectivityClient.deleteHub(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteHub(); - // [END networkconnectivity_v1_generated_HubService_DeleteHub_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-networkconnectivity/v1/samples/generated/v1/hub_service.delete_spoke.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.delete_spoke.js deleted file mode 100644 index 290cda0f1c6..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.delete_spoke.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(name) { - // [START networkconnectivity_v1_generated_HubService_DeleteSpoke_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the spoke to delete. - */ - // const name = 'abc123' - /** - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly creating duplicate commitments. - * The request ID must be a valid UUID, with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callDeleteSpoke() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await networkconnectivityClient.deleteSpoke(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteSpoke(); - // [END networkconnectivity_v1_generated_HubService_DeleteSpoke_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-networkconnectivity/v1/samples/generated/v1/hub_service.get_hub.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.get_hub.js deleted file mode 100644 index 257b256eda5..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.get_hub.js +++ /dev/null @@ -1,61 +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 networkconnectivity_v1_generated_HubService_GetHub_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the hub resource to get. - */ - // const name = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callGetHub() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await networkconnectivityClient.getHub(request); - console.log(response); - } - - callGetHub(); - // [END networkconnectivity_v1_generated_HubService_GetHub_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-networkconnectivity/v1/samples/generated/v1/hub_service.get_spoke.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.get_spoke.js deleted file mode 100644 index 6a19cf40cba..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.get_spoke.js +++ /dev/null @@ -1,61 +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 networkconnectivity_v1_generated_HubService_GetSpoke_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the spoke resource. - */ - // const name = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callGetSpoke() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await networkconnectivityClient.getSpoke(request); - console.log(response); - } - - callGetSpoke(); - // [END networkconnectivity_v1_generated_HubService_GetSpoke_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-networkconnectivity/v1/samples/generated/v1/hub_service.list_hubs.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.list_hubs.js deleted file mode 100644 index 8aeb997799c..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.list_hubs.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 networkconnectivity_v1_generated_HubService_ListHubs_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 parent resource's name. - */ - // const parent = 'abc123' - /** - * The maximum number of results per page that should be returned. - */ - // const pageSize = 1234 - /** - * The page token. - */ - // const pageToken = 'abc123' - /** - * An expression that filters the results listed in the response. - */ - // const filter = 'abc123' - /** - * Sort the results by a certain order. - */ - // const orderBy = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callListHubs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await networkconnectivityClient.listHubsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListHubs(); - // [END networkconnectivity_v1_generated_HubService_ListHubs_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-networkconnectivity/v1/samples/generated/v1/hub_service.list_spokes.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.list_spokes.js deleted file mode 100644 index 4f40de8c227..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.list_spokes.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 networkconnectivity_v1_generated_HubService_ListSpokes_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 parent resource. - */ - // const parent = 'abc123' - /** - * The maximum number of results per page that should be returned. - */ - // const pageSize = 1234 - /** - * The page token. - */ - // const pageToken = 'abc123' - /** - * An expression that filters the results listed in the response. - */ - // const filter = 'abc123' - /** - * Sort the results by a certain order. - */ - // const orderBy = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callListSpokes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await networkconnectivityClient.listSpokesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSpokes(); - // [END networkconnectivity_v1_generated_HubService_ListSpokes_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-networkconnectivity/v1/samples/generated/v1/hub_service.update_hub.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.update_hub.js deleted file mode 100644 index 9f5b0dbbed6..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.update_hub.js +++ /dev/null @@ -1,85 +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(hub) { - // [START networkconnectivity_v1_generated_HubService_UpdateHub_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. - */ - /** - * Optional. In the case of an update to an existing hub, field mask is used - * to specify the fields to be overwritten. The fields specified in the - * update_mask are relative to the resource, not the full request. A field is - * overwritten if it is in the mask. If the user does not provide a mask, then - * all fields are overwritten. - */ - // const updateMask = {} - /** - * Required. The state that the hub should be in after the update. - */ - // const hub = {} - /** - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly creating duplicate commitments. - * The request ID must be a valid UUID, with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callUpdateHub() { - // Construct request - const request = { - hub, - }; - - // Run request - const [operation] = await networkconnectivityClient.updateHub(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateHub(); - // [END networkconnectivity_v1_generated_HubService_UpdateHub_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-networkconnectivity/v1/samples/generated/v1/hub_service.update_spoke.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.update_spoke.js deleted file mode 100644 index af05ba517c3..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/hub_service.update_spoke.js +++ /dev/null @@ -1,85 +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(spoke) { - // [START networkconnectivity_v1_generated_HubService_UpdateSpoke_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. - */ - /** - * Optional. In the case of an update to an existing spoke, field mask is used - * to specify the fields to be overwritten. The fields specified in the - * update_mask are relative to the resource, not the full request. A field is - * overwritten if it is in the mask. If the user does not provide a mask, then - * all fields are overwritten. - */ - // const updateMask = {} - /** - * Required. The state that the spoke should be in after the update. - */ - // const spoke = {} - /** - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly creating duplicate commitments. - * The request ID must be a valid UUID, with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callUpdateSpoke() { - // Construct request - const request = { - spoke, - }; - - // Run request - const [operation] = await networkconnectivityClient.updateSpoke(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateSpoke(); - // [END networkconnectivity_v1_generated_HubService_UpdateSpoke_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-networkconnectivity/v1/samples/generated/v1/snippet_metadata_google.cloud.networkconnectivity.v1.json b/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/snippet_metadata_google.cloud.networkconnectivity.v1.json deleted file mode 100644 index 5f6649ebfe6..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/samples/generated/v1/snippet_metadata_google.cloud.networkconnectivity.v1.json +++ /dev/null @@ -1,495 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-networkconnectivity", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.networkconnectivity.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "networkconnectivity_v1_generated_HubService_ListHubs_async", - "title": "HubService listHubs Sample", - "origin": "API_DEFINITION", - "description": " Lists the Network Connectivity Center hubs associated with a given project.", - "canonical": true, - "file": "hub_service.list_hubs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListHubs", - "fullName": "google.cloud.networkconnectivity.v1.HubService.ListHubs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkconnectivity.v1.ListHubsResponse", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "ListHubs", - "fullName": "google.cloud.networkconnectivity.v1.HubService.ListHubs", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_GetHub_async", - "title": "HubService getHub Sample", - "origin": "API_DEFINITION", - "description": " Gets details about a Network Connectivity Center hub.", - "canonical": true, - "file": "hub_service.get_hub.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetHub", - "fullName": "google.cloud.networkconnectivity.v1.HubService.GetHub", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkconnectivity.v1.Hub", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "GetHub", - "fullName": "google.cloud.networkconnectivity.v1.HubService.GetHub", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_CreateHub_async", - "title": "HubService createHub Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Network Connectivity Center hub in the specified project.", - "canonical": true, - "file": "hub_service.create_hub.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateHub", - "fullName": "google.cloud.networkconnectivity.v1.HubService.CreateHub", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "hub_id", - "type": "TYPE_STRING" - }, - { - "name": "hub", - "type": ".google.cloud.networkconnectivity.v1.Hub" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "CreateHub", - "fullName": "google.cloud.networkconnectivity.v1.HubService.CreateHub", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_UpdateHub_async", - "title": "HubService updateHub Sample", - "origin": "API_DEFINITION", - "description": " Updates the description and/or labels of a Network Connectivity Center hub.", - "canonical": true, - "file": "hub_service.update_hub.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateHub", - "fullName": "google.cloud.networkconnectivity.v1.HubService.UpdateHub", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "hub", - "type": ".google.cloud.networkconnectivity.v1.Hub" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "UpdateHub", - "fullName": "google.cloud.networkconnectivity.v1.HubService.UpdateHub", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_DeleteHub_async", - "title": "HubService deleteHub Sample", - "origin": "API_DEFINITION", - "description": " Deletes a Network Connectivity Center hub.", - "canonical": true, - "file": "hub_service.delete_hub.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteHub", - "fullName": "google.cloud.networkconnectivity.v1.HubService.DeleteHub", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "DeleteHub", - "fullName": "google.cloud.networkconnectivity.v1.HubService.DeleteHub", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_ListSpokes_async", - "title": "HubService listSpokes Sample", - "origin": "API_DEFINITION", - "description": " Lists the Network Connectivity Center spokes in a specified project and location.", - "canonical": true, - "file": "hub_service.list_spokes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSpokes", - "fullName": "google.cloud.networkconnectivity.v1.HubService.ListSpokes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkconnectivity.v1.ListSpokesResponse", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "ListSpokes", - "fullName": "google.cloud.networkconnectivity.v1.HubService.ListSpokes", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_GetSpoke_async", - "title": "HubService getSpoke Sample", - "origin": "API_DEFINITION", - "description": " Gets details about a Network Connectivity Center spoke.", - "canonical": true, - "file": "hub_service.get_spoke.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSpoke", - "fullName": "google.cloud.networkconnectivity.v1.HubService.GetSpoke", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkconnectivity.v1.Spoke", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "GetSpoke", - "fullName": "google.cloud.networkconnectivity.v1.HubService.GetSpoke", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_CreateSpoke_async", - "title": "HubService createSpoke Sample", - "origin": "API_DEFINITION", - "description": " Creates a Network Connectivity Center spoke.", - "canonical": true, - "file": "hub_service.create_spoke.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSpoke", - "fullName": "google.cloud.networkconnectivity.v1.HubService.CreateSpoke", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "spoke_id", - "type": "TYPE_STRING" - }, - { - "name": "spoke", - "type": ".google.cloud.networkconnectivity.v1.Spoke" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "CreateSpoke", - "fullName": "google.cloud.networkconnectivity.v1.HubService.CreateSpoke", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_UpdateSpoke_async", - "title": "HubService updateSpoke Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of a Network Connectivity Center spoke.", - "canonical": true, - "file": "hub_service.update_spoke.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSpoke", - "fullName": "google.cloud.networkconnectivity.v1.HubService.UpdateSpoke", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "spoke", - "type": ".google.cloud.networkconnectivity.v1.Spoke" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "UpdateSpoke", - "fullName": "google.cloud.networkconnectivity.v1.HubService.UpdateSpoke", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_DeleteSpoke_async", - "title": "HubService deleteSpoke Sample", - "origin": "API_DEFINITION", - "description": " Deletes a Network Connectivity Center spoke.", - "canonical": true, - "file": "hub_service.delete_spoke.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteSpoke", - "fullName": "google.cloud.networkconnectivity.v1.HubService.DeleteSpoke", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "DeleteSpoke", - "fullName": "google.cloud.networkconnectivity.v1.HubService.DeleteSpoke", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/src/index.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1/src/index.ts deleted file mode 100644 index 5da8f8a5f72..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/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 v1 from './v1'; -const HubServiceClient = v1.HubServiceClient; -type HubServiceClient = v1.HubServiceClient; -export {v1, HubServiceClient}; -export default {v1, HubServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 3e4f0fedf40..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.networkconnectivity.v1", - "libraryPackage": "@google-cloud/network-connectivity", - "services": { - "HubService": { - "clients": { - "grpc": { - "libraryClient": "HubServiceClient", - "rpcs": { - "GetHub": { - "methods": [ - "getHub" - ] - }, - "GetSpoke": { - "methods": [ - "getSpoke" - ] - }, - "CreateHub": { - "methods": [ - "createHub" - ] - }, - "UpdateHub": { - "methods": [ - "updateHub" - ] - }, - "DeleteHub": { - "methods": [ - "deleteHub" - ] - }, - "CreateSpoke": { - "methods": [ - "createSpoke" - ] - }, - "UpdateSpoke": { - "methods": [ - "updateSpoke" - ] - }, - "DeleteSpoke": { - "methods": [ - "deleteSpoke" - ] - }, - "ListHubs": { - "methods": [ - "listHubs", - "listHubsStream", - "listHubsAsync" - ] - }, - "ListSpokes": { - "methods": [ - "listSpokes", - "listSpokesStream", - "listSpokesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "HubServiceClient", - "rpcs": { - "GetHub": { - "methods": [ - "getHub" - ] - }, - "GetSpoke": { - "methods": [ - "getSpoke" - ] - }, - "CreateHub": { - "methods": [ - "createHub" - ] - }, - "UpdateHub": { - "methods": [ - "updateHub" - ] - }, - "DeleteHub": { - "methods": [ - "deleteHub" - ] - }, - "CreateSpoke": { - "methods": [ - "createSpoke" - ] - }, - "UpdateSpoke": { - "methods": [ - "updateSpoke" - ] - }, - "DeleteSpoke": { - "methods": [ - "deleteSpoke" - ] - }, - "ListHubs": { - "methods": [ - "listHubs", - "listHubsStream", - "listHubsAsync" - ] - }, - "ListSpokes": { - "methods": [ - "listSpokes", - "listSpokesStream", - "listSpokesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_client.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_client.ts deleted file mode 100644 index 4e693bbfd8e..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_client.ts +++ /dev/null @@ -1,2277 +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, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/hub_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './hub_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Network Connectivity Center is a hub-and-spoke abstraction for network - * connectivity management in Google Cloud. It reduces operational complexity - * through a simple, centralized connectivity management model. - * @class - * @memberof v1 - */ -export class HubServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - hubServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of HubServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 HubServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof HubServiceClient; - 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; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - 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 = { - hubPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/global/hubs/{hub}' - ), - instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/zones/{zone}/instances/{instance}' - ), - interconnectAttachmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/interconnectAttachments/{resource_id}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{resource_id}' - ), - spokePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/spokes/{spoke}' - ), - vpnTunnelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/vpnTunnels/{resource_id}' - ), - }; - - // 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 = { - listHubs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'hubs'), - listSpokes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spokes') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/global/hubs/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/spokes/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/global/hubs/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/spokes/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/global/hubs/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/spokes/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createHubResponse = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.Hub') as gax.protobuf.Type; - const createHubMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; - const updateHubResponse = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.Hub') as gax.protobuf.Type; - const updateHubMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; - const deleteHubResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteHubMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; - const createSpokeResponse = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.Spoke') as gax.protobuf.Type; - const createSpokeMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; - const updateSpokeResponse = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.Spoke') as gax.protobuf.Type; - const updateSpokeMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; - const deleteSpokeResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteSpokeMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createHub: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createHubResponse.decode.bind(createHubResponse), - createHubMetadata.decode.bind(createHubMetadata)), - updateHub: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateHubResponse.decode.bind(updateHubResponse), - updateHubMetadata.decode.bind(updateHubMetadata)), - deleteHub: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteHubResponse.decode.bind(deleteHubResponse), - deleteHubMetadata.decode.bind(deleteHubMetadata)), - createSpoke: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createSpokeResponse.decode.bind(createSpokeResponse), - createSpokeMetadata.decode.bind(createSpokeMetadata)), - updateSpoke: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateSpokeResponse.decode.bind(updateSpokeResponse), - updateSpokeMetadata.decode.bind(updateSpokeMetadata)), - deleteSpoke: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteSpokeResponse.decode.bind(deleteSpokeResponse), - deleteSpokeMetadata.decode.bind(deleteSpokeMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networkconnectivity.v1.HubService', 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.hubServiceStub) { - return this.hubServiceStub; - } - - // Put together the "service stub" for - // google.cloud.networkconnectivity.v1.HubService. - this.hubServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networkconnectivity.v1.HubService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networkconnectivity.v1.HubService, - 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 hubServiceStubMethods = - ['listHubs', 'getHub', 'createHub', 'updateHub', 'deleteHub', 'listSpokes', 'getSpoke', 'createSpoke', 'updateSpoke', 'deleteSpoke']; - for (const methodName of hubServiceStubMethods) { - const callPromise = this.hubServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.hubServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'networkconnectivity.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 'networkconnectivity.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 -- - // ------------------- -/** - * Gets details about a Network Connectivity Center hub. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the hub resource to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.networkconnectivity.v1.Hub|Hub}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/hub_service.get_hub.js - * region_tag:networkconnectivity_v1_generated_HubService_GetHub_async - */ - getHub( - request?: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkconnectivity.v1.IHub, - protos.google.cloud.networkconnectivity.v1.IGetHubRequest|undefined, {}|undefined - ]>; - getHub( - request: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networkconnectivity.v1.IHub, - protos.google.cloud.networkconnectivity.v1.IGetHubRequest|null|undefined, - {}|null|undefined>): void; - getHub( - request: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, - callback: Callback< - protos.google.cloud.networkconnectivity.v1.IHub, - protos.google.cloud.networkconnectivity.v1.IGetHubRequest|null|undefined, - {}|null|undefined>): void; - getHub( - request?: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networkconnectivity.v1.IHub, - protos.google.cloud.networkconnectivity.v1.IGetHubRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.networkconnectivity.v1.IHub, - protos.google.cloud.networkconnectivity.v1.IGetHubRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networkconnectivity.v1.IHub, - protos.google.cloud.networkconnectivity.v1.IGetHubRequest|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.getHub(request, options, callback); - } -/** - * Gets details about a Network Connectivity Center spoke. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spoke 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 protos.google.cloud.networkconnectivity.v1.Spoke|Spoke}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/hub_service.get_spoke.js - * region_tag:networkconnectivity_v1_generated_HubService_GetSpoke_async - */ - getSpoke( - request?: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkconnectivity.v1.ISpoke, - protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|undefined, {}|undefined - ]>; - getSpoke( - request: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networkconnectivity.v1.ISpoke, - protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|null|undefined, - {}|null|undefined>): void; - getSpoke( - request: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, - callback: Callback< - protos.google.cloud.networkconnectivity.v1.ISpoke, - protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|null|undefined, - {}|null|undefined>): void; - getSpoke( - request?: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networkconnectivity.v1.ISpoke, - protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.networkconnectivity.v1.ISpoke, - protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networkconnectivity.v1.ISpoke, - protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|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.getSpoke(request, options, callback); - } - -/** - * Creates a new Network Connectivity Center hub in the specified project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource. - * @param {string} request.hubId - * Required. A unique identifier for the hub. - * @param {google.cloud.networkconnectivity.v1.Hub} request.hub - * Required. The initial values for a new hub. - * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly creating duplicate commitments. - * - * The request ID must be a valid UUID, with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/hub_service.create_hub.js - * region_tag:networkconnectivity_v1_generated_HubService_CreateHub_async - */ - createHub( - request?: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createHub( - request: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createHub( - request: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createHub( - request?: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createHub(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createHub()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/hub_service.create_hub.js - * region_tag:networkconnectivity_v1_generated_HubService_CreateHub_async - */ - async checkCreateHubProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createHub, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the description and/or labels of a Network Connectivity Center - * hub. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. In the case of an update to an existing hub, field mask is used - * to specify the fields to be overwritten. The fields specified in the - * update_mask are relative to the resource, not the full request. A field is - * overwritten if it is in the mask. If the user does not provide a mask, then - * all fields are overwritten. - * @param {google.cloud.networkconnectivity.v1.Hub} request.hub - * Required. The state that the hub should be in after the update. - * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly creating duplicate commitments. - * - * The request ID must be a valid UUID, with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/hub_service.update_hub.js - * region_tag:networkconnectivity_v1_generated_HubService_UpdateHub_async - */ - updateHub( - request?: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateHub( - request: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateHub( - request: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateHub( - request?: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'hub.name': request.hub!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateHub(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateHub()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/hub_service.update_hub.js - * region_tag:networkconnectivity_v1_generated_HubService_UpdateHub_async - */ - async checkUpdateHubProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateHub, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a Network Connectivity Center hub. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the hub to delete. - * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly creating duplicate commitments. - * - * The request ID must be a valid UUID, with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/hub_service.delete_hub.js - * region_tag:networkconnectivity_v1_generated_HubService_DeleteHub_async - */ - deleteHub( - request?: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteHub( - request: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteHub( - request: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteHub( - request?: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteHub(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteHub()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/hub_service.delete_hub.js - * region_tag:networkconnectivity_v1_generated_HubService_DeleteHub_async - */ - async checkDeleteHubProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteHub, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a Network Connectivity Center spoke. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource. - * @param {string} request.spokeId - * Required. Unique id for the spoke to create. - * @param {google.cloud.networkconnectivity.v1.Spoke} request.spoke - * Required. The initial values for a new spoke. - * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly creating duplicate commitments. - * - * The request ID must be a valid UUID, with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/hub_service.create_spoke.js - * region_tag:networkconnectivity_v1_generated_HubService_CreateSpoke_async - */ - createSpoke( - request?: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createSpoke( - request: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createSpoke( - request: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createSpoke( - request?: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createSpoke(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createSpoke()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/hub_service.create_spoke.js - * region_tag:networkconnectivity_v1_generated_HubService_CreateSpoke_async - */ - async checkCreateSpokeProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createSpoke, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the parameters of a Network Connectivity Center spoke. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. In the case of an update to an existing spoke, field mask is used - * to specify the fields to be overwritten. The fields specified in the - * update_mask are relative to the resource, not the full request. A field is - * overwritten if it is in the mask. If the user does not provide a mask, then - * all fields are overwritten. - * @param {google.cloud.networkconnectivity.v1.Spoke} request.spoke - * Required. The state that the spoke should be in after the update. - * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly creating duplicate commitments. - * - * The request ID must be a valid UUID, with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/hub_service.update_spoke.js - * region_tag:networkconnectivity_v1_generated_HubService_UpdateSpoke_async - */ - updateSpoke( - request?: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateSpoke( - request: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateSpoke( - request: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateSpoke( - request?: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'spoke.name': request.spoke!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSpoke(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateSpoke()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/hub_service.update_spoke.js - * region_tag:networkconnectivity_v1_generated_HubService_UpdateSpoke_async - */ - async checkUpdateSpokeProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateSpoke, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a Network Connectivity Center spoke. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spoke to delete. - * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly creating duplicate commitments. - * - * The request ID must be a valid UUID, with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/hub_service.delete_spoke.js - * region_tag:networkconnectivity_v1_generated_HubService_DeleteSpoke_async - */ - deleteSpoke( - request?: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteSpoke( - request: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteSpoke( - request: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteSpoke( - request?: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteSpoke(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteSpoke()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/hub_service.delete_spoke.js - * region_tag:networkconnectivity_v1_generated_HubService_DeleteSpoke_async - */ - async checkDeleteSpokeProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteSpoke, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists the Network Connectivity Center hubs associated with a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * An expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.networkconnectivity.v1.Hub|Hub}. - * 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 `listHubsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listHubs( - request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkconnectivity.v1.IHub[], - protos.google.cloud.networkconnectivity.v1.IListHubsRequest|null, - protos.google.cloud.networkconnectivity.v1.IListHubsResponse - ]>; - listHubs( - request: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - protos.google.cloud.networkconnectivity.v1.IListHubsResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1.IHub>): void; - listHubs( - request: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - protos.google.cloud.networkconnectivity.v1.IListHubsResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1.IHub>): void; - listHubs( - request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - protos.google.cloud.networkconnectivity.v1.IListHubsResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1.IHub>, - callback?: PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - protos.google.cloud.networkconnectivity.v1.IListHubsResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1.IHub>): - Promise<[ - protos.google.cloud.networkconnectivity.v1.IHub[], - protos.google.cloud.networkconnectivity.v1.IListHubsRequest|null, - protos.google.cloud.networkconnectivity.v1.IListHubsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listHubs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * An expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @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 protos.google.cloud.networkconnectivity.v1.Hub|Hub} 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 `listHubsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listHubsStream( - request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - 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['listHubs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listHubs.createStream( - this.innerApiCalls.listHubs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listHubs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * An expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.networkconnectivity.v1.Hub|Hub}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/hub_service.list_hubs.js - * region_tag:networkconnectivity_v1_generated_HubService_ListHubs_async - */ - listHubsAsync( - request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - 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['listHubs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listHubs.asyncIterate( - this.innerApiCalls['listHubs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the Network Connectivity Center spokes in a specified project and - * location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * An expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.networkconnectivity.v1.Spoke|Spoke}. - * 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 `listSpokesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSpokes( - request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkconnectivity.v1.ISpoke[], - protos.google.cloud.networkconnectivity.v1.IListSpokesRequest|null, - protos.google.cloud.networkconnectivity.v1.IListSpokesResponse - ]>; - listSpokes( - request: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - protos.google.cloud.networkconnectivity.v1.IListSpokesResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1.ISpoke>): void; - listSpokes( - request: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - protos.google.cloud.networkconnectivity.v1.IListSpokesResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1.ISpoke>): void; - listSpokes( - request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - protos.google.cloud.networkconnectivity.v1.IListSpokesResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1.ISpoke>, - callback?: PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - protos.google.cloud.networkconnectivity.v1.IListSpokesResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1.ISpoke>): - Promise<[ - protos.google.cloud.networkconnectivity.v1.ISpoke[], - protos.google.cloud.networkconnectivity.v1.IListSpokesRequest|null, - protos.google.cloud.networkconnectivity.v1.IListSpokesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listSpokes(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * An expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @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 protos.google.cloud.networkconnectivity.v1.Spoke|Spoke} 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 `listSpokesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSpokesStream( - request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - 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['listSpokes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSpokes.createStream( - this.innerApiCalls.listSpokes as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSpokes`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * An expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.networkconnectivity.v1.Spoke|Spoke}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/hub_service.list_spokes.js - * region_tag:networkconnectivity_v1_generated_HubService_ListSpokes_async - */ - listSpokesAsync( - request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - 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['listSpokes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSpokes.asyncIterate( - this.innerApiCalls['listSpokes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @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}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified hub resource name string. - * - * @param {string} project - * @param {string} hub - * @returns {string} Resource name string. - */ - hubPath(project:string,hub:string) { - return this.pathTemplates.hubPathTemplate.render({ - project: project, - hub: hub, - }); - } - - /** - * Parse the project from Hub resource. - * - * @param {string} hubName - * A fully-qualified path representing Hub resource. - * @returns {string} A string representing the project. - */ - matchProjectFromHubName(hubName: string) { - return this.pathTemplates.hubPathTemplate.match(hubName).project; - } - - /** - * Parse the hub from Hub resource. - * - * @param {string} hubName - * A fully-qualified path representing Hub resource. - * @returns {string} A string representing the hub. - */ - matchHubFromHubName(hubName: string) { - return this.pathTemplates.hubPathTemplate.match(hubName).hub; - } - - /** - * Return a fully-qualified instance resource name string. - * - * @param {string} project - * @param {string} zone - * @param {string} instance - * @returns {string} Resource name string. - */ - instancePath(project:string,zone:string,instance:string) { - return this.pathTemplates.instancePathTemplate.render({ - project: project, - zone: zone, - instance: instance, - }); - } - - /** - * Parse the project from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).project; - } - - /** - * Parse the zone from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the zone. - */ - matchZoneFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).zone; - } - - /** - * Parse the instance from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).instance; - } - - /** - * Return a fully-qualified interconnectAttachment resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} resource_id - * @returns {string} Resource name string. - */ - interconnectAttachmentPath(project:string,region:string,resourceId:string) { - return this.pathTemplates.interconnectAttachmentPathTemplate.render({ - project: project, - region: region, - resource_id: resourceId, - }); - } - - /** - * Parse the project from InterconnectAttachment resource. - * - * @param {string} interconnectAttachmentName - * A fully-qualified path representing InterconnectAttachment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInterconnectAttachmentName(interconnectAttachmentName: string) { - return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).project; - } - - /** - * Parse the region from InterconnectAttachment resource. - * - * @param {string} interconnectAttachmentName - * A fully-qualified path representing InterconnectAttachment resource. - * @returns {string} A string representing the region. - */ - matchRegionFromInterconnectAttachmentName(interconnectAttachmentName: string) { - return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).region; - } - - /** - * Parse the resource_id from InterconnectAttachment resource. - * - * @param {string} interconnectAttachmentName - * A fully-qualified path representing InterconnectAttachment resource. - * @returns {string} A string representing the resource_id. - */ - matchResourceIdFromInterconnectAttachmentName(interconnectAttachmentName: string) { - return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).resource_id; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified network resource name string. - * - * @param {string} project - * @param {string} resource_id - * @returns {string} Resource name string. - */ - networkPath(project:string,resourceId:string) { - return this.pathTemplates.networkPathTemplate.render({ - project: project, - resource_id: resourceId, - }); - } - - /** - * Parse the project from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).project; - } - - /** - * Parse the resource_id from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the resource_id. - */ - matchResourceIdFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).resource_id; - } - - /** - * Return a fully-qualified spoke resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} spoke - * @returns {string} Resource name string. - */ - spokePath(project:string,location:string,spoke:string) { - return this.pathTemplates.spokePathTemplate.render({ - project: project, - location: location, - spoke: spoke, - }); - } - - /** - * Parse the project from Spoke resource. - * - * @param {string} spokeName - * A fully-qualified path representing Spoke resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSpokeName(spokeName: string) { - return this.pathTemplates.spokePathTemplate.match(spokeName).project; - } - - /** - * Parse the location from Spoke resource. - * - * @param {string} spokeName - * A fully-qualified path representing Spoke resource. - * @returns {string} A string representing the location. - */ - matchLocationFromSpokeName(spokeName: string) { - return this.pathTemplates.spokePathTemplate.match(spokeName).location; - } - - /** - * Parse the spoke from Spoke resource. - * - * @param {string} spokeName - * A fully-qualified path representing Spoke resource. - * @returns {string} A string representing the spoke. - */ - matchSpokeFromSpokeName(spokeName: string) { - return this.pathTemplates.spokePathTemplate.match(spokeName).spoke; - } - - /** - * Return a fully-qualified vpnTunnel resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} resource_id - * @returns {string} Resource name string. - */ - vpnTunnelPath(project:string,region:string,resourceId:string) { - return this.pathTemplates.vpnTunnelPathTemplate.render({ - project: project, - region: region, - resource_id: resourceId, - }); - } - - /** - * Parse the project from VpnTunnel resource. - * - * @param {string} vpnTunnelName - * A fully-qualified path representing VpnTunnel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromVpnTunnelName(vpnTunnelName: string) { - return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).project; - } - - /** - * Parse the region from VpnTunnel resource. - * - * @param {string} vpnTunnelName - * A fully-qualified path representing VpnTunnel resource. - * @returns {string} A string representing the region. - */ - matchRegionFromVpnTunnelName(vpnTunnelName: string) { - return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).region; - } - - /** - * Parse the resource_id from VpnTunnel resource. - * - * @param {string} vpnTunnelName - * A fully-qualified path representing VpnTunnel resource. - * @returns {string} A string representing the resource_id. - */ - matchResourceIdFromVpnTunnelName(vpnTunnelName: string) { - return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).resource_id; - } - - /** - * 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.hubServiceStub && !this._terminated) { - return this.hubServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_client_config.json b/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_client_config.json deleted file mode 100644 index 068f769fc14..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_client_config.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "interfaces": { - "google.cloud.networkconnectivity.v1.HubService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListHubs": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetHub": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateHub": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateHub": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteHub": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListSpokes": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetSpoke": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateSpoke": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSpoke": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteSpoke": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_proto_list.json b/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_proto_list.json deleted file mode 100644 index ebe50faf7cb..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/hub_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/networkconnectivity/v1/common.proto", - "../../protos/google/cloud/networkconnectivity/v1/hub.proto" -] diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/index.ts deleted file mode 100644 index 937a411a485..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/src/v1/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 {HubServiceClient} from './hub_service_client'; diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index d3cd46d0a96..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/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 networkconnectivity = require('@google-cloud/network-connectivity'); - -function main() { - const hubServiceClient = new networkconnectivity.HubServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index ae4d979ece8..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/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 {HubServiceClient} from '@google-cloud/network-connectivity'; - -// check that the client class type name can be used -function doStuffWithHubServiceClient(client: HubServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const hubServiceClient = new HubServiceClient(); - doStuffWithHubServiceClient(hubServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/install.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/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-networkconnectivity/v1/test/gapic_hub_service_v1.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1/test/gapic_hub_service_v1.ts deleted file mode 100644 index eef24f583fe..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1/test/gapic_hub_service_v1.ts +++ /dev/null @@ -1,2849 +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 hubserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.HubServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = hubserviceModule.v1.HubServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = hubserviceModule.v1.HubServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = hubserviceModule.v1.HubServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new hubserviceModule.v1.HubServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new hubserviceModule.v1.HubServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.hubServiceStub, undefined); - await client.initialize(); - assert(client.hubServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.hubServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.hubServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new hubserviceModule.v1.HubServiceClient({ - 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 hubserviceModule.v1.HubServiceClient({ - 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('getHub', () => { - it('invokes getHub without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.GetHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.GetHubRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.Hub() - ); - client.innerApiCalls.getHub = stubSimpleCall(expectedResponse); - const [response] = await client.getHub(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getHub without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.GetHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.GetHubRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.Hub() - ); - client.innerApiCalls.getHub = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getHub( - request, - (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1.IHub|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getHub with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.GetHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.GetHubRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getHub = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getHub(request), expectedError); - const actualRequest = (client.innerApiCalls.getHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getHub with closed client', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.GetHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.GetHubRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getHub(request), expectedError); - }); - }); - - describe('getSpoke', () => { - it('invokes getSpoke without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.GetSpokeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.Spoke() - ); - client.innerApiCalls.getSpoke = stubSimpleCall(expectedResponse); - const [response] = await client.getSpoke(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSpoke without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.GetSpokeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.Spoke() - ); - client.innerApiCalls.getSpoke = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSpoke( - request, - (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1.ISpoke|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSpoke with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.GetSpokeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSpoke = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSpoke(request), expectedError); - const actualRequest = (client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSpoke with closed client', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.GetSpokeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSpoke(request), expectedError); - }); - }); - - describe('createHub', () => { - it('invokes createHub without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.CreateHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.CreateHubRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createHub = stubLongRunningCall(expectedResponse); - const [operation] = await client.createHub(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createHub without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.CreateHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.CreateHubRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createHub = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createHub( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createHub with call error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.CreateHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.CreateHubRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createHub = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createHub(request), expectedError); - const actualRequest = (client.innerApiCalls.createHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createHub with LRO error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.CreateHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.CreateHubRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createHub = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createHub(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateHubProgress without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateHubProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateHubProgress with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateHubProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateHub', () => { - it('invokes updateHub without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest() - ); - request.hub ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.UpdateHubRequest', ['hub', 'name']); - request.hub.name = defaultValue1; - const expectedHeaderRequestParams = `hub.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateHub = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateHub(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateHub without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest() - ); - request.hub ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.UpdateHubRequest', ['hub', 'name']); - request.hub.name = defaultValue1; - const expectedHeaderRequestParams = `hub.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateHub = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateHub( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateHub with call error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest() - ); - request.hub ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.UpdateHubRequest', ['hub', 'name']); - request.hub.name = defaultValue1; - const expectedHeaderRequestParams = `hub.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateHub = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateHub(request), expectedError); - const actualRequest = (client.innerApiCalls.updateHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateHub with LRO error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest() - ); - request.hub ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.UpdateHubRequest', ['hub', 'name']); - request.hub.name = defaultValue1; - const expectedHeaderRequestParams = `hub.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateHub = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateHub(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateHubProgress without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateHubProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateHubProgress with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateHubProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteHub', () => { - it('invokes deleteHub without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.DeleteHubRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteHub = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteHub(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteHub without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.DeleteHubRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteHub = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteHub( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteHub with call error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.DeleteHubRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteHub = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteHub(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteHub with LRO error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.DeleteHubRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteHub = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteHub(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteHubProgress without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteHubProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteHubProgress with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteHubProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createSpoke', () => { - it('invokes createSpoke without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.CreateSpokeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSpoke = stubLongRunningCall(expectedResponse); - const [operation] = await client.createSpoke(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSpoke without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.CreateSpokeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSpoke = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSpoke( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSpoke with call error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.CreateSpokeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSpoke = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createSpoke(request), expectedError); - const actualRequest = (client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSpoke with LRO error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.CreateSpokeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSpoke = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createSpoke(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateSpokeProgress without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateSpokeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateSpokeProgress with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateSpokeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateSpoke', () => { - it('invokes updateSpoke without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest() - ); - request.spoke ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.UpdateSpokeRequest', ['spoke', 'name']); - request.spoke.name = defaultValue1; - const expectedHeaderRequestParams = `spoke.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSpoke = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateSpoke(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSpoke without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest() - ); - request.spoke ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.UpdateSpokeRequest', ['spoke', 'name']); - request.spoke.name = defaultValue1; - const expectedHeaderRequestParams = `spoke.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSpoke = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSpoke( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSpoke with call error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest() - ); - request.spoke ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.UpdateSpokeRequest', ['spoke', 'name']); - request.spoke.name = defaultValue1; - const expectedHeaderRequestParams = `spoke.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSpoke = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateSpoke(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSpoke with LRO error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest() - ); - request.spoke ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.UpdateSpokeRequest', ['spoke', 'name']); - request.spoke.name = defaultValue1; - const expectedHeaderRequestParams = `spoke.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSpoke = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateSpoke(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateSpokeProgress without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateSpokeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateSpokeProgress with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateSpokeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteSpoke', () => { - it('invokes deleteSpoke without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.DeleteSpokeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSpoke = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteSpoke(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSpoke without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.DeleteSpokeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSpoke = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSpoke( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSpoke with call error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.DeleteSpokeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSpoke = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteSpoke(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSpoke with LRO error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.DeleteSpokeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSpoke = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteSpoke(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteSpokeProgress without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteSpokeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteSpokeProgress with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteSpokeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listHubs', () => { - it('invokes listHubs without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListHubsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - ]; - client.innerApiCalls.listHubs = stubSimpleCall(expectedResponse); - const [response] = await client.listHubs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listHubs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listHubs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listHubs without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListHubsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - ]; - client.innerApiCalls.listHubs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listHubs( - request, - (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1.IHub[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listHubs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listHubs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listHubs with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListHubsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listHubs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listHubs(request), expectedError); - const actualRequest = (client.innerApiCalls.listHubs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listHubs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listHubsStream without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListHubsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - ]; - client.descriptors.page.listHubs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listHubsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1.Hub[] = []; - stream.on('data', (response: protos.google.cloud.networkconnectivity.v1.Hub) => { - 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.listHubs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listHubs, request)); - assert( - (client.descriptors.page.listHubs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listHubsStream with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListHubsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listHubs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listHubsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1.Hub[] = []; - stream.on('data', (response: protos.google.cloud.networkconnectivity.v1.Hub) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listHubs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listHubs, request)); - assert( - (client.descriptors.page.listHubs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listHubs without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListHubsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - ]; - client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networkconnectivity.v1.IHub[] = []; - const iterable = client.listHubsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listHubs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listHubs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listHubs with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListHubsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listHubsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networkconnectivity.v1.IHub[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listHubs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listHubs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listSpokes', () => { - it('invokes listSpokes without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListSpokesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - ]; - client.innerApiCalls.listSpokes = stubSimpleCall(expectedResponse); - const [response] = await client.listSpokes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSpokes without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListSpokesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - ]; - client.innerApiCalls.listSpokes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSpokes( - request, - (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1.ISpoke[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSpokes with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListSpokesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSpokes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSpokes(request), expectedError); - const actualRequest = (client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSpokesStream without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListSpokesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - ]; - client.descriptors.page.listSpokes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSpokesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1.Spoke[] = []; - stream.on('data', (response: protos.google.cloud.networkconnectivity.v1.Spoke) => { - 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.listSpokes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSpokes, request)); - assert( - (client.descriptors.page.listSpokes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listSpokesStream with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListSpokesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSpokes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSpokesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1.Spoke[] = []; - stream.on('data', (response: protos.google.cloud.networkconnectivity.v1.Spoke) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSpokes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSpokes, request)); - assert( - (client.descriptors.page.listSpokes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSpokes without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListSpokesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - ]; - client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networkconnectivity.v1.ISpoke[] = []; - const iterable = client.listSpokesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSpokes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSpokes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSpokes with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1.ListSpokesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSpokesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networkconnectivity.v1.ISpoke[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSpokes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSpokes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('hub', () => { - const fakePath = "/rendered/path/hub"; - const expectedParameters = { - project: "projectValue", - hub: "hubValue", - }; - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.hubPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.hubPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('hubPath', () => { - const result = client.hubPath("projectValue", "hubValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.hubPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromHubName', () => { - const result = client.matchProjectFromHubName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.hubPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchHubFromHubName', () => { - const result = client.matchHubFromHubName(fakePath); - assert.strictEqual(result, "hubValue"); - assert((client.pathTemplates.hubPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('instance', () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - zone: "zoneValue", - instance: "instanceValue", - }; - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "zoneValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchZoneFromInstanceName', () => { - const result = client.matchZoneFromInstanceName(fakePath); - assert.strictEqual(result, "zoneValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interconnectAttachment', () => { - const fakePath = "/rendered/path/interconnectAttachment"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - resource_id: "resourceIdValue", - }; - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.interconnectAttachmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interconnectAttachmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interconnectAttachmentPath', () => { - const result = client.interconnectAttachmentPath("projectValue", "regionValue", "resourceIdValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interconnectAttachmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterconnectAttachmentName', () => { - const result = client.matchProjectFromInterconnectAttachmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromInterconnectAttachmentName', () => { - const result = client.matchRegionFromInterconnectAttachmentName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchResourceIdFromInterconnectAttachmentName', () => { - const result = client.matchResourceIdFromInterconnectAttachmentName(fakePath); - assert.strictEqual(result, "resourceIdValue"); - assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('network', () => { - const fakePath = "/rendered/path/network"; - const expectedParameters = { - project: "projectValue", - resource_id: "resourceIdValue", - }; - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.networkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath("projectValue", "resourceIdValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchResourceIdFromNetworkName', () => { - const result = client.matchResourceIdFromNetworkName(fakePath); - assert.strictEqual(result, "resourceIdValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('spoke', () => { - const fakePath = "/rendered/path/spoke"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - spoke: "spokeValue", - }; - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.spokePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.spokePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('spokePath', () => { - const result = client.spokePath("projectValue", "locationValue", "spokeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.spokePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSpokeName', () => { - const result = client.matchProjectFromSpokeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.spokePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSpokeName', () => { - const result = client.matchLocationFromSpokeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.spokePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSpokeFromSpokeName', () => { - const result = client.matchSpokeFromSpokeName(fakePath); - assert.strictEqual(result, "spokeValue"); - assert((client.pathTemplates.spokePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('vpnTunnel', () => { - const fakePath = "/rendered/path/vpnTunnel"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - resource_id: "resourceIdValue", - }; - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.vpnTunnelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.vpnTunnelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('vpnTunnelPath', () => { - const result = client.vpnTunnelPath("projectValue", "regionValue", "resourceIdValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.vpnTunnelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromVpnTunnelName', () => { - const result = client.matchProjectFromVpnTunnelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromVpnTunnelName', () => { - const result = client.matchRegionFromVpnTunnelName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchResourceIdFromVpnTunnelName', () => { - const result = client.matchResourceIdFromVpnTunnelName(fakePath); - assert.strictEqual(result, "resourceIdValue"); - assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1/tsconfig.json b/owl-bot-staging/google-cloud-networkconnectivity/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/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-networkconnectivity/v1/webpack.config.js b/owl-bot-staging/google-cloud-networkconnectivity/v1/webpack.config.js deleted file mode 100644 index 2412b4e375c..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/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: 'HubService', - filename: './hub-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-networkconnectivity/v1alpha1/.eslintignore b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.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-networkconnectivity/v1alpha1/.eslintrc.json b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.gitignore b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.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-networkconnectivity/v1alpha1/.jsdoc.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.jsdoc.js deleted file mode 100644 index 37865cfe2ea..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.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/network-connectivity', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.mocharc.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.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-networkconnectivity/v1alpha1/.prettierrc.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/.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-networkconnectivity/v1alpha1/README.md b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/README.md deleted file mode 100644 index 086026da9e1..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/README.md +++ /dev/null @@ -1 +0,0 @@ -Networkconnectivity: Nodejs Client diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/package.json b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/package.json deleted file mode 100644 index 3944e98cf57..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/network-connectivity", - "version": "0.1.0", - "description": "Networkconnectivity client for Node.js", - "repository": "googleapis/nodejs-networkconnectivity", - "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 networkconnectivity", - "networkconnectivity", - "hub service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/common.proto b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/common.proto deleted file mode 100644 index 1ef4b4714da..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/common.proto +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.networkconnectivity.v1alpha1; - -import "google/api/field_behavior.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1Alpha1"; -option go_package = "cloud.google.com/go/networkconnectivity/apiv1alpha1/networkconnectivitypb;networkconnectivitypb"; -option java_multiple_files = true; -option java_outer_classname = "CommonProto"; -option java_package = "com.google.cloud.networkconnectivity.v1alpha1"; -option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1alpha1"; -option ruby_package = "Google::Cloud::NetworkConnectivity::V1alpha1"; - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/hub.proto b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/hub.proto deleted file mode 100644 index 72875cfb66e..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/hub.proto +++ /dev/null @@ -1,551 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.networkconnectivity.v1alpha1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1Alpha1"; -option go_package = "cloud.google.com/go/networkconnectivity/apiv1alpha1/networkconnectivitypb;networkconnectivitypb"; -option java_multiple_files = true; -option java_outer_classname = "HubProto"; -option java_package = "com.google.cloud.networkconnectivity.v1alpha1"; -option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1alpha1"; -option ruby_package = "Google::Cloud::NetworkConnectivity::V1alpha1"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/VpnTunnel" - pattern: "projects/{project}/regions/{region}/vpnTunnels/{resource_id}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/InterconnectAttachment" - pattern: "projects/{project}/regions/{region}/interconnectAttachments/{resource_id}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Instance" - pattern: "projects/{project}/zones/{zone}/instances/{instance}" -}; - -// Network Connectivity Center is a hub-and-spoke abstraction for -// network connectivity management in Google Cloud. It reduces -// operational complexity through a simple, centralized connectivity management -// model. -service HubService { - option (google.api.default_host) = "networkconnectivity.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists Hubs in a given project and location. - rpc ListHubs(ListHubsRequest) returns (ListHubsResponse) { - option (google.api.http) = { - get: "/v1alpha1/{parent=projects/*/locations/global}/hubs" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single Hub. - rpc GetHub(GetHubRequest) returns (Hub) { - option (google.api.http) = { - get: "/v1alpha1/{name=projects/*/locations/global/hubs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new Hub in a given project and location. - rpc CreateHub(CreateHubRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha1/{parent=projects/*/locations/global}/hubs" - body: "hub" - }; - option (google.api.method_signature) = "parent,hub,hub_id"; - option (google.longrunning.operation_info) = { - response_type: "Hub" - metadata_type: "OperationMetadata" - }; - } - - // Updates the parameters of a single Hub. - rpc UpdateHub(UpdateHubRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1alpha1/{hub.name=projects/*/locations/global/hubs/*}" - body: "hub" - }; - option (google.api.method_signature) = "hub,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Hub" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a single Hub. - rpc DeleteHub(DeleteHubRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1alpha1/{name=projects/*/locations/global/hubs/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Lists Spokes in a given project and location. - rpc ListSpokes(ListSpokesRequest) returns (ListSpokesResponse) { - option (google.api.http) = { - get: "/v1alpha1/{parent=projects/*/locations/*}/spokes" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single Spoke. - rpc GetSpoke(GetSpokeRequest) returns (Spoke) { - option (google.api.http) = { - get: "/v1alpha1/{name=projects/*/locations/*/spokes/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new Spoke in a given project and location. - rpc CreateSpoke(CreateSpokeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha1/{parent=projects/*/locations/*}/spokes" - body: "spoke" - }; - option (google.api.method_signature) = "parent,spoke,spoke_id"; - option (google.longrunning.operation_info) = { - response_type: "Spoke" - metadata_type: "OperationMetadata" - }; - } - - // Updates the parameters of a single Spoke. - rpc UpdateSpoke(UpdateSpokeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1alpha1/{spoke.name=projects/*/locations/*/spokes/*}" - body: "spoke" - }; - option (google.api.method_signature) = "spoke,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Spoke" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a single Spoke. - rpc DeleteSpoke(DeleteSpokeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1alpha1/{name=projects/*/locations/*/spokes/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } -} - -// Network Connectivity Center is a hub-and-spoke abstraction for -// network connectivity management in Google Cloud. It reduces -// operational complexity through a simple, centralized connectivity management -// model. Following is the resource message of a hub. -message Hub { - option (google.api.resource) = { - type: "networkconnectivity.googleapis.com/Hub" - pattern: "projects/{project}/locations/global/hubs/{hub}" - }; - - // Immutable. The name of a Hub resource. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Time when the Hub was created. - google.protobuf.Timestamp create_time = 2; - - // Time when the Hub was updated. - google.protobuf.Timestamp update_time = 3; - - // User-defined labels. - map labels = 4; - - // Short description of the hub resource. - string description = 5; - - // Output only. A list of the URIs of all attached spokes - repeated string spokes = 6 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Spoke" - } - ]; - - // Output only. Google-generated UUID for this resource. This is unique across all Hub - // resources. If a Hub resource is deleted and another with the same name is - // created, it gets a different unique_id. - string unique_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current lifecycle state of this Hub. - State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A Spoke is an abstraction of a network attachment being attached -// to a Hub. A Spoke can be underlying a VPN tunnel, a -// VLAN (interconnect) attachment, a Router appliance, etc. -message Spoke { - option (google.api.resource) = { - type: "networkconnectivity.googleapis.com/Spoke" - pattern: "projects/{project}/locations/{location}/spokes/{spoke}" - }; - - // Immutable. The name of a Spoke resource. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // The time when the Spoke was created. - google.protobuf.Timestamp create_time = 2; - - // The time when the Spoke was updated. - google.protobuf.Timestamp update_time = 3; - - // User-defined labels. - map labels = 4; - - // Short description of the spoke resource - string description = 5; - - // The resource URL of the hub resource that the spoke is attached to - string hub = 6 [(google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Hub" - }]; - - // The URIs of linked VPN tunnel resources - repeated string linked_vpn_tunnels = 12 [(google.api.resource_reference) = { - type: "compute.googleapis.com/VpnTunnel" - }]; - - // The URIs of linked interconnect attachment resources - repeated string linked_interconnect_attachments = 13 [(google.api.resource_reference) = { - type: "compute.googleapis.com/InterconnectAttachment" - }]; - - // The URIs of linked Router appliance resources - repeated RouterApplianceInstance linked_router_appliance_instances = 14; - - // Output only. Google-generated UUID for this resource. This is unique across all Spoke - // resources. If a Spoke resource is deleted and another with the same name is - // created, it gets a different unique_id. - string unique_id = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current lifecycle state of this Hub. - State state = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request for [HubService.ListHubs][google.cloud.networkconnectivity.v1alpha1.HubService.ListHubs] method. -message ListHubsRequest { - // Required. The parent resource's name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of results per page that should be returned. - int32 page_size = 2; - - // The page token. - string page_token = 3; - - // A filter expression that filters the results listed in the response. - string filter = 4; - - // Sort the results by a certain order. - string order_by = 5; -} - -// Response for [HubService.ListHubs][google.cloud.networkconnectivity.v1alpha1.HubService.ListHubs] method. -message ListHubsResponse { - // Hubs to be returned. - repeated Hub hubs = 1; - - // The next pagination token in the List response. It should be used as - // page_token for the following request. An empty value means no more result. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request for [HubService.GetHub][google.cloud.networkconnectivity.v1alpha1.HubService.GetHub] method. -message GetHubRequest { - // Required. Name of the Hub resource to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Hub" - } - ]; -} - -// Request for [HubService.CreateHub][google.cloud.networkconnectivity.v1alpha1.HubService.CreateHub] method. -message CreateHubRequest { - // Required. The parent resource's name of the Hub. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. Unique id for the Hub to create. - string hub_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Initial values for a new Hub. - Hub hub = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for [HubService.UpdateHub][google.cloud.networkconnectivity.v1alpha1.HubService.UpdateHub] method. -message UpdateHubRequest { - // Optional. Field mask is used to specify the fields to be overwritten in the - // Hub resource by the update. - // The fields specified in the update_mask are relative to the resource, not - // the full request. A field will be overwritten if it is in the mask. If the - // user does not provide a mask then all fields will be overwritten. - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The state that the Hub should be in after the update. - Hub hub = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request for [HubService.DeleteHub][google.cloud.networkconnectivity.v1alpha1.HubService.DeleteHub]. -message DeleteHubRequest { - // Required. The name of the Hub to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Hub" - } - ]; - - // Optional. An optional request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request for [HubService.ListSpokes][google.cloud.networkconnectivity.v1alpha1.HubService.ListSpokes]. -message ListSpokesRequest { - // Required. The parent's resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of results per page that should be returned. - int32 page_size = 2; - - // The page token. - string page_token = 3; - - // A filter expression that filters the results listed in the response. - string filter = 4; - - // Sort the results by a certain order. - string order_by = 5; -} - -// The response for [HubService.ListSpokes][google.cloud.networkconnectivity.v1alpha1.HubService.ListSpokes]. -message ListSpokesResponse { - // Spokes to be returned. - repeated Spoke spokes = 1; - - // The next pagination token in the List response. It should be used as - // page_token for the following request. An empty value means no more result. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// The request for [HubService.GetSpoke][google.cloud.networkconnectivity.v1alpha1.HubService.GetSpoke]. -message GetSpokeRequest { - // Required. The name of Spoke resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Spoke" - } - ]; -} - -// The request for [HubService.CreateSpoke][google.cloud.networkconnectivity.v1alpha1.HubService.CreateSpoke]. -message CreateSpokeRequest { - // Required. The parent's resource name of the Spoke. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. Unique id for the Spoke to create. - string spoke_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Initial values for a new Hub. - Spoke spoke = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for [HubService.UpdateSpoke][google.cloud.networkconnectivity.v1alpha1.HubService.UpdateSpoke] method. -message UpdateSpokeRequest { - // Optional. Field mask is used to specify the fields to be overwritten in the - // Spoke resource by the update. - // The fields specified in the update_mask are relative to the resource, not - // the full request. A field will be overwritten if it is in the mask. If the - // user does not provide a mask then all fields will be overwritten. - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The state that the Spoke should be in after the update. - Spoke spoke = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request for [HubService.DeleteSpoke][google.cloud.networkconnectivity.v1alpha1.HubService.DeleteSpoke]. -message DeleteSpokeRequest { - // Required. The name of the Spoke to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Spoke" - } - ]; - - // Optional. An optional request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// RouterAppliance represents a Router appliance which is specified by a VM URI -// and a NIC address. -message RouterApplianceInstance { - // The URI of the virtual machine resource - string virtual_machine = 1 [(google.api.resource_reference) = { - type: "compute.googleapis.com/Instance" - }]; - - // The IP address of the network interface to use for peering. - string ip_address = 3; - - string network_interface = 2 [deprecated = true]; -} - -// The State enum represents the lifecycle of a Network Connectivity Center -// resource. -enum State { - // No state information available - STATE_UNSPECIFIED = 0; - - // The resource's create operation is in progress - CREATING = 1; - - // The resource is active - ACTIVE = 2; - - // The resource's Delete operation is in progress - DELETING = 3; -} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.create_hub.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.create_hub.js deleted file mode 100644 index c8b5d34acc1..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.create_hub.js +++ /dev/null @@ -1,85 +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, hub) { - // [START networkconnectivity_v1alpha1_generated_HubService_CreateHub_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 parent resource's name of the Hub. - */ - // const parent = 'abc123' - /** - * Optional. Unique id for the Hub to create. - */ - // const hubId = 'abc123' - /** - * Required. Initial values for a new Hub. - */ - // const hub = {} - /** - * Optional. An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callCreateHub() { - // Construct request - const request = { - parent, - hub, - }; - - // Run request - const [operation] = await networkconnectivityClient.createHub(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateHub(); - // [END networkconnectivity_v1alpha1_generated_HubService_CreateHub_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.create_spoke.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.create_spoke.js deleted file mode 100644 index 343d50b558f..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.create_spoke.js +++ /dev/null @@ -1,85 +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, spoke) { - // [START networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_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 parent's resource name of the Spoke. - */ - // const parent = 'abc123' - /** - * Optional. Unique id for the Spoke to create. - */ - // const spokeId = 'abc123' - /** - * Required. Initial values for a new Hub. - */ - // const spoke = {} - /** - * Optional. An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callCreateSpoke() { - // Construct request - const request = { - parent, - spoke, - }; - - // Run request - const [operation] = await networkconnectivityClient.createSpoke(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateSpoke(); - // [END networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.delete_hub.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.delete_hub.js deleted file mode 100644 index 93c03c92be0..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.delete_hub.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(name) { - // [START networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Hub to delete. - */ - // const name = 'abc123' - /** - * Optional. An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callDeleteHub() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await networkconnectivityClient.deleteHub(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteHub(); - // [END networkconnectivity_v1alpha1_generated_HubService_DeleteHub_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.delete_spoke.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.delete_spoke.js deleted file mode 100644 index cca64f13b62..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.delete_spoke.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(name) { - // [START networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Spoke to delete. - */ - // const name = 'abc123' - /** - * Optional. An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callDeleteSpoke() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await networkconnectivityClient.deleteSpoke(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteSpoke(); - // [END networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.get_hub.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.get_hub.js deleted file mode 100644 index 9e6f1b3936f..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.get_hub.js +++ /dev/null @@ -1,61 +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 networkconnectivity_v1alpha1_generated_HubService_GetHub_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 Hub resource to get. - */ - // const name = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callGetHub() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await networkconnectivityClient.getHub(request); - console.log(response); - } - - callGetHub(); - // [END networkconnectivity_v1alpha1_generated_HubService_GetHub_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.get_spoke.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.get_spoke.js deleted file mode 100644 index bb562af924c..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.get_spoke.js +++ /dev/null @@ -1,61 +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 networkconnectivity_v1alpha1_generated_HubService_GetSpoke_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of Spoke resource. - */ - // const name = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callGetSpoke() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await networkconnectivityClient.getSpoke(request); - console.log(response); - } - - callGetSpoke(); - // [END networkconnectivity_v1alpha1_generated_HubService_GetSpoke_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.list_hubs.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.list_hubs.js deleted file mode 100644 index 0d356f939a3..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.list_hubs.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 networkconnectivity_v1alpha1_generated_HubService_ListHubs_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 parent resource's name. - */ - // const parent = 'abc123' - /** - * The maximum number of results per page that should be returned. - */ - // const pageSize = 1234 - /** - * The page token. - */ - // const pageToken = 'abc123' - /** - * A filter expression that filters the results listed in the response. - */ - // const filter = 'abc123' - /** - * Sort the results by a certain order. - */ - // const orderBy = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callListHubs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await networkconnectivityClient.listHubsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListHubs(); - // [END networkconnectivity_v1alpha1_generated_HubService_ListHubs_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.list_spokes.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.list_spokes.js deleted file mode 100644 index 4cb6315bb83..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.list_spokes.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 networkconnectivity_v1alpha1_generated_HubService_ListSpokes_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 parent's resource name. - */ - // const parent = 'abc123' - /** - * The maximum number of results per page that should be returned. - */ - // const pageSize = 1234 - /** - * The page token. - */ - // const pageToken = 'abc123' - /** - * A filter expression that filters the results listed in the response. - */ - // const filter = 'abc123' - /** - * Sort the results by a certain order. - */ - // const orderBy = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callListSpokes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await networkconnectivityClient.listSpokesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSpokes(); - // [END networkconnectivity_v1alpha1_generated_HubService_ListSpokes_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.update_hub.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.update_hub.js deleted file mode 100644 index cced7221ab6..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.update_hub.js +++ /dev/null @@ -1,84 +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(hub) { - // [START networkconnectivity_v1alpha1_generated_HubService_UpdateHub_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. - */ - /** - * Optional. Field mask is used to specify the fields to be overwritten in the - * Hub resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - */ - // const updateMask = {} - /** - * Required. The state that the Hub should be in after the update. - */ - // const hub = {} - /** - * Optional. An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callUpdateHub() { - // Construct request - const request = { - hub, - }; - - // Run request - const [operation] = await networkconnectivityClient.updateHub(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateHub(); - // [END networkconnectivity_v1alpha1_generated_HubService_UpdateHub_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.update_spoke.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.update_spoke.js deleted file mode 100644 index bbd35a85eea..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/hub_service.update_spoke.js +++ /dev/null @@ -1,84 +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(spoke) { - // [START networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_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. - */ - /** - * Optional. Field mask is used to specify the fields to be overwritten in the - * Spoke resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - */ - // const updateMask = {} - /** - * Required. The state that the Spoke should be in after the update. - */ - // const spoke = {} - /** - * Optional. An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callUpdateSpoke() { - // Construct request - const request = { - spoke, - }; - - // Run request - const [operation] = await networkconnectivityClient.updateSpoke(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateSpoke(); - // [END networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_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-networkconnectivity/v1alpha1/samples/generated/v1alpha1/snippet_metadata_google.cloud.networkconnectivity.v1alpha1.json b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/snippet_metadata_google.cloud.networkconnectivity.v1alpha1.json deleted file mode 100644 index 9aa3324b1dd..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/samples/generated/v1alpha1/snippet_metadata_google.cloud.networkconnectivity.v1alpha1.json +++ /dev/null @@ -1,495 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-networkconnectivity", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.networkconnectivity.v1alpha1", - "version": "v1alpha1" - } - ] - }, - "snippets": [ - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_ListHubs_async", - "title": "HubService listHubs Sample", - "origin": "API_DEFINITION", - "description": " Lists Hubs in a given project and location.", - "canonical": true, - "file": "hub_service.list_hubs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListHubs", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.ListHubs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkconnectivity.v1alpha1.ListHubsResponse", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "ListHubs", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.ListHubs", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_GetHub_async", - "title": "HubService getHub Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single Hub.", - "canonical": true, - "file": "hub_service.get_hub.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetHub", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.GetHub", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkconnectivity.v1alpha1.Hub", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "GetHub", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.GetHub", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_CreateHub_async", - "title": "HubService createHub Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Hub in a given project and location.", - "canonical": true, - "file": "hub_service.create_hub.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateHub", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.CreateHub", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "hub_id", - "type": "TYPE_STRING" - }, - { - "name": "hub", - "type": ".google.cloud.networkconnectivity.v1alpha1.Hub" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "CreateHub", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.CreateHub", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_UpdateHub_async", - "title": "HubService updateHub Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of a single Hub.", - "canonical": true, - "file": "hub_service.update_hub.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateHub", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.UpdateHub", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "hub", - "type": ".google.cloud.networkconnectivity.v1alpha1.Hub" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "UpdateHub", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.UpdateHub", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async", - "title": "HubService deleteHub Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single Hub.", - "canonical": true, - "file": "hub_service.delete_hub.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteHub", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.DeleteHub", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "DeleteHub", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.DeleteHub", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_ListSpokes_async", - "title": "HubService listSpokes Sample", - "origin": "API_DEFINITION", - "description": " Lists Spokes in a given project and location.", - "canonical": true, - "file": "hub_service.list_spokes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSpokes", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.ListSpokes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkconnectivity.v1alpha1.ListSpokesResponse", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "ListSpokes", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.ListSpokes", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_GetSpoke_async", - "title": "HubService getSpoke Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single Spoke.", - "canonical": true, - "file": "hub_service.get_spoke.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSpoke", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.GetSpoke", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkconnectivity.v1alpha1.Spoke", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "GetSpoke", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.GetSpoke", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_async", - "title": "HubService createSpoke Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Spoke in a given project and location.", - "canonical": true, - "file": "hub_service.create_spoke.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSpoke", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.CreateSpoke", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "spoke_id", - "type": "TYPE_STRING" - }, - { - "name": "spoke", - "type": ".google.cloud.networkconnectivity.v1alpha1.Spoke" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "CreateSpoke", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.CreateSpoke", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_async", - "title": "HubService updateSpoke Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of a single Spoke.", - "canonical": true, - "file": "hub_service.update_spoke.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSpoke", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.UpdateSpoke", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "spoke", - "type": ".google.cloud.networkconnectivity.v1alpha1.Spoke" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "UpdateSpoke", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.UpdateSpoke", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async", - "title": "HubService deleteSpoke Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single Spoke.", - "canonical": true, - "file": "hub_service.delete_spoke.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteSpoke", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.DeleteSpoke", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "DeleteSpoke", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.DeleteSpoke", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/index.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/index.ts deleted file mode 100644 index e31f63613d0..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/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 v1alpha1 from './v1alpha1'; -const HubServiceClient = v1alpha1.HubServiceClient; -type HubServiceClient = v1alpha1.HubServiceClient; -export {v1alpha1, HubServiceClient}; -export default {v1alpha1, HubServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/gapic_metadata.json b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/gapic_metadata.json deleted file mode 100644 index c9dd97f35eb..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/gapic_metadata.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.networkconnectivity.v1alpha1", - "libraryPackage": "@google-cloud/network-connectivity", - "services": { - "HubService": { - "clients": { - "grpc": { - "libraryClient": "HubServiceClient", - "rpcs": { - "GetHub": { - "methods": [ - "getHub" - ] - }, - "GetSpoke": { - "methods": [ - "getSpoke" - ] - }, - "CreateHub": { - "methods": [ - "createHub" - ] - }, - "UpdateHub": { - "methods": [ - "updateHub" - ] - }, - "DeleteHub": { - "methods": [ - "deleteHub" - ] - }, - "CreateSpoke": { - "methods": [ - "createSpoke" - ] - }, - "UpdateSpoke": { - "methods": [ - "updateSpoke" - ] - }, - "DeleteSpoke": { - "methods": [ - "deleteSpoke" - ] - }, - "ListHubs": { - "methods": [ - "listHubs", - "listHubsStream", - "listHubsAsync" - ] - }, - "ListSpokes": { - "methods": [ - "listSpokes", - "listSpokesStream", - "listSpokesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "HubServiceClient", - "rpcs": { - "GetHub": { - "methods": [ - "getHub" - ] - }, - "GetSpoke": { - "methods": [ - "getSpoke" - ] - }, - "CreateHub": { - "methods": [ - "createHub" - ] - }, - "UpdateHub": { - "methods": [ - "updateHub" - ] - }, - "DeleteHub": { - "methods": [ - "deleteHub" - ] - }, - "CreateSpoke": { - "methods": [ - "createSpoke" - ] - }, - "UpdateSpoke": { - "methods": [ - "updateSpoke" - ] - }, - "DeleteSpoke": { - "methods": [ - "deleteSpoke" - ] - }, - "ListHubs": { - "methods": [ - "listHubs", - "listHubsStream", - "listHubsAsync" - ] - }, - "ListSpokes": { - "methods": [ - "listSpokes", - "listSpokesStream", - "listSpokesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_client.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_client.ts deleted file mode 100644 index 99a2070f087..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_client.ts +++ /dev/null @@ -1,1829 +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, GrpcClientOptions, LROperation, 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/v1alpha1/hub_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './hub_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Network Connectivity Center is a hub-and-spoke abstraction for - * network connectivity management in Google Cloud. It reduces - * operational complexity through a simple, centralized connectivity management - * model. - * @class - * @memberof v1alpha1 - */ -export class HubServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - hubServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of HubServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 HubServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof HubServiceClient; - 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 { - 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 = { - hubPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/global/hubs/{hub}' - ), - instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/zones/{zone}/instances/{instance}' - ), - interconnectAttachmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/interconnectAttachments/{resource_id}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - spokePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/spokes/{spoke}' - ), - vpnTunnelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/vpnTunnels/{resource_id}' - ), - }; - - // 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 = { - listHubs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'hubs'), - listSpokes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spokes') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha1/{resource=projects/*/locations/global/hubs/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha1/{resource=projects/*/locations/*/spokes/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha1/{resource=projects/*/locations/global/hubs/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/spokes/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha1/{resource=projects/*/locations/global/hubs/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/spokes/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createHubResponse = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.Hub') as gax.protobuf.Type; - const createHubMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const updateHubResponse = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.Hub') as gax.protobuf.Type; - const updateHubMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const deleteHubResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteHubMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const createSpokeResponse = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.Spoke') as gax.protobuf.Type; - const createSpokeMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const updateSpokeResponse = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.Spoke') as gax.protobuf.Type; - const updateSpokeMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const deleteSpokeResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteSpokeMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createHub: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createHubResponse.decode.bind(createHubResponse), - createHubMetadata.decode.bind(createHubMetadata)), - updateHub: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateHubResponse.decode.bind(updateHubResponse), - updateHubMetadata.decode.bind(updateHubMetadata)), - deleteHub: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteHubResponse.decode.bind(deleteHubResponse), - deleteHubMetadata.decode.bind(deleteHubMetadata)), - createSpoke: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createSpokeResponse.decode.bind(createSpokeResponse), - createSpokeMetadata.decode.bind(createSpokeMetadata)), - updateSpoke: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateSpokeResponse.decode.bind(updateSpokeResponse), - updateSpokeMetadata.decode.bind(updateSpokeMetadata)), - deleteSpoke: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteSpokeResponse.decode.bind(deleteSpokeResponse), - deleteSpokeMetadata.decode.bind(deleteSpokeMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networkconnectivity.v1alpha1.HubService', 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.hubServiceStub) { - return this.hubServiceStub; - } - - // Put together the "service stub" for - // google.cloud.networkconnectivity.v1alpha1.HubService. - this.hubServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networkconnectivity.v1alpha1.HubService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networkconnectivity.v1alpha1.HubService, - 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 hubServiceStubMethods = - ['listHubs', 'getHub', 'createHub', 'updateHub', 'deleteHub', 'listSpokes', 'getSpoke', 'createSpoke', 'updateSpoke', 'deleteSpoke']; - for (const methodName of hubServiceStubMethods) { - const callPromise = this.hubServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.hubServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'networkconnectivity.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 'networkconnectivity.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 -- - // ------------------- -/** - * Gets details of a single Hub. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the Hub resource to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.networkconnectivity.v1alpha1.Hub|Hub}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha1/hub_service.get_hub.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_GetHub_async - */ - getHub( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkconnectivity.v1alpha1.IHub, - protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|undefined, {}|undefined - ]>; - getHub( - request: protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networkconnectivity.v1alpha1.IHub, - protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|null|undefined, - {}|null|undefined>): void; - getHub( - request: protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, - callback: Callback< - protos.google.cloud.networkconnectivity.v1alpha1.IHub, - protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|null|undefined, - {}|null|undefined>): void; - getHub( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networkconnectivity.v1alpha1.IHub, - protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.networkconnectivity.v1alpha1.IHub, - protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networkconnectivity.v1alpha1.IHub, - protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|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.getHub(request, options, callback); - } -/** - * Gets details of a single Spoke. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of Spoke 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 protos.google.cloud.networkconnectivity.v1alpha1.Spoke|Spoke}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha1/hub_service.get_spoke.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_GetSpoke_async - */ - getSpoke( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, - protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|undefined, {}|undefined - ]>; - getSpoke( - request: protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, - protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|null|undefined, - {}|null|undefined>): void; - getSpoke( - request: protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest, - callback: Callback< - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, - protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|null|undefined, - {}|null|undefined>): void; - getSpoke( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, - protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, - protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, - protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|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.getSpoke(request, options, callback); - } - -/** - * Creates a new Hub in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name of the Hub. - * @param {string} [request.hubId] - * Optional. Unique id for the Hub to create. - * @param {google.cloud.networkconnectivity.v1alpha1.Hub} request.hub - * Required. Initial values for a new Hub. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha1/hub_service.create_hub.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_CreateHub_async - */ - createHub( - request?: protos.google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createHub( - request: protos.google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createHub( - request: protos.google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createHub( - request?: protos.google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createHub(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createHub()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha1/hub_service.create_hub.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_CreateHub_async - */ - async checkCreateHubProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createHub, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the parameters of a single Hub. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * Hub resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.networkconnectivity.v1alpha1.Hub} request.hub - * Required. The state that the Hub should be in after the update. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha1/hub_service.update_hub.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_UpdateHub_async - */ - updateHub( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateHub( - request: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateHub( - request: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateHub( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'hub.name': request.hub!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateHub(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateHub()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha1/hub_service.update_hub.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_UpdateHub_async - */ - async checkUpdateHubProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateHub, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single Hub. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Hub to delete. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha1/hub_service.delete_hub.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async - */ - deleteHub( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteHubRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteHub( - request: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteHubRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteHub( - request: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteHubRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteHub( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteHubRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteHub(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteHub()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha1/hub_service.delete_hub.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async - */ - async checkDeleteHubProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteHub, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new Spoke in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent's resource name of the Spoke. - * @param {string} [request.spokeId] - * Optional. Unique id for the Spoke to create. - * @param {google.cloud.networkconnectivity.v1alpha1.Spoke} request.spoke - * Required. Initial values for a new Hub. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha1/hub_service.create_spoke.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_async - */ - createSpoke( - request?: protos.google.cloud.networkconnectivity.v1alpha1.ICreateSpokeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createSpoke( - request: protos.google.cloud.networkconnectivity.v1alpha1.ICreateSpokeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createSpoke( - request: protos.google.cloud.networkconnectivity.v1alpha1.ICreateSpokeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createSpoke( - request?: protos.google.cloud.networkconnectivity.v1alpha1.ICreateSpokeRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createSpoke(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createSpoke()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha1/hub_service.create_spoke.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_async - */ - async checkCreateSpokeProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createSpoke, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the parameters of a single Spoke. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * Spoke resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.networkconnectivity.v1alpha1.Spoke} request.spoke - * Required. The state that the Spoke should be in after the update. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha1/hub_service.update_spoke.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_async - */ - updateSpoke( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateSpokeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateSpoke( - request: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateSpokeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateSpoke( - request: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateSpokeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateSpoke( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateSpokeRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'spoke.name': request.spoke!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSpoke(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateSpoke()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha1/hub_service.update_spoke.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_async - */ - async checkUpdateSpokeProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateSpoke, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single Spoke. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Spoke to delete. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha1/hub_service.delete_spoke.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async - */ - deleteSpoke( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteSpokeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteSpoke( - request: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteSpokeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteSpoke( - request: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteSpokeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteSpoke( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteSpokeRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteSpoke(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteSpoke()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha1/hub_service.delete_spoke.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async - */ - async checkDeleteSpokeProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteSpoke, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Hubs in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * A filter expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.networkconnectivity.v1alpha1.Hub|Hub}. - * 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 `listHubsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listHubs( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkconnectivity.v1alpha1.IHub[], - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest|null, - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse - ]>; - listHubs( - request: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1alpha1.IHub>): void; - listHubs( - request: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1alpha1.IHub>): void; - listHubs( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1alpha1.IHub>, - callback?: PaginationCallback< - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1alpha1.IHub>): - Promise<[ - protos.google.cloud.networkconnectivity.v1alpha1.IHub[], - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest|null, - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listHubs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * A filter expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @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 protos.google.cloud.networkconnectivity.v1alpha1.Hub|Hub} 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 `listHubsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listHubsStream( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - 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['listHubs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listHubs.createStream( - this.innerApiCalls.listHubs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listHubs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * A filter expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.networkconnectivity.v1alpha1.Hub|Hub}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha1/hub_service.list_hubs.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_ListHubs_async - */ - listHubsAsync( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - 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['listHubs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listHubs.asyncIterate( - this.innerApiCalls['listHubs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists Spokes in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent's resource name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * A filter expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.networkconnectivity.v1alpha1.Spoke|Spoke}. - * 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 `listSpokesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSpokes( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[], - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest|null, - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse - ]>; - listSpokes( - request: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke>): void; - listSpokes( - request: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke>): void; - listSpokes( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke>, - callback?: PaginationCallback< - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke>): - Promise<[ - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[], - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest|null, - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listSpokes(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent's resource name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * A filter expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @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 protos.google.cloud.networkconnectivity.v1alpha1.Spoke|Spoke} 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 `listSpokesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSpokesStream( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - 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['listSpokes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSpokes.createStream( - this.innerApiCalls.listSpokes as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSpokes`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent's resource name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * A filter expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.networkconnectivity.v1alpha1.Spoke|Spoke}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha1/hub_service.list_spokes.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_ListSpokes_async - */ - listSpokesAsync( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - 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['listSpokes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSpokes.asyncIterate( - this.innerApiCalls['listSpokes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified hub resource name string. - * - * @param {string} project - * @param {string} hub - * @returns {string} Resource name string. - */ - hubPath(project:string,hub:string) { - return this.pathTemplates.hubPathTemplate.render({ - project: project, - hub: hub, - }); - } - - /** - * Parse the project from Hub resource. - * - * @param {string} hubName - * A fully-qualified path representing Hub resource. - * @returns {string} A string representing the project. - */ - matchProjectFromHubName(hubName: string) { - return this.pathTemplates.hubPathTemplate.match(hubName).project; - } - - /** - * Parse the hub from Hub resource. - * - * @param {string} hubName - * A fully-qualified path representing Hub resource. - * @returns {string} A string representing the hub. - */ - matchHubFromHubName(hubName: string) { - return this.pathTemplates.hubPathTemplate.match(hubName).hub; - } - - /** - * Return a fully-qualified instance resource name string. - * - * @param {string} project - * @param {string} zone - * @param {string} instance - * @returns {string} Resource name string. - */ - instancePath(project:string,zone:string,instance:string) { - return this.pathTemplates.instancePathTemplate.render({ - project: project, - zone: zone, - instance: instance, - }); - } - - /** - * Parse the project from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).project; - } - - /** - * Parse the zone from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the zone. - */ - matchZoneFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).zone; - } - - /** - * Parse the instance from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).instance; - } - - /** - * Return a fully-qualified interconnectAttachment resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} resource_id - * @returns {string} Resource name string. - */ - interconnectAttachmentPath(project:string,region:string,resourceId:string) { - return this.pathTemplates.interconnectAttachmentPathTemplate.render({ - project: project, - region: region, - resource_id: resourceId, - }); - } - - /** - * Parse the project from InterconnectAttachment resource. - * - * @param {string} interconnectAttachmentName - * A fully-qualified path representing InterconnectAttachment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInterconnectAttachmentName(interconnectAttachmentName: string) { - return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).project; - } - - /** - * Parse the region from InterconnectAttachment resource. - * - * @param {string} interconnectAttachmentName - * A fully-qualified path representing InterconnectAttachment resource. - * @returns {string} A string representing the region. - */ - matchRegionFromInterconnectAttachmentName(interconnectAttachmentName: string) { - return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).region; - } - - /** - * Parse the resource_id from InterconnectAttachment resource. - * - * @param {string} interconnectAttachmentName - * A fully-qualified path representing InterconnectAttachment resource. - * @returns {string} A string representing the resource_id. - */ - matchResourceIdFromInterconnectAttachmentName(interconnectAttachmentName: string) { - return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).resource_id; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified spoke resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} spoke - * @returns {string} Resource name string. - */ - spokePath(project:string,location:string,spoke:string) { - return this.pathTemplates.spokePathTemplate.render({ - project: project, - location: location, - spoke: spoke, - }); - } - - /** - * Parse the project from Spoke resource. - * - * @param {string} spokeName - * A fully-qualified path representing Spoke resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSpokeName(spokeName: string) { - return this.pathTemplates.spokePathTemplate.match(spokeName).project; - } - - /** - * Parse the location from Spoke resource. - * - * @param {string} spokeName - * A fully-qualified path representing Spoke resource. - * @returns {string} A string representing the location. - */ - matchLocationFromSpokeName(spokeName: string) { - return this.pathTemplates.spokePathTemplate.match(spokeName).location; - } - - /** - * Parse the spoke from Spoke resource. - * - * @param {string} spokeName - * A fully-qualified path representing Spoke resource. - * @returns {string} A string representing the spoke. - */ - matchSpokeFromSpokeName(spokeName: string) { - return this.pathTemplates.spokePathTemplate.match(spokeName).spoke; - } - - /** - * Return a fully-qualified vpnTunnel resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} resource_id - * @returns {string} Resource name string. - */ - vpnTunnelPath(project:string,region:string,resourceId:string) { - return this.pathTemplates.vpnTunnelPathTemplate.render({ - project: project, - region: region, - resource_id: resourceId, - }); - } - - /** - * Parse the project from VpnTunnel resource. - * - * @param {string} vpnTunnelName - * A fully-qualified path representing VpnTunnel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromVpnTunnelName(vpnTunnelName: string) { - return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).project; - } - - /** - * Parse the region from VpnTunnel resource. - * - * @param {string} vpnTunnelName - * A fully-qualified path representing VpnTunnel resource. - * @returns {string} A string representing the region. - */ - matchRegionFromVpnTunnelName(vpnTunnelName: string) { - return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).region; - } - - /** - * Parse the resource_id from VpnTunnel resource. - * - * @param {string} vpnTunnelName - * A fully-qualified path representing VpnTunnel resource. - * @returns {string} A string representing the resource_id. - */ - matchResourceIdFromVpnTunnelName(vpnTunnelName: string) { - return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).resource_id; - } - - /** - * 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.hubServiceStub && !this._terminated) { - return this.hubServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_client_config.json b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_client_config.json deleted file mode 100644 index ac38b3fb814..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_client_config.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "interfaces": { - "google.cloud.networkconnectivity.v1alpha1.HubService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListHubs": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetHub": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateHub": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateHub": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteHub": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListSpokes": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetSpoke": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateSpoke": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSpoke": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteSpoke": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_proto_list.json b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_proto_list.json deleted file mode 100644 index af2e83266ef..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/hub_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/networkconnectivity/v1alpha1/common.proto", - "../../protos/google/cloud/networkconnectivity/v1alpha1/hub.proto" -] diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/index.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/index.ts deleted file mode 100644 index 937a411a485..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/src/v1alpha1/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 {HubServiceClient} from './hub_service_client'; diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index d3cd46d0a96..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/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 networkconnectivity = require('@google-cloud/network-connectivity'); - -function main() { - const hubServiceClient = new networkconnectivity.HubServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index ae4d979ece8..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/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 {HubServiceClient} from '@google-cloud/network-connectivity'; - -// check that the client class type name can be used -function doStuffWithHubServiceClient(client: HubServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const hubServiceClient = new HubServiceClient(); - doStuffWithHubServiceClient(hubServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/install.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/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-networkconnectivity/v1alpha1/test/gapic_hub_service_v1alpha1.ts b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/test/gapic_hub_service_v1alpha1.ts deleted file mode 100644 index 7f17fc9d099..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/test/gapic_hub_service_v1alpha1.ts +++ /dev/null @@ -1,2114 +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 hubserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1alpha1.HubServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = hubserviceModule.v1alpha1.HubServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = hubserviceModule.v1alpha1.HubServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = hubserviceModule.v1alpha1.HubServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.hubServiceStub, undefined); - await client.initialize(); - assert(client.hubServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.hubServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.hubServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - 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 hubserviceModule.v1alpha1.HubServiceClient({ - 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('getHub', () => { - it('invokes getHub without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.GetHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.GetHubRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.Hub() - ); - client.innerApiCalls.getHub = stubSimpleCall(expectedResponse); - const [response] = await client.getHub(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getHub without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.GetHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.GetHubRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.Hub() - ); - client.innerApiCalls.getHub = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getHub( - request, - (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1alpha1.IHub|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getHub with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.GetHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.GetHubRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getHub = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getHub(request), expectedError); - const actualRequest = (client.innerApiCalls.getHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getHub with closed client', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.GetHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.GetHubRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getHub(request), expectedError); - }); - }); - - describe('getSpoke', () => { - it('invokes getSpoke without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.Spoke() - ); - client.innerApiCalls.getSpoke = stubSimpleCall(expectedResponse); - const [response] = await client.getSpoke(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSpoke without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.Spoke() - ); - client.innerApiCalls.getSpoke = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSpoke( - request, - (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSpoke with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSpoke = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSpoke(request), expectedError); - const actualRequest = (client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSpoke with closed client', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSpoke(request), expectedError); - }); - }); - - describe('createHub', () => { - it('invokes createHub without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createHub = stubLongRunningCall(expectedResponse); - const [operation] = await client.createHub(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createHub without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createHub = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createHub( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createHub with call error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createHub = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createHub(request), expectedError); - const actualRequest = (client.innerApiCalls.createHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createHub with LRO error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createHub = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createHub(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateHubProgress without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateHubProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateHubProgress with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateHubProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateHub', () => { - it('invokes updateHub without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest() - ); - request.hub ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest', ['hub', 'name']); - request.hub.name = defaultValue1; - const expectedHeaderRequestParams = `hub.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateHub = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateHub(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateHub without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest() - ); - request.hub ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest', ['hub', 'name']); - request.hub.name = defaultValue1; - const expectedHeaderRequestParams = `hub.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateHub = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateHub( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateHub with call error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest() - ); - request.hub ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest', ['hub', 'name']); - request.hub.name = defaultValue1; - const expectedHeaderRequestParams = `hub.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateHub = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateHub(request), expectedError); - const actualRequest = (client.innerApiCalls.updateHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateHub with LRO error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest() - ); - request.hub ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest', ['hub', 'name']); - request.hub.name = defaultValue1; - const expectedHeaderRequestParams = `hub.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateHub = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateHub(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateHubProgress without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateHubProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateHubProgress with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateHubProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteHub', () => { - it('invokes deleteHub without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteHub = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteHub(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteHub without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteHub = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteHub( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteHub with call error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteHub = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteHub(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteHub with LRO error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteHub = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteHub(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteHubProgress without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteHubProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteHubProgress with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteHubProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createSpoke', () => { - it('invokes createSpoke without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSpoke = stubLongRunningCall(expectedResponse); - const [operation] = await client.createSpoke(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSpoke without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSpoke = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSpoke( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSpoke with call error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSpoke = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createSpoke(request), expectedError); - const actualRequest = (client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSpoke with LRO error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSpoke = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createSpoke(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateSpokeProgress without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateSpokeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateSpokeProgress with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateSpokeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateSpoke', () => { - it('invokes updateSpoke without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest() - ); - request.spoke ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest', ['spoke', 'name']); - request.spoke.name = defaultValue1; - const expectedHeaderRequestParams = `spoke.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSpoke = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateSpoke(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSpoke without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest() - ); - request.spoke ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest', ['spoke', 'name']); - request.spoke.name = defaultValue1; - const expectedHeaderRequestParams = `spoke.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSpoke = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSpoke( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSpoke with call error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest() - ); - request.spoke ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest', ['spoke', 'name']); - request.spoke.name = defaultValue1; - const expectedHeaderRequestParams = `spoke.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSpoke = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateSpoke(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSpoke with LRO error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest() - ); - request.spoke ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest', ['spoke', 'name']); - request.spoke.name = defaultValue1; - const expectedHeaderRequestParams = `spoke.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSpoke = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateSpoke(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateSpokeProgress without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateSpokeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateSpokeProgress with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateSpokeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteSpoke', () => { - it('invokes deleteSpoke without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSpoke = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteSpoke(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSpoke without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSpoke = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSpoke( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSpoke with call error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSpoke = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteSpoke(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSpoke with LRO error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSpoke = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteSpoke(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteSpokeProgress without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteSpokeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteSpokeProgress with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteSpokeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listHubs', () => { - it('invokes listHubs without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - ]; - client.innerApiCalls.listHubs = stubSimpleCall(expectedResponse); - const [response] = await client.listHubs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listHubs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listHubs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listHubs without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - ]; - client.innerApiCalls.listHubs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listHubs( - request, - (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1alpha1.IHub[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listHubs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listHubs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listHubs with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listHubs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listHubs(request), expectedError); - const actualRequest = (client.innerApiCalls.listHubs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listHubs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listHubsStream without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - ]; - client.descriptors.page.listHubs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listHubsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.Hub[] = []; - stream.on('data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Hub) => { - 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.listHubs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listHubs, request)); - assert( - (client.descriptors.page.listHubs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listHubsStream with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listHubs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listHubsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.Hub[] = []; - stream.on('data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Hub) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listHubs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listHubs, request)); - assert( - (client.descriptors.page.listHubs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listHubs without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - ]; - client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networkconnectivity.v1alpha1.IHub[] = []; - const iterable = client.listHubsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listHubs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listHubs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listHubs with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listHubsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.IHub[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listHubs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listHubs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listSpokes', () => { - it('invokes listSpokes without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - ]; - client.innerApiCalls.listSpokes = stubSimpleCall(expectedResponse); - const [response] = await client.listSpokes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSpokes without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - ]; - client.innerApiCalls.listSpokes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSpokes( - request, - (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSpokes with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSpokes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSpokes(request), expectedError); - const actualRequest = (client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSpokesStream without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - ]; - client.descriptors.page.listSpokes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSpokesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.Spoke[] = []; - stream.on('data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Spoke) => { - 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.listSpokes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSpokes, request)); - assert( - (client.descriptors.page.listSpokes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listSpokesStream with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSpokes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSpokesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.Spoke[] = []; - stream.on('data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Spoke) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSpokes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSpokes, request)); - assert( - (client.descriptors.page.listSpokes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSpokes without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - ]; - client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[] = []; - const iterable = client.listSpokesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSpokes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSpokes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSpokes with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSpokesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSpokes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSpokes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('hub', () => { - const fakePath = "/rendered/path/hub"; - const expectedParameters = { - project: "projectValue", - hub: "hubValue", - }; - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.hubPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.hubPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('hubPath', () => { - const result = client.hubPath("projectValue", "hubValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.hubPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromHubName', () => { - const result = client.matchProjectFromHubName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.hubPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchHubFromHubName', () => { - const result = client.matchHubFromHubName(fakePath); - assert.strictEqual(result, "hubValue"); - assert((client.pathTemplates.hubPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('instance', () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - zone: "zoneValue", - instance: "instanceValue", - }; - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "zoneValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchZoneFromInstanceName', () => { - const result = client.matchZoneFromInstanceName(fakePath); - assert.strictEqual(result, "zoneValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interconnectAttachment', () => { - const fakePath = "/rendered/path/interconnectAttachment"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - resource_id: "resourceIdValue", - }; - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.interconnectAttachmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interconnectAttachmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interconnectAttachmentPath', () => { - const result = client.interconnectAttachmentPath("projectValue", "regionValue", "resourceIdValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interconnectAttachmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterconnectAttachmentName', () => { - const result = client.matchProjectFromInterconnectAttachmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromInterconnectAttachmentName', () => { - const result = client.matchRegionFromInterconnectAttachmentName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchResourceIdFromInterconnectAttachmentName', () => { - const result = client.matchResourceIdFromInterconnectAttachmentName(fakePath); - assert.strictEqual(result, "resourceIdValue"); - assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('spoke', () => { - const fakePath = "/rendered/path/spoke"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - spoke: "spokeValue", - }; - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.spokePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.spokePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('spokePath', () => { - const result = client.spokePath("projectValue", "locationValue", "spokeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.spokePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSpokeName', () => { - const result = client.matchProjectFromSpokeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.spokePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSpokeName', () => { - const result = client.matchLocationFromSpokeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.spokePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSpokeFromSpokeName', () => { - const result = client.matchSpokeFromSpokeName(fakePath); - assert.strictEqual(result, "spokeValue"); - assert((client.pathTemplates.spokePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('vpnTunnel', () => { - const fakePath = "/rendered/path/vpnTunnel"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - resource_id: "resourceIdValue", - }; - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.vpnTunnelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.vpnTunnelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('vpnTunnelPath', () => { - const result = client.vpnTunnelPath("projectValue", "regionValue", "resourceIdValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.vpnTunnelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromVpnTunnelName', () => { - const result = client.matchProjectFromVpnTunnelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromVpnTunnelName', () => { - const result = client.matchRegionFromVpnTunnelName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchResourceIdFromVpnTunnelName', () => { - const result = client.matchResourceIdFromVpnTunnelName(fakePath); - assert.strictEqual(result, "resourceIdValue"); - assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/tsconfig.json b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/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-networkconnectivity/v1alpha1/webpack.config.js b/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/webpack.config.js deleted file mode 100644 index 2412b4e375c..00000000000 --- a/owl-bot-staging/google-cloud-networkconnectivity/v1alpha1/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: 'HubService', - filename: './hub-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-networkmanagement/v1/.eslintignore b/owl-bot-staging/google-cloud-networkmanagement/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1/.eslintrc.json b/owl-bot-staging/google-cloud-networkmanagement/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/.gitignore b/owl-bot-staging/google-cloud-networkmanagement/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1/.jsdoc.js b/owl-bot-staging/google-cloud-networkmanagement/v1/.jsdoc.js deleted file mode 100644 index d081790c646..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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/network-management', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/.mocharc.js b/owl-bot-staging/google-cloud-networkmanagement/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1/.prettierrc.js b/owl-bot-staging/google-cloud-networkmanagement/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1/README.md b/owl-bot-staging/google-cloud-networkmanagement/v1/README.md deleted file mode 100644 index 90c3778ad46..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Networkmanagement: Nodejs Client diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/package.json b/owl-bot-staging/google-cloud-networkmanagement/v1/package.json deleted file mode 100644 index 70e771ee9ed..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/network-management", - "version": "0.1.0", - "description": "Networkmanagement client for Node.js", - "repository": "googleapis/nodejs-networkmanagement", - "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 networkmanagement", - "networkmanagement", - "reachability service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/connectivity_test.proto b/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/connectivity_test.proto deleted file mode 100644 index 7bbdef65d38..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/connectivity_test.proto +++ /dev/null @@ -1,405 +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 -// -// 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.networkmanagement.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/networkmanagement/v1/trace.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.NetworkManagement.V1"; -option go_package = "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb;networkmanagementpb"; -option java_multiple_files = true; -option java_outer_classname = "TestOuterClass"; -option java_package = "com.google.cloud.networkmanagement.v1"; -option php_namespace = "Google\\Cloud\\NetworkManagement\\V1"; -option ruby_package = "Google::Cloud::NetworkManagement::V1"; - -// A Connectivity Test for a network reachability analysis. -message ConnectivityTest { - option (google.api.resource) = { - type: "networkmanagement.googleapis.com/ConnectivityTest" - pattern: "projects/{project}/locations/global/connectivityTests/{test}" - }; - - // Required. Unique name of the resource using the form: - // `projects/{project_id}/locations/global/connectivityTests/{test}` - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // The user-supplied description of the Connectivity Test. - // Maximum of 512 characters. - string description = 2; - - // Required. Source specification of the Connectivity Test. - // - // You can use a combination of source IP address, virtual machine - // (VM) instance, or Compute Engine network to uniquely identify - // the source location. - // - // Examples: - // If the source IP address is an internal IP address within a Google Cloud - // Virtual Private Cloud (VPC) network, then you must also specify the VPC - // network. Otherwise, specify the VM instance, which already contains its - // internal IP address and VPC network information. - // - // If the source of the test is within an on-premises network, then you must - // provide the destination VPC network. - // - // If the source endpoint is a Compute Engine VM instance with multiple - // network interfaces, the instance itself is not sufficient to identify the - // endpoint. So, you must also specify the source IP address or VPC network. - // - // A reachability analysis proceeds even if the source location is - // ambiguous. However, the test result may include endpoints that you don't - // intend to test. - Endpoint source = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Destination specification of the Connectivity Test. - // - // You can use a combination of destination IP address, Compute Engine - // VM instance, or VPC network to uniquely identify the destination - // location. - // - // Even if the destination IP address is not unique, the source IP - // location is unique. Usually, the analysis can infer the destination - // endpoint from route information. - // - // If the destination you specify is a VM instance and the instance has - // multiple network interfaces, then you must also specify either - // a destination IP address or VPC network to identify the destination - // interface. - // - // A reachability analysis proceeds even if the destination location is - // ambiguous. However, the result can include endpoints that you don't - // intend to test. - Endpoint destination = 4 [(google.api.field_behavior) = REQUIRED]; - - // IP Protocol of the test. When not provided, "TCP" is assumed. - string protocol = 5; - - // Other projects that may be relevant for reachability analysis. - // This is applicable to scenarios where a test can cross project boundaries. - repeated string related_projects = 6; - - // Output only. The display name of a Connectivity Test. - string display_name = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Resource labels to represent user-provided metadata. - map labels = 8; - - // Output only. The time the test was created. - google.protobuf.Timestamp create_time = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the test's configuration was updated. - google.protobuf.Timestamp update_time = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The reachability details of this test from the latest run. - // The details are updated when creating a new test, updating an - // existing test, or triggering a one-time rerun of an existing test. - ReachabilityDetails reachability_details = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The probing details of this test from the latest run, present - // for applicable tests only. The details are updated when creating a new - // test, updating an existing test, or triggering a one-time rerun of an - // existing test. - ProbingDetails probing_details = 14 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Source or destination of the Connectivity Test. -message Endpoint { - // The type definition of an endpoint's network. Use one of the - // following choices: - enum NetworkType { - // Default type if unspecified. - NETWORK_TYPE_UNSPECIFIED = 0; - - // A network hosted within Google Cloud. - // To receive more detailed output, specify the URI for the source or - // destination network. - GCP_NETWORK = 1; - - // A network hosted outside of Google Cloud. - // This can be an on-premises network, or a network hosted by another cloud - // provider. - NON_GCP_NETWORK = 2; - } - - // Type of the target of a forwarding rule. - enum ForwardingRuleTarget { - // Forwarding rule target is unknown. - FORWARDING_RULE_TARGET_UNSPECIFIED = 0; - - // Compute Engine instance for protocol forwarding. - INSTANCE = 1; - - // Load Balancer. The specific type can be found from [load_balancer_type] - // [google.cloud.networkmanagement.v1.Endpoint.load_balancer_type]. - LOAD_BALANCER = 2; - - // Classic Cloud VPN Gateway. - VPN_GATEWAY = 3; - - // Forwarding Rule is a Private Service Connect endpoint. - PSC = 4; - } - - // Wrapper for Cloud Function attributes. - message CloudFunctionEndpoint { - // A [Cloud Function](https://cloud.google.com/functions) name. - string uri = 1; - } - - // Wrapper for the App Engine service version attributes. - message AppEngineVersionEndpoint { - // An [App Engine](https://cloud.google.com/appengine) [service - // version](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions) - // name. - string uri = 1; - } - - // Wrapper for Cloud Run revision attributes. - message CloudRunRevisionEndpoint { - // A [Cloud Run](https://cloud.google.com/run) - // [revision](https://cloud.google.com/run/docs/reference/rest/v1/namespaces.revisions/get) - // URI. The format is: - // projects/{project}/locations/{location}/revisions/{revision} - string uri = 1; - } - - // The IP address of the endpoint, which can be an external or internal IP. - // An IPv6 address is only allowed when the test's destination is a - // [global load balancer - // VIP](https://cloud.google.com/load-balancing/docs/load-balancing-overview). - string ip_address = 1; - - // The IP protocol port of the endpoint. - // Only applicable when protocol is TCP or UDP. - int32 port = 2; - - // A Compute Engine instance URI. - string instance = 3; - - // A forwarding rule and its corresponding IP address represent the frontend - // configuration of a Google Cloud load balancer. Forwarding rules are also - // used for protocol forwarding, Private Service Connect and other network - // services to provide forwarding information in the control plane. Format: - // projects/{project}/global/forwardingRules/{id} or - // projects/{project}/regions/{region}/forwardingRules/{id} - string forwarding_rule = 13; - - // Output only. Specifies the type of the target of the forwarding rule. - optional ForwardingRuleTarget forwarding_rule_target = 14 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. ID of the load balancer the forwarding rule points to. Empty - // for forwarding rules not related to load balancers. - optional string load_balancer_id = 15 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Type of the load balancer the forwarding rule points to. - optional LoadBalancerType load_balancer_type = 16 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A cluster URI for [Google Kubernetes Engine - // master](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-architecture). - string gke_master_cluster = 7; - - // A [Cloud SQL](https://cloud.google.com/sql) instance URI. - string cloud_sql_instance = 8; - - // A [Cloud Function](https://cloud.google.com/functions). - CloudFunctionEndpoint cloud_function = 10; - - // An [App Engine](https://cloud.google.com/appengine) [service - // version](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions). - AppEngineVersionEndpoint app_engine_version = 11; - - // A [Cloud Run](https://cloud.google.com/run) - // [revision](https://cloud.google.com/run/docs/reference/rest/v1/namespaces.revisions/get) - CloudRunRevisionEndpoint cloud_run_revision = 12; - - // A Compute Engine network URI. - string network = 4; - - // Type of the network where the endpoint is located. - // Applicable only to source endpoint, as destination network type can be - // inferred from the source. - NetworkType network_type = 5; - - // Project ID where the endpoint is located. - // The Project ID can be derived from the URI if you provide a VM instance or - // network URI. - // The following are two cases where you must provide the project ID: - // 1. Only the IP address is specified, and the IP address is within a Google - // Cloud project. - // 2. When you are using Shared VPC and the IP address that you provide is - // from the service project. In this case, the network that the IP address - // resides in is defined in the host project. - string project_id = 6; -} - -// Results of the configuration analysis from the last run of the test. -message ReachabilityDetails { - // The overall result of the test's configuration analysis. - enum Result { - // No result was specified. - RESULT_UNSPECIFIED = 0; - - // Possible scenarios are: - // - // * The configuration analysis determined that a packet originating from - // the source is expected to reach the destination. - // * The analysis didn't complete because the user lacks permission for - // some of the resources in the trace. However, at the time the user's - // permission became insufficient, the trace had been successful so far. - REACHABLE = 1; - - // A packet originating from the source is expected to be dropped before - // reaching the destination. - UNREACHABLE = 2; - - // The source and destination endpoints do not uniquely identify - // the test location in the network, and the reachability result contains - // multiple traces. For some traces, a packet could be delivered, and for - // others, it would not be. - AMBIGUOUS = 4; - - // The configuration analysis did not complete. Possible reasons are: - // - // * A permissions error occurred--for example, the user might not have - // read permission for all of the resources named in the test. - // * An internal error occurred. - // * The analyzer received an invalid or unsupported argument or was unable - // to identify a known endpoint. - UNDETERMINED = 5; - } - - // The overall result of the test's configuration analysis. - Result result = 1; - - // The time of the configuration analysis. - google.protobuf.Timestamp verify_time = 2; - - // The details of a failure or a cancellation of reachability analysis. - google.rpc.Status error = 3; - - // Result may contain a list of traces if a test has multiple possible - // paths in the network, such as when destination endpoint is a load balancer - // with multiple backends. - repeated Trace traces = 5; -} - -// Latency percentile rank and value. -message LatencyPercentile { - // Percentage of samples this data point applies to. - int32 percent = 1; - - // percent-th percentile of latency observed, in microseconds. - // Fraction of percent/100 of samples have latency lower or - // equal to the value of this field. - int64 latency_micros = 2; -} - -// Describes measured latency distribution. -message LatencyDistribution { - // Representative latency percentiles. - repeated LatencyPercentile latency_percentiles = 1; -} - -// Results of active probing from the last run of the test. -message ProbingDetails { - // Overall probing result of the test. - enum ProbingResult { - // No result was specified. - PROBING_RESULT_UNSPECIFIED = 0; - - // At least 95% of packets reached the destination. - REACHABLE = 1; - - // No packets reached the destination. - UNREACHABLE = 2; - - // Less than 95% of packets reached the destination. - REACHABILITY_INCONSISTENT = 3; - - // Reachability could not be determined. Possible reasons are: - // * The user lacks permission to access some of the network resources - // required to run the test. - // * No valid source endpoint could be derived from the request. - // * An internal error occurred. - UNDETERMINED = 4; - } - - // Abort cause types. - enum ProbingAbortCause { - // No reason was specified. - PROBING_ABORT_CAUSE_UNSPECIFIED = 0; - - // The user lacks permission to access some of the - // network resources required to run the test. - PERMISSION_DENIED = 1; - - // No valid source endpoint could be derived from the request. - NO_SOURCE_LOCATION = 2; - } - - // Representation of a network edge location as per - // https://cloud.google.com/vpc/docs/edge-locations. - message EdgeLocation { - // Name of the metropolitan area. - string metropolitan_area = 1; - } - - // The overall result of active probing. - ProbingResult result = 1; - - // The time that reachability was assessed through active probing. - google.protobuf.Timestamp verify_time = 2; - - // Details about an internal failure or the cancellation of active probing. - google.rpc.Status error = 3; - - // The reason probing was aborted. - ProbingAbortCause abort_cause = 4; - - // Number of probes sent. - int32 sent_probe_count = 5; - - // Number of probes that reached the destination. - int32 successful_probe_count = 6; - - // The source and destination endpoints derived from the test input and used - // for active probing. - EndpointInfo endpoint_info = 7; - - // Latency as measured by active probing in one direction: - // from the source to the destination endpoint. - LatencyDistribution probing_latency = 8; - - // The EdgeLocation from which a packet destined for/originating from the - // internet will egress/ingress the Google network. - // This will only be populated for a connectivity test which has an internet - // destination/source address. - // The absence of this field *must not* be used as an indication that the - // destination/source is part of the Google network. - EdgeLocation destination_egress_location = 9; -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/reachability.proto b/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/reachability.proto deleted file mode 100644 index d81fe4f5779..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/reachability.proto +++ /dev/null @@ -1,274 +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.networkmanagement.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/networkmanagement/v1/connectivity_test.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.NetworkManagement.V1"; -option go_package = "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb;networkmanagementpb"; -option java_multiple_files = true; -option java_outer_classname = "ReachabilityServiceProto"; -option java_package = "com.google.cloud.networkmanagement.v1"; -option php_namespace = "Google\\Cloud\\NetworkManagement\\V1"; -option ruby_package = "Google::Cloud::NetworkManagement::V1"; - -// The Reachability service in Google Cloud Network Management API - -// The Reachability service in the Google Cloud Network Management API provides -// services that analyze the reachability within a single Google Virtual Private -// Cloud (VPC) network, between peered VPC networks, between VPC and on-premises -// networks, or between VPC networks and internet hosts. A reachability analysis -// is based on Google Cloud network configurations. -// -// You can use the analysis results to verify these configurations and -// to troubleshoot connectivity issues. -service ReachabilityService { - option (google.api.default_host) = "networkmanagement.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists all Connectivity Tests owned by a project. - rpc ListConnectivityTests(ListConnectivityTestsRequest) returns (ListConnectivityTestsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/global}/connectivityTests" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a specific Connectivity Test. - rpc GetConnectivityTest(GetConnectivityTestRequest) returns (ConnectivityTest) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/global/connectivityTests/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new Connectivity Test. - // After you create a test, the reachability analysis is performed as part - // of the long running operation, which completes when the analysis completes. - // - // If the endpoint specifications in `ConnectivityTest` are invalid - // (for example, containing non-existent resources in the network, or you - // don't have read permissions to the network configurations of listed - // projects), then the reachability result returns a value of `UNKNOWN`. - // - // If the endpoint specifications in `ConnectivityTest` are - // incomplete, the reachability result returns a value of - // AMBIGUOUS. For more information, - // see the Connectivity Test documentation. - rpc CreateConnectivityTest(CreateConnectivityTestRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/global}/connectivityTests" - body: "resource" - }; - option (google.api.method_signature) = "parent,test_id,resource"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.networkmanagement.v1.ConnectivityTest" - metadata_type: "OperationMetadata" - }; - } - - // Updates the configuration of an existing `ConnectivityTest`. - // After you update a test, the reachability analysis is performed as part - // of the long running operation, which completes when the analysis completes. - // The Reachability state in the test resource is updated with the new result. - // - // If the endpoint specifications in `ConnectivityTest` are invalid - // (for example, they contain non-existent resources in the network, or the - // user does not have read permissions to the network configurations of - // listed projects), then the reachability result returns a value of - // UNKNOWN. - // - // If the endpoint specifications in `ConnectivityTest` are incomplete, the - // reachability result returns a value of `AMBIGUOUS`. See the documentation - // in `ConnectivityTest` for for more details. - rpc UpdateConnectivityTest(UpdateConnectivityTestRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{resource.name=projects/*/locations/global/connectivityTests/*}" - body: "resource" - }; - option (google.api.method_signature) = "update_mask,resource"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.networkmanagement.v1.ConnectivityTest" - metadata_type: "OperationMetadata" - }; - } - - // Rerun an existing `ConnectivityTest`. - // After the user triggers the rerun, the reachability analysis is performed - // as part of the long running operation, which completes when the analysis - // completes. - // - // Even though the test configuration remains the same, the reachability - // result may change due to underlying network configuration changes. - // - // If the endpoint specifications in `ConnectivityTest` become invalid (for - // example, specified resources are deleted in the network, or you lost - // read permissions to the network configurations of listed projects), then - // the reachability result returns a value of `UNKNOWN`. - rpc RerunConnectivityTest(RerunConnectivityTestRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/global/connectivityTests/*}:rerun" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.networkmanagement.v1.ConnectivityTest" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a specific `ConnectivityTest`. - rpc DeleteConnectivityTest(DeleteConnectivityTestRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/global/connectivityTests/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } -} - -// Request for the `ListConnectivityTests` method. -message ListConnectivityTestsRequest { - // Required. The parent resource of the Connectivity Tests: - // `projects/{project_id}/locations/global` - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Number of `ConnectivityTests` to return. - int32 page_size = 2; - - // Page token from an earlier query, as returned in `next_page_token`. - string page_token = 3; - - // Lists the `ConnectivityTests` that match the filter expression. A filter - // expression filters the resources listed in the response. The expression - // must be of the form ` ` where operators: `<`, `>`, - // `<=`, - // `>=`, - // `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is - // roughly synonymous with equality). can refer to a proto or JSON - // field, or a synthetic field. Field names can be camelCase or snake_case. - // - // Examples: - // - Filter by name: - // name = "projects/proj-1/locations/global/connectivityTests/test-1 - // - // - Filter by labels: - // - Resources that have a key called `foo` - // labels.foo:* - // - Resources that have a key called `foo` whose value is `bar` - // labels.foo = bar - string filter = 4; - - // Field to use to sort the list. - string order_by = 5; -} - -// Response for the `ListConnectivityTests` method. -message ListConnectivityTestsResponse { - // List of Connectivity Tests. - repeated ConnectivityTest resources = 1; - - // Page token to fetch the next set of Connectivity Tests. - string next_page_token = 2; - - // Locations that could not be reached (when querying all locations with `-`). - repeated string unreachable = 3; -} - -// Request for the `GetConnectivityTest` method. -message GetConnectivityTestRequest { - // Required. `ConnectivityTest` resource name using the form: - // `projects/{project_id}/locations/global/connectivityTests/{test_id}` - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `CreateConnectivityTest` method. -message CreateConnectivityTestRequest { - // Required. The parent resource of the Connectivity Test to create: - // `projects/{project_id}/locations/global` - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The logical name of the Connectivity Test in your project - // with the following restrictions: - // - // * Must contain only lowercase letters, numbers, and hyphens. - // * Must start with a letter. - // * Must be between 1-40 characters. - // * Must end with a number or a letter. - // * Must be unique within the customer project - string test_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A `ConnectivityTest` resource - ConnectivityTest resource = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `UpdateConnectivityTest` method. -message UpdateConnectivityTestRequest { - // Required. Mask of fields to update. At least one path must be supplied in - // this field. - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Only fields specified in update_mask are updated. - ConnectivityTest resource = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `DeleteConnectivityTest` method. -message DeleteConnectivityTestRequest { - // Required. Connectivity Test resource name using the form: - // `projects/{project_id}/locations/global/connectivityTests/{test_id}` - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `RerunConnectivityTest` method. -message RerunConnectivityTestRequest { - // Required. Connectivity Test resource name using the form: - // `projects/{project_id}/locations/global/connectivityTests/{test_id}` - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Metadata describing an [Operation][google.longrunning.Operation] -message OperationMetadata { - // The time the operation was created. - google.protobuf.Timestamp create_time = 1; - - // The time the operation finished running. - google.protobuf.Timestamp end_time = 2; - - // Target of the operation - for example - // projects/project-1/locations/global/connectivityTests/test-1 - string target = 3; - - // Name of the verb executed by the operation. - string verb = 4; - - // Human-readable status of the operation, if any. - string status_detail = 5; - - // Specifies if cancellation was requested for the operation. - bool cancel_requested = 6; - - // API version. - string api_version = 7; -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/trace.proto b/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/trace.proto deleted file mode 100644 index 3316f6f097e..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/protos/google/cloud/networkmanagement/v1/trace.proto +++ /dev/null @@ -1,1241 +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 -// -// 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.networkmanagement.v1; - -option csharp_namespace = "Google.Cloud.NetworkManagement.V1"; -option go_package = "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb;networkmanagementpb"; -option java_multiple_files = true; -option java_outer_classname = "TraceProto"; -option java_package = "com.google.cloud.networkmanagement.v1"; -option php_namespace = "Google\\Cloud\\NetworkManagement\\V1"; -option ruby_package = "Google::Cloud::NetworkManagement::V1"; - -// Trace represents one simulated packet forwarding path. -// -// * Each trace contains multiple ordered steps. -// * Each step is in a particular state with associated configuration. -// * State is categorized as final or non-final states. -// * Each final state has a reason associated. -// * Each trace must end with a final state (the last step). -// ``` -// |---------------------Trace----------------------| -// Step1(State) Step2(State) --- StepN(State(final)) -// ``` -message Trace { - // Derived from the source and destination endpoints definition specified by - // user request, and validated by the data plane model. - // If there are multiple traces starting from different source locations, then - // the endpoint_info may be different between traces. - EndpointInfo endpoint_info = 1; - - // A trace of a test contains multiple steps from the initial state to the - // final state (delivered, dropped, forwarded, or aborted). - // - // The steps are ordered by the processing sequence within the simulated - // network state machine. It is critical to preserve the order of the steps - // and avoid reordering or sorting them. - repeated Step steps = 2; -} - -// A simulated forwarding path is composed of multiple steps. -// Each step has a well-defined state and an associated configuration. -message Step { - // Type of states that are defined in the network state machine. - // Each step in the packet trace is in a specific state. - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // Initial state: packet originating from a Compute Engine instance. - // An InstanceInfo is populated with starting instance information. - START_FROM_INSTANCE = 1; - - // Initial state: packet originating from the internet. - // The endpoint information is populated. - START_FROM_INTERNET = 2; - - // Initial state: packet originating from a Google service. Some Google - // services, such as health check probers or Identity Aware Proxy use - // special routes, outside VPC routing configuration to reach Compute Engine - // Instances. - START_FROM_GOOGLE_SERVICE = 27; - - // Initial state: packet originating from a VPC or on-premises network - // with internal source IP. - // If the source is a VPC network visible to the user, a NetworkInfo - // is populated with details of the network. - START_FROM_PRIVATE_NETWORK = 3; - - // Initial state: packet originating from a Google Kubernetes Engine cluster - // master. A GKEMasterInfo is populated with starting instance information. - START_FROM_GKE_MASTER = 21; - - // Initial state: packet originating from a Cloud SQL instance. - // A CloudSQLInstanceInfo is populated with starting instance information. - START_FROM_CLOUD_SQL_INSTANCE = 22; - - // Initial state: packet originating from a Cloud Function. - // A CloudFunctionInfo is populated with starting function information. - START_FROM_CLOUD_FUNCTION = 23; - - // Initial state: packet originating from an App Engine service version. - // An AppEngineVersionInfo is populated with starting version information. - START_FROM_APP_ENGINE_VERSION = 25; - - // Initial state: packet originating from a Cloud Run revision. - // A CloudRunRevisionInfo is populated with starting revision information. - START_FROM_CLOUD_RUN_REVISION = 26; - - // Config checking state: verify ingress firewall rule. - APPLY_INGRESS_FIREWALL_RULE = 4; - - // Config checking state: verify egress firewall rule. - APPLY_EGRESS_FIREWALL_RULE = 5; - - // Config checking state: verify route. - APPLY_ROUTE = 6; - - // Config checking state: match forwarding rule. - APPLY_FORWARDING_RULE = 7; - - // Config checking state: packet sent or received under foreign IP - // address and allowed. - SPOOFING_APPROVED = 8; - - // Forwarding state: arriving at a Compute Engine instance. - ARRIVE_AT_INSTANCE = 9; - - // Forwarding state: arriving at a Compute Engine internal load balancer. - ARRIVE_AT_INTERNAL_LOAD_BALANCER = 10; - - // Forwarding state: arriving at a Compute Engine external load balancer. - ARRIVE_AT_EXTERNAL_LOAD_BALANCER = 11; - - // Forwarding state: arriving at a Cloud VPN gateway. - ARRIVE_AT_VPN_GATEWAY = 12; - - // Forwarding state: arriving at a Cloud VPN tunnel. - ARRIVE_AT_VPN_TUNNEL = 13; - - // Forwarding state: arriving at a VPC connector. - ARRIVE_AT_VPC_CONNECTOR = 24; - - // Transition state: packet header translated. - NAT = 14; - - // Transition state: original connection is terminated and a new proxied - // connection is initiated. - PROXY_CONNECTION = 15; - - // Final state: packet could be delivered. - DELIVER = 16; - - // Final state: packet could be dropped. - DROP = 17; - - // Final state: packet could be forwarded to a network with an unknown - // configuration. - FORWARD = 18; - - // Final state: analysis is aborted. - ABORT = 19; - - // Special state: viewer of the test result does not have permission to - // see the configuration in this step. - VIEWER_PERMISSION_MISSING = 20; - } - - // A description of the step. Usually this is a summary of the state. - string description = 1; - - // Each step is in one of the pre-defined states. - State state = 2; - - // This is a step that leads to the final state Drop. - bool causes_drop = 3; - - // Project ID that contains the configuration this step is validating. - string project_id = 4; - - // Configuration or metadata associated with each step. - // The configuration is filtered based on viewer's permission. If a viewer - // has no permission to view the configuration in this step, for non-final - // states a special state is populated (VIEWER_PERMISSION_MISSING), and for - // final state the configuration is cleared. - oneof step_info { - // Display information of a Compute Engine instance. - InstanceInfo instance = 5; - - // Display information of a Compute Engine firewall rule. - FirewallInfo firewall = 6; - - // Display information of a Compute Engine route. - RouteInfo route = 7; - - // Display information of the source and destination under analysis. - // The endpoint information in an intermediate state may differ with the - // initial input, as it might be modified by state like NAT, - // or Connection Proxy. - EndpointInfo endpoint = 8; - - // Display information of a Google service - GoogleServiceInfo google_service = 24; - - // Display information of a Compute Engine forwarding rule. - ForwardingRuleInfo forwarding_rule = 9; - - // Display information of a Compute Engine VPN gateway. - VpnGatewayInfo vpn_gateway = 10; - - // Display information of a Compute Engine VPN tunnel. - VpnTunnelInfo vpn_tunnel = 11; - - // Display information of a VPC connector. - VpcConnectorInfo vpc_connector = 21; - - // Display information of the final state "deliver" and reason. - DeliverInfo deliver = 12; - - // Display information of the final state "forward" and reason. - ForwardInfo forward = 13; - - // Display information of the final state "abort" and reason. - AbortInfo abort = 14; - - // Display information of the final state "drop" and reason. - DropInfo drop = 15; - - // Display information of the load balancers. - LoadBalancerInfo load_balancer = 16; - - // Display information of a Google Cloud network. - NetworkInfo network = 17; - - // Display information of a Google Kubernetes Engine cluster master. - GKEMasterInfo gke_master = 18; - - // Display information of a Cloud SQL instance. - CloudSQLInstanceInfo cloud_sql_instance = 19; - - // Display information of a Cloud Function. - CloudFunctionInfo cloud_function = 20; - - // Display information of an App Engine service version. - AppEngineVersionInfo app_engine_version = 22; - - // Display information of a Cloud Run revision. - CloudRunRevisionInfo cloud_run_revision = 23; - } -} - -// For display only. Metadata associated with a Compute Engine instance. -message InstanceInfo { - // Name of a Compute Engine instance. - string display_name = 1; - - // URI of a Compute Engine instance. - string uri = 2; - - // Name of the network interface of a Compute Engine instance. - string interface = 3; - - // URI of a Compute Engine network. - string network_uri = 4; - - // Internal IP address of the network interface. - string internal_ip = 5; - - // External IP address of the network interface. - string external_ip = 6; - - // Network tags configured on the instance. - repeated string network_tags = 7; - - // Service account authorized for the instance. - string service_account = 8 [deprecated = true]; -} - -// For display only. Metadata associated with a Compute Engine network. -message NetworkInfo { - // Name of a Compute Engine network. - string display_name = 1; - - // URI of a Compute Engine network. - string uri = 2; - - // The IP range that matches the test. - string matched_ip_range = 4; -} - -// For display only. Metadata associated with a VPC firewall rule, an implied -// VPC firewall rule, or a hierarchical firewall policy rule. -message FirewallInfo { - // The firewall rule's type. - enum FirewallRuleType { - // Unspecified type. - FIREWALL_RULE_TYPE_UNSPECIFIED = 0; - - // Hierarchical firewall policy rule. For details, see - // [Hierarchical firewall policies - // overview](https://cloud.google.com/vpc/docs/firewall-policies). - HIERARCHICAL_FIREWALL_POLICY_RULE = 1; - - // VPC firewall rule. For details, see - // [VPC firewall rules - // overview](https://cloud.google.com/vpc/docs/firewalls). - VPC_FIREWALL_RULE = 2; - - // Implied VPC firewall rule. For details, see - // [Implied - // rules](https://cloud.google.com/vpc/docs/firewalls#default_firewall_rules). - IMPLIED_VPC_FIREWALL_RULE = 3; - - // Implicit firewall rules that are managed by serverless VPC access to - // allow ingress access. They are not visible in the Google Cloud console. - // For details, see [VPC connector's implicit - // rules](https://cloud.google.com/functions/docs/networking/connecting-vpc#restrict-access). - SERVERLESS_VPC_ACCESS_MANAGED_FIREWALL_RULE = 4; - - // Global network firewall policy rule. - // For details, see [Network firewall - // policies](https://cloud.google.com/vpc/docs/network-firewall-policies). - NETWORK_FIREWALL_POLICY_RULE = 5; - - // Regional network firewall policy rule. - // For details, see [Regional network firewall - // policies](https://cloud.google.com/firewall/docs/regional-firewall-policies). - NETWORK_REGIONAL_FIREWALL_POLICY_RULE = 6; - } - - // The display name of the VPC firewall rule. This field is not applicable - // to hierarchical firewall policy rules. - string display_name = 1; - - // The URI of the VPC firewall rule. This field is not applicable to - // implied firewall rules or hierarchical firewall policy rules. - string uri = 2; - - // Possible values: INGRESS, EGRESS - string direction = 3; - - // Possible values: ALLOW, DENY - string action = 4; - - // The priority of the firewall rule. - int32 priority = 5; - - // The URI of the VPC network that the firewall rule is associated with. - // This field is not applicable to hierarchical firewall policy rules. - string network_uri = 6; - - // The target tags defined by the VPC firewall rule. This field is not - // applicable to hierarchical firewall policy rules. - repeated string target_tags = 7; - - // The target service accounts specified by the firewall rule. - repeated string target_service_accounts = 8; - - // The hierarchical firewall policy that this rule is associated with. - // This field is not applicable to VPC firewall rules. - string policy = 9; - - // The firewall rule's type. - FirewallRuleType firewall_rule_type = 10; -} - -// For display only. Metadata associated with a Compute Engine route. -message RouteInfo { - // Type of route: - enum RouteType { - // Unspecified type. Default value. - ROUTE_TYPE_UNSPECIFIED = 0; - - // Route is a subnet route automatically created by the system. - SUBNET = 1; - - // Static route created by the user, including the default route to the - // internet. - STATIC = 2; - - // Dynamic route exchanged between BGP peers. - DYNAMIC = 3; - - // A subnet route received from peering network. - PEERING_SUBNET = 4; - - // A static route received from peering network. - PEERING_STATIC = 5; - - // A dynamic route received from peering network. - PEERING_DYNAMIC = 6; - - // Policy based route. - POLICY_BASED = 7; - } - - // Type of next hop: - enum NextHopType { - // Unspecified type. Default value. - NEXT_HOP_TYPE_UNSPECIFIED = 0; - - // Next hop is an IP address. - NEXT_HOP_IP = 1; - - // Next hop is a Compute Engine instance. - NEXT_HOP_INSTANCE = 2; - - // Next hop is a VPC network gateway. - NEXT_HOP_NETWORK = 3; - - // Next hop is a peering VPC. - NEXT_HOP_PEERING = 4; - - // Next hop is an interconnect. - NEXT_HOP_INTERCONNECT = 5; - - // Next hop is a VPN tunnel. - NEXT_HOP_VPN_TUNNEL = 6; - - // Next hop is a VPN gateway. This scenario only happens when tracing - // connectivity from an on-premises network to Google Cloud through a VPN. - // The analysis simulates a packet departing from the on-premises network - // through a VPN tunnel and arriving at a Cloud VPN gateway. - NEXT_HOP_VPN_GATEWAY = 7; - - // Next hop is an internet gateway. - NEXT_HOP_INTERNET_GATEWAY = 8; - - // Next hop is blackhole; that is, the next hop either does not exist or is - // not running. - NEXT_HOP_BLACKHOLE = 9; - - // Next hop is the forwarding rule of an Internal Load Balancer. - NEXT_HOP_ILB = 10; - - // Next hop is a - // [router appliance - // instance](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/ra-overview). - NEXT_HOP_ROUTER_APPLIANCE = 11; - - // Next hop is an NCC hub. - NEXT_HOP_NCC_HUB = 12; - } - - // Indicates where routes are applicable. - enum RouteScope { - // Unspecified scope. Default value. - ROUTE_SCOPE_UNSPECIFIED = 0; - - // Route is applicable to packets in Network. - NETWORK = 1; - - // Route is applicable to packets using NCC Hub's routing table. - NCC_HUB = 2; - } - - // Type of route. - RouteType route_type = 8; - - // Type of next hop. - NextHopType next_hop_type = 9; - - // Indicates where route is applicable. - RouteScope route_scope = 14; - - // Name of a route. - string display_name = 1; - - // URI of a route. - // Dynamic, peering static and peering dynamic routes do not have an URI. - // Advertised route from Google Cloud VPC to on-premises network also does - // not have an URI. - string uri = 2; - - // Destination IP range of the route. - string dest_ip_range = 3; - - // Next hop of the route. - string next_hop = 4; - - // URI of a Compute Engine network. NETWORK routes only. - string network_uri = 5; - - // Priority of the route. - int32 priority = 6; - - // Instance tags of the route. - repeated string instance_tags = 7; - - // Source IP address range of the route. Policy based routes only. - string src_ip_range = 10; - - // Destination port ranges of the route. Policy based routes only. - repeated string dest_port_ranges = 11; - - // Source port ranges of the route. Policy based routes only. - repeated string src_port_ranges = 12; - - // Protocols of the route. Policy based routes only. - repeated string protocols = 13; - - // URI of a NCC Hub. NCC_HUB routes only. - optional string ncc_hub_uri = 15; - - // URI of a NCC Spoke. NCC_HUB routes only. - optional string ncc_spoke_uri = 16; -} - -// For display only. Details of a Google Service sending packets to a -// VPC network. Although the source IP might be a publicly routable address, -// some Google Services use special routes within Google production -// infrastructure to reach Compute Engine Instances. -// https://cloud.google.com/vpc/docs/routes#special_return_paths -message GoogleServiceInfo { - // Recognized type of a Google Service. - enum GoogleServiceType { - // Unspecified Google Service. Includes most of Google APIs and services. - GOOGLE_SERVICE_TYPE_UNSPECIFIED = 0; - - // Identity aware proxy. - // https://cloud.google.com/iap/docs/using-tcp-forwarding - IAP = 1; - - // One of two services sharing IP ranges: - // * Load Balancer proxy - // * Centralized Health Check prober - // https://cloud.google.com/load-balancing/docs/firewall-rules - GFE_PROXY_OR_HEALTH_CHECK_PROBER = 2; - - // Connectivity from Cloud DNS to forwarding targets or alternate name - // servers that use private routing. - // https://cloud.google.com/dns/docs/zones/forwarding-zones#firewall-rules - // https://cloud.google.com/dns/docs/policies#firewall-rules - CLOUD_DNS = 3; - } - - // Source IP address. - string source_ip = 1; - - // Recognized type of a Google Service. - GoogleServiceType google_service_type = 2; -} - -// For display only. Metadata associated with a Compute Engine forwarding rule. -message ForwardingRuleInfo { - // Name of a Compute Engine forwarding rule. - string display_name = 1; - - // URI of a Compute Engine forwarding rule. - string uri = 2; - - // Protocol defined in the forwarding rule that matches the test. - string matched_protocol = 3; - - // Port range defined in the forwarding rule that matches the test. - string matched_port_range = 6; - - // VIP of the forwarding rule. - string vip = 4; - - // Target type of the forwarding rule. - string target = 5; - - // Network URI. Only valid for Internal Load Balancer. - string network_uri = 7; -} - -// For display only. Metadata associated with a load balancer. -message LoadBalancerInfo { - // The type definition for a load balancer: - enum LoadBalancerType { - // Type is unspecified. - LOAD_BALANCER_TYPE_UNSPECIFIED = 0; - - // Internal TCP/UDP load balancer. - INTERNAL_TCP_UDP = 1; - - // Network TCP/UDP load balancer. - NETWORK_TCP_UDP = 2; - - // HTTP(S) proxy load balancer. - HTTP_PROXY = 3; - - // TCP proxy load balancer. - TCP_PROXY = 4; - - // SSL proxy load balancer. - SSL_PROXY = 5; - } - - // The type definition for a load balancer backend configuration: - enum BackendType { - // Type is unspecified. - BACKEND_TYPE_UNSPECIFIED = 0; - - // Backend Service as the load balancer's backend. - BACKEND_SERVICE = 1; - - // Target Pool as the load balancer's backend. - TARGET_POOL = 2; - - // Target Instance as the load balancer's backend. - TARGET_INSTANCE = 3; - } - - // Type of the load balancer. - LoadBalancerType load_balancer_type = 1; - - // URI of the health check for the load balancer. - string health_check_uri = 2; - - // Information for the loadbalancer backends. - repeated LoadBalancerBackend backends = 3; - - // Type of load balancer's backend configuration. - BackendType backend_type = 4; - - // Backend configuration URI. - string backend_uri = 5; -} - -// For display only. Metadata associated with a specific load balancer backend. -message LoadBalancerBackend { - // State of a health check firewall configuration: - enum HealthCheckFirewallState { - // State is unspecified. Default state if not populated. - HEALTH_CHECK_FIREWALL_STATE_UNSPECIFIED = 0; - - // There are configured firewall rules to allow health check probes to the - // backend. - CONFIGURED = 1; - - // There are firewall rules configured to allow partial health check ranges - // or block all health check ranges. - // If a health check probe is sent from denied IP ranges, - // the health check to the backend will fail. Then, the backend will be - // marked unhealthy and will not receive traffic sent to the load balancer. - MISCONFIGURED = 2; - } - - // Name of a Compute Engine instance or network endpoint. - string display_name = 1; - - // URI of a Compute Engine instance or network endpoint. - string uri = 2; - - // State of the health check firewall configuration. - HealthCheckFirewallState health_check_firewall_state = 3; - - // A list of firewall rule URIs allowing probes from health check IP ranges. - repeated string health_check_allowing_firewall_rules = 4; - - // A list of firewall rule URIs blocking probes from health check IP ranges. - repeated string health_check_blocking_firewall_rules = 5; -} - -// For display only. Metadata associated with a Compute Engine VPN gateway. -message VpnGatewayInfo { - // Name of a VPN gateway. - string display_name = 1; - - // URI of a VPN gateway. - string uri = 2; - - // URI of a Compute Engine network where the VPN gateway is configured. - string network_uri = 3; - - // IP address of the VPN gateway. - string ip_address = 4; - - // A VPN tunnel that is associated with this VPN gateway. - // There may be multiple VPN tunnels configured on a VPN gateway, and only - // the one relevant to the test is displayed. - string vpn_tunnel_uri = 5; - - // Name of a Google Cloud region where this VPN gateway is configured. - string region = 6; -} - -// For display only. Metadata associated with a Compute Engine VPN tunnel. -message VpnTunnelInfo { - // Types of VPN routing policy. For details, refer to [Networks and Tunnel - // routing](https://cloud.google.com/network-connectivity/docs/vpn/concepts/choosing-networks-routing/). - enum RoutingType { - // Unspecified type. Default value. - ROUTING_TYPE_UNSPECIFIED = 0; - - // Route based VPN. - ROUTE_BASED = 1; - - // Policy based routing. - POLICY_BASED = 2; - - // Dynamic (BGP) routing. - DYNAMIC = 3; - } - - // Name of a VPN tunnel. - string display_name = 1; - - // URI of a VPN tunnel. - string uri = 2; - - // URI of the VPN gateway at local end of the tunnel. - string source_gateway = 3; - - // URI of a VPN gateway at remote end of the tunnel. - string remote_gateway = 4; - - // Remote VPN gateway's IP address. - string remote_gateway_ip = 5; - - // Local VPN gateway's IP address. - string source_gateway_ip = 6; - - // URI of a Compute Engine network where the VPN tunnel is configured. - string network_uri = 7; - - // Name of a Google Cloud region where this VPN tunnel is configured. - string region = 8; - - // Type of the routing policy. - RoutingType routing_type = 9; -} - -// For display only. The specification of the endpoints for the test. -// EndpointInfo is derived from source and destination Endpoint and validated -// by the backend data plane model. -message EndpointInfo { - // Source IP address. - string source_ip = 1; - - // Destination IP address. - string destination_ip = 2; - - // IP protocol in string format, for example: "TCP", "UDP", "ICMP". - string protocol = 3; - - // Source port. Only valid when protocol is TCP or UDP. - int32 source_port = 4; - - // Destination port. Only valid when protocol is TCP or UDP. - int32 destination_port = 5; - - // URI of the network where this packet originates from. - string source_network_uri = 6; - - // URI of the network where this packet is sent to. - string destination_network_uri = 7; - - // URI of the source telemetry agent this packet originates from. - string source_agent_uri = 8; -} - -// Details of the final state "deliver" and associated resource. -message DeliverInfo { - // Deliver target types: - enum Target { - // Target not specified. - TARGET_UNSPECIFIED = 0; - - // Target is a Compute Engine instance. - INSTANCE = 1; - - // Target is the internet. - INTERNET = 2; - - // Target is a Google API. - GOOGLE_API = 3; - - // Target is a Google Kubernetes Engine cluster master. - GKE_MASTER = 4; - - // Target is a Cloud SQL instance. - CLOUD_SQL_INSTANCE = 5; - - // Target is a published service that uses [Private Service - // Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-services). - PSC_PUBLISHED_SERVICE = 6; - - // Target is all Google APIs that use [Private Service - // Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-apis). - PSC_GOOGLE_API = 7; - - // Target is a VPC-SC that uses [Private Service - // Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-apis). - PSC_VPC_SC = 8; - - // Target is a serverless network endpoint group. - SERVERLESS_NEG = 9; - } - - // Target type where the packet is delivered to. - Target target = 1; - - // URI of the resource that the packet is delivered to. - string resource_uri = 2; -} - -// Details of the final state "forward" and associated resource. -message ForwardInfo { - // Forward target types. - enum Target { - // Target not specified. - TARGET_UNSPECIFIED = 0; - - // Forwarded to a VPC peering network. - PEERING_VPC = 1; - - // Forwarded to a Cloud VPN gateway. - VPN_GATEWAY = 2; - - // Forwarded to a Cloud Interconnect connection. - INTERCONNECT = 3; - - // Forwarded to a Google Kubernetes Engine Container cluster master. - GKE_MASTER = 4; - - // Forwarded to the next hop of a custom route imported from a peering VPC. - IMPORTED_CUSTOM_ROUTE_NEXT_HOP = 5; - - // Forwarded to a Cloud SQL instance. - CLOUD_SQL_INSTANCE = 6; - - // Forwarded to a VPC network in another project. - ANOTHER_PROJECT = 7; - - // Forwarded to an NCC Hub. - NCC_HUB = 8; - } - - // Target type where this packet is forwarded to. - Target target = 1; - - // URI of the resource that the packet is forwarded to. - string resource_uri = 2; -} - -// Details of the final state "abort" and associated resource. -message AbortInfo { - // Abort cause types: - enum Cause { - // Cause is unspecified. - CAUSE_UNSPECIFIED = 0; - - // Aborted due to unknown network. - // The reachability analysis cannot proceed because the user does not have - // access to the host project's network configurations, including firewall - // rules and routes. This happens when the project is a service project and - // the endpoints being traced are in the host project's network. - UNKNOWN_NETWORK = 1; - - // Aborted because the IP address(es) are unknown. - UNKNOWN_IP = 2; - - // Aborted because no project information can be derived from the test - // input. - UNKNOWN_PROJECT = 3; - - // Aborted because the user lacks the permission to access all or part of - // the network configurations required to run the test. - PERMISSION_DENIED = 4; - - // Aborted because no valid source endpoint is derived from the input test - // request. - NO_SOURCE_LOCATION = 5; - - // Aborted because the source and/or destination endpoint specified in - // the test are invalid. The possible reasons that an endpoint is - // invalid include: malformed IP address; nonexistent instance or - // network URI; IP address not in the range of specified network URI; and - // instance not owning the network interface in the specified network. - INVALID_ARGUMENT = 6; - - // Aborted because traffic is sent from a public IP to an instance without - // an external IP. - NO_EXTERNAL_IP = 7; - - // Aborted because none of the traces matches destination information - // specified in the input test request. - UNINTENDED_DESTINATION = 8; - - // Aborted because the number of steps in the trace exceeding a certain - // limit which may be caused by routing loop. - TRACE_TOO_LONG = 9; - - // Aborted due to internal server error. - INTERNAL_ERROR = 10; - - // Aborted because the source endpoint could not be found. - SOURCE_ENDPOINT_NOT_FOUND = 11; - - // Aborted because the source network does not match the source endpoint. - MISMATCHED_SOURCE_NETWORK = 12; - - // Aborted because the destination endpoint could not be found. - DESTINATION_ENDPOINT_NOT_FOUND = 13; - - // Aborted because the destination network does not match the destination - // endpoint. - MISMATCHED_DESTINATION_NETWORK = 14; - - // Aborted because the test scenario is not supported. - UNSUPPORTED = 15; - - // Aborted because the source and destination resources have no common IP - // version. - MISMATCHED_IP_VERSION = 16; - - // Aborted because the connection between the control plane and the node of - // the source cluster is initiated by the node and managed by the - // Konnectivity proxy. - GKE_KONNECTIVITY_PROXY_UNSUPPORTED = 17; - - // Aborted because expected resource configuration was missing. - RESOURCE_CONFIG_NOT_FOUND = 18; - - // Aborted because a PSC endpoint selection for the Google-managed service - // is ambiguous (several PSC endpoints satisfy test input). - GOOGLE_MANAGED_SERVICE_AMBIGUOUS_PSC_ENDPOINT = 19; - - // Aborted because tests with a PSC-based Cloud SQL instance as a source are - // not supported. - SOURCE_PSC_CLOUD_SQL_UNSUPPORTED = 20; - - // Aborted because tests with a forwarding rule as a source are not - // supported. - SOURCE_FORWARDING_RULE_UNSUPPORTED = 21; - } - - // Causes that the analysis is aborted. - Cause cause = 1; - - // URI of the resource that caused the abort. - string resource_uri = 2; - - // List of project IDs that the user has specified in the request but does - // not have permission to access network configs. Analysis is aborted in this - // case with the PERMISSION_DENIED cause. - repeated string projects_missing_permission = 3; -} - -// Details of the final state "drop" and associated resource. -message DropInfo { - // Drop cause types: - enum Cause { - // Cause is unspecified. - CAUSE_UNSPECIFIED = 0; - - // Destination external address cannot be resolved to a known target. If - // the address is used in a Google Cloud project, provide the project ID - // as test input. - UNKNOWN_EXTERNAL_ADDRESS = 1; - - // A Compute Engine instance can only send or receive a packet with a - // foreign IP address if ip_forward is enabled. - FOREIGN_IP_DISALLOWED = 2; - - // Dropped due to a firewall rule, unless allowed due to connection - // tracking. - FIREWALL_RULE = 3; - - // Dropped due to no routes. - NO_ROUTE = 4; - - // Dropped due to invalid route. Route's next hop is a blackhole. - ROUTE_BLACKHOLE = 5; - - // Packet is sent to a wrong (unintended) network. Example: you trace a - // packet from VM1:Network1 to VM2:Network2, however, the route configured - // in Network1 sends the packet destined for VM2's IP addresss to Network3. - ROUTE_WRONG_NETWORK = 6; - - // Packet with internal destination address sent to the internet gateway. - PRIVATE_TRAFFIC_TO_INTERNET = 7; - - // Instance with only an internal IP address tries to access Google API and - // services, but private Google access is not enabled. - PRIVATE_GOOGLE_ACCESS_DISALLOWED = 8; - - // Instance with only an internal IP address tries to access external hosts, - // but Cloud NAT is not enabled in the subnet, unless special configurations - // on a VM allow this connection. - NO_EXTERNAL_ADDRESS = 9; - - // Destination internal address cannot be resolved to a known target. If - // this is a shared VPC scenario, verify if the service project ID is - // provided as test input. Otherwise, verify if the IP address is being - // used in the project. - UNKNOWN_INTERNAL_ADDRESS = 10; - - // Forwarding rule's protocol and ports do not match the packet header. - FORWARDING_RULE_MISMATCH = 11; - - // Packet could be dropped because it was sent from a different region - // to a regional forwarding without global access. - FORWARDING_RULE_REGION_MISMATCH = 25; - - // Forwarding rule does not have backends configured. - FORWARDING_RULE_NO_INSTANCES = 12; - - // Firewalls block the health check probes to the backends and cause - // the backends to be unavailable for traffic from the load balancer. - // For more details, see [Health check firewall - // rules](https://cloud.google.com/load-balancing/docs/health-checks#firewall_rules). - FIREWALL_BLOCKING_LOAD_BALANCER_BACKEND_HEALTH_CHECK = 13; - - // Packet is sent from or to a Compute Engine instance that is not in a - // running state. - INSTANCE_NOT_RUNNING = 14; - - // Packet sent from or to a GKE cluster that is not in running state. - GKE_CLUSTER_NOT_RUNNING = 27; - - // Packet sent from or to a Cloud SQL instance that is not in running state. - CLOUD_SQL_INSTANCE_NOT_RUNNING = 28; - - // The type of traffic is blocked and the user cannot configure a firewall - // rule to enable it. See [Always blocked - // traffic](https://cloud.google.com/vpc/docs/firewalls#blockedtraffic) for - // more details. - TRAFFIC_TYPE_BLOCKED = 15; - - // Access to Google Kubernetes Engine cluster master's endpoint is not - // authorized. See [Access to the cluster - // endpoints](https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters#access_to_the_cluster_endpoints) - // for more details. - GKE_MASTER_UNAUTHORIZED_ACCESS = 16; - - // Access to the Cloud SQL instance endpoint is not authorized. - // See [Authorizing with authorized - // networks](https://cloud.google.com/sql/docs/mysql/authorize-networks) for - // more details. - CLOUD_SQL_INSTANCE_UNAUTHORIZED_ACCESS = 17; - - // Packet was dropped inside Google Kubernetes Engine Service. - DROPPED_INSIDE_GKE_SERVICE = 18; - - // Packet was dropped inside Cloud SQL Service. - DROPPED_INSIDE_CLOUD_SQL_SERVICE = 19; - - // Packet was dropped because there is no peering between the originating - // network and the Google Managed Services Network. - GOOGLE_MANAGED_SERVICE_NO_PEERING = 20; - - // Packet was dropped because the Google-managed service uses Private - // Service Connect (PSC), but the PSC endpoint is not found in the project. - GOOGLE_MANAGED_SERVICE_NO_PSC_ENDPOINT = 38; - - // Packet was dropped because the GKE cluster uses Private Service Connect - // (PSC), but the PSC endpoint is not found in the project. - GKE_PSC_ENDPOINT_MISSING = 36; - - // Packet was dropped because the Cloud SQL instance has neither a private - // nor a public IP address. - CLOUD_SQL_INSTANCE_NO_IP_ADDRESS = 21; - - // Packet was dropped because a GKE cluster private endpoint is - // unreachable from a region different from the cluster's region. - GKE_CONTROL_PLANE_REGION_MISMATCH = 30; - - // Packet sent from a public GKE cluster control plane to a private - // IP address. - PUBLIC_GKE_CONTROL_PLANE_TO_PRIVATE_DESTINATION = 31; - - // Packet was dropped because there is no route from a GKE cluster - // control plane to a destination network. - GKE_CONTROL_PLANE_NO_ROUTE = 32; - - // Packet sent from a Cloud SQL instance to an external IP address is not - // allowed. The Cloud SQL instance is not configured to send packets to - // external IP addresses. - CLOUD_SQL_INSTANCE_NOT_CONFIGURED_FOR_EXTERNAL_TRAFFIC = 33; - - // Packet sent from a Cloud SQL instance with only a public IP address to a - // private IP address. - PUBLIC_CLOUD_SQL_INSTANCE_TO_PRIVATE_DESTINATION = 34; - - // Packet was dropped because there is no route from a Cloud SQL - // instance to a destination network. - CLOUD_SQL_INSTANCE_NO_ROUTE = 35; - - // Packet could be dropped because the Cloud Function is not in an active - // status. - CLOUD_FUNCTION_NOT_ACTIVE = 22; - - // Packet could be dropped because no VPC connector is set. - VPC_CONNECTOR_NOT_SET = 23; - - // Packet could be dropped because the VPC connector is not in a running - // state. - VPC_CONNECTOR_NOT_RUNNING = 24; - - // The Private Service Connect endpoint is in a project that is not approved - // to connect to the service. - PSC_CONNECTION_NOT_ACCEPTED = 26; - - // Packet sent from a Cloud Run revision that is not ready. - CLOUD_RUN_REVISION_NOT_READY = 29; - - // Packet was dropped inside Private Service Connect service producer. - DROPPED_INSIDE_PSC_SERVICE_PRODUCER = 37; - - // Packet sent to a load balancer, which requires a proxy-only subnet and - // the subnet is not found. - LOAD_BALANCER_HAS_NO_PROXY_SUBNET = 39; - } - - // Cause that the packet is dropped. - Cause cause = 1; - - // URI of the resource that caused the drop. - string resource_uri = 2; -} - -// For display only. Metadata associated with a Google Kubernetes Engine (GKE) -// cluster master. -message GKEMasterInfo { - // URI of a GKE cluster. - string cluster_uri = 2; - - // URI of a GKE cluster network. - string cluster_network_uri = 4; - - // Internal IP address of a GKE cluster master. - string internal_ip = 5; - - // External IP address of a GKE cluster master. - string external_ip = 6; -} - -// For display only. Metadata associated with a Cloud SQL instance. -message CloudSQLInstanceInfo { - // Name of a Cloud SQL instance. - string display_name = 1; - - // URI of a Cloud SQL instance. - string uri = 2; - - // URI of a Cloud SQL instance network or empty string if the instance does - // not have one. - string network_uri = 4; - - // Internal IP address of a Cloud SQL instance. - string internal_ip = 5; - - // External IP address of a Cloud SQL instance. - string external_ip = 6; - - // Region in which the Cloud SQL instance is running. - string region = 7; -} - -// For display only. Metadata associated with a Cloud Function. -message CloudFunctionInfo { - // Name of a Cloud Function. - string display_name = 1; - - // URI of a Cloud Function. - string uri = 2; - - // Location in which the Cloud Function is deployed. - string location = 3; - - // Latest successfully deployed version id of the Cloud Function. - int64 version_id = 4; -} - -// For display only. Metadata associated with a Cloud Run revision. -message CloudRunRevisionInfo { - // Name of a Cloud Run revision. - string display_name = 1; - - // URI of a Cloud Run revision. - string uri = 2; - - // Location in which this revision is deployed. - string location = 4; - - // URI of Cloud Run service this revision belongs to. - string service_uri = 5; -} - -// For display only. Metadata associated with an App Engine version. -message AppEngineVersionInfo { - // Name of an App Engine version. - string display_name = 1; - - // URI of an App Engine version. - string uri = 2; - - // Runtime of the App Engine version. - string runtime = 3; - - // App Engine execution environment for a version. - string environment = 4; -} - -// For display only. Metadata associated with a VPC connector. -message VpcConnectorInfo { - // Name of a VPC connector. - string display_name = 1; - - // URI of a VPC connector. - string uri = 2; - - // Location in which the VPC connector is deployed. - string location = 3; -} - -// Type of a load balancer. For more information, see [Summary of Google Cloud -// load -// balancers](https://cloud.google.com/load-balancing/docs/load-balancing-overview#summary-of-google-cloud-load-balancers). -enum LoadBalancerType { - // Forwarding rule points to a different target than a load balancer or a - // load balancer type is unknown. - LOAD_BALANCER_TYPE_UNSPECIFIED = 0; - - // Global external HTTP(S) load balancer. - HTTPS_ADVANCED_LOAD_BALANCER = 1; - - // Global external HTTP(S) load balancer (classic) - HTTPS_LOAD_BALANCER = 2; - - // Regional external HTTP(S) load balancer. - REGIONAL_HTTPS_LOAD_BALANCER = 3; - - // Internal HTTP(S) load balancer. - INTERNAL_HTTPS_LOAD_BALANCER = 4; - - // External SSL proxy load balancer. - SSL_PROXY_LOAD_BALANCER = 5; - - // External TCP proxy load balancer. - TCP_PROXY_LOAD_BALANCER = 6; - - // Internal regional TCP proxy load balancer. - INTERNAL_TCP_PROXY_LOAD_BALANCER = 7; - - // External TCP/UDP Network load balancer. - NETWORK_LOAD_BALANCER = 8; - - // Target-pool based external TCP/UDP Network load balancer. - LEGACY_NETWORK_LOAD_BALANCER = 9; - - // Internal TCP/UDP load balancer. - TCP_UDP_INTERNAL_LOAD_BALANCER = 10; -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.create_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.create_connectivity_test.js deleted file mode 100644 index 17dab06845f..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.create_connectivity_test.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, testId, resource) { - // [START networkmanagement_v1_generated_ReachabilityService_CreateConnectivityTest_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 parent resource of the Connectivity Test to create: - * `projects/{project_id}/locations/global` - */ - // const parent = 'abc123' - /** - * Required. The logical name of the Connectivity Test in your project - * with the following restrictions: - * * Must contain only lowercase letters, numbers, and hyphens. - * * Must start with a letter. - * * Must be between 1-40 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project - */ - // const testId = 'abc123' - /** - * Required. A `ConnectivityTest` resource - */ - // const resource = {} - - // Imports the Networkmanagement library - const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1; - - // Instantiates a client - const networkmanagementClient = new ReachabilityServiceClient(); - - async function callCreateConnectivityTest() { - // Construct request - const request = { - parent, - testId, - resource, - }; - - // Run request - const [operation] = await networkmanagementClient.createConnectivityTest(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateConnectivityTest(); - // [END networkmanagement_v1_generated_ReachabilityService_CreateConnectivityTest_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-networkmanagement/v1/samples/generated/v1/reachability_service.delete_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.delete_connectivity_test.js deleted file mode 100644 index 3e016d5a2b8..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.delete_connectivity_test.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 networkmanagement_v1_generated_ReachabilityService_DeleteConnectivityTest_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. Connectivity Test resource name using the form: - * `projects/{project_id}/locations/global/connectivityTests/{test_id}` - */ - // const name = 'abc123' - - // Imports the Networkmanagement library - const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1; - - // Instantiates a client - const networkmanagementClient = new ReachabilityServiceClient(); - - async function callDeleteConnectivityTest() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await networkmanagementClient.deleteConnectivityTest(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteConnectivityTest(); - // [END networkmanagement_v1_generated_ReachabilityService_DeleteConnectivityTest_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-networkmanagement/v1/samples/generated/v1/reachability_service.get_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.get_connectivity_test.js deleted file mode 100644 index 91750c65cff..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.get_connectivity_test.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 networkmanagement_v1_generated_ReachabilityService_GetConnectivityTest_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. `ConnectivityTest` resource name using the form: - * `projects/{project_id}/locations/global/connectivityTests/{test_id}` - */ - // const name = 'abc123' - - // Imports the Networkmanagement library - const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1; - - // Instantiates a client - const networkmanagementClient = new ReachabilityServiceClient(); - - async function callGetConnectivityTest() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await networkmanagementClient.getConnectivityTest(request); - console.log(response); - } - - callGetConnectivityTest(); - // [END networkmanagement_v1_generated_ReachabilityService_GetConnectivityTest_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-networkmanagement/v1/samples/generated/v1/reachability_service.list_connectivity_tests.js b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.list_connectivity_tests.js deleted file mode 100644 index aac206ec275..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.list_connectivity_tests.js +++ /dev/null @@ -1,95 +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 networkmanagement_v1_generated_ReachabilityService_ListConnectivityTests_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 parent resource of the Connectivity Tests: - * `projects/{project_id}/locations/global` - */ - // const parent = 'abc123' - /** - * Number of `ConnectivityTests` to return. - */ - // const pageSize = 1234 - /** - * Page token from an earlier query, as returned in `next_page_token`. - */ - // const pageToken = 'abc123' - /** - * Lists the `ConnectivityTests` that match the filter expression. A filter - * expression filters the resources listed in the response. The expression - * must be of the form ` ` where operators: `<`, `>`, - * `<=`, - * `>=`, - * `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is - * roughly synonymous with equality). can refer to a proto or JSON - * field, or a synthetic field. Field names can be camelCase or snake_case. - * Examples: - * - Filter by name: - * name = "projects/proj-1/locations/global/connectivityTests/test-1 - * - Filter by labels: - * - Resources that have a key called `foo` - * labels.foo:* - * - Resources that have a key called `foo` whose value is `bar` - * labels.foo = bar - */ - // const filter = 'abc123' - /** - * Field to use to sort the list. - */ - // const orderBy = 'abc123' - - // Imports the Networkmanagement library - const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1; - - // Instantiates a client - const networkmanagementClient = new ReachabilityServiceClient(); - - async function callListConnectivityTests() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await networkmanagementClient.listConnectivityTestsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListConnectivityTests(); - // [END networkmanagement_v1_generated_ReachabilityService_ListConnectivityTests_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-networkmanagement/v1/samples/generated/v1/reachability_service.rerun_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.rerun_connectivity_test.js deleted file mode 100644 index 545e38ee534..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.rerun_connectivity_test.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 networkmanagement_v1_generated_ReachabilityService_RerunConnectivityTest_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. Connectivity Test resource name using the form: - * `projects/{project_id}/locations/global/connectivityTests/{test_id}` - */ - // const name = 'abc123' - - // Imports the Networkmanagement library - const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1; - - // Instantiates a client - const networkmanagementClient = new ReachabilityServiceClient(); - - async function callRerunConnectivityTest() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await networkmanagementClient.rerunConnectivityTest(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRerunConnectivityTest(); - // [END networkmanagement_v1_generated_ReachabilityService_RerunConnectivityTest_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-networkmanagement/v1/samples/generated/v1/reachability_service.update_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.update_connectivity_test.js deleted file mode 100644 index 64cf6c04985..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/reachability_service.update_connectivity_test.js +++ /dev/null @@ -1,68 +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(updateMask, resource) { - // [START networkmanagement_v1_generated_ReachabilityService_UpdateConnectivityTest_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. Mask of fields to update. At least one path must be supplied in - * this field. - */ - // const updateMask = {} - /** - * Required. Only fields specified in update_mask are updated. - */ - // const resource = {} - - // Imports the Networkmanagement library - const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1; - - // Instantiates a client - const networkmanagementClient = new ReachabilityServiceClient(); - - async function callUpdateConnectivityTest() { - // Construct request - const request = { - updateMask, - resource, - }; - - // Run request - const [operation] = await networkmanagementClient.updateConnectivityTest(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateConnectivityTest(); - // [END networkmanagement_v1_generated_ReachabilityService_UpdateConnectivityTest_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-networkmanagement/v1/samples/generated/v1/snippet_metadata_google.cloud.networkmanagement.v1.json b/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/snippet_metadata_google.cloud.networkmanagement.v1.json deleted file mode 100644 index d8e86fe41a8..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/samples/generated/v1/snippet_metadata_google.cloud.networkmanagement.v1.json +++ /dev/null @@ -1,283 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-networkmanagement", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.networkmanagement.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "networkmanagement_v1_generated_ReachabilityService_ListConnectivityTests_async", - "title": "ReachabilityService listConnectivityTests Sample", - "origin": "API_DEFINITION", - "description": " Lists all Connectivity Tests owned by a project.", - "canonical": true, - "file": "reachability_service.list_connectivity_tests.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListConnectivityTests", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.ListConnectivityTests", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkmanagement.v1.ListConnectivityTestsResponse", - "client": { - "shortName": "ReachabilityServiceClient", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityServiceClient" - }, - "method": { - "shortName": "ListConnectivityTests", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.ListConnectivityTests", - "service": { - "shortName": "ReachabilityService", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService" - } - } - } - }, - { - "regionTag": "networkmanagement_v1_generated_ReachabilityService_GetConnectivityTest_async", - "title": "ReachabilityService getConnectivityTest Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a specific Connectivity Test.", - "canonical": true, - "file": "reachability_service.get_connectivity_test.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.GetConnectivityTest", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkmanagement.v1.ConnectivityTest", - "client": { - "shortName": "ReachabilityServiceClient", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityServiceClient" - }, - "method": { - "shortName": "GetConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.GetConnectivityTest", - "service": { - "shortName": "ReachabilityService", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService" - } - } - } - }, - { - "regionTag": "networkmanagement_v1_generated_ReachabilityService_CreateConnectivityTest_async", - "title": "ReachabilityService createConnectivityTest Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Connectivity Test. After you create a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. If the endpoint specifications in `ConnectivityTest` are invalid (for example, containing non-existent resources in the network, or you don't have read permissions to the network configurations of listed projects), then the reachability result returns a value of `UNKNOWN`. If the endpoint specifications in `ConnectivityTest` are incomplete, the reachability result returns a value of AMBIGUOUS. For more information, see the Connectivity Test documentation.", - "canonical": true, - "file": "reachability_service.create_connectivity_test.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.CreateConnectivityTest", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "test_id", - "type": "TYPE_STRING" - }, - { - "name": "resource", - "type": ".google.cloud.networkmanagement.v1.ConnectivityTest" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ReachabilityServiceClient", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityServiceClient" - }, - "method": { - "shortName": "CreateConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.CreateConnectivityTest", - "service": { - "shortName": "ReachabilityService", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService" - } - } - } - }, - { - "regionTag": "networkmanagement_v1_generated_ReachabilityService_UpdateConnectivityTest_async", - "title": "ReachabilityService updateConnectivityTest Sample", - "origin": "API_DEFINITION", - "description": " Updates the configuration of an existing `ConnectivityTest`. After you update a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. The Reachability state in the test resource is updated with the new result. If the endpoint specifications in `ConnectivityTest` are invalid (for example, they contain non-existent resources in the network, or the user does not have read permissions to the network configurations of listed projects), then the reachability result returns a value of UNKNOWN. If the endpoint specifications in `ConnectivityTest` are incomplete, the reachability result returns a value of `AMBIGUOUS`. See the documentation in `ConnectivityTest` for for more details.", - "canonical": true, - "file": "reachability_service.update_connectivity_test.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.UpdateConnectivityTest", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "resource", - "type": ".google.cloud.networkmanagement.v1.ConnectivityTest" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ReachabilityServiceClient", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityServiceClient" - }, - "method": { - "shortName": "UpdateConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.UpdateConnectivityTest", - "service": { - "shortName": "ReachabilityService", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService" - } - } - } - }, - { - "regionTag": "networkmanagement_v1_generated_ReachabilityService_RerunConnectivityTest_async", - "title": "ReachabilityService rerunConnectivityTest Sample", - "origin": "API_DEFINITION", - "description": " Rerun an existing `ConnectivityTest`. After the user triggers the rerun, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. Even though the test configuration remains the same, the reachability result may change due to underlying network configuration changes. If the endpoint specifications in `ConnectivityTest` become invalid (for example, specified resources are deleted in the network, or you lost read permissions to the network configurations of listed projects), then the reachability result returns a value of `UNKNOWN`.", - "canonical": true, - "file": "reachability_service.rerun_connectivity_test.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RerunConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.RerunConnectivityTest", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ReachabilityServiceClient", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityServiceClient" - }, - "method": { - "shortName": "RerunConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.RerunConnectivityTest", - "service": { - "shortName": "ReachabilityService", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService" - } - } - } - }, - { - "regionTag": "networkmanagement_v1_generated_ReachabilityService_DeleteConnectivityTest_async", - "title": "ReachabilityService deleteConnectivityTest Sample", - "origin": "API_DEFINITION", - "description": " Deletes a specific `ConnectivityTest`.", - "canonical": true, - "file": "reachability_service.delete_connectivity_test.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.DeleteConnectivityTest", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ReachabilityServiceClient", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityServiceClient" - }, - "method": { - "shortName": "DeleteConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService.DeleteConnectivityTest", - "service": { - "shortName": "ReachabilityService", - "fullName": "google.cloud.networkmanagement.v1.ReachabilityService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/src/index.ts b/owl-bot-staging/google-cloud-networkmanagement/v1/src/index.ts deleted file mode 100644 index 16039802135..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/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 v1 from './v1'; -const ReachabilityServiceClient = v1.ReachabilityServiceClient; -type ReachabilityServiceClient = v1.ReachabilityServiceClient; -export {v1, ReachabilityServiceClient}; -export default {v1, ReachabilityServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 0a5d92ed4df..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.networkmanagement.v1", - "libraryPackage": "@google-cloud/network-management", - "services": { - "ReachabilityService": { - "clients": { - "grpc": { - "libraryClient": "ReachabilityServiceClient", - "rpcs": { - "GetConnectivityTest": { - "methods": [ - "getConnectivityTest" - ] - }, - "CreateConnectivityTest": { - "methods": [ - "createConnectivityTest" - ] - }, - "UpdateConnectivityTest": { - "methods": [ - "updateConnectivityTest" - ] - }, - "RerunConnectivityTest": { - "methods": [ - "rerunConnectivityTest" - ] - }, - "DeleteConnectivityTest": { - "methods": [ - "deleteConnectivityTest" - ] - }, - "ListConnectivityTests": { - "methods": [ - "listConnectivityTests", - "listConnectivityTestsStream", - "listConnectivityTestsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ReachabilityServiceClient", - "rpcs": { - "GetConnectivityTest": { - "methods": [ - "getConnectivityTest" - ] - }, - "CreateConnectivityTest": { - "methods": [ - "createConnectivityTest" - ] - }, - "UpdateConnectivityTest": { - "methods": [ - "updateConnectivityTest" - ] - }, - "RerunConnectivityTest": { - "methods": [ - "rerunConnectivityTest" - ] - }, - "DeleteConnectivityTest": { - "methods": [ - "deleteConnectivityTest" - ] - }, - "ListConnectivityTests": { - "methods": [ - "listConnectivityTests", - "listConnectivityTestsStream", - "listConnectivityTestsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/index.ts deleted file mode 100644 index ffe401de1fe..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/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 {ReachabilityServiceClient} from './reachability_service_client'; diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_client.ts b/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_client.ts deleted file mode 100644 index 1322b3afc58..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_client.ts +++ /dev/null @@ -1,1139 +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, GrpcClientOptions, LROperation, 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/reachability_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './reachability_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The Reachability service in the Google Cloud Network Management API provides - * services that analyze the reachability within a single Google Virtual Private - * Cloud (VPC) network, between peered VPC networks, between VPC and on-premises - * networks, or between VPC networks and internet hosts. A reachability analysis - * is based on Google Cloud network configurations. - * - * You can use the analysis results to verify these configurations and - * to troubleshoot connectivity issues. - * @class - * @memberof v1 - */ -export class ReachabilityServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - reachabilityServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ReachabilityServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 ReachabilityServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ReachabilityServiceClient; - 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 { - 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 = { - connectivityTestPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/global/connectivityTests/{test}' - ), - }; - - // 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 = { - listConnectivityTests: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/global/connectivityTests/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/global/connectivityTests/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/global/connectivityTests/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/global/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/global}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createConnectivityTestResponse = protoFilesRoot.lookup( - '.google.cloud.networkmanagement.v1.ConnectivityTest') as gax.protobuf.Type; - const createConnectivityTestMetadata = protoFilesRoot.lookup( - '.google.cloud.networkmanagement.v1.OperationMetadata') as gax.protobuf.Type; - const updateConnectivityTestResponse = protoFilesRoot.lookup( - '.google.cloud.networkmanagement.v1.ConnectivityTest') as gax.protobuf.Type; - const updateConnectivityTestMetadata = protoFilesRoot.lookup( - '.google.cloud.networkmanagement.v1.OperationMetadata') as gax.protobuf.Type; - const rerunConnectivityTestResponse = protoFilesRoot.lookup( - '.google.cloud.networkmanagement.v1.ConnectivityTest') as gax.protobuf.Type; - const rerunConnectivityTestMetadata = protoFilesRoot.lookup( - '.google.cloud.networkmanagement.v1.OperationMetadata') as gax.protobuf.Type; - const deleteConnectivityTestResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteConnectivityTestMetadata = protoFilesRoot.lookup( - '.google.cloud.networkmanagement.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createConnectivityTest: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createConnectivityTestResponse.decode.bind(createConnectivityTestResponse), - createConnectivityTestMetadata.decode.bind(createConnectivityTestMetadata)), - updateConnectivityTest: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateConnectivityTestResponse.decode.bind(updateConnectivityTestResponse), - updateConnectivityTestMetadata.decode.bind(updateConnectivityTestMetadata)), - rerunConnectivityTest: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - rerunConnectivityTestResponse.decode.bind(rerunConnectivityTestResponse), - rerunConnectivityTestMetadata.decode.bind(rerunConnectivityTestMetadata)), - deleteConnectivityTest: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteConnectivityTestResponse.decode.bind(deleteConnectivityTestResponse), - deleteConnectivityTestMetadata.decode.bind(deleteConnectivityTestMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networkmanagement.v1.ReachabilityService', 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.reachabilityServiceStub) { - return this.reachabilityServiceStub; - } - - // Put together the "service stub" for - // google.cloud.networkmanagement.v1.ReachabilityService. - this.reachabilityServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networkmanagement.v1.ReachabilityService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networkmanagement.v1.ReachabilityService, - 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 reachabilityServiceStubMethods = - ['listConnectivityTests', 'getConnectivityTest', 'createConnectivityTest', 'updateConnectivityTest', 'rerunConnectivityTest', 'deleteConnectivityTest']; - for (const methodName of reachabilityServiceStubMethods) { - const callPromise = this.reachabilityServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.reachabilityServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'networkmanagement.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 'networkmanagement.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 -- - // ------------------- -/** - * Gets the details of a specific Connectivity Test. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. `ConnectivityTest` resource name using the form: - * `projects/{project_id}/locations/global/connectivityTests/{test_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 protos.google.cloud.networkmanagement.v1.ConnectivityTest|ConnectivityTest}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/reachability_service.get_connectivity_test.js - * region_tag:networkmanagement_v1_generated_ReachabilityService_GetConnectivityTest_async - */ - getConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkmanagement.v1.IConnectivityTest, - protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest|undefined, {}|undefined - ]>; - getConnectivityTest( - request: protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networkmanagement.v1.IConnectivityTest, - protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest|null|undefined, - {}|null|undefined>): void; - getConnectivityTest( - request: protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest, - callback: Callback< - protos.google.cloud.networkmanagement.v1.IConnectivityTest, - protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest|null|undefined, - {}|null|undefined>): void; - getConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networkmanagement.v1.IConnectivityTest, - protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.networkmanagement.v1.IConnectivityTest, - protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networkmanagement.v1.IConnectivityTest, - protos.google.cloud.networkmanagement.v1.IGetConnectivityTestRequest|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.getConnectivityTest(request, options, callback); - } - -/** - * Creates a new Connectivity Test. - * After you create a test, the reachability analysis is performed as part - * of the long running operation, which completes when the analysis completes. - * - * If the endpoint specifications in `ConnectivityTest` are invalid - * (for example, containing non-existent resources in the network, or you - * don't have read permissions to the network configurations of listed - * projects), then the reachability result returns a value of `UNKNOWN`. - * - * If the endpoint specifications in `ConnectivityTest` are - * incomplete, the reachability result returns a value of - * AMBIGUOUS. For more information, - * see the Connectivity Test documentation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the Connectivity Test to create: - * `projects/{project_id}/locations/global` - * @param {string} request.testId - * Required. The logical name of the Connectivity Test in your project - * with the following restrictions: - * - * * Must contain only lowercase letters, numbers, and hyphens. - * * Must start with a letter. - * * Must be between 1-40 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project - * @param {google.cloud.networkmanagement.v1.ConnectivityTest} request.resource - * Required. A `ConnectivityTest` 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/reachability_service.create_connectivity_test.js - * region_tag:networkmanagement_v1_generated_ReachabilityService_CreateConnectivityTest_async - */ - createConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1.ICreateConnectivityTestRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createConnectivityTest( - request: protos.google.cloud.networkmanagement.v1.ICreateConnectivityTestRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConnectivityTest( - request: protos.google.cloud.networkmanagement.v1.ICreateConnectivityTestRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1.ICreateConnectivityTestRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createConnectivityTest(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createConnectivityTest()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/reachability_service.create_connectivity_test.js - * region_tag:networkmanagement_v1_generated_ReachabilityService_CreateConnectivityTest_async - */ - async checkCreateConnectivityTestProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConnectivityTest, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the configuration of an existing `ConnectivityTest`. - * After you update a test, the reachability analysis is performed as part - * of the long running operation, which completes when the analysis completes. - * The Reachability state in the test resource is updated with the new result. - * - * If the endpoint specifications in `ConnectivityTest` are invalid - * (for example, they contain non-existent resources in the network, or the - * user does not have read permissions to the network configurations of - * listed projects), then the reachability result returns a value of - * UNKNOWN. - * - * If the endpoint specifications in `ConnectivityTest` are incomplete, the - * reachability result returns a value of `AMBIGUOUS`. See the documentation - * in `ConnectivityTest` for for more details. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. At least one path must be supplied in - * this field. - * @param {google.cloud.networkmanagement.v1.ConnectivityTest} request.resource - * Required. Only fields specified in update_mask are updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/reachability_service.update_connectivity_test.js - * region_tag:networkmanagement_v1_generated_ReachabilityService_UpdateConnectivityTest_async - */ - updateConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1.IUpdateConnectivityTestRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateConnectivityTest( - request: protos.google.cloud.networkmanagement.v1.IUpdateConnectivityTestRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateConnectivityTest( - request: protos.google.cloud.networkmanagement.v1.IUpdateConnectivityTestRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1.IUpdateConnectivityTestRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource.name': request.resource!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateConnectivityTest(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateConnectivityTest()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/reachability_service.update_connectivity_test.js - * region_tag:networkmanagement_v1_generated_ReachabilityService_UpdateConnectivityTest_async - */ - async checkUpdateConnectivityTestProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateConnectivityTest, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Rerun an existing `ConnectivityTest`. - * After the user triggers the rerun, the reachability analysis is performed - * as part of the long running operation, which completes when the analysis - * completes. - * - * Even though the test configuration remains the same, the reachability - * result may change due to underlying network configuration changes. - * - * If the endpoint specifications in `ConnectivityTest` become invalid (for - * example, specified resources are deleted in the network, or you lost - * read permissions to the network configurations of listed projects), then - * the reachability result returns a value of `UNKNOWN`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Connectivity Test resource name using the form: - * `projects/{project_id}/locations/global/connectivityTests/{test_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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/reachability_service.rerun_connectivity_test.js - * region_tag:networkmanagement_v1_generated_ReachabilityService_RerunConnectivityTest_async - */ - rerunConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1.IRerunConnectivityTestRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - rerunConnectivityTest( - request: protos.google.cloud.networkmanagement.v1.IRerunConnectivityTestRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - rerunConnectivityTest( - request: protos.google.cloud.networkmanagement.v1.IRerunConnectivityTestRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - rerunConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1.IRerunConnectivityTestRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.rerunConnectivityTest(request, options, callback); - } -/** - * Check the status of the long running operation returned by `rerunConnectivityTest()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/reachability_service.rerun_connectivity_test.js - * region_tag:networkmanagement_v1_generated_ReachabilityService_RerunConnectivityTest_async - */ - async checkRerunConnectivityTestProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.rerunConnectivityTest, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a specific `ConnectivityTest`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Connectivity Test resource name using the form: - * `projects/{project_id}/locations/global/connectivityTests/{test_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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/reachability_service.delete_connectivity_test.js - * region_tag:networkmanagement_v1_generated_ReachabilityService_DeleteConnectivityTest_async - */ - deleteConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1.IDeleteConnectivityTestRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteConnectivityTest( - request: protos.google.cloud.networkmanagement.v1.IDeleteConnectivityTestRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConnectivityTest( - request: protos.google.cloud.networkmanagement.v1.IDeleteConnectivityTestRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1.IDeleteConnectivityTestRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteConnectivityTest(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteConnectivityTest()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/reachability_service.delete_connectivity_test.js - * region_tag:networkmanagement_v1_generated_ReachabilityService_DeleteConnectivityTest_async - */ - async checkDeleteConnectivityTestProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConnectivityTest, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all Connectivity Tests owned by a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the Connectivity Tests: - * `projects/{project_id}/locations/global` - * @param {number} request.pageSize - * Number of `ConnectivityTests` to return. - * @param {string} request.pageToken - * Page token from an earlier query, as returned in `next_page_token`. - * @param {string} request.filter - * Lists the `ConnectivityTests` that match the filter expression. A filter - * expression filters the resources listed in the response. The expression - * must be of the form ` ` where operators: `<`, `>`, - * `<=`, - * `>=`, - * `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is - * roughly synonymous with equality). can refer to a proto or JSON - * field, or a synthetic field. Field names can be camelCase or snake_case. - * - * Examples: - * - Filter by name: - * name = "projects/proj-1/locations/global/connectivityTests/test-1 - * - * - Filter by labels: - * - Resources that have a key called `foo` - * labels.foo:* - * - Resources that have a key called `foo` whose value is `bar` - * labels.foo = bar - * @param {string} request.orderBy - * Field to use to sort the list. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.networkmanagement.v1.ConnectivityTest|ConnectivityTest}. - * 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 `listConnectivityTestsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listConnectivityTests( - request?: protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkmanagement.v1.IConnectivityTest[], - protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest|null, - protos.google.cloud.networkmanagement.v1.IListConnectivityTestsResponse - ]>; - listConnectivityTests( - request: protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, - protos.google.cloud.networkmanagement.v1.IListConnectivityTestsResponse|null|undefined, - protos.google.cloud.networkmanagement.v1.IConnectivityTest>): void; - listConnectivityTests( - request: protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, - callback: PaginationCallback< - protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, - protos.google.cloud.networkmanagement.v1.IListConnectivityTestsResponse|null|undefined, - protos.google.cloud.networkmanagement.v1.IConnectivityTest>): void; - listConnectivityTests( - request?: protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, - protos.google.cloud.networkmanagement.v1.IListConnectivityTestsResponse|null|undefined, - protos.google.cloud.networkmanagement.v1.IConnectivityTest>, - callback?: PaginationCallback< - protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, - protos.google.cloud.networkmanagement.v1.IListConnectivityTestsResponse|null|undefined, - protos.google.cloud.networkmanagement.v1.IConnectivityTest>): - Promise<[ - protos.google.cloud.networkmanagement.v1.IConnectivityTest[], - protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest|null, - protos.google.cloud.networkmanagement.v1.IListConnectivityTestsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listConnectivityTests(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the Connectivity Tests: - * `projects/{project_id}/locations/global` - * @param {number} request.pageSize - * Number of `ConnectivityTests` to return. - * @param {string} request.pageToken - * Page token from an earlier query, as returned in `next_page_token`. - * @param {string} request.filter - * Lists the `ConnectivityTests` that match the filter expression. A filter - * expression filters the resources listed in the response. The expression - * must be of the form ` ` where operators: `<`, `>`, - * `<=`, - * `>=`, - * `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is - * roughly synonymous with equality). can refer to a proto or JSON - * field, or a synthetic field. Field names can be camelCase or snake_case. - * - * Examples: - * - Filter by name: - * name = "projects/proj-1/locations/global/connectivityTests/test-1 - * - * - Filter by labels: - * - Resources that have a key called `foo` - * labels.foo:* - * - Resources that have a key called `foo` whose value is `bar` - * labels.foo = bar - * @param {string} request.orderBy - * Field to use to sort the list. - * @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 protos.google.cloud.networkmanagement.v1.ConnectivityTest|ConnectivityTest} 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 `listConnectivityTestsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listConnectivityTestsStream( - request?: protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, - 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['listConnectivityTests']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConnectivityTests.createStream( - this.innerApiCalls.listConnectivityTests as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listConnectivityTests`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the Connectivity Tests: - * `projects/{project_id}/locations/global` - * @param {number} request.pageSize - * Number of `ConnectivityTests` to return. - * @param {string} request.pageToken - * Page token from an earlier query, as returned in `next_page_token`. - * @param {string} request.filter - * Lists the `ConnectivityTests` that match the filter expression. A filter - * expression filters the resources listed in the response. The expression - * must be of the form ` ` where operators: `<`, `>`, - * `<=`, - * `>=`, - * `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is - * roughly synonymous with equality). can refer to a proto or JSON - * field, or a synthetic field. Field names can be camelCase or snake_case. - * - * Examples: - * - Filter by name: - * name = "projects/proj-1/locations/global/connectivityTests/test-1 - * - * - Filter by labels: - * - Resources that have a key called `foo` - * labels.foo:* - * - Resources that have a key called `foo` whose value is `bar` - * labels.foo = bar - * @param {string} request.orderBy - * Field to use to sort the list. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.networkmanagement.v1.ConnectivityTest|ConnectivityTest}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/reachability_service.list_connectivity_tests.js - * region_tag:networkmanagement_v1_generated_ReachabilityService_ListConnectivityTests_async - */ - listConnectivityTestsAsync( - request?: protos.google.cloud.networkmanagement.v1.IListConnectivityTestsRequest, - 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['listConnectivityTests']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConnectivityTests.asyncIterate( - this.innerApiCalls['listConnectivityTests'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified connectivityTest resource name string. - * - * @param {string} project - * @param {string} test - * @returns {string} Resource name string. - */ - connectivityTestPath(project:string,test:string) { - return this.pathTemplates.connectivityTestPathTemplate.render({ - project: project, - test: test, - }); - } - - /** - * Parse the project from ConnectivityTest resource. - * - * @param {string} connectivityTestName - * A fully-qualified path representing ConnectivityTest resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConnectivityTestName(connectivityTestName: string) { - return this.pathTemplates.connectivityTestPathTemplate.match(connectivityTestName).project; - } - - /** - * Parse the test from ConnectivityTest resource. - * - * @param {string} connectivityTestName - * A fully-qualified path representing ConnectivityTest resource. - * @returns {string} A string representing the test. - */ - matchTestFromConnectivityTestName(connectivityTestName: string) { - return this.pathTemplates.connectivityTestPathTemplate.match(connectivityTestName).test; - } - - /** - * 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.reachabilityServiceStub && !this._terminated) { - return this.reachabilityServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_client_config.json b/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_client_config.json deleted file mode 100644 index 6fcdab96cf2..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_client_config.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "interfaces": { - "google.cloud.networkmanagement.v1.ReachabilityService": { - "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": { - "ListConnectivityTests": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetConnectivityTest": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateConnectivityTest": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateConnectivityTest": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RerunConnectivityTest": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteConnectivityTest": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_proto_list.json b/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_proto_list.json deleted file mode 100644 index d84c76feae1..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/src/v1/reachability_service_proto_list.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "../../protos/google/cloud/networkmanagement/v1/connectivity_test.proto", - "../../protos/google/cloud/networkmanagement/v1/reachability.proto", - "../../protos/google/cloud/networkmanagement/v1/trace.proto" -] diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-networkmanagement/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index fd277b9a109..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/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 networkmanagement = require('@google-cloud/network-management'); - -function main() { - const reachabilityServiceClient = new networkmanagement.ReachabilityServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-networkmanagement/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 1a6b5c88dd3..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/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 {ReachabilityServiceClient} from '@google-cloud/network-management'; - -// check that the client class type name can be used -function doStuffWithReachabilityServiceClient(client: ReachabilityServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const reachabilityServiceClient = new ReachabilityServiceClient(); - doStuffWithReachabilityServiceClient(reachabilityServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/system-test/install.ts b/owl-bot-staging/google-cloud-networkmanagement/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1/test/gapic_reachability_service_v1.ts b/owl-bot-staging/google-cloud-networkmanagement/v1/test/gapic_reachability_service_v1.ts deleted file mode 100644 index 21f2f364e80..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1/test/gapic_reachability_service_v1.ts +++ /dev/null @@ -1,1227 +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 reachabilityserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.ReachabilityServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = reachabilityserviceModule.v1.ReachabilityServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = reachabilityserviceModule.v1.ReachabilityServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = reachabilityserviceModule.v1.ReachabilityServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.reachabilityServiceStub, undefined); - await client.initialize(); - assert(client.reachabilityServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.reachabilityServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.reachabilityServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - 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 reachabilityserviceModule.v1.ReachabilityServiceClient({ - 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('getConnectivityTest', () => { - it('invokes getConnectivityTest without error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.GetConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.GetConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.ConnectivityTest() - ); - client.innerApiCalls.getConnectivityTest = stubSimpleCall(expectedResponse); - const [response] = await client.getConnectivityTest(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectivityTest without error using callback', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.GetConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.GetConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.ConnectivityTest() - ); - client.innerApiCalls.getConnectivityTest = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConnectivityTest( - request, - (err?: Error|null, result?: protos.google.cloud.networkmanagement.v1.IConnectivityTest|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectivityTest with error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.GetConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.GetConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConnectivityTest = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConnectivityTest(request), expectedError); - const actualRequest = (client.innerApiCalls.getConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectivityTest with closed client', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.GetConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.GetConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getConnectivityTest(request), expectedError); - }); - }); - - describe('createConnectivityTest', () => { - it('invokes createConnectivityTest without error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.CreateConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.CreateConnectivityTestRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConnectivityTest = stubLongRunningCall(expectedResponse); - const [operation] = await client.createConnectivityTest(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnectivityTest without error using callback', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.CreateConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.CreateConnectivityTestRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConnectivityTest = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createConnectivityTest( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnectivityTest with call error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.CreateConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.CreateConnectivityTestRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConnectivityTest = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createConnectivityTest(request), expectedError); - const actualRequest = (client.innerApiCalls.createConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnectivityTest with LRO error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.CreateConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.CreateConnectivityTestRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConnectivityTest = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createConnectivityTest(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateConnectivityTestProgress without error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateConnectivityTestProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateConnectivityTestProgress with error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateConnectivityTestProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateConnectivityTest', () => { - it('invokes updateConnectivityTest without error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.UpdateConnectivityTestRequest() - ); - request.resource ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.UpdateConnectivityTestRequest', ['resource', 'name']); - request.resource.name = defaultValue1; - const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateConnectivityTest = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateConnectivityTest(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnectivityTest without error using callback', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.UpdateConnectivityTestRequest() - ); - request.resource ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.UpdateConnectivityTestRequest', ['resource', 'name']); - request.resource.name = defaultValue1; - const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateConnectivityTest = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateConnectivityTest( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnectivityTest with call error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.UpdateConnectivityTestRequest() - ); - request.resource ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.UpdateConnectivityTestRequest', ['resource', 'name']); - request.resource.name = defaultValue1; - const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateConnectivityTest = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateConnectivityTest(request), expectedError); - const actualRequest = (client.innerApiCalls.updateConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnectivityTest with LRO error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.UpdateConnectivityTestRequest() - ); - request.resource ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.UpdateConnectivityTestRequest', ['resource', 'name']); - request.resource.name = defaultValue1; - const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateConnectivityTest = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateConnectivityTest(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateConnectivityTestProgress without error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateConnectivityTestProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateConnectivityTestProgress with error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateConnectivityTestProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('rerunConnectivityTest', () => { - it('invokes rerunConnectivityTest without error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.RerunConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.RerunConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.rerunConnectivityTest = stubLongRunningCall(expectedResponse); - const [operation] = await client.rerunConnectivityTest(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rerunConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rerunConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rerunConnectivityTest without error using callback', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.RerunConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.RerunConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.rerunConnectivityTest = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rerunConnectivityTest( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rerunConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rerunConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rerunConnectivityTest with call error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.RerunConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.RerunConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rerunConnectivityTest = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.rerunConnectivityTest(request), expectedError); - const actualRequest = (client.innerApiCalls.rerunConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rerunConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rerunConnectivityTest with LRO error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.RerunConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.RerunConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rerunConnectivityTest = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.rerunConnectivityTest(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.rerunConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rerunConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRerunConnectivityTestProgress without error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRerunConnectivityTestProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRerunConnectivityTestProgress with error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRerunConnectivityTestProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteConnectivityTest', () => { - it('invokes deleteConnectivityTest without error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.DeleteConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.DeleteConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConnectivityTest = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteConnectivityTest(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnectivityTest without error using callback', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.DeleteConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.DeleteConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConnectivityTest = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteConnectivityTest( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnectivityTest with call error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.DeleteConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.DeleteConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConnectivityTest = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteConnectivityTest(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnectivityTest with LRO error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.DeleteConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.DeleteConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConnectivityTest = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteConnectivityTest(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteConnectivityTestProgress without error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteConnectivityTestProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteConnectivityTestProgress with error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteConnectivityTestProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listConnectivityTests', () => { - it('invokes listConnectivityTests without error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), - generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), - generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), - ]; - client.innerApiCalls.listConnectivityTests = stubSimpleCall(expectedResponse); - const [response] = await client.listConnectivityTests(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConnectivityTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectivityTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnectivityTests without error using callback', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), - generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), - generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), - ]; - client.innerApiCalls.listConnectivityTests = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listConnectivityTests( - request, - (err?: Error|null, result?: protos.google.cloud.networkmanagement.v1.IConnectivityTest[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConnectivityTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectivityTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnectivityTests with error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listConnectivityTests = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConnectivityTests(request), expectedError); - const actualRequest = (client.innerApiCalls.listConnectivityTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectivityTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnectivityTestsStream without error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), - generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), - generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), - ]; - client.descriptors.page.listConnectivityTests.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listConnectivityTestsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkmanagement.v1.ConnectivityTest[] = []; - stream.on('data', (response: protos.google.cloud.networkmanagement.v1.ConnectivityTest) => { - 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.listConnectivityTests.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConnectivityTests, request)); - assert( - (client.descriptors.page.listConnectivityTests.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listConnectivityTestsStream with error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConnectivityTests.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listConnectivityTestsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkmanagement.v1.ConnectivityTest[] = []; - stream.on('data', (response: protos.google.cloud.networkmanagement.v1.ConnectivityTest) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listConnectivityTests.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConnectivityTests, request)); - assert( - (client.descriptors.page.listConnectivityTests.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConnectivityTests without error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), - generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), - generateSampleMessage(new protos.google.cloud.networkmanagement.v1.ConnectivityTest()), - ]; - client.descriptors.page.listConnectivityTests.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networkmanagement.v1.IConnectivityTest[] = []; - const iterable = client.listConnectivityTestsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listConnectivityTests.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConnectivityTests.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConnectivityTests with error', async () => { - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1.ListConnectivityTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConnectivityTests.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listConnectivityTestsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networkmanagement.v1.IConnectivityTest[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listConnectivityTests.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConnectivityTests.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('connectivityTest', () => { - const fakePath = "/rendered/path/connectivityTest"; - const expectedParameters = { - project: "projectValue", - test: "testValue", - }; - const client = new reachabilityserviceModule.v1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.connectivityTestPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.connectivityTestPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('connectivityTestPath', () => { - const result = client.connectivityTestPath("projectValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.connectivityTestPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConnectivityTestName', () => { - const result = client.matchProjectFromConnectivityTestName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.connectivityTestPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromConnectivityTestName', () => { - const result = client.matchTestFromConnectivityTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.connectivityTestPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1/tsconfig.json b/owl-bot-staging/google-cloud-networkmanagement/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1/webpack.config.js b/owl-bot-staging/google-cloud-networkmanagement/v1/webpack.config.js deleted file mode 100644 index d975be0ab73..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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: 'ReachabilityService', - filename: './reachability-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-networkmanagement/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.gitignore b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.jsdoc.js deleted file mode 100644 index d081790c646..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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/network-management', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1beta1/README.md b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/README.md deleted file mode 100644 index 90c3778ad46..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Networkmanagement: Nodejs Client diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/package.json b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/package.json deleted file mode 100644 index 70e771ee9ed..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/network-management", - "version": "0.1.0", - "description": "Networkmanagement client for Node.js", - "repository": "googleapis/nodejs-networkmanagement", - "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 networkmanagement", - "networkmanagement", - "reachability service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/connectivity_test.proto b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/connectivity_test.proto deleted file mode 100644 index b565eb34597..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/connectivity_test.proto +++ /dev/null @@ -1,405 +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 -// -// 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.networkmanagement.v1beta1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/networkmanagement/v1beta1/trace.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.NetworkManagement.V1Beta1"; -option go_package = "cloud.google.com/go/networkmanagement/apiv1beta1/networkmanagementpb;networkmanagementpb"; -option java_multiple_files = true; -option java_outer_classname = "TestOuterClass"; -option java_package = "com.google.cloud.networkmanagement.v1beta1"; -option php_namespace = "Google\\Cloud\\NetworkManagement\\V1beta1"; -option ruby_package = "Google::Cloud::NetworkManagement::V1beta1"; - -// A Connectivity Test for a network reachability analysis. -message ConnectivityTest { - option (google.api.resource) = { - type: "networkmanagement.googleapis.com/ConnectivityTest" - pattern: "projects/{project}/locations/global/connectivityTests/{test}" - }; - - // Required. Unique name of the resource using the form: - // `projects/{project_id}/locations/global/connectivityTests/{test}` - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // The user-supplied description of the Connectivity Test. - // Maximum of 512 characters. - string description = 2; - - // Required. Source specification of the Connectivity Test. - // - // You can use a combination of source IP address, virtual machine - // (VM) instance, or Compute Engine network to uniquely identify - // the source location. - // - // Examples: - // If the source IP address is an internal IP address within a Google Cloud - // Virtual Private Cloud (VPC) network, then you must also specify the VPC - // network. Otherwise, specify the VM instance, which already contains its - // internal IP address and VPC network information. - // - // If the source of the test is within an on-premises network, then you must - // provide the destination VPC network. - // - // If the source endpoint is a Compute Engine VM instance with multiple - // network interfaces, the instance itself is not sufficient to identify the - // endpoint. So, you must also specify the source IP address or VPC network. - // - // A reachability analysis proceeds even if the source location is - // ambiguous. However, the test result may include endpoints that you don't - // intend to test. - Endpoint source = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Destination specification of the Connectivity Test. - // - // You can use a combination of destination IP address, Compute Engine - // VM instance, or VPC network to uniquely identify the destination - // location. - // - // Even if the destination IP address is not unique, the source IP - // location is unique. Usually, the analysis can infer the destination - // endpoint from route information. - // - // If the destination you specify is a VM instance and the instance has - // multiple network interfaces, then you must also specify either - // a destination IP address or VPC network to identify the destination - // interface. - // - // A reachability analysis proceeds even if the destination location is - // ambiguous. However, the result can include endpoints that you don't - // intend to test. - Endpoint destination = 4 [(google.api.field_behavior) = REQUIRED]; - - // IP Protocol of the test. When not provided, "TCP" is assumed. - string protocol = 5; - - // Other projects that may be relevant for reachability analysis. - // This is applicable to scenarios where a test can cross project boundaries. - repeated string related_projects = 6; - - // Output only. The display name of a Connectivity Test. - string display_name = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Resource labels to represent user-provided metadata. - map labels = 8; - - // Output only. The time the test was created. - google.protobuf.Timestamp create_time = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the test's configuration was updated. - google.protobuf.Timestamp update_time = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The reachability details of this test from the latest run. - // The details are updated when creating a new test, updating an - // existing test, or triggering a one-time rerun of an existing test. - ReachabilityDetails reachability_details = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The probing details of this test from the latest run, present - // for applicable tests only. The details are updated when creating a new - // test, updating an existing test, or triggering a one-time rerun of an - // existing test. - ProbingDetails probing_details = 14 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Source or destination of the Connectivity Test. -message Endpoint { - // The type definition of an endpoint's network. Use one of the - // following choices: - enum NetworkType { - // Default type if unspecified. - NETWORK_TYPE_UNSPECIFIED = 0; - - // A network hosted within Google Cloud. - // To receive more detailed output, specify the URI for the source or - // destination network. - GCP_NETWORK = 1; - - // A network hosted outside of Google Cloud. - // This can be an on-premises network, or a network hosted by another cloud - // provider. - NON_GCP_NETWORK = 2; - } - - // Type of the target of a forwarding rule. - enum ForwardingRuleTarget { - // Forwarding rule target is unknown. - FORWARDING_RULE_TARGET_UNSPECIFIED = 0; - - // Compute Engine instance for protocol forwarding. - INSTANCE = 1; - - // Load Balancer. The specific type can be found from [load_balancer_type] - // [google.cloud.networkmanagement.v1beta1.Endpoint.load_balancer_type]. - LOAD_BALANCER = 2; - - // Classic Cloud VPN Gateway. - VPN_GATEWAY = 3; - - // Forwarding Rule is a Private Service Connect endpoint. - PSC = 4; - } - - // Wrapper for Cloud Function attributes. - message CloudFunctionEndpoint { - // A [Cloud Function](https://cloud.google.com/functions) name. - string uri = 1; - } - - // Wrapper for the App Engine service version attributes. - message AppEngineVersionEndpoint { - // An [App Engine](https://cloud.google.com/appengine) [service - // version](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions) - // name. - string uri = 1; - } - - // Wrapper for Cloud Run revision attributes. - message CloudRunRevisionEndpoint { - // A [Cloud Run](https://cloud.google.com/run) - // [revision](https://cloud.google.com/run/docs/reference/rest/v1/namespaces.revisions/get) - // URI. The format is: - // projects/{project}/locations/{location}/revisions/{revision} - string uri = 1; - } - - // The IP address of the endpoint, which can be an external or internal IP. - // An IPv6 address is only allowed when the test's destination is a - // [global load balancer - // VIP](https://cloud.google.com/load-balancing/docs/load-balancing-overview). - string ip_address = 1; - - // The IP protocol port of the endpoint. - // Only applicable when protocol is TCP or UDP. - int32 port = 2; - - // A Compute Engine instance URI. - string instance = 3; - - // A forwarding rule and its corresponding IP address represent the frontend - // configuration of a Google Cloud load balancer. Forwarding rules are also - // used for protocol forwarding, Private Service Connect and other network - // services to provide forwarding information in the control plane. Format: - // projects/{project}/global/forwardingRules/{id} or - // projects/{project}/regions/{region}/forwardingRules/{id} - string forwarding_rule = 13; - - // Output only. Specifies the type of the target of the forwarding rule. - optional ForwardingRuleTarget forwarding_rule_target = 14 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. ID of the load balancer the forwarding rule points to. Empty - // for forwarding rules not related to load balancers. - optional string load_balancer_id = 15 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Type of the load balancer the forwarding rule points to. - optional LoadBalancerType load_balancer_type = 16 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A cluster URI for [Google Kubernetes Engine - // master](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-architecture). - string gke_master_cluster = 7; - - // A [Cloud SQL](https://cloud.google.com/sql) instance URI. - string cloud_sql_instance = 8; - - // A [Cloud Function](https://cloud.google.com/functions). - CloudFunctionEndpoint cloud_function = 10; - - // An [App Engine](https://cloud.google.com/appengine) [service - // version](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions). - AppEngineVersionEndpoint app_engine_version = 11; - - // A [Cloud Run](https://cloud.google.com/run) - // [revision](https://cloud.google.com/run/docs/reference/rest/v1/namespaces.revisions/get) - CloudRunRevisionEndpoint cloud_run_revision = 12; - - // A Compute Engine network URI. - string network = 4; - - // Type of the network where the endpoint is located. - // Applicable only to source endpoint, as destination network type can be - // inferred from the source. - NetworkType network_type = 5; - - // Project ID where the endpoint is located. - // The Project ID can be derived from the URI if you provide a VM instance or - // network URI. - // The following are two cases where you must provide the project ID: - // 1. Only the IP address is specified, and the IP address is within a Google - // Cloud project. - // 2. When you are using Shared VPC and the IP address that you provide is - // from the service project. In this case, the network that the IP address - // resides in is defined in the host project. - string project_id = 6; -} - -// Results of the configuration analysis from the last run of the test. -message ReachabilityDetails { - // The overall result of the test's configuration analysis. - enum Result { - // No result was specified. - RESULT_UNSPECIFIED = 0; - - // Possible scenarios are: - // - // * The configuration analysis determined that a packet originating from - // the source is expected to reach the destination. - // * The analysis didn't complete because the user lacks permission for - // some of the resources in the trace. However, at the time the user's - // permission became insufficient, the trace had been successful so far. - REACHABLE = 1; - - // A packet originating from the source is expected to be dropped before - // reaching the destination. - UNREACHABLE = 2; - - // The source and destination endpoints do not uniquely identify - // the test location in the network, and the reachability result contains - // multiple traces. For some traces, a packet could be delivered, and for - // others, it would not be. - AMBIGUOUS = 4; - - // The configuration analysis did not complete. Possible reasons are: - // - // * A permissions error occurred--for example, the user might not have - // read permission for all of the resources named in the test. - // * An internal error occurred. - // * The analyzer received an invalid or unsupported argument or was unable - // to identify a known endpoint. - UNDETERMINED = 5; - } - - // The overall result of the test's configuration analysis. - Result result = 1; - - // The time of the configuration analysis. - google.protobuf.Timestamp verify_time = 2; - - // The details of a failure or a cancellation of reachability analysis. - google.rpc.Status error = 3; - - // Result may contain a list of traces if a test has multiple possible - // paths in the network, such as when destination endpoint is a load balancer - // with multiple backends. - repeated Trace traces = 5; -} - -// Latency percentile rank and value. -message LatencyPercentile { - // Percentage of samples this data point applies to. - int32 percent = 1; - - // percent-th percentile of latency observed, in microseconds. - // Fraction of percent/100 of samples have latency lower or - // equal to the value of this field. - int64 latency_micros = 2; -} - -// Describes measured latency distribution. -message LatencyDistribution { - // Representative latency percentiles. - repeated LatencyPercentile latency_percentiles = 1; -} - -// Results of active probing from the last run of the test. -message ProbingDetails { - // Overall probing result of the test. - enum ProbingResult { - // No result was specified. - PROBING_RESULT_UNSPECIFIED = 0; - - // At least 95% of packets reached the destination. - REACHABLE = 1; - - // No packets reached the destination. - UNREACHABLE = 2; - - // Less than 95% of packets reached the destination. - REACHABILITY_INCONSISTENT = 3; - - // Reachability could not be determined. Possible reasons are: - // * The user lacks permission to access some of the network resources - // required to run the test. - // * No valid source endpoint could be derived from the request. - // * An internal error occurred. - UNDETERMINED = 4; - } - - // Abort cause types. - enum ProbingAbortCause { - // No reason was specified. - PROBING_ABORT_CAUSE_UNSPECIFIED = 0; - - // The user lacks permission to access some of the - // network resources required to run the test. - PERMISSION_DENIED = 1; - - // No valid source endpoint could be derived from the request. - NO_SOURCE_LOCATION = 2; - } - - // Representation of a network edge location as per - // https://cloud.google.com/vpc/docs/edge-locations. - message EdgeLocation { - // Name of the metropolitan area. - string metropolitan_area = 1; - } - - // The overall result of active probing. - ProbingResult result = 1; - - // The time that reachability was assessed through active probing. - google.protobuf.Timestamp verify_time = 2; - - // Details about an internal failure or the cancellation of active probing. - google.rpc.Status error = 3; - - // The reason probing was aborted. - ProbingAbortCause abort_cause = 4; - - // Number of probes sent. - int32 sent_probe_count = 5; - - // Number of probes that reached the destination. - int32 successful_probe_count = 6; - - // The source and destination endpoints derived from the test input and used - // for active probing. - EndpointInfo endpoint_info = 7; - - // Latency as measured by active probing in one direction: - // from the source to the destination endpoint. - LatencyDistribution probing_latency = 8; - - // The EdgeLocation from which a packet destined for/originating from the - // internet will egress/ingress the Google network. - // This will only be populated for a connectivity test which has an internet - // destination/source address. - // The absence of this field *must not* be used as an indication that the - // destination/source is part of the Google network. - EdgeLocation destination_egress_location = 9; -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/reachability.proto b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/reachability.proto deleted file mode 100644 index 6c642e51e46..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/reachability.proto +++ /dev/null @@ -1,269 +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.networkmanagement.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/networkmanagement/v1beta1/connectivity_test.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.NetworkManagement.V1Beta1"; -option go_package = "cloud.google.com/go/networkmanagement/apiv1beta1/networkmanagementpb;networkmanagementpb"; -option java_multiple_files = true; -option java_outer_classname = "ReachabilityServiceProto"; -option java_package = "com.google.cloud.networkmanagement.v1beta1"; -option php_namespace = "Google\\Cloud\\NetworkManagement\\V1beta1"; -option ruby_package = "Google::Cloud::NetworkManagement::V1beta1"; - -// The Reachability service in Google Cloud Network Management API - -// The Reachability service in the Google Cloud Network Management API provides -// services that analyze the reachability within a single Google Virtual Private -// Cloud (VPC) network, between peered VPC networks, between VPC and on-premises -// networks, or between VPC networks and internet hosts. A reachability analysis -// is based on Google Cloud network configurations. -// -// You can use the analysis results to verify these configurations and -// to troubleshoot connectivity issues. -service ReachabilityService { - option (google.api.default_host) = "networkmanagement.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists all Connectivity Tests owned by a project. - rpc ListConnectivityTests(ListConnectivityTestsRequest) returns (ListConnectivityTestsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/global}/connectivityTests" - }; - } - - // Gets the details of a specific Connectivity Test. - rpc GetConnectivityTest(GetConnectivityTestRequest) returns (ConnectivityTest) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/global/connectivityTests/*}" - }; - } - - // Creates a new Connectivity Test. - // After you create a test, the reachability analysis is performed as part - // of the long running operation, which completes when the analysis completes. - // - // If the endpoint specifications in `ConnectivityTest` are invalid - // (for example, containing non-existent resources in the network, or you - // don't have read permissions to the network configurations of listed - // projects), then the reachability result returns a value of `UNKNOWN`. - // - // If the endpoint specifications in `ConnectivityTest` are - // incomplete, the reachability result returns a value of - // AMBIGUOUS. For more information, - // see the Connectivity Test documentation. - rpc CreateConnectivityTest(CreateConnectivityTestRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{parent=projects/*/locations/global}/connectivityTests" - body: "resource" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.networkmanagement.v1beta1.ConnectivityTest" - metadata_type: "OperationMetadata" - }; - } - - // Updates the configuration of an existing `ConnectivityTest`. - // After you update a test, the reachability analysis is performed as part - // of the long running operation, which completes when the analysis completes. - // The Reachability state in the test resource is updated with the new result. - // - // If the endpoint specifications in `ConnectivityTest` are invalid - // (for example, they contain non-existent resources in the network, or the - // user does not have read permissions to the network configurations of - // listed projects), then the reachability result returns a value of - // UNKNOWN. - // - // If the endpoint specifications in `ConnectivityTest` are incomplete, the - // reachability result returns a value of `AMBIGUOUS`. See the documentation - // in `ConnectivityTest` for for more details. - rpc UpdateConnectivityTest(UpdateConnectivityTestRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta1/{resource.name=projects/*/locations/global/connectivityTests/*}" - body: "resource" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.networkmanagement.v1beta1.ConnectivityTest" - metadata_type: "OperationMetadata" - }; - } - - // Rerun an existing `ConnectivityTest`. - // After the user triggers the rerun, the reachability analysis is performed - // as part of the long running operation, which completes when the analysis - // completes. - // - // Even though the test configuration remains the same, the reachability - // result may change due to underlying network configuration changes. - // - // If the endpoint specifications in `ConnectivityTest` become invalid (for - // example, specified resources are deleted in the network, or you lost - // read permissions to the network configurations of listed projects), then - // the reachability result returns a value of `UNKNOWN`. - rpc RerunConnectivityTest(RerunConnectivityTestRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/global/connectivityTests/*}:rerun" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.networkmanagement.v1beta1.ConnectivityTest" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a specific `ConnectivityTest`. - rpc DeleteConnectivityTest(DeleteConnectivityTestRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta1/{name=projects/*/locations/global/connectivityTests/*}" - }; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } -} - -// Request for the `ListConnectivityTests` method. -message ListConnectivityTestsRequest { - // Required. The parent resource of the Connectivity Tests: - // `projects/{project_id}/locations/global` - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Number of `ConnectivityTests` to return. - int32 page_size = 2; - - // Page token from an earlier query, as returned in `next_page_token`. - string page_token = 3; - - // Lists the `ConnectivityTests` that match the filter expression. A filter - // expression filters the resources listed in the response. The expression - // must be of the form ` ` where operators: `<`, `>`, - // `<=`, - // `>=`, - // `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is - // roughly synonymous with equality). can refer to a proto or JSON - // field, or a synthetic field. Field names can be camelCase or snake_case. - // - // Examples: - // - Filter by name: - // name = "projects/proj-1/locations/global/connectivityTests/test-1 - // - // - Filter by labels: - // - Resources that have a key called `foo` - // labels.foo:* - // - Resources that have a key called `foo` whose value is `bar` - // labels.foo = bar - string filter = 4; - - // Field to use to sort the list. - string order_by = 5; -} - -// Response for the `ListConnectivityTests` method. -message ListConnectivityTestsResponse { - // List of Connectivity Tests. - repeated ConnectivityTest resources = 1; - - // Page token to fetch the next set of Connectivity Tests. - string next_page_token = 2; - - // Locations that could not be reached (when querying all locations with `-`). - repeated string unreachable = 3; -} - -// Request for the `GetConnectivityTest` method. -message GetConnectivityTestRequest { - // Required. `ConnectivityTest` resource name using the form: - // `projects/{project_id}/locations/global/connectivityTests/{test_id}` - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `CreateConnectivityTest` method. -message CreateConnectivityTestRequest { - // Required. The parent resource of the Connectivity Test to create: - // `projects/{project_id}/locations/global` - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The logical name of the Connectivity Test in your project - // with the following restrictions: - // - // * Must contain only lowercase letters, numbers, and hyphens. - // * Must start with a letter. - // * Must be between 1-40 characters. - // * Must end with a number or a letter. - // * Must be unique within the customer project - string test_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A `ConnectivityTest` resource - ConnectivityTest resource = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `UpdateConnectivityTest` method. -message UpdateConnectivityTestRequest { - // Required. Mask of fields to update. At least one path must be supplied in - // this field. - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Only fields specified in update_mask are updated. - ConnectivityTest resource = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `DeleteConnectivityTest` method. -message DeleteConnectivityTestRequest { - // Required. Connectivity Test resource name using the form: - // `projects/{project_id}/locations/global/connectivityTests/{test_id}` - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `RerunConnectivityTest` method. -message RerunConnectivityTestRequest { - // Required. Connectivity Test resource name using the form: - // `projects/{project_id}/locations/global/connectivityTests/{test_id}` - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Metadata describing an [Operation][google.longrunning.Operation] -message OperationMetadata { - // The time the operation was created. - google.protobuf.Timestamp create_time = 1; - - // The time the operation finished running. - google.protobuf.Timestamp end_time = 2; - - // Target of the operation - for example - // projects/project-1/locations/global/connectivityTests/test-1 - string target = 3; - - // Name of the verb executed by the operation. - string verb = 4; - - // Human-readable status of the operation, if any. - string status_detail = 5; - - // Specifies if cancellation was requested for the operation. - bool cancel_requested = 6; - - // API version. - string api_version = 7; -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/trace.proto b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/trace.proto deleted file mode 100644 index ebc53ba0d09..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/protos/google/cloud/networkmanagement/v1beta1/trace.proto +++ /dev/null @@ -1,1241 +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 -// -// 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.networkmanagement.v1beta1; - -option csharp_namespace = "Google.Cloud.NetworkManagement.V1Beta1"; -option go_package = "cloud.google.com/go/networkmanagement/apiv1beta1/networkmanagementpb;networkmanagementpb"; -option java_multiple_files = true; -option java_outer_classname = "TraceProto"; -option java_package = "com.google.cloud.networkmanagement.v1beta1"; -option php_namespace = "Google\\Cloud\\NetworkManagement\\V1beta1"; -option ruby_package = "Google::Cloud::NetworkManagement::V1beta1"; - -// Trace represents one simulated packet forwarding path. -// -// * Each trace contains multiple ordered steps. -// * Each step is in a particular state with associated configuration. -// * State is categorized as final or non-final states. -// * Each final state has a reason associated. -// * Each trace must end with a final state (the last step). -// ``` -// |---------------------Trace----------------------| -// Step1(State) Step2(State) --- StepN(State(final)) -// ``` -message Trace { - // Derived from the source and destination endpoints definition specified by - // user request, and validated by the data plane model. - // If there are multiple traces starting from different source locations, then - // the endpoint_info may be different between traces. - EndpointInfo endpoint_info = 1; - - // A trace of a test contains multiple steps from the initial state to the - // final state (delivered, dropped, forwarded, or aborted). - // - // The steps are ordered by the processing sequence within the simulated - // network state machine. It is critical to preserve the order of the steps - // and avoid reordering or sorting them. - repeated Step steps = 2; -} - -// A simulated forwarding path is composed of multiple steps. -// Each step has a well-defined state and an associated configuration. -message Step { - // Type of states that are defined in the network state machine. - // Each step in the packet trace is in a specific state. - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // Initial state: packet originating from a Compute Engine instance. - // An InstanceInfo is populated with starting instance information. - START_FROM_INSTANCE = 1; - - // Initial state: packet originating from the internet. - // The endpoint information is populated. - START_FROM_INTERNET = 2; - - // Initial state: packet originating from a Google service. Some Google - // services, such as health check probers or Identity Aware Proxy use - // special routes, outside VPC routing configuration to reach Compute Engine - // Instances. - START_FROM_GOOGLE_SERVICE = 27; - - // Initial state: packet originating from a VPC or on-premises network - // with internal source IP. - // If the source is a VPC network visible to the user, a NetworkInfo - // is populated with details of the network. - START_FROM_PRIVATE_NETWORK = 3; - - // Initial state: packet originating from a Google Kubernetes Engine cluster - // master. A GKEMasterInfo is populated with starting instance information. - START_FROM_GKE_MASTER = 21; - - // Initial state: packet originating from a Cloud SQL instance. - // A CloudSQLInstanceInfo is populated with starting instance information. - START_FROM_CLOUD_SQL_INSTANCE = 22; - - // Initial state: packet originating from a Cloud Function. - // A CloudFunctionInfo is populated with starting function information. - START_FROM_CLOUD_FUNCTION = 23; - - // Initial state: packet originating from an App Engine service version. - // An AppEngineVersionInfo is populated with starting version information. - START_FROM_APP_ENGINE_VERSION = 25; - - // Initial state: packet originating from a Cloud Run revision. - // A CloudRunRevisionInfo is populated with starting revision information. - START_FROM_CLOUD_RUN_REVISION = 26; - - // Config checking state: verify ingress firewall rule. - APPLY_INGRESS_FIREWALL_RULE = 4; - - // Config checking state: verify egress firewall rule. - APPLY_EGRESS_FIREWALL_RULE = 5; - - // Config checking state: verify route. - APPLY_ROUTE = 6; - - // Config checking state: match forwarding rule. - APPLY_FORWARDING_RULE = 7; - - // Config checking state: packet sent or received under foreign IP - // address and allowed. - SPOOFING_APPROVED = 8; - - // Forwarding state: arriving at a Compute Engine instance. - ARRIVE_AT_INSTANCE = 9; - - // Forwarding state: arriving at a Compute Engine internal load balancer. - ARRIVE_AT_INTERNAL_LOAD_BALANCER = 10; - - // Forwarding state: arriving at a Compute Engine external load balancer. - ARRIVE_AT_EXTERNAL_LOAD_BALANCER = 11; - - // Forwarding state: arriving at a Cloud VPN gateway. - ARRIVE_AT_VPN_GATEWAY = 12; - - // Forwarding state: arriving at a Cloud VPN tunnel. - ARRIVE_AT_VPN_TUNNEL = 13; - - // Forwarding state: arriving at a VPC connector. - ARRIVE_AT_VPC_CONNECTOR = 24; - - // Transition state: packet header translated. - NAT = 14; - - // Transition state: original connection is terminated and a new proxied - // connection is initiated. - PROXY_CONNECTION = 15; - - // Final state: packet could be delivered. - DELIVER = 16; - - // Final state: packet could be dropped. - DROP = 17; - - // Final state: packet could be forwarded to a network with an unknown - // configuration. - FORWARD = 18; - - // Final state: analysis is aborted. - ABORT = 19; - - // Special state: viewer of the test result does not have permission to - // see the configuration in this step. - VIEWER_PERMISSION_MISSING = 20; - } - - // A description of the step. Usually this is a summary of the state. - string description = 1; - - // Each step is in one of the pre-defined states. - State state = 2; - - // This is a step that leads to the final state Drop. - bool causes_drop = 3; - - // Project ID that contains the configuration this step is validating. - string project_id = 4; - - // Configuration or metadata associated with each step. - // The configuration is filtered based on viewer's permission. If a viewer - // has no permission to view the configuration in this step, for non-final - // states a special state is populated (VIEWER_PERMISSION_MISSING), and for - // final state the configuration is cleared. - oneof step_info { - // Display information of a Compute Engine instance. - InstanceInfo instance = 5; - - // Display information of a Compute Engine firewall rule. - FirewallInfo firewall = 6; - - // Display information of a Compute Engine route. - RouteInfo route = 7; - - // Display information of the source and destination under analysis. - // The endpoint information in an intermediate state may differ with the - // initial input, as it might be modified by state like NAT, - // or Connection Proxy. - EndpointInfo endpoint = 8; - - // Display information of a Google service - GoogleServiceInfo google_service = 24; - - // Display information of a Compute Engine forwarding rule. - ForwardingRuleInfo forwarding_rule = 9; - - // Display information of a Compute Engine VPN gateway. - VpnGatewayInfo vpn_gateway = 10; - - // Display information of a Compute Engine VPN tunnel. - VpnTunnelInfo vpn_tunnel = 11; - - // Display information of a VPC connector. - VpcConnectorInfo vpc_connector = 21; - - // Display information of the final state "deliver" and reason. - DeliverInfo deliver = 12; - - // Display information of the final state "forward" and reason. - ForwardInfo forward = 13; - - // Display information of the final state "abort" and reason. - AbortInfo abort = 14; - - // Display information of the final state "drop" and reason. - DropInfo drop = 15; - - // Display information of the load balancers. - LoadBalancerInfo load_balancer = 16; - - // Display information of a Google Cloud network. - NetworkInfo network = 17; - - // Display information of a Google Kubernetes Engine cluster master. - GKEMasterInfo gke_master = 18; - - // Display information of a Cloud SQL instance. - CloudSQLInstanceInfo cloud_sql_instance = 19; - - // Display information of a Cloud Function. - CloudFunctionInfo cloud_function = 20; - - // Display information of an App Engine service version. - AppEngineVersionInfo app_engine_version = 22; - - // Display information of a Cloud Run revision. - CloudRunRevisionInfo cloud_run_revision = 23; - } -} - -// For display only. Metadata associated with a Compute Engine instance. -message InstanceInfo { - // Name of a Compute Engine instance. - string display_name = 1; - - // URI of a Compute Engine instance. - string uri = 2; - - // Name of the network interface of a Compute Engine instance. - string interface = 3; - - // URI of a Compute Engine network. - string network_uri = 4; - - // Internal IP address of the network interface. - string internal_ip = 5; - - // External IP address of the network interface. - string external_ip = 6; - - // Network tags configured on the instance. - repeated string network_tags = 7; - - // Service account authorized for the instance. - string service_account = 8 [deprecated = true]; -} - -// For display only. Metadata associated with a Compute Engine network. -message NetworkInfo { - // Name of a Compute Engine network. - string display_name = 1; - - // URI of a Compute Engine network. - string uri = 2; - - // The IP range that matches the test. - string matched_ip_range = 4; -} - -// For display only. Metadata associated with a VPC firewall rule, an implied -// VPC firewall rule, or a hierarchical firewall policy rule. -message FirewallInfo { - // The firewall rule's type. - enum FirewallRuleType { - // Unspecified type. - FIREWALL_RULE_TYPE_UNSPECIFIED = 0; - - // Hierarchical firewall policy rule. For details, see - // [Hierarchical firewall policies - // overview](https://cloud.google.com/vpc/docs/firewall-policies). - HIERARCHICAL_FIREWALL_POLICY_RULE = 1; - - // VPC firewall rule. For details, see - // [VPC firewall rules - // overview](https://cloud.google.com/vpc/docs/firewalls). - VPC_FIREWALL_RULE = 2; - - // Implied VPC firewall rule. For details, see - // [Implied - // rules](https://cloud.google.com/vpc/docs/firewalls#default_firewall_rules). - IMPLIED_VPC_FIREWALL_RULE = 3; - - // Implicit firewall rules that are managed by serverless VPC access to - // allow ingress access. They are not visible in the Google Cloud console. - // For details, see [VPC connector's implicit - // rules](https://cloud.google.com/functions/docs/networking/connecting-vpc#restrict-access). - SERVERLESS_VPC_ACCESS_MANAGED_FIREWALL_RULE = 4; - - // Global network firewall policy rule. - // For details, see [Network firewall - // policies](https://cloud.google.com/vpc/docs/network-firewall-policies). - NETWORK_FIREWALL_POLICY_RULE = 5; - - // Regional network firewall policy rule. - // For details, see [Regional network firewall - // policies](https://cloud.google.com/firewall/docs/regional-firewall-policies). - NETWORK_REGIONAL_FIREWALL_POLICY_RULE = 6; - } - - // The display name of the VPC firewall rule. This field is not applicable - // to hierarchical firewall policy rules. - string display_name = 1; - - // The URI of the VPC firewall rule. This field is not applicable to - // implied firewall rules or hierarchical firewall policy rules. - string uri = 2; - - // Possible values: INGRESS, EGRESS - string direction = 3; - - // Possible values: ALLOW, DENY - string action = 4; - - // The priority of the firewall rule. - int32 priority = 5; - - // The URI of the VPC network that the firewall rule is associated with. - // This field is not applicable to hierarchical firewall policy rules. - string network_uri = 6; - - // The target tags defined by the VPC firewall rule. This field is not - // applicable to hierarchical firewall policy rules. - repeated string target_tags = 7; - - // The target service accounts specified by the firewall rule. - repeated string target_service_accounts = 8; - - // The hierarchical firewall policy that this rule is associated with. - // This field is not applicable to VPC firewall rules. - string policy = 9; - - // The firewall rule's type. - FirewallRuleType firewall_rule_type = 10; -} - -// For display only. Metadata associated with a Compute Engine route. -message RouteInfo { - // Type of route: - enum RouteType { - // Unspecified type. Default value. - ROUTE_TYPE_UNSPECIFIED = 0; - - // Route is a subnet route automatically created by the system. - SUBNET = 1; - - // Static route created by the user, including the default route to the - // internet. - STATIC = 2; - - // Dynamic route exchanged between BGP peers. - DYNAMIC = 3; - - // A subnet route received from peering network. - PEERING_SUBNET = 4; - - // A static route received from peering network. - PEERING_STATIC = 5; - - // A dynamic route received from peering network. - PEERING_DYNAMIC = 6; - - // Policy based route. - POLICY_BASED = 7; - } - - // Type of next hop: - enum NextHopType { - // Unspecified type. Default value. - NEXT_HOP_TYPE_UNSPECIFIED = 0; - - // Next hop is an IP address. - NEXT_HOP_IP = 1; - - // Next hop is a Compute Engine instance. - NEXT_HOP_INSTANCE = 2; - - // Next hop is a VPC network gateway. - NEXT_HOP_NETWORK = 3; - - // Next hop is a peering VPC. - NEXT_HOP_PEERING = 4; - - // Next hop is an interconnect. - NEXT_HOP_INTERCONNECT = 5; - - // Next hop is a VPN tunnel. - NEXT_HOP_VPN_TUNNEL = 6; - - // Next hop is a VPN gateway. This scenario only happens when tracing - // connectivity from an on-premises network to Google Cloud through a VPN. - // The analysis simulates a packet departing from the on-premises network - // through a VPN tunnel and arriving at a Cloud VPN gateway. - NEXT_HOP_VPN_GATEWAY = 7; - - // Next hop is an internet gateway. - NEXT_HOP_INTERNET_GATEWAY = 8; - - // Next hop is blackhole; that is, the next hop either does not exist or is - // not running. - NEXT_HOP_BLACKHOLE = 9; - - // Next hop is the forwarding rule of an Internal Load Balancer. - NEXT_HOP_ILB = 10; - - // Next hop is a - // [router appliance - // instance](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/ra-overview). - NEXT_HOP_ROUTER_APPLIANCE = 11; - - // Next hop is an NCC hub. - NEXT_HOP_NCC_HUB = 12; - } - - // Indicates where routes are applicable. - enum RouteScope { - // Unspecified scope. Default value. - ROUTE_SCOPE_UNSPECIFIED = 0; - - // Route is applicable to packets in Network. - NETWORK = 1; - - // Route is applicable to packets using NCC Hub's routing table. - NCC_HUB = 2; - } - - // Type of route. - RouteType route_type = 8; - - // Type of next hop. - NextHopType next_hop_type = 9; - - // Indicates where route is applicable. - RouteScope route_scope = 14; - - // Name of a route. - string display_name = 1; - - // URI of a route. - // Dynamic, peering static and peering dynamic routes do not have an URI. - // Advertised route from Google Cloud VPC to on-premises network also does - // not have an URI. - string uri = 2; - - // Destination IP range of the route. - string dest_ip_range = 3; - - // Next hop of the route. - string next_hop = 4; - - // URI of a Compute Engine network. NETWORK routes only. - string network_uri = 5; - - // Priority of the route. - int32 priority = 6; - - // Instance tags of the route. - repeated string instance_tags = 7; - - // Source IP address range of the route. Policy based routes only. - string src_ip_range = 10; - - // Destination port ranges of the route. Policy based routes only. - repeated string dest_port_ranges = 11; - - // Source port ranges of the route. Policy based routes only. - repeated string src_port_ranges = 12; - - // Protocols of the route. Policy based routes only. - repeated string protocols = 13; - - // URI of a NCC Hub. NCC_HUB routes only. - optional string ncc_hub_uri = 15; - - // URI of a NCC Spoke. NCC_HUB routes only. - optional string ncc_spoke_uri = 16; -} - -// For display only. Details of a Google Service sending packets to a -// VPC network. Although the source IP might be a publicly routable address, -// some Google Services use special routes within Google production -// infrastructure to reach Compute Engine Instances. -// https://cloud.google.com/vpc/docs/routes#special_return_paths -message GoogleServiceInfo { - // Recognized type of a Google Service. - enum GoogleServiceType { - // Unspecified Google Service. Includes most of Google APIs and services. - GOOGLE_SERVICE_TYPE_UNSPECIFIED = 0; - - // Identity aware proxy. - // https://cloud.google.com/iap/docs/using-tcp-forwarding - IAP = 1; - - // One of two services sharing IP ranges: - // * Load Balancer proxy - // * Centralized Health Check prober - // https://cloud.google.com/load-balancing/docs/firewall-rules - GFE_PROXY_OR_HEALTH_CHECK_PROBER = 2; - - // Connectivity from Cloud DNS to forwarding targets or alternate name - // servers that use private routing. - // https://cloud.google.com/dns/docs/zones/forwarding-zones#firewall-rules - // https://cloud.google.com/dns/docs/policies#firewall-rules - CLOUD_DNS = 3; - } - - // Source IP address. - string source_ip = 1; - - // Recognized type of a Google Service. - GoogleServiceType google_service_type = 2; -} - -// For display only. Metadata associated with a Compute Engine forwarding rule. -message ForwardingRuleInfo { - // Name of a Compute Engine forwarding rule. - string display_name = 1; - - // URI of a Compute Engine forwarding rule. - string uri = 2; - - // Protocol defined in the forwarding rule that matches the test. - string matched_protocol = 3; - - // Port range defined in the forwarding rule that matches the test. - string matched_port_range = 6; - - // VIP of the forwarding rule. - string vip = 4; - - // Target type of the forwarding rule. - string target = 5; - - // Network URI. Only valid for Internal Load Balancer. - string network_uri = 7; -} - -// For display only. Metadata associated with a load balancer. -message LoadBalancerInfo { - // The type definition for a load balancer: - enum LoadBalancerType { - // Type is unspecified. - LOAD_BALANCER_TYPE_UNSPECIFIED = 0; - - // Internal TCP/UDP load balancer. - INTERNAL_TCP_UDP = 1; - - // Network TCP/UDP load balancer. - NETWORK_TCP_UDP = 2; - - // HTTP(S) proxy load balancer. - HTTP_PROXY = 3; - - // TCP proxy load balancer. - TCP_PROXY = 4; - - // SSL proxy load balancer. - SSL_PROXY = 5; - } - - // The type definition for a load balancer backend configuration: - enum BackendType { - // Type is unspecified. - BACKEND_TYPE_UNSPECIFIED = 0; - - // Backend Service as the load balancer's backend. - BACKEND_SERVICE = 1; - - // Target Pool as the load balancer's backend. - TARGET_POOL = 2; - - // Target Instance as the load balancer's backend. - TARGET_INSTANCE = 3; - } - - // Type of the load balancer. - LoadBalancerType load_balancer_type = 1; - - // URI of the health check for the load balancer. - string health_check_uri = 2; - - // Information for the loadbalancer backends. - repeated LoadBalancerBackend backends = 3; - - // Type of load balancer's backend configuration. - BackendType backend_type = 4; - - // Backend configuration URI. - string backend_uri = 5; -} - -// For display only. Metadata associated with a specific load balancer backend. -message LoadBalancerBackend { - // State of a health check firewall configuration: - enum HealthCheckFirewallState { - // State is unspecified. Default state if not populated. - HEALTH_CHECK_FIREWALL_STATE_UNSPECIFIED = 0; - - // There are configured firewall rules to allow health check probes to the - // backend. - CONFIGURED = 1; - - // There are firewall rules configured to allow partial health check ranges - // or block all health check ranges. - // If a health check probe is sent from denied IP ranges, - // the health check to the backend will fail. Then, the backend will be - // marked unhealthy and will not receive traffic sent to the load balancer. - MISCONFIGURED = 2; - } - - // Name of a Compute Engine instance or network endpoint. - string display_name = 1; - - // URI of a Compute Engine instance or network endpoint. - string uri = 2; - - // State of the health check firewall configuration. - HealthCheckFirewallState health_check_firewall_state = 3; - - // A list of firewall rule URIs allowing probes from health check IP ranges. - repeated string health_check_allowing_firewall_rules = 4; - - // A list of firewall rule URIs blocking probes from health check IP ranges. - repeated string health_check_blocking_firewall_rules = 5; -} - -// For display only. Metadata associated with a Compute Engine VPN gateway. -message VpnGatewayInfo { - // Name of a VPN gateway. - string display_name = 1; - - // URI of a VPN gateway. - string uri = 2; - - // URI of a Compute Engine network where the VPN gateway is configured. - string network_uri = 3; - - // IP address of the VPN gateway. - string ip_address = 4; - - // A VPN tunnel that is associated with this VPN gateway. - // There may be multiple VPN tunnels configured on a VPN gateway, and only - // the one relevant to the test is displayed. - string vpn_tunnel_uri = 5; - - // Name of a Google Cloud region where this VPN gateway is configured. - string region = 6; -} - -// For display only. Metadata associated with a Compute Engine VPN tunnel. -message VpnTunnelInfo { - // Types of VPN routing policy. For details, refer to [Networks and Tunnel - // routing](https://cloud.google.com/network-connectivity/docs/vpn/concepts/choosing-networks-routing/). - enum RoutingType { - // Unspecified type. Default value. - ROUTING_TYPE_UNSPECIFIED = 0; - - // Route based VPN. - ROUTE_BASED = 1; - - // Policy based routing. - POLICY_BASED = 2; - - // Dynamic (BGP) routing. - DYNAMIC = 3; - } - - // Name of a VPN tunnel. - string display_name = 1; - - // URI of a VPN tunnel. - string uri = 2; - - // URI of the VPN gateway at local end of the tunnel. - string source_gateway = 3; - - // URI of a VPN gateway at remote end of the tunnel. - string remote_gateway = 4; - - // Remote VPN gateway's IP address. - string remote_gateway_ip = 5; - - // Local VPN gateway's IP address. - string source_gateway_ip = 6; - - // URI of a Compute Engine network where the VPN tunnel is configured. - string network_uri = 7; - - // Name of a Google Cloud region where this VPN tunnel is configured. - string region = 8; - - // Type of the routing policy. - RoutingType routing_type = 9; -} - -// For display only. The specification of the endpoints for the test. -// EndpointInfo is derived from source and destination Endpoint and validated -// by the backend data plane model. -message EndpointInfo { - // Source IP address. - string source_ip = 1; - - // Destination IP address. - string destination_ip = 2; - - // IP protocol in string format, for example: "TCP", "UDP", "ICMP". - string protocol = 3; - - // Source port. Only valid when protocol is TCP or UDP. - int32 source_port = 4; - - // Destination port. Only valid when protocol is TCP or UDP. - int32 destination_port = 5; - - // URI of the network where this packet originates from. - string source_network_uri = 6; - - // URI of the network where this packet is sent to. - string destination_network_uri = 7; - - // URI of the source telemetry agent this packet originates from. - string source_agent_uri = 8; -} - -// Details of the final state "deliver" and associated resource. -message DeliverInfo { - // Deliver target types: - enum Target { - // Target not specified. - TARGET_UNSPECIFIED = 0; - - // Target is a Compute Engine instance. - INSTANCE = 1; - - // Target is the internet. - INTERNET = 2; - - // Target is a Google API. - GOOGLE_API = 3; - - // Target is a Google Kubernetes Engine cluster master. - GKE_MASTER = 4; - - // Target is a Cloud SQL instance. - CLOUD_SQL_INSTANCE = 5; - - // Target is a published service that uses [Private Service - // Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-services). - PSC_PUBLISHED_SERVICE = 6; - - // Target is all Google APIs that use [Private Service - // Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-apis). - PSC_GOOGLE_API = 7; - - // Target is a VPC-SC that uses [Private Service - // Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-apis). - PSC_VPC_SC = 8; - - // Target is a serverless network endpoint group. - SERVERLESS_NEG = 9; - } - - // Target type where the packet is delivered to. - Target target = 1; - - // URI of the resource that the packet is delivered to. - string resource_uri = 2; -} - -// Details of the final state "forward" and associated resource. -message ForwardInfo { - // Forward target types. - enum Target { - // Target not specified. - TARGET_UNSPECIFIED = 0; - - // Forwarded to a VPC peering network. - PEERING_VPC = 1; - - // Forwarded to a Cloud VPN gateway. - VPN_GATEWAY = 2; - - // Forwarded to a Cloud Interconnect connection. - INTERCONNECT = 3; - - // Forwarded to a Google Kubernetes Engine Container cluster master. - GKE_MASTER = 4; - - // Forwarded to the next hop of a custom route imported from a peering VPC. - IMPORTED_CUSTOM_ROUTE_NEXT_HOP = 5; - - // Forwarded to a Cloud SQL instance. - CLOUD_SQL_INSTANCE = 6; - - // Forwarded to a VPC network in another project. - ANOTHER_PROJECT = 7; - - // Forwarded to an NCC Hub. - NCC_HUB = 8; - } - - // Target type where this packet is forwarded to. - Target target = 1; - - // URI of the resource that the packet is forwarded to. - string resource_uri = 2; -} - -// Details of the final state "abort" and associated resource. -message AbortInfo { - // Abort cause types: - enum Cause { - // Cause is unspecified. - CAUSE_UNSPECIFIED = 0; - - // Aborted due to unknown network. - // The reachability analysis cannot proceed because the user does not have - // access to the host project's network configurations, including firewall - // rules and routes. This happens when the project is a service project and - // the endpoints being traced are in the host project's network. - UNKNOWN_NETWORK = 1; - - // Aborted because the IP address(es) are unknown. - UNKNOWN_IP = 2; - - // Aborted because no project information can be derived from the test - // input. - UNKNOWN_PROJECT = 3; - - // Aborted because the user lacks the permission to access all or part of - // the network configurations required to run the test. - PERMISSION_DENIED = 4; - - // Aborted because no valid source endpoint is derived from the input test - // request. - NO_SOURCE_LOCATION = 5; - - // Aborted because the source and/or destination endpoint specified in - // the test are invalid. The possible reasons that an endpoint is - // invalid include: malformed IP address; nonexistent instance or - // network URI; IP address not in the range of specified network URI; and - // instance not owning the network interface in the specified network. - INVALID_ARGUMENT = 6; - - // Aborted because traffic is sent from a public IP to an instance without - // an external IP. - NO_EXTERNAL_IP = 7; - - // Aborted because none of the traces matches destination information - // specified in the input test request. - UNINTENDED_DESTINATION = 8; - - // Aborted because the number of steps in the trace exceeding a certain - // limit which may be caused by routing loop. - TRACE_TOO_LONG = 9; - - // Aborted due to internal server error. - INTERNAL_ERROR = 10; - - // Aborted because the source endpoint could not be found. - SOURCE_ENDPOINT_NOT_FOUND = 11; - - // Aborted because the source network does not match the source endpoint. - MISMATCHED_SOURCE_NETWORK = 12; - - // Aborted because the destination endpoint could not be found. - DESTINATION_ENDPOINT_NOT_FOUND = 13; - - // Aborted because the destination network does not match the destination - // endpoint. - MISMATCHED_DESTINATION_NETWORK = 14; - - // Aborted because the test scenario is not supported. - UNSUPPORTED = 15; - - // Aborted because the source and destination resources have no common IP - // version. - MISMATCHED_IP_VERSION = 16; - - // Aborted because the connection between the control plane and the node of - // the source cluster is initiated by the node and managed by the - // Konnectivity proxy. - GKE_KONNECTIVITY_PROXY_UNSUPPORTED = 17; - - // Aborted because expected resource configuration was missing. - RESOURCE_CONFIG_NOT_FOUND = 18; - - // Aborted because a PSC endpoint selection for the Google-managed service - // is ambiguous (several PSC endpoints satisfy test input). - GOOGLE_MANAGED_SERVICE_AMBIGUOUS_PSC_ENDPOINT = 19; - - // Aborted because tests with a PSC-based Cloud SQL instance as a source are - // not supported. - SOURCE_PSC_CLOUD_SQL_UNSUPPORTED = 20; - - // Aborted because tests with a forwarding rule as a source are not - // supported. - SOURCE_FORWARDING_RULE_UNSUPPORTED = 21; - } - - // Causes that the analysis is aborted. - Cause cause = 1; - - // URI of the resource that caused the abort. - string resource_uri = 2; - - // List of project IDs that the user has specified in the request but does - // not have permission to access network configs. Analysis is aborted in this - // case with the PERMISSION_DENIED cause. - repeated string projects_missing_permission = 3; -} - -// Details of the final state "drop" and associated resource. -message DropInfo { - // Drop cause types: - enum Cause { - // Cause is unspecified. - CAUSE_UNSPECIFIED = 0; - - // Destination external address cannot be resolved to a known target. If - // the address is used in a Google Cloud project, provide the project ID - // as test input. - UNKNOWN_EXTERNAL_ADDRESS = 1; - - // A Compute Engine instance can only send or receive a packet with a - // foreign IP address if ip_forward is enabled. - FOREIGN_IP_DISALLOWED = 2; - - // Dropped due to a firewall rule, unless allowed due to connection - // tracking. - FIREWALL_RULE = 3; - - // Dropped due to no routes. - NO_ROUTE = 4; - - // Dropped due to invalid route. Route's next hop is a blackhole. - ROUTE_BLACKHOLE = 5; - - // Packet is sent to a wrong (unintended) network. Example: you trace a - // packet from VM1:Network1 to VM2:Network2, however, the route configured - // in Network1 sends the packet destined for VM2's IP addresss to Network3. - ROUTE_WRONG_NETWORK = 6; - - // Packet with internal destination address sent to the internet gateway. - PRIVATE_TRAFFIC_TO_INTERNET = 7; - - // Instance with only an internal IP address tries to access Google API and - // services, but private Google access is not enabled. - PRIVATE_GOOGLE_ACCESS_DISALLOWED = 8; - - // Instance with only an internal IP address tries to access external hosts, - // but Cloud NAT is not enabled in the subnet, unless special configurations - // on a VM allow this connection. - NO_EXTERNAL_ADDRESS = 9; - - // Destination internal address cannot be resolved to a known target. If - // this is a shared VPC scenario, verify if the service project ID is - // provided as test input. Otherwise, verify if the IP address is being - // used in the project. - UNKNOWN_INTERNAL_ADDRESS = 10; - - // Forwarding rule's protocol and ports do not match the packet header. - FORWARDING_RULE_MISMATCH = 11; - - // Packet could be dropped because it was sent from a different region - // to a regional forwarding without global access. - FORWARDING_RULE_REGION_MISMATCH = 25; - - // Forwarding rule does not have backends configured. - FORWARDING_RULE_NO_INSTANCES = 12; - - // Firewalls block the health check probes to the backends and cause - // the backends to be unavailable for traffic from the load balancer. - // For more details, see [Health check firewall - // rules](https://cloud.google.com/load-balancing/docs/health-checks#firewall_rules). - FIREWALL_BLOCKING_LOAD_BALANCER_BACKEND_HEALTH_CHECK = 13; - - // Packet is sent from or to a Compute Engine instance that is not in a - // running state. - INSTANCE_NOT_RUNNING = 14; - - // Packet sent from or to a GKE cluster that is not in running state. - GKE_CLUSTER_NOT_RUNNING = 27; - - // Packet sent from or to a Cloud SQL instance that is not in running state. - CLOUD_SQL_INSTANCE_NOT_RUNNING = 28; - - // The type of traffic is blocked and the user cannot configure a firewall - // rule to enable it. See [Always blocked - // traffic](https://cloud.google.com/vpc/docs/firewalls#blockedtraffic) for - // more details. - TRAFFIC_TYPE_BLOCKED = 15; - - // Access to Google Kubernetes Engine cluster master's endpoint is not - // authorized. See [Access to the cluster - // endpoints](https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters#access_to_the_cluster_endpoints) - // for more details. - GKE_MASTER_UNAUTHORIZED_ACCESS = 16; - - // Access to the Cloud SQL instance endpoint is not authorized. - // See [Authorizing with authorized - // networks](https://cloud.google.com/sql/docs/mysql/authorize-networks) for - // more details. - CLOUD_SQL_INSTANCE_UNAUTHORIZED_ACCESS = 17; - - // Packet was dropped inside Google Kubernetes Engine Service. - DROPPED_INSIDE_GKE_SERVICE = 18; - - // Packet was dropped inside Cloud SQL Service. - DROPPED_INSIDE_CLOUD_SQL_SERVICE = 19; - - // Packet was dropped because there is no peering between the originating - // network and the Google Managed Services Network. - GOOGLE_MANAGED_SERVICE_NO_PEERING = 20; - - // Packet was dropped because the Google-managed service uses Private - // Service Connect (PSC), but the PSC endpoint is not found in the project. - GOOGLE_MANAGED_SERVICE_NO_PSC_ENDPOINT = 38; - - // Packet was dropped because the GKE cluster uses Private Service Connect - // (PSC), but the PSC endpoint is not found in the project. - GKE_PSC_ENDPOINT_MISSING = 36; - - // Packet was dropped because the Cloud SQL instance has neither a private - // nor a public IP address. - CLOUD_SQL_INSTANCE_NO_IP_ADDRESS = 21; - - // Packet was dropped because a GKE cluster private endpoint is - // unreachable from a region different from the cluster's region. - GKE_CONTROL_PLANE_REGION_MISMATCH = 30; - - // Packet sent from a public GKE cluster control plane to a private - // IP address. - PUBLIC_GKE_CONTROL_PLANE_TO_PRIVATE_DESTINATION = 31; - - // Packet was dropped because there is no route from a GKE cluster - // control plane to a destination network. - GKE_CONTROL_PLANE_NO_ROUTE = 32; - - // Packet sent from a Cloud SQL instance to an external IP address is not - // allowed. The Cloud SQL instance is not configured to send packets to - // external IP addresses. - CLOUD_SQL_INSTANCE_NOT_CONFIGURED_FOR_EXTERNAL_TRAFFIC = 33; - - // Packet sent from a Cloud SQL instance with only a public IP address to a - // private IP address. - PUBLIC_CLOUD_SQL_INSTANCE_TO_PRIVATE_DESTINATION = 34; - - // Packet was dropped because there is no route from a Cloud SQL - // instance to a destination network. - CLOUD_SQL_INSTANCE_NO_ROUTE = 35; - - // Packet could be dropped because the Cloud Function is not in an active - // status. - CLOUD_FUNCTION_NOT_ACTIVE = 22; - - // Packet could be dropped because no VPC connector is set. - VPC_CONNECTOR_NOT_SET = 23; - - // Packet could be dropped because the VPC connector is not in a running - // state. - VPC_CONNECTOR_NOT_RUNNING = 24; - - // The Private Service Connect endpoint is in a project that is not approved - // to connect to the service. - PSC_CONNECTION_NOT_ACCEPTED = 26; - - // Packet sent from a Cloud Run revision that is not ready. - CLOUD_RUN_REVISION_NOT_READY = 29; - - // Packet was dropped inside Private Service Connect service producer. - DROPPED_INSIDE_PSC_SERVICE_PRODUCER = 37; - - // Packet sent to a load balancer, which requires a proxy-only subnet and - // the subnet is not found. - LOAD_BALANCER_HAS_NO_PROXY_SUBNET = 39; - } - - // Cause that the packet is dropped. - Cause cause = 1; - - // URI of the resource that caused the drop. - string resource_uri = 2; -} - -// For display only. Metadata associated with a Google Kubernetes Engine (GKE) -// cluster master. -message GKEMasterInfo { - // URI of a GKE cluster. - string cluster_uri = 2; - - // URI of a GKE cluster network. - string cluster_network_uri = 4; - - // Internal IP address of a GKE cluster master. - string internal_ip = 5; - - // External IP address of a GKE cluster master. - string external_ip = 6; -} - -// For display only. Metadata associated with a Cloud SQL instance. -message CloudSQLInstanceInfo { - // Name of a Cloud SQL instance. - string display_name = 1; - - // URI of a Cloud SQL instance. - string uri = 2; - - // URI of a Cloud SQL instance network or empty string if the instance does - // not have one. - string network_uri = 4; - - // Internal IP address of a Cloud SQL instance. - string internal_ip = 5; - - // External IP address of a Cloud SQL instance. - string external_ip = 6; - - // Region in which the Cloud SQL instance is running. - string region = 7; -} - -// For display only. Metadata associated with a Cloud Function. -message CloudFunctionInfo { - // Name of a Cloud Function. - string display_name = 1; - - // URI of a Cloud Function. - string uri = 2; - - // Location in which the Cloud Function is deployed. - string location = 3; - - // Latest successfully deployed version id of the Cloud Function. - int64 version_id = 4; -} - -// For display only. Metadata associated with a Cloud Run revision. -message CloudRunRevisionInfo { - // Name of a Cloud Run revision. - string display_name = 1; - - // URI of a Cloud Run revision. - string uri = 2; - - // Location in which this revision is deployed. - string location = 4; - - // URI of Cloud Run service this revision belongs to. - string service_uri = 5; -} - -// For display only. Metadata associated with an App Engine version. -message AppEngineVersionInfo { - // Name of an App Engine version. - string display_name = 1; - - // URI of an App Engine version. - string uri = 2; - - // Runtime of the App Engine version. - string runtime = 3; - - // App Engine execution environment for a version. - string environment = 4; -} - -// For display only. Metadata associated with a VPC connector. -message VpcConnectorInfo { - // Name of a VPC connector. - string display_name = 1; - - // URI of a VPC connector. - string uri = 2; - - // Location in which the VPC connector is deployed. - string location = 3; -} - -// Type of a load balancer. For more information, see [Summary of Google Cloud -// load -// balancers](https://cloud.google.com/load-balancing/docs/load-balancing-overview#summary-of-google-cloud-load-balancers). -enum LoadBalancerType { - // Forwarding rule points to a different target than a load balancer or a - // load balancer type is unknown. - LOAD_BALANCER_TYPE_UNSPECIFIED = 0; - - // Global external HTTP(S) load balancer. - HTTPS_ADVANCED_LOAD_BALANCER = 1; - - // Global external HTTP(S) load balancer (classic) - HTTPS_LOAD_BALANCER = 2; - - // Regional external HTTP(S) load balancer. - REGIONAL_HTTPS_LOAD_BALANCER = 3; - - // Internal HTTP(S) load balancer. - INTERNAL_HTTPS_LOAD_BALANCER = 4; - - // External SSL proxy load balancer. - SSL_PROXY_LOAD_BALANCER = 5; - - // External TCP proxy load balancer. - TCP_PROXY_LOAD_BALANCER = 6; - - // Internal regional TCP proxy load balancer. - INTERNAL_TCP_PROXY_LOAD_BALANCER = 7; - - // External TCP/UDP Network load balancer. - NETWORK_LOAD_BALANCER = 8; - - // Target-pool based external TCP/UDP Network load balancer. - LEGACY_NETWORK_LOAD_BALANCER = 9; - - // Internal TCP/UDP load balancer. - TCP_UDP_INTERNAL_LOAD_BALANCER = 10; -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.create_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.create_connectivity_test.js deleted file mode 100644 index 32c809a7810..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.create_connectivity_test.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, testId, resource) { - // [START networkmanagement_v1beta1_generated_ReachabilityService_CreateConnectivityTest_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 parent resource of the Connectivity Test to create: - * `projects/{project_id}/locations/global` - */ - // const parent = 'abc123' - /** - * Required. The logical name of the Connectivity Test in your project - * with the following restrictions: - * * Must contain only lowercase letters, numbers, and hyphens. - * * Must start with a letter. - * * Must be between 1-40 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project - */ - // const testId = 'abc123' - /** - * Required. A `ConnectivityTest` resource - */ - // const resource = {} - - // Imports the Networkmanagement library - const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1beta1; - - // Instantiates a client - const networkmanagementClient = new ReachabilityServiceClient(); - - async function callCreateConnectivityTest() { - // Construct request - const request = { - parent, - testId, - resource, - }; - - // Run request - const [operation] = await networkmanagementClient.createConnectivityTest(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateConnectivityTest(); - // [END networkmanagement_v1beta1_generated_ReachabilityService_CreateConnectivityTest_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-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.delete_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.delete_connectivity_test.js deleted file mode 100644 index 779d0bba582..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.delete_connectivity_test.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 networkmanagement_v1beta1_generated_ReachabilityService_DeleteConnectivityTest_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. Connectivity Test resource name using the form: - * `projects/{project_id}/locations/global/connectivityTests/{test_id}` - */ - // const name = 'abc123' - - // Imports the Networkmanagement library - const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1beta1; - - // Instantiates a client - const networkmanagementClient = new ReachabilityServiceClient(); - - async function callDeleteConnectivityTest() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await networkmanagementClient.deleteConnectivityTest(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteConnectivityTest(); - // [END networkmanagement_v1beta1_generated_ReachabilityService_DeleteConnectivityTest_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-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.get_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.get_connectivity_test.js deleted file mode 100644 index 36b77449e00..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.get_connectivity_test.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 networkmanagement_v1beta1_generated_ReachabilityService_GetConnectivityTest_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. `ConnectivityTest` resource name using the form: - * `projects/{project_id}/locations/global/connectivityTests/{test_id}` - */ - // const name = 'abc123' - - // Imports the Networkmanagement library - const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1beta1; - - // Instantiates a client - const networkmanagementClient = new ReachabilityServiceClient(); - - async function callGetConnectivityTest() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await networkmanagementClient.getConnectivityTest(request); - console.log(response); - } - - callGetConnectivityTest(); - // [END networkmanagement_v1beta1_generated_ReachabilityService_GetConnectivityTest_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-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.list_connectivity_tests.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.list_connectivity_tests.js deleted file mode 100644 index d4c6277f0af..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.list_connectivity_tests.js +++ /dev/null @@ -1,95 +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 networkmanagement_v1beta1_generated_ReachabilityService_ListConnectivityTests_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 parent resource of the Connectivity Tests: - * `projects/{project_id}/locations/global` - */ - // const parent = 'abc123' - /** - * Number of `ConnectivityTests` to return. - */ - // const pageSize = 1234 - /** - * Page token from an earlier query, as returned in `next_page_token`. - */ - // const pageToken = 'abc123' - /** - * Lists the `ConnectivityTests` that match the filter expression. A filter - * expression filters the resources listed in the response. The expression - * must be of the form ` ` where operators: `<`, `>`, - * `<=`, - * `>=`, - * `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is - * roughly synonymous with equality). can refer to a proto or JSON - * field, or a synthetic field. Field names can be camelCase or snake_case. - * Examples: - * - Filter by name: - * name = "projects/proj-1/locations/global/connectivityTests/test-1 - * - Filter by labels: - * - Resources that have a key called `foo` - * labels.foo:* - * - Resources that have a key called `foo` whose value is `bar` - * labels.foo = bar - */ - // const filter = 'abc123' - /** - * Field to use to sort the list. - */ - // const orderBy = 'abc123' - - // Imports the Networkmanagement library - const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1beta1; - - // Instantiates a client - const networkmanagementClient = new ReachabilityServiceClient(); - - async function callListConnectivityTests() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await networkmanagementClient.listConnectivityTestsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListConnectivityTests(); - // [END networkmanagement_v1beta1_generated_ReachabilityService_ListConnectivityTests_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-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.rerun_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.rerun_connectivity_test.js deleted file mode 100644 index ab700df0a97..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.rerun_connectivity_test.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 networkmanagement_v1beta1_generated_ReachabilityService_RerunConnectivityTest_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. Connectivity Test resource name using the form: - * `projects/{project_id}/locations/global/connectivityTests/{test_id}` - */ - // const name = 'abc123' - - // Imports the Networkmanagement library - const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1beta1; - - // Instantiates a client - const networkmanagementClient = new ReachabilityServiceClient(); - - async function callRerunConnectivityTest() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await networkmanagementClient.rerunConnectivityTest(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRerunConnectivityTest(); - // [END networkmanagement_v1beta1_generated_ReachabilityService_RerunConnectivityTest_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-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.update_connectivity_test.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.update_connectivity_test.js deleted file mode 100644 index 97e4345ec1a..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/reachability_service.update_connectivity_test.js +++ /dev/null @@ -1,68 +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(updateMask, resource) { - // [START networkmanagement_v1beta1_generated_ReachabilityService_UpdateConnectivityTest_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. Mask of fields to update. At least one path must be supplied in - * this field. - */ - // const updateMask = {} - /** - * Required. Only fields specified in update_mask are updated. - */ - // const resource = {} - - // Imports the Networkmanagement library - const {ReachabilityServiceClient} = require('@google-cloud/network-management').v1beta1; - - // Instantiates a client - const networkmanagementClient = new ReachabilityServiceClient(); - - async function callUpdateConnectivityTest() { - // Construct request - const request = { - updateMask, - resource, - }; - - // Run request - const [operation] = await networkmanagementClient.updateConnectivityTest(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateConnectivityTest(); - // [END networkmanagement_v1beta1_generated_ReachabilityService_UpdateConnectivityTest_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-networkmanagement/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.networkmanagement.v1beta1.json b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.networkmanagement.v1beta1.json deleted file mode 100644 index 3c9479a081a..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.networkmanagement.v1beta1.json +++ /dev/null @@ -1,283 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-networkmanagement", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.networkmanagement.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "networkmanagement_v1beta1_generated_ReachabilityService_ListConnectivityTests_async", - "title": "ReachabilityService listConnectivityTests Sample", - "origin": "API_DEFINITION", - "description": " Lists all Connectivity Tests owned by a project.", - "canonical": true, - "file": "reachability_service.list_connectivity_tests.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListConnectivityTests", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.ListConnectivityTests", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkmanagement.v1beta1.ListConnectivityTestsResponse", - "client": { - "shortName": "ReachabilityServiceClient", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityServiceClient" - }, - "method": { - "shortName": "ListConnectivityTests", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.ListConnectivityTests", - "service": { - "shortName": "ReachabilityService", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService" - } - } - } - }, - { - "regionTag": "networkmanagement_v1beta1_generated_ReachabilityService_GetConnectivityTest_async", - "title": "ReachabilityService getConnectivityTest Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a specific Connectivity Test.", - "canonical": true, - "file": "reachability_service.get_connectivity_test.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.GetConnectivityTest", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkmanagement.v1beta1.ConnectivityTest", - "client": { - "shortName": "ReachabilityServiceClient", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityServiceClient" - }, - "method": { - "shortName": "GetConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.GetConnectivityTest", - "service": { - "shortName": "ReachabilityService", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService" - } - } - } - }, - { - "regionTag": "networkmanagement_v1beta1_generated_ReachabilityService_CreateConnectivityTest_async", - "title": "ReachabilityService createConnectivityTest Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Connectivity Test. After you create a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. If the endpoint specifications in `ConnectivityTest` are invalid (for example, containing non-existent resources in the network, or you don't have read permissions to the network configurations of listed projects), then the reachability result returns a value of `UNKNOWN`. If the endpoint specifications in `ConnectivityTest` are incomplete, the reachability result returns a value of AMBIGUOUS. For more information, see the Connectivity Test documentation.", - "canonical": true, - "file": "reachability_service.create_connectivity_test.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.CreateConnectivityTest", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "test_id", - "type": "TYPE_STRING" - }, - { - "name": "resource", - "type": ".google.cloud.networkmanagement.v1beta1.ConnectivityTest" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ReachabilityServiceClient", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityServiceClient" - }, - "method": { - "shortName": "CreateConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.CreateConnectivityTest", - "service": { - "shortName": "ReachabilityService", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService" - } - } - } - }, - { - "regionTag": "networkmanagement_v1beta1_generated_ReachabilityService_UpdateConnectivityTest_async", - "title": "ReachabilityService updateConnectivityTest Sample", - "origin": "API_DEFINITION", - "description": " Updates the configuration of an existing `ConnectivityTest`. After you update a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. The Reachability state in the test resource is updated with the new result. If the endpoint specifications in `ConnectivityTest` are invalid (for example, they contain non-existent resources in the network, or the user does not have read permissions to the network configurations of listed projects), then the reachability result returns a value of UNKNOWN. If the endpoint specifications in `ConnectivityTest` are incomplete, the reachability result returns a value of `AMBIGUOUS`. See the documentation in `ConnectivityTest` for for more details.", - "canonical": true, - "file": "reachability_service.update_connectivity_test.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.UpdateConnectivityTest", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "resource", - "type": ".google.cloud.networkmanagement.v1beta1.ConnectivityTest" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ReachabilityServiceClient", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityServiceClient" - }, - "method": { - "shortName": "UpdateConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.UpdateConnectivityTest", - "service": { - "shortName": "ReachabilityService", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService" - } - } - } - }, - { - "regionTag": "networkmanagement_v1beta1_generated_ReachabilityService_RerunConnectivityTest_async", - "title": "ReachabilityService rerunConnectivityTest Sample", - "origin": "API_DEFINITION", - "description": " Rerun an existing `ConnectivityTest`. After the user triggers the rerun, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. Even though the test configuration remains the same, the reachability result may change due to underlying network configuration changes. If the endpoint specifications in `ConnectivityTest` become invalid (for example, specified resources are deleted in the network, or you lost read permissions to the network configurations of listed projects), then the reachability result returns a value of `UNKNOWN`.", - "canonical": true, - "file": "reachability_service.rerun_connectivity_test.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RerunConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.RerunConnectivityTest", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ReachabilityServiceClient", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityServiceClient" - }, - "method": { - "shortName": "RerunConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.RerunConnectivityTest", - "service": { - "shortName": "ReachabilityService", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService" - } - } - } - }, - { - "regionTag": "networkmanagement_v1beta1_generated_ReachabilityService_DeleteConnectivityTest_async", - "title": "ReachabilityService deleteConnectivityTest Sample", - "origin": "API_DEFINITION", - "description": " Deletes a specific `ConnectivityTest`.", - "canonical": true, - "file": "reachability_service.delete_connectivity_test.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.DeleteConnectivityTest", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ReachabilityServiceClient", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityServiceClient" - }, - "method": { - "shortName": "DeleteConnectivityTest", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService.DeleteConnectivityTest", - "service": { - "shortName": "ReachabilityService", - "fullName": "google.cloud.networkmanagement.v1beta1.ReachabilityService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/index.ts deleted file mode 100644 index 9081c16e578..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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 ReachabilityServiceClient = v1beta1.ReachabilityServiceClient; -type ReachabilityServiceClient = v1beta1.ReachabilityServiceClient; -export {v1beta1, ReachabilityServiceClient}; -export default {v1beta1, ReachabilityServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/gapic_metadata.json deleted file mode 100644 index ef6ab2ba0d6..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/gapic_metadata.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.networkmanagement.v1beta1", - "libraryPackage": "@google-cloud/network-management", - "services": { - "ReachabilityService": { - "clients": { - "grpc": { - "libraryClient": "ReachabilityServiceClient", - "rpcs": { - "GetConnectivityTest": { - "methods": [ - "getConnectivityTest" - ] - }, - "CreateConnectivityTest": { - "methods": [ - "createConnectivityTest" - ] - }, - "UpdateConnectivityTest": { - "methods": [ - "updateConnectivityTest" - ] - }, - "RerunConnectivityTest": { - "methods": [ - "rerunConnectivityTest" - ] - }, - "DeleteConnectivityTest": { - "methods": [ - "deleteConnectivityTest" - ] - }, - "ListConnectivityTests": { - "methods": [ - "listConnectivityTests", - "listConnectivityTestsStream", - "listConnectivityTestsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ReachabilityServiceClient", - "rpcs": { - "GetConnectivityTest": { - "methods": [ - "getConnectivityTest" - ] - }, - "CreateConnectivityTest": { - "methods": [ - "createConnectivityTest" - ] - }, - "UpdateConnectivityTest": { - "methods": [ - "updateConnectivityTest" - ] - }, - "RerunConnectivityTest": { - "methods": [ - "rerunConnectivityTest" - ] - }, - "DeleteConnectivityTest": { - "methods": [ - "deleteConnectivityTest" - ] - }, - "ListConnectivityTests": { - "methods": [ - "listConnectivityTests", - "listConnectivityTestsStream", - "listConnectivityTestsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/index.ts deleted file mode 100644 index ffe401de1fe..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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 {ReachabilityServiceClient} from './reachability_service_client'; diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_client.ts b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_client.ts deleted file mode 100644 index 9a44026ce70..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_client.ts +++ /dev/null @@ -1,1139 +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, GrpcClientOptions, LROperation, 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/v1beta1/reachability_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './reachability_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The Reachability service in the Google Cloud Network Management API provides - * services that analyze the reachability within a single Google Virtual Private - * Cloud (VPC) network, between peered VPC networks, between VPC and on-premises - * networks, or between VPC networks and internet hosts. A reachability analysis - * is based on Google Cloud network configurations. - * - * You can use the analysis results to verify these configurations and - * to troubleshoot connectivity issues. - * @class - * @memberof v1beta1 - */ -export class ReachabilityServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - reachabilityServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ReachabilityServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 ReachabilityServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ReachabilityServiceClient; - 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 { - 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 = { - connectivityTestPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/global/connectivityTests/{test}' - ), - }; - - // 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 = { - listConnectivityTests: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta1/{resource=projects/*/locations/global/connectivityTests/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta1/{resource=projects/*/locations/global/connectivityTests/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta1/{resource=projects/*/locations/global/connectivityTests/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=projects/*/locations/global/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/{name=projects/*/locations/global}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createConnectivityTestResponse = protoFilesRoot.lookup( - '.google.cloud.networkmanagement.v1beta1.ConnectivityTest') as gax.protobuf.Type; - const createConnectivityTestMetadata = protoFilesRoot.lookup( - '.google.cloud.networkmanagement.v1beta1.OperationMetadata') as gax.protobuf.Type; - const updateConnectivityTestResponse = protoFilesRoot.lookup( - '.google.cloud.networkmanagement.v1beta1.ConnectivityTest') as gax.protobuf.Type; - const updateConnectivityTestMetadata = protoFilesRoot.lookup( - '.google.cloud.networkmanagement.v1beta1.OperationMetadata') as gax.protobuf.Type; - const rerunConnectivityTestResponse = protoFilesRoot.lookup( - '.google.cloud.networkmanagement.v1beta1.ConnectivityTest') as gax.protobuf.Type; - const rerunConnectivityTestMetadata = protoFilesRoot.lookup( - '.google.cloud.networkmanagement.v1beta1.OperationMetadata') as gax.protobuf.Type; - const deleteConnectivityTestResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteConnectivityTestMetadata = protoFilesRoot.lookup( - '.google.cloud.networkmanagement.v1beta1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createConnectivityTest: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createConnectivityTestResponse.decode.bind(createConnectivityTestResponse), - createConnectivityTestMetadata.decode.bind(createConnectivityTestMetadata)), - updateConnectivityTest: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateConnectivityTestResponse.decode.bind(updateConnectivityTestResponse), - updateConnectivityTestMetadata.decode.bind(updateConnectivityTestMetadata)), - rerunConnectivityTest: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - rerunConnectivityTestResponse.decode.bind(rerunConnectivityTestResponse), - rerunConnectivityTestMetadata.decode.bind(rerunConnectivityTestMetadata)), - deleteConnectivityTest: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteConnectivityTestResponse.decode.bind(deleteConnectivityTestResponse), - deleteConnectivityTestMetadata.decode.bind(deleteConnectivityTestMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networkmanagement.v1beta1.ReachabilityService', 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.reachabilityServiceStub) { - return this.reachabilityServiceStub; - } - - // Put together the "service stub" for - // google.cloud.networkmanagement.v1beta1.ReachabilityService. - this.reachabilityServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networkmanagement.v1beta1.ReachabilityService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networkmanagement.v1beta1.ReachabilityService, - 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 reachabilityServiceStubMethods = - ['listConnectivityTests', 'getConnectivityTest', 'createConnectivityTest', 'updateConnectivityTest', 'rerunConnectivityTest', 'deleteConnectivityTest']; - for (const methodName of reachabilityServiceStubMethods) { - const callPromise = this.reachabilityServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.reachabilityServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'networkmanagement.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 'networkmanagement.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 -- - // ------------------- -/** - * Gets the details of a specific Connectivity Test. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. `ConnectivityTest` resource name using the form: - * `projects/{project_id}/locations/global/connectivityTests/{test_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 protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest|ConnectivityTest}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/reachability_service.get_connectivity_test.js - * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_GetConnectivityTest_async - */ - getConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest, - protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest|undefined, {}|undefined - ]>; - getConnectivityTest( - request: protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest, - protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest|null|undefined, - {}|null|undefined>): void; - getConnectivityTest( - request: protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest, - callback: Callback< - protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest, - protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest|null|undefined, - {}|null|undefined>): void; - getConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest, - protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest, - protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest, - protos.google.cloud.networkmanagement.v1beta1.IGetConnectivityTestRequest|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.getConnectivityTest(request, options, callback); - } - -/** - * Creates a new Connectivity Test. - * After you create a test, the reachability analysis is performed as part - * of the long running operation, which completes when the analysis completes. - * - * If the endpoint specifications in `ConnectivityTest` are invalid - * (for example, containing non-existent resources in the network, or you - * don't have read permissions to the network configurations of listed - * projects), then the reachability result returns a value of `UNKNOWN`. - * - * If the endpoint specifications in `ConnectivityTest` are - * incomplete, the reachability result returns a value of - * AMBIGUOUS. For more information, - * see the Connectivity Test documentation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the Connectivity Test to create: - * `projects/{project_id}/locations/global` - * @param {string} request.testId - * Required. The logical name of the Connectivity Test in your project - * with the following restrictions: - * - * * Must contain only lowercase letters, numbers, and hyphens. - * * Must start with a letter. - * * Must be between 1-40 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project - * @param {google.cloud.networkmanagement.v1beta1.ConnectivityTest} request.resource - * Required. A `ConnectivityTest` 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/reachability_service.create_connectivity_test.js - * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_CreateConnectivityTest_async - */ - createConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1beta1.ICreateConnectivityTestRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createConnectivityTest( - request: protos.google.cloud.networkmanagement.v1beta1.ICreateConnectivityTestRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConnectivityTest( - request: protos.google.cloud.networkmanagement.v1beta1.ICreateConnectivityTestRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1beta1.ICreateConnectivityTestRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createConnectivityTest(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createConnectivityTest()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/reachability_service.create_connectivity_test.js - * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_CreateConnectivityTest_async - */ - async checkCreateConnectivityTestProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConnectivityTest, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the configuration of an existing `ConnectivityTest`. - * After you update a test, the reachability analysis is performed as part - * of the long running operation, which completes when the analysis completes. - * The Reachability state in the test resource is updated with the new result. - * - * If the endpoint specifications in `ConnectivityTest` are invalid - * (for example, they contain non-existent resources in the network, or the - * user does not have read permissions to the network configurations of - * listed projects), then the reachability result returns a value of - * UNKNOWN. - * - * If the endpoint specifications in `ConnectivityTest` are incomplete, the - * reachability result returns a value of `AMBIGUOUS`. See the documentation - * in `ConnectivityTest` for for more details. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. At least one path must be supplied in - * this field. - * @param {google.cloud.networkmanagement.v1beta1.ConnectivityTest} request.resource - * Required. Only fields specified in update_mask are updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/reachability_service.update_connectivity_test.js - * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_UpdateConnectivityTest_async - */ - updateConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1beta1.IUpdateConnectivityTestRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateConnectivityTest( - request: protos.google.cloud.networkmanagement.v1beta1.IUpdateConnectivityTestRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateConnectivityTest( - request: protos.google.cloud.networkmanagement.v1beta1.IUpdateConnectivityTestRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1beta1.IUpdateConnectivityTestRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource.name': request.resource!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateConnectivityTest(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateConnectivityTest()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/reachability_service.update_connectivity_test.js - * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_UpdateConnectivityTest_async - */ - async checkUpdateConnectivityTestProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateConnectivityTest, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Rerun an existing `ConnectivityTest`. - * After the user triggers the rerun, the reachability analysis is performed - * as part of the long running operation, which completes when the analysis - * completes. - * - * Even though the test configuration remains the same, the reachability - * result may change due to underlying network configuration changes. - * - * If the endpoint specifications in `ConnectivityTest` become invalid (for - * example, specified resources are deleted in the network, or you lost - * read permissions to the network configurations of listed projects), then - * the reachability result returns a value of `UNKNOWN`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Connectivity Test resource name using the form: - * `projects/{project_id}/locations/global/connectivityTests/{test_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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/reachability_service.rerun_connectivity_test.js - * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_RerunConnectivityTest_async - */ - rerunConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1beta1.IRerunConnectivityTestRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - rerunConnectivityTest( - request: protos.google.cloud.networkmanagement.v1beta1.IRerunConnectivityTestRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - rerunConnectivityTest( - request: protos.google.cloud.networkmanagement.v1beta1.IRerunConnectivityTestRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - rerunConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1beta1.IRerunConnectivityTestRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.rerunConnectivityTest(request, options, callback); - } -/** - * Check the status of the long running operation returned by `rerunConnectivityTest()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/reachability_service.rerun_connectivity_test.js - * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_RerunConnectivityTest_async - */ - async checkRerunConnectivityTestProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.rerunConnectivityTest, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a specific `ConnectivityTest`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Connectivity Test resource name using the form: - * `projects/{project_id}/locations/global/connectivityTests/{test_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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/reachability_service.delete_connectivity_test.js - * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_DeleteConnectivityTest_async - */ - deleteConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1beta1.IDeleteConnectivityTestRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteConnectivityTest( - request: protos.google.cloud.networkmanagement.v1beta1.IDeleteConnectivityTestRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConnectivityTest( - request: protos.google.cloud.networkmanagement.v1beta1.IDeleteConnectivityTestRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConnectivityTest( - request?: protos.google.cloud.networkmanagement.v1beta1.IDeleteConnectivityTestRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteConnectivityTest(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteConnectivityTest()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/reachability_service.delete_connectivity_test.js - * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_DeleteConnectivityTest_async - */ - async checkDeleteConnectivityTestProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConnectivityTest, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all Connectivity Tests owned by a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the Connectivity Tests: - * `projects/{project_id}/locations/global` - * @param {number} request.pageSize - * Number of `ConnectivityTests` to return. - * @param {string} request.pageToken - * Page token from an earlier query, as returned in `next_page_token`. - * @param {string} request.filter - * Lists the `ConnectivityTests` that match the filter expression. A filter - * expression filters the resources listed in the response. The expression - * must be of the form ` ` where operators: `<`, `>`, - * `<=`, - * `>=`, - * `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is - * roughly synonymous with equality). can refer to a proto or JSON - * field, or a synthetic field. Field names can be camelCase or snake_case. - * - * Examples: - * - Filter by name: - * name = "projects/proj-1/locations/global/connectivityTests/test-1 - * - * - Filter by labels: - * - Resources that have a key called `foo` - * labels.foo:* - * - Resources that have a key called `foo` whose value is `bar` - * labels.foo = bar - * @param {string} request.orderBy - * Field to use to sort the list. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest|ConnectivityTest}. - * 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 `listConnectivityTestsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listConnectivityTests( - request?: protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest[], - protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest|null, - protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsResponse - ]>; - listConnectivityTests( - request: protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, - protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsResponse|null|undefined, - protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest>): void; - listConnectivityTests( - request: protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, - callback: PaginationCallback< - protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, - protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsResponse|null|undefined, - protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest>): void; - listConnectivityTests( - request?: protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, - protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsResponse|null|undefined, - protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest>, - callback?: PaginationCallback< - protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, - protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsResponse|null|undefined, - protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest>): - Promise<[ - protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest[], - protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest|null, - protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listConnectivityTests(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the Connectivity Tests: - * `projects/{project_id}/locations/global` - * @param {number} request.pageSize - * Number of `ConnectivityTests` to return. - * @param {string} request.pageToken - * Page token from an earlier query, as returned in `next_page_token`. - * @param {string} request.filter - * Lists the `ConnectivityTests` that match the filter expression. A filter - * expression filters the resources listed in the response. The expression - * must be of the form ` ` where operators: `<`, `>`, - * `<=`, - * `>=`, - * `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is - * roughly synonymous with equality). can refer to a proto or JSON - * field, or a synthetic field. Field names can be camelCase or snake_case. - * - * Examples: - * - Filter by name: - * name = "projects/proj-1/locations/global/connectivityTests/test-1 - * - * - Filter by labels: - * - Resources that have a key called `foo` - * labels.foo:* - * - Resources that have a key called `foo` whose value is `bar` - * labels.foo = bar - * @param {string} request.orderBy - * Field to use to sort the list. - * @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 protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest|ConnectivityTest} 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 `listConnectivityTestsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listConnectivityTestsStream( - request?: protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, - 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['listConnectivityTests']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConnectivityTests.createStream( - this.innerApiCalls.listConnectivityTests as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listConnectivityTests`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the Connectivity Tests: - * `projects/{project_id}/locations/global` - * @param {number} request.pageSize - * Number of `ConnectivityTests` to return. - * @param {string} request.pageToken - * Page token from an earlier query, as returned in `next_page_token`. - * @param {string} request.filter - * Lists the `ConnectivityTests` that match the filter expression. A filter - * expression filters the resources listed in the response. The expression - * must be of the form ` ` where operators: `<`, `>`, - * `<=`, - * `>=`, - * `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is - * roughly synonymous with equality). can refer to a proto or JSON - * field, or a synthetic field. Field names can be camelCase or snake_case. - * - * Examples: - * - Filter by name: - * name = "projects/proj-1/locations/global/connectivityTests/test-1 - * - * - Filter by labels: - * - Resources that have a key called `foo` - * labels.foo:* - * - Resources that have a key called `foo` whose value is `bar` - * labels.foo = bar - * @param {string} request.orderBy - * Field to use to sort the list. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest|ConnectivityTest}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/reachability_service.list_connectivity_tests.js - * region_tag:networkmanagement_v1beta1_generated_ReachabilityService_ListConnectivityTests_async - */ - listConnectivityTestsAsync( - request?: protos.google.cloud.networkmanagement.v1beta1.IListConnectivityTestsRequest, - 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['listConnectivityTests']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConnectivityTests.asyncIterate( - this.innerApiCalls['listConnectivityTests'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified connectivityTest resource name string. - * - * @param {string} project - * @param {string} test - * @returns {string} Resource name string. - */ - connectivityTestPath(project:string,test:string) { - return this.pathTemplates.connectivityTestPathTemplate.render({ - project: project, - test: test, - }); - } - - /** - * Parse the project from ConnectivityTest resource. - * - * @param {string} connectivityTestName - * A fully-qualified path representing ConnectivityTest resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConnectivityTestName(connectivityTestName: string) { - return this.pathTemplates.connectivityTestPathTemplate.match(connectivityTestName).project; - } - - /** - * Parse the test from ConnectivityTest resource. - * - * @param {string} connectivityTestName - * A fully-qualified path representing ConnectivityTest resource. - * @returns {string} A string representing the test. - */ - matchTestFromConnectivityTestName(connectivityTestName: string) { - return this.pathTemplates.connectivityTestPathTemplate.match(connectivityTestName).test; - } - - /** - * 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.reachabilityServiceStub && !this._terminated) { - return this.reachabilityServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_client_config.json b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_client_config.json deleted file mode 100644 index 0d2fd849ae5..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_client_config.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "interfaces": { - "google.cloud.networkmanagement.v1beta1.ReachabilityService": { - "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": { - "ListConnectivityTests": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetConnectivityTest": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateConnectivityTest": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateConnectivityTest": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RerunConnectivityTest": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteConnectivityTest": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_proto_list.json b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_proto_list.json deleted file mode 100644 index 7b7d6d56cc1..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/src/v1beta1/reachability_service_proto_list.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "../../protos/google/cloud/networkmanagement/v1beta1/connectivity_test.proto", - "../../protos/google/cloud/networkmanagement/v1beta1/reachability.proto", - "../../protos/google/cloud/networkmanagement/v1beta1/trace.proto" -] diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index fd277b9a109..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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 networkmanagement = require('@google-cloud/network-management'); - -function main() { - const reachabilityServiceClient = new networkmanagement.ReachabilityServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 1a6b5c88dd3..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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 {ReachabilityServiceClient} from '@google-cloud/network-management'; - -// check that the client class type name can be used -function doStuffWithReachabilityServiceClient(client: ReachabilityServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const reachabilityServiceClient = new ReachabilityServiceClient(); - doStuffWithReachabilityServiceClient(reachabilityServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1beta1/test/gapic_reachability_service_v1beta1.ts b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/test/gapic_reachability_service_v1beta1.ts deleted file mode 100644 index cb9ff3fce3d..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/test/gapic_reachability_service_v1beta1.ts +++ /dev/null @@ -1,1227 +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 reachabilityserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.ReachabilityServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = reachabilityserviceModule.v1beta1.ReachabilityServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = reachabilityserviceModule.v1beta1.ReachabilityServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = reachabilityserviceModule.v1beta1.ReachabilityServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.reachabilityServiceStub, undefined); - await client.initialize(); - assert(client.reachabilityServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.reachabilityServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.reachabilityServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - 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 reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - 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('getConnectivityTest', () => { - it('invokes getConnectivityTest without error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.GetConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.GetConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest() - ); - client.innerApiCalls.getConnectivityTest = stubSimpleCall(expectedResponse); - const [response] = await client.getConnectivityTest(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectivityTest without error using callback', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.GetConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.GetConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest() - ); - client.innerApiCalls.getConnectivityTest = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConnectivityTest( - request, - (err?: Error|null, result?: protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectivityTest with error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.GetConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.GetConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConnectivityTest = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConnectivityTest(request), expectedError); - const actualRequest = (client.innerApiCalls.getConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectivityTest with closed client', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.GetConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.GetConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getConnectivityTest(request), expectedError); - }); - }); - - describe('createConnectivityTest', () => { - it('invokes createConnectivityTest without error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConnectivityTest = stubLongRunningCall(expectedResponse); - const [operation] = await client.createConnectivityTest(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnectivityTest without error using callback', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConnectivityTest = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createConnectivityTest( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnectivityTest with call error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConnectivityTest = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createConnectivityTest(request), expectedError); - const actualRequest = (client.innerApiCalls.createConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnectivityTest with LRO error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConnectivityTest = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createConnectivityTest(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateConnectivityTestProgress without error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateConnectivityTestProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateConnectivityTestProgress with error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateConnectivityTestProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateConnectivityTest', () => { - it('invokes updateConnectivityTest without error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.UpdateConnectivityTestRequest() - ); - request.resource ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.UpdateConnectivityTestRequest', ['resource', 'name']); - request.resource.name = defaultValue1; - const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateConnectivityTest = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateConnectivityTest(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnectivityTest without error using callback', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.UpdateConnectivityTestRequest() - ); - request.resource ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.UpdateConnectivityTestRequest', ['resource', 'name']); - request.resource.name = defaultValue1; - const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateConnectivityTest = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateConnectivityTest( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnectivityTest with call error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.UpdateConnectivityTestRequest() - ); - request.resource ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.UpdateConnectivityTestRequest', ['resource', 'name']); - request.resource.name = defaultValue1; - const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateConnectivityTest = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateConnectivityTest(request), expectedError); - const actualRequest = (client.innerApiCalls.updateConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnectivityTest with LRO error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.UpdateConnectivityTestRequest() - ); - request.resource ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.UpdateConnectivityTestRequest', ['resource', 'name']); - request.resource.name = defaultValue1; - const expectedHeaderRequestParams = `resource.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateConnectivityTest = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateConnectivityTest(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateConnectivityTestProgress without error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateConnectivityTestProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateConnectivityTestProgress with error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateConnectivityTestProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('rerunConnectivityTest', () => { - it('invokes rerunConnectivityTest without error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.RerunConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.RerunConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.rerunConnectivityTest = stubLongRunningCall(expectedResponse); - const [operation] = await client.rerunConnectivityTest(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rerunConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rerunConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rerunConnectivityTest without error using callback', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.RerunConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.RerunConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.rerunConnectivityTest = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rerunConnectivityTest( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rerunConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rerunConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rerunConnectivityTest with call error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.RerunConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.RerunConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rerunConnectivityTest = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.rerunConnectivityTest(request), expectedError); - const actualRequest = (client.innerApiCalls.rerunConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rerunConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rerunConnectivityTest with LRO error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.RerunConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.RerunConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rerunConnectivityTest = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.rerunConnectivityTest(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.rerunConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rerunConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRerunConnectivityTestProgress without error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRerunConnectivityTestProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRerunConnectivityTestProgress with error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRerunConnectivityTestProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteConnectivityTest', () => { - it('invokes deleteConnectivityTest without error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.DeleteConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.DeleteConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConnectivityTest = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteConnectivityTest(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnectivityTest without error using callback', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.DeleteConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.DeleteConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConnectivityTest = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteConnectivityTest( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnectivityTest with call error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.DeleteConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.DeleteConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConnectivityTest = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteConnectivityTest(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnectivityTest with LRO error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.DeleteConnectivityTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.DeleteConnectivityTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConnectivityTest = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteConnectivityTest(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteConnectivityTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectivityTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteConnectivityTestProgress without error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteConnectivityTestProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteConnectivityTestProgress with error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteConnectivityTestProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listConnectivityTests', () => { - it('invokes listConnectivityTests without error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), - generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), - generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), - ]; - client.innerApiCalls.listConnectivityTests = stubSimpleCall(expectedResponse); - const [response] = await client.listConnectivityTests(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConnectivityTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectivityTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnectivityTests without error using callback', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), - generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), - generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), - ]; - client.innerApiCalls.listConnectivityTests = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listConnectivityTests( - request, - (err?: Error|null, result?: protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConnectivityTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectivityTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnectivityTests with error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listConnectivityTests = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConnectivityTests(request), expectedError); - const actualRequest = (client.innerApiCalls.listConnectivityTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectivityTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnectivityTestsStream without error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), - generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), - generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), - ]; - client.descriptors.page.listConnectivityTests.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listConnectivityTestsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest[] = []; - stream.on('data', (response: protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest) => { - 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.listConnectivityTests.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConnectivityTests, request)); - assert( - (client.descriptors.page.listConnectivityTests.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listConnectivityTestsStream with error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConnectivityTests.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listConnectivityTestsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest[] = []; - stream.on('data', (response: protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listConnectivityTests.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConnectivityTests, request)); - assert( - (client.descriptors.page.listConnectivityTests.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConnectivityTests without error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), - generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), - generateSampleMessage(new protos.google.cloud.networkmanagement.v1beta1.ConnectivityTest()), - ]; - client.descriptors.page.listConnectivityTests.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest[] = []; - const iterable = client.listConnectivityTestsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listConnectivityTests.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConnectivityTests.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConnectivityTests with error', async () => { - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networkmanagement.v1beta1.ListConnectivityTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConnectivityTests.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listConnectivityTestsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networkmanagement.v1beta1.IConnectivityTest[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listConnectivityTests.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConnectivityTests.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('connectivityTest', () => { - const fakePath = "/rendered/path/connectivityTest"; - const expectedParameters = { - project: "projectValue", - test: "testValue", - }; - const client = new reachabilityserviceModule.v1beta1.ReachabilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.connectivityTestPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.connectivityTestPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('connectivityTestPath', () => { - const result = client.connectivityTestPath("projectValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.connectivityTestPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConnectivityTestName', () => { - const result = client.matchProjectFromConnectivityTestName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.connectivityTestPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromConnectivityTestName', () => { - const result = client.matchTestFromConnectivityTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.connectivityTestPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-networkmanagement/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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-networkmanagement/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-networkmanagement/v1beta1/webpack.config.js deleted file mode 100644 index d975be0ab73..00000000000 --- a/owl-bot-staging/google-cloud-networkmanagement/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: 'ReachabilityService', - filename: './reachability-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/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index a838bfd43a5..ea39364b480 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -96,8 +96,7 @@ export class CloudFunctionsServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -105,7 +104,7 @@ export class CloudFunctionsServiceClient { * 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 CloudFunctionsServiceClient({fallback: 'rest'}, gax); + * const client = new CloudFunctionsServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -176,7 +175,7 @@ export class CloudFunctionsServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -222,7 +221,7 @@ export class CloudFunctionsServiceClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-functions/src/v2/function_service_client.ts b/packages/google-cloud-functions/src/v2/function_service_client.ts index 90620e78f05..2b8e71fa6e5 100644 --- a/packages/google-cloud-functions/src/v2/function_service_client.ts +++ b/packages/google-cloud-functions/src/v2/function_service_client.ts @@ -104,8 +104,7 @@ export class FunctionServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -113,7 +112,7 @@ export class FunctionServiceClient { * 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 FunctionServiceClient({fallback: 'rest'}, gax); + * const client = new FunctionServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -185,7 +184,7 @@ export class FunctionServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -255,7 +254,7 @@ export class FunctionServiceClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-functions/src/v2alpha/function_service_client.ts b/packages/google-cloud-functions/src/v2alpha/function_service_client.ts index 0f84ff0ec1b..ca7c6a48fc0 100644 --- a/packages/google-cloud-functions/src/v2alpha/function_service_client.ts +++ b/packages/google-cloud-functions/src/v2alpha/function_service_client.ts @@ -104,8 +104,7 @@ export class FunctionServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -113,7 +112,7 @@ export class FunctionServiceClient { * 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 FunctionServiceClient({fallback: 'rest'}, gax); + * const client = new FunctionServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -185,7 +184,7 @@ export class FunctionServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -255,7 +254,7 @@ export class FunctionServiceClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-functions/src/v2beta/function_service_client.ts b/packages/google-cloud-functions/src/v2beta/function_service_client.ts index 62cc6e9bceb..f9c6b4e3529 100644 --- a/packages/google-cloud-functions/src/v2beta/function_service_client.ts +++ b/packages/google-cloud-functions/src/v2beta/function_service_client.ts @@ -104,8 +104,7 @@ export class FunctionServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -113,7 +112,7 @@ export class FunctionServiceClient { * 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 FunctionServiceClient({fallback: 'rest'}, gax); + * const client = new FunctionServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -185,7 +184,7 @@ export class FunctionServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -255,7 +254,7 @@ export class FunctionServiceClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-gkebackup/src/v1/backup_for_g_k_e_client.ts b/packages/google-cloud-gkebackup/src/v1/backup_for_g_k_e_client.ts index 2eecd77a473..ff544974809 100644 --- a/packages/google-cloud-gkebackup/src/v1/backup_for_g_k_e_client.ts +++ b/packages/google-cloud-gkebackup/src/v1/backup_for_g_k_e_client.ts @@ -100,8 +100,7 @@ export class BackupForGKEClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -109,7 +108,7 @@ export class BackupForGKEClient { * 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 BackupForGKEClient({fallback: 'rest'}, gax); + * const client = new BackupForGKEClient({fallback: true}, gax); * ``` */ constructor( @@ -181,7 +180,7 @@ export class BackupForGKEClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -261,7 +260,7 @@ export class BackupForGKEClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-gkeconnect-gateway/src/v1beta1/gateway_service_client.ts b/packages/google-cloud-gkeconnect-gateway/src/v1beta1/gateway_service_client.ts index 1e84ade326f..9ed73916225 100644 --- a/packages/google-cloud-gkeconnect-gateway/src/v1beta1/gateway_service_client.ts +++ b/packages/google-cloud-gkeconnect-gateway/src/v1beta1/gateway_service_client.ts @@ -91,8 +91,7 @@ export class GatewayServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -100,7 +99,7 @@ export class GatewayServiceClient { * 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 GatewayServiceClient({fallback: 'rest'}, gax); + * const client = new GatewayServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -163,7 +162,7 @@ export class GatewayServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { diff --git a/packages/google-cloud-gkehub/src/v1/gke_hub_client.ts b/packages/google-cloud-gkehub/src/v1/gke_hub_client.ts index 8541f11096d..8ddcf3009a7 100644 --- a/packages/google-cloud-gkehub/src/v1/gke_hub_client.ts +++ b/packages/google-cloud-gkehub/src/v1/gke_hub_client.ts @@ -109,8 +109,7 @@ export class GkeHubClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -118,7 +117,7 @@ export class GkeHubClient { * 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 GkeHubClient({fallback: 'rest'}, gax); + * const client = new GkeHubClient({fallback: true}, gax); * ``` */ constructor( @@ -184,7 +183,7 @@ export class GkeHubClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -235,7 +234,7 @@ export class GkeHubClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-gkehub/src/v1alpha/gke_hub_client.ts b/packages/google-cloud-gkehub/src/v1alpha/gke_hub_client.ts index b951125d3c0..d4479db7a7e 100644 --- a/packages/google-cloud-gkehub/src/v1alpha/gke_hub_client.ts +++ b/packages/google-cloud-gkehub/src/v1alpha/gke_hub_client.ts @@ -106,8 +106,7 @@ export class GkeHubClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -115,7 +114,7 @@ export class GkeHubClient { * 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 GkeHubClient({fallback: 'rest'}, gax); + * const client = new GkeHubClient({fallback: true}, gax); * ``` */ constructor( @@ -181,7 +180,7 @@ export class GkeHubClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -218,7 +217,7 @@ export class GkeHubClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-gkehub/src/v1alpha2/gke_hub_client.ts b/packages/google-cloud-gkehub/src/v1alpha2/gke_hub_client.ts index 1e7879a468c..54429fad04d 100644 --- a/packages/google-cloud-gkehub/src/v1alpha2/gke_hub_client.ts +++ b/packages/google-cloud-gkehub/src/v1alpha2/gke_hub_client.ts @@ -100,8 +100,7 @@ export class GkeHubClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -109,7 +108,7 @@ export class GkeHubClient { * 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 GkeHubClient({fallback: 'rest'}, gax); + * const client = new GkeHubClient({fallback: true}, gax); * ``` */ constructor( @@ -175,7 +174,7 @@ export class GkeHubClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -218,7 +217,7 @@ export class GkeHubClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-gkehub/src/v1beta/gke_hub_client.ts b/packages/google-cloud-gkehub/src/v1beta/gke_hub_client.ts index 93bf8bcab82..948395e0cc0 100644 --- a/packages/google-cloud-gkehub/src/v1beta/gke_hub_client.ts +++ b/packages/google-cloud-gkehub/src/v1beta/gke_hub_client.ts @@ -106,8 +106,7 @@ export class GkeHubClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -115,7 +114,7 @@ export class GkeHubClient { * 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 GkeHubClient({fallback: 'rest'}, gax); + * const client = new GkeHubClient({fallback: true}, gax); * ``` */ constructor( @@ -181,7 +180,7 @@ export class GkeHubClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -218,7 +217,7 @@ export class GkeHubClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-gkehub/src/v1beta1/gke_hub_membership_service_client.ts b/packages/google-cloud-gkehub/src/v1beta1/gke_hub_membership_service_client.ts index b05398985f9..efac80ba982 100644 --- a/packages/google-cloud-gkehub/src/v1beta1/gke_hub_membership_service_client.ts +++ b/packages/google-cloud-gkehub/src/v1beta1/gke_hub_membership_service_client.ts @@ -108,8 +108,7 @@ export class GkeHubMembershipServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -117,7 +116,7 @@ export class GkeHubMembershipServiceClient { * 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 GkeHubMembershipServiceClient({fallback: 'rest'}, gax); + * const client = new GkeHubMembershipServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -190,7 +189,7 @@ export class GkeHubMembershipServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -233,7 +232,7 @@ export class GkeHubMembershipServiceClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-gkemulticloud/src/v1/attached_clusters_client.ts b/packages/google-cloud-gkemulticloud/src/v1/attached_clusters_client.ts index 48a07262dae..41b5054630f 100644 --- a/packages/google-cloud-gkemulticloud/src/v1/attached_clusters_client.ts +++ b/packages/google-cloud-gkemulticloud/src/v1/attached_clusters_client.ts @@ -95,8 +95,7 @@ export class AttachedClustersClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -104,7 +103,7 @@ export class AttachedClustersClient { * 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 AttachedClustersClient({fallback: 'rest'}, gax); + * const client = new AttachedClustersClient({fallback: true}, gax); * ``` */ constructor( @@ -167,7 +166,7 @@ export class AttachedClustersClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -234,7 +233,7 @@ export class AttachedClustersClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-gkemulticloud/src/v1/aws_clusters_client.ts b/packages/google-cloud-gkemulticloud/src/v1/aws_clusters_client.ts index 60009c99929..d16100be427 100644 --- a/packages/google-cloud-gkemulticloud/src/v1/aws_clusters_client.ts +++ b/packages/google-cloud-gkemulticloud/src/v1/aws_clusters_client.ts @@ -94,8 +94,7 @@ export class AwsClustersClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -103,7 +102,7 @@ export class AwsClustersClient { * 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 AwsClustersClient({fallback: 'rest'}, gax); + * const client = new AwsClustersClient({fallback: true}, gax); * ``` */ constructor( @@ -166,7 +165,7 @@ export class AwsClustersClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -238,7 +237,7 @@ export class AwsClustersClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-gkemulticloud/src/v1/azure_clusters_client.ts b/packages/google-cloud-gkemulticloud/src/v1/azure_clusters_client.ts index 365b8144517..954864d257f 100644 --- a/packages/google-cloud-gkemulticloud/src/v1/azure_clusters_client.ts +++ b/packages/google-cloud-gkemulticloud/src/v1/azure_clusters_client.ts @@ -94,8 +94,7 @@ export class AzureClustersClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -103,7 +102,7 @@ export class AzureClustersClient { * 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 AzureClustersClient({fallback: 'rest'}, gax); + * const client = new AzureClustersClient({fallback: true}, gax); * ``` */ constructor( @@ -166,7 +165,7 @@ export class AzureClustersClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -243,7 +242,7 @@ export class AzureClustersClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-gkemulticloud/test/gapic_attached_clusters_v1.ts b/packages/google-cloud-gkemulticloud/test/gapic_attached_clusters_v1.ts index af55abb70b4..190a50de1fa 100644 --- a/packages/google-cloud-gkemulticloud/test/gapic_attached_clusters_v1.ts +++ b/packages/google-cloud-gkemulticloud/test/gapic_attached_clusters_v1.ts @@ -548,8 +548,9 @@ describe('v1.AttachedClustersClient', () => { ); client.innerApiCalls.generateAttachedClusterInstallManifest = stubSimpleCall(expectedResponse); - const [response] = - await client.generateAttachedClusterInstallManifest(request); + const [response] = await client.generateAttachedClusterInstallManifest( + request + ); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( client.innerApiCalls.generateAttachedClusterInstallManifest as SinonStub diff --git a/packages/google-cloud-gsuiteaddons/src/v1/g_suite_add_ons_client.ts b/packages/google-cloud-gsuiteaddons/src/v1/g_suite_add_ons_client.ts index 09b30a1b00d..15cf07d9597 100644 --- a/packages/google-cloud-gsuiteaddons/src/v1/g_suite_add_ons_client.ts +++ b/packages/google-cloud-gsuiteaddons/src/v1/g_suite_add_ons_client.ts @@ -117,8 +117,7 @@ export class GSuiteAddOnsClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -126,7 +125,7 @@ export class GSuiteAddOnsClient { * 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 GSuiteAddOnsClient({fallback: 'rest'}, gax); + * const client = new GSuiteAddOnsClient({fallback: true}, gax); * ``` */ constructor( @@ -192,7 +191,7 @@ export class GSuiteAddOnsClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { 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 b73d801b960..9f5aa7a3c50 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 @@ -90,8 +90,7 @@ export class IdentityAwareProxyAdminServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -99,7 +98,7 @@ export class IdentityAwareProxyAdminServiceClient { * 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); + * const client = new IdentityAwareProxyAdminServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -166,7 +165,7 @@ export class IdentityAwareProxyAdminServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { diff --git a/packages/google-cloud-iap/src/v1/identity_aware_proxy_o_auth_service_client.ts b/packages/google-cloud-iap/src/v1/identity_aware_proxy_o_auth_service_client.ts index 6d7c749e33a..551e280c0d3 100644 --- a/packages/google-cloud-iap/src/v1/identity_aware_proxy_o_auth_service_client.ts +++ b/packages/google-cloud-iap/src/v1/identity_aware_proxy_o_auth_service_client.ts @@ -92,8 +92,7 @@ export class IdentityAwareProxyOAuthServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -101,7 +100,7 @@ export class IdentityAwareProxyOAuthServiceClient { * 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); + * const client = new IdentityAwareProxyOAuthServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -168,7 +167,7 @@ export class IdentityAwareProxyOAuthServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { diff --git a/packages/google-cloud-iap/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts b/packages/google-cloud-iap/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts index bff4a168988..85e6de4d774 100644 --- a/packages/google-cloud-iap/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts +++ b/packages/google-cloud-iap/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts @@ -87,8 +87,7 @@ export class IdentityAwareProxyAdminV1Beta1Client { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -96,7 +95,7 @@ export class IdentityAwareProxyAdminV1Beta1Client { * 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); + * const client = new IdentityAwareProxyAdminV1Beta1Client({fallback: true}, gax); * ``` */ constructor( @@ -163,7 +162,7 @@ export class IdentityAwareProxyAdminV1Beta1Client { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { diff --git a/packages/google-cloud-iap/test/gapic_identity_aware_proxy_o_auth_service_v1.ts b/packages/google-cloud-iap/test/gapic_identity_aware_proxy_o_auth_service_v1.ts index 1e5d76a0f1a..2d18656a191 100644 --- a/packages/google-cloud-iap/test/gapic_identity_aware_proxy_o_auth_service_v1.ts +++ b/packages/google-cloud-iap/test/gapic_identity_aware_proxy_o_auth_service_v1.ts @@ -995,8 +995,9 @@ describe('v1.IdentityAwareProxyOAuthServiceClient', () => { ); client.innerApiCalls.resetIdentityAwareProxyClientSecret = stubSimpleCall(expectedResponse); - const [response] = - await client.resetIdentityAwareProxyClientSecret(request); + const [response] = await client.resetIdentityAwareProxyClientSecret( + request + ); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( client.innerApiCalls.resetIdentityAwareProxyClientSecret as SinonStub diff --git a/packages/google-cloud-ids/src/v1/i_d_s_client.ts b/packages/google-cloud-ids/src/v1/i_d_s_client.ts index 7f5c3e8cc2b..9e93d835173 100644 --- a/packages/google-cloud-ids/src/v1/i_d_s_client.ts +++ b/packages/google-cloud-ids/src/v1/i_d_s_client.ts @@ -93,8 +93,7 @@ export class IDSClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -102,7 +101,7 @@ export class IDSClient { * 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 IDSClient({fallback: 'rest'}, gax); + * const client = new IDSClient({fallback: true}, gax); * ``` */ constructor( @@ -168,7 +167,7 @@ export class IDSClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -211,7 +210,7 @@ export class IDSClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-iot/src/v1/device_manager_client.ts b/packages/google-cloud-iot/src/v1/device_manager_client.ts index c4f63f85490..52765d0b7a6 100644 --- a/packages/google-cloud-iot/src/v1/device_manager_client.ts +++ b/packages/google-cloud-iot/src/v1/device_manager_client.ts @@ -90,8 +90,7 @@ export class DeviceManagerClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -99,7 +98,7 @@ export class DeviceManagerClient { * 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 DeviceManagerClient({fallback: 'rest'}, gax); + * const client = new DeviceManagerClient({fallback: true}, gax); * ``` */ constructor( @@ -165,7 +164,7 @@ export class DeviceManagerClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { diff --git a/packages/google-cloud-kms-inventory/src/v1/key_dashboard_service_client.ts b/packages/google-cloud-kms-inventory/src/v1/key_dashboard_service_client.ts index 55209daf44e..833c66610a7 100644 --- a/packages/google-cloud-kms-inventory/src/v1/key_dashboard_service_client.ts +++ b/packages/google-cloud-kms-inventory/src/v1/key_dashboard_service_client.ts @@ -90,8 +90,7 @@ export class KeyDashboardServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -99,7 +98,7 @@ export class KeyDashboardServiceClient { * 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 KeyDashboardServiceClient({fallback: 'rest'}, gax); + * const client = new KeyDashboardServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -165,7 +164,7 @@ export class KeyDashboardServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { diff --git a/packages/google-cloud-kms-inventory/src/v1/key_tracking_service_client.ts b/packages/google-cloud-kms-inventory/src/v1/key_tracking_service_client.ts index 9289fce7a85..0e39305a791 100644 --- a/packages/google-cloud-kms-inventory/src/v1/key_tracking_service_client.ts +++ b/packages/google-cloud-kms-inventory/src/v1/key_tracking_service_client.ts @@ -91,8 +91,7 @@ export class KeyTrackingServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -100,7 +99,7 @@ export class KeyTrackingServiceClient { * 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 KeyTrackingServiceClient({fallback: 'rest'}, gax); + * const client = new KeyTrackingServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -166,7 +165,7 @@ export class KeyTrackingServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { diff --git a/packages/google-cloud-kms/src/v1/ekm_service_client.ts b/packages/google-cloud-kms/src/v1/ekm_service_client.ts index e40c57277ac..b21fa8cfb70 100644 --- a/packages/google-cloud-kms/src/v1/ekm_service_client.ts +++ b/packages/google-cloud-kms/src/v1/ekm_service_client.ts @@ -100,8 +100,7 @@ export class EkmServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -109,7 +108,7 @@ export class EkmServiceClient { * HTTP implementation. Load only fallback version and pass it to the constructor: * ``` * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new EkmServiceClient({fallback: 'rest'}, gax); + * const client = new EkmServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -181,7 +180,7 @@ export class EkmServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { diff --git a/packages/google-cloud-kms/src/v1/key_management_service_client.ts b/packages/google-cloud-kms/src/v1/key_management_service_client.ts index b755e871a25..7422dc13a21 100644 --- a/packages/google-cloud-kms/src/v1/key_management_service_client.ts +++ b/packages/google-cloud-kms/src/v1/key_management_service_client.ts @@ -107,8 +107,7 @@ export class KeyManagementServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -116,7 +115,7 @@ export class KeyManagementServiceClient { * HTTP implementation. Load only fallback version and pass it to the constructor: * ``` * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new KeyManagementServiceClient({fallback: 'rest'}, gax); + * const client = new KeyManagementServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -188,7 +187,7 @@ export class KeyManagementServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { diff --git a/packages/google-cloud-language/src/v1/language_service_client.ts b/packages/google-cloud-language/src/v1/language_service_client.ts index 212a4605568..65d2b327446 100644 --- a/packages/google-cloud-language/src/v1/language_service_client.ts +++ b/packages/google-cloud-language/src/v1/language_service_client.ts @@ -88,8 +88,7 @@ export class LanguageServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -97,7 +96,7 @@ export class LanguageServiceClient { * 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 LanguageServiceClient({fallback: 'rest'}, gax); + * const client = new LanguageServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -163,7 +162,7 @@ export class LanguageServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { diff --git a/packages/google-cloud-language/src/v1beta2/language_service_client.ts b/packages/google-cloud-language/src/v1beta2/language_service_client.ts index 972f699a449..48b895cccba 100644 --- a/packages/google-cloud-language/src/v1beta2/language_service_client.ts +++ b/packages/google-cloud-language/src/v1beta2/language_service_client.ts @@ -88,8 +88,7 @@ export class LanguageServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -97,7 +96,7 @@ export class LanguageServiceClient { * 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 LanguageServiceClient({fallback: 'rest'}, gax); + * const client = new LanguageServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -163,7 +162,7 @@ export class LanguageServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { diff --git a/packages/google-cloud-language/src/v2/language_service_client.ts b/packages/google-cloud-language/src/v2/language_service_client.ts index fd0f65740d4..6056100bc72 100644 --- a/packages/google-cloud-language/src/v2/language_service_client.ts +++ b/packages/google-cloud-language/src/v2/language_service_client.ts @@ -88,8 +88,7 @@ export class LanguageServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -97,7 +96,7 @@ export class LanguageServiceClient { * 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 LanguageServiceClient({fallback: 'rest'}, gax); + * const client = new LanguageServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -163,7 +162,7 @@ export class LanguageServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { diff --git a/packages/google-cloud-lifesciences/src/v2beta/workflows_service_v2_beta_client.ts b/packages/google-cloud-lifesciences/src/v2beta/workflows_service_v2_beta_client.ts index bc5edde774f..31a7af18fcc 100644 --- a/packages/google-cloud-lifesciences/src/v2beta/workflows_service_v2_beta_client.ts +++ b/packages/google-cloud-lifesciences/src/v2beta/workflows_service_v2_beta_client.ts @@ -94,8 +94,7 @@ export class WorkflowsServiceV2BetaClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -103,7 +102,7 @@ export class WorkflowsServiceV2BetaClient { * 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 WorkflowsServiceV2BetaClient({fallback: 'rest'}, gax); + * const client = new WorkflowsServiceV2BetaClient({fallback: true}, gax); * ``` */ constructor( @@ -174,7 +173,7 @@ export class WorkflowsServiceV2BetaClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -191,7 +190,7 @@ export class WorkflowsServiceV2BetaClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-managedidentities/src/v1/managed_identities_service_client.ts b/packages/google-cloud-managedidentities/src/v1/managed_identities_service_client.ts index 8d626b5b171..d0ef6019159 100644 --- a/packages/google-cloud-managedidentities/src/v1/managed_identities_service_client.ts +++ b/packages/google-cloud-managedidentities/src/v1/managed_identities_service_client.ts @@ -124,8 +124,7 @@ export class ManagedIdentitiesServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -133,7 +132,7 @@ export class ManagedIdentitiesServiceClient { * 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 ManagedIdentitiesServiceClient({fallback: 'rest'}, gax); + * const client = new ManagedIdentitiesServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -200,7 +199,7 @@ export class ManagedIdentitiesServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -243,7 +242,7 @@ export class ManagedIdentitiesServiceClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-managedidentities/src/v1beta1/managed_identities_service_client.ts b/packages/google-cloud-managedidentities/src/v1beta1/managed_identities_service_client.ts index 37caa41de5c..7d33e5ed658 100644 --- a/packages/google-cloud-managedidentities/src/v1beta1/managed_identities_service_client.ts +++ b/packages/google-cloud-managedidentities/src/v1beta1/managed_identities_service_client.ts @@ -92,8 +92,7 @@ export class ManagedIdentitiesServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -101,7 +100,7 @@ export class ManagedIdentitiesServiceClient { * 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 ManagedIdentitiesServiceClient({fallback: 'rest'}, gax); + * const client = new ManagedIdentitiesServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -168,7 +167,7 @@ export class ManagedIdentitiesServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -211,7 +210,7 @@ export class ManagedIdentitiesServiceClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-mediatranslation/src/v1beta1/speech_translation_service_client.ts b/packages/google-cloud-mediatranslation/src/v1beta1/speech_translation_service_client.ts index 78a4f23f038..b7a2d9b52bb 100644 --- a/packages/google-cloud-mediatranslation/src/v1beta1/speech_translation_service_client.ts +++ b/packages/google-cloud-mediatranslation/src/v1beta1/speech_translation_service_client.ts @@ -87,8 +87,7 @@ export class SpeechTranslationServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -96,7 +95,7 @@ export class SpeechTranslationServiceClient { * 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 SpeechTranslationServiceClient({fallback: 'rest'}, gax); + * const client = new SpeechTranslationServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -163,7 +162,7 @@ export class SpeechTranslationServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -177,7 +176,7 @@ export class SpeechTranslationServiceClient { this.descriptors.stream = { streamingTranslateSpeech: new this._gaxModule.StreamDescriptor( this._gaxModule.StreamType.BIDI_STREAMING, - opts.fallback === 'rest' + !!opts.fallback ), }; diff --git a/packages/google-cloud-memcache/src/v1/cloud_memcache_client.ts b/packages/google-cloud-memcache/src/v1/cloud_memcache_client.ts index 8dd14a9cef9..2c1b8ab0e23 100644 --- a/packages/google-cloud-memcache/src/v1/cloud_memcache_client.ts +++ b/packages/google-cloud-memcache/src/v1/cloud_memcache_client.ts @@ -110,8 +110,7 @@ export class CloudMemcacheClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -119,7 +118,7 @@ export class CloudMemcacheClient { * 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 CloudMemcacheClient({fallback: 'rest'}, gax); + * const client = new CloudMemcacheClient({fallback: true}, gax); * ``` */ constructor( @@ -189,7 +188,7 @@ export class CloudMemcacheClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -229,7 +228,7 @@ export class CloudMemcacheClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-memcache/src/v1beta2/cloud_memcache_client.ts b/packages/google-cloud-memcache/src/v1beta2/cloud_memcache_client.ts index a3effaa9830..2abbce65f98 100644 --- a/packages/google-cloud-memcache/src/v1beta2/cloud_memcache_client.ts +++ b/packages/google-cloud-memcache/src/v1beta2/cloud_memcache_client.ts @@ -110,8 +110,7 @@ export class CloudMemcacheClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -119,7 +118,7 @@ export class CloudMemcacheClient { * 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 CloudMemcacheClient({fallback: 'rest'}, gax); + * const client = new CloudMemcacheClient({fallback: true}, gax); * ``` */ constructor( @@ -189,7 +188,7 @@ export class CloudMemcacheClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -229,7 +228,7 @@ export class CloudMemcacheClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-metastore/src/v1/dataproc_metastore_client.ts b/packages/google-cloud-metastore/src/v1/dataproc_metastore_client.ts index d5290b37b67..9d5371b6fcd 100644 --- a/packages/google-cloud-metastore/src/v1/dataproc_metastore_client.ts +++ b/packages/google-cloud-metastore/src/v1/dataproc_metastore_client.ts @@ -115,8 +115,7 @@ export class DataprocMetastoreClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -124,7 +123,7 @@ export class DataprocMetastoreClient { * 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 DataprocMetastoreClient({fallback: 'rest'}, gax); + * const client = new DataprocMetastoreClient({fallback: true}, gax); * ``` */ constructor( @@ -196,7 +195,7 @@ export class DataprocMetastoreClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -261,7 +260,7 @@ export class DataprocMetastoreClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-metastore/src/v1/dataproc_metastore_federation_client.ts b/packages/google-cloud-metastore/src/v1/dataproc_metastore_federation_client.ts index 05aaef75d2f..565881ab1bf 100644 --- a/packages/google-cloud-metastore/src/v1/dataproc_metastore_federation_client.ts +++ b/packages/google-cloud-metastore/src/v1/dataproc_metastore_federation_client.ts @@ -111,8 +111,7 @@ export class DataprocMetastoreFederationClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -120,7 +119,7 @@ export class DataprocMetastoreFederationClient { * 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 DataprocMetastoreFederationClient({fallback: 'rest'}, gax); + * const client = new DataprocMetastoreFederationClient({fallback: true}, gax); * ``` */ constructor( @@ -193,7 +192,7 @@ export class DataprocMetastoreFederationClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -245,7 +244,7 @@ export class DataprocMetastoreFederationClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-metastore/src/v1alpha/dataproc_metastore_client.ts b/packages/google-cloud-metastore/src/v1alpha/dataproc_metastore_client.ts index 5beabd5a497..4b787fd1a81 100644 --- a/packages/google-cloud-metastore/src/v1alpha/dataproc_metastore_client.ts +++ b/packages/google-cloud-metastore/src/v1alpha/dataproc_metastore_client.ts @@ -115,8 +115,7 @@ export class DataprocMetastoreClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -124,7 +123,7 @@ export class DataprocMetastoreClient { * 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 DataprocMetastoreClient({fallback: 'rest'}, gax); + * const client = new DataprocMetastoreClient({fallback: true}, gax); * ``` */ constructor( @@ -196,7 +195,7 @@ export class DataprocMetastoreClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -264,7 +263,7 @@ export class DataprocMetastoreClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-metastore/src/v1alpha/dataproc_metastore_federation_client.ts b/packages/google-cloud-metastore/src/v1alpha/dataproc_metastore_federation_client.ts index 0c8feecfec7..2671cf3b46a 100644 --- a/packages/google-cloud-metastore/src/v1alpha/dataproc_metastore_federation_client.ts +++ b/packages/google-cloud-metastore/src/v1alpha/dataproc_metastore_federation_client.ts @@ -111,8 +111,7 @@ export class DataprocMetastoreFederationClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -120,7 +119,7 @@ export class DataprocMetastoreFederationClient { * 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 DataprocMetastoreFederationClient({fallback: 'rest'}, gax); + * const client = new DataprocMetastoreFederationClient({fallback: true}, gax); * ``` */ constructor( @@ -193,7 +192,7 @@ export class DataprocMetastoreFederationClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -245,7 +244,7 @@ export class DataprocMetastoreFederationClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-metastore/src/v1beta/dataproc_metastore_client.ts b/packages/google-cloud-metastore/src/v1beta/dataproc_metastore_client.ts index bf5ca36523d..574bb5f4850 100644 --- a/packages/google-cloud-metastore/src/v1beta/dataproc_metastore_client.ts +++ b/packages/google-cloud-metastore/src/v1beta/dataproc_metastore_client.ts @@ -115,8 +115,7 @@ export class DataprocMetastoreClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -124,7 +123,7 @@ export class DataprocMetastoreClient { * 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 DataprocMetastoreClient({fallback: 'rest'}, gax); + * const client = new DataprocMetastoreClient({fallback: true}, gax); * ``` */ constructor( @@ -196,7 +195,7 @@ export class DataprocMetastoreClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -264,7 +263,7 @@ export class DataprocMetastoreClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-metastore/src/v1beta/dataproc_metastore_federation_client.ts b/packages/google-cloud-metastore/src/v1beta/dataproc_metastore_federation_client.ts index da5835563bc..7b3b56d649b 100644 --- a/packages/google-cloud-metastore/src/v1beta/dataproc_metastore_federation_client.ts +++ b/packages/google-cloud-metastore/src/v1beta/dataproc_metastore_federation_client.ts @@ -111,8 +111,7 @@ export class DataprocMetastoreFederationClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -120,7 +119,7 @@ export class DataprocMetastoreFederationClient { * 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 DataprocMetastoreFederationClient({fallback: 'rest'}, gax); + * const client = new DataprocMetastoreFederationClient({fallback: true}, gax); * ``` */ constructor( @@ -193,7 +192,7 @@ export class DataprocMetastoreFederationClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -245,7 +244,7 @@ export class DataprocMetastoreFederationClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-migrationcenter/src/v1/migration_center_client.ts b/packages/google-cloud-migrationcenter/src/v1/migration_center_client.ts index f9fa0a9410e..dd728522627 100644 --- a/packages/google-cloud-migrationcenter/src/v1/migration_center_client.ts +++ b/packages/google-cloud-migrationcenter/src/v1/migration_center_client.ts @@ -96,8 +96,7 @@ export class MigrationCenterClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -105,7 +104,7 @@ export class MigrationCenterClient { * 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 MigrationCenterClient({fallback: 'rest'}, gax); + * const client = new MigrationCenterClient({fallback: true}, gax); * ``` */ constructor( @@ -175,7 +174,7 @@ export class MigrationCenterClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -285,7 +284,7 @@ export class MigrationCenterClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-networkconnectivity/src/v1/hub_service_client.ts b/packages/google-cloud-networkconnectivity/src/v1/hub_service_client.ts index 2e2a6086fdf..984af7e1e8b 100644 --- a/packages/google-cloud-networkconnectivity/src/v1/hub_service_client.ts +++ b/packages/google-cloud-networkconnectivity/src/v1/hub_service_client.ts @@ -101,8 +101,7 @@ export class HubServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -110,7 +109,7 @@ export class HubServiceClient { * 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 HubServiceClient({fallback: 'rest'}, gax); + * const client = new HubServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -182,7 +181,7 @@ export class HubServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -242,7 +241,7 @@ export class HubServiceClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-networkconnectivity/src/v1alpha1/hub_service_client.ts b/packages/google-cloud-networkconnectivity/src/v1alpha1/hub_service_client.ts index bd3c3bd89f4..dd9bc493e38 100644 --- a/packages/google-cloud-networkconnectivity/src/v1alpha1/hub_service_client.ts +++ b/packages/google-cloud-networkconnectivity/src/v1alpha1/hub_service_client.ts @@ -96,8 +96,7 @@ export class HubServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -105,7 +104,7 @@ export class HubServiceClient { * 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 HubServiceClient({fallback: 'rest'}, gax); + * const client = new HubServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -171,7 +170,7 @@ export class HubServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -228,7 +227,7 @@ export class HubServiceClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-networkmanagement/src/v1/reachability_service_client.ts b/packages/google-cloud-networkmanagement/src/v1/reachability_service_client.ts index 4a94043c903..9cca80c22cd 100644 --- a/packages/google-cloud-networkmanagement/src/v1/reachability_service_client.ts +++ b/packages/google-cloud-networkmanagement/src/v1/reachability_service_client.ts @@ -100,8 +100,7 @@ export class ReachabilityServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -109,7 +108,7 @@ export class ReachabilityServiceClient { * 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 ReachabilityServiceClient({fallback: 'rest'}, gax); + * const client = new ReachabilityServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -175,7 +174,7 @@ export class ReachabilityServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -212,7 +211,7 @@ export class ReachabilityServiceClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/packages/google-cloud-networkmanagement/src/v1beta1/reachability_service_client.ts b/packages/google-cloud-networkmanagement/src/v1beta1/reachability_service_client.ts index acdf4ef7eca..551ecd60656 100644 --- a/packages/google-cloud-networkmanagement/src/v1beta1/reachability_service_client.ts +++ b/packages/google-cloud-networkmanagement/src/v1beta1/reachability_service_client.ts @@ -100,8 +100,7 @@ export class ReachabilityServiceClient { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * 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 @@ -109,7 +108,7 @@ export class ReachabilityServiceClient { * 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 ReachabilityServiceClient({fallback: 'rest'}, gax); + * const client = new ReachabilityServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -175,7 +174,7 @@ export class ReachabilityServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -212,7 +211,7 @@ export class ReachabilityServiceClient { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ {